mirror of
https://github.com/zadam/trilium.git
synced 2024-12-28 19:04:02 +08:00
137 lines
3.7 KiB
HTML
137 lines
3.7 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<title>JSDoc: Source: note_short.js</title>
|
|
|
|
<script src="scripts/prettify/prettify.js"> </script>
|
|
<script src="scripts/prettify/lang-css.js"> </script>
|
|
<!--[if lt IE 9]>
|
|
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
|
|
<![endif]-->
|
|
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
|
|
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<div id="main">
|
|
|
|
<h1 class="page-title">Source: note_short.js</h1>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<section>
|
|
<article>
|
|
<pre class="prettyprint source linenums"><code>/**
|
|
* This note's representation is used in note tree and is kept in Froca.
|
|
* Its notable omission is the note content.
|
|
*/
|
|
class NoteShort {
|
|
constructor(froca, row) {
|
|
this.froca = froca;
|
|
/** @param {string} */
|
|
this.noteId = row.noteId;
|
|
/** @param {string} */
|
|
this.title = row.title;
|
|
/** @param {boolean} */
|
|
this.isProtected = row.isProtected;
|
|
/** @param {string} one of 'text', 'code', 'file' or 'render' */
|
|
this.type = row.type;
|
|
/** @param {string} content-type, e.g. "application/json" */
|
|
this.mime = row.mime;
|
|
/** @param {boolean} */
|
|
this.archived = row.archived;
|
|
this.cssClass = row.cssClass;
|
|
}
|
|
|
|
/** @returns {boolean} */
|
|
isJson() {
|
|
return this.mime === "application/json";
|
|
}
|
|
|
|
/** @returns {Promise<Array.<Branch>>} */
|
|
async getBranches() {
|
|
const branchIds = this.froca.parents[this.noteId].map(
|
|
parentNoteId => this.froca.getBranchIdByChildParent(this.noteId, parentNoteId));
|
|
|
|
return this.froca.getBranches(branchIds);
|
|
}
|
|
|
|
/** @returns {boolean} */
|
|
hasChildren() {
|
|
return this.froca.children[this.noteId]
|
|
&& this.froca.children[this.noteId].length > 0;
|
|
}
|
|
|
|
/** @returns {Promise<Array.<Branch>>} */
|
|
async getChildBranches() {
|
|
if (!this.froca.children[this.noteId]) {
|
|
return [];
|
|
}
|
|
|
|
const branchIds = this.froca.children[this.noteId].map(
|
|
childNoteId => this.froca.getBranchIdByChildParent(childNoteId, this.noteId));
|
|
|
|
return await this.froca.getBranches(branchIds);
|
|
}
|
|
|
|
/** @returns {Array.<string>} */
|
|
getParentNoteIds() {
|
|
return this.froca.parents[this.noteId] || [];
|
|
}
|
|
|
|
/** @returns {Promise<Array.<NoteShort>>} */
|
|
async getParentNotes() {
|
|
return await this.froca.getNotes(this.getParentNoteIds());
|
|
}
|
|
|
|
/** @returns {Array.<string>} */
|
|
getChildNoteIds() {
|
|
return this.froca.children[this.noteId] || [];
|
|
}
|
|
|
|
/** @returns {Promise<Array.<NoteShort>>} */
|
|
async getChildNotes() {
|
|
return await this.froca.getNotes(this.getChildNoteIds());
|
|
}
|
|
|
|
get toString() {
|
|
return `Note(noteId=${this.noteId}, title=${this.title})`;
|
|
}
|
|
|
|
get dto() {
|
|
const dto = Object.assign({}, this);
|
|
delete dto.froca;
|
|
delete dto.archived;
|
|
|
|
return dto;
|
|
}
|
|
}
|
|
|
|
export default NoteShort;</code></pre>
|
|
</article>
|
|
</section>
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
<nav>
|
|
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Branch.html">Branch</a></li><li><a href="NoteFull.html">NoteFull</a></li><li><a href="NoteShort.html">NoteShort</a></li></ul>
|
|
</nav>
|
|
|
|
<br class="clear">
|
|
|
|
<footer>
|
|
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Thu Aug 23 2018 12:50:56 GMT+0200 (CEST)
|
|
</footer>
|
|
|
|
<script> prettyPrint(); </script>
|
|
<script src="scripts/linenumber.js"> </script>
|
|
</body>
|
|
</html>
|