mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 10:26:08 +01:00 
			
		
		
		
	Compare commits
	
		
			180 Commits
		
	
	
		
			v0.51.0-be
			...
			v0.52.1-be
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|  | ec4fac421b | ||
|  | f587e0dfd9 | ||
|  | b5214e6cea | ||
|  | 5fbaed61c1 | ||
|  | 8fcc76ad6d | ||
|  | 15a9ff4450 | ||
|  | 0a4f419e5e | ||
|  | 7fa531b3d6 | ||
|  | 3cfca27b54 | ||
|  | 103aa95ccf | ||
|  | 339a6d7817 | ||
|  | 93dd9274e7 | ||
|  | ca35527aeb | ||
|  | 388dcadef3 | ||
|  | 8905148dbc | ||
|  | daa36192cc | ||
|  | ade77e5fb8 | ||
|  | f250b72563 | ||
|  | 37cb5f5e9a | ||
|  | 82fcc97ed2 | ||
|  | 53e9c8cdac | ||
|  | 541d451168 | ||
|  | 7c64dc9440 | ||
|  | 27570a7756 | ||
|  | d6931f7441 | ||
|  | 7d39d080f5 | ||
|  | 13ccd2ba67 | ||
|  | 81fd7397e4 | ||
|  | 6f75f944a3 | ||
|  | 308b0f7464 | ||
|  | 678e883044 | ||
|  | 819cf0907d | ||
|  | 942f17b2f4 | ||
|  | 2085dc5ed4 | ||
|  | a1d1b4580a | ||
|  | 9e089cc7cd | ||
|  | cd622cbdd7 | ||
|  | 4978a3ff1a | ||
|  | fca0b82610 | ||
|  | 6cef1082b2 | ||
|  | 37eb16b2f3 | ||
|  | c24c807921 | ||
|  | 5bc629d1c7 | ||
|  | 04379b4e1f | ||
|  | c51e6107a1 | ||
|  | bb7ad496bf | ||
|  | c50d8e85dc | ||
|  | 1d8664927d | ||
|  | dbb5d02ecf | ||
|  | 593a275795 | ||
|  | 6778e1e60e | ||
|  | 36308c307b | ||
|  | 078fc420b0 | ||
|  | 8ec814c29f | ||
|  | e87e065100 | ||
|  | 8318ab7ac0 | ||
|  | 87b75a9a22 | ||
|  | 8df3b0a5bd | ||
|  | 6906c82408 | ||
|  | 45edef2d71 | ||
|  | bf49648896 | ||
|  | 91d23c540a | ||
|  | 1cbf918024 | ||
|  | 26f3c1d453 | ||
|  | c421ee79b0 | ||
|  | 77f8474d83 | ||
|  | 9a04a76672 | ||
|  | 963c18b8e4 | ||
|  | bbbad67764 | ||
|  | 3491e71084 | ||
|  | c85f70e197 | ||
|  | 3df712b64f | ||
|  | 160bd0a790 | ||
|  | 81e0c6dcc2 | ||
|  | 11bd48a1b5 | ||
|  | 61657087f5 | ||
|  | 87f436c6ea | ||
|  | 065e4f55c3 | ||
|  | 92adcf82e4 | ||
|  | 06e0f2418c | ||
|  | 35c4c61d15 | ||
|  | a168edb168 | ||
|  | d2975bbd21 | ||
|  | 358e8c548c | ||
|  | f85ed672cc | ||
|  | 83f1a68bfd | ||
|  | 552e5d7d06 | ||
|  | 9c7f8cf5d8 | ||
|  | f0f9274a3c | ||
|  | 65c725c21e | ||
|  | dfa30358c5 | ||
|  | 2394fe6ed9 | ||
|  | 6cae68288d | ||
|  | 83afb89a16 | ||
|  | 93cc6b12ec | ||
|  | dc35df9f63 | ||
|  | 1a4bc0b989 | ||
|  | a37d75a08f | ||
|  | 8d510a3fdd | ||
|  | 7bcd1c3009 | ||
|  | 5dab189815 | ||
|  | a9dc62505d | ||
|  | 26e1ff4e16 | ||
|  | b3763eed61 | ||
|  | f9c01851ef | ||
|  | 6b61b0604a | ||
|  | f705c432fd | ||
|  | 70edd9a210 | ||
|  | 0a45b58784 | ||
|  | dbd312c88d | ||
|  | 11578b1bc3 | ||
|  | 569c80f551 | ||
|  | 3b58b83f8b | ||
|  | 643a5e5b16 | ||
|  | 4e4010e15e | ||
|  | 6bdaf050c5 | ||
|  | 05c8c6cfaa | ||
|  | 2441515666 | ||
|  | c42bcd6c59 | ||
|  | fc95bb8f18 | ||
|  | cb88f316db | ||
|  | e19ddc10d3 | ||
|  | d3e86acfaa | ||
|  | 536643ed3b | ||
|  | 9771b441ad | ||
|  | c295fdb142 | ||
|  | ee7aa3d3da | ||
|  | e437a9d70f | ||
|  | a8655fcd27 | ||
|  | aefc9f1593 | ||
|  | 73671671d7 | ||
|  | f53a93e828 | ||
|  | e156c6292b | ||
|  | e365521d5e | ||
|  | f354821f25 | ||
|  | 82e278a2a2 | ||
|  | b4d4606c73 | ||
|  | b14b7b6ad1 | ||
|  | 32aa7bb540 | ||
|  | 300f4ad357 | ||
|  | cf6b5c3b6e | ||
|  | f1c9dda366 | ||
|  | 7f01032b6d | ||
|  | f08afd4723 | ||
|  | afe2a03aef | ||
|  | 272bb136d8 | ||
|  | 27d0388d79 | ||
|  | 025032de42 | ||
|  | 15a3b42124 | ||
|  | 4266156cee | ||
|  | 45a66ab694 | ||
|  | 49f4ce7149 | ||
|  | 220df662ad | ||
|  | 6e535bac05 | ||
|  | 3b1dcc7199 | ||
|  | ae75ac424f | ||
|  | 5c46fe792d | ||
|  | a33b0f1e1c | ||
|  | bd28ed07d7 | ||
|  | 12185fbd32 | ||
|  | 24911da8db | ||
|  | da84d16421 | ||
|  | 53666cbfe8 | ||
|  | 8897d98bd9 | ||
|  | 93e485cea9 | ||
|  | 22363f5b74 | ||
|  | 2a2c82cd29 | ||
|  | 5ebe717da8 | ||
|  | 2f2d8327e4 | ||
|  | a894c19c2b | ||
|  | 0469962c5e | ||
|  | f6ebc76917 | ||
|  | 73425ec29d | ||
|  | 51e5f591b2 | ||
|  | d1b3d8a58a | ||
|  | 534c71491b | ||
|  | 987f8e9961 | ||
|  | a45cf033aa | ||
|  | 06b6097f29 | ||
|  | 75c8e700d4 | 
							
								
								
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							| @@ -10,3 +10,4 @@ cert.key | ||||
| cert.crt | ||||
| server-package.json | ||||
| .idea/httpRequests/ | ||||
| data/ | ||||
|   | ||||
| @@ -2,7 +2,7 @@ image: | ||||
|   file: .gitpod.dockerfile | ||||
|  | ||||
| tasks: | ||||
|     - before: nvm install 16.14.2 && nvm use 16.14.2 | ||||
|     - before: nvm install 16.15.0 && nvm use 16.15.0 | ||||
|       init: npm install | ||||
|       command: npm run start-server | ||||
|  | ||||
|   | ||||
							
								
								
									
										11
									
								
								Dockerfile
									
									
									
									
									
								
							
							
						
						
									
										11
									
								
								Dockerfile
									
									
									
									
									
								
							| @@ -1,5 +1,5 @@ | ||||
| # !!! Don't try to build this Dockerfile directly, run it through bin/build-docker.sh script !!! | ||||
| FROM node:16.14.2-alpine | ||||
| FROM node:16.15.0-alpine | ||||
|  | ||||
| # Create app directory | ||||
| WORKDIR /usr/src/app | ||||
| @@ -21,10 +21,15 @@ RUN set -x \ | ||||
|     && npm install --production \ | ||||
|     && apk del .build-dependencies | ||||
|  | ||||
| # Some setup tools need to be kept | ||||
| RUN apk add --no-cache su-exec | ||||
|  | ||||
| # Bundle app source | ||||
| COPY . . | ||||
|  | ||||
| USER node | ||||
| # Add application user and setup proper volume permissions | ||||
| RUN adduser -s /bin/false node; exit 0 | ||||
|  | ||||
| # Start the application | ||||
| EXPOSE 8080 | ||||
| CMD [ "node", "./src/www" ] | ||||
| CMD [ "./start-docker.sh" ] | ||||
|   | ||||
| @@ -1,7 +1,7 @@ | ||||
| #!/usr/bin/env bash | ||||
|  | ||||
| PKG_DIR=dist/trilium-linux-x64-server | ||||
| NODE_VERSION=16.14.2 | ||||
| NODE_VERSION=16.15.0 | ||||
|  | ||||
| if [ "$1" != "DONTCOPY" ] | ||||
| then | ||||
|   | ||||
| @@ -5,7 +5,7 @@ if [[ $# -eq 0 ]] ; then | ||||
|     exit 1 | ||||
| fi | ||||
|  | ||||
| n exec 16.14.2 npm run webpack | ||||
| n exec 16.15.0 npm run webpack | ||||
|  | ||||
| DIR=$1 | ||||
|  | ||||
| @@ -30,7 +30,7 @@ cp -r electron.js $DIR/ | ||||
| cp webpack-* $DIR/ | ||||
|  | ||||
| # run in subshell (so we return to original dir) | ||||
| (cd $DIR && n exec 16.14.2 npm install --only=prod) | ||||
| (cd $DIR && n exec 16.15.0 npm install --only=prod) | ||||
|  | ||||
| # cleanup of useless files in dependencies | ||||
| rm -r $DIR/node_modules/image-q/demo | ||||
|   | ||||
							
								
								
									
										
											BIN
										
									
								
								db/demo.zip
									
									
									
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								db/demo.zip
									
									
									
									
									
								
							
										
											Binary file not shown.
										
									
								
							| @@ -0,0 +1,2 @@ | ||||
| -- removing potential remnants of recent notes in entity changes, see https://github.com/zadam/trilium/issues/2842 | ||||
| DELETE FROM entity_changes WHERE entityName = 'recent_notes'; | ||||
							
								
								
									
										434
									
								
								docs/backend_api/AbstractEntity.html
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										434
									
								
								docs/backend_api/AbstractEntity.html
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,434 @@ | ||||
| <!DOCTYPE html> | ||||
| <html lang="en"> | ||||
| <head> | ||||
|     <meta charset="utf-8"> | ||||
|     <title>JSDoc: Class: AbstractEntity</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">Class: AbstractEntity</h1> | ||||
|  | ||||
|      | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
| <section> | ||||
|  | ||||
| <header> | ||||
|      | ||||
|         <h2><span class="attribs"><span class="type-signature"></span></span>AbstractEntity<span class="signature">()</span><span class="type-signature"></span></h2> | ||||
|          | ||||
|             <div class="class-description">Base class for all backend entities.</div> | ||||
|          | ||||
|      | ||||
| </header> | ||||
|  | ||||
| <article> | ||||
|     <div class="container-overview"> | ||||
|      | ||||
|          | ||||
|  | ||||
|      | ||||
|     <h2>Constructor</h2> | ||||
|      | ||||
|  | ||||
|      | ||||
|     <h4 class="name" id="AbstractEntity"><span class="type-signature"></span>new AbstractEntity<span class="signature">()</span><span class="type-signature"></span></h4> | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
| <dl class="details"> | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|     <dt class="tag-source">Source:</dt> | ||||
|     <dd class="tag-source"><ul class="dummy"><li> | ||||
|         <a href="becca_entities_abstract_entity.js.html">becca/entities/abstract_entity.js</a>, <a href="becca_entities_abstract_entity.js.html#line16">line 16</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
| </dl> | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|      | ||||
|     </div> | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|         <h3 class="subsection-title">Methods</h3> | ||||
|  | ||||
|          | ||||
|              | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|     <h4 class="name" id="markAsDeleted"><span class="type-signature"></span>markAsDeleted<span class="signature">(deleteId<span class="signature-attributes">opt</span>)</span><span class="type-signature"></span></h4> | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|  | ||||
|  | ||||
| <div class="description"> | ||||
|     Mark the entity as (soft) deleted. It will be completely erased later. | ||||
|  | ||||
| This is a low level method, for notes and branches use `note.deleteNote()` and 'branch.deleteBranch()` instead. | ||||
| </div> | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|     <h5>Parameters:</h5> | ||||
|      | ||||
|  | ||||
| <table class="params"> | ||||
|     <thead> | ||||
|     <tr> | ||||
|          | ||||
|         <th>Name</th> | ||||
|          | ||||
|  | ||||
|         <th>Type</th> | ||||
|  | ||||
|          | ||||
|         <th>Attributes</th> | ||||
|          | ||||
|  | ||||
|          | ||||
|         <th>Default</th> | ||||
|          | ||||
|  | ||||
|         <th class="last">Description</th> | ||||
|     </tr> | ||||
|     </thead> | ||||
|  | ||||
|     <tbody> | ||||
|      | ||||
|  | ||||
|         <tr> | ||||
|              | ||||
|                 <td class="name"><code>deleteId</code></td> | ||||
|              | ||||
|  | ||||
|             <td class="type"> | ||||
|              | ||||
|             </td> | ||||
|  | ||||
|              | ||||
|                 <td class="attributes"> | ||||
|                  | ||||
|                     <optional><br> | ||||
|                  | ||||
|  | ||||
|                  | ||||
|  | ||||
|                  | ||||
|                 </td> | ||||
|              | ||||
|  | ||||
|              | ||||
|                 <td class="default"> | ||||
|                  | ||||
|                     null | ||||
|                  | ||||
|                 </td> | ||||
|              | ||||
|  | ||||
|             <td class="description last"></td> | ||||
|         </tr> | ||||
|  | ||||
|      | ||||
|     </tbody> | ||||
| </table> | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
| <dl class="details"> | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|     <dt class="tag-source">Source:</dt> | ||||
|     <dd class="tag-source"><ul class="dummy"><li> | ||||
|         <a href="becca_entities_abstract_entity.js.html">becca/entities/abstract_entity.js</a>, <a href="becca_entities_abstract_entity.js.html#line118">line 118</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
| </dl> | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|          | ||||
|              | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|     <h4 class="name" id="save"><span class="type-signature"></span>save<span class="signature">()</span><span class="type-signature"> → {<a href="AbstractEntity.html">AbstractEntity</a>}</span></h4> | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|  | ||||
|  | ||||
| <div class="description"> | ||||
|     Saves entity - executes SQL, but doesn't commit the transaction on its own | ||||
| </div> | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
| <dl class="details"> | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|     <dt class="tag-source">Source:</dt> | ||||
|     <dd class="tag-source"><ul class="dummy"><li> | ||||
|         <a href="becca_entities_abstract_entity.js.html">becca/entities/abstract_entity.js</a>, <a href="becca_entities_abstract_entity.js.html#line73">line 73</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
| </dl> | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
| <h5>Returns:</h5> | ||||
|  | ||||
|          | ||||
|  | ||||
|  | ||||
| <dl> | ||||
|     <dt> | ||||
|         Type | ||||
|     </dt> | ||||
|     <dd> | ||||
|          | ||||
| <span class="param-type"><a href="AbstractEntity.html">AbstractEntity</a></span> | ||||
|  | ||||
|  | ||||
|     </dd> | ||||
| </dl> | ||||
|  | ||||
|      | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|          | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
| </article> | ||||
|  | ||||
| </section> | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
| </div> | ||||
|  | ||||
| <nav> | ||||
|     <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-sql.html">sql</a></li></ul><h3>Classes</h3><ul><li><a href="AbstractEntity.html">AbstractEntity</a></li><li><a href="Attribute.html">Attribute</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li><li><a href="Branch.html">Branch</a></li><li><a href="EtapiToken.html">EtapiToken</a></li><li><a href="Note.html">Note</a></li><li><a href="NoteRevision.html">NoteRevision</a></li><li><a href="Option.html">Option</a></li><li><a href="RecentNote.html">RecentNote</a></li></ul><h3><a href="global.html">Global</a></h3> | ||||
| </nav> | ||||
|  | ||||
| <br class="clear"> | ||||
|  | ||||
| <footer> | ||||
|     Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> | ||||
| </footer> | ||||
|  | ||||
| <script> prettyPrint(); </script> | ||||
| <script src="scripts/linenumber.js"> </script> | ||||
| </body> | ||||
| </html> | ||||
| @@ -94,7 +94,7 @@ and relation (representing named relationship between source and target note)</d | ||||
|      | ||||
|     <dt class="tag-source">Source:</dt> | ||||
|     <dd class="tag-source"><ul class="dummy"><li> | ||||
|         <a href="becca_entities_attribute.js.html">becca/entities/attribute.js</a>, <a href="becca_entities_attribute.js.html#line13">line 13</a> | ||||
|         <a href="becca_entities_attribute.js.html">becca/entities/attribute.js</a>, <a href="becca_entities_attribute.js.html#line15">line 15</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
| @@ -128,6 +128,17 @@ and relation (representing named relationship between source and target note)</d | ||||
|     </div> | ||||
|  | ||||
|      | ||||
|         <h3 class="subsection-title">Extends</h3> | ||||
|  | ||||
|          | ||||
|  | ||||
|  | ||||
|     <ul> | ||||
|         <li><a href="AbstractEntity.html">AbstractEntity</a></li> | ||||
|     </ul> | ||||
|  | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
| @@ -194,7 +205,7 @@ and relation (representing named relationship between source and target note)</d | ||||
|      | ||||
|     <dt class="tag-source">Source:</dt> | ||||
|     <dd class="tag-source"><ul class="dummy"><li> | ||||
|         <a href="becca_entities_attribute.js.html">becca/entities/attribute.js</a>, <a href="becca_entities_attribute.js.html#line44">line 44</a> | ||||
|         <a href="becca_entities_attribute.js.html">becca/entities/attribute.js</a>, <a href="becca_entities_attribute.js.html#line46">line 46</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
| @@ -262,7 +273,7 @@ and relation (representing named relationship between source and target note)</d | ||||
|      | ||||
|     <dt class="tag-source">Source:</dt> | ||||
|     <dd class="tag-source"><ul class="dummy"><li> | ||||
|         <a href="becca_entities_attribute.js.html">becca/entities/attribute.js</a>, <a href="becca_entities_attribute.js.html#line56">line 56</a> | ||||
|         <a href="becca_entities_attribute.js.html">becca/entities/attribute.js</a>, <a href="becca_entities_attribute.js.html#line58">line 58</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
| @@ -330,7 +341,7 @@ and relation (representing named relationship between source and target note)</d | ||||
|      | ||||
|     <dt class="tag-source">Source:</dt> | ||||
|     <dd class="tag-source"><ul class="dummy"><li> | ||||
|         <a href="becca_entities_attribute.js.html">becca/entities/attribute.js</a>, <a href="becca_entities_attribute.js.html#line50">line 50</a> | ||||
|         <a href="becca_entities_attribute.js.html">becca/entities/attribute.js</a>, <a href="becca_entities_attribute.js.html#line52">line 52</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
| @@ -398,7 +409,7 @@ and relation (representing named relationship between source and target note)</d | ||||
|      | ||||
|     <dt class="tag-source">Source:</dt> | ||||
|     <dd class="tag-source"><ul class="dummy"><li> | ||||
|         <a href="becca_entities_attribute.js.html">becca/entities/attribute.js</a>, <a href="becca_entities_attribute.js.html#line46">line 46</a> | ||||
|         <a href="becca_entities_attribute.js.html">becca/entities/attribute.js</a>, <a href="becca_entities_attribute.js.html#line48">line 48</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
| @@ -466,7 +477,7 @@ and relation (representing named relationship between source and target note)</d | ||||
|      | ||||
|     <dt class="tag-source">Source:</dt> | ||||
|     <dd class="tag-source"><ul class="dummy"><li> | ||||
|         <a href="becca_entities_attribute.js.html">becca/entities/attribute.js</a>, <a href="becca_entities_attribute.js.html#line52">line 52</a> | ||||
|         <a href="becca_entities_attribute.js.html">becca/entities/attribute.js</a>, <a href="becca_entities_attribute.js.html#line54">line 54</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
| @@ -534,7 +545,7 @@ and relation (representing named relationship between source and target note)</d | ||||
|      | ||||
|     <dt class="tag-source">Source:</dt> | ||||
|     <dd class="tag-source"><ul class="dummy"><li> | ||||
|         <a href="becca_entities_attribute.js.html">becca/entities/attribute.js</a>, <a href="becca_entities_attribute.js.html#line48">line 48</a> | ||||
|         <a href="becca_entities_attribute.js.html">becca/entities/attribute.js</a>, <a href="becca_entities_attribute.js.html#line50">line 50</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
| @@ -602,7 +613,7 @@ and relation (representing named relationship between source and target note)</d | ||||
|      | ||||
|     <dt class="tag-source">Source:</dt> | ||||
|     <dd class="tag-source"><ul class="dummy"><li> | ||||
|         <a href="becca_entities_attribute.js.html">becca/entities/attribute.js</a>, <a href="becca_entities_attribute.js.html#line58">line 58</a> | ||||
|         <a href="becca_entities_attribute.js.html">becca/entities/attribute.js</a>, <a href="becca_entities_attribute.js.html#line60">line 60</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
| @@ -670,7 +681,7 @@ and relation (representing named relationship between source and target note)</d | ||||
|      | ||||
|     <dt class="tag-source">Source:</dt> | ||||
|     <dd class="tag-source"><ul class="dummy"><li> | ||||
|         <a href="becca_entities_attribute.js.html">becca/entities/attribute.js</a>, <a href="becca_entities_attribute.js.html#line54">line 54</a> | ||||
|         <a href="becca_entities_attribute.js.html">becca/entities/attribute.js</a>, <a href="becca_entities_attribute.js.html#line56">line 56</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
| @@ -746,7 +757,7 @@ and relation (representing named relationship between source and target note)</d | ||||
|      | ||||
|     <dt class="tag-source">Source:</dt> | ||||
|     <dd class="tag-source"><ul class="dummy"><li> | ||||
|         <a href="becca_entities_attribute.js.html">becca/entities/attribute.js</a>, <a href="becca_entities_attribute.js.html#line112">line 112</a> | ||||
|         <a href="becca_entities_attribute.js.html">becca/entities/attribute.js</a>, <a href="becca_entities_attribute.js.html#line114">line 114</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
| @@ -851,7 +862,7 @@ and relation (representing named relationship between source and target note)</d | ||||
|      | ||||
|     <dt class="tag-source">Source:</dt> | ||||
|     <dd class="tag-source"><ul class="dummy"><li> | ||||
|         <a href="becca_entities_attribute.js.html">becca/entities/attribute.js</a>, <a href="becca_entities_attribute.js.html#line119">line 119</a> | ||||
|         <a href="becca_entities_attribute.js.html">becca/entities/attribute.js</a>, <a href="becca_entities_attribute.js.html#line121">line 121</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
| @@ -956,7 +967,7 @@ and relation (representing named relationship between source and target note)</d | ||||
|      | ||||
|     <dt class="tag-source">Source:</dt> | ||||
|     <dd class="tag-source"><ul class="dummy"><li> | ||||
|         <a href="becca_entities_attribute.js.html">becca/entities/attribute.js</a>, <a href="becca_entities_attribute.js.html#line134">line 134</a> | ||||
|         <a href="becca_entities_attribute.js.html">becca/entities/attribute.js</a>, <a href="becca_entities_attribute.js.html#line136">line 136</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
| @@ -1010,6 +1021,276 @@ and relation (representing named relationship between source and target note)</d | ||||
|      | ||||
|  | ||||
|      | ||||
|     <h4 class="name" id="markAsDeleted"><span class="type-signature"></span>markAsDeleted<span class="signature">(deleteId<span class="signature-attributes">opt</span>)</span><span class="type-signature"></span></h4> | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|  | ||||
|  | ||||
| <div class="description"> | ||||
|     Mark the entity as (soft) deleted. It will be completely erased later. | ||||
|  | ||||
| This is a low level method, for notes and branches use `note.deleteNote()` and 'branch.deleteBranch()` instead. | ||||
| </div> | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|     <h5>Parameters:</h5> | ||||
|      | ||||
|  | ||||
| <table class="params"> | ||||
|     <thead> | ||||
|     <tr> | ||||
|          | ||||
|         <th>Name</th> | ||||
|          | ||||
|  | ||||
|         <th>Type</th> | ||||
|  | ||||
|          | ||||
|         <th>Attributes</th> | ||||
|          | ||||
|  | ||||
|          | ||||
|         <th>Default</th> | ||||
|          | ||||
|  | ||||
|         <th class="last">Description</th> | ||||
|     </tr> | ||||
|     </thead> | ||||
|  | ||||
|     <tbody> | ||||
|      | ||||
|  | ||||
|         <tr> | ||||
|              | ||||
|                 <td class="name"><code>deleteId</code></td> | ||||
|              | ||||
|  | ||||
|             <td class="type"> | ||||
|              | ||||
|             </td> | ||||
|  | ||||
|              | ||||
|                 <td class="attributes"> | ||||
|                  | ||||
|                     <optional><br> | ||||
|                  | ||||
|  | ||||
|                  | ||||
|  | ||||
|                  | ||||
|                 </td> | ||||
|              | ||||
|  | ||||
|              | ||||
|                 <td class="default"> | ||||
|                  | ||||
|                     null | ||||
|                  | ||||
|                 </td> | ||||
|              | ||||
|  | ||||
|             <td class="description last"></td> | ||||
|         </tr> | ||||
|  | ||||
|      | ||||
|     </tbody> | ||||
| </table> | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
| <dl class="details"> | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|     <dt class="tag-overrides">Overrides:</dt> | ||||
|     <dd class="tag-overrides"><ul class="dummy"><li> | ||||
|         <a href="AbstractEntity.html#markAsDeleted">AbstractEntity#markAsDeleted</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|     <dt class="tag-source">Source:</dt> | ||||
|     <dd class="tag-source"><ul class="dummy"><li> | ||||
|         <a href="becca_entities_abstract_entity.js.html">becca/entities/abstract_entity.js</a>, <a href="becca_entities_abstract_entity.js.html#line118">line 118</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
| </dl> | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|          | ||||
|              | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|     <h4 class="name" id="save"><span class="type-signature"></span>save<span class="signature">()</span><span class="type-signature"> → {<a href="AbstractEntity.html">AbstractEntity</a>}</span></h4> | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|  | ||||
|  | ||||
| <div class="description"> | ||||
|     Saves entity - executes SQL, but doesn't commit the transaction on its own | ||||
| </div> | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
| <dl class="details"> | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|     <dt class="tag-overrides">Overrides:</dt> | ||||
|     <dd class="tag-overrides"><ul class="dummy"><li> | ||||
|         <a href="AbstractEntity.html#save">AbstractEntity#save</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|     <dt class="tag-source">Source:</dt> | ||||
|     <dd class="tag-source"><ul class="dummy"><li> | ||||
|         <a href="becca_entities_abstract_entity.js.html">becca/entities/abstract_entity.js</a>, <a href="becca_entities_abstract_entity.js.html#line73">line 73</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
| </dl> | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
| <h5>Returns:</h5> | ||||
|  | ||||
|          | ||||
|  | ||||
|  | ||||
| <dl> | ||||
|     <dt> | ||||
|         Type | ||||
|     </dt> | ||||
|     <dd> | ||||
|          | ||||
| <span class="param-type"><a href="AbstractEntity.html">AbstractEntity</a></span> | ||||
|  | ||||
|  | ||||
|     </dd> | ||||
| </dl> | ||||
|  | ||||
|      | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|          | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
| </article> | ||||
|  | ||||
| </section> | ||||
| @@ -1020,13 +1301,13 @@ and relation (representing named relationship between source and target note)</d | ||||
| </div> | ||||
|  | ||||
| <nav> | ||||
|     <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-sql.html">sql</a></li></ul><h3>Classes</h3><ul><li><a href="Attribute.html">Attribute</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li><li><a href="Branch.html">Branch</a></li><li><a href="EtapiToken.html">EtapiToken</a></li><li><a href="Note.html">Note</a></li><li><a href="NoteRevision.html">NoteRevision</a></li><li><a href="Option.html">Option</a></li><li><a href="RecentNote.html">RecentNote</a></li></ul><h3><a href="global.html">Global</a></h3> | ||||
|     <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-sql.html">sql</a></li></ul><h3>Classes</h3><ul><li><a href="AbstractEntity.html">AbstractEntity</a></li><li><a href="Attribute.html">Attribute</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li><li><a href="Branch.html">Branch</a></li><li><a href="EtapiToken.html">EtapiToken</a></li><li><a href="Note.html">Note</a></li><li><a href="NoteRevision.html">NoteRevision</a></li><li><a href="Option.html">Option</a></li><li><a href="RecentNote.html">RecentNote</a></li></ul><h3><a href="global.html">Global</a></h3> | ||||
| </nav> | ||||
|  | ||||
| <br class="clear"> | ||||
|  | ||||
| <footer> | ||||
|     Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.7</a> | ||||
|     Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> | ||||
| </footer> | ||||
|  | ||||
| <script> prettyPrint(); </script> | ||||
|   | ||||
| @@ -131,6 +131,78 @@ | ||||
|  | ||||
|          | ||||
|              | ||||
| <h4 class="name" id="__private"><span class="type-signature"></span>__private<span class="type-signature"> :Object</span></h4> | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
| <div class="description"> | ||||
|     This object contains "at your risk" and "no BC guarantees" objects for advanced use cases. | ||||
| </div> | ||||
|  | ||||
|  | ||||
|  | ||||
|     <h5>Type:</h5> | ||||
|     <ul> | ||||
|         <li> | ||||
|              | ||||
| <span class="param-type">Object</span> | ||||
|  | ||||
|  | ||||
|         </li> | ||||
|     </ul> | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
| <dl class="details"> | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|     <dt class="tag-source">Source:</dt> | ||||
|     <dd class="tag-source"><ul class="dummy"><li> | ||||
|         <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line435">line 435</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
| </dl> | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|          | ||||
|              | ||||
| <h4 class="name" id="axios"><span class="type-signature"></span>axios<span class="type-signature"></span></h4> | ||||
|  | ||||
|  | ||||
| @@ -6073,13 +6145,13 @@ exists, then we'll use that transaction. | ||||
| </div> | ||||
|  | ||||
| <nav> | ||||
|     <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-sql.html">sql</a></li></ul><h3>Classes</h3><ul><li><a href="Attribute.html">Attribute</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li><li><a href="Branch.html">Branch</a></li><li><a href="EtapiToken.html">EtapiToken</a></li><li><a href="Note.html">Note</a></li><li><a href="NoteRevision.html">NoteRevision</a></li><li><a href="Option.html">Option</a></li><li><a href="RecentNote.html">RecentNote</a></li></ul><h3><a href="global.html">Global</a></h3> | ||||
|     <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-sql.html">sql</a></li></ul><h3>Classes</h3><ul><li><a href="AbstractEntity.html">AbstractEntity</a></li><li><a href="Attribute.html">Attribute</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li><li><a href="Branch.html">Branch</a></li><li><a href="EtapiToken.html">EtapiToken</a></li><li><a href="Note.html">Note</a></li><li><a href="NoteRevision.html">NoteRevision</a></li><li><a href="Option.html">Option</a></li><li><a href="RecentNote.html">RecentNote</a></li></ul><h3><a href="global.html">Global</a></h3> | ||||
| </nav> | ||||
|  | ||||
| <br class="clear"> | ||||
|  | ||||
| <footer> | ||||
|     Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.7</a> | ||||
|     Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> | ||||
| </footer> | ||||
|  | ||||
| <script> prettyPrint(); </script> | ||||
|   | ||||
| @@ -94,7 +94,7 @@ parents.</div> | ||||
|      | ||||
|     <dt class="tag-source">Source:</dt> | ||||
|     <dd class="tag-source"><ul class="dummy"><li> | ||||
|         <a href="becca_entities_branch.js.html">becca/entities/branch.js</a>, <a href="becca_entities_branch.js.html#line12">line 12</a> | ||||
|         <a href="becca_entities_branch.js.html">becca/entities/branch.js</a>, <a href="becca_entities_branch.js.html#line18">line 18</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
| @@ -128,6 +128,17 @@ parents.</div> | ||||
|     </div> | ||||
|  | ||||
|      | ||||
|         <h3 class="subsection-title">Extends</h3> | ||||
|  | ||||
|          | ||||
|  | ||||
|  | ||||
|     <ul> | ||||
|         <li><a href="AbstractEntity.html">AbstractEntity</a></li> | ||||
|     </ul> | ||||
|  | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
| @@ -194,7 +205,7 @@ parents.</div> | ||||
|      | ||||
|     <dt class="tag-source">Source:</dt> | ||||
|     <dd class="tag-source"><ul class="dummy"><li> | ||||
|         <a href="becca_entities_branch.js.html">becca/entities/branch.js</a>, <a href="becca_entities_branch.js.html#line43">line 43</a> | ||||
|         <a href="becca_entities_branch.js.html">becca/entities/branch.js</a>, <a href="becca_entities_branch.js.html#line49">line 49</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
| @@ -252,7 +263,7 @@ parents.</div> | ||||
|      | ||||
|     <dt class="tag-source">Source:</dt> | ||||
|     <dd class="tag-source"><ul class="dummy"><li> | ||||
|         <a href="becca_entities_branch.js.html">becca/entities/branch.js</a>, <a href="becca_entities_branch.js.html#line88">line 88</a> | ||||
|         <a href="becca_entities_branch.js.html">becca/entities/branch.js</a>, <a href="becca_entities_branch.js.html#line94">line 94</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
| @@ -320,7 +331,7 @@ parents.</div> | ||||
|      | ||||
|     <dt class="tag-source">Source:</dt> | ||||
|     <dd class="tag-source"><ul class="dummy"><li> | ||||
|         <a href="becca_entities_branch.js.html">becca/entities/branch.js</a>, <a href="becca_entities_branch.js.html#line53">line 53</a> | ||||
|         <a href="becca_entities_branch.js.html">becca/entities/branch.js</a>, <a href="becca_entities_branch.js.html#line59">line 59</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
| @@ -388,7 +399,7 @@ parents.</div> | ||||
|      | ||||
|     <dt class="tag-source">Source:</dt> | ||||
|     <dd class="tag-source"><ul class="dummy"><li> | ||||
|         <a href="becca_entities_branch.js.html">becca/entities/branch.js</a>, <a href="becca_entities_branch.js.html#line45">line 45</a> | ||||
|         <a href="becca_entities_branch.js.html">becca/entities/branch.js</a>, <a href="becca_entities_branch.js.html#line51">line 51</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
| @@ -456,7 +467,7 @@ parents.</div> | ||||
|      | ||||
|     <dt class="tag-source">Source:</dt> | ||||
|     <dd class="tag-source"><ul class="dummy"><li> | ||||
|         <a href="becca_entities_branch.js.html">becca/entities/branch.js</a>, <a href="becca_entities_branch.js.html#line51">line 51</a> | ||||
|         <a href="becca_entities_branch.js.html">becca/entities/branch.js</a>, <a href="becca_entities_branch.js.html#line57">line 57</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
| @@ -514,7 +525,7 @@ parents.</div> | ||||
|      | ||||
|     <dt class="tag-source">Source:</dt> | ||||
|     <dd class="tag-source"><ul class="dummy"><li> | ||||
|         <a href="becca_entities_branch.js.html">becca/entities/branch.js</a>, <a href="becca_entities_branch.js.html#line102">line 102</a> | ||||
|         <a href="becca_entities_branch.js.html">becca/entities/branch.js</a>, <a href="becca_entities_branch.js.html#line108">line 108</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
| @@ -582,7 +593,7 @@ parents.</div> | ||||
|      | ||||
|     <dt class="tag-source">Source:</dt> | ||||
|     <dd class="tag-source"><ul class="dummy"><li> | ||||
|         <a href="becca_entities_branch.js.html">becca/entities/branch.js</a>, <a href="becca_entities_branch.js.html#line47">line 47</a> | ||||
|         <a href="becca_entities_branch.js.html">becca/entities/branch.js</a>, <a href="becca_entities_branch.js.html#line53">line 53</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
| @@ -650,7 +661,7 @@ parents.</div> | ||||
|      | ||||
|     <dt class="tag-source">Source:</dt> | ||||
|     <dd class="tag-source"><ul class="dummy"><li> | ||||
|         <a href="becca_entities_branch.js.html">becca/entities/branch.js</a>, <a href="becca_entities_branch.js.html#line49">line 49</a> | ||||
|         <a href="becca_entities_branch.js.html">becca/entities/branch.js</a>, <a href="becca_entities_branch.js.html#line55">line 55</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
| @@ -718,7 +729,181 @@ parents.</div> | ||||
|      | ||||
|     <dt class="tag-source">Source:</dt> | ||||
|     <dd class="tag-source"><ul class="dummy"><li> | ||||
|         <a href="becca_entities_branch.js.html">becca/entities/branch.js</a>, <a href="becca_entities_branch.js.html#line55">line 55</a> | ||||
|         <a href="becca_entities_branch.js.html">becca/entities/branch.js</a>, <a href="becca_entities_branch.js.html#line61">line 61</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
| </dl> | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|          | ||||
|      | ||||
|  | ||||
|      | ||||
|         <h3 class="subsection-title">Methods</h3> | ||||
|  | ||||
|          | ||||
|              | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|     <h4 class="name" id="deleteBranch"><span class="type-signature"></span>deleteBranch<span class="signature">(deleteId<span class="signature-attributes">opt</span>, taskContext<span class="signature-attributes">opt</span>)</span><span class="type-signature"> → {boolean}</span></h4> | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|  | ||||
|  | ||||
| <div class="description"> | ||||
|     Delete a branch. If this is a last note's branch, delete the note as well. | ||||
| </div> | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|     <h5>Parameters:</h5> | ||||
|      | ||||
|  | ||||
| <table class="params"> | ||||
|     <thead> | ||||
|     <tr> | ||||
|          | ||||
|         <th>Name</th> | ||||
|          | ||||
|  | ||||
|         <th>Type</th> | ||||
|  | ||||
|          | ||||
|         <th>Attributes</th> | ||||
|          | ||||
|  | ||||
|          | ||||
|  | ||||
|         <th class="last">Description</th> | ||||
|     </tr> | ||||
|     </thead> | ||||
|  | ||||
|     <tbody> | ||||
|      | ||||
|  | ||||
|         <tr> | ||||
|              | ||||
|                 <td class="name"><code>deleteId</code></td> | ||||
|              | ||||
|  | ||||
|             <td class="type"> | ||||
|              | ||||
|                  | ||||
| <span class="param-type">string</span> | ||||
|  | ||||
|  | ||||
|              | ||||
|             </td> | ||||
|  | ||||
|              | ||||
|                 <td class="attributes"> | ||||
|                  | ||||
|                     <optional><br> | ||||
|                  | ||||
|  | ||||
|                  | ||||
|  | ||||
|                  | ||||
|                 </td> | ||||
|              | ||||
|  | ||||
|              | ||||
|  | ||||
|             <td class="description last">optional delete identified</td> | ||||
|         </tr> | ||||
|  | ||||
|      | ||||
|  | ||||
|         <tr> | ||||
|              | ||||
|                 <td class="name"><code>taskContext</code></td> | ||||
|              | ||||
|  | ||||
|             <td class="type"> | ||||
|              | ||||
|                  | ||||
| <span class="param-type">TaskContext</span> | ||||
|  | ||||
|  | ||||
|              | ||||
|             </td> | ||||
|  | ||||
|              | ||||
|                 <td class="attributes"> | ||||
|                  | ||||
|                     <optional><br> | ||||
|                  | ||||
|  | ||||
|                  | ||||
|  | ||||
|                  | ||||
|                 </td> | ||||
|              | ||||
|  | ||||
|              | ||||
|  | ||||
|             <td class="description last"></td> | ||||
|         </tr> | ||||
|  | ||||
|      | ||||
|     </tbody> | ||||
| </table> | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
| <dl class="details"> | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|     <dt class="tag-source">Source:</dt> | ||||
|     <dd class="tag-source"><ul class="dummy"><li> | ||||
|         <a href="becca_entities_branch.js.html">becca/entities/branch.js</a>, <a href="becca_entities_branch.js.html#line129">line 129</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
| @@ -742,6 +927,310 @@ parents.</div> | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
| <h5>Returns:</h5> | ||||
|  | ||||
|          | ||||
| <div class="param-desc"> | ||||
|     - true if note has been deleted, false otherwise | ||||
| </div> | ||||
|  | ||||
|  | ||||
|  | ||||
| <dl> | ||||
|     <dt> | ||||
|         Type | ||||
|     </dt> | ||||
|     <dd> | ||||
|          | ||||
| <span class="param-type">boolean</span> | ||||
|  | ||||
|  | ||||
|     </dd> | ||||
| </dl> | ||||
|  | ||||
|      | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|          | ||||
|              | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|     <h4 class="name" id="markAsDeleted"><span class="type-signature"></span>markAsDeleted<span class="signature">(deleteId<span class="signature-attributes">opt</span>)</span><span class="type-signature"></span></h4> | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|  | ||||
|  | ||||
| <div class="description"> | ||||
|     Mark the entity as (soft) deleted. It will be completely erased later. | ||||
|  | ||||
| This is a low level method, for notes and branches use `note.deleteNote()` and 'branch.deleteBranch()` instead. | ||||
| </div> | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|     <h5>Parameters:</h5> | ||||
|      | ||||
|  | ||||
| <table class="params"> | ||||
|     <thead> | ||||
|     <tr> | ||||
|          | ||||
|         <th>Name</th> | ||||
|          | ||||
|  | ||||
|         <th>Type</th> | ||||
|  | ||||
|          | ||||
|         <th>Attributes</th> | ||||
|          | ||||
|  | ||||
|          | ||||
|         <th>Default</th> | ||||
|          | ||||
|  | ||||
|         <th class="last">Description</th> | ||||
|     </tr> | ||||
|     </thead> | ||||
|  | ||||
|     <tbody> | ||||
|      | ||||
|  | ||||
|         <tr> | ||||
|              | ||||
|                 <td class="name"><code>deleteId</code></td> | ||||
|              | ||||
|  | ||||
|             <td class="type"> | ||||
|              | ||||
|             </td> | ||||
|  | ||||
|              | ||||
|                 <td class="attributes"> | ||||
|                  | ||||
|                     <optional><br> | ||||
|                  | ||||
|  | ||||
|                  | ||||
|  | ||||
|                  | ||||
|                 </td> | ||||
|              | ||||
|  | ||||
|              | ||||
|                 <td class="default"> | ||||
|                  | ||||
|                     null | ||||
|                  | ||||
|                 </td> | ||||
|              | ||||
|  | ||||
|             <td class="description last"></td> | ||||
|         </tr> | ||||
|  | ||||
|      | ||||
|     </tbody> | ||||
| </table> | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
| <dl class="details"> | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|     <dt class="tag-overrides">Overrides:</dt> | ||||
|     <dd class="tag-overrides"><ul class="dummy"><li> | ||||
|         <a href="AbstractEntity.html#markAsDeleted">AbstractEntity#markAsDeleted</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|     <dt class="tag-source">Source:</dt> | ||||
|     <dd class="tag-source"><ul class="dummy"><li> | ||||
|         <a href="becca_entities_abstract_entity.js.html">becca/entities/abstract_entity.js</a>, <a href="becca_entities_abstract_entity.js.html#line118">line 118</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
| </dl> | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|          | ||||
|              | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|     <h4 class="name" id="save"><span class="type-signature"></span>save<span class="signature">()</span><span class="type-signature"> → {<a href="AbstractEntity.html">AbstractEntity</a>}</span></h4> | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|  | ||||
|  | ||||
| <div class="description"> | ||||
|     Saves entity - executes SQL, but doesn't commit the transaction on its own | ||||
| </div> | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
| <dl class="details"> | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|     <dt class="tag-overrides">Overrides:</dt> | ||||
|     <dd class="tag-overrides"><ul class="dummy"><li> | ||||
|         <a href="AbstractEntity.html#save">AbstractEntity#save</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|     <dt class="tag-source">Source:</dt> | ||||
|     <dd class="tag-source"><ul class="dummy"><li> | ||||
|         <a href="becca_entities_abstract_entity.js.html">becca/entities/abstract_entity.js</a>, <a href="becca_entities_abstract_entity.js.html#line73">line 73</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
| </dl> | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
| <h5>Returns:</h5> | ||||
|  | ||||
|          | ||||
|  | ||||
|  | ||||
| <dl> | ||||
|     <dt> | ||||
|         Type | ||||
|     </dt> | ||||
|     <dd> | ||||
|          | ||||
| <span class="param-type"><a href="AbstractEntity.html">AbstractEntity</a></span> | ||||
|  | ||||
|  | ||||
|     </dd> | ||||
| </dl> | ||||
|  | ||||
|      | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|          | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
| </article> | ||||
|  | ||||
| </section> | ||||
| @@ -752,13 +1241,13 @@ parents.</div> | ||||
| </div> | ||||
|  | ||||
| <nav> | ||||
|     <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-sql.html">sql</a></li></ul><h3>Classes</h3><ul><li><a href="Attribute.html">Attribute</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li><li><a href="Branch.html">Branch</a></li><li><a href="EtapiToken.html">EtapiToken</a></li><li><a href="Note.html">Note</a></li><li><a href="NoteRevision.html">NoteRevision</a></li><li><a href="Option.html">Option</a></li><li><a href="RecentNote.html">RecentNote</a></li></ul><h3><a href="global.html">Global</a></h3> | ||||
|     <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-sql.html">sql</a></li></ul><h3>Classes</h3><ul><li><a href="AbstractEntity.html">AbstractEntity</a></li><li><a href="Attribute.html">Attribute</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li><li><a href="Branch.html">Branch</a></li><li><a href="EtapiToken.html">EtapiToken</a></li><li><a href="Note.html">Note</a></li><li><a href="NoteRevision.html">NoteRevision</a></li><li><a href="Option.html">Option</a></li><li><a href="RecentNote.html">RecentNote</a></li></ul><h3><a href="global.html">Global</a></h3> | ||||
| </nav> | ||||
|  | ||||
| <br class="clear"> | ||||
|  | ||||
| <footer> | ||||
|     Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.7</a> | ||||
|     Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> | ||||
| </footer> | ||||
|  | ||||
| <script> prettyPrint(); </script> | ||||
|   | ||||
| @@ -99,7 +99,7 @@ from tokenHash and token.</div> | ||||
|      | ||||
|     <dt class="tag-source">Source:</dt> | ||||
|     <dd class="tag-source"><ul class="dummy"><li> | ||||
|         <a href="becca_entities_etapi_token.js.html">becca/entities/etapi_token.js</a>, <a href="becca_entities_etapi_token.js.html#line16">line 16</a> | ||||
|         <a href="becca_entities_etapi_token.js.html">becca/entities/etapi_token.js</a>, <a href="becca_entities_etapi_token.js.html#line17">line 17</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
| @@ -133,6 +133,17 @@ from tokenHash and token.</div> | ||||
|     </div> | ||||
|  | ||||
|      | ||||
|         <h3 class="subsection-title">Extends</h3> | ||||
|  | ||||
|          | ||||
|  | ||||
|  | ||||
|     <ul> | ||||
|         <li><a href="AbstractEntity.html">AbstractEntity</a></li> | ||||
|     </ul> | ||||
|  | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
| @@ -199,7 +210,7 @@ from tokenHash and token.</div> | ||||
|      | ||||
|     <dt class="tag-source">Source:</dt> | ||||
|     <dd class="tag-source"><ul class="dummy"><li> | ||||
|         <a href="becca_entities_etapi_token.js.html">becca/entities/etapi_token.js</a>, <a href="becca_entities_etapi_token.js.html#line34">line 34</a> | ||||
|         <a href="becca_entities_etapi_token.js.html">becca/entities/etapi_token.js</a>, <a href="becca_entities_etapi_token.js.html#line35">line 35</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
| @@ -267,7 +278,7 @@ from tokenHash and token.</div> | ||||
|      | ||||
|     <dt class="tag-source">Source:</dt> | ||||
|     <dd class="tag-source"><ul class="dummy"><li> | ||||
|         <a href="becca_entities_etapi_token.js.html">becca/entities/etapi_token.js</a>, <a href="becca_entities_etapi_token.js.html#line44">line 44</a> | ||||
|         <a href="becca_entities_etapi_token.js.html">becca/entities/etapi_token.js</a>, <a href="becca_entities_etapi_token.js.html#line45">line 45</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
| @@ -335,7 +346,7 @@ from tokenHash and token.</div> | ||||
|      | ||||
|     <dt class="tag-source">Source:</dt> | ||||
|     <dd class="tag-source"><ul class="dummy"><li> | ||||
|         <a href="becca_entities_etapi_token.js.html">becca/entities/etapi_token.js</a>, <a href="becca_entities_etapi_token.js.html#line36">line 36</a> | ||||
|         <a href="becca_entities_etapi_token.js.html">becca/entities/etapi_token.js</a>, <a href="becca_entities_etapi_token.js.html#line37">line 37</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
| @@ -403,7 +414,7 @@ from tokenHash and token.</div> | ||||
|      | ||||
|     <dt class="tag-source">Source:</dt> | ||||
|     <dd class="tag-source"><ul class="dummy"><li> | ||||
|         <a href="becca_entities_etapi_token.js.html">becca/entities/etapi_token.js</a>, <a href="becca_entities_etapi_token.js.html#line38">line 38</a> | ||||
|         <a href="becca_entities_etapi_token.js.html">becca/entities/etapi_token.js</a>, <a href="becca_entities_etapi_token.js.html#line39">line 39</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
| @@ -471,7 +482,7 @@ from tokenHash and token.</div> | ||||
|      | ||||
|     <dt class="tag-source">Source:</dt> | ||||
|     <dd class="tag-source"><ul class="dummy"><li> | ||||
|         <a href="becca_entities_etapi_token.js.html">becca/entities/etapi_token.js</a>, <a href="becca_entities_etapi_token.js.html#line40">line 40</a> | ||||
|         <a href="becca_entities_etapi_token.js.html">becca/entities/etapi_token.js</a>, <a href="becca_entities_etapi_token.js.html#line41">line 41</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
| @@ -539,7 +550,158 @@ from tokenHash and token.</div> | ||||
|      | ||||
|     <dt class="tag-source">Source:</dt> | ||||
|     <dd class="tag-source"><ul class="dummy"><li> | ||||
|         <a href="becca_entities_etapi_token.js.html">becca/entities/etapi_token.js</a>, <a href="becca_entities_etapi_token.js.html#line42">line 42</a> | ||||
|         <a href="becca_entities_etapi_token.js.html">becca/entities/etapi_token.js</a>, <a href="becca_entities_etapi_token.js.html#line43">line 43</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
| </dl> | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|          | ||||
|      | ||||
|  | ||||
|      | ||||
|         <h3 class="subsection-title">Methods</h3> | ||||
|  | ||||
|          | ||||
|              | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|     <h4 class="name" id="markAsDeleted"><span class="type-signature"></span>markAsDeleted<span class="signature">(deleteId<span class="signature-attributes">opt</span>)</span><span class="type-signature"></span></h4> | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|  | ||||
|  | ||||
| <div class="description"> | ||||
|     Mark the entity as (soft) deleted. It will be completely erased later. | ||||
|  | ||||
| This is a low level method, for notes and branches use `note.deleteNote()` and 'branch.deleteBranch()` instead. | ||||
| </div> | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|     <h5>Parameters:</h5> | ||||
|      | ||||
|  | ||||
| <table class="params"> | ||||
|     <thead> | ||||
|     <tr> | ||||
|          | ||||
|         <th>Name</th> | ||||
|          | ||||
|  | ||||
|         <th>Type</th> | ||||
|  | ||||
|          | ||||
|         <th>Attributes</th> | ||||
|          | ||||
|  | ||||
|          | ||||
|         <th>Default</th> | ||||
|          | ||||
|  | ||||
|         <th class="last">Description</th> | ||||
|     </tr> | ||||
|     </thead> | ||||
|  | ||||
|     <tbody> | ||||
|      | ||||
|  | ||||
|         <tr> | ||||
|              | ||||
|                 <td class="name"><code>deleteId</code></td> | ||||
|              | ||||
|  | ||||
|             <td class="type"> | ||||
|              | ||||
|             </td> | ||||
|  | ||||
|              | ||||
|                 <td class="attributes"> | ||||
|                  | ||||
|                     <optional><br> | ||||
|                  | ||||
|  | ||||
|                  | ||||
|  | ||||
|                  | ||||
|                 </td> | ||||
|              | ||||
|  | ||||
|              | ||||
|                 <td class="default"> | ||||
|                  | ||||
|                     null | ||||
|                  | ||||
|                 </td> | ||||
|              | ||||
|  | ||||
|             <td class="description last"></td> | ||||
|         </tr> | ||||
|  | ||||
|      | ||||
|     </tbody> | ||||
| </table> | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
| <dl class="details"> | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|     <dt class="tag-overrides">Overrides:</dt> | ||||
|     <dd class="tag-overrides"><ul class="dummy"><li> | ||||
|         <a href="AbstractEntity.html#markAsDeleted">AbstractEntity#markAsDeleted</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|     <dt class="tag-source">Source:</dt> | ||||
|     <dd class="tag-source"><ul class="dummy"><li> | ||||
|         <a href="becca_entities_abstract_entity.js.html">becca/entities/abstract_entity.js</a>, <a href="becca_entities_abstract_entity.js.html#line118">line 118</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
| @@ -563,6 +725,129 @@ from tokenHash and token.</div> | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|          | ||||
|              | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|     <h4 class="name" id="save"><span class="type-signature"></span>save<span class="signature">()</span><span class="type-signature"> → {<a href="AbstractEntity.html">AbstractEntity</a>}</span></h4> | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|  | ||||
|  | ||||
| <div class="description"> | ||||
|     Saves entity - executes SQL, but doesn't commit the transaction on its own | ||||
| </div> | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
| <dl class="details"> | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|     <dt class="tag-overrides">Overrides:</dt> | ||||
|     <dd class="tag-overrides"><ul class="dummy"><li> | ||||
|         <a href="AbstractEntity.html#save">AbstractEntity#save</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|     <dt class="tag-source">Source:</dt> | ||||
|     <dd class="tag-source"><ul class="dummy"><li> | ||||
|         <a href="becca_entities_abstract_entity.js.html">becca/entities/abstract_entity.js</a>, <a href="becca_entities_abstract_entity.js.html#line73">line 73</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
| </dl> | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
| <h5>Returns:</h5> | ||||
|  | ||||
|          | ||||
|  | ||||
|  | ||||
| <dl> | ||||
|     <dt> | ||||
|         Type | ||||
|     </dt> | ||||
|     <dd> | ||||
|          | ||||
| <span class="param-type"><a href="AbstractEntity.html">AbstractEntity</a></span> | ||||
|  | ||||
|  | ||||
|     </dd> | ||||
| </dl> | ||||
|  | ||||
|      | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|          | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
| </article> | ||||
|  | ||||
| </section> | ||||
| @@ -573,13 +858,13 @@ from tokenHash and token.</div> | ||||
| </div> | ||||
|  | ||||
| <nav> | ||||
|     <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-sql.html">sql</a></li></ul><h3>Classes</h3><ul><li><a href="Attribute.html">Attribute</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li><li><a href="Branch.html">Branch</a></li><li><a href="EtapiToken.html">EtapiToken</a></li><li><a href="Note.html">Note</a></li><li><a href="NoteRevision.html">NoteRevision</a></li><li><a href="Option.html">Option</a></li><li><a href="RecentNote.html">RecentNote</a></li></ul><h3><a href="global.html">Global</a></h3> | ||||
|     <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-sql.html">sql</a></li></ul><h3>Classes</h3><ul><li><a href="AbstractEntity.html">AbstractEntity</a></li><li><a href="Attribute.html">Attribute</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li><li><a href="Branch.html">Branch</a></li><li><a href="EtapiToken.html">EtapiToken</a></li><li><a href="Note.html">Note</a></li><li><a href="NoteRevision.html">NoteRevision</a></li><li><a href="Option.html">Option</a></li><li><a href="RecentNote.html">RecentNote</a></li></ul><h3><a href="global.html">Global</a></h3> | ||||
| </nav> | ||||
|  | ||||
| <br class="clear"> | ||||
|  | ||||
| <footer> | ||||
|     Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.7</a> | ||||
|     Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> | ||||
| </footer> | ||||
|  | ||||
| <script> prettyPrint(); </script> | ||||
|   | ||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @@ -94,7 +94,7 @@ It's used for seamless note versioning.</div> | ||||
|      | ||||
|     <dt class="tag-source">Source:</dt> | ||||
|     <dd class="tag-source"><ul class="dummy"><li> | ||||
|         <a href="becca_entities_note_revision.js.html">becca/entities/note_revision.js</a>, <a href="becca_entities_note_revision.js.html#line15">line 15</a> | ||||
|         <a href="becca_entities_note_revision.js.html">becca/entities/note_revision.js</a>, <a href="becca_entities_note_revision.js.html#line17">line 17</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
| @@ -128,6 +128,17 @@ It's used for seamless note versioning.</div> | ||||
|     </div> | ||||
|  | ||||
|      | ||||
|         <h3 class="subsection-title">Extends</h3> | ||||
|  | ||||
|          | ||||
|  | ||||
|  | ||||
|     <ul> | ||||
|         <li><a href="AbstractEntity.html">AbstractEntity</a></li> | ||||
|     </ul> | ||||
|  | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
| @@ -194,7 +205,7 @@ It's used for seamless note versioning.</div> | ||||
|      | ||||
|     <dt class="tag-source">Source:</dt> | ||||
|     <dd class="tag-source"><ul class="dummy"><li> | ||||
|         <a href="becca_entities_note_revision.js.html">becca/entities/note_revision.js</a>, <a href="becca_entities_note_revision.js.html#line46">line 46</a> | ||||
|         <a href="becca_entities_note_revision.js.html">becca/entities/note_revision.js</a>, <a href="becca_entities_note_revision.js.html#line48">line 48</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
| @@ -262,7 +273,7 @@ It's used for seamless note versioning.</div> | ||||
|      | ||||
|     <dt class="tag-source">Source:</dt> | ||||
|     <dd class="tag-source"><ul class="dummy"><li> | ||||
|         <a href="becca_entities_note_revision.js.html">becca/entities/note_revision.js</a>, <a href="becca_entities_note_revision.js.html#line38">line 38</a> | ||||
|         <a href="becca_entities_note_revision.js.html">becca/entities/note_revision.js</a>, <a href="becca_entities_note_revision.js.html#line40">line 40</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
| @@ -330,7 +341,7 @@ It's used for seamless note versioning.</div> | ||||
|      | ||||
|     <dt class="tag-source">Source:</dt> | ||||
|     <dd class="tag-source"><ul class="dummy"><li> | ||||
|         <a href="becca_entities_note_revision.js.html">becca/entities/note_revision.js</a>, <a href="becca_entities_note_revision.js.html#line36">line 36</a> | ||||
|         <a href="becca_entities_note_revision.js.html">becca/entities/note_revision.js</a>, <a href="becca_entities_note_revision.js.html#line38">line 38</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
| @@ -398,7 +409,7 @@ It's used for seamless note versioning.</div> | ||||
|      | ||||
|     <dt class="tag-source">Source:</dt> | ||||
|     <dd class="tag-source"><ul class="dummy"><li> | ||||
|         <a href="becca_entities_note_revision.js.html">becca/entities/note_revision.js</a>, <a href="becca_entities_note_revision.js.html#line32">line 32</a> | ||||
|         <a href="becca_entities_note_revision.js.html">becca/entities/note_revision.js</a>, <a href="becca_entities_note_revision.js.html#line34">line 34</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
| @@ -466,7 +477,7 @@ It's used for seamless note versioning.</div> | ||||
|      | ||||
|     <dt class="tag-source">Source:</dt> | ||||
|     <dd class="tag-source"><ul class="dummy"><li> | ||||
|         <a href="becca_entities_note_revision.js.html">becca/entities/note_revision.js</a>, <a href="becca_entities_note_revision.js.html#line30">line 30</a> | ||||
|         <a href="becca_entities_note_revision.js.html">becca/entities/note_revision.js</a>, <a href="becca_entities_note_revision.js.html#line32">line 32</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
| @@ -534,7 +545,7 @@ It's used for seamless note versioning.</div> | ||||
|      | ||||
|     <dt class="tag-source">Source:</dt> | ||||
|     <dd class="tag-source"><ul class="dummy"><li> | ||||
|         <a href="becca_entities_note_revision.js.html">becca/entities/note_revision.js</a>, <a href="becca_entities_note_revision.js.html#line26">line 26</a> | ||||
|         <a href="becca_entities_note_revision.js.html">becca/entities/note_revision.js</a>, <a href="becca_entities_note_revision.js.html#line28">line 28</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
| @@ -602,7 +613,7 @@ It's used for seamless note versioning.</div> | ||||
|      | ||||
|     <dt class="tag-source">Source:</dt> | ||||
|     <dd class="tag-source"><ul class="dummy"><li> | ||||
|         <a href="becca_entities_note_revision.js.html">becca/entities/note_revision.js</a>, <a href="becca_entities_note_revision.js.html#line24">line 24</a> | ||||
|         <a href="becca_entities_note_revision.js.html">becca/entities/note_revision.js</a>, <a href="becca_entities_note_revision.js.html#line26">line 26</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
| @@ -670,7 +681,7 @@ It's used for seamless note versioning.</div> | ||||
|      | ||||
|     <dt class="tag-source">Source:</dt> | ||||
|     <dd class="tag-source"><ul class="dummy"><li> | ||||
|         <a href="becca_entities_note_revision.js.html">becca/entities/note_revision.js</a>, <a href="becca_entities_note_revision.js.html#line34">line 34</a> | ||||
|         <a href="becca_entities_note_revision.js.html">becca/entities/note_revision.js</a>, <a href="becca_entities_note_revision.js.html#line36">line 36</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
| @@ -738,7 +749,7 @@ It's used for seamless note versioning.</div> | ||||
|      | ||||
|     <dt class="tag-source">Source:</dt> | ||||
|     <dd class="tag-source"><ul class="dummy"><li> | ||||
|         <a href="becca_entities_note_revision.js.html">becca/entities/note_revision.js</a>, <a href="becca_entities_note_revision.js.html#line28">line 28</a> | ||||
|         <a href="becca_entities_note_revision.js.html">becca/entities/note_revision.js</a>, <a href="becca_entities_note_revision.js.html#line30">line 30</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
| @@ -806,7 +817,7 @@ It's used for seamless note versioning.</div> | ||||
|      | ||||
|     <dt class="tag-source">Source:</dt> | ||||
|     <dd class="tag-source"><ul class="dummy"><li> | ||||
|         <a href="becca_entities_note_revision.js.html">becca/entities/note_revision.js</a>, <a href="becca_entities_note_revision.js.html#line42">line 42</a> | ||||
|         <a href="becca_entities_note_revision.js.html">becca/entities/note_revision.js</a>, <a href="becca_entities_note_revision.js.html#line44">line 44</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
| @@ -874,7 +885,7 @@ It's used for seamless note versioning.</div> | ||||
|      | ||||
|     <dt class="tag-source">Source:</dt> | ||||
|     <dd class="tag-source"><ul class="dummy"><li> | ||||
|         <a href="becca_entities_note_revision.js.html">becca/entities/note_revision.js</a>, <a href="becca_entities_note_revision.js.html#line40">line 40</a> | ||||
|         <a href="becca_entities_note_revision.js.html">becca/entities/note_revision.js</a>, <a href="becca_entities_note_revision.js.html#line42">line 42</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
| @@ -942,7 +953,7 @@ It's used for seamless note versioning.</div> | ||||
|      | ||||
|     <dt class="tag-source">Source:</dt> | ||||
|     <dd class="tag-source"><ul class="dummy"><li> | ||||
|         <a href="becca_entities_note_revision.js.html">becca/entities/note_revision.js</a>, <a href="becca_entities_note_revision.js.html#line44">line 44</a> | ||||
|         <a href="becca_entities_note_revision.js.html">becca/entities/note_revision.js</a>, <a href="becca_entities_note_revision.js.html#line46">line 46</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
| @@ -1018,7 +1029,7 @@ It's used for seamless note versioning.</div> | ||||
|      | ||||
|     <dt class="tag-source">Source:</dt> | ||||
|     <dd class="tag-source"><ul class="dummy"><li> | ||||
|         <a href="becca_entities_note_revision.js.html">becca/entities/note_revision.js</a>, <a href="becca_entities_note_revision.js.html#line77">line 77</a> | ||||
|         <a href="becca_entities_note_revision.js.html">becca/entities/note_revision.js</a>, <a href="becca_entities_note_revision.js.html#line79">line 79</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
| @@ -1120,7 +1131,7 @@ It's used for seamless note versioning.</div> | ||||
|      | ||||
|     <dt class="tag-source">Source:</dt> | ||||
|     <dd class="tag-source"><ul class="dummy"><li> | ||||
|         <a href="becca_entities_note_revision.js.html">becca/entities/note_revision.js</a>, <a href="becca_entities_note_revision.js.html#line141">line 141</a> | ||||
|         <a href="becca_entities_note_revision.js.html">becca/entities/note_revision.js</a>, <a href="becca_entities_note_revision.js.html#line143">line 143</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
| @@ -1222,7 +1233,7 @@ It's used for seamless note versioning.</div> | ||||
|      | ||||
|     <dt class="tag-source">Source:</dt> | ||||
|     <dd class="tag-source"><ul class="dummy"><li> | ||||
|         <a href="becca_entities_note_revision.js.html">becca/entities/note_revision.js</a>, <a href="becca_entities_note_revision.js.html#line63">line 63</a> | ||||
|         <a href="becca_entities_note_revision.js.html">becca/entities/note_revision.js</a>, <a href="becca_entities_note_revision.js.html#line65">line 65</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
| @@ -1280,6 +1291,276 @@ It's used for seamless note versioning.</div> | ||||
|      | ||||
|  | ||||
|      | ||||
|     <h4 class="name" id="markAsDeleted"><span class="type-signature"></span>markAsDeleted<span class="signature">(deleteId<span class="signature-attributes">opt</span>)</span><span class="type-signature"></span></h4> | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|  | ||||
|  | ||||
| <div class="description"> | ||||
|     Mark the entity as (soft) deleted. It will be completely erased later. | ||||
|  | ||||
| This is a low level method, for notes and branches use `note.deleteNote()` and 'branch.deleteBranch()` instead. | ||||
| </div> | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|     <h5>Parameters:</h5> | ||||
|      | ||||
|  | ||||
| <table class="params"> | ||||
|     <thead> | ||||
|     <tr> | ||||
|          | ||||
|         <th>Name</th> | ||||
|          | ||||
|  | ||||
|         <th>Type</th> | ||||
|  | ||||
|          | ||||
|         <th>Attributes</th> | ||||
|          | ||||
|  | ||||
|          | ||||
|         <th>Default</th> | ||||
|          | ||||
|  | ||||
|         <th class="last">Description</th> | ||||
|     </tr> | ||||
|     </thead> | ||||
|  | ||||
|     <tbody> | ||||
|      | ||||
|  | ||||
|         <tr> | ||||
|              | ||||
|                 <td class="name"><code>deleteId</code></td> | ||||
|              | ||||
|  | ||||
|             <td class="type"> | ||||
|              | ||||
|             </td> | ||||
|  | ||||
|              | ||||
|                 <td class="attributes"> | ||||
|                  | ||||
|                     <optional><br> | ||||
|                  | ||||
|  | ||||
|                  | ||||
|  | ||||
|                  | ||||
|                 </td> | ||||
|              | ||||
|  | ||||
|              | ||||
|                 <td class="default"> | ||||
|                  | ||||
|                     null | ||||
|                  | ||||
|                 </td> | ||||
|              | ||||
|  | ||||
|             <td class="description last"></td> | ||||
|         </tr> | ||||
|  | ||||
|      | ||||
|     </tbody> | ||||
| </table> | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
| <dl class="details"> | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|     <dt class="tag-overrides">Overrides:</dt> | ||||
|     <dd class="tag-overrides"><ul class="dummy"><li> | ||||
|         <a href="AbstractEntity.html#markAsDeleted">AbstractEntity#markAsDeleted</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|     <dt class="tag-source">Source:</dt> | ||||
|     <dd class="tag-source"><ul class="dummy"><li> | ||||
|         <a href="becca_entities_abstract_entity.js.html">becca/entities/abstract_entity.js</a>, <a href="becca_entities_abstract_entity.js.html#line118">line 118</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
| </dl> | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|          | ||||
|              | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|     <h4 class="name" id="save"><span class="type-signature"></span>save<span class="signature">()</span><span class="type-signature"> → {<a href="AbstractEntity.html">AbstractEntity</a>}</span></h4> | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|  | ||||
|  | ||||
| <div class="description"> | ||||
|     Saves entity - executes SQL, but doesn't commit the transaction on its own | ||||
| </div> | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
| <dl class="details"> | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|     <dt class="tag-overrides">Overrides:</dt> | ||||
|     <dd class="tag-overrides"><ul class="dummy"><li> | ||||
|         <a href="AbstractEntity.html#save">AbstractEntity#save</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|     <dt class="tag-source">Source:</dt> | ||||
|     <dd class="tag-source"><ul class="dummy"><li> | ||||
|         <a href="becca_entities_abstract_entity.js.html">becca/entities/abstract_entity.js</a>, <a href="becca_entities_abstract_entity.js.html#line73">line 73</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
| </dl> | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
| <h5>Returns:</h5> | ||||
|  | ||||
|          | ||||
|  | ||||
|  | ||||
| <dl> | ||||
|     <dt> | ||||
|         Type | ||||
|     </dt> | ||||
|     <dd> | ||||
|          | ||||
| <span class="param-type"><a href="AbstractEntity.html">AbstractEntity</a></span> | ||||
|  | ||||
|  | ||||
|     </dd> | ||||
| </dl> | ||||
|  | ||||
|      | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|          | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
| </article> | ||||
|  | ||||
| </section> | ||||
| @@ -1290,13 +1571,13 @@ It's used for seamless note versioning.</div> | ||||
| </div> | ||||
|  | ||||
| <nav> | ||||
|     <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-sql.html">sql</a></li></ul><h3>Classes</h3><ul><li><a href="Attribute.html">Attribute</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li><li><a href="Branch.html">Branch</a></li><li><a href="EtapiToken.html">EtapiToken</a></li><li><a href="Note.html">Note</a></li><li><a href="NoteRevision.html">NoteRevision</a></li><li><a href="Option.html">Option</a></li><li><a href="RecentNote.html">RecentNote</a></li></ul><h3><a href="global.html">Global</a></h3> | ||||
|     <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-sql.html">sql</a></li></ul><h3>Classes</h3><ul><li><a href="AbstractEntity.html">AbstractEntity</a></li><li><a href="Attribute.html">Attribute</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li><li><a href="Branch.html">Branch</a></li><li><a href="EtapiToken.html">EtapiToken</a></li><li><a href="Note.html">Note</a></li><li><a href="NoteRevision.html">NoteRevision</a></li><li><a href="Option.html">Option</a></li><li><a href="RecentNote.html">RecentNote</a></li></ul><h3><a href="global.html">Global</a></h3> | ||||
| </nav> | ||||
|  | ||||
| <br class="clear"> | ||||
|  | ||||
| <footer> | ||||
|     Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.7</a> | ||||
|     Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> | ||||
| </footer> | ||||
|  | ||||
| <script> prettyPrint(); </script> | ||||
|   | ||||
| @@ -93,7 +93,7 @@ | ||||
|      | ||||
|     <dt class="tag-source">Source:</dt> | ||||
|     <dd class="tag-source"><ul class="dummy"><li> | ||||
|         <a href="becca_entities_option.js.html">becca/entities/option.js</a>, <a href="becca_entities_option.js.html#line9">line 9</a> | ||||
|         <a href="becca_entities_option.js.html">becca/entities/option.js</a>, <a href="becca_entities_option.js.html#line11">line 11</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
| @@ -127,6 +127,17 @@ | ||||
|     </div> | ||||
|  | ||||
|      | ||||
|         <h3 class="subsection-title">Extends</h3> | ||||
|  | ||||
|          | ||||
|  | ||||
|  | ||||
|     <ul> | ||||
|         <li><a href="AbstractEntity.html">AbstractEntity</a></li> | ||||
|     </ul> | ||||
|  | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
| @@ -193,7 +204,7 @@ | ||||
|      | ||||
|     <dt class="tag-source">Source:</dt> | ||||
|     <dd class="tag-source"><ul class="dummy"><li> | ||||
|         <a href="becca_entities_option.js.html">becca/entities/option.js</a>, <a href="becca_entities_option.js.html#line22">line 22</a> | ||||
|         <a href="becca_entities_option.js.html">becca/entities/option.js</a>, <a href="becca_entities_option.js.html#line24">line 24</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
| @@ -261,7 +272,7 @@ | ||||
|      | ||||
|     <dt class="tag-source">Source:</dt> | ||||
|     <dd class="tag-source"><ul class="dummy"><li> | ||||
|         <a href="becca_entities_option.js.html">becca/entities/option.js</a>, <a href="becca_entities_option.js.html#line18">line 18</a> | ||||
|         <a href="becca_entities_option.js.html">becca/entities/option.js</a>, <a href="becca_entities_option.js.html#line20">line 20</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
| @@ -329,7 +340,7 @@ | ||||
|      | ||||
|     <dt class="tag-source">Source:</dt> | ||||
|     <dd class="tag-source"><ul class="dummy"><li> | ||||
|         <a href="becca_entities_option.js.html">becca/entities/option.js</a>, <a href="becca_entities_option.js.html#line24">line 24</a> | ||||
|         <a href="becca_entities_option.js.html">becca/entities/option.js</a>, <a href="becca_entities_option.js.html#line26">line 26</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
| @@ -397,7 +408,158 @@ | ||||
|      | ||||
|     <dt class="tag-source">Source:</dt> | ||||
|     <dd class="tag-source"><ul class="dummy"><li> | ||||
|         <a href="becca_entities_option.js.html">becca/entities/option.js</a>, <a href="becca_entities_option.js.html#line20">line 20</a> | ||||
|         <a href="becca_entities_option.js.html">becca/entities/option.js</a>, <a href="becca_entities_option.js.html#line22">line 22</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
| </dl> | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|          | ||||
|      | ||||
|  | ||||
|      | ||||
|         <h3 class="subsection-title">Methods</h3> | ||||
|  | ||||
|          | ||||
|              | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|     <h4 class="name" id="markAsDeleted"><span class="type-signature"></span>markAsDeleted<span class="signature">(deleteId<span class="signature-attributes">opt</span>)</span><span class="type-signature"></span></h4> | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|  | ||||
|  | ||||
| <div class="description"> | ||||
|     Mark the entity as (soft) deleted. It will be completely erased later. | ||||
|  | ||||
| This is a low level method, for notes and branches use `note.deleteNote()` and 'branch.deleteBranch()` instead. | ||||
| </div> | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|     <h5>Parameters:</h5> | ||||
|      | ||||
|  | ||||
| <table class="params"> | ||||
|     <thead> | ||||
|     <tr> | ||||
|          | ||||
|         <th>Name</th> | ||||
|          | ||||
|  | ||||
|         <th>Type</th> | ||||
|  | ||||
|          | ||||
|         <th>Attributes</th> | ||||
|          | ||||
|  | ||||
|          | ||||
|         <th>Default</th> | ||||
|          | ||||
|  | ||||
|         <th class="last">Description</th> | ||||
|     </tr> | ||||
|     </thead> | ||||
|  | ||||
|     <tbody> | ||||
|      | ||||
|  | ||||
|         <tr> | ||||
|              | ||||
|                 <td class="name"><code>deleteId</code></td> | ||||
|              | ||||
|  | ||||
|             <td class="type"> | ||||
|              | ||||
|             </td> | ||||
|  | ||||
|              | ||||
|                 <td class="attributes"> | ||||
|                  | ||||
|                     <optional><br> | ||||
|                  | ||||
|  | ||||
|                  | ||||
|  | ||||
|                  | ||||
|                 </td> | ||||
|              | ||||
|  | ||||
|              | ||||
|                 <td class="default"> | ||||
|                  | ||||
|                     null | ||||
|                  | ||||
|                 </td> | ||||
|              | ||||
|  | ||||
|             <td class="description last"></td> | ||||
|         </tr> | ||||
|  | ||||
|      | ||||
|     </tbody> | ||||
| </table> | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
| <dl class="details"> | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|     <dt class="tag-overrides">Overrides:</dt> | ||||
|     <dd class="tag-overrides"><ul class="dummy"><li> | ||||
|         <a href="AbstractEntity.html#markAsDeleted">AbstractEntity#markAsDeleted</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|     <dt class="tag-source">Source:</dt> | ||||
|     <dd class="tag-source"><ul class="dummy"><li> | ||||
|         <a href="becca_entities_abstract_entity.js.html">becca/entities/abstract_entity.js</a>, <a href="becca_entities_abstract_entity.js.html#line118">line 118</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
| @@ -421,6 +583,129 @@ | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|          | ||||
|              | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|     <h4 class="name" id="save"><span class="type-signature"></span>save<span class="signature">()</span><span class="type-signature"> → {<a href="AbstractEntity.html">AbstractEntity</a>}</span></h4> | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|  | ||||
|  | ||||
| <div class="description"> | ||||
|     Saves entity - executes SQL, but doesn't commit the transaction on its own | ||||
| </div> | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
| <dl class="details"> | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|     <dt class="tag-overrides">Overrides:</dt> | ||||
|     <dd class="tag-overrides"><ul class="dummy"><li> | ||||
|         <a href="AbstractEntity.html#save">AbstractEntity#save</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|     <dt class="tag-source">Source:</dt> | ||||
|     <dd class="tag-source"><ul class="dummy"><li> | ||||
|         <a href="becca_entities_abstract_entity.js.html">becca/entities/abstract_entity.js</a>, <a href="becca_entities_abstract_entity.js.html#line73">line 73</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
| </dl> | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
| <h5>Returns:</h5> | ||||
|  | ||||
|          | ||||
|  | ||||
|  | ||||
| <dl> | ||||
|     <dt> | ||||
|         Type | ||||
|     </dt> | ||||
|     <dd> | ||||
|          | ||||
| <span class="param-type"><a href="AbstractEntity.html">AbstractEntity</a></span> | ||||
|  | ||||
|  | ||||
|     </dd> | ||||
| </dl> | ||||
|  | ||||
|      | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|          | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
| </article> | ||||
|  | ||||
| </section> | ||||
| @@ -431,13 +716,13 @@ | ||||
| </div> | ||||
|  | ||||
| <nav> | ||||
|     <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-sql.html">sql</a></li></ul><h3>Classes</h3><ul><li><a href="Attribute.html">Attribute</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li><li><a href="Branch.html">Branch</a></li><li><a href="EtapiToken.html">EtapiToken</a></li><li><a href="Note.html">Note</a></li><li><a href="NoteRevision.html">NoteRevision</a></li><li><a href="Option.html">Option</a></li><li><a href="RecentNote.html">RecentNote</a></li></ul><h3><a href="global.html">Global</a></h3> | ||||
|     <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-sql.html">sql</a></li></ul><h3>Classes</h3><ul><li><a href="AbstractEntity.html">AbstractEntity</a></li><li><a href="Attribute.html">Attribute</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li><li><a href="Branch.html">Branch</a></li><li><a href="EtapiToken.html">EtapiToken</a></li><li><a href="Note.html">Note</a></li><li><a href="NoteRevision.html">NoteRevision</a></li><li><a href="Option.html">Option</a></li><li><a href="RecentNote.html">RecentNote</a></li></ul><h3><a href="global.html">Global</a></h3> | ||||
| </nav> | ||||
|  | ||||
| <br class="clear"> | ||||
|  | ||||
| <footer> | ||||
|     Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.7</a> | ||||
|     Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> | ||||
| </footer> | ||||
|  | ||||
| <script> prettyPrint(); </script> | ||||
|   | ||||
| @@ -93,7 +93,7 @@ | ||||
|      | ||||
|     <dt class="tag-source">Source:</dt> | ||||
|     <dd class="tag-source"><ul class="dummy"><li> | ||||
|         <a href="becca_entities_recent_note.js.html">becca/entities/recent_note.js</a>, <a href="becca_entities_recent_note.js.html#line9">line 9</a> | ||||
|         <a href="becca_entities_recent_note.js.html">becca/entities/recent_note.js</a>, <a href="becca_entities_recent_note.js.html#line11">line 11</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
| @@ -127,6 +127,17 @@ | ||||
|     </div> | ||||
|  | ||||
|      | ||||
|         <h3 class="subsection-title">Extends</h3> | ||||
|  | ||||
|          | ||||
|  | ||||
|  | ||||
|     <ul> | ||||
|         <li><a href="AbstractEntity.html">AbstractEntity</a></li> | ||||
|     </ul> | ||||
|  | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
| @@ -193,7 +204,7 @@ | ||||
|      | ||||
|     <dt class="tag-source">Source:</dt> | ||||
|     <dd class="tag-source"><ul class="dummy"><li> | ||||
|         <a href="becca_entities_recent_note.js.html">becca/entities/recent_note.js</a>, <a href="becca_entities_recent_note.js.html#line17">line 17</a> | ||||
|         <a href="becca_entities_recent_note.js.html">becca/entities/recent_note.js</a>, <a href="becca_entities_recent_note.js.html#line19">line 19</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
| @@ -261,7 +272,7 @@ | ||||
|      | ||||
|     <dt class="tag-source">Source:</dt> | ||||
|     <dd class="tag-source"><ul class="dummy"><li> | ||||
|         <a href="becca_entities_recent_note.js.html">becca/entities/recent_note.js</a>, <a href="becca_entities_recent_note.js.html#line19">line 19</a> | ||||
|         <a href="becca_entities_recent_note.js.html">becca/entities/recent_note.js</a>, <a href="becca_entities_recent_note.js.html#line21">line 21</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
| @@ -329,7 +340,158 @@ | ||||
|      | ||||
|     <dt class="tag-source">Source:</dt> | ||||
|     <dd class="tag-source"><ul class="dummy"><li> | ||||
|         <a href="becca_entities_recent_note.js.html">becca/entities/recent_note.js</a>, <a href="becca_entities_recent_note.js.html#line21">line 21</a> | ||||
|         <a href="becca_entities_recent_note.js.html">becca/entities/recent_note.js</a>, <a href="becca_entities_recent_note.js.html#line23">line 23</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
| </dl> | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|          | ||||
|      | ||||
|  | ||||
|      | ||||
|         <h3 class="subsection-title">Methods</h3> | ||||
|  | ||||
|          | ||||
|              | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|     <h4 class="name" id="markAsDeleted"><span class="type-signature"></span>markAsDeleted<span class="signature">(deleteId<span class="signature-attributes">opt</span>)</span><span class="type-signature"></span></h4> | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|  | ||||
|  | ||||
| <div class="description"> | ||||
|     Mark the entity as (soft) deleted. It will be completely erased later. | ||||
|  | ||||
| This is a low level method, for notes and branches use `note.deleteNote()` and 'branch.deleteBranch()` instead. | ||||
| </div> | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|     <h5>Parameters:</h5> | ||||
|      | ||||
|  | ||||
| <table class="params"> | ||||
|     <thead> | ||||
|     <tr> | ||||
|          | ||||
|         <th>Name</th> | ||||
|          | ||||
|  | ||||
|         <th>Type</th> | ||||
|  | ||||
|          | ||||
|         <th>Attributes</th> | ||||
|          | ||||
|  | ||||
|          | ||||
|         <th>Default</th> | ||||
|          | ||||
|  | ||||
|         <th class="last">Description</th> | ||||
|     </tr> | ||||
|     </thead> | ||||
|  | ||||
|     <tbody> | ||||
|      | ||||
|  | ||||
|         <tr> | ||||
|              | ||||
|                 <td class="name"><code>deleteId</code></td> | ||||
|              | ||||
|  | ||||
|             <td class="type"> | ||||
|              | ||||
|             </td> | ||||
|  | ||||
|              | ||||
|                 <td class="attributes"> | ||||
|                  | ||||
|                     <optional><br> | ||||
|                  | ||||
|  | ||||
|                  | ||||
|  | ||||
|                  | ||||
|                 </td> | ||||
|              | ||||
|  | ||||
|              | ||||
|                 <td class="default"> | ||||
|                  | ||||
|                     null | ||||
|                  | ||||
|                 </td> | ||||
|              | ||||
|  | ||||
|             <td class="description last"></td> | ||||
|         </tr> | ||||
|  | ||||
|      | ||||
|     </tbody> | ||||
| </table> | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
| <dl class="details"> | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|     <dt class="tag-overrides">Overrides:</dt> | ||||
|     <dd class="tag-overrides"><ul class="dummy"><li> | ||||
|         <a href="AbstractEntity.html#markAsDeleted">AbstractEntity#markAsDeleted</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|     <dt class="tag-source">Source:</dt> | ||||
|     <dd class="tag-source"><ul class="dummy"><li> | ||||
|         <a href="becca_entities_abstract_entity.js.html">becca/entities/abstract_entity.js</a>, <a href="becca_entities_abstract_entity.js.html#line118">line 118</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
| @@ -353,6 +515,129 @@ | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|          | ||||
|              | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|     <h4 class="name" id="save"><span class="type-signature"></span>save<span class="signature">()</span><span class="type-signature"> → {<a href="AbstractEntity.html">AbstractEntity</a>}</span></h4> | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|  | ||||
|  | ||||
| <div class="description"> | ||||
|     Saves entity - executes SQL, but doesn't commit the transaction on its own | ||||
| </div> | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
| <dl class="details"> | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|     <dt class="tag-overrides">Overrides:</dt> | ||||
|     <dd class="tag-overrides"><ul class="dummy"><li> | ||||
|         <a href="AbstractEntity.html#save">AbstractEntity#save</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|     <dt class="tag-source">Source:</dt> | ||||
|     <dd class="tag-source"><ul class="dummy"><li> | ||||
|         <a href="becca_entities_abstract_entity.js.html">becca/entities/abstract_entity.js</a>, <a href="becca_entities_abstract_entity.js.html#line73">line 73</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
| </dl> | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
| <h5>Returns:</h5> | ||||
|  | ||||
|          | ||||
|  | ||||
|  | ||||
| <dl> | ||||
|     <dt> | ||||
|         Type | ||||
|     </dt> | ||||
|     <dd> | ||||
|          | ||||
| <span class="param-type"><a href="AbstractEntity.html">AbstractEntity</a></span> | ||||
|  | ||||
|  | ||||
|     </dd> | ||||
| </dl> | ||||
|  | ||||
|      | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|          | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
| </article> | ||||
|  | ||||
| </section> | ||||
| @@ -363,13 +648,13 @@ | ||||
| </div> | ||||
|  | ||||
| <nav> | ||||
|     <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-sql.html">sql</a></li></ul><h3>Classes</h3><ul><li><a href="Attribute.html">Attribute</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li><li><a href="Branch.html">Branch</a></li><li><a href="EtapiToken.html">EtapiToken</a></li><li><a href="Note.html">Note</a></li><li><a href="NoteRevision.html">NoteRevision</a></li><li><a href="Option.html">Option</a></li><li><a href="RecentNote.html">RecentNote</a></li></ul><h3><a href="global.html">Global</a></h3> | ||||
|     <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-sql.html">sql</a></li></ul><h3>Classes</h3><ul><li><a href="AbstractEntity.html">AbstractEntity</a></li><li><a href="Attribute.html">Attribute</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li><li><a href="Branch.html">Branch</a></li><li><a href="EtapiToken.html">EtapiToken</a></li><li><a href="Note.html">Note</a></li><li><a href="NoteRevision.html">NoteRevision</a></li><li><a href="Option.html">Option</a></li><li><a href="RecentNote.html">RecentNote</a></li></ul><h3><a href="global.html">Global</a></h3> | ||||
| </nav> | ||||
|  | ||||
| <br class="clear"> | ||||
|  | ||||
| <footer> | ||||
|     Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.7</a> | ||||
|     Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> | ||||
| </footer> | ||||
|  | ||||
| <script> prettyPrint(); </script> | ||||
|   | ||||
							
								
								
									
										211
									
								
								docs/backend_api/becca_entities_abstract_entity.js.html
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										211
									
								
								docs/backend_api/becca_entities_abstract_entity.js.html
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,211 @@ | ||||
| <!DOCTYPE html> | ||||
| <html lang="en"> | ||||
| <head> | ||||
|     <meta charset="utf-8"> | ||||
|     <title>JSDoc: Source: becca/entities/abstract_entity.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: becca/entities/abstract_entity.js</h1> | ||||
|  | ||||
|      | ||||
|  | ||||
|  | ||||
|  | ||||
|      | ||||
|     <section> | ||||
|         <article> | ||||
|             <pre class="prettyprint source linenums"><code>"use strict"; | ||||
|  | ||||
| const utils = require('../../services/utils'); | ||||
| const sql = require('../../services/sql'); | ||||
| const entityChangesService = require('../../services/entity_changes'); | ||||
| const eventService = require("../../services/events"); | ||||
| const dateUtils = require("../../services/date_utils"); | ||||
| const cls = require("../../services/cls"); | ||||
| const log = require("../../services/log"); | ||||
|  | ||||
| let becca = null; | ||||
|  | ||||
| /** | ||||
|  * Base class for all backend entities. | ||||
|  */ | ||||
| class AbstractEntity { | ||||
|     beforeSaving() { | ||||
|         this.generateIdIfNecessary(); | ||||
|     } | ||||
|  | ||||
|     generateIdIfNecessary() { | ||||
|         if (!this[this.constructor.primaryKeyName]) { | ||||
|             this[this.constructor.primaryKeyName] = utils.newEntityId(); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     generateHash(isDeleted = false) { | ||||
|         let contentToHash = ""; | ||||
|  | ||||
|         for (const propertyName of this.constructor.hashedProperties) { | ||||
|             contentToHash += "|" + this[propertyName]; | ||||
|         } | ||||
|  | ||||
|         if (isDeleted) { | ||||
|             contentToHash += "|deleted"; | ||||
|         } | ||||
|  | ||||
|         return utils.hash(contentToHash).substr(0, 10); | ||||
|     } | ||||
|  | ||||
|     getUtcDateChanged() { | ||||
|         return this.utcDateModified || this.utcDateCreated; | ||||
|     } | ||||
|  | ||||
|     get becca() { | ||||
|         if (!becca) { | ||||
|             becca = require('../becca'); | ||||
|         } | ||||
|  | ||||
|         return becca; | ||||
|     } | ||||
|  | ||||
|     addEntityChange(isDeleted = false) { | ||||
|         entityChangesService.addEntityChange({ | ||||
|             entityName: this.constructor.entityName, | ||||
|             entityId: this[this.constructor.primaryKeyName], | ||||
|             hash: this.generateHash(isDeleted), | ||||
|             isErased: false, | ||||
|             utcDateChanged: this.getUtcDateChanged(), | ||||
|             isSynced: this.constructor.entityName !== 'options' || !!this.isSynced | ||||
|         }); | ||||
|     } | ||||
|  | ||||
|     getPojoToSave() { | ||||
|         return this.getPojo(); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Saves entity - executes SQL, but doesn't commit the transaction on its own | ||||
|      * | ||||
|      * @returns {AbstractEntity} | ||||
|      */ | ||||
|     save() { | ||||
|         const entityName = this.constructor.entityName; | ||||
|         const primaryKeyName = this.constructor.primaryKeyName; | ||||
|  | ||||
|         const isNewEntity = !this[primaryKeyName]; | ||||
|  | ||||
|         if (this.beforeSaving) { | ||||
|             this.beforeSaving(); | ||||
|         } | ||||
|  | ||||
|         const pojo = this.getPojoToSave(); | ||||
|  | ||||
|         sql.transactional(() => { | ||||
|             sql.upsert(entityName, primaryKeyName, pojo); | ||||
|  | ||||
|             if (entityName === 'recent_notes') { | ||||
|                 return; | ||||
|             } | ||||
|  | ||||
|             this.addEntityChange(false); | ||||
|  | ||||
|             if (!cls.isEntityEventsDisabled()) { | ||||
|                 const eventPayload = { | ||||
|                     entityName, | ||||
|                     entity: this | ||||
|                 }; | ||||
|  | ||||
|                 if (isNewEntity) { | ||||
|                     eventService.emit(eventService.ENTITY_CREATED, eventPayload); | ||||
|                 } | ||||
|  | ||||
|                 eventService.emit(eventService.ENTITY_CHANGED, eventPayload); | ||||
|             } | ||||
|         }); | ||||
|  | ||||
|         return this; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Mark the entity as (soft) deleted. It will be completely erased later. | ||||
|      * | ||||
|      * This is a low level method, for notes and branches use `note.deleteNote()` and 'branch.deleteBranch()` instead. | ||||
|      * | ||||
|      * @param [deleteId=null] | ||||
|      */ | ||||
|     markAsDeleted(deleteId = null) { | ||||
|         const entityId = this[this.constructor.primaryKeyName]; | ||||
|         const entityName = this.constructor.entityName; | ||||
|  | ||||
|         this.utcDateModified = dateUtils.utcNowDateTime(); | ||||
|  | ||||
|         sql.execute(`UPDATE ${entityName} SET isDeleted = 1, deleteId = ?, utcDateModified = ? | ||||
|                            WHERE ${this.constructor.primaryKeyName} = ?`, | ||||
|             [deleteId, this.utcDateModified, entityId]); | ||||
|  | ||||
|         if (this.dateModified) { | ||||
|             this.dateModified = dateUtils.localNowDateTime(); | ||||
|  | ||||
|             sql.execute(`UPDATE ${entityName} SET dateModified = ? WHERE ${this.constructor.primaryKeyName} = ?`, | ||||
|                 [this.dateModified, entityId]); | ||||
|         } | ||||
|  | ||||
|         log.info(`Marking ${entityName} ${entityId} as deleted`); | ||||
|  | ||||
|         this.addEntityChange(true); | ||||
|  | ||||
|         eventService.emit(eventService.ENTITY_DELETED, { entityName, entityId, entity: this }); | ||||
|     } | ||||
|  | ||||
|     markAsDeletedSimple() { | ||||
|         const entityId = this[this.constructor.primaryKeyName]; | ||||
|         const entityName = this.constructor.entityName; | ||||
|  | ||||
|         this.utcDateModified = dateUtils.utcNowDateTime(); | ||||
|  | ||||
|         sql.execute(`UPDATE ${entityName} SET isDeleted = 1, utcDateModified = ? | ||||
|                            WHERE ${this.constructor.primaryKeyName} = ?`, | ||||
|             [this.utcDateModified, entityId]); | ||||
|  | ||||
|         log.info(`Marking ${entityName} ${entityId} as deleted`); | ||||
|  | ||||
|         this.addEntityChange(true); | ||||
|  | ||||
|         eventService.emit(eventService.ENTITY_DELETED, { entityName, entityId, entity: this }); | ||||
|     } | ||||
| } | ||||
|  | ||||
| module.exports = AbstractEntity; | ||||
| </code></pre> | ||||
|         </article> | ||||
|     </section> | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
| </div> | ||||
|  | ||||
| <nav> | ||||
|     <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-sql.html">sql</a></li></ul><h3>Classes</h3><ul><li><a href="AbstractEntity.html">AbstractEntity</a></li><li><a href="Attribute.html">Attribute</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li><li><a href="Branch.html">Branch</a></li><li><a href="EtapiToken.html">EtapiToken</a></li><li><a href="Note.html">Note</a></li><li><a href="NoteRevision.html">NoteRevision</a></li><li><a href="Option.html">Option</a></li><li><a href="RecentNote.html">RecentNote</a></li></ul><h3><a href="global.html">Global</a></h3> | ||||
| </nav> | ||||
|  | ||||
| <br class="clear"> | ||||
|  | ||||
| <footer> | ||||
|     Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> | ||||
| </footer> | ||||
|  | ||||
| <script> prettyPrint(); </script> | ||||
| <script src="scripts/linenumber.js"> </script> | ||||
| </body> | ||||
| </html> | ||||
| @@ -37,6 +37,8 @@ const promotedAttributeDefinitionParser = require("../../services/promoted_attri | ||||
| /** | ||||
|  * Attribute is an abstract concept which has two real uses - label (key - value pair) | ||||
|  * and relation (representing named relationship between source and target note) | ||||
|  * | ||||
|  * @extends AbstractEntity | ||||
|  */ | ||||
| class Attribute extends AbstractEntity { | ||||
|     static get entityName() { return "attributes"; } | ||||
| @@ -245,13 +247,13 @@ module.exports = Attribute; | ||||
| </div> | ||||
|  | ||||
| <nav> | ||||
|     <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-sql.html">sql</a></li></ul><h3>Classes</h3><ul><li><a href="Attribute.html">Attribute</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li><li><a href="Branch.html">Branch</a></li><li><a href="EtapiToken.html">EtapiToken</a></li><li><a href="Note.html">Note</a></li><li><a href="NoteRevision.html">NoteRevision</a></li><li><a href="Option.html">Option</a></li><li><a href="RecentNote.html">RecentNote</a></li></ul><h3><a href="global.html">Global</a></h3> | ||||
|     <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-sql.html">sql</a></li></ul><h3>Classes</h3><ul><li><a href="AbstractEntity.html">AbstractEntity</a></li><li><a href="Attribute.html">Attribute</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li><li><a href="Branch.html">Branch</a></li><li><a href="EtapiToken.html">EtapiToken</a></li><li><a href="Note.html">Note</a></li><li><a href="NoteRevision.html">NoteRevision</a></li><li><a href="Option.html">Option</a></li><li><a href="RecentNote.html">RecentNote</a></li></ul><h3><a href="global.html">Global</a></h3> | ||||
| </nav> | ||||
|  | ||||
| <br class="clear"> | ||||
|  | ||||
| <footer> | ||||
|     Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.7</a> | ||||
|     Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> | ||||
| </footer> | ||||
|  | ||||
| <script> prettyPrint(); </script> | ||||
|   | ||||
| @@ -32,10 +32,16 @@ const Note = require('./note'); | ||||
| const AbstractEntity = require("./abstract_entity"); | ||||
| const sql = require("../../services/sql"); | ||||
| const dateUtils = require("../../services/date_utils"); | ||||
| const utils = require("../../services/utils.js"); | ||||
| const TaskContext = require("../../services/task_context.js"); | ||||
| const cls = require("../../services/cls.js"); | ||||
| const log = require("../../services/log.js"); | ||||
|  | ||||
| /** | ||||
|  * Branch represents a relationship between a child note and its parent note. Trilium allows a note to have multiple | ||||
|  * parents. | ||||
|  * | ||||
|  * @extends AbstractEntity | ||||
|  */ | ||||
| class Branch extends AbstractEntity { | ||||
|     static get entityName() { return "branches"; } | ||||
| @@ -140,6 +146,63 @@ class Branch extends AbstractEntity { | ||||
|         return !(this.branchId in this.becca.branches); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Delete a branch. If this is a last note's branch, delete the note as well. | ||||
|      * | ||||
|      * @param {string} [deleteId] - optional delete identified | ||||
|      * @param {TaskContext} [taskContext] | ||||
|      * | ||||
|      * @return {boolean} - true if note has been deleted, false otherwise | ||||
|      */ | ||||
|     deleteBranch(deleteId, taskContext) { | ||||
|         if (!deleteId) { | ||||
|             deleteId = utils.randomString(10); | ||||
|         } | ||||
|  | ||||
|         if (!taskContext) { | ||||
|             taskContext = new TaskContext('no-progress-reporting'); | ||||
|         } | ||||
|  | ||||
|         taskContext.increaseProgressCount(); | ||||
|  | ||||
|         if (this.branchId === 'root' | ||||
|             || this.noteId === 'root' | ||||
|             || this.noteId === cls.getHoistedNoteId()) { | ||||
|  | ||||
|             throw new Error("Can't delete root or hoisted branch/note"); | ||||
|         } | ||||
|  | ||||
|         this.markAsDeleted(deleteId); | ||||
|  | ||||
|         const note = this.getNote(); | ||||
|         const notDeletedBranches = note.getParentBranches(); | ||||
|  | ||||
|         if (notDeletedBranches.length === 0) { | ||||
|             for (const childBranch of note.getChildBranches()) { | ||||
|                 childBranch.deleteBranch(deleteId, taskContext); | ||||
|             } | ||||
|  | ||||
|             // first delete children and then parent - this will show up better in recent changes | ||||
|  | ||||
|             log.info("Deleting note " + note.noteId); | ||||
|  | ||||
|             for (const attribute of note.getOwnedAttributes()) { | ||||
|                 attribute.markAsDeleted(deleteId); | ||||
|             } | ||||
|  | ||||
|             for (const relation of note.getTargetRelations()) { | ||||
|                 relation.markAsDeleted(deleteId); | ||||
|             } | ||||
|  | ||||
|             note.markAsDeleted(deleteId); | ||||
|  | ||||
|             return true; | ||||
|         } | ||||
|         else { | ||||
|             return false; | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     beforeSaving() { | ||||
|         if (this.notePosition === undefined || this.notePosition === null) { | ||||
|             // TODO finding new position can be refactored into becca | ||||
| @@ -193,13 +256,13 @@ module.exports = Branch; | ||||
| </div> | ||||
|  | ||||
| <nav> | ||||
|     <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-sql.html">sql</a></li></ul><h3>Classes</h3><ul><li><a href="Attribute.html">Attribute</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li><li><a href="Branch.html">Branch</a></li><li><a href="EtapiToken.html">EtapiToken</a></li><li><a href="Note.html">Note</a></li><li><a href="NoteRevision.html">NoteRevision</a></li><li><a href="Option.html">Option</a></li><li><a href="RecentNote.html">RecentNote</a></li></ul><h3><a href="global.html">Global</a></h3> | ||||
|     <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-sql.html">sql</a></li></ul><h3>Classes</h3><ul><li><a href="AbstractEntity.html">AbstractEntity</a></li><li><a href="Attribute.html">Attribute</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li><li><a href="Branch.html">Branch</a></li><li><a href="EtapiToken.html">EtapiToken</a></li><li><a href="Note.html">Note</a></li><li><a href="NoteRevision.html">NoteRevision</a></li><li><a href="Option.html">Option</a></li><li><a href="RecentNote.html">RecentNote</a></li></ul><h3><a href="global.html">Global</a></h3> | ||||
| </nav> | ||||
|  | ||||
| <br class="clear"> | ||||
|  | ||||
| <footer> | ||||
|     Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.7</a> | ||||
|     Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> | ||||
| </footer> | ||||
|  | ||||
| <script> prettyPrint(); </script> | ||||
|   | ||||
| @@ -30,7 +30,6 @@ | ||||
|  | ||||
| const dateUtils = require('../../services/date_utils'); | ||||
| const AbstractEntity = require("./abstract_entity"); | ||||
| const sql = require("../../services/sql.js"); | ||||
|  | ||||
| /** | ||||
|  * EtapiToken is an entity representing token used to authenticate against Trilium REST API from client applications. | ||||
| @@ -40,6 +39,8 @@ const sql = require("../../services/sql.js"); | ||||
|  * | ||||
|  * The format user is presented with is "<etapiTokenId>_<tokenHash>". This is also called "authToken" to distinguish it | ||||
|  * from tokenHash and token. | ||||
|  * | ||||
|  * @extends AbstractEntity | ||||
|  */ | ||||
| class EtapiToken extends AbstractEntity { | ||||
|     static get entityName() { return "etapi_tokens"; } | ||||
| @@ -71,7 +72,9 @@ class EtapiToken extends AbstractEntity { | ||||
|         /** @type {boolean} */ | ||||
|         this.isDeleted = !!row.isDeleted; | ||||
|  | ||||
|         this.becca.etapiTokens[this.etapiTokenId] = this; | ||||
|         if (this.etapiTokenId) { | ||||
|             this.becca.etapiTokens[this.etapiTokenId] = this; | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     init() { | ||||
| @@ -111,13 +114,13 @@ module.exports = EtapiToken; | ||||
| </div> | ||||
|  | ||||
| <nav> | ||||
|     <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-sql.html">sql</a></li></ul><h3>Classes</h3><ul><li><a href="Attribute.html">Attribute</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li><li><a href="Branch.html">Branch</a></li><li><a href="EtapiToken.html">EtapiToken</a></li><li><a href="Note.html">Note</a></li><li><a href="NoteRevision.html">NoteRevision</a></li><li><a href="Option.html">Option</a></li><li><a href="RecentNote.html">RecentNote</a></li></ul><h3><a href="global.html">Global</a></h3> | ||||
|     <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-sql.html">sql</a></li></ul><h3>Classes</h3><ul><li><a href="AbstractEntity.html">AbstractEntity</a></li><li><a href="Attribute.html">Attribute</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li><li><a href="Branch.html">Branch</a></li><li><a href="EtapiToken.html">EtapiToken</a></li><li><a href="Note.html">Note</a></li><li><a href="NoteRevision.html">NoteRevision</a></li><li><a href="Option.html">Option</a></li><li><a href="RecentNote.html">RecentNote</a></li></ul><h3><a href="global.html">Global</a></h3> | ||||
| </nav> | ||||
|  | ||||
| <br class="clear"> | ||||
|  | ||||
| <footer> | ||||
|     Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.7</a> | ||||
|     Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> | ||||
| </footer> | ||||
|  | ||||
| <script> prettyPrint(); </script> | ||||
|   | ||||
| @@ -36,12 +36,17 @@ const dateUtils = require('../../services/date_utils'); | ||||
| const entityChangesService = require('../../services/entity_changes'); | ||||
| const AbstractEntity = require("./abstract_entity"); | ||||
| const NoteRevision = require("./note_revision"); | ||||
| const TaskContext = require("../../services/task_context.js"); | ||||
| const optionService = require("../../services/options.js"); | ||||
| const noteRevisionService = require("../../services/note_revisions.js"); | ||||
|  | ||||
| const LABEL = 'label'; | ||||
| const RELATION = 'relation'; | ||||
|  | ||||
| /** | ||||
|  * Trilium's main entity which can represent text note, image, code note, file attachment etc. | ||||
|  * | ||||
|  * @extends AbstractEntity | ||||
|  */ | ||||
| class Note extends AbstractEntity { | ||||
|     static get entityName() { return "notes"; } | ||||
| @@ -263,7 +268,7 @@ class Note extends AbstractEntity { | ||||
|  | ||||
|     setContent(content, ignoreMissingProtectedSession = false) { | ||||
|         if (content === null || content === undefined) { | ||||
|             throw new Error(`Cannot set null content to note ${this.noteId}`); | ||||
|             throw new Error(`Cannot set null content to note '${this.noteId}'`); | ||||
|         } | ||||
|  | ||||
|         if (this.isStringNote()) { | ||||
| @@ -285,7 +290,7 @@ class Note extends AbstractEntity { | ||||
|                 pojo.content = protectedSessionService.encrypt(pojo.content); | ||||
|             } | ||||
|             else if (!ignoreMissingProtectedSession) { | ||||
|                 throw new Error(`Cannot update content of noteId=${this.noteId} since we're out of protected session.`); | ||||
|                 throw new Error(`Cannot update content of noteId '${this.noteId}' since we're out of protected session.`); | ||||
|             } | ||||
|         } | ||||
|  | ||||
| @@ -1151,10 +1156,31 @@ class Note extends AbstractEntity { | ||||
|         return cloningService.cloneNoteToBranch(this.noteId, branch.branchId); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * (Soft) delete a note and all its descendants. | ||||
|      * | ||||
|      * @param {string} [deleteId] - optional delete identified | ||||
|      * @param {TaskContext} [taskContext] | ||||
|      */ | ||||
|     deleteNote(deleteId, taskContext) { | ||||
|         if (!deleteId) { | ||||
|             deleteId = utils.randomString(10); | ||||
|         } | ||||
|  | ||||
|         if (!taskContext) { | ||||
|             taskContext = new TaskContext('no-progress-reporting'); | ||||
|         } | ||||
|  | ||||
|         for (const branch of this.getParentBranches()) { | ||||
|             branch.deleteBranch(deleteId, taskContext); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     decrypt() { | ||||
|         if (this.isProtected && !this.isDecrypted && protectedSessionService.isProtectedSessionAvailable()) { | ||||
|             try { | ||||
|                 this.title = protectedSessionService.decryptString(this.title); | ||||
|                 this.flatTextCache = null; | ||||
|  | ||||
|                 this.isDecrypted = true; | ||||
|             } | ||||
| @@ -1168,6 +1194,41 @@ class Note extends AbstractEntity { | ||||
|         return !(this.noteId in this.becca.notes); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @return {NoteRevision|null} | ||||
|      */ | ||||
|     saveNoteRevision() { | ||||
|         const content = this.getContent(); | ||||
|  | ||||
|         if (!content || (Buffer.isBuffer(content) && content.byteLength === 0)) { | ||||
|             return null; | ||||
|         } | ||||
|  | ||||
|         const contentMetadata = this.getContentMetadata(); | ||||
|  | ||||
|         const noteRevision = new NoteRevision({ | ||||
|             noteId: this.noteId, | ||||
|             // title and text should be decrypted now | ||||
|             title: this.title, | ||||
|             type: this.type, | ||||
|             mime: this.mime, | ||||
|             isProtected: false, // will be fixed in the protectNoteRevisions() call | ||||
|             utcDateLastEdited: this.utcDateModified > contentMetadata.utcDateModified | ||||
|                 ? this.utcDateModified | ||||
|                 : contentMetadata.utcDateModified, | ||||
|             utcDateCreated: dateUtils.utcNowDateTime(), | ||||
|             utcDateModified: dateUtils.utcNowDateTime(), | ||||
|             dateLastEdited: this.dateModified > contentMetadata.dateModified | ||||
|                 ? this.dateModified | ||||
|                 : contentMetadata.dateModified, | ||||
|             dateCreated: dateUtils.localNowDateTime() | ||||
|         }).save(); | ||||
|  | ||||
|         noteRevision.setContent(content); | ||||
|  | ||||
|         return noteRevision; | ||||
|     } | ||||
|  | ||||
|     beforeSaving() { | ||||
|         super.beforeSaving(); | ||||
|  | ||||
| @@ -1220,13 +1281,13 @@ module.exports = Note; | ||||
| </div> | ||||
|  | ||||
| <nav> | ||||
|     <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-sql.html">sql</a></li></ul><h3>Classes</h3><ul><li><a href="Attribute.html">Attribute</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li><li><a href="Branch.html">Branch</a></li><li><a href="EtapiToken.html">EtapiToken</a></li><li><a href="Note.html">Note</a></li><li><a href="NoteRevision.html">NoteRevision</a></li><li><a href="Option.html">Option</a></li><li><a href="RecentNote.html">RecentNote</a></li></ul><h3><a href="global.html">Global</a></h3> | ||||
|     <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-sql.html">sql</a></li></ul><h3>Classes</h3><ul><li><a href="AbstractEntity.html">AbstractEntity</a></li><li><a href="Attribute.html">Attribute</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li><li><a href="Branch.html">Branch</a></li><li><a href="EtapiToken.html">EtapiToken</a></li><li><a href="Note.html">Note</a></li><li><a href="NoteRevision.html">NoteRevision</a></li><li><a href="Option.html">Option</a></li><li><a href="RecentNote.html">RecentNote</a></li></ul><h3><a href="global.html">Global</a></h3> | ||||
| </nav> | ||||
|  | ||||
| <br class="clear"> | ||||
|  | ||||
| <footer> | ||||
|     Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.7</a> | ||||
|     Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> | ||||
| </footer> | ||||
|  | ||||
| <script> prettyPrint(); </script> | ||||
|   | ||||
| @@ -39,6 +39,8 @@ const AbstractEntity = require("./abstract_entity"); | ||||
| /** | ||||
|  * NoteRevision represents snapshot of note's title and content at some point in the past. | ||||
|  * It's used for seamless note versioning. | ||||
|  * | ||||
|  * @extends AbstractEntity | ||||
|  */ | ||||
| class NoteRevision extends AbstractEntity { | ||||
|     static get entityName() { return "note_revisions"; } | ||||
| @@ -230,13 +232,13 @@ module.exports = NoteRevision; | ||||
| </div> | ||||
|  | ||||
| <nav> | ||||
|     <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-sql.html">sql</a></li></ul><h3>Classes</h3><ul><li><a href="Attribute.html">Attribute</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li><li><a href="Branch.html">Branch</a></li><li><a href="EtapiToken.html">EtapiToken</a></li><li><a href="Note.html">Note</a></li><li><a href="NoteRevision.html">NoteRevision</a></li><li><a href="Option.html">Option</a></li><li><a href="RecentNote.html">RecentNote</a></li></ul><h3><a href="global.html">Global</a></h3> | ||||
|     <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-sql.html">sql</a></li></ul><h3>Classes</h3><ul><li><a href="AbstractEntity.html">AbstractEntity</a></li><li><a href="Attribute.html">Attribute</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li><li><a href="Branch.html">Branch</a></li><li><a href="EtapiToken.html">EtapiToken</a></li><li><a href="Note.html">Note</a></li><li><a href="NoteRevision.html">NoteRevision</a></li><li><a href="Option.html">Option</a></li><li><a href="RecentNote.html">RecentNote</a></li></ul><h3><a href="global.html">Global</a></h3> | ||||
| </nav> | ||||
|  | ||||
| <br class="clear"> | ||||
|  | ||||
| <footer> | ||||
|     Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.7</a> | ||||
|     Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> | ||||
| </footer> | ||||
|  | ||||
| <script> prettyPrint(); </script> | ||||
|   | ||||
| @@ -33,6 +33,8 @@ const AbstractEntity = require("./abstract_entity"); | ||||
|  | ||||
| /** | ||||
|  * Option represents name-value pair, either directly configurable by the user or some system property. | ||||
|  * | ||||
|  * @extends AbstractEntity | ||||
|  */ | ||||
| class Option extends AbstractEntity { | ||||
|     static get entityName() { return "options"; } | ||||
| @@ -81,13 +83,13 @@ module.exports = Option; | ||||
| </div> | ||||
|  | ||||
| <nav> | ||||
|     <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-sql.html">sql</a></li></ul><h3>Classes</h3><ul><li><a href="Attribute.html">Attribute</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li><li><a href="Branch.html">Branch</a></li><li><a href="EtapiToken.html">EtapiToken</a></li><li><a href="Note.html">Note</a></li><li><a href="NoteRevision.html">NoteRevision</a></li><li><a href="Option.html">Option</a></li><li><a href="RecentNote.html">RecentNote</a></li></ul><h3><a href="global.html">Global</a></h3> | ||||
|     <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-sql.html">sql</a></li></ul><h3>Classes</h3><ul><li><a href="AbstractEntity.html">AbstractEntity</a></li><li><a href="Attribute.html">Attribute</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li><li><a href="Branch.html">Branch</a></li><li><a href="EtapiToken.html">EtapiToken</a></li><li><a href="Note.html">Note</a></li><li><a href="NoteRevision.html">NoteRevision</a></li><li><a href="Option.html">Option</a></li><li><a href="RecentNote.html">RecentNote</a></li></ul><h3><a href="global.html">Global</a></h3> | ||||
| </nav> | ||||
|  | ||||
| <br class="clear"> | ||||
|  | ||||
| <footer> | ||||
|     Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.7</a> | ||||
|     Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> | ||||
| </footer> | ||||
|  | ||||
| <script> prettyPrint(); </script> | ||||
|   | ||||
| @@ -33,6 +33,8 @@ const AbstractEntity = require("./abstract_entity"); | ||||
|  | ||||
| /** | ||||
|  * RecentNote represents recently visited note. | ||||
|  * | ||||
|  * @extends AbstractEntity | ||||
|  */ | ||||
| class RecentNote extends AbstractEntity { | ||||
|     static get entityName() { return "recent_notes"; } | ||||
| @@ -69,13 +71,13 @@ module.exports = RecentNote; | ||||
| </div> | ||||
|  | ||||
| <nav> | ||||
|     <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-sql.html">sql</a></li></ul><h3>Classes</h3><ul><li><a href="Attribute.html">Attribute</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li><li><a href="Branch.html">Branch</a></li><li><a href="EtapiToken.html">EtapiToken</a></li><li><a href="Note.html">Note</a></li><li><a href="NoteRevision.html">NoteRevision</a></li><li><a href="Option.html">Option</a></li><li><a href="RecentNote.html">RecentNote</a></li></ul><h3><a href="global.html">Global</a></h3> | ||||
|     <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-sql.html">sql</a></li></ul><h3>Classes</h3><ul><li><a href="AbstractEntity.html">AbstractEntity</a></li><li><a href="Attribute.html">Attribute</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li><li><a href="Branch.html">Branch</a></li><li><a href="EtapiToken.html">EtapiToken</a></li><li><a href="Note.html">Note</a></li><li><a href="NoteRevision.html">NoteRevision</a></li><li><a href="Option.html">Option</a></li><li><a href="RecentNote.html">RecentNote</a></li></ul><h3><a href="global.html">Global</a></h3> | ||||
| </nav> | ||||
|  | ||||
| <br class="clear"> | ||||
|  | ||||
| <footer> | ||||
|     Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.7</a> | ||||
|     Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> | ||||
| </footer> | ||||
|  | ||||
| <script> prettyPrint(); </script> | ||||
|   | ||||
| @@ -237,7 +237,7 @@ | ||||
|  | ||||
|              | ||||
|  | ||||
|             <td class="description last">text, code, file, image, search, book, relation-map - MANDATORY</td> | ||||
|             <td class="description last">text, code, file, image, search, book, relation-map, canvas - MANDATORY</td> | ||||
|         </tr> | ||||
|  | ||||
|      | ||||
| @@ -1083,13 +1083,13 @@ | ||||
| </div> | ||||
|  | ||||
| <nav> | ||||
|     <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-sql.html">sql</a></li></ul><h3>Classes</h3><ul><li><a href="Attribute.html">Attribute</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li><li><a href="Branch.html">Branch</a></li><li><a href="EtapiToken.html">EtapiToken</a></li><li><a href="Note.html">Note</a></li><li><a href="NoteRevision.html">NoteRevision</a></li><li><a href="Option.html">Option</a></li><li><a href="RecentNote.html">RecentNote</a></li></ul><h3><a href="global.html">Global</a></h3> | ||||
|     <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-sql.html">sql</a></li></ul><h3>Classes</h3><ul><li><a href="AbstractEntity.html">AbstractEntity</a></li><li><a href="Attribute.html">Attribute</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li><li><a href="Branch.html">Branch</a></li><li><a href="EtapiToken.html">EtapiToken</a></li><li><a href="Note.html">Note</a></li><li><a href="NoteRevision.html">NoteRevision</a></li><li><a href="Option.html">Option</a></li><li><a href="RecentNote.html">RecentNote</a></li></ul><h3><a href="global.html">Global</a></h3> | ||||
| </nav> | ||||
|  | ||||
| <br class="clear"> | ||||
|  | ||||
| <footer> | ||||
|     Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.7</a> | ||||
|     Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> | ||||
| </footer> | ||||
|  | ||||
| <script> prettyPrint(); </script> | ||||
|   | ||||
| @@ -50,13 +50,13 @@ | ||||
| </div> | ||||
|  | ||||
| <nav> | ||||
|     <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-sql.html">sql</a></li></ul><h3>Classes</h3><ul><li><a href="Attribute.html">Attribute</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li><li><a href="Branch.html">Branch</a></li><li><a href="EtapiToken.html">EtapiToken</a></li><li><a href="Note.html">Note</a></li><li><a href="NoteRevision.html">NoteRevision</a></li><li><a href="Option.html">Option</a></li><li><a href="RecentNote.html">RecentNote</a></li></ul><h3><a href="global.html">Global</a></h3> | ||||
|     <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-sql.html">sql</a></li></ul><h3>Classes</h3><ul><li><a href="AbstractEntity.html">AbstractEntity</a></li><li><a href="Attribute.html">Attribute</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li><li><a href="Branch.html">Branch</a></li><li><a href="EtapiToken.html">EtapiToken</a></li><li><a href="Note.html">Note</a></li><li><a href="NoteRevision.html">NoteRevision</a></li><li><a href="Option.html">Option</a></li><li><a href="RecentNote.html">RecentNote</a></li></ul><h3><a href="global.html">Global</a></h3> | ||||
| </nav> | ||||
|  | ||||
| <br class="clear"> | ||||
|  | ||||
| <footer> | ||||
|     Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.7</a> | ||||
|     Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> | ||||
| </footer> | ||||
|  | ||||
| <script> prettyPrint(); </script> | ||||
|   | ||||
| @@ -208,7 +208,7 @@ | ||||
|      | ||||
|     <dt class="tag-source">Source:</dt> | ||||
|     <dd class="tag-source"><ul class="dummy"><li> | ||||
|         <a href="services_sql.js.html">services/sql.js</a>, <a href="services_sql.js.html#line345">line 345</a> | ||||
|         <a href="services_sql.js.html">services/sql.js</a>, <a href="services_sql.js.html#line355">line 355</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
| @@ -388,7 +388,7 @@ | ||||
|      | ||||
|     <dt class="tag-source">Source:</dt> | ||||
|     <dd class="tag-source"><ul class="dummy"><li> | ||||
|         <a href="services_sql.js.html">services/sql.js</a>, <a href="services_sql.js.html#line336">line 336</a> | ||||
|         <a href="services_sql.js.html">services/sql.js</a>, <a href="services_sql.js.html#line346">line 346</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
| @@ -590,7 +590,7 @@ | ||||
|      | ||||
|     <dt class="tag-source">Source:</dt> | ||||
|     <dd class="tag-source"><ul class="dummy"><li> | ||||
|         <a href="services_sql.js.html">services/sql.js</a>, <a href="services_sql.js.html#line326">line 326</a> | ||||
|         <a href="services_sql.js.html">services/sql.js</a>, <a href="services_sql.js.html#line336">line 336</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
| @@ -792,7 +792,7 @@ | ||||
|      | ||||
|     <dt class="tag-source">Source:</dt> | ||||
|     <dd class="tag-source"><ul class="dummy"><li> | ||||
|         <a href="services_sql.js.html">services/sql.js</a>, <a href="services_sql.js.html#line302">line 302</a> | ||||
|         <a href="services_sql.js.html">services/sql.js</a>, <a href="services_sql.js.html#line312">line 312</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
| @@ -994,7 +994,7 @@ | ||||
|      | ||||
|     <dt class="tag-source">Source:</dt> | ||||
|     <dd class="tag-source"><ul class="dummy"><li> | ||||
|         <a href="services_sql.js.html">services/sql.js</a>, <a href="services_sql.js.html#line313">line 313</a> | ||||
|         <a href="services_sql.js.html">services/sql.js</a>, <a href="services_sql.js.html#line323">line 323</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
| @@ -1196,7 +1196,7 @@ | ||||
|      | ||||
|     <dt class="tag-source">Source:</dt> | ||||
|     <dd class="tag-source"><ul class="dummy"><li> | ||||
|         <a href="services_sql.js.html">services/sql.js</a>, <a href="services_sql.js.html#line292">line 292</a> | ||||
|         <a href="services_sql.js.html">services/sql.js</a>, <a href="services_sql.js.html#line302">line 302</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
| @@ -1252,13 +1252,13 @@ | ||||
| </div> | ||||
|  | ||||
| <nav> | ||||
|     <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-sql.html">sql</a></li></ul><h3>Classes</h3><ul><li><a href="Attribute.html">Attribute</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li><li><a href="Branch.html">Branch</a></li><li><a href="EtapiToken.html">EtapiToken</a></li><li><a href="Note.html">Note</a></li><li><a href="NoteRevision.html">NoteRevision</a></li><li><a href="Option.html">Option</a></li><li><a href="RecentNote.html">RecentNote</a></li></ul><h3><a href="global.html">Global</a></h3> | ||||
|     <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-sql.html">sql</a></li></ul><h3>Classes</h3><ul><li><a href="AbstractEntity.html">AbstractEntity</a></li><li><a href="Attribute.html">Attribute</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li><li><a href="Branch.html">Branch</a></li><li><a href="EtapiToken.html">EtapiToken</a></li><li><a href="Note.html">Note</a></li><li><a href="NoteRevision.html">NoteRevision</a></li><li><a href="Option.html">Option</a></li><li><a href="RecentNote.html">RecentNote</a></li></ul><h3><a href="global.html">Global</a></h3> | ||||
| </nav> | ||||
|  | ||||
| <br class="clear"> | ||||
|  | ||||
| <footer> | ||||
|     Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.7</a> | ||||
|     Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> | ||||
| </footer> | ||||
|  | ||||
| <script> prettyPrint(); </script> | ||||
|   | ||||
| @@ -238,7 +238,7 @@ function BackendScriptApi(currentNote, apiParams) { | ||||
|      * @property {string} parentNoteId - MANDATORY | ||||
|      * @property {string} title - MANDATORY | ||||
|      * @property {string|buffer} content - MANDATORY | ||||
|      * @property {string} type - text, code, file, image, search, book, relation-map - MANDATORY | ||||
|      * @property {string} type - text, code, file, image, search, book, relation-map, canvas - MANDATORY | ||||
|      * @property {string} mime - value is derived from default mimes for type | ||||
|      * @property {boolean} isProtected - default is false | ||||
|      * @property {boolean} isExpanded - default is false | ||||
| @@ -321,7 +321,7 @@ function BackendScriptApi(currentNote, apiParams) { | ||||
|      * | ||||
|      * @param message | ||||
|      */ | ||||
|     this.log = message => log.info(`Script "${currentNote.title}" (${currentNote.noteId}): ${message}`); | ||||
|     this.log = message => log.info(message); | ||||
|  | ||||
|     /** | ||||
|      * Returns root note of the calendar. | ||||
| @@ -454,6 +454,15 @@ function BackendScriptApi(currentNote, apiParams) { | ||||
|      * @return {{syncVersion, appVersion, buildRevision, dbVersion, dataDirectory, buildDate}|*} - object representing basic info about running Trilium version | ||||
|      */ | ||||
|     this.getAppInfo = () => appInfo | ||||
|  | ||||
|     /** | ||||
|      * This object contains "at your risk" and "no BC guarantees" objects for advanced use cases. | ||||
|      * | ||||
|      * @type {{becca: Becca}} | ||||
|      */ | ||||
|     this.__private = { | ||||
|         becca | ||||
|     } | ||||
| } | ||||
|  | ||||
| module.exports = BackendScriptApi; | ||||
| @@ -467,13 +476,13 @@ module.exports = BackendScriptApi; | ||||
| </div> | ||||
|  | ||||
| <nav> | ||||
|     <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-sql.html">sql</a></li></ul><h3>Classes</h3><ul><li><a href="Attribute.html">Attribute</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li><li><a href="Branch.html">Branch</a></li><li><a href="EtapiToken.html">EtapiToken</a></li><li><a href="Note.html">Note</a></li><li><a href="NoteRevision.html">NoteRevision</a></li><li><a href="Option.html">Option</a></li><li><a href="RecentNote.html">RecentNote</a></li></ul><h3><a href="global.html">Global</a></h3> | ||||
|     <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-sql.html">sql</a></li></ul><h3>Classes</h3><ul><li><a href="AbstractEntity.html">AbstractEntity</a></li><li><a href="Attribute.html">Attribute</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li><li><a href="Branch.html">Branch</a></li><li><a href="EtapiToken.html">EtapiToken</a></li><li><a href="Note.html">Note</a></li><li><a href="NoteRevision.html">NoteRevision</a></li><li><a href="Option.html">Option</a></li><li><a href="RecentNote.html">RecentNote</a></li></ul><h3><a href="global.html">Global</a></h3> | ||||
| </nav> | ||||
|  | ||||
| <br class="clear"> | ||||
|  | ||||
| <footer> | ||||
|     Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.7</a> | ||||
|     Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> | ||||
| </footer> | ||||
|  | ||||
| <script> prettyPrint(); </script> | ||||
|   | ||||
| @@ -36,6 +36,7 @@ const log = require('./log'); | ||||
| const Database = require('better-sqlite3'); | ||||
| const dataDir = require('./data_dir'); | ||||
| const cls = require('./cls'); | ||||
| const fs = require("fs-extra"); | ||||
|  | ||||
| const dbConnection = new Database(dataDir.DOCUMENT_PATH); | ||||
| dbConnection.pragma('journal_mode = WAL'); | ||||
| @@ -304,6 +305,15 @@ function fillParamList(paramIds, truncate = true) { | ||||
|     s.run(paramIds); | ||||
| } | ||||
|  | ||||
| async function copyDatabase(targetFilePath) { | ||||
|     try { | ||||
|         fs.unlinkSync(targetFilePath); | ||||
|     } catch (e) { | ||||
|     } // unlink throws exception if the file did not exist | ||||
|  | ||||
|     await dbConnection.backup(targetFilePath); | ||||
| } | ||||
|  | ||||
| module.exports = { | ||||
|     dbConnection, | ||||
|     insert, | ||||
| @@ -375,7 +385,8 @@ module.exports = { | ||||
|     executeScript, | ||||
|     transactional, | ||||
|     upsert, | ||||
|     fillParamList | ||||
|     fillParamList, | ||||
|     copyDatabase | ||||
| }; | ||||
| </code></pre> | ||||
|         </article> | ||||
| @@ -387,13 +398,13 @@ module.exports = { | ||||
| </div> | ||||
|  | ||||
| <nav> | ||||
|     <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-sql.html">sql</a></li></ul><h3>Classes</h3><ul><li><a href="Attribute.html">Attribute</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li><li><a href="Branch.html">Branch</a></li><li><a href="EtapiToken.html">EtapiToken</a></li><li><a href="Note.html">Note</a></li><li><a href="NoteRevision.html">NoteRevision</a></li><li><a href="Option.html">Option</a></li><li><a href="RecentNote.html">RecentNote</a></li></ul><h3><a href="global.html">Global</a></h3> | ||||
|     <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-sql.html">sql</a></li></ul><h3>Classes</h3><ul><li><a href="AbstractEntity.html">AbstractEntity</a></li><li><a href="Attribute.html">Attribute</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li><li><a href="Branch.html">Branch</a></li><li><a href="EtapiToken.html">EtapiToken</a></li><li><a href="Note.html">Note</a></li><li><a href="NoteRevision.html">NoteRevision</a></li><li><a href="Option.html">Option</a></li><li><a href="RecentNote.html">RecentNote</a></li></ul><h3><a href="global.html">Global</a></h3> | ||||
| </nav> | ||||
|  | ||||
| <br class="clear"> | ||||
|  | ||||
| <footer> | ||||
|     Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.7</a> | ||||
|     Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> | ||||
| </footer> | ||||
|  | ||||
| <script> prettyPrint(); </script> | ||||
|   | ||||
| @@ -748,7 +748,7 @@ and relation (representing named relationship between source and target note)</d | ||||
| <br class="clear"> | ||||
|  | ||||
| <footer> | ||||
|     Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.7</a> | ||||
|     Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> | ||||
| </footer> | ||||
|  | ||||
| <script> prettyPrint(); </script> | ||||
|   | ||||
| @@ -1062,7 +1062,7 @@ parents.</div> | ||||
| <br class="clear"> | ||||
|  | ||||
| <footer> | ||||
|     Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.7</a> | ||||
|     Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> | ||||
| </footer> | ||||
|  | ||||
| <script> prettyPrint(); </script> | ||||
|   | ||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @@ -781,7 +781,7 @@ | ||||
| <br class="clear"> | ||||
|  | ||||
| <footer> | ||||
|     Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.7</a> | ||||
|     Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> | ||||
| </footer> | ||||
|  | ||||
| <script> prettyPrint(); </script> | ||||
|   | ||||
| @@ -167,7 +167,7 @@ This note's representation is used in note tree and is kept in Froca.</div> | ||||
|      | ||||
|     <dt class="tag-source">Source:</dt> | ||||
|     <dd class="tag-source"><ul class="dummy"><li> | ||||
|         <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line27">line 27</a> | ||||
|         <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line28">line 28</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
| @@ -267,7 +267,7 @@ This note's representation is used in note tree and is kept in Froca.</div> | ||||
|      | ||||
|     <dt class="tag-source">Source:</dt> | ||||
|     <dd class="tag-source"><ul class="dummy"><li> | ||||
|         <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line36">line 36</a> | ||||
|         <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line37">line 37</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
| @@ -335,7 +335,7 @@ This note's representation is used in note tree and is kept in Froca.</div> | ||||
|      | ||||
|     <dt class="tag-source">Source:</dt> | ||||
|     <dd class="tag-source"><ul class="dummy"><li> | ||||
|         <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line44">line 44</a> | ||||
|         <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line45">line 45</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
| @@ -403,7 +403,7 @@ This note's representation is used in note tree and is kept in Froca.</div> | ||||
|      | ||||
|     <dt class="tag-source">Source:</dt> | ||||
|     <dd class="tag-source"><ul class="dummy"><li> | ||||
|         <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line50">line 50</a> | ||||
|         <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line51">line 51</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
| @@ -471,7 +471,7 @@ This note's representation is used in note tree and is kept in Froca.</div> | ||||
|      | ||||
|     <dt class="tag-source">Source:</dt> | ||||
|     <dd class="tag-source"><ul class="dummy"><li> | ||||
|         <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line61">line 61</a> | ||||
|         <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line62">line 62</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
| @@ -543,7 +543,7 @@ This note's representation is used in note tree and is kept in Froca.</div> | ||||
|      | ||||
|     <dt class="tag-source">Source:</dt> | ||||
|     <dd class="tag-source"><ul class="dummy"><li> | ||||
|         <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line71">line 71</a> | ||||
|         <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line72">line 72</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
| @@ -611,7 +611,7 @@ This note's representation is used in note tree and is kept in Froca.</div> | ||||
|      | ||||
|     <dt class="tag-source">Source:</dt> | ||||
|     <dd class="tag-source"><ul class="dummy"><li> | ||||
|         <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line57">line 57</a> | ||||
|         <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line58">line 58</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
| @@ -679,7 +679,7 @@ This note's representation is used in note tree and is kept in Froca.</div> | ||||
|      | ||||
|     <dt class="tag-source">Source:</dt> | ||||
|     <dd class="tag-source"><ul class="dummy"><li> | ||||
|         <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line42">line 42</a> | ||||
|         <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line43">line 43</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
| @@ -747,7 +747,7 @@ This note's representation is used in note tree and is kept in Froca.</div> | ||||
|      | ||||
|     <dt class="tag-source">Source:</dt> | ||||
|     <dd class="tag-source"><ul class="dummy"><li> | ||||
|         <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line47">line 47</a> | ||||
|         <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line48">line 48</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
| @@ -815,7 +815,7 @@ This note's representation is used in note tree and is kept in Froca.</div> | ||||
|      | ||||
|     <dt class="tag-source">Source:</dt> | ||||
|     <dd class="tag-source"><ul class="dummy"><li> | ||||
|         <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line39">line 39</a> | ||||
|         <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line40">line 40</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
| @@ -883,7 +883,7 @@ This note's representation is used in note tree and is kept in Froca.</div> | ||||
|      | ||||
|     <dt class="tag-source">Source:</dt> | ||||
|     <dd class="tag-source"><ul class="dummy"><li> | ||||
|         <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line59">line 59</a> | ||||
|         <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line60">line 60</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
| @@ -955,7 +955,7 @@ This note's representation is used in note tree and is kept in Froca.</div> | ||||
|      | ||||
|     <dt class="tag-source">Source:</dt> | ||||
|     <dd class="tag-source"><ul class="dummy"><li> | ||||
|         <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line66">line 66</a> | ||||
|         <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line67">line 67</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
| @@ -1103,7 +1103,7 @@ This note's representation is used in note tree and is kept in Froca.</div> | ||||
|      | ||||
|     <dt class="tag-source">Source:</dt> | ||||
|     <dd class="tag-source"><ul class="dummy"><li> | ||||
|         <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line498">line 498</a> | ||||
|         <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line499">line 499</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
| @@ -1303,7 +1303,7 @@ This note's representation is used in note tree and is kept in Froca.</div> | ||||
|      | ||||
|     <dt class="tag-source">Source:</dt> | ||||
|     <dd class="tag-source"><ul class="dummy"><li> | ||||
|         <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line236">line 236</a> | ||||
|         <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line237">line 237</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
| @@ -1481,7 +1481,7 @@ This note's representation is used in note tree and is kept in Froca.</div> | ||||
|      | ||||
|     <dt class="tag-source">Source:</dt> | ||||
|     <dd class="tag-source"><ul class="dummy"><li> | ||||
|         <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line520">line 520</a> | ||||
|         <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line521">line 521</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
| @@ -1589,7 +1589,7 @@ This note's representation is used in note tree and is kept in Froca.</div> | ||||
|      | ||||
|     <dt class="tag-source">Source:</dt> | ||||
|     <dd class="tag-source"><ul class="dummy"><li> | ||||
|         <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line161">line 161</a> | ||||
|         <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line162">line 162</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
| @@ -1693,7 +1693,7 @@ This note's representation is used in note tree and is kept in Froca.</div> | ||||
|      | ||||
|     <dt class="tag-source">Source:</dt> | ||||
|     <dd class="tag-source"><ul class="dummy"><li> | ||||
|         <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line144">line 144</a> | ||||
|         <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line145">line 145</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
| @@ -1795,7 +1795,7 @@ This note's representation is used in note tree and is kept in Froca.</div> | ||||
|      | ||||
|     <dt class="tag-source">Source:</dt> | ||||
|     <dd class="tag-source"><ul class="dummy"><li> | ||||
|         <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line171">line 171</a> | ||||
|         <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line172">line 172</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
| @@ -1897,7 +1897,7 @@ This note's representation is used in note tree and is kept in Froca.</div> | ||||
|      | ||||
|     <dt class="tag-source">Source:</dt> | ||||
|     <dd class="tag-source"><ul class="dummy"><li> | ||||
|         <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line209">line 209</a> | ||||
|         <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line210">line 210</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
| @@ -1999,7 +1999,7 @@ This note's representation is used in note tree and is kept in Froca.</div> | ||||
|      | ||||
|     <dt class="tag-source">Source:</dt> | ||||
|     <dd class="tag-source"><ul class="dummy"><li> | ||||
|         <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line214">line 214</a> | ||||
|         <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line215">line 215</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
| @@ -2150,7 +2150,7 @@ This note's representation is used in note tree and is kept in Froca.</div> | ||||
|      | ||||
|     <dt class="tag-source">Source:</dt> | ||||
|     <dd class="tag-source"><ul class="dummy"><li> | ||||
|         <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line560">line 560</a> | ||||
|         <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line561">line 561</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
| @@ -2317,7 +2317,7 @@ This note's representation is used in note tree and is kept in Froca.</div> | ||||
|      | ||||
|     <dt class="tag-source">Source:</dt> | ||||
|     <dd class="tag-source"><ul class="dummy"><li> | ||||
|         <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line384">line 384</a> | ||||
|         <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line385">line 385</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
| @@ -2472,7 +2472,7 @@ This note's representation is used in note tree and is kept in Froca.</div> | ||||
|      | ||||
|     <dt class="tag-source">Source:</dt> | ||||
|     <dd class="tag-source"><ul class="dummy"><li> | ||||
|         <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line584">line 584</a> | ||||
|         <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line585">line 585</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
| @@ -2582,7 +2582,7 @@ This note's representation is used in note tree and is kept in Froca.</div> | ||||
|      | ||||
|     <dt class="tag-source">Source:</dt> | ||||
|     <dd class="tag-source"><ul class="dummy"><li> | ||||
|         <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line706">line 706</a> | ||||
|         <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line707">line 707</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
| @@ -2756,7 +2756,7 @@ This note's representation is used in note tree and is kept in Froca.</div> | ||||
|      | ||||
|     <dt class="tag-source">Source:</dt> | ||||
|     <dd class="tag-source"><ul class="dummy"><li> | ||||
|         <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line487">line 487</a> | ||||
|         <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line488">line 488</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
| @@ -2956,7 +2956,7 @@ This note's representation is used in note tree and is kept in Froca.</div> | ||||
|      | ||||
|     <dt class="tag-source">Source:</dt> | ||||
|     <dd class="tag-source"><ul class="dummy"><li> | ||||
|         <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line223">line 223</a> | ||||
|         <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line224">line 224</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
| @@ -3134,7 +3134,7 @@ This note's representation is used in note tree and is kept in Froca.</div> | ||||
|      | ||||
|     <dt class="tag-source">Source:</dt> | ||||
|     <dd class="tag-source"><ul class="dummy"><li> | ||||
|         <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line509">line 509</a> | ||||
|         <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line510">line 510</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
| @@ -3289,7 +3289,7 @@ This note's representation is used in note tree and is kept in Froca.</div> | ||||
|      | ||||
|     <dt class="tag-source">Source:</dt> | ||||
|     <dd class="tag-source"><ul class="dummy"><li> | ||||
|         <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line554">line 554</a> | ||||
|         <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line555">line 555</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
| @@ -3456,7 +3456,7 @@ This note's representation is used in note tree and is kept in Froca.</div> | ||||
|      | ||||
|     <dt class="tag-source">Source:</dt> | ||||
|     <dd class="tag-source"><ul class="dummy"><li> | ||||
|         <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line376">line 376</a> | ||||
|         <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line377">line 377</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
| @@ -3611,7 +3611,7 @@ This note's representation is used in note tree and is kept in Froca.</div> | ||||
|      | ||||
|     <dt class="tag-source">Source:</dt> | ||||
|     <dd class="tag-source"><ul class="dummy"><li> | ||||
|         <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line578">line 578</a> | ||||
|         <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line579">line 579</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
| @@ -3766,7 +3766,7 @@ This note's representation is used in note tree and is kept in Froca.</div> | ||||
|      | ||||
|     <dt class="tag-source">Source:</dt> | ||||
|     <dd class="tag-source"><ul class="dummy"><li> | ||||
|         <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line566">line 566</a> | ||||
|         <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line567">line 567</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
| @@ -3933,7 +3933,7 @@ This note's representation is used in note tree and is kept in Froca.</div> | ||||
|      | ||||
|     <dt class="tag-source">Source:</dt> | ||||
|     <dd class="tag-source"><ul class="dummy"><li> | ||||
|         <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line452">line 452</a> | ||||
|         <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line453">line 453</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
| @@ -4088,7 +4088,7 @@ This note's representation is used in note tree and is kept in Froca.</div> | ||||
|      | ||||
|     <dt class="tag-source">Source:</dt> | ||||
|     <dd class="tag-source"><ul class="dummy"><li> | ||||
|         <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line590">line 590</a> | ||||
|         <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line591">line 591</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
| @@ -4194,7 +4194,7 @@ This note's representation is used in note tree and is kept in Froca.</div> | ||||
|      | ||||
|     <dt class="tag-source">Source:</dt> | ||||
|     <dd class="tag-source"><ul class="dummy"><li> | ||||
|         <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line151">line 151</a> | ||||
|         <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line152">line 152</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
| @@ -4296,7 +4296,7 @@ This note's representation is used in note tree and is kept in Froca.</div> | ||||
|      | ||||
|     <dt class="tag-source">Source:</dt> | ||||
|     <dd class="tag-source"><ul class="dummy"><li> | ||||
|         <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line136">line 136</a> | ||||
|         <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line137">line 137</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
| @@ -4398,7 +4398,7 @@ This note's representation is used in note tree and is kept in Froca.</div> | ||||
|      | ||||
|     <dt class="tag-source">Source:</dt> | ||||
|     <dd class="tag-source"><ul class="dummy"><li> | ||||
|         <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line179">line 179</a> | ||||
|         <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line180">line 180</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
| @@ -4500,7 +4500,7 @@ This note's representation is used in note tree and is kept in Froca.</div> | ||||
|      | ||||
|     <dt class="tag-source">Source:</dt> | ||||
|     <dd class="tag-source"><ul class="dummy"><li> | ||||
|         <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line184">line 184</a> | ||||
|         <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line185">line 185</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
| @@ -4651,7 +4651,7 @@ This note's representation is used in note tree and is kept in Froca.</div> | ||||
|      | ||||
|     <dt class="tag-source">Source:</dt> | ||||
|     <dd class="tag-source"><ul class="dummy"><li> | ||||
|         <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line572">line 572</a> | ||||
|         <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line573">line 573</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
| @@ -4818,7 +4818,7 @@ This note's representation is used in note tree and is kept in Froca.</div> | ||||
|      | ||||
|     <dt class="tag-source">Source:</dt> | ||||
|     <dd class="tag-source"><ul class="dummy"><li> | ||||
|         <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line460">line 460</a> | ||||
|         <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line461">line 461</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
| @@ -4973,7 +4973,7 @@ This note's representation is used in note tree and is kept in Froca.</div> | ||||
|      | ||||
|     <dt class="tag-source">Source:</dt> | ||||
|     <dd class="tag-source"><ul class="dummy"><li> | ||||
|         <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line602">line 602</a> | ||||
|         <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line603">line 603</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
| @@ -5143,7 +5143,7 @@ This note's representation is used in note tree and is kept in Froca.</div> | ||||
|      | ||||
|     <dt class="tag-source">Source:</dt> | ||||
|     <dd class="tag-source"><ul class="dummy"><li> | ||||
|         <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line612">line 612</a> | ||||
|         <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line613">line 613</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
| @@ -5294,7 +5294,7 @@ This note's representation is used in note tree and is kept in Froca.</div> | ||||
|      | ||||
|     <dt class="tag-source">Source:</dt> | ||||
|     <dd class="tag-source"><ul class="dummy"><li> | ||||
|         <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line596">line 596</a> | ||||
|         <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line597">line 597</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
| @@ -5400,7 +5400,7 @@ This note's representation is used in note tree and is kept in Froca.</div> | ||||
|      | ||||
|     <dt class="tag-source">Source:</dt> | ||||
|     <dd class="tag-source"><ul class="dummy"><li> | ||||
|         <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line750">line 750</a> | ||||
|         <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line751">line 751</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
| @@ -5513,7 +5513,7 @@ This note's representation is used in note tree and is kept in Froca.</div> | ||||
|      | ||||
|     <dt class="tag-source">Source:</dt> | ||||
|     <dd class="tag-source"><ul class="dummy"><li> | ||||
|         <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line685">line 685</a> | ||||
|         <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line686">line 686</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
| @@ -5619,7 +5619,7 @@ This note's representation is used in note tree and is kept in Froca.</div> | ||||
|      | ||||
|     <dt class="tag-source">Source:</dt> | ||||
|     <dd class="tag-source"><ul class="dummy"><li> | ||||
|         <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line695">line 695</a> | ||||
|         <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line696">line 696</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
| @@ -5721,7 +5721,7 @@ This note's representation is used in note tree and is kept in Froca.</div> | ||||
|      | ||||
|     <dt class="tag-source">Source:</dt> | ||||
|     <dd class="tag-source"><ul class="dummy"><li> | ||||
|         <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line626">line 626</a> | ||||
|         <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line627">line 627</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
| @@ -5895,7 +5895,7 @@ This note's representation is used in note tree and is kept in Froca.</div> | ||||
|      | ||||
|     <dt class="tag-source">Source:</dt> | ||||
|     <dd class="tag-source"><ul class="dummy"><li> | ||||
|         <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line469">line 469</a> | ||||
|         <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line470">line 470</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
| @@ -6001,7 +6001,7 @@ This note's representation is used in note tree and is kept in Froca.</div> | ||||
|      | ||||
|     <dt class="tag-source">Source:</dt> | ||||
|     <dd class="tag-source"><ul class="dummy"><li> | ||||
|         <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line166">line 166</a> | ||||
|         <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line167">line 167</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
| @@ -6152,7 +6152,7 @@ This note's representation is used in note tree and is kept in Froca.</div> | ||||
|      | ||||
|     <dt class="tag-source">Source:</dt> | ||||
|     <dd class="tag-source"><ul class="dummy"><li> | ||||
|         <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line536">line 536</a> | ||||
|         <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line537">line 537</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
| @@ -6330,7 +6330,7 @@ This note's representation is used in note tree and is kept in Froca.</div> | ||||
|      | ||||
|     <dt class="tag-source">Source:</dt> | ||||
|     <dd class="tag-source"><ul class="dummy"><li> | ||||
|         <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line478">line 478</a> | ||||
|         <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line479">line 479</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
| @@ -6485,7 +6485,7 @@ This note's representation is used in note tree and is kept in Froca.</div> | ||||
|      | ||||
|     <dt class="tag-source">Source:</dt> | ||||
|     <dd class="tag-source"><ul class="dummy"><li> | ||||
|         <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line530">line 530</a> | ||||
|         <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line531">line 531</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
| @@ -6640,7 +6640,7 @@ This note's representation is used in note tree and is kept in Froca.</div> | ||||
|      | ||||
|     <dt class="tag-source">Source:</dt> | ||||
|     <dd class="tag-source"><ul class="dummy"><li> | ||||
|         <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line542">line 542</a> | ||||
|         <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line543">line 543</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
| @@ -6795,7 +6795,7 @@ This note's representation is used in note tree and is kept in Froca.</div> | ||||
|      | ||||
|     <dt class="tag-source">Source:</dt> | ||||
|     <dd class="tag-source"><ul class="dummy"><li> | ||||
|         <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line548">line 548</a> | ||||
|         <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line549">line 549</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
| @@ -6903,7 +6903,7 @@ This note's representation is used in note tree and is kept in Froca.</div> | ||||
|      | ||||
|     <dt class="tag-source">Source:</dt> | ||||
|     <dd class="tag-source"><ul class="dummy"><li> | ||||
|         <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line678">line 678</a> | ||||
|         <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line679">line 679</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
| @@ -6987,7 +6987,7 @@ This note's representation is used in note tree and is kept in Froca.</div> | ||||
|      | ||||
|     <dt class="tag-source">Source:</dt> | ||||
|     <dd class="tag-source"><ul class="dummy"><li> | ||||
|         <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line745">line 745</a> | ||||
|         <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line746">line 746</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
| @@ -7093,7 +7093,7 @@ This note's representation is used in note tree and is kept in Froca.</div> | ||||
|      | ||||
|     <dt class="tag-source">Source:</dt> | ||||
|     <dd class="tag-source"><ul class="dummy"><li> | ||||
|         <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line737">line 737</a> | ||||
|         <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line738">line 738</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
| @@ -7199,7 +7199,7 @@ This note's representation is used in note tree and is kept in Froca.</div> | ||||
|      | ||||
|     <dt class="tag-source">Source:</dt> | ||||
|     <dd class="tag-source"><ul class="dummy"><li> | ||||
|         <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line109">line 109</a> | ||||
|         <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line110">line 110</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
| @@ -7269,7 +7269,7 @@ This note's representation is used in note tree and is kept in Froca.</div> | ||||
| <br class="clear"> | ||||
|  | ||||
| <footer> | ||||
|     Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.7</a> | ||||
|     Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> | ||||
| </footer> | ||||
|  | ||||
| <script> prettyPrint(); </script> | ||||
|   | ||||
| @@ -110,7 +110,7 @@ export default Attribute; | ||||
| <br class="clear"> | ||||
|  | ||||
| <footer> | ||||
|     Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.7</a> | ||||
|     Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> | ||||
| </footer> | ||||
|  | ||||
| <script> prettyPrint(); </script> | ||||
|   | ||||
| @@ -99,7 +99,7 @@ export default Branch; | ||||
| <br class="clear"> | ||||
|  | ||||
| <footer> | ||||
|     Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.7</a> | ||||
|     Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> | ||||
| </footer> | ||||
|  | ||||
| <script> prettyPrint(); </script> | ||||
|   | ||||
| @@ -82,7 +82,7 @@ export default NoteComplement; | ||||
| <br class="clear"> | ||||
|  | ||||
| <footer> | ||||
|     Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.7</a> | ||||
|     Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> | ||||
| </footer> | ||||
|  | ||||
| <script> prettyPrint(); </script> | ||||
|   | ||||
| @@ -44,7 +44,8 @@ const NOTE_TYPE_ICONS = { | ||||
|     "relation-map": "bx bx-map-alt", | ||||
|     "book": "bx bx-book", | ||||
|     "note-map": "bx bx-map-alt", | ||||
|     "mermaid": "bx bx-selection" | ||||
|     "mermaid": "bx bx-selection", | ||||
|     "canvas": "bx bx-pen" | ||||
| }; | ||||
|  | ||||
| /** | ||||
| @@ -152,7 +153,7 @@ class NoteShort { | ||||
|             return JSON.parse(content); | ||||
|         } | ||||
|         catch (e) { | ||||
|             console.log(`Cannot parse content of note ${this.noteId}: `, e.message); | ||||
|             console.log(`Cannot parse content of note '${this.noteId}': `, e.message); | ||||
|  | ||||
|             return null; | ||||
|         } | ||||
| @@ -848,7 +849,7 @@ export default NoteShort; | ||||
| <br class="clear"> | ||||
|  | ||||
| <footer> | ||||
|     Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.7</a> | ||||
|     Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> | ||||
| </footer> | ||||
|  | ||||
| <script> prettyPrint(); </script> | ||||
|   | ||||
| @@ -395,7 +395,7 @@ | ||||
|      | ||||
|     <dt class="tag-source">Source:</dt> | ||||
|     <dd class="tag-source"><ul class="dummy"><li> | ||||
|         <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line104">line 104</a> | ||||
|         <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line124">line 124</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
| @@ -431,7 +431,7 @@ | ||||
| <br class="clear"> | ||||
|  | ||||
| <footer> | ||||
|     Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.7</a> | ||||
|     Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> | ||||
| </footer> | ||||
|  | ||||
| <script> prettyPrint(); </script> | ||||
|   | ||||
| @@ -56,7 +56,7 @@ | ||||
| <br class="clear"> | ||||
|  | ||||
| <footer> | ||||
|     Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.7</a> | ||||
|     Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> | ||||
| </footer> | ||||
|  | ||||
| <script> prettyPrint(); </script> | ||||
|   | ||||
| @@ -129,6 +129,26 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null, $contain | ||||
|         } | ||||
|     }; | ||||
|  | ||||
|     /** | ||||
|      * Open a note in a new split. | ||||
|      * | ||||
|      * @param {string} notePath (or noteId) | ||||
|      * @param {boolean} activate - set to true to activate the new split, false to stay on the current split | ||||
|      * @return {Promise<void>} | ||||
|      */ | ||||
|     this.openSplitWithNote = async (notePath, activate) => { | ||||
|         await ws.waitForMaxKnownEntityChangeId(); | ||||
|  | ||||
|         const subContexts = appContext.tabManager.getActiveContext().getSubContexts(); | ||||
|         const {ntxId} = subContexts[subContexts.length - 1]; | ||||
|  | ||||
|         appContext.triggerCommand("openNewNoteSplit", {ntxId, notePath}); | ||||
|  | ||||
|         if (activate) { | ||||
|             appContext.triggerEvent('focusAndSelectTitle'); | ||||
|         } | ||||
|     }; | ||||
|  | ||||
|     /** | ||||
|      * @typedef {Object} ToolbarButtonOptions | ||||
|      * @property {string} title | ||||
| @@ -327,6 +347,24 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null, $contain | ||||
|      */ | ||||
|     this.showError = toastService.showError; | ||||
|  | ||||
|     /** | ||||
|      * Trigger command. | ||||
|      * | ||||
|      * @method | ||||
|      * @param {string} name | ||||
|      * @param {object} data | ||||
|      */ | ||||
|     this.triggerCommand = (name, data) => appContext.triggerCommand(name, data); | ||||
|  | ||||
|     /** | ||||
|      * Trigger event. | ||||
|      * | ||||
|      * @method | ||||
|      * @param {string} name | ||||
|      * @param {object} data | ||||
|      */ | ||||
|     this.triggerEvent = (name, data) => appContext.triggerEvent(name, data); | ||||
|  | ||||
|     /** | ||||
|      * @method | ||||
|      * @deprecated - this is now no-op since all the changes should be gracefully handled per widget | ||||
| @@ -349,30 +387,104 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null, $contain | ||||
|     /** | ||||
|      * Adds given text to the editor cursor | ||||
|      * | ||||
|      * @deprecated use addTextToActiveContextEditor() instead | ||||
|      * @param {string} text - this must be clear text, HTML is not supported. | ||||
|      * @method | ||||
|      */ | ||||
|     this.addTextToActiveTabEditor = text => appContext.triggerCommand('addTextToActiveEditor', {text}); | ||||
|     this.addTextToActiveTabEditor = text => { | ||||
|         console.warn("api.addTextToActiveTabEditor() is deprecated, use addTextToActiveContextEditor() instead."); | ||||
|  | ||||
|         return appContext.triggerCommand('addTextToActiveEditor', {text}); | ||||
|     }; | ||||
|  | ||||
|     /** | ||||
|      * Adds given text to the editor cursor | ||||
|      * | ||||
|      * @param {string} text - this must be clear text, HTML is not supported. | ||||
|      * @method | ||||
|      */ | ||||
|     this.addTextToActiveContextEditor = text => appContext.triggerCommand('addTextToActiveEditor', {text}); | ||||
|  | ||||
|     /** | ||||
|      * @method | ||||
|      * @deprecated use getActiveContextNote() instead | ||||
|      * @returns {NoteShort} active note (loaded into right pane) | ||||
|      */ | ||||
|     this.getActiveTabNote = () => { | ||||
|         console.warn("api.getActiveTabNote() is deprecated, use getActiveContextNote() instead."); | ||||
|  | ||||
|         return appContext.tabManager.getActiveContextNote(); | ||||
|     }; | ||||
|  | ||||
|     /** | ||||
|      * @method | ||||
|      * @returns {NoteShort} active note (loaded into right pane) | ||||
|      */ | ||||
|     this.getActiveTabNote = () => appContext.tabManager.getActiveContextNote(); | ||||
|     this.getActiveContextNote = () => appContext.tabManager.getActiveContextNote(); | ||||
|  | ||||
|     /** | ||||
|      * See https://ckeditor.com/docs/ckeditor5/latest/api/module_core_editor_editor-Editor.html for a documentation on the returned instance. | ||||
|      * | ||||
|      * @deprecated use getActiveContextTextEditor() | ||||
|      * @method | ||||
|      * @param [callback] - callback receiving "textEditor" instance | ||||
|      */ | ||||
|     this.getActiveTabTextEditor = callback => { | ||||
|         console.warn("api.getActiveTabTextEditor() is deprecated, use getActiveContextTextEditor() instead."); | ||||
|  | ||||
|         return appContext.tabManager.getActiveContext()?.getTextEditor(callback); | ||||
|     }; | ||||
|  | ||||
|     /** | ||||
|      * See https://ckeditor.com/docs/ckeditor5/latest/api/module_core_editor_editor-Editor.html for a documentation on the returned instance. | ||||
|      * | ||||
|      * @method | ||||
|      * @param callback - method receiving "textEditor" instance | ||||
|      * @returns {Promise<CKEditor>} instance of CKEditor | ||||
|      */ | ||||
|     this.getActiveTabTextEditor = callback => appContext.triggerCommand('executeInActiveEditor', {callback}); | ||||
|     this.getActiveContextTextEditor = () => appContext.tabManager.getActiveContext()?.getTextEditor(); | ||||
|  | ||||
|     /** | ||||
|      * See https://codemirror.net/doc/manual.html#api | ||||
|      * | ||||
|      * @method | ||||
|      * @returns {Promise<CodeMirror>} instance of CodeMirror | ||||
|      */ | ||||
|     this.getActiveContextCodeEditor = () => appContext.tabManager.getActiveContext()?.getCodeEditor(); | ||||
|  | ||||
|     /** | ||||
|      * Get access to the widget handling note detail. Methods like `getWidgetType()` and `getTypeWidget()` to get to the | ||||
|      * implementation of actual widget type. | ||||
|      * | ||||
|      * @method | ||||
|      * @returns {Promise<NoteDetailWidget>} | ||||
|      */ | ||||
|     this.getActiveNoteDetailWidget = () => new Promise(resolve => appContext.triggerCommand('executeInActiveNoteDetailWidget', {callback: resolve})); | ||||
|  | ||||
|     /** | ||||
|      * @method | ||||
|      * @deprecated use getActiveContextNotePath() instead | ||||
|      * @returns {Promise<string|null>} returns note path of active note or null if there isn't active note | ||||
|      */ | ||||
|     this.getActiveTabNotePath = () => { | ||||
|         console.warn("api.getActiveTabNotePath() is deprecated, use getActiveContextNotePath() instead."); | ||||
|  | ||||
|         return appContext.tabManager.getActiveContextNotePath(); | ||||
|     }; | ||||
|  | ||||
|     /** | ||||
|      * @method | ||||
|      * @returns {Promise<string|null>} returns note path of active note or null if there isn't active note | ||||
|      */ | ||||
|     this.getActiveTabNotePath = () => appContext.tabManager.getActiveContextNotePath(); | ||||
|     this.getActiveContextNotePath = () => appContext.tabManager.getActiveContextNotePath(); | ||||
|  | ||||
|     /** | ||||
|      * Returns component which owns given DOM element (the nearest parent component in DOM tree) | ||||
|      * | ||||
|      * @method | ||||
|      * @param {Element} el - DOM element | ||||
|      * @returns {Component} | ||||
|      */ | ||||
|     this.getComponentByEl = el => appContext.getComponentByEl(el); | ||||
|  | ||||
|     /** | ||||
|      * @method | ||||
| @@ -529,7 +641,7 @@ export default FrontendScriptApi; | ||||
| <br class="clear"> | ||||
|  | ||||
| <footer> | ||||
|     Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.7</a> | ||||
|     Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> | ||||
| </footer> | ||||
|  | ||||
| <script> prettyPrint(); </script> | ||||
|   | ||||
| @@ -81,7 +81,7 @@ export default class CollapsibleWidget extends NoteContextAwareWidget { | ||||
| <br class="clear"> | ||||
|  | ||||
| <footer> | ||||
|     Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.7</a> | ||||
|     Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> | ||||
| </footer> | ||||
|  | ||||
| <script> prettyPrint(); </script> | ||||
|   | ||||
| @@ -6,7 +6,7 @@ It is meant as a last resort solution when the standard mean to access your data | ||||
|  | ||||
| ## Installation | ||||
|  | ||||
| This tool requires node.js, testing has been done on 16.14.2, but it will probably work on other versions as well. | ||||
| This tool requires node.js, testing has been done on 16.15.0, but it will probably work on other versions as well. | ||||
|  | ||||
| ``` | ||||
| npm install | ||||
|   | ||||
							
								
								
									
										2
									
								
								libraries/ckeditor/ckeditor.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								libraries/ckeditor/ckeditor.js
									
									
									
									
										vendored
									
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
							
								
								
									
										7
									
								
								libraries/jquery.mark.es6.min.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								libraries/jquery.mark.es6.min.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
							
								
								
									
										2632
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										2632
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										49
									
								
								package.json
									
									
									
									
									
								
							
							
						
						
									
										49
									
								
								package.json
									
									
									
									
									
								
							| @@ -2,7 +2,7 @@ | ||||
|   "name": "trilium", | ||||
|   "productName": "Trilium Notes", | ||||
|   "description": "Trilium Notes", | ||||
|   "version": "0.51.0-beta", | ||||
|   "version": "0.52.1-beta", | ||||
|   "license": "AGPL-3.0-only", | ||||
|   "main": "electron.js", | ||||
|   "bin": { | ||||
| @@ -13,43 +13,44 @@ | ||||
|     "url": "https://github.com/zadam/trilium.git" | ||||
|   }, | ||||
|   "scripts": { | ||||
|     "start-server": "cross-env TRILIUM_ENV=dev node ./src/www", | ||||
|     "start-electron": "cross-env TRILIUM_ENV=dev electron --inspect=5858 .", | ||||
|     "start-server": "cross-env TRILIUM_DATA_DIR=./data TRILIUM_ENV=dev node ./src/www", | ||||
|     "start-electron": "cross-env TRILIUM_DATA_DIR=./data TRILIUM_ENV=dev electron --inspect=5858 .", | ||||
|     "build-backend-docs": "rm -r ./docs/backend_api && ./node_modules/.bin/jsdoc -c jsdoc-conf.json -d ./docs/backend_api src/becca/entities/*.js src/services/backend_script_api.js src/services/sql.js", | ||||
|     "build-frontend-docs": "rm -r ./docs/frontend_api && ./node_modules/.bin/jsdoc -c jsdoc-conf.json -d ./docs/frontend_api src/public/app/entities/*.js src/public/app/services/frontend_script_api.js src/public/app/widgets/collapsible_widget.js", | ||||
|     "build-docs": "npm run build-backend-docs && npm run build-frontend-docs", | ||||
|     "webpack": "npx webpack -c webpack-desktop.config.js && npx webpack -c webpack-mobile.config.js && npx webpack -c webpack-setup.config.js", | ||||
|     "test": "jasmine", | ||||
|     "test-es6": "node -r esm spec-es6/attribute_parser.spec.js ", | ||||
|     "test-all": "npm run test && npm run test-es6" | ||||
|     "test-all": "npm run test && npm run test-es6", | ||||
|     "postinstall": "rimraf ./node_modules/canvas" | ||||
|   }, | ||||
|   "dependencies": { | ||||
|     "archiver": "5.3.0", | ||||
|     "@electron/remote": "2.0.8", | ||||
|     "@excalidraw/excalidraw": "0.11.0", | ||||
|     "archiver": "5.3.1", | ||||
|     "async-mutex": "0.3.2", | ||||
|     "axios": "0.26.1", | ||||
|     "axios": "0.27.2", | ||||
|     "better-sqlite3": "7.4.5", | ||||
|     "chokidar": "3.5.3", | ||||
|     "cls-hooked": "4.2.2", | ||||
|     "commonmark": "0.30.0", | ||||
|     "cookie-parser": "1.4.6", | ||||
|     "csurf": "1.11.0", | ||||
|     "dayjs": "1.11.0", | ||||
|     "ejs": "3.1.6", | ||||
|     "dayjs": "1.11.2", | ||||
|     "ejs": "3.1.8", | ||||
|     "electron-debug": "3.2.0", | ||||
|     "electron-dl": "3.3.1", | ||||
|     "electron-find": "1.0.7", | ||||
|     "electron-window-state": "5.0.3", | ||||
|     "@electron/remote": "2.0.8", | ||||
|     "express": "4.17.3", | ||||
|     "express": "4.18.1", | ||||
|     "express-partial-content": "1.0.2", | ||||
|     "express-rate-limit": "6.3.0", | ||||
|     "express-session": "1.17.2", | ||||
|     "fs-extra": "10.0.1", | ||||
|     "helmet": "5.0.2", | ||||
|     "express-rate-limit": "6.4.0", | ||||
|     "express-session": "1.17.3", | ||||
|     "fs-extra": "10.1.0", | ||||
|     "helmet": "5.1.0", | ||||
|     "html": "1.0.0", | ||||
|     "html2plaintext": "2.1.4", | ||||
|     "http-proxy-agent": "5.0.0", | ||||
|     "https-proxy-agent": "5.0.0", | ||||
|     "https-proxy-agent": "5.0.1", | ||||
|     "image-type": "4.1.0", | ||||
|     "ini": "3.0.0", | ||||
|     "is-animated": "2.0.2", | ||||
| @@ -59,17 +60,19 @@ | ||||
|     "jsdom": "19.0.0", | ||||
|     "mime-types": "2.1.35", | ||||
|     "multer": "1.4.4", | ||||
|     "node-abi": "3.8.0", | ||||
|     "node-abi": "3.21.0", | ||||
|     "normalize-strings": "1.1.1", | ||||
|     "open": "8.4.0", | ||||
|     "portscanner": "2.2.0", | ||||
|     "rand-token": "1.0.1", | ||||
|     "react": "17.0.2", | ||||
|     "react-dom": "17.0.2", | ||||
|     "request": "2.88.2", | ||||
|     "rimraf": "3.0.2", | ||||
|     "sanitize-filename": "1.6.3", | ||||
|     "sanitize-html": "2.7.0", | ||||
|     "sax": "1.2.4", | ||||
|     "semver": "7.3.6", | ||||
|     "semver": "7.3.7", | ||||
|     "serve-favicon": "2.5.0", | ||||
|     "session-file-store": "1.5.0", | ||||
|     "stream-throttle": "0.1.3", | ||||
| @@ -77,21 +80,21 @@ | ||||
|     "tmp": "0.2.1", | ||||
|     "turndown": "7.1.1", | ||||
|     "unescape": "1.0.1", | ||||
|     "ws": "8.5.0", | ||||
|     "ws": "8.6.0", | ||||
|     "yauzl": "2.10.0" | ||||
|   }, | ||||
|   "devDependencies": { | ||||
|     "cross-env": "7.0.3", | ||||
|     "electron": "16.2.1", | ||||
|     "electron": "16.2.8", | ||||
|     "electron-builder": "23.0.3", | ||||
|     "electron-packager": "15.4.0", | ||||
|     "electron-packager": "15.5.1", | ||||
|     "electron-rebuild": "3.2.7", | ||||
|     "esm": "3.2.25", | ||||
|     "jasmine": "4.0.2", | ||||
|     "jasmine": "4.1.0", | ||||
|     "jsdoc": "3.6.10", | ||||
|     "lorem-ipsum": "2.0.4", | ||||
|     "rcedit": "3.0.1", | ||||
|     "webpack": "5.72.0", | ||||
|     "webpack": "5.72.1", | ||||
|     "webpack-cli": "4.9.2" | ||||
|   }, | ||||
|   "optionalDependencies": { | ||||
|   | ||||
| @@ -58,11 +58,8 @@ describe("Parser", () => { | ||||
|         expect(subs[0].constructor.name).toEqual("NoteFlatTextExp"); | ||||
|         expect(subs[0].tokens).toEqual(["hello", "hi"]); | ||||
|  | ||||
|         expect(subs[1].constructor.name).toEqual("NoteContentProtectedFulltextExp"); | ||||
|         expect(subs[1].constructor.name).toEqual("NoteContentFulltextExp"); | ||||
|         expect(subs[1].tokens).toEqual(["hello", "hi"]); | ||||
|  | ||||
|         expect(subs[2].constructor.name).toEqual("NoteContentUnprotectedFulltextExp"); | ||||
|         expect(subs[2].tokens).toEqual(["hello", "hi"]); | ||||
|     }); | ||||
|  | ||||
|     it("simple label comparison", () => { | ||||
|   | ||||
| @@ -20,7 +20,8 @@ app.set('view engine', 'ejs'); | ||||
|  | ||||
| app.use(helmet({ | ||||
|     hidePoweredBy: false, // errors out in electron | ||||
|     contentSecurityPolicy: false | ||||
|     contentSecurityPolicy: false, | ||||
|     crossOriginEmbedderPolicy: false | ||||
| })); | ||||
|  | ||||
| app.use(express.text({limit: '500mb'})); | ||||
| @@ -30,6 +31,11 @@ app.use(express.urlencoded({extended: false})); | ||||
| app.use(cookieParser()); | ||||
| app.use(express.static(path.join(__dirname, 'public'))); | ||||
| app.use('/libraries', express.static(path.join(__dirname, '..', 'libraries'))); | ||||
| // excalidraw-view mode in shared notes | ||||
| app.use('/node_modules/react/umd/react.production.min.js', express.static(path.join(__dirname, '..', 'node_modules/react/umd/react.production.min.js'))); | ||||
| app.use('/node_modules/react-dom/umd/react-dom.production.min.js', express.static(path.join(__dirname, '..', 'node_modules/react-dom/umd/react-dom.production.min.js'))); | ||||
| // expose whole dist folder since complete assets are needed in edit and share | ||||
| app.use('/node_modules/@excalidraw/excalidraw/dist/', express.static(path.join(__dirname, '..', 'node_modules/@excalidraw/excalidraw/dist/'))); | ||||
| app.use('/images', express.static(path.join(__dirname, '..', 'images'))); | ||||
| const sessionParser = session({ | ||||
|     secret: sessionSecret, | ||||
|   | ||||
| @@ -67,7 +67,7 @@ function getNoteTitle(childNoteId, parentNoteId) { | ||||
|     const parentNote = becca.notes[parentNoteId]; | ||||
|  | ||||
|     if (!childNote) { | ||||
|         log.info(`Cannot find note in cache for noteId ${childNoteId}`); | ||||
|         log.info(`Cannot find note in cache for noteId '${childNoteId}'`); | ||||
|         return "[error fetching title]"; | ||||
|     } | ||||
|  | ||||
| @@ -162,7 +162,7 @@ function getNotePath(noteId) { | ||||
|     const note = becca.notes[noteId]; | ||||
|  | ||||
|     if (!note) { | ||||
|         console.trace(`Cannot find note ${noteId} in cache.`); | ||||
|         console.trace(`Cannot find note '${noteId}' in cache.`); | ||||
|         return; | ||||
|     } | ||||
|  | ||||
|   | ||||
| @@ -10,6 +10,9 @@ const log = require("../../services/log"); | ||||
|  | ||||
| let becca = null; | ||||
|  | ||||
| /** | ||||
|  * Base class for all backend entities. | ||||
|  */ | ||||
| class AbstractEntity { | ||||
|     beforeSaving() { | ||||
|         this.generateIdIfNecessary(); | ||||
| @@ -62,6 +65,11 @@ class AbstractEntity { | ||||
|         return this.getPojo(); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Saves entity - executes SQL, but doesn't commit the transaction on its own | ||||
|      * | ||||
|      * @returns {AbstractEntity} | ||||
|      */ | ||||
|     save() { | ||||
|         const entityName = this.constructor.entityName; | ||||
|         const primaryKeyName = this.constructor.primaryKeyName; | ||||
| @@ -100,6 +108,13 @@ class AbstractEntity { | ||||
|         return this; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Mark the entity as (soft) deleted. It will be completely erased later. | ||||
|      * | ||||
|      * This is a low level method, for notes and branches use `note.deleteNote()` and 'branch.deleteBranch()` instead. | ||||
|      * | ||||
|      * @param [deleteId=null] | ||||
|      */ | ||||
|     markAsDeleted(deleteId = null) { | ||||
|         const entityId = this[this.constructor.primaryKeyName]; | ||||
|         const entityName = this.constructor.entityName; | ||||
|   | ||||
| @@ -9,6 +9,8 @@ const promotedAttributeDefinitionParser = require("../../services/promoted_attri | ||||
| /** | ||||
|  * Attribute is an abstract concept which has two real uses - label (key - value pair) | ||||
|  * and relation (representing named relationship between source and target note) | ||||
|  * | ||||
|  * @extends AbstractEntity | ||||
|  */ | ||||
| class Attribute extends AbstractEntity { | ||||
|     static get entityName() { return "attributes"; } | ||||
|   | ||||
| @@ -4,10 +4,16 @@ const Note = require('./note'); | ||||
| const AbstractEntity = require("./abstract_entity"); | ||||
| const sql = require("../../services/sql"); | ||||
| const dateUtils = require("../../services/date_utils"); | ||||
| const utils = require("../../services/utils.js"); | ||||
| const TaskContext = require("../../services/task_context"); | ||||
| const cls = require("../../services/cls"); | ||||
| const log = require("../../services/log"); | ||||
|  | ||||
| /** | ||||
|  * Branch represents a relationship between a child note and its parent note. Trilium allows a note to have multiple | ||||
|  * parents. | ||||
|  * | ||||
|  * @extends AbstractEntity | ||||
|  */ | ||||
| class Branch extends AbstractEntity { | ||||
|     static get entityName() { return "branches"; } | ||||
| @@ -112,6 +118,74 @@ class Branch extends AbstractEntity { | ||||
|         return !(this.branchId in this.becca.branches); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Delete a branch. If this is a last note's branch, delete the note as well. | ||||
|      * | ||||
|      * @param {string} [deleteId] - optional delete identified | ||||
|      * @param {TaskContext} [taskContext] | ||||
|      * | ||||
|      * @return {boolean} - true if note has been deleted, false otherwise | ||||
|      */ | ||||
|     deleteBranch(deleteId, taskContext) { | ||||
|         if (!deleteId) { | ||||
|             deleteId = utils.randomString(10); | ||||
|         } | ||||
|  | ||||
|         if (!taskContext) { | ||||
|             taskContext = new TaskContext('no-progress-reporting'); | ||||
|         } | ||||
|  | ||||
|         taskContext.increaseProgressCount(); | ||||
|  | ||||
|         const note = this.getNote(); | ||||
|  | ||||
|         if (!taskContext.noteDeletionHandlerTriggered) { | ||||
|             const parentBranches = note.getParentBranches(); | ||||
|  | ||||
|             if (parentBranches.length === 1 && parentBranches[0] === this) { | ||||
|                 // needs to be run before branches and attributes are deleted and thus attached relations disappear | ||||
|                 const handlers = require("../../services/handlers"); | ||||
|                 handlers.runAttachedRelations(note, 'runOnNoteDeletion', note); | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         if (this.branchId === 'root' | ||||
|             || this.noteId === 'root' | ||||
|             || this.noteId === cls.getHoistedNoteId()) { | ||||
|  | ||||
|             throw new Error("Can't delete root or hoisted branch/note"); | ||||
|         } | ||||
|  | ||||
|         this.markAsDeleted(deleteId); | ||||
|  | ||||
|         const notDeletedBranches = note.getParentBranches(); | ||||
|  | ||||
|         if (notDeletedBranches.length === 0) { | ||||
|             for (const childBranch of note.getChildBranches()) { | ||||
|                 childBranch.deleteBranch(deleteId, taskContext); | ||||
|             } | ||||
|  | ||||
|             // first delete children and then parent - this will show up better in recent changes | ||||
|  | ||||
|             log.info("Deleting note " + note.noteId); | ||||
|  | ||||
|             for (const attribute of note.getOwnedAttributes()) { | ||||
|                 attribute.markAsDeleted(deleteId); | ||||
|             } | ||||
|  | ||||
|             for (const relation of note.getTargetRelations()) { | ||||
|                 relation.markAsDeleted(deleteId); | ||||
|             } | ||||
|  | ||||
|             note.markAsDeleted(deleteId); | ||||
|  | ||||
|             return true; | ||||
|         } | ||||
|         else { | ||||
|             return false; | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     beforeSaving() { | ||||
|         if (this.notePosition === undefined || this.notePosition === null) { | ||||
|             // TODO finding new position can be refactored into becca | ||||
|   | ||||
| @@ -11,6 +11,8 @@ const AbstractEntity = require("./abstract_entity"); | ||||
|  * | ||||
|  * The format user is presented with is "<etapiTokenId>_<tokenHash>". This is also called "authToken" to distinguish it | ||||
|  * from tokenHash and token. | ||||
|  * | ||||
|  * @extends AbstractEntity | ||||
|  */ | ||||
| class EtapiToken extends AbstractEntity { | ||||
|     static get entityName() { return "etapi_tokens"; } | ||||
|   | ||||
| @@ -8,12 +8,16 @@ const dateUtils = require('../../services/date_utils'); | ||||
| const entityChangesService = require('../../services/entity_changes'); | ||||
| const AbstractEntity = require("./abstract_entity"); | ||||
| const NoteRevision = require("./note_revision"); | ||||
| const TaskContext = require("../../services/task_context"); | ||||
| const handlers = require("../../services/handlers"); | ||||
|  | ||||
| const LABEL = 'label'; | ||||
| const RELATION = 'relation'; | ||||
|  | ||||
| /** | ||||
|  * Trilium's main entity which can represent text note, image, code note, file attachment etc. | ||||
|  * | ||||
|  * @extends AbstractEntity | ||||
|  */ | ||||
| class Note extends AbstractEntity { | ||||
|     static get entityName() { return "notes"; } | ||||
| @@ -235,7 +239,7 @@ class Note extends AbstractEntity { | ||||
|  | ||||
|     setContent(content, ignoreMissingProtectedSession = false) { | ||||
|         if (content === null || content === undefined) { | ||||
|             throw new Error(`Cannot set null content to note ${this.noteId}`); | ||||
|             throw new Error(`Cannot set null content to note '${this.noteId}'`); | ||||
|         } | ||||
|  | ||||
|         if (this.isStringNote()) { | ||||
| @@ -257,7 +261,7 @@ class Note extends AbstractEntity { | ||||
|                 pojo.content = protectedSessionService.encrypt(pojo.content); | ||||
|             } | ||||
|             else if (!ignoreMissingProtectedSession) { | ||||
|                 throw new Error(`Cannot update content of noteId=${this.noteId} since we're out of protected session.`); | ||||
|                 throw new Error(`Cannot update content of noteId '${this.noteId}' since we're out of protected session.`); | ||||
|             } | ||||
|         } | ||||
|  | ||||
| @@ -1123,6 +1127,30 @@ class Note extends AbstractEntity { | ||||
|         return cloningService.cloneNoteToBranch(this.noteId, branch.branchId); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * (Soft) delete a note and all its descendants. | ||||
|      * | ||||
|      * @param {string} [deleteId] - optional delete identified | ||||
|      * @param {TaskContext} [taskContext] | ||||
|      */ | ||||
|     deleteNote(deleteId, taskContext) { | ||||
|         if (!deleteId) { | ||||
|             deleteId = utils.randomString(10); | ||||
|         } | ||||
|  | ||||
|         if (!taskContext) { | ||||
|             taskContext = new TaskContext('no-progress-reporting'); | ||||
|         } | ||||
|  | ||||
|         // needs to be run before branches and attributes are deleted and thus attached relations disappear | ||||
|         handlers.runAttachedRelations(this, 'runOnNoteDeletion', this); | ||||
|         taskContext.noteDeletionHandlerTriggered = true; | ||||
|  | ||||
|         for (const branch of this.getParentBranches()) { | ||||
|             branch.deleteBranch(deleteId, taskContext); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     decrypt() { | ||||
|         if (this.isProtected && !this.isDecrypted && protectedSessionService.isProtectedSessionAvailable()) { | ||||
|             try { | ||||
| @@ -1141,6 +1169,41 @@ class Note extends AbstractEntity { | ||||
|         return !(this.noteId in this.becca.notes); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @return {NoteRevision|null} | ||||
|      */ | ||||
|     saveNoteRevision() { | ||||
|         const content = this.getContent(); | ||||
|  | ||||
|         if (!content || (Buffer.isBuffer(content) && content.byteLength === 0)) { | ||||
|             return null; | ||||
|         } | ||||
|  | ||||
|         const contentMetadata = this.getContentMetadata(); | ||||
|  | ||||
|         const noteRevision = new NoteRevision({ | ||||
|             noteId: this.noteId, | ||||
|             // title and text should be decrypted now | ||||
|             title: this.title, | ||||
|             type: this.type, | ||||
|             mime: this.mime, | ||||
|             isProtected: false, // will be fixed in the protectNoteRevisions() call | ||||
|             utcDateLastEdited: this.utcDateModified > contentMetadata.utcDateModified | ||||
|                 ? this.utcDateModified | ||||
|                 : contentMetadata.utcDateModified, | ||||
|             utcDateCreated: dateUtils.utcNowDateTime(), | ||||
|             utcDateModified: dateUtils.utcNowDateTime(), | ||||
|             dateLastEdited: this.dateModified > contentMetadata.dateModified | ||||
|                 ? this.dateModified | ||||
|                 : contentMetadata.dateModified, | ||||
|             dateCreated: dateUtils.localNowDateTime() | ||||
|         }).save(); | ||||
|  | ||||
|         noteRevision.setContent(content); | ||||
|  | ||||
|         return noteRevision; | ||||
|     } | ||||
|  | ||||
|     beforeSaving() { | ||||
|         super.beforeSaving(); | ||||
|  | ||||
|   | ||||
| @@ -11,6 +11,8 @@ const AbstractEntity = require("./abstract_entity"); | ||||
| /** | ||||
|  * NoteRevision represents snapshot of note's title and content at some point in the past. | ||||
|  * It's used for seamless note versioning. | ||||
|  * | ||||
|  * @extends AbstractEntity | ||||
|  */ | ||||
| class NoteRevision extends AbstractEntity { | ||||
|     static get entityName() { return "note_revisions"; } | ||||
|   | ||||
| @@ -5,6 +5,8 @@ const AbstractEntity = require("./abstract_entity"); | ||||
|  | ||||
| /** | ||||
|  * Option represents name-value pair, either directly configurable by the user or some system property. | ||||
|  * | ||||
|  * @extends AbstractEntity | ||||
|  */ | ||||
| class Option extends AbstractEntity { | ||||
|     static get entityName() { return "options"; } | ||||
|   | ||||
| @@ -5,6 +5,8 @@ const AbstractEntity = require("./abstract_entity"); | ||||
|  | ||||
| /** | ||||
|  * RecentNote represents recently visited note. | ||||
|  * | ||||
|  * @extends AbstractEntity | ||||
|  */ | ||||
| class RecentNote extends AbstractEntity { | ||||
|     static get entityName() { return "recent_notes"; } | ||||
|   | ||||
| @@ -71,7 +71,7 @@ function register(router) { | ||||
|             return res.sendStatus(204); | ||||
|         } | ||||
|  | ||||
|         noteService.deleteBranch(branch, null, new TaskContext('no-progress-reporting')); | ||||
|         branch.deleteBranch(); | ||||
|  | ||||
|         res.sendStatus(204); | ||||
|     }); | ||||
|   | ||||
| @@ -98,7 +98,7 @@ function register(router) { | ||||
|             return res.sendStatus(204); | ||||
|         } | ||||
|  | ||||
|         noteService.deleteNote(note, null, new TaskContext('no-progress-reporting')); | ||||
|         note.deleteNote(null, new TaskContext('no-progress-reporting')); | ||||
|  | ||||
|         res.sendStatus(204); | ||||
|     }); | ||||
|   | ||||
| @@ -16,7 +16,7 @@ async function convertMarkdownToHtml(text) { | ||||
|  | ||||
|     const result = writer.render(parsed); | ||||
|  | ||||
|     appContext.triggerCommand('executeInActiveEditor', { | ||||
|     appContext.triggerCommand('executeWithTextEditor', { | ||||
|         callback: textEditor => { | ||||
|             const viewFragment = textEditor.data.processor.toView(result); | ||||
|             const modelFragment = textEditor.data.toModel(viewFragment); | ||||
| @@ -24,7 +24,8 @@ async function convertMarkdownToHtml(text) { | ||||
|             textEditor.model.insertContent(modelFragment, textEditor.model.document.selection); | ||||
|  | ||||
|             toastService.showMessage("Markdown content has been imported into the document."); | ||||
|         } | ||||
|         }, | ||||
|         ntxId: this.ntxId | ||||
|     }); | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -171,6 +171,28 @@ async function setContentPane() { | ||||
|  | ||||
|         $content.html($table); | ||||
|     } | ||||
|     else if (revisionItem.type === 'canvas') { | ||||
|         /** | ||||
|          * FIXME: We load a font called Virgil.wof2, which originates from excalidraw.com | ||||
|          *        REMOVE external dependency!!!! This is defined in the svg in defs.style | ||||
|          */ | ||||
|         const content = fullNoteRevision.content; | ||||
|  | ||||
|         try { | ||||
|             const data = JSON.parse(content) | ||||
|             const svg = data.svg || "no svg present." | ||||
|  | ||||
|             /** | ||||
|              * maxWidth: 100% use full width of container but do not enlarge! | ||||
|              * height:auto to ensure that height scales with width | ||||
|              */ | ||||
|             const $svgHtml = $(svg).css({maxWidth: "100%", height: "auto"}); | ||||
|             $content.html($('<div>').append($svgHtml)); | ||||
|         } catch(err) { | ||||
|             console.error("error parsing fullNoteRevision.content as JSON", fullNoteRevision.content, err); | ||||
|             $content.html($("<div>").text("Error parsing content. Please check console.error() for more details.")); | ||||
|         } | ||||
|     } | ||||
|     else { | ||||
|         $content.text("Preview isn't available for this note type."); | ||||
|     } | ||||
|   | ||||
| @@ -33,7 +33,13 @@ const TPL = ` | ||||
| </div> | ||||
|  | ||||
| <div> | ||||
|     <h4>Image compression</h4> | ||||
|     <h4>Images</h4> | ||||
|      | ||||
|     <div class="form-group"> | ||||
|         <input id="download-images-automatically" type="checkbox" name="download-images-automatically"> | ||||
|         <label for="download-images-automatically">Download images automatically for offline use.</label> | ||||
|         <p>(pasted HTML can contain references to online images, Trilium will find those references and download the images so that they are available offline)</p> | ||||
|     </div> | ||||
|      | ||||
|     <div class="form-group"> | ||||
|         <input id="image-compresion-enabled" type="checkbox" name="image-compression-enabled"> | ||||
| @@ -216,6 +222,15 @@ export default class ProtectedSessionOptions { | ||||
|             return false; | ||||
|         }); | ||||
|  | ||||
|         this.$downloadImagesAutomatically = $("#download-images-automatically"); | ||||
|  | ||||
|         this.$downloadImagesAutomatically.on("change", () => { | ||||
|             const isChecked = this.$downloadImagesAutomatically.prop("checked"); | ||||
|             const opts = { 'downloadImagesAutomatically': isChecked ? 'true' : 'false' }; | ||||
|  | ||||
|             server.put('options', opts).then(() => toastService.showMessage("Options changed have been saved.")); | ||||
|         }); | ||||
|  | ||||
|         this.$enableImageCompression = $("#image-compresion-enabled"); | ||||
|         this.$imageCompressionWrapper = $("#image-compression-enabled-wraper"); | ||||
|  | ||||
| @@ -225,7 +240,7 @@ export default class ProtectedSessionOptions { | ||||
|             } else { | ||||
|                 this.$imageCompressionWrapper.addClass("disabled-field"); | ||||
|             } | ||||
|         } | ||||
|         }; | ||||
|  | ||||
|         this.$enableImageCompression.on("change", () => { | ||||
|             const isChecked = this.$enableImageCompression.prop("checked"); | ||||
| @@ -234,7 +249,7 @@ export default class ProtectedSessionOptions { | ||||
|             server.put('options', opts).then(() => toastService.showMessage("Options changed have been saved.")); | ||||
|  | ||||
|             this.setImageCompression(isChecked); | ||||
|         }) | ||||
|         }); | ||||
|     } | ||||
|  | ||||
|     optionsLoaded(options) { | ||||
| @@ -251,6 +266,9 @@ export default class ProtectedSessionOptions { | ||||
|         this.$autoReadonlySizeText.val(options['autoReadonlySizeText']); | ||||
|         this.$autoReadonlySizeCode.val(options['autoReadonlySizeCode']); | ||||
|  | ||||
|         const downloadImagesAutomatically = options['downloadImagesAutomatically'] === 'true'; | ||||
|         this.$downloadImagesAutomatically.prop('checked', downloadImagesAutomatically); | ||||
|  | ||||
|         const compressImages = options['compressImages'] === 'true'; | ||||
|         this.$enableImageCompression.prop('checked', compressImages); | ||||
|         this.setImageCompression(compressImages); | ||||
|   | ||||
| @@ -16,7 +16,8 @@ const NOTE_TYPE_ICONS = { | ||||
|     "relation-map": "bx bx-map-alt", | ||||
|     "book": "bx bx-book", | ||||
|     "note-map": "bx bx-map-alt", | ||||
|     "mermaid": "bx bx-selection" | ||||
|     "mermaid": "bx bx-selection", | ||||
|     "canvas": "bx bx-pen" | ||||
| }; | ||||
|  | ||||
| /** | ||||
| @@ -124,7 +125,7 @@ class NoteShort { | ||||
|             return JSON.parse(content); | ||||
|         } | ||||
|         catch (e) { | ||||
|             console.log(`Cannot parse content of note ${this.noteId}: `, e.message); | ||||
|             console.log(`Cannot parse content of note '${this.noteId}': `, e.message); | ||||
|  | ||||
|             return null; | ||||
|         } | ||||
|   | ||||
| @@ -48,6 +48,7 @@ import BookmarkButtons from "../widgets/bookmark_buttons.js"; | ||||
| import NoteWrapperWidget from "../widgets/note_wrapper.js"; | ||||
| import BacklinksWidget from "../widgets/backlinks.js"; | ||||
| import SharedInfoWidget from "../widgets/shared_info.js"; | ||||
| import FindWidget from "../widgets/find.js"; | ||||
|  | ||||
| export default class DesktopLayout { | ||||
|     constructor(customWidgets) { | ||||
| @@ -161,6 +162,7 @@ export default class DesktopLayout { | ||||
|                                         .child(new SearchResultWidget()) | ||||
|                                         .child(new SqlResultWidget()) | ||||
|                                 ) | ||||
|                                 .child(new FindWidget()) | ||||
|                                 .child(...this.customWidgets.get('node-detail-pane')) | ||||
|                             ) | ||||
|                         ) | ||||
|   | ||||
| @@ -11,7 +11,6 @@ import Component from "../widgets/component.js"; | ||||
| import keyboardActionsService from "./keyboard_actions.js"; | ||||
| import MobileScreenSwitcherExecutor from "../widgets/mobile_widgets/mobile_screen_switcher.js"; | ||||
| import MainTreeExecutors from "./main_tree_executors.js"; | ||||
| import protectedSessionHolder from "./protected_session_holder.js"; | ||||
| import toast from "./toast.js"; | ||||
|  | ||||
| class AppContext extends Component { | ||||
|   | ||||
							
								
								
									
										70
									
								
								src/public/app/services/debounce.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										70
									
								
								src/public/app/services/debounce.js
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,70 @@ | ||||
| /** | ||||
|  * Returns a function, that, as long as it continues to be invoked, will not | ||||
|  * be triggered. The function will be called after it stops being called for | ||||
|  * N milliseconds. If `immediate` is passed, trigger the function on the | ||||
|  * leading edge, instead of the trailing. The function also has a property 'clear' | ||||
|  * that is a function which will clear the timer to prevent previously scheduled executions. | ||||
|  * | ||||
|  * @source underscore.js | ||||
|  * @see http://unscriptable.com/2009/03/20/debouncing-javascript-methods/ | ||||
|  * @param {Function} function to wrap | ||||
|  * @param {Number} timeout in ms (`100`) | ||||
|  * @param {Boolean} whether to execute at the beginning (`false`) | ||||
|  * @api public | ||||
|  */ | ||||
| function debounce(func, wait_ms, immediate){ | ||||
|     var timeout, args, context, timestamp, result; | ||||
|     if (null == wait_ms) wait_ms = 100; | ||||
|  | ||||
|     function later() { | ||||
|         var last = Date.now() - timestamp; | ||||
|  | ||||
|         if (last < wait_ms && last >= 0) { | ||||
|             timeout = setTimeout(later, wait_ms - last); | ||||
|         } else { | ||||
|             timeout = null; | ||||
|             if (!immediate) { | ||||
|                 result = func.apply(context, args); | ||||
|                 context = args = null; | ||||
|             } | ||||
|         } | ||||
|     }; | ||||
|  | ||||
|     var debounced = function(){ | ||||
|         context = this; | ||||
|         args = arguments; | ||||
|         timestamp = Date.now(); | ||||
|         var callNow = immediate && !timeout; | ||||
|         if (!timeout) timeout = setTimeout(later, wait_ms); | ||||
|         if (callNow) { | ||||
|             result = func.apply(context, args); | ||||
|             context = args = null; | ||||
|         } | ||||
|  | ||||
|         return result; | ||||
|     }; | ||||
|  | ||||
|     debounced.clear = function() { | ||||
|         if (timeout) { | ||||
|             clearTimeout(timeout); | ||||
|             timeout = null; | ||||
|         } | ||||
|     }; | ||||
|  | ||||
|     debounced.flush = function() { | ||||
|         if (timeout) { | ||||
|             result = func.apply(context, args); | ||||
|             context = args = null; | ||||
|  | ||||
|             clearTimeout(timeout); | ||||
|             timeout = null; | ||||
|         } | ||||
|     }; | ||||
|  | ||||
|     return debounced; | ||||
| }; | ||||
|  | ||||
| // Adds compatibility for ES modules | ||||
| debounce.debounce = debounce; | ||||
|  | ||||
| export default debounce; | ||||
| @@ -39,34 +39,10 @@ export default class Entrypoints extends Component { | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     findInTextCommand() { | ||||
|         if (!utils.isElectron()) { | ||||
|             return; | ||||
|         } | ||||
|  | ||||
|         const remote = utils.dynamicRequire('@electron/remote'); | ||||
|         const {FindInPage} = utils.dynamicRequire('electron-find'); | ||||
|         const findInPage = new FindInPage(remote.getCurrentWebContents(), { | ||||
|             offsetTop: 10, | ||||
|             offsetRight: 10, | ||||
|             boxBgColor: 'var(--main-background-color)', | ||||
|             boxShadowColor: '#000', | ||||
|             inputColor: 'var(--input-text-color)', | ||||
|             inputBgColor: 'var(--input-background-color)', | ||||
|             inputFocusColor: '#555', | ||||
|             textColor: 'var(--main-text-color)', | ||||
|             textHoverBgColor: '#555', | ||||
|             caseSelectedColor: 'var(--main-border-color)' | ||||
|         }); | ||||
|  | ||||
|         findInPage.openFindWindow(); | ||||
|     } | ||||
|  | ||||
|     async createNoteIntoInboxCommand() { | ||||
|         const inboxNote = await dateNoteService.getInboxNote(); | ||||
|  | ||||
|         const {note} = await server.post(`notes/${inboxNote.noteId}/children?target=into`, { | ||||
|             title: 'new note', | ||||
|             content: '', | ||||
|             type: 'text', | ||||
|             isProtected: inboxNote.isProtected && protectedSessionHolder.isProtectedSessionAvailable() | ||||
|   | ||||
| @@ -179,7 +179,7 @@ class Froca { | ||||
|         const searchResultNoteIds = await server.get('search-note/' + note.noteId); | ||||
|  | ||||
|         if (!Array.isArray(searchResultNoteIds)) { | ||||
|             throw new Error(`Search note ${note.noteId} failed: ${searchResultNoteIds}`); | ||||
|             throw new Error(`Search note '${note.noteId}' failed: ${searchResultNoteIds}`); | ||||
|         } | ||||
|  | ||||
|         // reset all the virtual branches from old search results | ||||
| @@ -254,7 +254,7 @@ class Froca { | ||||
|             return null; | ||||
|         } | ||||
|         else if (!noteId) { | ||||
|             console.trace(`Falsy noteId ${noteId}, returning null.`); | ||||
|             console.trace(`Falsy noteId '${noteId}', returning null.`); | ||||
|             return null; | ||||
|         } | ||||
|  | ||||
| @@ -312,7 +312,7 @@ class Froca { | ||||
|         if (!this.noteComplementPromises[noteId]) { | ||||
|             this.noteComplementPromises[noteId] = server.get('notes/' + noteId) | ||||
|                 .then(row => new NoteComplement(row)) | ||||
|                 .catch(e => console.error(`Cannot get note complement for note ${noteId}`)); | ||||
|                 .catch(e => console.error(`Cannot get note complement for note '${noteId}'`)); | ||||
|  | ||||
|             // we don't want to keep large payloads forever in memory so we clean that up quite quickly | ||||
|             // this cache is more meant to share the data between different components within one business transaction (e.g. loading of the note into the tab context and all the components) | ||||
|   | ||||
| @@ -101,6 +101,26 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null, $contain | ||||
|         } | ||||
|     }; | ||||
|  | ||||
|     /** | ||||
|      * Open a note in a new split. | ||||
|      * | ||||
|      * @param {string} notePath (or noteId) | ||||
|      * @param {boolean} activate - set to true to activate the new split, false to stay on the current split | ||||
|      * @return {Promise<void>} | ||||
|      */ | ||||
|     this.openSplitWithNote = async (notePath, activate) => { | ||||
|         await ws.waitForMaxKnownEntityChangeId(); | ||||
|  | ||||
|         const subContexts = appContext.tabManager.getActiveContext().getSubContexts(); | ||||
|         const {ntxId} = subContexts[subContexts.length - 1]; | ||||
|  | ||||
|         appContext.triggerCommand("openNewNoteSplit", {ntxId, notePath}); | ||||
|  | ||||
|         if (activate) { | ||||
|             appContext.triggerEvent('focusAndSelectTitle'); | ||||
|         } | ||||
|     }; | ||||
|  | ||||
|     /** | ||||
|      * @typedef {Object} ToolbarButtonOptions | ||||
|      * @property {string} title | ||||
| @@ -299,6 +319,24 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null, $contain | ||||
|      */ | ||||
|     this.showError = toastService.showError; | ||||
|  | ||||
|     /** | ||||
|      * Trigger command. | ||||
|      * | ||||
|      * @method | ||||
|      * @param {string} name | ||||
|      * @param {object} data | ||||
|      */ | ||||
|     this.triggerCommand = (name, data) => appContext.triggerCommand(name, data); | ||||
|  | ||||
|     /** | ||||
|      * Trigger event. | ||||
|      * | ||||
|      * @method | ||||
|      * @param {string} name | ||||
|      * @param {object} data | ||||
|      */ | ||||
|     this.triggerEvent = (name, data) => appContext.triggerEvent(name, data); | ||||
|  | ||||
|     /** | ||||
|      * @method | ||||
|      * @deprecated - this is now no-op since all the changes should be gracefully handled per widget | ||||
| @@ -321,30 +359,104 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null, $contain | ||||
|     /** | ||||
|      * Adds given text to the editor cursor | ||||
|      * | ||||
|      * @deprecated use addTextToActiveContextEditor() instead | ||||
|      * @param {string} text - this must be clear text, HTML is not supported. | ||||
|      * @method | ||||
|      */ | ||||
|     this.addTextToActiveTabEditor = text => appContext.triggerCommand('addTextToActiveEditor', {text}); | ||||
|     this.addTextToActiveTabEditor = text => { | ||||
|         console.warn("api.addTextToActiveTabEditor() is deprecated, use addTextToActiveContextEditor() instead."); | ||||
|  | ||||
|         return appContext.triggerCommand('addTextToActiveEditor', {text}); | ||||
|     }; | ||||
|  | ||||
|     /** | ||||
|      * Adds given text to the editor cursor | ||||
|      * | ||||
|      * @param {string} text - this must be clear text, HTML is not supported. | ||||
|      * @method | ||||
|      */ | ||||
|     this.addTextToActiveContextEditor = text => appContext.triggerCommand('addTextToActiveEditor', {text}); | ||||
|  | ||||
|     /** | ||||
|      * @method | ||||
|      * @deprecated use getActiveContextNote() instead | ||||
|      * @returns {NoteShort} active note (loaded into right pane) | ||||
|      */ | ||||
|     this.getActiveTabNote = () => { | ||||
|         console.warn("api.getActiveTabNote() is deprecated, use getActiveContextNote() instead."); | ||||
|  | ||||
|         return appContext.tabManager.getActiveContextNote(); | ||||
|     }; | ||||
|  | ||||
|     /** | ||||
|      * @method | ||||
|      * @returns {NoteShort} active note (loaded into right pane) | ||||
|      */ | ||||
|     this.getActiveTabNote = () => appContext.tabManager.getActiveContextNote(); | ||||
|     this.getActiveContextNote = () => appContext.tabManager.getActiveContextNote(); | ||||
|  | ||||
|     /** | ||||
|      * See https://ckeditor.com/docs/ckeditor5/latest/api/module_core_editor_editor-Editor.html for a documentation on the returned instance. | ||||
|      * | ||||
|      * @deprecated use getActiveContextTextEditor() | ||||
|      * @method | ||||
|      * @param [callback] - callback receiving "textEditor" instance | ||||
|      */ | ||||
|     this.getActiveTabTextEditor = callback => { | ||||
|         console.warn("api.getActiveTabTextEditor() is deprecated, use getActiveContextTextEditor() instead."); | ||||
|  | ||||
|         return appContext.tabManager.getActiveContext()?.getTextEditor(callback); | ||||
|     }; | ||||
|  | ||||
|     /** | ||||
|      * See https://ckeditor.com/docs/ckeditor5/latest/api/module_core_editor_editor-Editor.html for a documentation on the returned instance. | ||||
|      * | ||||
|      * @method | ||||
|      * @param callback - method receiving "textEditor" instance | ||||
|      * @returns {Promise<CKEditor>} instance of CKEditor | ||||
|      */ | ||||
|     this.getActiveTabTextEditor = callback => appContext.triggerCommand('executeInActiveEditor', {callback}); | ||||
|     this.getActiveContextTextEditor = () => appContext.tabManager.getActiveContext()?.getTextEditor(); | ||||
|  | ||||
|     /** | ||||
|      * See https://codemirror.net/doc/manual.html#api | ||||
|      * | ||||
|      * @method | ||||
|      * @returns {Promise<CodeMirror>} instance of CodeMirror | ||||
|      */ | ||||
|     this.getActiveContextCodeEditor = () => appContext.tabManager.getActiveContext()?.getCodeEditor(); | ||||
|  | ||||
|     /** | ||||
|      * Get access to the widget handling note detail. Methods like `getWidgetType()` and `getTypeWidget()` to get to the | ||||
|      * implementation of actual widget type. | ||||
|      * | ||||
|      * @method | ||||
|      * @returns {Promise<NoteDetailWidget>} | ||||
|      */ | ||||
|     this.getActiveNoteDetailWidget = () => new Promise(resolve => appContext.triggerCommand('executeInActiveNoteDetailWidget', {callback: resolve})); | ||||
|  | ||||
|     /** | ||||
|      * @method | ||||
|      * @deprecated use getActiveContextNotePath() instead | ||||
|      * @returns {Promise<string|null>} returns note path of active note or null if there isn't active note | ||||
|      */ | ||||
|     this.getActiveTabNotePath = () => { | ||||
|         console.warn("api.getActiveTabNotePath() is deprecated, use getActiveContextNotePath() instead."); | ||||
|  | ||||
|         return appContext.tabManager.getActiveContextNotePath(); | ||||
|     }; | ||||
|  | ||||
|     /** | ||||
|      * @method | ||||
|      * @returns {Promise<string|null>} returns note path of active note or null if there isn't active note | ||||
|      */ | ||||
|     this.getActiveTabNotePath = () => appContext.tabManager.getActiveContextNotePath(); | ||||
|     this.getActiveContextNotePath = () => appContext.tabManager.getActiveContextNotePath(); | ||||
|  | ||||
|     /** | ||||
|      * Returns component which owns given DOM element (the nearest parent component in DOM tree) | ||||
|      * | ||||
|      * @method | ||||
|      * @param {Element} el - DOM element | ||||
|      * @returns {Component} | ||||
|      */ | ||||
|     this.getComponentByEl = el => appContext.getComponentByEl(el); | ||||
|  | ||||
|     /** | ||||
|      * @method | ||||
|   | ||||
| @@ -56,6 +56,20 @@ const MERMAID = { | ||||
|     js: [ "libraries/mermaid.min.js" ] | ||||
| } | ||||
|  | ||||
| const EXCALIDRAW = { | ||||
|     js: [ | ||||
|         "node_modules/react/umd/react.production.min.js", | ||||
|         "node_modules/react-dom/umd/react-dom.production.min.js", | ||||
|         "node_modules/@excalidraw/excalidraw/dist/excalidraw.production.min.js", | ||||
|     ] | ||||
| }; | ||||
|  | ||||
| const MARKJS = { | ||||
|     js: [ | ||||
|         "libraries/jquery.mark.es6.min.js" | ||||
|     ] | ||||
| }; | ||||
|  | ||||
| async function requireLibrary(library) { | ||||
|     if (library.css) { | ||||
|         library.css.map(cssUrl => requireCss(cssUrl)); | ||||
| @@ -106,5 +120,7 @@ export default { | ||||
|     KATEX, | ||||
|     WHEEL_ZOOM, | ||||
|     FORCE_GRAPH, | ||||
|     MERMAID | ||||
|     MERMAID, | ||||
|     EXCALIDRAW, | ||||
|     MARKJS | ||||
| } | ||||
|   | ||||
| @@ -141,6 +141,27 @@ async function getRenderedContent(note, options = {}) { | ||||
|  | ||||
|         $renderedContent.append($content); | ||||
|     } | ||||
|     else if (type === 'canvas') { | ||||
|         // make sure surrounding container has size of what is visible. Then image is shrinked to its boundaries | ||||
|         $renderedContent.css({height: "100%", width:"100%"}); | ||||
|          | ||||
|         const noteComplement = await froca.getNoteComplement(note.noteId); | ||||
|         const content = noteComplement.content || ""; | ||||
|  | ||||
|         try { | ||||
|             const placeHolderSVG = "<svg />"; | ||||
|             const data = JSON.parse(content) | ||||
|             const svg = data.svg || placeHolderSVG; | ||||
|             /** | ||||
|              * maxWidth: size down to 100% (full) width of container but do not enlarge! | ||||
|              * height:auto to ensure that height scales with width | ||||
|              */ | ||||
|             $renderedContent.append($(svg).css({maxWidth: "100%", maxHeight: "100%", height: "auto", width: "auto"})); | ||||
|         } catch(err) { | ||||
|             console.error("error parsing content as JSON", content, err); | ||||
|             $renderedContent.append($("<div>").text("Error parsing content. Please check console.error() for more details.")); | ||||
|         } | ||||
|     } | ||||
|     else if (!options.tooltip && type === 'protected-session') { | ||||
|         const $button = $(`<button class="btn btn-sm"><span class="bx bx-log-in"></span> Enter protected session</button>`) | ||||
|             .on('click', protectedSessionService.enterProtectedSession); | ||||
|   | ||||
| @@ -226,6 +226,35 @@ class NoteContext extends Component { | ||||
|             && this.note.mime !== 'text/x-sqlite;schema=trilium' | ||||
|             && !this.note.hasLabel('hideChildrenOverview'); | ||||
|     } | ||||
|  | ||||
|     async getTextEditor(callback) { | ||||
|         return new Promise(resolve => appContext.triggerCommand('executeWithTextEditor', { | ||||
|             callback, | ||||
|             resolve, | ||||
|             ntxId: this.ntxId | ||||
|         })); | ||||
|     } | ||||
|  | ||||
|     async getCodeEditor() { | ||||
|         return new Promise(resolve => appContext.triggerCommand('executeWithCodeEditor', { | ||||
|             resolve, | ||||
|             ntxId: this.ntxId | ||||
|         })); | ||||
|     } | ||||
|  | ||||
|     async getContentElement() { | ||||
|         return new Promise(resolve => appContext.triggerCommand('executeWithContentElement', { | ||||
|             resolve, | ||||
|             ntxId: this.ntxId | ||||
|         })); | ||||
|     } | ||||
|  | ||||
|     async getTypeWidget() { | ||||
|         return new Promise(resolve => appContext.triggerCommand('executeWithTypeWidget', { | ||||
|             resolve, | ||||
|             ntxId: this.ntxId | ||||
|         })); | ||||
|     } | ||||
| } | ||||
|  | ||||
| export default NoteContext; | ||||
|   | ||||
| @@ -24,12 +24,10 @@ async function createNote(parentNotePath, options = {}) { | ||||
|         options.saveSelection = false; | ||||
|     } | ||||
|  | ||||
|     if (options.saveSelection && utils.isCKEditorInitialized()) { | ||||
|         [options.title, options.content] = parseSelectedHtml(window.cutToNote.getSelectedHtml()); | ||||
|     if (options.saveSelection) { | ||||
|         [options.title, options.content] = parseSelectedHtml(options.textEditor.getSelectedHtml()); | ||||
|     } | ||||
|  | ||||
|     const newNoteName = options.title || "new note"; | ||||
|  | ||||
|     const parentNoteId = treeService.getNoteIdFromNotePath(parentNotePath); | ||||
|  | ||||
|     if (options.type === 'mermaid' && !options.content) { | ||||
| @@ -41,16 +39,16 @@ async function createNote(parentNotePath, options = {}) { | ||||
|     } | ||||
|  | ||||
|     const {note, branch} = await server.post(`notes/${parentNoteId}/children?target=${options.target}&targetBranchId=${options.targetBranchId || ""}`, { | ||||
|         title: newNoteName, | ||||
|         title: options.title, | ||||
|         content: options.content || "", | ||||
|         isProtected: options.isProtected, | ||||
|         type: options.type, | ||||
|         mime: options.mime | ||||
|     }); | ||||
|  | ||||
|     if (options.saveSelection && utils.isCKEditorInitialized()) { | ||||
|     if (options.saveSelection) { | ||||
|         // we remove the selection only after it was saved to server to make sure we don't lose anything | ||||
|         window.cutToNote.removeSelection(); | ||||
|         options.textEditor.removeSelection(); | ||||
|     } | ||||
|  | ||||
|     await ws.waitForMaxKnownEntityChangeId(); | ||||
|   | ||||
| @@ -99,13 +99,15 @@ const TPL = ` | ||||
|         padding: 10px; | ||||
|     } | ||||
|      | ||||
|     .note-book-content.type-image img { | ||||
|     .note-book-content.type-image img, .note-book-content.type-canvas svg { | ||||
|         max-width: 100%; | ||||
|         max-height: 100%; | ||||
|         object-fit: contain; | ||||
|     } | ||||
|      | ||||
|     .note-book-card.type-image .note-book-content img, .note-book-card.type-text .note-book-content img { | ||||
|     .note-book-card.type-image .note-book-content img, | ||||
|     .note-book-card.type-text .note-book-content img, | ||||
|     .note-book-card.type-canvas .note-book-content img { | ||||
|         max-width: 100%; | ||||
|         max-height: 100%; | ||||
|     } | ||||
|   | ||||
| @@ -63,6 +63,7 @@ async function mouseEnterHandler() { | ||||
|             placement: 'auto', | ||||
|             trigger: 'manual', | ||||
|             boundary: 'window', | ||||
|             offset: "0, 20", // workaround for https://github.com/zadam/trilium/issues/2794 | ||||
|             title: html, | ||||
|             html: true, | ||||
|             template: '<div class="tooltip note-tooltip" role="tooltip"><div class="arrow"></div><div class="tooltip-inner"></div></div>', | ||||
|   | ||||
| @@ -1,17 +1,5 @@ | ||||
| import options from './options.js'; | ||||
| import server from "./server.js"; | ||||
|  | ||||
| let lastProtectedSessionOperationDate = 0; | ||||
|  | ||||
| setInterval(() => { | ||||
|     const protectedSessionTimeout = options.getInt('protectedSessionTimeout'); | ||||
|     if (lastProtectedSessionOperationDate | ||||
|         && Date.now() - lastProtectedSessionOperationDate > protectedSessionTimeout * 1000) { | ||||
|  | ||||
|         resetProtectedSession(); | ||||
|     } | ||||
| }, 10000); | ||||
|  | ||||
| function enableProtectedSession() { | ||||
|     glob.isProtectedSessionAvailable = true; | ||||
|  | ||||
| @@ -26,9 +14,9 @@ function isProtectedSessionAvailable() { | ||||
|     return glob.isProtectedSessionAvailable; | ||||
| } | ||||
|  | ||||
| function touchProtectedSession() { | ||||
| async function touchProtectedSession() { | ||||
|     if (isProtectedSessionAvailable()) { | ||||
|         lastProtectedSessionOperationDate = Date.now(); | ||||
|         await server.post("login/protected/touch"); | ||||
|     } | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -306,7 +306,8 @@ export default class TabManager extends Component { | ||||
|                 const mainNoteContexts = this.getNoteContexts().filter(nc => nc.isMainContext()); | ||||
|  | ||||
|                 if (mainNoteContexts.length === 1) { | ||||
|                     mainNoteContexts[0].setEmpty(); | ||||
|                     await this.clearLastMainNoteContext(noteContextToRemove); | ||||
|  | ||||
|                     return; | ||||
|                 } | ||||
|             } | ||||
| @@ -317,7 +318,7 @@ export default class TabManager extends Component { | ||||
|             const noteContextsToRemove = noteContextToRemove.getSubContexts(); | ||||
|             const ntxIdsToRemove = noteContextsToRemove.map(nc => nc.ntxId); | ||||
|  | ||||
|             await this.triggerEvent('beforeTabRemove', { ntxIds: ntxIdsToRemove }); | ||||
|             await this.triggerEvent('beforeNoteContextRemove', { ntxIds: ntxIdsToRemove }); | ||||
|  | ||||
|             if (!noteContextToRemove.isMainContext()) { | ||||
|                 await this.activateNoteContext(noteContextToRemove.getMainContext().ntxId); | ||||
| @@ -336,16 +337,39 @@ export default class TabManager extends Component { | ||||
|                 } | ||||
|             } | ||||
|  | ||||
|             this.children = this.children.filter(nc => !ntxIdsToRemove.includes(nc.ntxId)); | ||||
|  | ||||
|             this.recentlyClosedTabs.push(noteContextsToRemove); | ||||
|  | ||||
|             this.triggerEvent('noteContextRemoved', {ntxIds: ntxIdsToRemove}); | ||||
|  | ||||
|             this.tabsUpdate.scheduleUpdate(); | ||||
|             this.removeNoteContexts(noteContextsToRemove); | ||||
|         }); | ||||
|     } | ||||
|  | ||||
|     async clearLastMainNoteContext(noteContextToClear) { | ||||
|         noteContextToClear.setEmpty(); | ||||
|  | ||||
|         // activate main split | ||||
|         await this.activateNoteContext(noteContextToClear.ntxId); | ||||
|  | ||||
|         // remove all other splits | ||||
|         const noteContextsToRemove = noteContextToClear.getSubContexts() | ||||
|             .filter(ntx => ntx.ntxId !== noteContextToClear.ntxId); | ||||
|  | ||||
|         const ntxIdsToRemove = noteContextsToRemove.map(ntx => ntx.ntxId); | ||||
|  | ||||
|         await this.triggerEvent('beforeNoteContextRemove', {ntxIds: ntxIdsToRemove}); | ||||
|  | ||||
|         this.removeNoteContexts(noteContextsToRemove); | ||||
|     } | ||||
|  | ||||
|     removeNoteContexts(noteContextsToRemove) { | ||||
|         const ntxIdsToRemove = noteContextsToRemove.map(nc => nc.ntxId); | ||||
|  | ||||
|         this.children = this.children.filter(nc => !ntxIdsToRemove.includes(nc.ntxId)); | ||||
|  | ||||
|         this.recentlyClosedTabs.push(noteContextsToRemove); | ||||
|  | ||||
|         this.triggerEvent('noteContextRemoved', {ntxIds: ntxIdsToRemove}); | ||||
|  | ||||
|         this.tabsUpdate.scheduleUpdate(); | ||||
|     } | ||||
|  | ||||
|     tabReorderEvent({ntxIdsInOrder}) { | ||||
|         const order = {}; | ||||
|  | ||||
|   | ||||
| @@ -33,7 +33,8 @@ class TreeContextMenu { | ||||
|             { title: "Note Map", command: command, type: "note-map", uiIcon: "map-alt" }, | ||||
|             { title: "Render HTML note", command: command, type: "render", uiIcon: "extension" }, | ||||
|             { title: "Book", command: command, type: "book", uiIcon: "book" }, | ||||
|             { title: "Mermaid diagram", command: command, type: "mermaid", uiIcon: "selection" } | ||||
|             { title: "Mermaid diagram", command: command, type: "mermaid", uiIcon: "selection" }, | ||||
|             { title: "Canvas", command: command, type: "canvas", uiIcon: "pen" }, | ||||
|         ]; | ||||
|     } | ||||
|  | ||||
|   | ||||
| @@ -292,10 +292,6 @@ function copySelectionToClipboard() { | ||||
|     } | ||||
| } | ||||
|  | ||||
| function isCKEditorInitialized() { | ||||
|     return !!(window && window.cutToNote); | ||||
| } | ||||
|  | ||||
| function dynamicRequire(moduleName) { | ||||
|     if (typeof __non_webpack_require__ !== 'undefined') { | ||||
|         return __non_webpack_require__(moduleName); | ||||
| @@ -359,6 +355,16 @@ function isValidAttributeName(name) { | ||||
|     return ATTR_NAME_MATCHER.test(name); | ||||
| } | ||||
|  | ||||
| function sleep(time_ms) { | ||||
|     return new Promise((resolve) => { | ||||
|         setTimeout(resolve, time_ms); | ||||
|     }); | ||||
| } | ||||
|  | ||||
| function escapeRegExp(str) { | ||||
|     return str.replace(/([.*+?^=!:${}()|\[\]\/\\])/g, "\\$1"); | ||||
| } | ||||
|  | ||||
| export default { | ||||
|     reloadFrontendApp, | ||||
|     parseDate, | ||||
| @@ -395,12 +401,13 @@ export default { | ||||
|     clearBrowserCache, | ||||
|     normalizeShortcut, | ||||
|     copySelectionToClipboard, | ||||
|     isCKEditorInitialized, | ||||
|     dynamicRequire, | ||||
|     timeLimit, | ||||
|     initHelpDropdown, | ||||
|     initHelpButtons, | ||||
|     openHelp, | ||||
|     filterAttributeName, | ||||
|     isValidAttributeName | ||||
|     isValidAttributeName, | ||||
|     sleep, | ||||
|     escapeRegExp | ||||
| }; | ||||
|   | ||||
| @@ -219,11 +219,23 @@ const ATTR_HELP = { | ||||
|         "shareDisallowRobotIndexing": `will forbid robot indexing of this note via <code>X-Robots-Tag: noindex</code> header`, | ||||
|         "displayRelations": "comma delimited names of relations which should be displayed. All other ones will be hidden.", | ||||
|         "hideRelations": "comma delimited names of relations which should be hidden. All other ones will be displayed.", | ||||
|         "titleTemplate": `default title of notes created as children of this note. The value is evaluated as JavaScript string  | ||||
|                         and thus can be enriched with dynamic content via the injected <code>now</code> and <code>parentNote</code> variables. Examples: | ||||
|                          | ||||
|                         <ul> | ||||
|                             <li><code>\${parentNote.getLabelValue('authorName')}'s literary works</code></li> | ||||
|                             <li><code>Log for \${now.format('YYYY-MM-DD HH:mm:ss')}</code></li> | ||||
|                         </ul> | ||||
|                          | ||||
|                         See <a href="https://github.com/zadam/trilium/wiki/Default-note-title">wiki with details</a>, API docs for <a href="https://zadam.github.io/trilium/backend_api/Note.html">parentNote</a> and <a href="https://day.js.org/docs/en/display/format">now</a> for details.` | ||||
|     }, | ||||
|     "relation": { | ||||
|         "runOnNoteCreation": "executes when note is created on backend", | ||||
|         "runOnNoteTitleChange": "executes when note title is changed (includes note creation as well)", | ||||
|         "runOnNoteChange": "executes when note is changed (includes note creation as well)", | ||||
|         "runOnNoteDeletion": "executes when note is being deleted", | ||||
|         "runOnBranchCreation": "executes when a branch is created. Branch is a link between parent note and child note and is created e.g. when cloning or moving note.", | ||||
|         "runOnBranchDeletion": "executes when a branch is delete. Branch is a link between parent note and child note and is deleted e.g. when moving note (old branch/link is deleted).", | ||||
|         "runOnChildNoteCreation": "executes when new note is created under this note", | ||||
|         "runOnAttributeCreation": "executes when new attribute is created under this note", | ||||
|         "runOnAttributeChange": "executes when attribute is changed under this note", | ||||
|   | ||||
| @@ -41,8 +41,8 @@ const TPL = ` | ||||
|             right: 10px; | ||||
|             width: 400px; | ||||
|             border-radius: 10px; | ||||
|             background-color: #eeeeee; | ||||
|             color: #444; | ||||
|             background-color: var(--more-accented-background-color); | ||||
|             color: var(--main-text-color); | ||||
|             padding: 20px; | ||||
|             overflow-y: auto; | ||||
|         } | ||||
|   | ||||
| @@ -71,7 +71,6 @@ export default class ButtonWidget extends NoteContextAwareWidget { | ||||
|         } | ||||
|  | ||||
|         this.$widget | ||||
|             .attr("title", this.settings.title) | ||||
|             .addClass(this.settings.icon); | ||||
|     } | ||||
|  | ||||
|   | ||||
| @@ -1,5 +1,7 @@ | ||||
| import ButtonWidget from "./button_widget.js"; | ||||
| import appContext from "../../services/app_context.js"; | ||||
| import attributeService from "../../services/attributes.js"; | ||||
| import protectedSessionHolder from "../../services/protected_session_holder.js"; | ||||
|  | ||||
| export default class EditButton extends ButtonWidget { | ||||
|     isEnabled() { | ||||
| @@ -22,9 +24,29 @@ export default class EditButton extends ButtonWidget { | ||||
|     } | ||||
|  | ||||
|     async refreshWithNote(note) { | ||||
|         // can't do this in isEnabled() since isReadOnly is async | ||||
|         this.toggleInt(await this.noteContext.isReadOnly()); | ||||
|         if (note.isProtected && !protectedSessionHolder.isProtectedSessionAvailable()) { | ||||
|             this.toggleInt(false); | ||||
|         } | ||||
|         else { | ||||
|             // prevent flickering by assuming hidden before async operation | ||||
|             this.toggleInt(false); | ||||
|  | ||||
|             // can't do this in isEnabled() since isReadOnly is async | ||||
|             this.toggleInt(await this.noteContext.isReadOnly()); | ||||
|         } | ||||
|  | ||||
|         await super.refreshWithNote(note); | ||||
|     } | ||||
|  | ||||
|     entitiesReloadedEvent({loadResults}) { | ||||
|         if (loadResults.getAttributes().find( | ||||
|             attr => attr.type === 'label' | ||||
|                 && attr.name.toLowerCase().includes("readonly") | ||||
|                 && attributeService.isAffecting(attr, this.note) | ||||
|         )) { | ||||
|             this.noteContext.readOnlyTemporarilyDisabled = false; | ||||
|  | ||||
|             this.refresh(); | ||||
|         } | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -5,6 +5,7 @@ export default class ScrollingContainer extends Container { | ||||
|         super(); | ||||
|  | ||||
|         this.css('overflow', 'auto'); | ||||
|         this.css('position', 'relative'); | ||||
|     } | ||||
|  | ||||
|     setNoteContextEvent({noteContext}) { | ||||
| @@ -35,7 +36,7 @@ export default class ScrollingContainer extends Container { | ||||
|  | ||||
|             const promise = super.handleEventInChildren(name, data); | ||||
|  | ||||
|             // there seems to be some asynchronicity and we need to wait a bit before scrolling | ||||
|             // there seems to be some asynchronicity, and we need to wait a bit before scrolling | ||||
|             promise.then(() => setTimeout(() => this.$widget.scrollTop(scrollTop), 500)); | ||||
|  | ||||
|             return promise; | ||||
| @@ -44,4 +45,8 @@ export default class ScrollingContainer extends Container { | ||||
|             return super.handleEventInChildren(name, data); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     scrollContainerToCommand({position}) { | ||||
|         this.$widget.scrollTop(position); | ||||
|     } | ||||
| } | ||||
|   | ||||
							
								
								
									
										255
									
								
								src/public/app/widgets/find.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										255
									
								
								src/public/app/widgets/find.js
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,255 @@ | ||||
| /** | ||||
|  * (c) Antonio Tejada 2022 | ||||
|  * https://github.com/antoniotejada/Trilium-FindWidget | ||||
|  */ | ||||
|  | ||||
| import NoteContextAwareWidget from "./note_context_aware_widget.js"; | ||||
| import FindInText from "./find_in_text.js"; | ||||
| import FindInCode from "./find_in_code.js"; | ||||
| import FindInHtml from "./find_in_html.js"; | ||||
|  | ||||
| const findWidgetDelayMillis = 200; | ||||
| const waitForEnter = (findWidgetDelayMillis < 0); | ||||
|  | ||||
| // tabIndex=-1 on the checkbox labels is necessary so when clicking on the label | ||||
| // the focusout handler is called with relatedTarget equal to the label instead | ||||
| // of undefined. It's -1 instead of > 0, so they don't tabstop | ||||
| const TPL = ` | ||||
| <div style="contain: none;"> | ||||
|     <style> | ||||
|         .find-widget-box { | ||||
|             padding: 10px; | ||||
|             border-top: 1px solid var(--main-border-color);  | ||||
|             align-items: center; | ||||
|         } | ||||
|          | ||||
|         .find-widget-box > * { | ||||
|             margin-right: 15px; | ||||
|         } | ||||
|          | ||||
|         .find-widget-box { | ||||
|             display: flex; | ||||
|         } | ||||
|          | ||||
|         .find-widget-found-wrapper { | ||||
|             font-weight: bold; | ||||
|         } | ||||
|          | ||||
|         .find-widget-search-term-input-group { | ||||
|             max-width: 300px; | ||||
|         } | ||||
|          | ||||
|         .find-widget-spacer { | ||||
|             flex-grow: 1; | ||||
|         } | ||||
|     </style> | ||||
|  | ||||
|     <div class="find-widget-box"> | ||||
|         <div class="input-group find-widget-search-term-input-group"> | ||||
|             <input type="text" class="form-control find-widget-search-term-input"> | ||||
|             <div class="input-group-append"> | ||||
|                 <button class="btn btn-outline-secondary bx bxs-chevron-up find-widget-previous-button" type="button"></button> | ||||
|                 <button class="btn btn-outline-secondary bx bxs-chevron-down find-widget-next-button" type="button"></button> | ||||
|             </div> | ||||
|         </div> | ||||
|          | ||||
|         <div class="form-check"> | ||||
|             <label tabIndex="-1" class="form-check-label"> | ||||
|                 <input type="checkbox" class="form-check-input find-widget-case-sensitive-checkbox">  | ||||
|                 case sensitive | ||||
|             </label> | ||||
|         </div> | ||||
|  | ||||
|         <div class="form-check"> | ||||
|             <label tabIndex="-1" class="form-check-label"> | ||||
|                 <input type="checkbox" class="form-check-input find-widget-match-words-checkbox">  | ||||
|                 match words | ||||
|             </label> | ||||
|         </div> | ||||
|          | ||||
|         <div class="find-widget-found-wrapper"> | ||||
|             <span class="find-widget-current-found">0</span> | ||||
|             / | ||||
|             <span class="find-widget-total-found">0</span> | ||||
|         </div> | ||||
|          | ||||
|         <div class="find-widget-spacer"></div> | ||||
|          | ||||
|         <div class="find-widget-close-button"><button class="btn icon-action bx bx-x"></button></div> | ||||
|     </div> | ||||
| </div>`; | ||||
|  | ||||
| export default class FindWidget extends NoteContextAwareWidget { | ||||
|     constructor() { | ||||
|         super(); | ||||
|  | ||||
|         this.searchTerm = null; | ||||
|  | ||||
|         this.textHandler = new FindInText(this); | ||||
|         this.codeHandler = new FindInCode(this); | ||||
|         this.htmlHandler = new FindInHtml(this); | ||||
|     } | ||||
|  | ||||
|     async noteSwitched() { | ||||
|         await super.noteSwitched(); | ||||
|  | ||||
|         await this.closeSearch(); | ||||
|     } | ||||
|  | ||||
|     doRender() { | ||||
|         this.$widget = $(TPL); | ||||
|         this.$findBox = this.$widget.find('.find-widget-box'); | ||||
|         this.$findBox.hide(); | ||||
|         this.$input = this.$widget.find('.find-widget-search-term-input'); | ||||
|         this.$currentFound = this.$widget.find('.find-widget-current-found'); | ||||
|         this.$totalFound = this.$widget.find('.find-widget-total-found'); | ||||
|         this.$caseSensitiveCheckbox = this.$widget.find(".find-widget-case-sensitive-checkbox"); | ||||
|         this.$caseSensitiveCheckbox.change(() => this.performFind()); | ||||
|         this.$matchWordsCheckbox = this.$widget.find(".find-widget-match-words-checkbox"); | ||||
|         this.$matchWordsCheckbox.change(() => this.performFind()); | ||||
|         this.$previousButton = this.$widget.find(".find-widget-previous-button"); | ||||
|         this.$previousButton.on("click", () => this.findNext(-1)); | ||||
|         this.$nextButton = this.$widget.find(".find-widget-next-button"); | ||||
|         this.$nextButton.on("click", () => this.findNext(1)); | ||||
|         this.$closeButton = this.$widget.find(".find-widget-close-button"); | ||||
|         this.$closeButton.on("click", () => this.closeSearch()); | ||||
|  | ||||
|         this.$input.keydown(async e => { | ||||
|             if ((e.metaKey || e.ctrlKey) && (e.key === 'F' || e.key === 'f')) { | ||||
|                 // If ctrl+f is pressed when the findbox is shown, select the | ||||
|                 // whole input to find | ||||
|                 this.$input.select(); | ||||
|             } else if (e.key === 'Enter' || e.key === 'F3') { | ||||
|                 await this.findNext(e?.shiftKey ? -1 : 1); | ||||
|                 e.preventDefault(); | ||||
|                 return false; | ||||
|             } | ||||
|         }); | ||||
|  | ||||
|         this.$findBox.keydown(async e => { | ||||
|             if (e.key === 'Escape') { | ||||
|                 await this.closeSearch(); | ||||
|             } | ||||
|         }); | ||||
|  | ||||
|         this.$input.on('input', () => this.startSearch()); | ||||
|  | ||||
|         return this.$widget; | ||||
|     } | ||||
|  | ||||
|     async findInTextEvent() { | ||||
|         if (!this.isActiveNoteContext()) { | ||||
|             return; | ||||
|         } | ||||
|  | ||||
|         if (!['text', 'code'].includes(this.note.type) || !this.$findBox.is(":hidden")) { | ||||
|             return; | ||||
|         } | ||||
|  | ||||
|         const readOnly = await this.noteContext.isReadOnly(); | ||||
|  | ||||
|         if (readOnly) { | ||||
|             this.handler = this.htmlHandler; | ||||
|         } else { | ||||
|             this.handler = this.note.type === "code" | ||||
|                 ? this.codeHandler | ||||
|                 : this.textHandler; | ||||
|         } | ||||
|  | ||||
|         this.$findBox.show(); | ||||
|         this.$input.focus(); | ||||
|         this.$totalFound.text(0); | ||||
|         this.$currentFound.text(0); | ||||
|  | ||||
|         const searchTerm = await this.handler.getInitialSearchTerm(); | ||||
|  | ||||
|         this.$input.val(searchTerm || ""); | ||||
|  | ||||
|         // Directly perform the search if there's some text to | ||||
|         // find, without delaying or waiting for enter | ||||
|         if (searchTerm !== "") { | ||||
|             this.$input.select(); | ||||
|             await this.performFind(); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     startSearch() { | ||||
|         // XXX This should clear the previous search immediately in all cases | ||||
|         //     (the search is stale when waitforenter but also while the | ||||
|         //     delay is running for non waitforenter case) | ||||
|         if (!waitForEnter) { | ||||
|             // Clear the previous timeout if any, it's ok if timeoutId is | ||||
|             // null or undefined | ||||
|             clearTimeout(this.timeoutId); | ||||
|  | ||||
|             // Defer the search a few millis so the search doesn't start | ||||
|             // immediately, as this can cause search word typing lag with | ||||
|             // one or two-char searchwords and long notes | ||||
|             // See https://github.com/antoniotejada/Trilium-FindWidget/issues/1 | ||||
|             this.timeoutId = setTimeout(async () => { | ||||
|                 this.timeoutId = null; | ||||
|                 await this.performFind(); | ||||
|             }, findWidgetDelayMillis); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @param direction +1 for next, -1 for previous | ||||
|      * @returns {Promise<void>} | ||||
|      */ | ||||
|     async findNext(direction) { | ||||
|         const searchTerm = this.$input.val(); | ||||
|         if (waitForEnter && this.searchTerm !== searchTerm) { | ||||
|             await this.performFind(); | ||||
|         } | ||||
|         const totalFound = parseInt(this.$totalFound.text()); | ||||
|         const currentFound = parseInt(this.$currentFound.text()) - 1; | ||||
|  | ||||
|         if (totalFound > 0) { | ||||
|             let nextFound = currentFound + direction; | ||||
|             // Wrap around | ||||
|             if (nextFound > totalFound - 1) { | ||||
|                 nextFound = 0; | ||||
|             } else if (nextFound < 0) { | ||||
|                 nextFound = totalFound - 1; | ||||
|             } | ||||
|  | ||||
|             this.$currentFound.text(nextFound + 1); | ||||
|  | ||||
|             await this.handler.findNext(direction, currentFound, nextFound); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     /** Perform the find and highlight the find results. */ | ||||
|     async performFind() { | ||||
|         const searchTerm = this.$input.val(); | ||||
|         const matchCase = this.$caseSensitiveCheckbox.prop("checked"); | ||||
|         const wholeWord = this.$matchWordsCheckbox.prop("checked"); | ||||
|  | ||||
|         const {totalFound, currentFound} = await this.handler.performFind(searchTerm, matchCase, wholeWord); | ||||
|  | ||||
|         this.$totalFound.text(totalFound); | ||||
|         this.$currentFound.text(currentFound); | ||||
|  | ||||
|         this.searchTerm = searchTerm; | ||||
|     } | ||||
|  | ||||
|     async closeSearch() { | ||||
|         if (this.$findBox.is(":visible")) { | ||||
|             this.$findBox.hide(); | ||||
|  | ||||
|             // Restore any state, if there's a current occurrence clear markers | ||||
|             // and scroll to and select the last occurrence | ||||
|             const totalFound = parseInt(this.$totalFound.text()); | ||||
|             const currentFound = parseInt(this.$currentFound.text()) - 1; | ||||
|  | ||||
|             this.searchTerm = null; | ||||
|  | ||||
|             await this.handler.findBoxClosed(totalFound, currentFound); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     isEnabled() { | ||||
|         return super.isEnabled() && ['text', 'code'].includes(this.note.type); | ||||
|     } | ||||
| } | ||||
							
								
								
									
										196
									
								
								src/public/app/widgets/find_in_code.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										196
									
								
								src/public/app/widgets/find_in_code.js
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,196 @@ | ||||
| // ck-find-result and ck-find-result_selected are the styles ck-editor | ||||
| // uses for highlighting matches, use the same one on CodeMirror | ||||
| // for consistency | ||||
| import utils from "../services/utils.js"; | ||||
|  | ||||
| const FIND_RESULT_SELECTED_CSS_CLASSNAME = "ck-find-result_selected"; | ||||
| const FIND_RESULT_CSS_CLASSNAME = "ck-find-result"; | ||||
|  | ||||
| export default class FindInCode { | ||||
|     constructor(parent) { | ||||
|         /** @property {FindWidget} */ | ||||
|         this.parent = parent; | ||||
|     } | ||||
|  | ||||
|     async getCodeEditor() { | ||||
|         return this.parent.noteContext.getCodeEditor(); | ||||
|     } | ||||
|  | ||||
|     async getInitialSearchTerm() { | ||||
|         const codeEditor = await this.getCodeEditor(); | ||||
|  | ||||
|         // highlightSelectionMatches is the overlay that highlights | ||||
|         // the words under the cursor. This occludes the search | ||||
|         // markers style, save it, disable it. Will be restored when | ||||
|         // the focus is back into the note | ||||
|         this.oldHighlightSelectionMatches = codeEditor.getOption("highlightSelectionMatches"); | ||||
|         codeEditor.setOption("highlightSelectionMatches", false); | ||||
|  | ||||
|         // Fill in the findbox with the current selection if any | ||||
|         const selectedText = codeEditor.getSelection() | ||||
|         if (selectedText !== "") { | ||||
|             return selectedText; | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     async performFind(searchTerm, matchCase, wholeWord) { | ||||
|         let findResult = null; | ||||
|         let totalFound = 0; | ||||
|         let currentFound = -1; | ||||
|  | ||||
|         // See https://codemirror.net/addon/search/searchcursor.js for tips | ||||
|         const codeEditor = await this.getCodeEditor(); | ||||
|         const doc = codeEditor.doc; | ||||
|         const text = doc.getValue(); | ||||
|  | ||||
|         // Clear all markers | ||||
|         if (this.findResult != null) { | ||||
|             codeEditor.operation(() => { | ||||
|                 for (let i = 0; i < this.findResult.length; ++i) { | ||||
|                     const marker = this.findResult[i]; | ||||
|                     marker.clear(); | ||||
|                 } | ||||
|             }); | ||||
|         } | ||||
|  | ||||
|         if (searchTerm !== "") { | ||||
|             searchTerm = utils.escapeRegExp(searchTerm); | ||||
|  | ||||
|             // Find and highlight matches | ||||
|             // Find and highlight matches | ||||
|             // XXX Using \\b and not using the unicode flag probably doesn't | ||||
|             //     work with non ascii alphabets, findAndReplace uses a more | ||||
|             //     complicated regexp, see | ||||
|             //     https://github.com/ckeditor/ckeditor5/blob/b95e2faf817262ac0e1e21993d9c0bde3f1be594/packages/ckeditor5-find-and-replace/src/utils.js#L145 | ||||
|             const wholeWordChar = wholeWord ? "\\b" : ""; | ||||
|             const re = new RegExp(wholeWordChar + searchTerm + wholeWordChar, | ||||
|                 'g' + (matchCase ? '' : 'i')); | ||||
|             let curLine = 0; | ||||
|             let curChar = 0; | ||||
|             let curMatch = null; | ||||
|             findResult = []; | ||||
|             // All those markText take several seconds on eg this ~500-line | ||||
|             // script, batch them inside an operation so they become | ||||
|             // unnoticeable. Alternatively, an overlay could be used, see | ||||
|             // https://codemirror.net/addon/search/match-highlighter.js ? | ||||
|             codeEditor.operation(() => { | ||||
|                 for (let i = 0; i < text.length; ++i) { | ||||
|                     // Fetch next match if it's the first time or | ||||
|                     // if past the current match start | ||||
|                     if ((curMatch == null) || (curMatch.index < i)) { | ||||
|                         curMatch = re.exec(text); | ||||
|                         if (curMatch == null) { | ||||
|                             // No more matches | ||||
|                             break; | ||||
|                         } | ||||
|                     } | ||||
|                     // Create a non-selected highlight marker for the match, the | ||||
|                     // selected marker highlight will be done later | ||||
|                     if (i === curMatch.index) { | ||||
|                         let fromPos = { "line" : curLine, "ch" : curChar }; | ||||
|                         // XXX If multiline is supported, this needs to | ||||
|                         //     recalculate curLine since the match may span | ||||
|                         //     lines | ||||
|                         let toPos = { "line" : curLine, "ch" : curChar + curMatch[0].length}; | ||||
|                         // XXX or css = "color: #f3" | ||||
|                         let marker = doc.markText( fromPos, toPos, { "className" : FIND_RESULT_CSS_CLASSNAME }); | ||||
|                         findResult.push(marker); | ||||
|  | ||||
|                         // Set the first match beyond the cursor as current | ||||
|                         // match | ||||
|                         if (currentFound === -1) { | ||||
|                             const cursorPos = codeEditor.getCursor(); | ||||
|                             if ((fromPos.line > cursorPos.line) || | ||||
|                                 ((fromPos.line === cursorPos.line) && | ||||
|                                     (fromPos.ch >= cursorPos.ch))){ | ||||
|                                 currentFound = totalFound; | ||||
|                             } | ||||
|                         } | ||||
|  | ||||
|                         totalFound++; | ||||
|                     } | ||||
|                     // Do line and char position tracking | ||||
|                     if (text[i] === "\n") { | ||||
|                         curLine++; | ||||
|                         curChar = 0; | ||||
|                     } else { | ||||
|                         curChar++; | ||||
|                     } | ||||
|                 } | ||||
|             }); | ||||
|         } | ||||
|  | ||||
|         this.findResult = findResult; | ||||
|  | ||||
|         // Calculate curfound if not already, highlight it as selected | ||||
|         if (totalFound > 0) { | ||||
|             currentFound = Math.max(0, currentFound) | ||||
|             let marker = findResult[currentFound]; | ||||
|             let pos = marker.find(); | ||||
|             codeEditor.scrollIntoView(pos.to); | ||||
|             marker.clear(); | ||||
|             findResult[currentFound] = doc.markText( pos.from, pos.to, | ||||
|                 { "className" : FIND_RESULT_SELECTED_CSS_CLASSNAME } | ||||
|             ); | ||||
|         } | ||||
|  | ||||
|         return { | ||||
|             totalFound, | ||||
|             currentFound: currentFound + 1 | ||||
|         }; | ||||
|     } | ||||
|  | ||||
|     async findNext(direction, currentFound, nextFound) { | ||||
|         const codeEditor = await this.getCodeEditor(); | ||||
|         const doc = codeEditor.doc; | ||||
|  | ||||
|         // | ||||
|         // Dehighlight current, highlight & scrollIntoView next | ||||
|         // | ||||
|  | ||||
|         let marker = this.findResult[currentFound]; | ||||
|         let pos = marker.find(); | ||||
|         marker.clear(); | ||||
|         marker = doc.markText( | ||||
|             pos.from, pos.to, | ||||
|             { "className" : FIND_RESULT_CSS_CLASSNAME } | ||||
|         ); | ||||
|         this.findResult[currentFound] = marker; | ||||
|  | ||||
|         marker = this.findResult[nextFound]; | ||||
|         pos = marker.find(); | ||||
|         marker.clear(); | ||||
|         marker = doc.markText( | ||||
|             pos.from, pos.to, | ||||
|             { "className" : FIND_RESULT_SELECTED_CSS_CLASSNAME } | ||||
|         ); | ||||
|         this.findResult[nextFound] = marker; | ||||
|  | ||||
|         codeEditor.scrollIntoView(pos.from); | ||||
|     } | ||||
|  | ||||
|     async findBoxClosed(totalFound, currentFound) { | ||||
|         const codeEditor = await this.getCodeEditor(); | ||||
|  | ||||
|         if (totalFound > 0) { | ||||
|             const doc = codeEditor.doc; | ||||
|             const pos = this.findResult[currentFound].find(); | ||||
|             // Note setting the selection sets the cursor to | ||||
|             // the end of the selection and scrolls it into | ||||
|             // view | ||||
|             doc.setSelection(pos.from, pos.to); | ||||
|             // Clear all markers | ||||
|             codeEditor.operation(() => { | ||||
|                 for (let i = 0; i < this.findResult.length; ++i) { | ||||
|                     let marker = this.findResult[i]; | ||||
|                     marker.clear(); | ||||
|                 } | ||||
|             }); | ||||
|         } | ||||
|         // Restore the highlightSelectionMatches setting | ||||
|         codeEditor.setOption("highlightSelectionMatches", this.oldHighlightSelectionMatches); | ||||
|         this.findResult = null; | ||||
|  | ||||
|         codeEditor.focus(); | ||||
|     } | ||||
| } | ||||
							
								
								
									
										93
									
								
								src/public/app/widgets/find_in_html.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										93
									
								
								src/public/app/widgets/find_in_html.js
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,93 @@ | ||||
| // ck-find-result and ck-find-result_selected are the styles ck-editor | ||||
| // uses for highlighting matches, use the same one on CodeMirror | ||||
| // for consistency | ||||
| import libraryLoader from "../services/library_loader.js"; | ||||
| import utils from "../services/utils.js"; | ||||
| import appContext from "../services/app_context.js"; | ||||
|  | ||||
| const FIND_RESULT_SELECTED_CSS_CLASSNAME = "ck-find-result_selected"; | ||||
| const FIND_RESULT_CSS_CLASSNAME = "ck-find-result"; | ||||
|  | ||||
| export default class FindInHtml { | ||||
|     constructor(parent) { | ||||
|         /** @property {FindWidget} */ | ||||
|         this.parent = parent; | ||||
|         this.currentIndex = 0; | ||||
|         this.$results = null; | ||||
|     } | ||||
|  | ||||
|     async getInitialSearchTerm() { | ||||
|         return ""; // FIXME | ||||
|     } | ||||
|  | ||||
|     async performFind(searchTerm, matchCase, wholeWord) { | ||||
|         await libraryLoader.requireLibrary(libraryLoader.MARKJS); | ||||
|  | ||||
|         const $content = await this.parent.noteContext.getContentElement(); | ||||
|  | ||||
|         const wholeWordChar = wholeWord ? "\\b" : ""; | ||||
|         const regExp = new RegExp(wholeWordChar + utils.escapeRegExp(searchTerm) + wholeWordChar, matchCase ? "g" : "gi"); | ||||
|  | ||||
|         return new Promise(res => { | ||||
|             $content.unmark({ | ||||
|                 done: () => { | ||||
|                     $content.markRegExp(regExp, { | ||||
|                         element: "span", | ||||
|                         className: FIND_RESULT_CSS_CLASSNAME, | ||||
|                         separateWordSearch: false, | ||||
|                         caseSensitive: matchCase, | ||||
|                         done: async () => { | ||||
|                             this.$results = $content.find("." + FIND_RESULT_CSS_CLASSNAME); | ||||
|                             this.currentIndex = 0; | ||||
|                             await this.jumpTo(); | ||||
|  | ||||
|                             res({ | ||||
|                                 totalFound: this.$results.length, | ||||
|                                 currentFound: 1 | ||||
|                             }); | ||||
|                         } | ||||
|                     }); | ||||
|                 } | ||||
|             }); | ||||
|         }); | ||||
|     } | ||||
|  | ||||
|     async findNext(direction, currentFound, nextFound) { | ||||
|         if (this.$results.length) { | ||||
|             this.currentIndex += direction; | ||||
|  | ||||
|             if (this.currentIndex < 0) { | ||||
|                 this.currentIndex = this.$results.length - 1; | ||||
|             } | ||||
|  | ||||
|             if (this.currentIndex > this.$results.length - 1) { | ||||
|                 this.currentIndex = 0; | ||||
|             } | ||||
|  | ||||
|             await this.jumpTo(); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     async findBoxClosed(totalFound, currentFound) { | ||||
|         const $content = await this.parent.noteContext.getContentElement(); | ||||
|         $content.unmark(); | ||||
|     } | ||||
|  | ||||
|     async jumpTo() { | ||||
|         if (this.$results.length) { | ||||
|             const offsetTop = 100; | ||||
|             const $current = this.$results.eq(this.currentIndex); | ||||
|             this.$results.removeClass(FIND_RESULT_SELECTED_CSS_CLASSNAME); | ||||
|  | ||||
|             if ($current.length) { | ||||
|                 $current.addClass(FIND_RESULT_SELECTED_CSS_CLASSNAME); | ||||
|                 const position = $current.position().top - offsetTop; | ||||
|  | ||||
|                 const $content = await this.parent.noteContext.getContentElement(); | ||||
|                 const $contentWiget = appContext.getComponentByEl($content); | ||||
|  | ||||
|                 $contentWiget.triggerCommand("scrollContainerTo", {position}); | ||||
|             } | ||||
|         } | ||||
|     } | ||||
| } | ||||
							
								
								
									
										119
									
								
								src/public/app/widgets/find_in_text.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										119
									
								
								src/public/app/widgets/find_in_text.js
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,119 @@ | ||||
| export default class FindInText { | ||||
|     constructor(parent) { | ||||
|         /** @property {FindWidget} */ | ||||
|         this.parent = parent; | ||||
|     } | ||||
|  | ||||
|     async getTextEditor() { | ||||
|         return this.parent.noteContext.getTextEditor(); | ||||
|     } | ||||
|  | ||||
|     async getInitialSearchTerm() { | ||||
|         const textEditor = await this.getTextEditor(); | ||||
|  | ||||
|         const selection = textEditor.model.document.selection; | ||||
|         const range = selection.getFirstRange(); | ||||
|  | ||||
|         for (const item of range.getItems()) { | ||||
|             // Fill in the findbox with the current selection if | ||||
|             // any | ||||
|             return item.data; | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     async performFind(searchTerm, matchCase, wholeWord) { | ||||
|         // Do this even if the searchTerm is empty so the markers are cleared and | ||||
|         // the counters updated | ||||
|         const textEditor = await this.getTextEditor(); | ||||
|         const model = textEditor.model; | ||||
|         let findResult = null; | ||||
|         let totalFound = 0; | ||||
|         let currentFound = -1; | ||||
|  | ||||
|         // Clear | ||||
|         const findAndReplaceEditing = textEditor.plugins.get('FindAndReplaceEditing'); | ||||
|         findAndReplaceEditing.state.clear(model); | ||||
|         findAndReplaceEditing.stop(); | ||||
|         if (searchTerm !== "") { | ||||
|             // Parameters are callback/text, options.matchCase=false, options.wholeWords=false | ||||
|             // See https://github.com/ckeditor/ckeditor5/blob/b95e2faf817262ac0e1e21993d9c0bde3f1be594/packages/ckeditor5-find-and-replace/src/findcommand.js#L44 | ||||
|             // XXX Need to use the callback version for regexp | ||||
|             // searchTerm = escapeRegExp(searchTerm); | ||||
|             // let re = new RegExp(searchTerm, 'gi'); | ||||
|             // let m = text.match(re); | ||||
|             // totalFound = m ? m.length : 0; | ||||
|             const options = { "matchCase" : matchCase, "wholeWords" : wholeWord }; | ||||
|             findResult = textEditor.execute('find', searchTerm, options); | ||||
|             totalFound = findResult.results.length; | ||||
|             // Find the result beyond the cursor | ||||
|             const cursorPos = model.document.selection.getLastPosition(); | ||||
|             for (let i = 0; i < findResult.results.length; ++i) { | ||||
|                 const marker = findResult.results.get(i).marker; | ||||
|                 const fromPos = marker.getStart(); | ||||
|                 if (fromPos.compareWith(cursorPos) !== "before") { | ||||
|                     currentFound = i; | ||||
|                     break; | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         this.findResult = findResult; | ||||
|  | ||||
|         // Calculate curfound if not already, highlight it as | ||||
|         // selected | ||||
|         if (totalFound > 0) { | ||||
|             currentFound = Math.max(0, currentFound); | ||||
|             // XXX Do this accessing the private data? | ||||
|             // See | ||||
|             // https://github.com/ckeditor/ckeditor5/blob/b95e2faf817262ac0e1e21993d9c0bde3f1be594/packages/ckeditor5-find-and-replace/src/findnextcommand.js | ||||
|             for (let i = 0 ; i < currentFound; ++i) { | ||||
|                 textEditor.execute('findNext', searchTerm); | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         return { | ||||
|             totalFound, | ||||
|             currentFound: currentFound + 1 | ||||
|         }; | ||||
|     } | ||||
|  | ||||
|     async findNext(direction, currentFound, nextFound) { | ||||
|         const textEditor = await this.getTextEditor(); | ||||
|  | ||||
|         // There are no parameters for findNext/findPrev | ||||
|         // See https://github.com/ckeditor/ckeditor5/blob/b95e2faf817262ac0e1e21993d9c0bde3f1be594/packages/ckeditor5-find-and-replace/src/findnextcommand.js#L57 | ||||
|         // curFound wrap around above assumes findNext and | ||||
|         // findPrevious wraparound, which is what they do | ||||
|         if (direction > 0) { | ||||
|             textEditor.execute('findNext'); | ||||
|         } else { | ||||
|             textEditor.execute('findPrevious'); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     async findBoxClosed(totalFound, currentFound) { | ||||
|         const textEditor = await this.getTextEditor(); | ||||
|  | ||||
|         if (totalFound > 0) { | ||||
|             // Clear the markers and set the caret to the | ||||
|             // current occurrence | ||||
|             const model = textEditor.model; | ||||
|             const range = this.findResult.results.get(currentFound).marker.getRange(); | ||||
|             // From | ||||
|             // https://github.com/ckeditor/ckeditor5/blob/b95e2faf817262ac0e1e21993d9c0bde3f1be594/packages/ckeditor5-find-and-replace/src/findandreplace.js#L92 | ||||
|             // XXX Roll our own since already done for codeEditor and | ||||
|             //     will probably allow more refactoring? | ||||
|             let findAndReplaceEditing = textEditor.plugins.get('FindAndReplaceEditing'); | ||||
|             findAndReplaceEditing.state.clear(model); | ||||
|             findAndReplaceEditing.stop(); | ||||
|             model.change(writer => { | ||||
|                 writer.setSelection(range, 0); | ||||
|             }); | ||||
|             textEditor.editing.view.scrollToTheSelection(); | ||||
|         } | ||||
|  | ||||
|         this.findResult = null; | ||||
|  | ||||
|         textEditor.focus(); | ||||
|     } | ||||
| } | ||||
| @@ -10,6 +10,7 @@ import FileTypeWidget from "./type_widgets/file.js"; | ||||
| import ImageTypeWidget from "./type_widgets/image.js"; | ||||
| import RenderTypeWidget from "./type_widgets/render.js"; | ||||
| import RelationMapTypeWidget from "./type_widgets/relation_map.js"; | ||||
| import CanvasTypeWidget from "./type_widgets/canvas.js"; | ||||
| import ProtectedSessionTypeWidget from "./type_widgets/protected_session.js"; | ||||
| import BookTypeWidget from "./type_widgets/book.js"; | ||||
| import appContext from "../services/app_context.js"; | ||||
| @@ -50,6 +51,7 @@ const typeWidgetClasses = { | ||||
|     'search': NoneTypeWidget, | ||||
|     'render': RenderTypeWidget, | ||||
|     'relation-map': RelationMapTypeWidget, | ||||
|     'canvas': CanvasTypeWidget, | ||||
|     'protected-session': ProtectedSessionTypeWidget, | ||||
|     'book': BookTypeWidget, | ||||
|     'note-map': NoteMapTypeWidget | ||||
| @@ -66,7 +68,7 @@ export default class NoteDetailWidget extends NoteContextAwareWidget { | ||||
|             const {noteId} = note; | ||||
|  | ||||
|             const dto = note.dto; | ||||
|             dto.content = this.getTypeWidget().getContent(); | ||||
|             dto.content = await this.getTypeWidget().getContent(); | ||||
|  | ||||
|             // for read only notes | ||||
|             if (dto.content === undefined) { | ||||
| @@ -145,11 +147,15 @@ export default class NoteDetailWidget extends NoteContextAwareWidget { | ||||
|         this.checkFullHeight(); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * sets full height of container that contains note content for a subset of note-types | ||||
|      */ | ||||
|     checkFullHeight() { | ||||
|         // https://github.com/zadam/trilium/issues/2522 | ||||
|         this.$widget.toggleClass("full-height", | ||||
|             !this.noteContext.hasNoteList() | ||||
|             && ['editable-text', 'editable-code'].includes(this.type)); | ||||
|             && ['editable-text', 'editable-code', 'canvas'].includes(this.type) | ||||
|             && this.mime !== 'text/x-sqlite;schema=trilium'); | ||||
|     } | ||||
|  | ||||
|     getTypeWidget() { | ||||
| @@ -210,7 +216,7 @@ export default class NoteDetailWidget extends NoteContextAwareWidget { | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     async beforeTabRemoveEvent({ntxIds}) { | ||||
|     async beforeNoteContextRemoveEvent({ntxIds}) { | ||||
|         if (this.isNoteContext(ntxIds)) { | ||||
|             await this.spacedUpdate.updateNowIfNecessary(); | ||||
|         } | ||||
| @@ -301,6 +307,16 @@ export default class NoteDetailWidget extends NoteContextAwareWidget { | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     async executeInActiveNoteDetailWidgetEvent({callback}) { | ||||
|         if (!this.isActiveNoteContext()) { | ||||
|             return; | ||||
|         } | ||||
|  | ||||
|         await this.initialized; | ||||
|  | ||||
|         callback(this); | ||||
|     } | ||||
|  | ||||
|     async cutIntoNoteCommand() { | ||||
|         const note = appContext.tabManager.getActiveContextNote(); | ||||
|  | ||||
| @@ -311,7 +327,8 @@ export default class NoteDetailWidget extends NoteContextAwareWidget { | ||||
|         // without await as this otherwise causes deadlock through component mutex | ||||
|         noteCreateService.createNote(appContext.tabManager.getActiveContextNotePath(), { | ||||
|             isProtected: note.isProtected, | ||||
|             saveSelection: true | ||||
|             saveSelection: true, | ||||
|             textEditor: await this.noteContext.getTextEditor() | ||||
|         }); | ||||
|     } | ||||
|  | ||||
| @@ -325,4 +342,16 @@ export default class NoteDetailWidget extends NoteContextAwareWidget { | ||||
|             this.refresh(); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     async executeWithTypeWidgetEvent({resolve, ntxId}) { | ||||
|         if (!this.isNoteContext(ntxId)) { | ||||
|             return; | ||||
|         } | ||||
|  | ||||
|         await this.initialized; | ||||
|  | ||||
|         await this.getWidgetType(); | ||||
|  | ||||
|         resolve(this.getTypeWidget()); | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -87,7 +87,7 @@ export default class NoteTitleWidget extends NoteContextAwareWidget { | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     async beforeTabRemoveEvent({ntxIds}) { | ||||
|     async beforeNoteContextRemoveEvent({ntxIds}) { | ||||
|         if (this.isNoteContext(ntxIds)) { | ||||
|             await this.spacedUpdate.updateNowIfNecessary(); | ||||
|         } | ||||
|   | ||||
| @@ -11,6 +11,7 @@ const NOTE_TYPES = [ | ||||
|     { type: "text", mime: "text/html", title: "Text", selectable: true }, | ||||
|     { type: "relation-map", mime: "application/json", title: "Relation Map", selectable: true }, | ||||
|     { type: "render", mime: '', title: "Render Note", selectable: true }, | ||||
|     { type: "canvas", mime: 'application/json', title: "Canvas", selectable: true }, | ||||
|     { type: "book", mime: '', title: "Book", selectable: true }, | ||||
|     { type: "mermaid", mime: 'text/mermaid', title: "Mermaid Diagram", selectable: true }, | ||||
|     { type: "code", mime: 'text/plain', title: "Code", selectable: true } | ||||
|   | ||||
| @@ -15,25 +15,36 @@ export default class NoteWrapperWidget extends FlexContainer { | ||||
|     } | ||||
|  | ||||
|     setNoteContextEvent({noteContext}) { | ||||
|         this.refresh(noteContext); | ||||
|         this.noteContext = noteContext; | ||||
|  | ||||
|         this.refresh(); | ||||
|     } | ||||
|  | ||||
|     noteSwitchedAndActivatedEvent({noteContext}) { | ||||
|         this.refresh(noteContext); | ||||
|     noteSwitchedAndActivatedEvent() { | ||||
|         this.refresh(); | ||||
|     } | ||||
|  | ||||
|     noteSwitchedEvent({noteContext}) { | ||||
|         this.refresh(noteContext); | ||||
|     noteSwitchedEvent() { | ||||
|         this.refresh(); | ||||
|     } | ||||
|  | ||||
|     activeContextChangedEvent({noteContext}) { | ||||
|         this.refresh(noteContext); | ||||
|     activeContextChangedEvent() { | ||||
|         this.refresh(); | ||||
|     } | ||||
|  | ||||
|     refresh(noteContext) { | ||||
|     refresh() { | ||||
|         const note = this.noteContext?.note; | ||||
|  | ||||
|         this.$widget.toggleClass("full-content-width", | ||||
|             ['image', 'mermaid', 'book', 'render'].includes(noteContext?.note?.type) | ||||
|             || !!noteContext?.note?.hasLabel('fullContentWidth') | ||||
|             ['image', 'mermaid', 'book', 'render', 'canvas'].includes(note?.type) | ||||
|             || !!note?.hasLabel('fullContentWidth') | ||||
|         ); | ||||
|     } | ||||
|  | ||||
|     async entitiesReloadedEvent({loadResults}) { | ||||
|         // listening on changes of note.type | ||||
|         if (loadResults.isNoteReloaded(this.noteContext?.noteId)) { | ||||
|             this.refresh(); | ||||
|         } | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -134,8 +134,6 @@ const TPL = ` | ||||
|                             Delete note</a> | ||||
|                         <a class="dropdown-item" href="#" data-action-add="deleteNoteRevisions"> | ||||
|                             Delete note revisions</a> | ||||
|                         <a class="dropdown-item" href="#" data-action-add="moveNote"> | ||||
|                             Delete note revisions</a> | ||||
|                         <a class="dropdown-item" href="#" data-action-add="deleteLabel"> | ||||
|                             Delete label</a> | ||||
|                         <a class="dropdown-item" href="#" data-action-add="deleteRelation"> | ||||
|   | ||||
							
								
								
									
										444
									
								
								src/public/app/widgets/type_widgets/canvas.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										444
									
								
								src/public/app/widgets/type_widgets/canvas.js
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,444 @@ | ||||
| import libraryLoader from "../../services/library_loader.js"; | ||||
| import TypeWidget from "./type_widget.js"; | ||||
| import utils from '../../services/utils.js'; | ||||
| import froca from "../../services/froca.js"; | ||||
| import debounce from "../../services/debounce.js"; | ||||
|  | ||||
| const {sleep} = utils; | ||||
|  | ||||
| const TPL = ` | ||||
|     <div class="canvas-widget note-detail-canvas note-detail-printable note-detail"> | ||||
|         <style type="text/css"> | ||||
|         .excalidraw .App-menu_top .buttonList { | ||||
|             display: flex; | ||||
|         } | ||||
|  | ||||
|         .excalidraw-wrapper { | ||||
|             height: 100%; | ||||
|         } | ||||
|  | ||||
|         :root[dir="ltr"] | ||||
|         .excalidraw | ||||
|         .layer-ui__wrapper | ||||
|         .zen-mode-transition.App-menu_bottom--transition-left { | ||||
|             transform: none; | ||||
|         } | ||||
|          | ||||
|         /* collaboration not possible so hide the button */ | ||||
|         .CollabButton { | ||||
|             display: none !important; | ||||
|         } | ||||
|  | ||||
|         </style> | ||||
|         <!-- height here necessary. otherwise excalidraw not shown --> | ||||
|         <div class="canvas-render" style="height: 100%"></div> | ||||
|     </div> | ||||
| `; | ||||
|  | ||||
| /** | ||||
|  * # Canvas note with excalidraw | ||||
|  * @author thfrei 2022-05-11 | ||||
|  * | ||||
|  * Background: | ||||
|  * excalidraw gives great support for hand drawn notes. It also allows to include images and support | ||||
|  * for sketching. Excalidraw has a vibrant and active community. | ||||
|  * | ||||
|  * Functionality: | ||||
|  * We store the excalidraw assets (elements, appState, files) in the note. In addition to that, we | ||||
|  * export the SVG from the canvas on every update. The SVG is also saved in the note. It is used | ||||
|  * for displaying any canvas note inside of a text note as an image. | ||||
|  * | ||||
|  * Paths not taken. | ||||
|  *  - excalidraw-to-svg (node.js) could be used to avoid storing the svg in the backend. | ||||
|  *    We could render the SVG on the fly. However, as of now, it does not render any hand drawn | ||||
|  *    (freedraw) paths. There is an issue with Path2D object not present in node-canvas library | ||||
|  *    used by jsdom. (See Trilium PR for samples and other issues in respective library. | ||||
|  *    Link will be added later). Related links: | ||||
|  *     - https://github.com/Automattic/node-canvas/pull/2013 | ||||
|  *     - https://github.com/google/canvas-5-polyfill | ||||
|  *     - https://github.com/Automattic/node-canvas/issues/1116 | ||||
|  *     - https://www.npmjs.com/package/path2d-polyfill | ||||
|  *  - excalidraw-to-svg (node.js) takes quite some time to load an image (1-2s) | ||||
|  *  - excalidraw-utils (browser) does render freedraw, however NOT freedraw with background. It is not | ||||
|  *    used, since it is a big dependency, and has the same functionality as react + excalidraw. | ||||
|  *  - infinite-drawing-canvas with fabric.js. This library lacked a lot of feature, excalidraw already | ||||
|  *    has. | ||||
|  * | ||||
|  * Known issues: | ||||
|  *  - v0.11.0 of excalidraw does not render freedraw backgrounds in the svg | ||||
|  *  - the 3 excalidraw fonts should be included in the share and everywhere, so that it is shown | ||||
|  *    when requiring svg. | ||||
|  * | ||||
|  * Discussion of storing svg in the note: | ||||
|  *  - Pro: we will combat bit-rot. Showing the SVG will be very fast and easy, since it is already there. | ||||
|  *  - Con: The note will get bigger (~40-50%?), we will generate more bandwith. However, using trilium | ||||
|  *         desktop instance mitigates that issue. | ||||
|  * | ||||
|  * Roadmap: | ||||
|  *  - Support image-notes as reference in excalidraw | ||||
|  *  - Support canvas note as reference (svg) in other canvas notes. | ||||
|  *  - Make it easy to include a canvas note inside a text note | ||||
|  *  - Support for excalidraw libraries. Maybe special code notes with a tag. | ||||
|  */ | ||||
| export default class ExcalidrawTypeWidget extends TypeWidget { | ||||
|     constructor() { | ||||
|         super(); | ||||
|  | ||||
|         // constants | ||||
|         this.SCENE_VERSION_INITIAL = -1; | ||||
|         this.SCENE_VERSION_ERROR = -2; | ||||
|  | ||||
|         // config | ||||
|         this.DEBOUNCE_TIME_ONCHANGEHANDLER = 750; // ms | ||||
|         // ensure that assets are loaded from trilium | ||||
|         window.EXCALIDRAW_ASSET_PATH = `${window.location.origin}/node_modules/@excalidraw/excalidraw/dist/`; | ||||
|  | ||||
|         // temporary vars | ||||
|         this.currentNoteId = ""; | ||||
|         this.currentSceneVersion = this.SCENE_VERSION_INITIAL; | ||||
|  | ||||
|         // will be overwritten | ||||
|         this.excalidrawRef; | ||||
|         this.$render; | ||||
|         this.$widget; | ||||
|         this.reactHandlers; // used to control react state | ||||
|  | ||||
|         this.createExcalidrawReactApp = this.createExcalidrawReactApp.bind(this); | ||||
|         this.onChangeHandler = this.onChangeHandler.bind(this); | ||||
|         this.isNewSceneVersion = this.isNewSceneVersion.bind(this); | ||||
|     } | ||||
|  | ||||
|     static getType() { | ||||
|         return "canvas"; | ||||
|     } | ||||
|  | ||||
|     doRender() { | ||||
|         this.$widget = $(TPL); | ||||
|  | ||||
|         this.$widget.toggleClass("full-height", true); // only add | ||||
|         this.$render = this.$widget.find('.canvas-render'); | ||||
|         const documentStyle = window.getComputedStyle(document.documentElement); | ||||
|         this.themeStyle = documentStyle.getPropertyValue('--theme-style')?.trim(); | ||||
|  | ||||
|         libraryLoader | ||||
|             .requireLibrary(libraryLoader.EXCALIDRAW) | ||||
|             .then(() => { | ||||
|                 const React = window.React; | ||||
|                 const ReactDOM = window.ReactDOM; | ||||
|                 const renderElement = this.$render.get(0); | ||||
|  | ||||
|                 ReactDOM.unmountComponentAtNode(renderElement); | ||||
|                 ReactDOM.render(React.createElement(this.createExcalidrawReactApp), renderElement); | ||||
|             }); | ||||
|  | ||||
|         return this.$widget; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * called to populate the widget container with the note content | ||||
|      * | ||||
|      * @param {note} note | ||||
|      */ | ||||
|     async doRefresh(note) { | ||||
|         // see if note changed, since we do not get a new class for a new note | ||||
|         const noteChanged = this.currentNoteId !== note.noteId; | ||||
|         if (noteChanged) { | ||||
|             // reset scene to omit unnecessary onchange handler | ||||
|             this.currentSceneVersion = this.SCENE_VERSION_INITIAL; | ||||
|         } | ||||
|         this.currentNoteId = note.noteId; | ||||
|  | ||||
|         // get note from backend and put into canvas | ||||
|         const noteComplement = await froca.getNoteComplement(note.noteId); | ||||
|  | ||||
|         // before we load content into excalidraw, make sure excalidraw has loaded | ||||
|         while (!this.excalidrawRef || !this.excalidrawRef.current) { | ||||
|             console.log("excalidrawRef not yet loaded, sleep 200ms..."); | ||||
|             await sleep(200); | ||||
|         } | ||||
|  | ||||
|         /** | ||||
|          * new and empty note - make sure that canvas is empty. | ||||
|          * If we do not set it manually, we occasionally get some "bleeding" from another | ||||
|          * note into this fresh note. Probably due to that this note-instance does not get | ||||
|          * newly instantiated? | ||||
|          */ | ||||
|         if (this.excalidrawRef.current && noteComplement.content?.trim() === "") { | ||||
|             const sceneData = { | ||||
|                 elements: [], | ||||
|                 appState: { | ||||
|                     theme: this.themeStyle | ||||
|                 }, | ||||
|                 collaborators: [] | ||||
|             }; | ||||
|  | ||||
|             this.excalidrawRef.current.updateScene(sceneData); | ||||
|         } | ||||
|         else if (this.excalidrawRef.current && noteComplement.content) { | ||||
|             // load saved content into excalidraw canvas | ||||
|             let content; | ||||
|  | ||||
|             try { | ||||
|                 content = JSON.parse(noteComplement.content || ""); | ||||
|             } catch(err) { | ||||
|                 console.error("Error parsing content. Probably note.type changed", | ||||
|                               "Starting with empty canvas" | ||||
|                               , note, noteComplement, err); | ||||
|  | ||||
|                 content = { | ||||
|                     elements: [], | ||||
|                     appState: {}, | ||||
|                     files: [], | ||||
|                 }; | ||||
|             } | ||||
|  | ||||
|             const {elements, appState, files} = content; | ||||
|  | ||||
|             appState.theme = this.themeStyle; | ||||
|  | ||||
|             /** | ||||
|              * use widths and offsets of current view, since stored appState has the state from | ||||
|              * previous edit. using the stored state would lead to pointer mismatch. | ||||
|              */ | ||||
|             const boundingClientRect = this.excalidrawWrapperRef.current.getBoundingClientRect(); | ||||
|             appState.width = boundingClientRect.width; | ||||
|             appState.height = boundingClientRect.height; | ||||
|             appState.offsetLeft = boundingClientRect.left; | ||||
|             appState.offsetTop = boundingClientRect.top; | ||||
|  | ||||
|             const sceneData = { | ||||
|                 elements, | ||||
|                 appState, | ||||
|                 collaborators: [] | ||||
|             }; | ||||
|  | ||||
|             // files are expected in an array when loading. they are stored as an key-index object | ||||
|             // see example for loading here: | ||||
|             // https://github.com/excalidraw/excalidraw/blob/c5a7723185f6ca05e0ceb0b0d45c4e3fbcb81b2a/src/packages/excalidraw/example/App.js#L68 | ||||
|             const fileArray = []; | ||||
|             for (const fileId in files) { | ||||
|                 const file = files[fileId]; | ||||
|                 // TODO: dataURL is replaceable with a trilium image url | ||||
|                 //       maybe we can save normal images (pasted) with base64 data url, and trilium images | ||||
|                 //       with their respective url! nice | ||||
|                 // file.dataURL = "http://localhost:8080/api/images/ltjOiU8nwoZx/start.png"; | ||||
|                 fileArray.push(file); | ||||
|             } | ||||
|  | ||||
|             this.excalidrawRef.current.updateScene(sceneData); | ||||
|             this.excalidrawRef.current.addFiles(fileArray); | ||||
|         } | ||||
|  | ||||
|         // set initial scene version | ||||
|         if (this.currentSceneVersion === this.SCENE_VERSION_INITIAL) { | ||||
|             this.currentSceneVersion = this.getSceneVersion(); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * gets data from widget container that will be sent via spacedUpdate.scheduleUpdate(); | ||||
|      * this is automatically called after this.saveData(); | ||||
|      */ | ||||
|     async getContent() { | ||||
|         const elements = this.excalidrawRef.current.getSceneElements(); | ||||
|         const appState = this.excalidrawRef.current.getAppState(); | ||||
|  | ||||
|         /** | ||||
|          * A file is not deleted, even though removed from canvas. therefore we only keep | ||||
|          * files that are referenced by an element. Maybe this will change with new excalidraw version? | ||||
|          */ | ||||
|         const files = this.excalidrawRef.current.getFiles(); | ||||
|  | ||||
|         /** | ||||
|          * parallel svg export to combat bitrot and enable rendering image for note inclusion, | ||||
|          * preview and share. | ||||
|          */ | ||||
|         const svg = await window.Excalidraw.exportToSvg({ | ||||
|             elements, | ||||
|             appState, | ||||
|             exportPadding: 5, // 5 px padding | ||||
|             metadata: 'trilium-export', | ||||
|             files | ||||
|         }); | ||||
|         const svgString = svg.outerHTML; | ||||
|  | ||||
|         /** | ||||
|          * workaround until https://github.com/excalidraw/excalidraw/pull/5065 is merged and published | ||||
|          */ | ||||
|         const svgSafeString = this.replaceExternalAssets(svgString); | ||||
|  | ||||
|         const activeFiles = {}; | ||||
|         elements.forEach((element) => { | ||||
|             if (element.fileId) { | ||||
|                 activeFiles[element.fileId] = files[element.fileId]; | ||||
|             } | ||||
|         }) | ||||
|  | ||||
|         const content = { | ||||
|             _meta: "This note has type `canvas`. It uses excalidraw and stores an exported svg alongside.", | ||||
|             elements, // excalidraw | ||||
|             appState, // excalidraw | ||||
|             files: activeFiles, // excalidraw | ||||
|             svg: svgSafeString, // not needed for excalidraw, used for note_short, content, and image api | ||||
|         }; | ||||
|  | ||||
|         return JSON.stringify(content); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * save content to backend | ||||
|      * spacedUpdate is kind of a debouncer. | ||||
|      */ | ||||
|     saveData() { | ||||
|         this.spacedUpdate.scheduleUpdate(); | ||||
|     } | ||||
|  | ||||
|     onChangeHandler() { | ||||
|         // changeHandler is called upon any tiny change in excalidraw. button clicked, hover, etc. | ||||
|         // make sure only when a new element is added, we actually save something. | ||||
|         const isNewSceneVersion = this.isNewSceneVersion(); | ||||
|         /** | ||||
|          * FIXME: however, we might want to make an exception, if viewport changed, since viewport | ||||
|          *        is desired to save? (add) and appState background, and some things | ||||
|          */ | ||||
|  | ||||
|         // upon updateScene, onchange is called, even though "nothing really changed" that is worth saving | ||||
|         const isNotInitialScene = this.currentSceneVersion !== this.SCENE_VERSION_INITIAL; | ||||
|  | ||||
|         const shouldSave = isNewSceneVersion && isNotInitialScene; | ||||
|  | ||||
|         if (shouldSave) { | ||||
|             this.updateSceneVersion(); | ||||
|             this.saveData(); | ||||
|         } else { | ||||
|             // do nothing | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     createExcalidrawReactApp() { | ||||
|         const React = window.React; | ||||
|         const Excalidraw = window.Excalidraw; | ||||
|  | ||||
|         const excalidrawRef = React.useRef(null); | ||||
|         this.excalidrawRef = excalidrawRef; | ||||
|         const excalidrawWrapperRef = React.useRef(null); | ||||
|         this.excalidrawWrapperRef = excalidrawWrapperRef; | ||||
|         const [dimensions, setDimensions] = React.useState({ | ||||
|             width: undefined, | ||||
|             height: undefined | ||||
|         }); | ||||
|  | ||||
|         React.useEffect(() => { | ||||
|             const dimensions = { | ||||
|                 width: excalidrawWrapperRef.current.getBoundingClientRect().width, | ||||
|                 height: excalidrawWrapperRef.current.getBoundingClientRect().height | ||||
|             }; | ||||
|             setDimensions(dimensions); | ||||
|  | ||||
|             const onResize = () => { | ||||
|                 const dimensions = { | ||||
|                     width: excalidrawWrapperRef.current.getBoundingClientRect().width, | ||||
|                     height: excalidrawWrapperRef.current.getBoundingClientRect().height | ||||
|                 }; | ||||
|                 setDimensions(dimensions); | ||||
|             }; | ||||
|  | ||||
|             window.addEventListener("resize", onResize); | ||||
|  | ||||
|             return () => window.removeEventListener("resize", onResize); | ||||
|         }, [excalidrawWrapperRef]); | ||||
|  | ||||
|         const onLinkOpen = React.useCallback((element, event) => { | ||||
|             const link = element.link; | ||||
|             const { nativeEvent } = event.detail; | ||||
|             const isNewTab = nativeEvent.ctrlKey || nativeEvent.metaKey; | ||||
|             const isNewWindow = nativeEvent.shiftKey; | ||||
|             const isInternalLink = link.startsWith("/") | ||||
|                 || link.includes(window.location.origin); | ||||
|  | ||||
|             if (isInternalLink && !isNewTab && !isNewWindow) { | ||||
|                 // signal that we're handling the redirect ourselves | ||||
|                 event.preventDefault(); | ||||
|                 // do a custom redirect, such as passing to react-router | ||||
|                 // ... | ||||
|             } else { | ||||
|                 // open in same tab | ||||
|             } | ||||
|           }, []); | ||||
|  | ||||
|         return React.createElement( | ||||
|             React.Fragment, | ||||
|             null, | ||||
|             React.createElement( | ||||
|                 "div", | ||||
|                 { | ||||
|                     className: "excalidraw-wrapper", | ||||
|                     ref: excalidrawWrapperRef | ||||
|                 }, | ||||
|                 React.createElement(Excalidraw.default, { | ||||
|                     // this makes sure that 1) manual theme switch button is hidden 2) theme stays as it should after opening menu | ||||
|                     theme: this.themeStyle, | ||||
|                     ref: excalidrawRef, | ||||
|                     width: dimensions.width, | ||||
|                     height: dimensions.height, | ||||
|                     onPaste: (data, event) => { | ||||
|                         console.log("Verbose: excalidraw internal paste. No trilium action implemented.", data, event); | ||||
|                     }, | ||||
|                     onChange: debounce(this.onChangeHandler, this.DEBOUNCE_TIME_ONCHANGEHANDLER), | ||||
|                     viewModeEnabled: false, | ||||
|                     zenModeEnabled: false, | ||||
|                     gridModeEnabled: false, | ||||
|                     isCollaborating: false, | ||||
|                     detectScroll: false, | ||||
|                     handleKeyboardGlobally: false, | ||||
|                     autoFocus: true, | ||||
|                     onLinkOpen, | ||||
|                 }) | ||||
|             ) | ||||
|         ); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * needed to ensure, that multipleOnChangeHandler calls do not trigger a safe. | ||||
|      * we compare the scene version as suggested in: | ||||
|      * https://github.com/excalidraw/excalidraw/issues/3014#issuecomment-778115329 | ||||
|      * | ||||
|      * info: sceneVersions are not incrementing. it seems to be a pseudo-random number | ||||
|      */ | ||||
|      isNewSceneVersion() { | ||||
|         const sceneVersion = this.getSceneVersion(); | ||||
|  | ||||
|         return this.currentSceneVersion === this.SCENE_VERSION_INITIAL // initial scene version update | ||||
|             || this.currentSceneVersion !== sceneVersion // ensure scene changed | ||||
|         ; | ||||
|     } | ||||
|  | ||||
|     getSceneVersion() { | ||||
|         if (this.excalidrawRef) { | ||||
|             const elements = this.excalidrawRef.current.getSceneElements(); | ||||
|             return window.Excalidraw.getSceneVersion(elements); | ||||
|         } else { | ||||
|             return this.SCENE_VERSION_ERROR; | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     updateSceneVersion() { | ||||
|         this.currentSceneVersion = this.getSceneVersion(); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * replaces exlicraw.com with own assets | ||||
|      * | ||||
|      * workaround until https://github.com/excalidraw/excalidraw/pull/5065 is merged and published | ||||
|      * needed for v0.11.0 | ||||
|      * | ||||
|      * @param {string} string | ||||
|      * @returns | ||||
|      */ | ||||
|     replaceExternalAssets = (string) => { | ||||
|         let result = string; | ||||
|         // exlidraw.com asset in react usage | ||||
|         result = result.replaceAll("https://excalidraw.com/", window.EXCALIDRAW_ASSET_PATH+"excalidraw-assets/"); | ||||
|         return result; | ||||
|     } | ||||
| } | ||||
| @@ -170,4 +170,14 @@ export default class EditableCodeTypeWidget extends TypeWidget { | ||||
|             }); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     async executeWithCodeEditorEvent({resolve, ntxId}) { | ||||
|         if (!this.isNoteContext(ntxId)) { | ||||
|             return; | ||||
|         } | ||||
|  | ||||
|         await this.initialized; | ||||
|  | ||||
|         resolve(this.codeEditor); | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -191,7 +191,7 @@ export default class EditableTextTypeWidget extends AbstractTextTypeWidget { | ||||
|         await this.initialized; | ||||
|  | ||||
|         this.textEditor.model.change(writer => { | ||||
|             const insertPosition = this.textEditor.model.document.selection.getFirstPosition(); | ||||
|             const insertPosition = this.textEditor.model.document.selection.getLastPosition(); | ||||
|             writer.insertText(text, insertPosition); | ||||
|         }); | ||||
|     } | ||||
| @@ -229,14 +229,18 @@ export default class EditableTextTypeWidget extends AbstractTextTypeWidget { | ||||
|         return !selection.isCollapsed; | ||||
|     } | ||||
|  | ||||
|     async executeInActiveEditorEvent({callback}) { | ||||
|         if (!this.isActive()) { | ||||
|     async executeWithTextEditorEvent({callback, resolve, ntxId}) { | ||||
|         if (!this.isNoteContext(ntxId)) { | ||||
|             return; | ||||
|         } | ||||
|  | ||||
|         await this.initialized; | ||||
|  | ||||
|         callback(this.textEditor); | ||||
|         if (callback) { | ||||
|             callback(this.textEditor); | ||||
|         } | ||||
|  | ||||
|         resolve(this.textEditor); | ||||
|     } | ||||
|  | ||||
|     addLinkToTextCommand() { | ||||
|   | ||||
| @@ -5,6 +5,7 @@ const TPL = ` | ||||
|     <style> | ||||
|     .note-detail-readonly-code { | ||||
|         min-height: 50px; | ||||
|         position: relative; | ||||
|     } | ||||
|      | ||||
|     .note-detail-readonly-code-content { | ||||
| @@ -30,4 +31,14 @@ export default class ReadOnlyCodeTypeWidget extends TypeWidget { | ||||
|  | ||||
|         this.$content.text(noteComplement.content); | ||||
|     } | ||||
|  | ||||
|     async executeWithContentElementEvent({resolve, ntxId}) { | ||||
|         if (!this.isNoteContext(ntxId)) { | ||||
|             return; | ||||
|         } | ||||
|  | ||||
|         await this.initialized; | ||||
|  | ||||
|         resolve(this.$content); | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -33,6 +33,7 @@ const TPL = ` | ||||
|         padding-top: 10px; | ||||
|         font-family: var(--detail-font-family); | ||||
|         min-height: 50px; | ||||
|         position: relative; | ||||
|     } | ||||
|          | ||||
|     .note-detail-readonly-text p:first-child, .note-detail-readonly-text::before { | ||||
| @@ -114,4 +115,14 @@ export default class ReadOnlyTextTypeWidget extends AbstractTextTypeWidget { | ||||
|     async refreshIncludedNoteEvent({noteId}) { | ||||
|         this.refreshIncludedNote(this.$content, noteId); | ||||
|     } | ||||
|  | ||||
|     async executeWithContentElementEvent({resolve, ntxId}) { | ||||
|         if (!this.isNoteContext(ntxId)) { | ||||
|             return; | ||||
|         } | ||||
|  | ||||
|         await this.initialized; | ||||
|  | ||||
|         resolve(this.$content); | ||||
|     } | ||||
| } | ||||
|   | ||||
Some files were not shown because too many files have changed in this diff Show More
		Reference in New Issue
	
	Block a user