mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 10:26:08 +01:00 
			
		
		
		
	Compare commits
	
		
			310 Commits
		
	
	
		
			v0.51.0-be
			...
			v0.53.2
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|  | ea3bce25d9 | ||
|  | 9b4ef6ea5e | ||
|  | c2c724aa00 | ||
|  | 95bbf5f405 | ||
|  | 12b3302687 | ||
|  | c575d47f0e | ||
|  | 02affece91 | ||
|  | 2f1a7e2093 | ||
|  | 4fc686bbbc | ||
|  | d1a763feef | ||
|  | ef49d20470 | ||
|  | 0d4275a260 | ||
|  | dbf1ac1e9d | ||
|  | e7db262559 | ||
|  | 3faae63b84 | ||
|  | 94867e07df | ||
|  | 33c272e86a | ||
|  | 7435cd4dc6 | ||
|  | 194ae41d19 | ||
|  | 2e1bef2df7 | ||
|  | 6b3077df0e | ||
|  | 1434effa22 | ||
|  | 67e69f1940 | ||
|  | 046db503d3 | ||
|  | 9827e30a61 | ||
|  | e21a1b56fa | ||
|  | 08e12e7349 | ||
|  | 5ed1631a35 | ||
|  | 8ac776f305 | ||
|  | 981fac8e50 | ||
|  | 8bb8ab96f1 | ||
|  | 0b0d1b59b9 | ||
|  | 57609a5952 | ||
|  | 4f86d769be | ||
|  | 6cb5144c09 | ||
|  | aee350b07b | ||
|  | 5ca7e39852 | ||
|  | 540aba39db | ||
|  | 9a8e677baf | ||
|  | c5bc23d511 | ||
|  | 7ac8dc6785 | ||
|  | 049261a8ee | ||
|  | 1d037d3f0f | ||
|  | b45df29937 | ||
|  | ec087ed328 | ||
|  | 9707094686 | ||
|  | eb8e5eafb6 | ||
|  | e140daa952 | ||
|  | 3255607b09 | ||
|  | 36c210d0dd | ||
|  | 595e16cc6f | ||
|  | 40bbe380d3 | ||
|  | 683b4ac73a | ||
|  | e0ad256194 | ||
|  | 0468ca6814 | ||
|  | 6ebf7ae94e | ||
|  | 5ccaf8b3b9 | ||
|  | 0e01c19414 | ||
|  | 1347d3fcc2 | ||
|  | ebd715ca1b | ||
|  | 73574ac890 | ||
|  | ca44edd48c | ||
|  | 312ffc110a | ||
|  | bc87bf12cf | ||
|  | 11412a258b | ||
|  | bc35efd565 | ||
|  | 416a723160 | ||
|  | 10322c5d0f | ||
|  | 7775d90b9a | ||
|  | fac9fef652 | ||
|  | f0ab1fb5a1 | ||
|  | f86fb129b6 | ||
|  | 63cabb13b6 | ||
|  | d3ee0aa8a8 | ||
|  | 6256bcde2d | ||
|  | df3fdb59c5 | ||
|  | 4cec856e21 | ||
|  | 8a43688a65 | ||
|  | 7edcd5d746 | ||
|  | ec6d93b34f | ||
|  | 0c6efb0cb7 | ||
|  | f8fd8e47a9 | ||
|  | 566111ce82 | ||
|  | 7ba619c71d | ||
|  | b678d87c80 | ||
|  | 4aaa0f8d8c | ||
|  | 1bfc5fb77f | ||
|  | 63f0e441b9 | ||
|  | 041b4ea442 | ||
|  | 2115b76047 | ||
|  | 117db9f1cc | ||
|  | b530bc548f | ||
|  | 8e23c15763 | ||
|  | 23e9bcfdc5 | ||
|  | 96c4934c00 | ||
|  | 31fb02f810 | ||
|  | 5fdb462ed5 | ||
|  | 7d76fb8bf5 | ||
|  | 0f7fa7a7b7 | ||
|  | e206d9cc68 | ||
|  | 2d33f570f4 | ||
|  | 15f8173add | ||
|  | 51bbc23270 | ||
|  | 7609bc78ec | ||
|  | b4ac41eff8 | ||
|  | f9bee7cd4e | ||
|  | f272238dde | ||
|  | 433003cf38 | ||
|  | 773cefe21d | ||
|  | 88fa51a34e | ||
|  | 4211d0feda | ||
|  | de1c76ee3c | ||
|  | ec4fac421b | ||
|  | f587e0dfd9 | ||
|  | b5214e6cea | ||
|  | 5fbaed61c1 | ||
|  | 9ce3e7e7d2 | ||
|  | e1cd09df36 | ||
|  | 27b55eb3ee | ||
|  | 8fcc76ad6d | ||
|  | ab0f0c5ced | ||
|  | 4837dd050b | ||
|  | c0c38a4b49 | ||
|  | 15a9ff4450 | ||
|  | 0a4f419e5e | ||
|  | 7fa531b3d6 | ||
|  | 3cfca27b54 | ||
|  | 93f0596b16 | ||
|  | b204014a11 | ||
|  | 98b579524c | ||
|  | 88586b0f25 | ||
|  | 103aa95ccf | ||
|  | 339a6d7817 | ||
|  | f252badba6 | ||
|  | fe27c80078 | ||
|  | 8052574950 | ||
|  | f19adf3ee0 | ||
|  | dcf31f8f95 | ||
|  | 93dd9274e7 | ||
|  | cce3f9a700 | ||
|  | 01155ad535 | ||
|  | ee217d6306 | ||
|  | 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 | ||||
|  | ||||
|   | ||||
							
								
								
									
										2
									
								
								.idea/misc.xml
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										2
									
								
								.idea/misc.xml
									
									
									
										generated
									
									
									
								
							| @@ -3,7 +3,7 @@ | ||||
|   <component name="JavaScriptSettings"> | ||||
|     <option name="languageLevel" value="ES6" /> | ||||
|   </component> | ||||
|   <component name="ProjectRootManager" version="2" languageLevel="JDK_11" default="true" project-jdk-name="11" project-jdk-type="JavaSDK"> | ||||
|   <component name="ProjectRootManager" version="2" languageLevel="JDK_18" default="true" project-jdk-name="openjdk-18" project-jdk-type="JavaSDK"> | ||||
|     <output url="file://$PROJECT_DIR$/out" /> | ||||
|   </component> | ||||
| </project> | ||||
							
								
								
									
										6
									
								
								DockerHealthcheck.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										6
									
								
								DockerHealthcheck.sh
									
									
									
									
									
										Executable file
									
								
							| @@ -0,0 +1,6 @@ | ||||
| #!/bin/sh | ||||
| if wget --spider -S "127.0.0.1:8080/api/health-check" 2>&1 | awk 'NR==2' | grep -w "HTTP/1.1 200 OK" ; then | ||||
|     exit 0 | ||||
| else | ||||
|     exit 1 | ||||
| fi | ||||
							
								
								
									
										13
									
								
								Dockerfile
									
									
									
									
									
								
							
							
						
						
									
										13
									
								
								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,17 @@ RUN set -x \ | ||||
|     && npm install --production \ | ||||
|     && apk del .build-dependencies | ||||
|  | ||||
| # Some setup tools need to be kept | ||||
| RUN apk add --no-cache su-exec shadow | ||||
|  | ||||
| # 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" ] | ||||
|  | ||||
| HEALTHCHECK CMD sh DockerHealthcheck.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'; | ||||
							
								
								
									
										2
									
								
								db/migrations/0196__rename_bulk_actions.sql
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								db/migrations/0196__rename_bulk_actions.sql
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,2 @@ | ||||
| UPDATE attributes SET value = replace(value, 'setLabelValue', 'updateLabelValue') WHERE name = 'action' AND type = 'label'; | ||||
| UPDATE attributes SET value = replace(value, 'setRelationTarget', 'updateRelationTarget') WHERE name = 'action' AND type = 'label'; | ||||
							
								
								
									
										1000
									
								
								docs/backend_api/AbstractEntity.html
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1000
									
								
								docs/backend_api/AbstractEntity.html
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @@ -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> | ||||
|   | ||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @@ -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> | ||||
|  | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
| @@ -149,6 +160,69 @@ from tokenHash and token.</div> | ||||
|  | ||||
|          | ||||
|              | ||||
| <h4 class="name" id="becca"><span class="type-signature">(protected) </span>becca<span class="type-signature"></span></h4> | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
| <dl class="details"> | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|     <dt class="tag-overrides">Overrides:</dt> | ||||
|     <dd class="tag-overrides"><ul class="dummy"><li> | ||||
|         <a href="AbstractEntity.html#becca">AbstractEntity#becca</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#line50">line 50</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
| </dl> | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|          | ||||
|              | ||||
| <h4 class="name" id="etapiTokenId"><span class="type-signature"></span>etapiTokenId<span class="type-signature"> :string</span></h4> | ||||
|  | ||||
|  | ||||
| @@ -199,7 +273,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 +341,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 +409,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 +477,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 +545,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 +613,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#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> | ||||
|      | ||||
|  | ||||
| @@ -559,6 +633,814 @@ from tokenHash and token.</div> | ||||
|      | ||||
|  | ||||
|      | ||||
|         <h3 class="subsection-title">Methods</h3> | ||||
|  | ||||
|          | ||||
|              | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|     <h4 class="name" id="addEntityChange"><span class="type-signature">(protected) </span>addEntityChange<span class="signature">()</span><span class="type-signature"></span></h4> | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
| <dl class="details"> | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|     <dt class="tag-overrides">Overrides:</dt> | ||||
|     <dd class="tag-overrides"><ul class="dummy"><li> | ||||
|         <a href="AbstractEntity.html#addEntityChange">AbstractEntity#addEntityChange</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#line59">line 59</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
| </dl> | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|          | ||||
|              | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|     <h4 class="name" id="beforeSaving"><span class="type-signature">(protected) </span>beforeSaving<span class="signature">()</span><span class="type-signature"></span></h4> | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
| <dl class="details"> | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|     <dt class="tag-overrides">Overrides:</dt> | ||||
|     <dd class="tag-overrides"><ul class="dummy"><li> | ||||
|         <a href="AbstractEntity.html#beforeSaving">AbstractEntity#beforeSaving</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#line18">line 18</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
| </dl> | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|          | ||||
|              | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|     <h4 class="name" id="generateHash"><span class="type-signature">(protected) </span>generateHash<span class="signature">()</span><span class="type-signature"></span></h4> | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
| <dl class="details"> | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|     <dt class="tag-overrides">Overrides:</dt> | ||||
|     <dd class="tag-overrides"><ul class="dummy"><li> | ||||
|         <a href="AbstractEntity.html#generateHash">AbstractEntity#generateHash</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#line30">line 30</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
| </dl> | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|          | ||||
|              | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|     <h4 class="name" id="generateIdIfNecessary"><span class="type-signature">(protected) </span>generateIdIfNecessary<span class="signature">()</span><span class="type-signature"></span></h4> | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
| <dl class="details"> | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|     <dt class="tag-overrides">Overrides:</dt> | ||||
|     <dd class="tag-overrides"><ul class="dummy"><li> | ||||
|         <a href="AbstractEntity.html#generateIdIfNecessary">AbstractEntity#generateIdIfNecessary</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#line23">line 23</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
| </dl> | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|          | ||||
|              | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|     <h4 class="name" id="getPojoToSave"><span class="type-signature">(protected) </span>getPojoToSave<span class="signature">()</span><span class="type-signature"></span></h4> | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
| <dl class="details"> | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|     <dt class="tag-overrides">Overrides:</dt> | ||||
|     <dd class="tag-overrides"><ul class="dummy"><li> | ||||
|         <a href="AbstractEntity.html#getPojoToSave">AbstractEntity#getPojoToSave</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#line71">line 71</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
| </dl> | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|          | ||||
|              | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|     <h4 class="name" id="getUtcDateChanged"><span class="type-signature">(protected) </span>getUtcDateChanged<span class="signature">()</span><span class="type-signature"></span></h4> | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
| <dl class="details"> | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|     <dt class="tag-overrides">Overrides:</dt> | ||||
|     <dd class="tag-overrides"><ul class="dummy"><li> | ||||
|         <a href="AbstractEntity.html#getUtcDateChanged">AbstractEntity#getUtcDateChanged</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#line45">line 45</a> | ||||
|     </li></ul></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#line125">line 125</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#line80">line 80</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> | ||||
|  | ||||
|      | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|          | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
| @@ -573,13 +1455,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
											
										
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @@ -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> | ||||
|  | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
| @@ -143,6 +154,69 @@ | ||||
|  | ||||
|          | ||||
|              | ||||
| <h4 class="name" id="becca"><span class="type-signature">(protected) </span>becca<span class="type-signature"></span></h4> | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
| <dl class="details"> | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|     <dt class="tag-overrides">Overrides:</dt> | ||||
|     <dd class="tag-overrides"><ul class="dummy"><li> | ||||
|         <a href="AbstractEntity.html#becca">AbstractEntity#becca</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#line50">line 50</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
| </dl> | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|          | ||||
|              | ||||
| <h4 class="name" id="isSynced"><span class="type-signature"></span>isSynced<span class="type-signature"> :boolean</span></h4> | ||||
|  | ||||
|  | ||||
| @@ -193,7 +267,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 +335,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 +403,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 +471,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#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> | ||||
|      | ||||
|  | ||||
| @@ -417,6 +491,814 @@ | ||||
|      | ||||
|  | ||||
|      | ||||
|         <h3 class="subsection-title">Methods</h3> | ||||
|  | ||||
|          | ||||
|              | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|     <h4 class="name" id="addEntityChange"><span class="type-signature">(protected) </span>addEntityChange<span class="signature">()</span><span class="type-signature"></span></h4> | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
| <dl class="details"> | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|     <dt class="tag-overrides">Overrides:</dt> | ||||
|     <dd class="tag-overrides"><ul class="dummy"><li> | ||||
|         <a href="AbstractEntity.html#addEntityChange">AbstractEntity#addEntityChange</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#line59">line 59</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
| </dl> | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|          | ||||
|              | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|     <h4 class="name" id="beforeSaving"><span class="type-signature">(protected) </span>beforeSaving<span class="signature">()</span><span class="type-signature"></span></h4> | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
| <dl class="details"> | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|     <dt class="tag-overrides">Overrides:</dt> | ||||
|     <dd class="tag-overrides"><ul class="dummy"><li> | ||||
|         <a href="AbstractEntity.html#beforeSaving">AbstractEntity#beforeSaving</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#line18">line 18</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
| </dl> | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|          | ||||
|              | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|     <h4 class="name" id="generateHash"><span class="type-signature">(protected) </span>generateHash<span class="signature">()</span><span class="type-signature"></span></h4> | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
| <dl class="details"> | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|     <dt class="tag-overrides">Overrides:</dt> | ||||
|     <dd class="tag-overrides"><ul class="dummy"><li> | ||||
|         <a href="AbstractEntity.html#generateHash">AbstractEntity#generateHash</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#line30">line 30</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
| </dl> | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|          | ||||
|              | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|     <h4 class="name" id="generateIdIfNecessary"><span class="type-signature">(protected) </span>generateIdIfNecessary<span class="signature">()</span><span class="type-signature"></span></h4> | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
| <dl class="details"> | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|     <dt class="tag-overrides">Overrides:</dt> | ||||
|     <dd class="tag-overrides"><ul class="dummy"><li> | ||||
|         <a href="AbstractEntity.html#generateIdIfNecessary">AbstractEntity#generateIdIfNecessary</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#line23">line 23</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
| </dl> | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|          | ||||
|              | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|     <h4 class="name" id="getPojoToSave"><span class="type-signature">(protected) </span>getPojoToSave<span class="signature">()</span><span class="type-signature"></span></h4> | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
| <dl class="details"> | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|     <dt class="tag-overrides">Overrides:</dt> | ||||
|     <dd class="tag-overrides"><ul class="dummy"><li> | ||||
|         <a href="AbstractEntity.html#getPojoToSave">AbstractEntity#getPojoToSave</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#line71">line 71</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
| </dl> | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|          | ||||
|              | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|     <h4 class="name" id="getUtcDateChanged"><span class="type-signature">(protected) </span>getUtcDateChanged<span class="signature">()</span><span class="type-signature"></span></h4> | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
| <dl class="details"> | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|     <dt class="tag-overrides">Overrides:</dt> | ||||
|     <dd class="tag-overrides"><ul class="dummy"><li> | ||||
|         <a href="AbstractEntity.html#getUtcDateChanged">AbstractEntity#getUtcDateChanged</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#line45">line 45</a> | ||||
|     </li></ul></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#line125">line 125</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#line80">line 80</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> | ||||
|  | ||||
|      | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|          | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
| @@ -431,13 +1313,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> | ||||
|  | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
| @@ -143,23 +154,13 @@ | ||||
|  | ||||
|          | ||||
|              | ||||
| <h4 class="name" id="noteId"><span class="type-signature"></span>noteId<span class="type-signature"> :string</span></h4> | ||||
| <h4 class="name" id="becca"><span class="type-signature">(protected) </span>becca<span class="type-signature"></span></h4> | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|     <h5>Type:</h5> | ||||
|     <ul> | ||||
|         <li> | ||||
|              | ||||
| <span class="param-type">string</span> | ||||
|  | ||||
|  | ||||
|         </li> | ||||
|     </ul> | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
| @@ -173,6 +174,11 @@ | ||||
|      | ||||
|  | ||||
|      | ||||
|     <dt class="tag-overrides">Overrides:</dt> | ||||
|     <dd class="tag-overrides"><ul class="dummy"><li> | ||||
|         <a href="AbstractEntity.html#becca">AbstractEntity#becca</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
| @@ -193,7 +199,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_abstract_entity.js.html">becca/entities/abstract_entity.js</a>, <a href="becca_entities_abstract_entity.js.html#line50">line 50</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
| @@ -211,7 +217,7 @@ | ||||
|  | ||||
|          | ||||
|              | ||||
| <h4 class="name" id="notePath"><span class="type-signature"></span>notePath<span class="type-signature"> :string</span></h4> | ||||
| <h4 class="name" id="noteId"><span class="type-signature"></span>noteId<span class="type-signature"> :string</span></h4> | ||||
|  | ||||
|  | ||||
|  | ||||
| @@ -279,7 +285,7 @@ | ||||
|  | ||||
|          | ||||
|              | ||||
| <h4 class="name" id="utcDateCreated"><span class="type-signature"></span>utcDateCreated<span class="type-signature"> :string</span></h4> | ||||
| <h4 class="name" id="notePath"><span class="type-signature"></span>notePath<span class="type-signature"> :string</span></h4> | ||||
|  | ||||
|  | ||||
|  | ||||
| @@ -346,10 +352,886 @@ | ||||
|  | ||||
|  | ||||
|          | ||||
|              | ||||
| <h4 class="name" id="utcDateCreated"><span class="type-signature"></span>utcDateCreated<span class="type-signature"> :string</span></h4> | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|     <h5>Type:</h5> | ||||
|     <ul> | ||||
|         <li> | ||||
|              | ||||
| <span class="param-type">string</span> | ||||
|  | ||||
|  | ||||
|         </li> | ||||
|     </ul> | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
| <dl class="details"> | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|     <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#line23">line 23</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
| </dl> | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|          | ||||
|      | ||||
|  | ||||
|      | ||||
|         <h3 class="subsection-title">Methods</h3> | ||||
|  | ||||
|          | ||||
|              | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|     <h4 class="name" id="addEntityChange"><span class="type-signature">(protected) </span>addEntityChange<span class="signature">()</span><span class="type-signature"></span></h4> | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
| <dl class="details"> | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|     <dt class="tag-overrides">Overrides:</dt> | ||||
|     <dd class="tag-overrides"><ul class="dummy"><li> | ||||
|         <a href="AbstractEntity.html#addEntityChange">AbstractEntity#addEntityChange</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#line59">line 59</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
| </dl> | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|          | ||||
|              | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|     <h4 class="name" id="beforeSaving"><span class="type-signature">(protected) </span>beforeSaving<span class="signature">()</span><span class="type-signature"></span></h4> | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
| <dl class="details"> | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|     <dt class="tag-overrides">Overrides:</dt> | ||||
|     <dd class="tag-overrides"><ul class="dummy"><li> | ||||
|         <a href="AbstractEntity.html#beforeSaving">AbstractEntity#beforeSaving</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#line18">line 18</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
| </dl> | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|          | ||||
|              | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|     <h4 class="name" id="generateHash"><span class="type-signature">(protected) </span>generateHash<span class="signature">()</span><span class="type-signature"></span></h4> | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
| <dl class="details"> | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|     <dt class="tag-overrides">Overrides:</dt> | ||||
|     <dd class="tag-overrides"><ul class="dummy"><li> | ||||
|         <a href="AbstractEntity.html#generateHash">AbstractEntity#generateHash</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#line30">line 30</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
| </dl> | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|          | ||||
|              | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|     <h4 class="name" id="generateIdIfNecessary"><span class="type-signature">(protected) </span>generateIdIfNecessary<span class="signature">()</span><span class="type-signature"></span></h4> | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
| <dl class="details"> | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|     <dt class="tag-overrides">Overrides:</dt> | ||||
|     <dd class="tag-overrides"><ul class="dummy"><li> | ||||
|         <a href="AbstractEntity.html#generateIdIfNecessary">AbstractEntity#generateIdIfNecessary</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#line23">line 23</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
| </dl> | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|          | ||||
|              | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|     <h4 class="name" id="getPojoToSave"><span class="type-signature">(protected) </span>getPojoToSave<span class="signature">()</span><span class="type-signature"></span></h4> | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
| <dl class="details"> | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|     <dt class="tag-overrides">Overrides:</dt> | ||||
|     <dd class="tag-overrides"><ul class="dummy"><li> | ||||
|         <a href="AbstractEntity.html#getPojoToSave">AbstractEntity#getPojoToSave</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#line71">line 71</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
| </dl> | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|          | ||||
|              | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|     <h4 class="name" id="getUtcDateChanged"><span class="type-signature">(protected) </span>getUtcDateChanged<span class="signature">()</span><span class="type-signature"></span></h4> | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
| <dl class="details"> | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|     <dt class="tag-overrides">Overrides:</dt> | ||||
|     <dd class="tag-overrides"><ul class="dummy"><li> | ||||
|         <a href="AbstractEntity.html#getUtcDateChanged">AbstractEntity#getUtcDateChanged</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#line45">line 45</a> | ||||
|     </li></ul></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#line125">line 125</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#line80">line 80</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> | ||||
|  | ||||
|      | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|          | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
| @@ -363,13 +1245,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> | ||||
|   | ||||
							
								
								
									
										218
									
								
								docs/backend_api/becca_entities_abstract_entity.js.html
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										218
									
								
								docs/backend_api/becca_entities_abstract_entity.js.html
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,218 @@ | ||||
| <!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 { | ||||
|     /** @protected */ | ||||
|     beforeSaving() { | ||||
|         this.generateIdIfNecessary(); | ||||
|     } | ||||
|  | ||||
|     /** @protected */ | ||||
|     generateIdIfNecessary() { | ||||
|         if (!this[this.constructor.primaryKeyName]) { | ||||
|             this[this.constructor.primaryKeyName] = utils.newEntityId(); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     /** @protected */ | ||||
|     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); | ||||
|     } | ||||
|  | ||||
|     /** @protected */ | ||||
|     getUtcDateChanged() { | ||||
|         return this.utcDateModified || this.utcDateCreated; | ||||
|     } | ||||
|  | ||||
|     /** @protected */ | ||||
|     get becca() { | ||||
|         if (!becca) { | ||||
|             becca = require('../becca'); | ||||
|         } | ||||
|  | ||||
|         return becca; | ||||
|     } | ||||
|  | ||||
|     /** @protected */ | ||||
|     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 | ||||
|         }); | ||||
|     } | ||||
|  | ||||
|     /** @protected */ | ||||
|     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"; } | ||||
| @@ -88,6 +90,7 @@ class Attribute extends AbstractEntity { | ||||
|         return this; | ||||
|     } | ||||
|  | ||||
|  | ||||
|     init() { | ||||
|         if (this.attributeId) { | ||||
|             this.becca.attributes[this.attributeId] = this; | ||||
| @@ -245,13 +248,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"); | ||||
| 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"; } | ||||
| @@ -140,6 +146,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 | ||||
| @@ -193,13 +267,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,16 +30,17 @@ | ||||
|  | ||||
| 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. | ||||
|  * Used by: | ||||
|  * - Trilium Sender | ||||
|  * - ETAPI clients | ||||
|  *  | ||||
|  * | ||||
|  * 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"; } | ||||
| @@ -70,10 +71,12 @@ class EtapiToken extends AbstractEntity { | ||||
|         this.utcDateModified = row.utcDateModified || this.utcDateCreated; | ||||
|         /** @type {boolean} */ | ||||
|         this.isDeleted = !!row.isDeleted; | ||||
|          | ||||
|         this.becca.etapiTokens[this.etapiTokenId] = this; | ||||
|  | ||||
|         if (this.etapiTokenId) { | ||||
|             this.becca.etapiTokens[this.etapiTokenId] = this; | ||||
|         } | ||||
|     } | ||||
|      | ||||
|  | ||||
|     init() { | ||||
|         if (this.etapiTokenId) { | ||||
|             this.becca.etapiTokens[this.etapiTokenId] = this; | ||||
| @@ -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,18 @@ 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 dayjs = require("dayjs"); | ||||
| const utc = require('dayjs/plugin/utc') | ||||
| dayjs.extend(utc) | ||||
|  | ||||
| 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"; } | ||||
| @@ -109,13 +115,17 @@ class Note extends AbstractEntity { | ||||
|     } | ||||
|  | ||||
|     init() { | ||||
|         /** @type {Branch[]} */ | ||||
|         /** @type {Branch[]} | ||||
|          * @private */ | ||||
|         this.parentBranches = []; | ||||
|         /** @type {Note[]} */ | ||||
|         /** @type {Note[]} | ||||
|          * @private */ | ||||
|         this.parents = []; | ||||
|         /** @type {Note[]} */ | ||||
|         /** @type {Note[]} | ||||
|          * @private*/ | ||||
|         this.children = []; | ||||
|         /** @type {Attribute[]} */ | ||||
|         /** @type {Attribute[]} | ||||
|          * @private */ | ||||
|         this.ownedAttributes = []; | ||||
|  | ||||
|         /** @type {Attribute[]|null} | ||||
| @@ -125,7 +135,8 @@ class Note extends AbstractEntity { | ||||
|          * @private*/ | ||||
|         this.inheritableAttributeCache = null; | ||||
|  | ||||
|         /** @type {Attribute[]} */ | ||||
|         /** @type {Attribute[]} | ||||
|          * @private*/ | ||||
|         this.targetRelations = []; | ||||
|  | ||||
|         this.becca.addNote(this.noteId, this); | ||||
| @@ -139,16 +150,19 @@ class Note extends AbstractEntity { | ||||
|         /** | ||||
|          * size of the content in bytes | ||||
|          * @type {int|null} | ||||
|          * @private | ||||
|          */ | ||||
|         this.contentSize = null; | ||||
|         /** | ||||
|          * size of the content and note revision contents in bytes | ||||
|          * @type {int|null} | ||||
|          * @private | ||||
|          */ | ||||
|         this.noteSize = null; | ||||
|         /** | ||||
|          * number of note revisions for this note | ||||
|          * @type {int|null} | ||||
|          * @private | ||||
|          */ | ||||
|         this.revisionCount = null; | ||||
|     } | ||||
| @@ -250,6 +264,22 @@ class Note extends AbstractEntity { | ||||
|             WHERE noteId = ?`, [this.noteId]); | ||||
|     } | ||||
|  | ||||
|     get dateCreatedObj() { | ||||
|         return this.dateCreated === null ? null : dayjs(this.dateCreated); | ||||
|     } | ||||
|  | ||||
|     get utcDateCreatedObj() { | ||||
|         return this.utcDateCreated === null ? null : dayjs.utc(this.utcDateCreated); | ||||
|     } | ||||
|  | ||||
|     get dateModifiedObj() { | ||||
|         return this.dateModified === null ? null : dayjs(this.dateModified); | ||||
|     } | ||||
|  | ||||
|     get utcDateModifiedObj() { | ||||
|         return this.utcDateModified === null ? null : dayjs.utc(this.utcDateModified); | ||||
|     } | ||||
|  | ||||
|     /** @returns {*} */ | ||||
|     getJsonContent() { | ||||
|         const content = this.getContent(); | ||||
| @@ -263,7 +293,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 +315,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.`); | ||||
|             } | ||||
|         } | ||||
|  | ||||
| @@ -375,6 +405,7 @@ class Note extends AbstractEntity { | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     /** @private */ | ||||
|     __getAttributes(path) { | ||||
|         if (path.includes(this.noteId)) { | ||||
|             return []; | ||||
| @@ -397,7 +428,11 @@ class Note extends AbstractEntity { | ||||
|                     const templateNote = this.becca.notes[ownedAttr.value]; | ||||
|  | ||||
|                     if (templateNote) { | ||||
|                         templateAttributes.push(...templateNote.__getAttributes(newPath)); | ||||
|                         templateAttributes.push( | ||||
|                             ...templateNote.__getAttributes(newPath) | ||||
|                                 // template attr is used as a marker for templates, but it's not meant to be inherited | ||||
|                                 .filter(attr => !(attr.type === 'label' && attr.name === 'template')) | ||||
|                         ); | ||||
|                     } | ||||
|                 } | ||||
|             } | ||||
| @@ -426,7 +461,10 @@ class Note extends AbstractEntity { | ||||
|         return this.__attributeCache; | ||||
|     } | ||||
|  | ||||
|     /** @returns {Attribute[]} */ | ||||
|     /** | ||||
|      * @private | ||||
|      * @returns {Attribute[]} | ||||
|      */ | ||||
|     __getInheritableAttributes(path) { | ||||
|         if (path.includes(this.noteId)) { | ||||
|             return []; | ||||
| @@ -439,8 +477,12 @@ class Note extends AbstractEntity { | ||||
|         return this.inheritableAttributeCache; | ||||
|     } | ||||
|  | ||||
|     hasAttribute(type, name) { | ||||
|         return !!this.getAttributes().find(attr => attr.type === type && attr.name === name); | ||||
|     hasAttribute(type, name, value) { | ||||
|         return !!this.getAttributes().find(attr => | ||||
|             attr.type === type | ||||
|             && attr.name === name | ||||
|             && (value === undefined || value === null || attr.value === value) | ||||
|         ); | ||||
|     } | ||||
|  | ||||
|     getAttributeCaseInsensitive(type, name, value) { | ||||
| @@ -461,27 +503,31 @@ class Note extends AbstractEntity { | ||||
|  | ||||
|     /** | ||||
|      * @param {string} name - label name | ||||
|      * @param {string} [value] - label value | ||||
|      * @returns {boolean} true if label exists (including inherited) | ||||
|      */ | ||||
|     hasLabel(name) { return this.hasAttribute(LABEL, name); } | ||||
|     hasLabel(name, value) { return this.hasAttribute(LABEL, name, value); } | ||||
|  | ||||
|     /** | ||||
|      * @param {string} name - label name | ||||
|      * @param {string} [value] - label value | ||||
|      * @returns {boolean} true if label exists (excluding inherited) | ||||
|      */ | ||||
|     hasOwnedLabel(name) { return this.hasOwnedAttribute(LABEL, name); } | ||||
|     hasOwnedLabel(name, value) { return this.hasOwnedAttribute(LABEL, name, value); } | ||||
|  | ||||
|     /** | ||||
|      * @param {string} name - relation name | ||||
|      * @param {string} [value] - relation value | ||||
|      * @returns {boolean} true if relation exists (including inherited) | ||||
|      */ | ||||
|     hasRelation(name) { return this.hasAttribute(RELATION, name); } | ||||
|     hasRelation(name, value) { return this.hasAttribute(RELATION, name, value); } | ||||
|  | ||||
|     /** | ||||
|      * @param {string} name - relation name | ||||
|      * @param {string} [value] - relation value | ||||
|      * @returns {boolean} true if relation exists (excluding inherited) | ||||
|      */ | ||||
|     hasOwnedRelation(name) { return this.hasOwnedAttribute(RELATION, name); } | ||||
|     hasOwnedRelation(name, value) { return this.hasOwnedAttribute(RELATION, name, value); } | ||||
|  | ||||
|     /** | ||||
|      * @param {string} name - label name | ||||
| @@ -534,10 +580,11 @@ class Note extends AbstractEntity { | ||||
|     /** | ||||
|      * @param {string} type - attribute type (label, relation, etc.) | ||||
|      * @param {string} name - attribute name | ||||
|      * @param {string} [value] - attribute value | ||||
|      * @returns {boolean} true if note has an attribute with given type and name (excluding inherited) | ||||
|      */ | ||||
|     hasOwnedAttribute(type, name) { | ||||
|         return !!this.getOwnedAttribute(type, name); | ||||
|     hasOwnedAttribute(type, name, value) { | ||||
|         return !!this.getOwnedAttribute(type, name, value); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
| @@ -624,15 +671,19 @@ class Note extends AbstractEntity { | ||||
|     /** | ||||
|      * @param {string} [type] - (optional) attribute type to filter | ||||
|      * @param {string} [name] - (optional) attribute name to filter | ||||
|      * @param {string} [value] - (optional) attribute value to filter | ||||
|      * @returns {Attribute[]} note's "owned" attributes - excluding inherited ones | ||||
|      */ | ||||
|     getOwnedAttributes(type, name) { | ||||
|     getOwnedAttributes(type, name, value) { | ||||
|         // it's a common mistake to include # or ~ into attribute name | ||||
|         if (name && ["#", "~"].includes(name[0])) { | ||||
|             name = name.substr(1); | ||||
|         } | ||||
|  | ||||
|         if (type && name) { | ||||
|         if (type && name && value !== undefined && value !== null) { | ||||
|             return this.ownedAttributes.filter(attr => attr.type === type && attr.name === name && attr.value === value); | ||||
|         } | ||||
|         else if (type && name) { | ||||
|             return this.ownedAttributes.filter(attr => attr.type === type && attr.name === name); | ||||
|         } | ||||
|         else if (type) { | ||||
| @@ -651,8 +702,8 @@ class Note extends AbstractEntity { | ||||
|      * | ||||
|      * This method can be significantly faster than the getAttribute() | ||||
|      */ | ||||
|     getOwnedAttribute(type, name) { | ||||
|         const attrs = this.getOwnedAttributes(type, name); | ||||
|     getOwnedAttribute(type, name, value) { | ||||
|         const attrs = this.getOwnedAttributes(type, name, value); | ||||
|  | ||||
|         return attrs.length > 0 ? attrs[0] : null; | ||||
|     } | ||||
| @@ -1151,10 +1202,40 @@ 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 (this.isDeleted) { | ||||
|             return; | ||||
|         } | ||||
|  | ||||
|         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 | ||||
|         const handlers = require("../../services/handlers"); | ||||
|         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 { | ||||
|                 this.title = protectedSessionService.decryptString(this.title); | ||||
|                 this.flatTextCache = null; | ||||
|  | ||||
|                 this.isDecrypted = true; | ||||
|             } | ||||
| @@ -1168,6 +1249,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: this.isProtected, | ||||
|             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 +1336,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'); | ||||
| @@ -269,9 +270,9 @@ function transactional(func) { | ||||
|         return ret; | ||||
|     } | ||||
|     catch (e) { | ||||
|         const entityChanges = cls.getAndClearEntityChangeIds(); | ||||
|         const entityChangeIds = cls.getAndClearEntityChangeIds(); | ||||
|  | ||||
|         if (entityChanges.length > 0) { | ||||
|         if (entityChangeIds.length > 0) { | ||||
|             log.info("Transaction rollback dirtied the becca, forcing reload."); | ||||
|  | ||||
|             require('../becca/becca_loader').load(); | ||||
| @@ -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> | ||||
|   | ||||
| @@ -742,13 +742,13 @@ and relation (representing named relationship between source and target note)</d | ||||
| </div> | ||||
|  | ||||
| <nav> | ||||
|     <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Attribute.html">Attribute</a></li><li><a href="Branch.html">Branch</a></li><li><a href="FrontendScriptApi.html">FrontendScriptApi</a></li><li><a href="NoteComplement.html">NoteComplement</a></li><li><a href="NoteShort.html">NoteShort</a></li></ul><h3>Global</h3><ul><li><a href="global.html#doRenderBody">doRenderBody</a></li></ul> | ||||
|     <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Attribute.html">Attribute</a></li><li><a href="Branch.html">Branch</a></li><li><a href="FrontendScriptApi.html">FrontendScriptApi</a></li><li><a href="module.exports.html">exports</a></li><li><a href="NoteComplement.html">NoteComplement</a></li><li><a href="NoteShort.html">NoteShort</a></li></ul><h3>Global</h3><ul><li><a href="global.html#doRenderBody">doRenderBody</a></li></ul> | ||||
| </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> | ||||
|   | ||||
| @@ -1056,13 +1056,13 @@ parents.</div> | ||||
| </div> | ||||
|  | ||||
| <nav> | ||||
|     <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Attribute.html">Attribute</a></li><li><a href="Branch.html">Branch</a></li><li><a href="FrontendScriptApi.html">FrontendScriptApi</a></li><li><a href="NoteComplement.html">NoteComplement</a></li><li><a href="NoteShort.html">NoteShort</a></li></ul><h3>Global</h3><ul><li><a href="global.html#doRenderBody">doRenderBody</a></li></ul> | ||||
|     <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Attribute.html">Attribute</a></li><li><a href="Branch.html">Branch</a></li><li><a href="FrontendScriptApi.html">FrontendScriptApi</a></li><li><a href="module.exports.html">exports</a></li><li><a href="NoteComplement.html">NoteComplement</a></li><li><a href="NoteShort.html">NoteShort</a></li></ul><h3>Global</h3><ul><li><a href="global.html#doRenderBody">doRenderBody</a></li></ul> | ||||
| </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
											
										
									
								
							| @@ -775,13 +775,13 @@ | ||||
| </div> | ||||
|  | ||||
| <nav> | ||||
|     <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Attribute.html">Attribute</a></li><li><a href="Branch.html">Branch</a></li><li><a href="FrontendScriptApi.html">FrontendScriptApi</a></li><li><a href="NoteComplement.html">NoteComplement</a></li><li><a href="NoteShort.html">NoteShort</a></li></ul><h3>Global</h3><ul><li><a href="global.html#doRenderBody">doRenderBody</a></li></ul> | ||||
|     <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Attribute.html">Attribute</a></li><li><a href="Branch.html">Branch</a></li><li><a href="FrontendScriptApi.html">FrontendScriptApi</a></li><li><a href="module.exports.html">exports</a></li><li><a href="NoteComplement.html">NoteComplement</a></li><li><a href="NoteShort.html">NoteShort</a></li></ul><h3>Global</h3><ul><li><a href="global.html#doRenderBody">doRenderBody</a></li></ul> | ||||
| </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> | ||||
|   | ||||
| @@ -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#line29">line 29</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#line38">line 38</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#line46">line 46</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#line52">line 52</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#line63">line 63</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#line73">line 73</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#line59">line 59</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#line44">line 44</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#line49">line 49</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#line41">line 41</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#line61">line 61</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#line68">line 68</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#line504">line 504</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#line238">line 238</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#line526">line 526</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#line163">line 163</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#line146">line 146</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#line173">line 173</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#line211">line 211</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#line216">line 216</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#line566">line 566</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#line390">line 390</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#line590">line 590</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#line717">line 717</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#line493">line 493</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#line225">line 225</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#line515">line 515</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#line560">line 560</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#line382">line 382</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#line584">line 584</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#line572">line 572</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#line458">line 458</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#line596">line 596</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#line153">line 153</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#line138">line 138</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#line181">line 181</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#line186">line 186</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#line578">line 578</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#line466">line 466</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#line608">line 608</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#line618">line 618</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#line602">line 602</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#line761">line 761</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#line696">line 696</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#line706">line 706</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#line632">line 632</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#line475">line 475</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#line168">line 168</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#line542">line 542</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#line484">line 484</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#line536">line 536</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#line548">line 548</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#line554">line 554</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#line689">line 689</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#line756">line 756</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#line748">line 748</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#line111">line 111</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
| @@ -7263,13 +7263,13 @@ This note's representation is used in note tree and is kept in Froca.</div> | ||||
| </div> | ||||
|  | ||||
| <nav> | ||||
|     <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Attribute.html">Attribute</a></li><li><a href="Branch.html">Branch</a></li><li><a href="FrontendScriptApi.html">FrontendScriptApi</a></li><li><a href="NoteComplement.html">NoteComplement</a></li><li><a href="NoteShort.html">NoteShort</a></li></ul><h3>Global</h3><ul><li><a href="global.html#doRenderBody">doRenderBody</a></li></ul> | ||||
|     <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Attribute.html">Attribute</a></li><li><a href="Branch.html">Branch</a></li><li><a href="FrontendScriptApi.html">FrontendScriptApi</a></li><li><a href="module.exports.html">exports</a></li><li><a href="NoteComplement.html">NoteComplement</a></li><li><a href="NoteShort.html">NoteShort</a></li></ul><h3>Global</h3><ul><li><a href="global.html#doRenderBody">doRenderBody</a></li></ul> | ||||
| </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> | ||||
|   | ||||
| @@ -104,13 +104,13 @@ export default Attribute; | ||||
| </div> | ||||
|  | ||||
| <nav> | ||||
|     <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Attribute.html">Attribute</a></li><li><a href="Branch.html">Branch</a></li><li><a href="FrontendScriptApi.html">FrontendScriptApi</a></li><li><a href="NoteComplement.html">NoteComplement</a></li><li><a href="NoteShort.html">NoteShort</a></li></ul><h3>Global</h3><ul><li><a href="global.html#doRenderBody">doRenderBody</a></li></ul> | ||||
|     <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Attribute.html">Attribute</a></li><li><a href="Branch.html">Branch</a></li><li><a href="FrontendScriptApi.html">FrontendScriptApi</a></li><li><a href="module.exports.html">exports</a></li><li><a href="NoteComplement.html">NoteComplement</a></li><li><a href="NoteShort.html">NoteShort</a></li></ul><h3>Global</h3><ul><li><a href="global.html#doRenderBody">doRenderBody</a></li></ul> | ||||
| </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,13 +93,13 @@ export default Branch; | ||||
| </div> | ||||
|  | ||||
| <nav> | ||||
|     <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Attribute.html">Attribute</a></li><li><a href="Branch.html">Branch</a></li><li><a href="FrontendScriptApi.html">FrontendScriptApi</a></li><li><a href="NoteComplement.html">NoteComplement</a></li><li><a href="NoteShort.html">NoteShort</a></li></ul><h3>Global</h3><ul><li><a href="global.html#doRenderBody">doRenderBody</a></li></ul> | ||||
|     <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Attribute.html">Attribute</a></li><li><a href="Branch.html">Branch</a></li><li><a href="FrontendScriptApi.html">FrontendScriptApi</a></li><li><a href="module.exports.html">exports</a></li><li><a href="NoteComplement.html">NoteComplement</a></li><li><a href="NoteShort.html">NoteShort</a></li></ul><h3>Global</h3><ul><li><a href="global.html#doRenderBody">doRenderBody</a></li></ul> | ||||
| </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> | ||||
|   | ||||
| @@ -76,13 +76,13 @@ export default NoteComplement; | ||||
| </div> | ||||
|  | ||||
| <nav> | ||||
|     <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Attribute.html">Attribute</a></li><li><a href="Branch.html">Branch</a></li><li><a href="FrontendScriptApi.html">FrontendScriptApi</a></li><li><a href="NoteComplement.html">NoteComplement</a></li><li><a href="NoteShort.html">NoteShort</a></li></ul><h3>Global</h3><ul><li><a href="global.html#doRenderBody">doRenderBody</a></li></ul> | ||||
|     <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Attribute.html">Attribute</a></li><li><a href="Branch.html">Branch</a></li><li><a href="FrontendScriptApi.html">FrontendScriptApi</a></li><li><a href="module.exports.html">exports</a></li><li><a href="NoteComplement.html">NoteComplement</a></li><li><a href="NoteShort.html">NoteShort</a></li></ul><h3>Global</h3><ul><li><a href="global.html#doRenderBody">doRenderBody</a></li></ul> | ||||
| </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> | ||||
|   | ||||
| @@ -44,7 +44,9 @@ 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", | ||||
|     "web-view": "bx bx-globe-alt" | ||||
| }; | ||||
|  | ||||
| /** | ||||
| @@ -152,7 +154,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; | ||||
|         } | ||||
| @@ -289,7 +291,11 @@ class NoteShort { | ||||
|                 const templateNote = this.froca.notes[templateAttr.value]; | ||||
|  | ||||
|                 if (templateNote && templateNote.noteId !== this.noteId) { | ||||
|                     attrArrs.push(templateNote.__getCachedAttributes(newPath)); | ||||
|                     attrArrs.push( | ||||
|                         templateNote.__getCachedAttributes(newPath) | ||||
|                             // template attr is used as a marker for templates, but it's not meant to be inherited | ||||
|                             .filter(attr => !(attr.type === 'label' && attr.name === 'template')) | ||||
|                     ); | ||||
|                 } | ||||
|             } | ||||
|  | ||||
| @@ -662,13 +668,18 @@ class NoteShort { | ||||
|             return []; | ||||
|         } | ||||
|  | ||||
|         return this.getAttributes() | ||||
|         const promotedAttrs = this.getAttributes() | ||||
|             .filter(attr => attr.isDefinition()) | ||||
|             .filter(attr => { | ||||
|                 const def = attr.getDefinition(); | ||||
|  | ||||
|                 return def && def.isPromoted; | ||||
|             }); | ||||
|  | ||||
|         // attrs are not resorted if position changes after initial load | ||||
|         promotedAttrs.sort((a, b) => a.position < b.position ? -1 : 1); | ||||
|  | ||||
|         return promotedAttrs; | ||||
|     } | ||||
|  | ||||
|     hasAncestor(ancestorNoteId, visitedNoteIds = null) { | ||||
| @@ -842,13 +853,13 @@ export default NoteShort; | ||||
| </div> | ||||
|  | ||||
| <nav> | ||||
|     <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Attribute.html">Attribute</a></li><li><a href="Branch.html">Branch</a></li><li><a href="FrontendScriptApi.html">FrontendScriptApi</a></li><li><a href="NoteComplement.html">NoteComplement</a></li><li><a href="NoteShort.html">NoteShort</a></li></ul><h3>Global</h3><ul><li><a href="global.html#doRenderBody">doRenderBody</a></li></ul> | ||||
|     <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Attribute.html">Attribute</a></li><li><a href="Branch.html">Branch</a></li><li><a href="FrontendScriptApi.html">FrontendScriptApi</a></li><li><a href="module.exports.html">exports</a></li><li><a href="NoteComplement.html">NoteComplement</a></li><li><a href="NoteShort.html">NoteShort</a></li></ul><h3>Global</h3><ul><li><a href="global.html#doRenderBody">doRenderBody</a></li></ul> | ||||
| </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> | ||||
|   | ||||
| @@ -156,7 +156,7 @@ | ||||
|      | ||||
|     <dt class="tag-source">Source:</dt> | ||||
|     <dd class="tag-source"><ul class="dummy"><li> | ||||
|         <a href="widgets_collapsible_widget.js.html">widgets/collapsible_widget.js</a>, <a href="widgets_collapsible_widget.js.html#line34">line 34</a> | ||||
|         <a href="widgets_collapsible_widget.js.html">widgets/collapsible_widget.js</a>, <a href="widgets_collapsible_widget.js.html#line37">line 37</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
| @@ -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> | ||||
|      | ||||
|  | ||||
| @@ -425,13 +425,13 @@ | ||||
| </div> | ||||
|  | ||||
| <nav> | ||||
|     <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Attribute.html">Attribute</a></li><li><a href="Branch.html">Branch</a></li><li><a href="FrontendScriptApi.html">FrontendScriptApi</a></li><li><a href="NoteComplement.html">NoteComplement</a></li><li><a href="NoteShort.html">NoteShort</a></li></ul><h3>Global</h3><ul><li><a href="global.html#doRenderBody">doRenderBody</a></li></ul> | ||||
|     <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Attribute.html">Attribute</a></li><li><a href="Branch.html">Branch</a></li><li><a href="FrontendScriptApi.html">FrontendScriptApi</a></li><li><a href="module.exports.html">exports</a></li><li><a href="NoteComplement.html">NoteComplement</a></li><li><a href="NoteShort.html">NoteShort</a></li></ul><h3>Global</h3><ul><li><a href="global.html#doRenderBody">doRenderBody</a></li></ul> | ||||
| </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>Classes</h3><ul><li><a href="Attribute.html">Attribute</a></li><li><a href="Branch.html">Branch</a></li><li><a href="FrontendScriptApi.html">FrontendScriptApi</a></li><li><a href="NoteComplement.html">NoteComplement</a></li><li><a href="NoteShort.html">NoteShort</a></li></ul><h3>Global</h3><ul><li><a href="global.html#doRenderBody">doRenderBody</a></li></ul> | ||||
|     <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Attribute.html">Attribute</a></li><li><a href="Branch.html">Branch</a></li><li><a href="FrontendScriptApi.html">FrontendScriptApi</a></li><li><a href="module.exports.html">exports</a></li><li><a href="NoteComplement.html">NoteComplement</a></li><li><a href="NoteShort.html">NoteShort</a></li></ul><h3>Global</h3><ul><li><a href="global.html#doRenderBody">doRenderBody</a></li></ul> | ||||
| </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> | ||||
|   | ||||
							
								
								
									
										170
									
								
								docs/frontend_api/module.exports.html
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										170
									
								
								docs/frontend_api/module.exports.html
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,170 @@ | ||||
| <!DOCTYPE html> | ||||
| <html lang="en"> | ||||
| <head> | ||||
|     <meta charset="utf-8"> | ||||
|     <title>JSDoc: Class: exports</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: exports</h1> | ||||
|  | ||||
|      | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
| <section> | ||||
|  | ||||
| <header> | ||||
|      | ||||
|         <h2><span class="attribs"><span class="type-signature"></span></span>exports<span class="signature">()</span><span class="type-signature"></span></h2> | ||||
|          | ||||
|             <div class="class-description">TODO: rename, it's not collapsible anymore</div> | ||||
|          | ||||
|      | ||||
| </header> | ||||
|  | ||||
| <article> | ||||
|     <div class="container-overview"> | ||||
|      | ||||
|          | ||||
|  | ||||
|      | ||||
|     <h2>Constructor</h2> | ||||
|      | ||||
|  | ||||
|      | ||||
|     <h4 class="name" id="exports"><span class="type-signature"></span>new exports<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="widgets_collapsible_widget.js.html">widgets/collapsible_widget.js</a>, <a href="widgets_collapsible_widget.js.html#line15">line 15</a> | ||||
|     </li></ul></dd> | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
| </dl> | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|      | ||||
|     </div> | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
|  | ||||
|      | ||||
| </article> | ||||
|  | ||||
| </section> | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
| </div> | ||||
|  | ||||
| <nav> | ||||
|     <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Attribute.html">Attribute</a></li><li><a href="Branch.html">Branch</a></li><li><a href="FrontendScriptApi.html">FrontendScriptApi</a></li><li><a href="module.exports.html">exports</a></li><li><a href="NoteComplement.html">NoteComplement</a></li><li><a href="NoteShort.html">NoteShort</a></li></ul><h3>Global</h3><ul><li><a href="global.html#doRenderBody">doRenderBody</a></li></ul> | ||||
| </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> | ||||
| @@ -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 | ||||
| @@ -523,13 +635,13 @@ export default FrontendScriptApi; | ||||
| </div> | ||||
|  | ||||
| <nav> | ||||
|     <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Attribute.html">Attribute</a></li><li><a href="Branch.html">Branch</a></li><li><a href="FrontendScriptApi.html">FrontendScriptApi</a></li><li><a href="NoteComplement.html">NoteComplement</a></li><li><a href="NoteShort.html">NoteShort</a></li></ul><h3>Global</h3><ul><li><a href="global.html#doRenderBody">doRenderBody</a></li></ul> | ||||
|     <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Attribute.html">Attribute</a></li><li><a href="Branch.html">Branch</a></li><li><a href="FrontendScriptApi.html">FrontendScriptApi</a></li><li><a href="module.exports.html">exports</a></li><li><a href="NoteComplement.html">NoteComplement</a></li><li><a href="NoteShort.html">NoteShort</a></li></ul><h3>Global</h3><ul><li><a href="global.html#doRenderBody">doRenderBody</a></li></ul> | ||||
| </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> | ||||
|   | ||||
| @@ -37,6 +37,9 @@ const WIDGET_TPL = ` | ||||
|     </div> | ||||
| </div>`; | ||||
|  | ||||
| /** | ||||
|  * TODO: rename, it's not collapsible anymore | ||||
|  */ | ||||
| export default class CollapsibleWidget extends NoteContextAwareWidget { | ||||
|     get widgetTitle() { return "Untitled widget"; } | ||||
|  | ||||
| @@ -60,10 +63,6 @@ export default class CollapsibleWidget extends NoteContextAwareWidget { | ||||
|  | ||||
|     /** for overriding */ | ||||
|     async doRenderBody() {} | ||||
|  | ||||
|     isExpanded() { | ||||
|         return this.$bodyWrapper.hasClass("show"); | ||||
|     } | ||||
| } | ||||
| </code></pre> | ||||
|         </article> | ||||
| @@ -75,13 +74,13 @@ export default class CollapsibleWidget extends NoteContextAwareWidget { | ||||
| </div> | ||||
|  | ||||
| <nav> | ||||
|     <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Attribute.html">Attribute</a></li><li><a href="Branch.html">Branch</a></li><li><a href="FrontendScriptApi.html">FrontendScriptApi</a></li><li><a href="NoteComplement.html">NoteComplement</a></li><li><a href="NoteShort.html">NoteShort</a></li></ul><h3>Global</h3><ul><li><a href="global.html#doRenderBody">doRenderBody</a></li></ul> | ||||
|     <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Attribute.html">Attribute</a></li><li><a href="Branch.html">Branch</a></li><li><a href="FrontendScriptApi.html">FrontendScriptApi</a></li><li><a href="module.exports.html">exports</a></li><li><a href="NoteComplement.html">NoteComplement</a></li><li><a href="NoteShort.html">NoteShort</a></li></ul><h3>Global</h3><ul><li><a href="global.html#doRenderBody">doRenderBody</a></li></ul> | ||||
| </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> | ||||
|   | ||||
| @@ -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 | ||||
|   | ||||
| @@ -48,7 +48,7 @@ function decrypt(key, cipherText, ivLength = 13) { | ||||
|     } | ||||
|     catch (e) { | ||||
|         // recovery from https://github.com/zadam/trilium/issues/510 | ||||
|         if (e.message && e.message.includes("WRONG_FINAL_BLOCK_LENGTH")) { | ||||
|         if (e.message?.includes("WRONG_FINAL_BLOCK_LENGTH") || e.message?.includes("wrong final block length")) { | ||||
|             log.info("Caught WRONG_FINAL_BLOCK_LENGTH, returning cipherText instead"); | ||||
|  | ||||
|             return cipherText; | ||||
|   | ||||
							
								
								
									
										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
											
										
									
								
							
							
								
								
									
										4
									
								
								libraries/mermaid.min.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										4
									
								
								libraries/mermaid.min.js
									
									
									
									
										vendored
									
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
							
								
								
									
										3005
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										3005
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										60
									
								
								package.json
									
									
									
									
									
								
							
							
						
						
									
										60
									
								
								package.json
									
									
									
									
									
								
							| @@ -2,7 +2,7 @@ | ||||
|   "name": "trilium", | ||||
|   "productName": "Trilium Notes", | ||||
|   "description": "Trilium Notes", | ||||
|   "version": "0.51.0-beta", | ||||
|   "version": "0.53.2", | ||||
|   "license": "AGPL-3.0-only", | ||||
|   "main": "electron.js", | ||||
|   "bin": { | ||||
| @@ -13,63 +13,67 @@ | ||||
|     "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.3", | ||||
|     "dayjs-plugin-utc": "^0.1.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", | ||||
|     "is-svg": "4.3.2", | ||||
|     "jimp": "0.16.1", | ||||
|     "joplin-turndown-plugin-gfm": "1.0.12", | ||||
|     "jsdom": "19.0.0", | ||||
|     "jsdom": "20.0.0", | ||||
|     "mime-types": "2.1.35", | ||||
|     "multer": "1.4.4", | ||||
|     "node-abi": "3.8.0", | ||||
|     "multer": "1.4.5-lts.1", | ||||
|     "node-abi": "3.22.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,22 +81,22 @@ | ||||
|     "tmp": "0.2.1", | ||||
|     "turndown": "7.1.1", | ||||
|     "unescape": "1.0.1", | ||||
|     "ws": "8.5.0", | ||||
|     "ws": "8.8.0", | ||||
|     "yauzl": "2.10.0" | ||||
|   }, | ||||
|   "devDependencies": { | ||||
|     "cross-env": "7.0.3", | ||||
|     "electron": "16.2.1", | ||||
|     "electron-builder": "23.0.3", | ||||
|     "electron-packager": "15.4.0", | ||||
|     "electron": "16.2.8", | ||||
|     "electron-builder": "23.1.0", | ||||
|     "electron-packager": "15.5.1", | ||||
|     "electron-rebuild": "3.2.7", | ||||
|     "esm": "3.2.25", | ||||
|     "jasmine": "4.0.2", | ||||
|     "jasmine": "4.2.1", | ||||
|     "jsdoc": "3.6.10", | ||||
|     "lorem-ipsum": "2.0.4", | ||||
|     "lorem-ipsum": "2.0.8", | ||||
|     "rcedit": "3.0.1", | ||||
|     "webpack": "5.72.0", | ||||
|     "webpack-cli": "4.9.2" | ||||
|     "webpack": "5.73.0", | ||||
|     "webpack-cli": "4.10.0" | ||||
|   }, | ||||
|   "optionalDependencies": { | ||||
|     "electron-installer-debian": "3.1.0" | ||||
|   | ||||
| @@ -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,17 +10,23 @@ const log = require("../../services/log"); | ||||
|  | ||||
| let becca = null; | ||||
|  | ||||
| /** | ||||
|  * Base class for all backend entities. | ||||
|  */ | ||||
| class AbstractEntity { | ||||
|     /** @protected */ | ||||
|     beforeSaving() { | ||||
|         this.generateIdIfNecessary(); | ||||
|     } | ||||
|  | ||||
|     /** @protected */ | ||||
|     generateIdIfNecessary() { | ||||
|         if (!this[this.constructor.primaryKeyName]) { | ||||
|             this[this.constructor.primaryKeyName] = utils.newEntityId(); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     /** @protected */ | ||||
|     generateHash(isDeleted = false) { | ||||
|         let contentToHash = ""; | ||||
|  | ||||
| @@ -35,10 +41,12 @@ class AbstractEntity { | ||||
|         return utils.hash(contentToHash).substr(0, 10); | ||||
|     } | ||||
|  | ||||
|     /** @protected */ | ||||
|     getUtcDateChanged() { | ||||
|         return this.utcDateModified || this.utcDateCreated; | ||||
|     } | ||||
|  | ||||
|     /** @protected */ | ||||
|     get becca() { | ||||
|         if (!becca) { | ||||
|             becca = require('../becca'); | ||||
| @@ -47,6 +55,7 @@ class AbstractEntity { | ||||
|         return becca; | ||||
|     } | ||||
|  | ||||
|     /** @protected */ | ||||
|     addEntityChange(isDeleted = false) { | ||||
|         entityChangesService.addEntityChange({ | ||||
|             entityName: this.constructor.entityName, | ||||
| @@ -58,10 +67,16 @@ class AbstractEntity { | ||||
|         }); | ||||
|     } | ||||
|  | ||||
|     /** @protected */ | ||||
|     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; | ||||
| @@ -100,6 +115,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"; } | ||||
| @@ -60,6 +62,7 @@ class Attribute extends AbstractEntity { | ||||
|         return this; | ||||
|     } | ||||
|  | ||||
|  | ||||
|     init() { | ||||
|         if (this.attributeId) { | ||||
|             this.becca.attributes[this.attributeId] = this; | ||||
|   | ||||
| @@ -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,18 @@ 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 dayjs = require("dayjs"); | ||||
| const utc = require('dayjs/plugin/utc') | ||||
| dayjs.extend(utc) | ||||
|  | ||||
| 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"; } | ||||
| @@ -81,13 +87,17 @@ class Note extends AbstractEntity { | ||||
|     } | ||||
|  | ||||
|     init() { | ||||
|         /** @type {Branch[]} */ | ||||
|         /** @type {Branch[]} | ||||
|          * @private */ | ||||
|         this.parentBranches = []; | ||||
|         /** @type {Note[]} */ | ||||
|         /** @type {Note[]} | ||||
|          * @private */ | ||||
|         this.parents = []; | ||||
|         /** @type {Note[]} */ | ||||
|         /** @type {Note[]} | ||||
|          * @private*/ | ||||
|         this.children = []; | ||||
|         /** @type {Attribute[]} */ | ||||
|         /** @type {Attribute[]} | ||||
|          * @private */ | ||||
|         this.ownedAttributes = []; | ||||
|  | ||||
|         /** @type {Attribute[]|null} | ||||
| @@ -97,7 +107,8 @@ class Note extends AbstractEntity { | ||||
|          * @private*/ | ||||
|         this.inheritableAttributeCache = null; | ||||
|  | ||||
|         /** @type {Attribute[]} */ | ||||
|         /** @type {Attribute[]} | ||||
|          * @private*/ | ||||
|         this.targetRelations = []; | ||||
|  | ||||
|         this.becca.addNote(this.noteId, this); | ||||
| @@ -111,16 +122,19 @@ class Note extends AbstractEntity { | ||||
|         /** | ||||
|          * size of the content in bytes | ||||
|          * @type {int|null} | ||||
|          * @private | ||||
|          */ | ||||
|         this.contentSize = null; | ||||
|         /** | ||||
|          * size of the content and note revision contents in bytes | ||||
|          * @type {int|null} | ||||
|          * @private | ||||
|          */ | ||||
|         this.noteSize = null; | ||||
|         /** | ||||
|          * number of note revisions for this note | ||||
|          * @type {int|null} | ||||
|          * @private | ||||
|          */ | ||||
|         this.revisionCount = null; | ||||
|     } | ||||
| @@ -222,6 +236,22 @@ class Note extends AbstractEntity { | ||||
|             WHERE noteId = ?`, [this.noteId]); | ||||
|     } | ||||
|  | ||||
|     get dateCreatedObj() { | ||||
|         return this.dateCreated === null ? null : dayjs(this.dateCreated); | ||||
|     } | ||||
|  | ||||
|     get utcDateCreatedObj() { | ||||
|         return this.utcDateCreated === null ? null : dayjs.utc(this.utcDateCreated); | ||||
|     } | ||||
|  | ||||
|     get dateModifiedObj() { | ||||
|         return this.dateModified === null ? null : dayjs(this.dateModified); | ||||
|     } | ||||
|  | ||||
|     get utcDateModifiedObj() { | ||||
|         return this.utcDateModified === null ? null : dayjs.utc(this.utcDateModified); | ||||
|     } | ||||
|  | ||||
|     /** @returns {*} */ | ||||
|     getJsonContent() { | ||||
|         const content = this.getContent(); | ||||
| @@ -235,7 +265,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 +287,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.`); | ||||
|             } | ||||
|         } | ||||
|  | ||||
| @@ -347,6 +377,7 @@ class Note extends AbstractEntity { | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     /** @private */ | ||||
|     __getAttributes(path) { | ||||
|         if (path.includes(this.noteId)) { | ||||
|             return []; | ||||
| @@ -369,7 +400,11 @@ class Note extends AbstractEntity { | ||||
|                     const templateNote = this.becca.notes[ownedAttr.value]; | ||||
|  | ||||
|                     if (templateNote) { | ||||
|                         templateAttributes.push(...templateNote.__getAttributes(newPath)); | ||||
|                         templateAttributes.push( | ||||
|                             ...templateNote.__getAttributes(newPath) | ||||
|                                 // template attr is used as a marker for templates, but it's not meant to be inherited | ||||
|                                 .filter(attr => !(attr.type === 'label' && attr.name === 'template')) | ||||
|                         ); | ||||
|                     } | ||||
|                 } | ||||
|             } | ||||
| @@ -398,7 +433,10 @@ class Note extends AbstractEntity { | ||||
|         return this.__attributeCache; | ||||
|     } | ||||
|  | ||||
|     /** @returns {Attribute[]} */ | ||||
|     /** | ||||
|      * @private | ||||
|      * @returns {Attribute[]} | ||||
|      */ | ||||
|     __getInheritableAttributes(path) { | ||||
|         if (path.includes(this.noteId)) { | ||||
|             return []; | ||||
| @@ -411,8 +449,18 @@ class Note extends AbstractEntity { | ||||
|         return this.inheritableAttributeCache; | ||||
|     } | ||||
|  | ||||
|     hasAttribute(type, name) { | ||||
|         return !!this.getAttributes().find(attr => attr.type === type && attr.name === name); | ||||
|     /** | ||||
|      * @param type | ||||
|      * @param name | ||||
|      * @param [value] | ||||
|      * @returns {boolean} | ||||
|      */ | ||||
|     hasAttribute(type, name, value) { | ||||
|         return !!this.getAttributes().find(attr => | ||||
|             attr.type === type | ||||
|             && attr.name === name | ||||
|             && (value === undefined || value === null || attr.value === value) | ||||
|         ); | ||||
|     } | ||||
|  | ||||
|     getAttributeCaseInsensitive(type, name, value) { | ||||
| @@ -433,27 +481,31 @@ class Note extends AbstractEntity { | ||||
|  | ||||
|     /** | ||||
|      * @param {string} name - label name | ||||
|      * @param {string} [value] - label value | ||||
|      * @returns {boolean} true if label exists (including inherited) | ||||
|      */ | ||||
|     hasLabel(name) { return this.hasAttribute(LABEL, name); } | ||||
|     hasLabel(name, value) { return this.hasAttribute(LABEL, name, value); } | ||||
|  | ||||
|     /** | ||||
|      * @param {string} name - label name | ||||
|      * @param {string} [value] - label value | ||||
|      * @returns {boolean} true if label exists (excluding inherited) | ||||
|      */ | ||||
|     hasOwnedLabel(name) { return this.hasOwnedAttribute(LABEL, name); } | ||||
|     hasOwnedLabel(name, value) { return this.hasOwnedAttribute(LABEL, name, value); } | ||||
|  | ||||
|     /** | ||||
|      * @param {string} name - relation name | ||||
|      * @param {string} [value] - relation value | ||||
|      * @returns {boolean} true if relation exists (including inherited) | ||||
|      */ | ||||
|     hasRelation(name) { return this.hasAttribute(RELATION, name); } | ||||
|     hasRelation(name, value) { return this.hasAttribute(RELATION, name, value); } | ||||
|  | ||||
|     /** | ||||
|      * @param {string} name - relation name | ||||
|      * @param {string} [value] - relation value | ||||
|      * @returns {boolean} true if relation exists (excluding inherited) | ||||
|      */ | ||||
|     hasOwnedRelation(name) { return this.hasOwnedAttribute(RELATION, name); } | ||||
|     hasOwnedRelation(name, value) { return this.hasOwnedAttribute(RELATION, name, value); } | ||||
|  | ||||
|     /** | ||||
|      * @param {string} name - label name | ||||
| @@ -506,10 +558,11 @@ class Note extends AbstractEntity { | ||||
|     /** | ||||
|      * @param {string} type - attribute type (label, relation, etc.) | ||||
|      * @param {string} name - attribute name | ||||
|      * @param {string} [value] - attribute value | ||||
|      * @returns {boolean} true if note has an attribute with given type and name (excluding inherited) | ||||
|      */ | ||||
|     hasOwnedAttribute(type, name) { | ||||
|         return !!this.getOwnedAttribute(type, name); | ||||
|     hasOwnedAttribute(type, name, value) { | ||||
|         return !!this.getOwnedAttribute(type, name, value); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
| @@ -596,15 +649,19 @@ class Note extends AbstractEntity { | ||||
|     /** | ||||
|      * @param {string} [type] - (optional) attribute type to filter | ||||
|      * @param {string} [name] - (optional) attribute name to filter | ||||
|      * @param {string} [value] - (optional) attribute value to filter | ||||
|      * @returns {Attribute[]} note's "owned" attributes - excluding inherited ones | ||||
|      */ | ||||
|     getOwnedAttributes(type, name) { | ||||
|     getOwnedAttributes(type, name, value) { | ||||
|         // it's a common mistake to include # or ~ into attribute name | ||||
|         if (name && ["#", "~"].includes(name[0])) { | ||||
|             name = name.substr(1); | ||||
|         } | ||||
|  | ||||
|         if (type && name) { | ||||
|         if (type && name && value !== undefined && value !== null) { | ||||
|             return this.ownedAttributes.filter(attr => attr.type === type && attr.name === name && attr.value === value); | ||||
|         } | ||||
|         else if (type && name) { | ||||
|             return this.ownedAttributes.filter(attr => attr.type === type && attr.name === name); | ||||
|         } | ||||
|         else if (type) { | ||||
| @@ -623,8 +680,8 @@ class Note extends AbstractEntity { | ||||
|      * | ||||
|      * This method can be significantly faster than the getAttribute() | ||||
|      */ | ||||
|     getOwnedAttribute(type, name) { | ||||
|         const attrs = this.getOwnedAttributes(type, name); | ||||
|     getOwnedAttribute(type, name, value) { | ||||
|         const attrs = this.getOwnedAttributes(type, name, value); | ||||
|  | ||||
|         return attrs.length > 0 ? attrs[0] : null; | ||||
|     } | ||||
| @@ -1123,6 +1180,35 @@ 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 (this.isDeleted) { | ||||
|             return; | ||||
|         } | ||||
|  | ||||
|         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 | ||||
|         const handlers = require("../../services/handlers"); | ||||
|         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 +1227,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: this.isProtected, | ||||
|             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() | ||||
|         }, true).save(); | ||||
|  | ||||
|         noteRevision.setContent(content); | ||||
|  | ||||
|         return noteRevision; | ||||
|     } | ||||
|  | ||||
|     beforeSaving() { | ||||
|         super.beforeSaving(); | ||||
|  | ||||
|   | ||||
| @@ -11,13 +11,15 @@ 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"; } | ||||
|     static get primaryKeyName() { return "noteRevisionId"; } | ||||
|     static get hashedProperties() { return ["noteRevisionId", "noteId", "title", "isProtected", "dateLastEdited", "dateCreated", "utcDateLastEdited", "utcDateCreated", "utcDateModified"]; } | ||||
|  | ||||
|     constructor(row) { | ||||
|     constructor(row, titleDecrypted = false) { | ||||
|         super(); | ||||
|  | ||||
|         /** @type {string} */ | ||||
| @@ -45,13 +47,10 @@ class NoteRevision extends AbstractEntity { | ||||
|         /** @type {number} */ | ||||
|         this.contentLength = row.contentLength; | ||||
|  | ||||
|         if (this.isProtected) { | ||||
|             if (protectedSessionService.isProtectedSessionAvailable()) { | ||||
|                 this.title = protectedSessionService.decryptString(this.title); | ||||
|             } | ||||
|             else { | ||||
|                 this.title = "[protected]"; | ||||
|             } | ||||
|         if (this.isProtected && !titleDecrypted) { | ||||
|             this.title = protectedSessionService.isProtectedSessionAvailable() | ||||
|                 ? protectedSessionService.decryptString(this.title) | ||||
|                 : "[protected]"; | ||||
|         } | ||||
|     } | ||||
|  | ||||
| @@ -66,8 +65,8 @@ class NoteRevision extends AbstractEntity { | ||||
|  | ||||
|     /* | ||||
|      * Note revision content has quite special handling - it's not a separate entity, but a lazily loaded | ||||
|      * part of NoteRevision entity with it's own sync. Reason behind this hybrid design is that | ||||
|      * content can be quite large and it's not necessary to load it / fill memory for any note access even | ||||
|      * part of NoteRevision entity with its own sync. Reason behind this hybrid design is that | ||||
|      * content can be quite large, and it's not necessary to load it / fill memory for any note access even | ||||
|      * if we don't need a content, especially for bulk operations like search. | ||||
|      * | ||||
|      * This is the same approach as is used for Note's content. | ||||
|   | ||||
| @@ -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); | ||||
|     }); | ||||
|   | ||||
| @@ -52,13 +52,13 @@ if (utils.isElectron()) { | ||||
|                     title: suggestion, | ||||
|                     command: "replaceMisspelling", | ||||
|                     spellingSuggestion: suggestion, | ||||
|                     uiIcon: "empty" | ||||
|                     uiIcon: "bx bx-empty" | ||||
|                 }); | ||||
|             } | ||||
|  | ||||
|             items.push({ | ||||
|                 title: `Add "${params.misspelledWord}" to dictionary`, | ||||
|                 uiIcon: "plus", | ||||
|                 uiIcon: "bx bx-plus", | ||||
|                 handler: () => webContents.session.addWordToSpellCheckerDictionary(params.misspelledWord) | ||||
|             }); | ||||
|  | ||||
| @@ -69,7 +69,7 @@ if (utils.isElectron()) { | ||||
|             items.push({ | ||||
|                 enabled: editFlags.canCut && hasText, | ||||
|                 title: `Cut <kbd>${platformModifier}+X`, | ||||
|                 uiIcon: "cut", | ||||
|                 uiIcon: "bx bx-cut", | ||||
|                 handler: () => webContents.cut() | ||||
|             }); | ||||
|         } | ||||
| @@ -78,7 +78,7 @@ if (utils.isElectron()) { | ||||
|             items.push({ | ||||
|                 enabled: editFlags.canCopy && hasText, | ||||
|                 title: `Copy <kbd>${platformModifier}+C`, | ||||
|                 uiIcon: "copy", | ||||
|                 uiIcon: "bx bx-copy", | ||||
|                 handler: () => webContents.copy() | ||||
|             }); | ||||
|         } | ||||
| @@ -86,7 +86,7 @@ if (utils.isElectron()) { | ||||
|         if (!["", "javascript:", "about:blank#blocked"].includes(params.linkURL) && params.mediaType === 'none') { | ||||
|             items.push({ | ||||
|                 title: `Copy link`, | ||||
|                 uiIcon: "copy", | ||||
|                 uiIcon: "bx bx-copy", | ||||
|                 handler: () => { | ||||
|                     electron.clipboard.write({ | ||||
|                         bookmark: params.linkText, | ||||
| @@ -100,7 +100,7 @@ if (utils.isElectron()) { | ||||
|             items.push({ | ||||
|                 enabled: editFlags.canPaste, | ||||
|                 title: `Paste <kbd>${platformModifier}+V`, | ||||
|                 uiIcon: "paste", | ||||
|                 uiIcon: "bx bx-paste", | ||||
|                 handler: () => webContents.paste() | ||||
|             }); | ||||
|         } | ||||
| @@ -109,7 +109,7 @@ if (utils.isElectron()) { | ||||
|             items.push({ | ||||
|                 enabled: editFlags.canPaste, | ||||
|                 title: `Paste as plain text <kbd>${platformModifier}+Shift+V`, | ||||
|                 uiIcon: "paste", | ||||
|                 uiIcon: "bx bx-paste", | ||||
|                 handler: () => webContents.pasteAndMatchStyle() | ||||
|             }); | ||||
|         } | ||||
| @@ -122,7 +122,7 @@ if (utils.isElectron()) { | ||||
|             items.push({ | ||||
|                 enabled: editFlags.canPaste, | ||||
|                 title: `Search for "${shortenedSelection}" with DuckDuckGo`, | ||||
|                 uiIcon: "search-alt", | ||||
|                 uiIcon: "bx bx-search-alt", | ||||
|                 handler: () => electron.shell.openExternal(`https://duckduckgo.com/?q=${encodeURIComponent(params.selectionText)}`) | ||||
|             }); | ||||
|         } | ||||
|   | ||||
| @@ -1,24 +0,0 @@ | ||||
| import server from "../services/server.js"; | ||||
| import utils from "../services/utils.js"; | ||||
|  | ||||
| const $dialog = $("#about-dialog"); | ||||
| const $appVersion = $("#app-version"); | ||||
| const $dbVersion = $("#db-version"); | ||||
| const $syncVersion = $("#sync-version"); | ||||
| const $buildDate = $("#build-date"); | ||||
| const $buildRevision = $("#build-revision"); | ||||
| const $dataDirectory = $("#data-directory"); | ||||
|  | ||||
| export async function showDialog() { | ||||
|     const appInfo = await server.get('app-info'); | ||||
|  | ||||
|     $appVersion.text(appInfo.appVersion); | ||||
|     $dbVersion.text(appInfo.dbVersion); | ||||
|     $syncVersion.text(appInfo.syncVersion); | ||||
|     $buildDate.text(appInfo.buildDate); | ||||
|     $buildRevision.text(appInfo.buildRevision); | ||||
|     $buildRevision.attr('href', 'https://github.com/zadam/trilium/commit/' + appInfo.buildRevision); | ||||
|     $dataDirectory.text(appInfo.dataDirectory); | ||||
|  | ||||
|     utils.openDialog($dialog); | ||||
| } | ||||
| @@ -1,131 +0,0 @@ | ||||
| import treeService from '../services/tree.js'; | ||||
| import noteAutocompleteService from "../services/note_autocomplete.js"; | ||||
| import utils from "../services/utils.js"; | ||||
|  | ||||
| const $dialog = $("#add-link-dialog"); | ||||
| const $form = $("#add-link-form"); | ||||
| const $autoComplete = $("#add-link-note-autocomplete"); | ||||
| const $linkTitle = $("#link-title"); | ||||
| const $addLinkTitleSettings = $("#add-link-title-settings"); | ||||
| const $addLinkTitleRadios = $(".add-link-title-radios"); | ||||
| const $addLinkTitleFormGroup = $("#add-link-title-form-group"); | ||||
|  | ||||
| /** @var TextTypeWidget */ | ||||
| let textTypeWidget; | ||||
|  | ||||
| export async function showDialog(widget, text = '') { | ||||
|     textTypeWidget = widget; | ||||
|  | ||||
|     $addLinkTitleSettings.toggle(!textTypeWidget.hasSelection()); | ||||
|  | ||||
|     $addLinkTitleSettings.find('input[type=radio]').on('change', updateTitleSettingsVisibility); | ||||
|  | ||||
|     // with selection hyper link is implied | ||||
|     if (textTypeWidget.hasSelection()) { | ||||
|         $addLinkTitleSettings.find("input[value='hyper-link']").prop("checked", true); | ||||
|     } | ||||
|     else { | ||||
|         $addLinkTitleSettings.find("input[value='reference-link']").prop("checked", true); | ||||
|     } | ||||
|  | ||||
|     updateTitleSettingsVisibility(); | ||||
|  | ||||
|     utils.openDialog($dialog); | ||||
|  | ||||
|     $autoComplete.val(''); | ||||
|     $linkTitle.val(''); | ||||
|  | ||||
|     async function setDefaultLinkTitle(noteId) { | ||||
|         const noteTitle = await treeService.getNoteTitle(noteId); | ||||
|  | ||||
|         $linkTitle.val(noteTitle); | ||||
|     } | ||||
|  | ||||
|     noteAutocompleteService.initNoteAutocomplete($autoComplete, { | ||||
|         allowExternalLinks: true, | ||||
|         allowCreatingNotes: true | ||||
|     }); | ||||
|  | ||||
|     $autoComplete.on('autocomplete:noteselected', (event, suggestion, dataset) => { | ||||
|         if (!suggestion.notePath) { | ||||
|             return false; | ||||
|         } | ||||
|  | ||||
|         updateTitleSettingsVisibility(); | ||||
|  | ||||
|         const noteId = treeService.getNoteIdFromNotePath(suggestion.notePath); | ||||
|  | ||||
|         if (noteId) { | ||||
|             setDefaultLinkTitle(noteId); | ||||
|         } | ||||
|     }); | ||||
|  | ||||
|     $autoComplete.on('autocomplete:externallinkselected', (event, suggestion, dataset) => { | ||||
|         if (!suggestion.externalLink) { | ||||
|             return false; | ||||
|         } | ||||
|  | ||||
|         updateTitleSettingsVisibility(); | ||||
|  | ||||
|         $linkTitle.val(suggestion.externalLink); | ||||
|     }); | ||||
|  | ||||
|     $autoComplete.on('autocomplete:cursorchanged',  function(event, suggestion, dataset) { | ||||
|         if (suggestion.externalLink) { | ||||
|             $linkTitle.val(suggestion.externalLink) | ||||
|         } | ||||
|         else { | ||||
|             const noteId = treeService.getNoteIdFromNotePath(suggestion.notePath); | ||||
|  | ||||
|             if (noteId) { | ||||
|                 setDefaultLinkTitle(noteId); | ||||
|             } | ||||
|         } | ||||
|     }); | ||||
|  | ||||
|     if (text && text.trim()) { | ||||
|         noteAutocompleteService.setText($autoComplete, text); | ||||
|     } | ||||
|     else { | ||||
|         noteAutocompleteService.showRecentNotes($autoComplete); | ||||
|     } | ||||
|  | ||||
|     $autoComplete | ||||
|         .trigger('focus') | ||||
|         .trigger('select'); // to be able to quickly remove entered text | ||||
| } | ||||
|  | ||||
| function getLinkType() { | ||||
|     if ($autoComplete.getSelectedExternalLink()) { | ||||
|         return 'external-link'; | ||||
|     } | ||||
|  | ||||
|     return $addLinkTitleSettings.find('input[type=radio]:checked').val(); | ||||
| } | ||||
|  | ||||
| function updateTitleSettingsVisibility() { | ||||
|     const linkType = getLinkType(); | ||||
|  | ||||
|     $addLinkTitleFormGroup.toggle(linkType !== 'reference-link'); | ||||
|     $addLinkTitleRadios.toggle(linkType !== 'external-link') | ||||
| } | ||||
|  | ||||
| $form.on('submit', () => { | ||||
|     if ($autoComplete.getSelectedNotePath()) { | ||||
|         $dialog.modal('hide'); | ||||
|  | ||||
|         const linkTitle = getLinkType() === 'reference-link' ? null : $linkTitle.val(); | ||||
|  | ||||
|         textTypeWidget.addLink($autoComplete.getSelectedNotePath(), linkTitle); | ||||
|     } | ||||
|     else if ($autoComplete.getSelectedExternalLink()) { | ||||
|         $dialog.modal('hide'); | ||||
|  | ||||
|         textTypeWidget.addLink($autoComplete.getSelectedExternalLink(), $linkTitle.val()); | ||||
|     } | ||||
|     else { | ||||
|         logError("No link to add."); | ||||
|     } | ||||
|  | ||||
|     return false; | ||||
| }); | ||||
| @@ -1,28 +0,0 @@ | ||||
| import server from "../services/server.js"; | ||||
| import utils from "../services/utils.js"; | ||||
|  | ||||
| const $dialog = $("#backend-log-dialog"); | ||||
| const $backendLogTextArea = $("#backend-log-textarea"); | ||||
| const $refreshBackendLog = $("#refresh-backend-log-button"); | ||||
|  | ||||
| export async function showDialog() { | ||||
|     utils.openDialog($dialog); | ||||
|  | ||||
|     load(); | ||||
| } | ||||
|  | ||||
| function scrollToBottom() { | ||||
|     $backendLogTextArea.scrollTop($backendLogTextArea[0].scrollHeight); | ||||
| } | ||||
|  | ||||
| async function load() { | ||||
|     const backendLog = await server.get('backend-log'); | ||||
|  | ||||
|     $backendLogTextArea.text(backendLog); | ||||
|  | ||||
|     scrollToBottom(); | ||||
| } | ||||
|  | ||||
| $refreshBackendLog.on('click', load); | ||||
|  | ||||
| $dialog.on('shown.bs.modal', scrollToBottom); | ||||
| @@ -1,59 +0,0 @@ | ||||
| import treeService from '../services/tree.js'; | ||||
| import server from '../services/server.js'; | ||||
| import froca from "../services/froca.js"; | ||||
| import toastService from "../services/toast.js"; | ||||
| import utils from "../services/utils.js"; | ||||
|  | ||||
| const $dialog = $("#branch-prefix-dialog"); | ||||
| const $form = $("#branch-prefix-form"); | ||||
| const $treePrefixInput = $("#branch-prefix-input"); | ||||
| const $noteTitle = $('#branch-prefix-note-title'); | ||||
|  | ||||
| let branchId; | ||||
|  | ||||
| export async function showDialog(notePath) { | ||||
|     const {noteId, parentNoteId} = treeService.getNoteIdAndParentIdFromNotePath(notePath); | ||||
|  | ||||
|     if (!noteId || !parentNoteId) { | ||||
|         return; | ||||
|     } | ||||
|  | ||||
|     branchId = await froca.getBranchId(parentNoteId, noteId); | ||||
|     const branch = froca.getBranch(branchId); | ||||
|  | ||||
|     if (!branch || branch.noteId === 'root') { | ||||
|         return; | ||||
|     } | ||||
|  | ||||
|     const parentNote = await froca.getNote(branch.parentNoteId); | ||||
|  | ||||
|     if (parentNote.type === 'search') { | ||||
|         return; | ||||
|     } | ||||
|  | ||||
|     utils.openDialog($dialog); | ||||
|  | ||||
|     $treePrefixInput.val(branch.prefix); | ||||
|  | ||||
|     const noteTitle = await treeService.getNoteTitle(noteId); | ||||
|  | ||||
|     $noteTitle.text(" - " + noteTitle); | ||||
| } | ||||
|  | ||||
| async function savePrefix() { | ||||
|     const prefix = $treePrefixInput.val(); | ||||
|  | ||||
|     await server.put('branches/' + branchId + '/set-prefix', { prefix: prefix }); | ||||
|  | ||||
|     $dialog.modal('hide'); | ||||
|  | ||||
|     toastService.showMessage("Branch prefix has been saved."); | ||||
| } | ||||
|  | ||||
| $form.on('submit', () => { | ||||
|     savePrefix(); | ||||
|  | ||||
|     return false; | ||||
| }); | ||||
|  | ||||
| $dialog.on('shown.bs.modal', () => $treePrefixInput.trigger('focus')); | ||||
| @@ -1,73 +0,0 @@ | ||||
| import noteAutocompleteService from "../services/note_autocomplete.js"; | ||||
| import utils from "../services/utils.js"; | ||||
| import treeService from "../services/tree.js"; | ||||
| import toastService from "../services/toast.js"; | ||||
| import froca from "../services/froca.js"; | ||||
| import branchService from "../services/branches.js"; | ||||
| import appContext from "../services/app_context.js"; | ||||
|  | ||||
| const $dialog = $("#clone-to-dialog"); | ||||
| const $form = $("#clone-to-form"); | ||||
| const $noteAutoComplete = $("#clone-to-note-autocomplete"); | ||||
| const $clonePrefix = $("#clone-prefix"); | ||||
| const $noteList = $("#clone-to-note-list"); | ||||
|  | ||||
| let clonedNoteIds; | ||||
|  | ||||
| export async function showDialog(noteIds) { | ||||
|     if (!noteIds || noteIds.length === 0) { | ||||
|         noteIds = [ appContext.tabManager.getActiveContextNoteId() ]; | ||||
|     } | ||||
|  | ||||
|     clonedNoteIds = []; | ||||
|  | ||||
|     for (const noteId of noteIds) { | ||||
|         if (!clonedNoteIds.includes(noteId)) { | ||||
|             clonedNoteIds.push(noteId); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     utils.openDialog($dialog); | ||||
|  | ||||
|     $noteAutoComplete.val('').trigger('focus'); | ||||
|  | ||||
|     $noteList.empty(); | ||||
|  | ||||
|     for (const noteId of clonedNoteIds) { | ||||
|         const note = await froca.getNote(noteId); | ||||
|  | ||||
|         $noteList.append($("<li>").text(note.title)); | ||||
|     } | ||||
|  | ||||
|     noteAutocompleteService.initNoteAutocomplete($noteAutoComplete); | ||||
|     noteAutocompleteService.showRecentNotes($noteAutoComplete); | ||||
| } | ||||
|  | ||||
| async function cloneNotesTo(notePath) { | ||||
|     const {noteId, parentNoteId} = treeService.getNoteIdAndParentIdFromNotePath(notePath); | ||||
|     const targetBranchId = await froca.getBranchId(parentNoteId, noteId); | ||||
|  | ||||
|     for (const cloneNoteId of clonedNoteIds) { | ||||
|         await branchService.cloneNoteToBranch(cloneNoteId, targetBranchId, $clonePrefix.val()); | ||||
|  | ||||
|         const clonedNote = await froca.getNote(cloneNoteId); | ||||
|         const targetNote = await froca.getBranch(targetBranchId).getNote(); | ||||
|  | ||||
|         toastService.showMessage(`Note "${clonedNote.title}" has been cloned into ${targetNote.title}`); | ||||
|     } | ||||
| } | ||||
|  | ||||
| $form.on('submit', () => { | ||||
|     const notePath = $noteAutoComplete.getSelectedNotePath(); | ||||
|  | ||||
|     if (notePath) { | ||||
|         $dialog.modal('hide'); | ||||
|  | ||||
|         cloneNotesTo(notePath); | ||||
|     } | ||||
|     else { | ||||
|         logError("No path to clone to."); | ||||
|     } | ||||
|  | ||||
|     return false; | ||||
| }); | ||||
| @@ -1,80 +0,0 @@ | ||||
| const $dialog = $("#confirm-dialog"); | ||||
| const $confirmContent = $("#confirm-dialog-content"); | ||||
| const $okButton = $("#confirm-dialog-ok-button"); | ||||
| const $cancelButton = $("#confirm-dialog-cancel-button"); | ||||
| const $custom = $("#confirm-dialog-custom"); | ||||
|  | ||||
| const DELETE_NOTE_BUTTON_ID = "confirm-dialog-delete-note"; | ||||
|  | ||||
| let resolve; | ||||
| let $originallyFocused; // element focused before the dialog was opened so we can return to it afterwards | ||||
|  | ||||
| export function confirm(message) { | ||||
|     $originallyFocused = $(':focus'); | ||||
|  | ||||
|     $custom.hide(); | ||||
|  | ||||
|     glob.activeDialog = $dialog; | ||||
|  | ||||
|     if (typeof message === 'string') { | ||||
|         message = $("<div>").text(message); | ||||
|     } | ||||
|  | ||||
|     $confirmContent.empty().append(message); | ||||
|  | ||||
|     $dialog.modal(); | ||||
|  | ||||
|     return new Promise((res, rej) => { resolve = res; }); | ||||
| } | ||||
|  | ||||
| export function confirmDeleteNoteBoxWithNote(title) { | ||||
|     glob.activeDialog = $dialog; | ||||
|  | ||||
|     $confirmContent.text(`Are you sure you want to remove the note "${title}" from relation map?`); | ||||
|  | ||||
|     $custom.empty() | ||||
|         .append("<br/>") | ||||
|         .append($("<div>").addClass("form-check") | ||||
|             .append($("<input>") | ||||
|                 .attr("id", DELETE_NOTE_BUTTON_ID) | ||||
|                 .attr("type", "checkbox") | ||||
|                 .addClass("form-check-input")) | ||||
|             .append($("<label>") | ||||
|                 .attr("for", DELETE_NOTE_BUTTON_ID) | ||||
|                 .addClass("form-check-label") | ||||
|                 .attr("style", "text-decoration: underline dotted black") | ||||
|                 .attr("title", "If you don't check this, note will be only removed from relation map, but will stay as a note.") | ||||
|                 .html("Also delete note"))); | ||||
|     $custom.show(); | ||||
|  | ||||
|     $dialog.modal(); | ||||
|  | ||||
|     return new Promise((res, rej) => { resolve = res; }); | ||||
| } | ||||
|  | ||||
| export function isDeleteNoteChecked() { | ||||
|     return $("#" + DELETE_NOTE_BUTTON_ID + ":checked").length > 0; | ||||
| } | ||||
|  | ||||
| $dialog.on('shown.bs.modal', () => $okButton.trigger("focus")); | ||||
|  | ||||
| $dialog.on("hidden.bs.modal", () => { | ||||
|     if (resolve) { | ||||
|         resolve(false); | ||||
|     } | ||||
|  | ||||
|     if ($originallyFocused) { | ||||
|         $originallyFocused.trigger('focus'); | ||||
|         $originallyFocused = null; | ||||
|     } | ||||
| }); | ||||
|  | ||||
| function doResolve(ret) { | ||||
|     resolve(ret); | ||||
|     resolve = null; | ||||
|  | ||||
|     $dialog.modal("hide"); | ||||
| } | ||||
|  | ||||
| $cancelButton.on('click', () => doResolve(false)); | ||||
| $okButton.on('click', () => doResolve(true)); | ||||
| @@ -1,99 +0,0 @@ | ||||
| import server from "../services/server.js"; | ||||
| import froca from "../services/froca.js"; | ||||
| import linkService from "../services/link.js"; | ||||
| import utils from "../services/utils.js"; | ||||
|  | ||||
| const $dialog = $("#delete-notes-dialog"); | ||||
| const $okButton = $("#delete-notes-dialog-ok-button"); | ||||
| const $cancelButton = $("#delete-notes-dialog-cancel-button"); | ||||
| const $deleteNotesList = $("#delete-notes-list"); | ||||
| const $brokenRelationsList = $("#broken-relations-list"); | ||||
| const $deletedNotesCount = $("#deleted-notes-count"); | ||||
| const $noNoteToDeleteWrapper = $("#no-note-to-delete-wrapper"); | ||||
| const $deleteNotesListWrapper = $("#delete-notes-list-wrapper"); | ||||
| const $brokenRelationsListWrapper = $("#broken-relations-wrapper"); | ||||
| const $brokenRelationsCount = $("#broke-relations-count"); | ||||
| const $deleteAllClones = $("#delete-all-clones"); | ||||
| const $eraseNotes = $("#erase-notes"); | ||||
|  | ||||
| let branchIds = null; | ||||
| let resolve = null; | ||||
|  | ||||
| async function renderDeletePreview() { | ||||
|     const response = await server.post('delete-notes-preview', { | ||||
|         branchIdsToDelete: branchIds, | ||||
|         deleteAllClones: isDeleteAllClonesChecked() | ||||
|     }); | ||||
|  | ||||
|     $deleteNotesList.empty(); | ||||
|     $brokenRelationsList.empty(); | ||||
|  | ||||
|     $deleteNotesListWrapper.toggle(response.noteIdsToBeDeleted.length > 0); | ||||
|     $noNoteToDeleteWrapper.toggle(response.noteIdsToBeDeleted.length === 0); | ||||
|  | ||||
|     for (const note of await froca.getNotes(response.noteIdsToBeDeleted)) { | ||||
|         $deleteNotesList.append( | ||||
|             $("<li>").append( | ||||
|                 await linkService.createNoteLink(note.noteId, {showNotePath: true}) | ||||
|             ) | ||||
|         ); | ||||
|     } | ||||
|  | ||||
|     $deletedNotesCount.text(response.noteIdsToBeDeleted.length); | ||||
|  | ||||
|     $brokenRelationsListWrapper.toggle(response.brokenRelations.length > 0); | ||||
|     $brokenRelationsCount.text(response.brokenRelations.length); | ||||
|  | ||||
|     await froca.getNotes(response.brokenRelations.map(br => br.noteId)); | ||||
|  | ||||
|     for (const attr of response.brokenRelations) { | ||||
|         $brokenRelationsList.append( | ||||
|             $("<li>") | ||||
|                 .append(`Note `) | ||||
|                 .append(await linkService.createNoteLink(attr.value)) | ||||
|                 .append(` (to be deleted) is referenced by relation <code>${attr.name}</code> originating from `) | ||||
|                 .append(await linkService.createNoteLink(attr.noteId)) | ||||
|         ); | ||||
|     } | ||||
| } | ||||
|  | ||||
| export async function showDialog(branchIdsToDelete) { | ||||
|     branchIds = branchIdsToDelete; | ||||
|  | ||||
|     await renderDeletePreview(); | ||||
|  | ||||
|     utils.openDialog($dialog); | ||||
|  | ||||
|     $deleteAllClones.prop("checked", false); | ||||
|     $eraseNotes.prop("checked", false); | ||||
|  | ||||
|     return new Promise((res, rej) => resolve = res); | ||||
| } | ||||
|  | ||||
| export function isDeleteAllClonesChecked() { | ||||
|     return $deleteAllClones.is(":checked"); | ||||
| } | ||||
|  | ||||
| export function isEraseNotesChecked() { | ||||
|     return $eraseNotes.is(":checked"); | ||||
| } | ||||
|  | ||||
| $dialog.on('shown.bs.modal', () => $okButton.trigger("focus")); | ||||
|  | ||||
| $cancelButton.on('click', () => { | ||||
|     utils.closeActiveDialog(); | ||||
|  | ||||
|     resolve({proceed: false}); | ||||
| }); | ||||
|  | ||||
| $okButton.on('click', () => { | ||||
|     utils.closeActiveDialog(); | ||||
|  | ||||
|     resolve({ | ||||
|         proceed: true, | ||||
|         deleteAllClones: isDeleteAllClonesChecked(), | ||||
|         eraseNotes: isEraseNotesChecked() | ||||
|     }); | ||||
| }); | ||||
|  | ||||
| $deleteAllClones.on('click', () => renderDeletePreview()); | ||||
| @@ -1,137 +0,0 @@ | ||||
| import treeService from "../services/tree.js"; | ||||
| import utils from "../services/utils.js"; | ||||
| import ws from "../services/ws.js"; | ||||
| import toastService from "../services/toast.js"; | ||||
| import froca from "../services/froca.js"; | ||||
| import openService from "../services/open.js"; | ||||
|  | ||||
| const $dialog = $("#export-dialog"); | ||||
| const $form = $("#export-form"); | ||||
| const $noteTitle = $dialog.find(".export-note-title"); | ||||
| const $subtreeFormats = $("#export-subtree-formats"); | ||||
| const $singleFormats = $("#export-single-formats"); | ||||
| const $subtreeType = $("#export-type-subtree"); | ||||
| const $singleType = $("#export-type-single"); | ||||
| const $exportButton = $("#export-button"); | ||||
| const $opmlVersions = $("#opml-versions"); | ||||
|  | ||||
| let taskId = ''; | ||||
| let branchId = null; | ||||
|  | ||||
| export async function showDialog(notePath, defaultType) { | ||||
|     // each opening of the dialog resets the taskId so we don't associate it with previous exports anymore | ||||
|     taskId = ''; | ||||
|     $exportButton.removeAttr("disabled"); | ||||
|  | ||||
|     if (defaultType === 'subtree') { | ||||
|         $subtreeType.prop("checked", true).trigger('change'); | ||||
|  | ||||
|         // to show/hide OPML versions | ||||
|         $("input[name=export-subtree-format]:checked").trigger('change'); | ||||
|     } | ||||
|     else if (defaultType === 'single') { | ||||
|         $singleType.prop("checked", true).trigger('change'); | ||||
|     } | ||||
|     else { | ||||
|         throw new Error("Unrecognized type " + defaultType); | ||||
|     } | ||||
|  | ||||
|     $("#opml-v2").prop("checked", true); // setting default | ||||
|  | ||||
|     utils.openDialog($dialog); | ||||
|  | ||||
|     const {noteId, parentNoteId} = treeService.getNoteIdAndParentIdFromNotePath(notePath); | ||||
|  | ||||
|     branchId = await froca.getBranchId(parentNoteId, noteId); | ||||
|  | ||||
|     const noteTitle = await treeService.getNoteTitle(noteId); | ||||
|  | ||||
|     $noteTitle.html(noteTitle); | ||||
| } | ||||
|  | ||||
| $form.on('submit', () => { | ||||
|     $dialog.modal('hide'); | ||||
|  | ||||
|     const exportType = $dialog.find("input[name='export-type']:checked").val(); | ||||
|  | ||||
|     if (!exportType) { | ||||
|         // this shouldn't happen as we always choose default export type | ||||
|         alert("Choose export type first please"); | ||||
|         return; | ||||
|     } | ||||
|  | ||||
|     const exportFormat = exportType === 'subtree' | ||||
|         ? $("input[name=export-subtree-format]:checked").val() | ||||
|         : $("input[name=export-single-format]:checked").val(); | ||||
|  | ||||
|     const exportVersion = exportFormat === 'opml' ? $dialog.find("input[name='opml-version']:checked").val() : "1.0"; | ||||
|  | ||||
|     exportBranch(branchId, exportType, exportFormat, exportVersion); | ||||
|  | ||||
|     return false; | ||||
| }); | ||||
|  | ||||
| function exportBranch(branchId, type, format, version) { | ||||
|     taskId = utils.randomString(10); | ||||
|  | ||||
|     const url = openService.getUrlForDownload(`api/notes/${branchId}/export/${type}/${format}/${version}/${taskId}`); | ||||
|  | ||||
|     openService.download(url); | ||||
| } | ||||
|  | ||||
| $('input[name=export-type]').on('change', function () { | ||||
|     if (this.value === 'subtree') { | ||||
|         if ($("input[name=export-subtree-format]:checked").length === 0) { | ||||
|             $("input[name=export-subtree-format]:first").prop("checked", true); | ||||
|         } | ||||
|  | ||||
|         $subtreeFormats.slideDown(); | ||||
|         $singleFormats.slideUp(); | ||||
|     } | ||||
|     else { | ||||
|         if ($("input[name=export-single-format]:checked").length === 0) { | ||||
|             $("input[name=export-single-format]:first").prop("checked", true); | ||||
|         } | ||||
|  | ||||
|         $subtreeFormats.slideUp(); | ||||
|         $singleFormats.slideDown(); | ||||
|     } | ||||
| }); | ||||
|  | ||||
| $('input[name=export-subtree-format]').on('change', function () { | ||||
|     if (this.value === 'opml') { | ||||
|         $opmlVersions.slideDown(); | ||||
|     } | ||||
|     else { | ||||
|         $opmlVersions.slideUp(); | ||||
|     } | ||||
| }); | ||||
|  | ||||
| function makeToast(id, message) { | ||||
|     return { | ||||
|         id: id, | ||||
|         title: "Export status", | ||||
|         message: message, | ||||
|         icon: "arrow-square-up-right" | ||||
|     }; | ||||
| } | ||||
|  | ||||
| ws.subscribeToMessages(async message => { | ||||
|     if (message.taskType !== 'export') { | ||||
|         return; | ||||
|     } | ||||
|  | ||||
|     if (message.type === 'taskError') { | ||||
|         toastService.closePersistent(message.taskId); | ||||
|         toastService.showError(message.message); | ||||
|     } | ||||
|     else if (message.type === 'taskProgressCount') { | ||||
|         toastService.showPersistent(makeToast(message.taskId, "Export in progress: " + message.progressCount)); | ||||
|     } | ||||
|     else if (message.type === 'taskSucceeded') { | ||||
|         const toast = makeToast(message.taskId, "Export finished successfully."); | ||||
|         toast.closeAfter = 5000; | ||||
|  | ||||
|         toastService.showPersistent(toast); | ||||
|     } | ||||
| }); | ||||
| @@ -1,7 +0,0 @@ | ||||
| import utils from "../services/utils.js"; | ||||
|  | ||||
| const $dialog = $("#help-dialog"); | ||||
|  | ||||
| export async function showDialog() { | ||||
|     utils.openDialog($dialog); | ||||
| } | ||||
| @@ -1,76 +0,0 @@ | ||||
| import utils from '../services/utils.js'; | ||||
| import treeService from "../services/tree.js"; | ||||
| import importService from "../services/import.js"; | ||||
| import options from "../services/options.js"; | ||||
|  | ||||
| const $dialog = $("#import-dialog"); | ||||
| const $form = $("#import-form"); | ||||
| const $noteTitle = $dialog.find(".import-note-title"); | ||||
| const $fileUploadInput = $("#import-file-upload-input"); | ||||
| const $importButton = $("#import-button"); | ||||
| const $safeImportCheckbox = $("#safe-import-checkbox"); | ||||
| const $shrinkImagesWrapper = $("shrink-images-wrapper"); | ||||
| const $shrinkImagesCheckbox = $("#shrink-images-checkbox"); | ||||
| const $textImportedAsTextCheckbox = $("#text-imported-as-text-checkbox"); | ||||
| const $codeImportedAsCodeCheckbox = $("#code-imported-as-code-checkbox"); | ||||
| const $explodeArchivesCheckbox = $("#explode-archives-checkbox"); | ||||
| const $replaceUnderscoresWithSpacesCheckbox = $("#replace-underscores-with-spaces-checkbox"); | ||||
| const $csrf = $("#import-csrf"); | ||||
|  | ||||
| let parentNoteId = null; | ||||
|  | ||||
| export async function showDialog(noteId) { | ||||
|     $fileUploadInput.val('').trigger('change'); // to trigger Import button disabling listener below | ||||
|  | ||||
|     $safeImportCheckbox.prop("checked", true); | ||||
|     $shrinkImagesCheckbox.prop("checked", options.is('compressImages')); | ||||
|     $textImportedAsTextCheckbox.prop("checked", true); | ||||
|     $codeImportedAsCodeCheckbox.prop("checked", true); | ||||
|     $explodeArchivesCheckbox.prop("checked", true); | ||||
|     $replaceUnderscoresWithSpacesCheckbox.prop("checked", true); | ||||
|  | ||||
|     parentNoteId = noteId; | ||||
|  | ||||
|     $noteTitle.text(await treeService.getNoteTitle(parentNoteId)); | ||||
|  | ||||
|     utils.openDialog($dialog); | ||||
| } | ||||
|  | ||||
| $form.on('submit', () => { | ||||
|     // disabling so that import is not triggered again. | ||||
|     $importButton.attr("disabled", "disabled"); | ||||
|  | ||||
|     importIntoNote(parentNoteId); | ||||
|  | ||||
|     return false; | ||||
| }); | ||||
|  | ||||
| async function importIntoNote(parentNoteId) { | ||||
|     const files = Array.from($fileUploadInput[0].files); // shallow copy since we're resetting the upload button below | ||||
|  | ||||
|     const options = { | ||||
|         safeImport: boolToString($safeImportCheckbox), | ||||
|         shrinkImages: boolToString($shrinkImagesCheckbox), | ||||
|         textImportedAsText: boolToString($textImportedAsTextCheckbox), | ||||
|         codeImportedAsCode: boolToString($codeImportedAsCodeCheckbox), | ||||
|         explodeArchives: boolToString($explodeArchivesCheckbox), | ||||
|         replaceUnderscoresWithSpaces: boolToString($replaceUnderscoresWithSpacesCheckbox) | ||||
|     }; | ||||
|  | ||||
|     $dialog.modal('hide'); | ||||
|  | ||||
|     await importService.uploadFiles(parentNoteId, files, options); | ||||
| } | ||||
|  | ||||
| function boolToString($el) { | ||||
|     return $el.is(":checked") ? "true" : "false"; | ||||
| } | ||||
|  | ||||
| $fileUploadInput.on('change', () => { | ||||
|     if ($fileUploadInput.val()) { | ||||
|         $importButton.removeAttr("disabled"); | ||||
|     } | ||||
|     else { | ||||
|         $importButton.attr("disabled", "disabled"); | ||||
|     } | ||||
| }); | ||||
| @@ -1,56 +0,0 @@ | ||||
| import treeService from '../services/tree.js'; | ||||
| import noteAutocompleteService from '../services/note_autocomplete.js'; | ||||
| import utils from "../services/utils.js"; | ||||
| import froca from "../services/froca.js"; | ||||
|  | ||||
| const $dialog = $("#include-note-dialog"); | ||||
| const $form = $("#include-note-form"); | ||||
| const $autoComplete = $("#include-note-autocomplete"); | ||||
|  | ||||
| /** @var TextTypeWidget */ | ||||
| let textTypeWidget; | ||||
|  | ||||
| export async function showDialog(widget) { | ||||
|     textTypeWidget = widget; | ||||
|  | ||||
|     $autoComplete.val(''); | ||||
|  | ||||
|     utils.openDialog($dialog); | ||||
|  | ||||
|     noteAutocompleteService.initNoteAutocomplete($autoComplete, { | ||||
|         hideGoToSelectedNoteButton: true, | ||||
|         allowCreatingNotes: true | ||||
|     }); | ||||
|     noteAutocompleteService.showRecentNotes($autoComplete); | ||||
| } | ||||
|  | ||||
| async function includeNote(notePath) { | ||||
|     const noteId = treeService.getNoteIdFromNotePath(notePath); | ||||
|     const note = await froca.getNote(noteId); | ||||
|  | ||||
|     const boxSize = $("input[name='include-note-box-size']:checked").val(); | ||||
|  | ||||
|     if (note.type === 'image') { | ||||
|         // there's no benefit to use insert note functionlity for images | ||||
|         // so we'll just add an IMG tag | ||||
|         textTypeWidget.addImage(noteId); | ||||
|     } | ||||
|     else { | ||||
|         textTypeWidget.addIncludeNote(noteId, boxSize); | ||||
|     } | ||||
| } | ||||
|  | ||||
| $form.on('submit', () => { | ||||
|     const notePath = $autoComplete.getSelectedNotePath(); | ||||
|  | ||||
|     if (notePath) { | ||||
|         $dialog.modal('hide'); | ||||
|  | ||||
|         includeNote(notePath); | ||||
|     } | ||||
|     else { | ||||
|         logError("No noteId to include."); | ||||
|     } | ||||
|  | ||||
|     return false; | ||||
| }); | ||||
| @@ -1,33 +0,0 @@ | ||||
| import utils from "../services/utils.js"; | ||||
|  | ||||
| const $dialog = $("#info-dialog"); | ||||
| const $infoContent = $("#info-dialog-content"); | ||||
| const $okButton = $("#info-dialog-ok-button"); | ||||
|  | ||||
| let resolve; | ||||
| let $originallyFocused; // element focused before the dialog was opened so we can return to it afterwards | ||||
|  | ||||
| export function info(message) { | ||||
|     $originallyFocused = $(':focus'); | ||||
|  | ||||
|     $infoContent.text(message); | ||||
|  | ||||
|     utils.openDialog($dialog); | ||||
|  | ||||
|     return new Promise((res, rej) => { resolve = res; }); | ||||
| } | ||||
|  | ||||
| $dialog.on('shown.bs.modal', () => $okButton.trigger("focus")); | ||||
|  | ||||
| $dialog.on("hidden.bs.modal", () => { | ||||
|     if (resolve) { | ||||
|         resolve(); | ||||
|     } | ||||
|  | ||||
|     if ($originallyFocused) { | ||||
|         $originallyFocused.trigger('focus'); | ||||
|         $originallyFocused = null; | ||||
|     } | ||||
| }); | ||||
|  | ||||
| $okButton.on('click', () => $dialog.modal("hide")); | ||||
| @@ -1,60 +0,0 @@ | ||||
| import noteAutocompleteService from '../services/note_autocomplete.js'; | ||||
| import utils from "../services/utils.js"; | ||||
| import appContext from "../services/app_context.js"; | ||||
|  | ||||
| const $dialog = $("#jump-to-note-dialog"); | ||||
| const $autoComplete = $("#jump-to-note-autocomplete"); | ||||
| const $showInFullTextButton = $("#show-in-full-text-button"); | ||||
|  | ||||
| let lastOpenedTs = 0; | ||||
| const KEEP_LAST_SEARCH_FOR_X_SECONDS = 120; | ||||
|  | ||||
| export async function showDialog() { | ||||
|     utils.openDialog($dialog); | ||||
|  | ||||
|     noteAutocompleteService.initNoteAutocomplete($autoComplete, { hideGoToSelectedNoteButton: true }) | ||||
|         // clear any event listener added in previous invocation of this function | ||||
|         .off('autocomplete:noteselected') | ||||
|         .on('autocomplete:noteselected', function(event, suggestion, dataset) { | ||||
|             if (!suggestion.notePath) { | ||||
|                 return false; | ||||
|             } | ||||
|  | ||||
|             appContext.tabManager.getActiveContext().setNote(suggestion.notePath); | ||||
|         }); | ||||
|  | ||||
|     // if you open the Jump To dialog soon after using it previously it can often mean that you | ||||
|     // actually want to search for the same thing (e.g. you opened the wrong note at first try) | ||||
|     // so we'll keep the content. | ||||
|     // if it's outside of this time limit then we assume it's a completely new search and show recent notes instead. | ||||
|     if (Date.now() - lastOpenedTs > KEEP_LAST_SEARCH_FOR_X_SECONDS * 1000) { | ||||
|         noteAutocompleteService.showRecentNotes($autoComplete); | ||||
|     } | ||||
|     else { | ||||
|         $autoComplete | ||||
|             // hack, the actual search value is stored in <pre> element next to the search input | ||||
|             // this is important because the search input value is replaced with the suggestion note's title | ||||
|             .autocomplete("val", $autoComplete.next().text()) | ||||
|             .trigger('focus') | ||||
|             .trigger('select'); | ||||
|     } | ||||
|  | ||||
|     lastOpenedTs = Date.now(); | ||||
| } | ||||
|  | ||||
| function showInFullText(e) { | ||||
|     // stop from propagating upwards (dangerous especially with ctrl+enter executable javascript notes) | ||||
|     e.preventDefault(); | ||||
|     e.stopPropagation(); | ||||
|  | ||||
|     const searchString = $autoComplete.val(); | ||||
|  | ||||
|     appContext.triggerCommand('searchNotes', {searchString}); | ||||
|  | ||||
|     $dialog.modal('hide'); | ||||
| } | ||||
|  | ||||
|  | ||||
| $showInFullTextButton.on('click', showInFullText); | ||||
|  | ||||
| utils.bindElShortcut($dialog, 'ctrl+return', showInFullText); | ||||
| @@ -1,61 +0,0 @@ | ||||
| import libraryLoader from "../services/library_loader.js"; | ||||
| import toastService from "../services/toast.js"; | ||||
| import utils from "../services/utils.js"; | ||||
| import appContext from "../services/app_context.js"; | ||||
|  | ||||
| const $dialog = $('#markdown-import-dialog'); | ||||
| const $importTextarea = $('#markdown-import-textarea'); | ||||
| const $importButton = $('#markdown-import-button'); | ||||
|  | ||||
| async function convertMarkdownToHtml(text) { | ||||
|     await libraryLoader.requireLibrary(libraryLoader.COMMONMARK); | ||||
|  | ||||
|     const reader = new commonmark.Parser(); | ||||
|     const writer = new commonmark.HtmlRenderer(); | ||||
|     const parsed = reader.parse(text); | ||||
|  | ||||
|     const result = writer.render(parsed); | ||||
|  | ||||
|     appContext.triggerCommand('executeInActiveEditor', { | ||||
|         callback: textEditor => { | ||||
|             const viewFragment = textEditor.data.processor.toView(result); | ||||
|             const modelFragment = textEditor.data.toModel(viewFragment); | ||||
|  | ||||
|             textEditor.model.insertContent(modelFragment, textEditor.model.document.selection); | ||||
|  | ||||
|             toastService.showMessage("Markdown content has been imported into the document."); | ||||
|         } | ||||
|     }); | ||||
| } | ||||
|  | ||||
| export async function importMarkdownInline() { | ||||
|     if (appContext.tabManager.getActiveContextNoteType() !== 'text') { | ||||
|         return; | ||||
|     } | ||||
|  | ||||
|     if (utils.isElectron()) { | ||||
|         const {clipboard} = utils.dynamicRequire('electron'); | ||||
|         const text = clipboard.readText(); | ||||
|  | ||||
|         convertMarkdownToHtml(text); | ||||
|     } | ||||
|     else { | ||||
|         utils.openDialog($dialog); | ||||
|     } | ||||
| } | ||||
|  | ||||
| async function sendForm() { | ||||
|     const text = $importTextarea.val(); | ||||
|  | ||||
|     $dialog.modal('hide'); | ||||
|  | ||||
|     await convertMarkdownToHtml(text); | ||||
|  | ||||
|     $importTextarea.val(''); | ||||
| } | ||||
|  | ||||
| $importButton.on('click', sendForm); | ||||
|  | ||||
| $dialog.on('shown.bs.modal', () => $importTextarea.trigger('focus')); | ||||
|  | ||||
| utils.bindElShortcut($dialog, 'ctrl+return', sendForm); | ||||
| @@ -1,58 +0,0 @@ | ||||
| import noteAutocompleteService from "../services/note_autocomplete.js"; | ||||
| import utils from "../services/utils.js"; | ||||
| import toastService from "../services/toast.js"; | ||||
| import froca from "../services/froca.js"; | ||||
| import branchService from "../services/branches.js"; | ||||
| import treeService from "../services/tree.js"; | ||||
|  | ||||
| const $dialog = $("#move-to-dialog"); | ||||
| const $form = $("#move-to-form"); | ||||
| const $noteAutoComplete = $("#move-to-note-autocomplete"); | ||||
| const $noteList = $("#move-to-note-list"); | ||||
|  | ||||
| let movedBranchIds; | ||||
|  | ||||
| export async function showDialog(branchIds) { | ||||
|     movedBranchIds = branchIds; | ||||
|  | ||||
|     utils.openDialog($dialog); | ||||
|  | ||||
|     $noteAutoComplete.val('').trigger('focus'); | ||||
|  | ||||
|     $noteList.empty(); | ||||
|  | ||||
|     for (const branchId of movedBranchIds) { | ||||
|         const branch = froca.getBranch(branchId); | ||||
|         const note = await froca.getNote(branch.noteId); | ||||
|  | ||||
|         $noteList.append($("<li>").text(note.title)); | ||||
|     } | ||||
|  | ||||
|     noteAutocompleteService.initNoteAutocomplete($noteAutoComplete); | ||||
|     noteAutocompleteService.showRecentNotes($noteAutoComplete); | ||||
| } | ||||
|  | ||||
| async function moveNotesTo(parentBranchId) { | ||||
|     await branchService.moveToParentNote(movedBranchIds, parentBranchId); | ||||
|  | ||||
|     const parentBranch = froca.getBranch(parentBranchId); | ||||
|     const parentNote = await parentBranch.getNote(); | ||||
|  | ||||
|     toastService.showMessage(`Selected notes have been moved into ${parentNote.title}`); | ||||
| } | ||||
|  | ||||
| $form.on('submit', () => { | ||||
|     const notePath = $noteAutoComplete.getSelectedNotePath(); | ||||
|  | ||||
|     if (notePath) { | ||||
|         $dialog.modal('hide'); | ||||
|  | ||||
|         const {noteId, parentNoteId} = treeService.getNoteIdAndParentIdFromNotePath(notePath); | ||||
|         froca.getBranchId(parentNoteId, noteId).then(branchId => moveNotesTo(branchId)); | ||||
|     } | ||||
|     else { | ||||
|         logError("No path to move to."); | ||||
|     } | ||||
|  | ||||
|     return false; | ||||
| }); | ||||
| @@ -1,203 +0,0 @@ | ||||
| import utils from '../services/utils.js'; | ||||
| import server from '../services/server.js'; | ||||
| import toastService from "../services/toast.js"; | ||||
| import appContext from "../services/app_context.js"; | ||||
| import libraryLoader from "../services/library_loader.js"; | ||||
| import openService from "../services/open.js"; | ||||
|  | ||||
| const $dialog = $("#note-revisions-dialog"); | ||||
| const $list = $("#note-revision-list"); | ||||
| const $listDropdown = $("#note-revision-list-dropdown"); | ||||
| const $content = $("#note-revision-content"); | ||||
| const $title = $("#note-revision-title"); | ||||
| const $titleButtons = $("#note-revision-title-buttons"); | ||||
| const $eraseAllRevisionsButton = $("#note-revisions-erase-all-revisions-button"); | ||||
|  | ||||
| $listDropdown.dropdown(); | ||||
|  | ||||
| $listDropdown.parent().on('hide.bs.dropdown', e => { | ||||
|     // prevent closing dropdown by clicking outside | ||||
|     if (e.clickEvent) { | ||||
|         e.preventDefault(); | ||||
|     } | ||||
| }); | ||||
|  | ||||
| let revisionItems = []; | ||||
| let note; | ||||
| let noteRevisionId; | ||||
|  | ||||
| export async function showCurrentNoteRevisions() { | ||||
|     await showNoteRevisionsDialog(appContext.tabManager.getActiveContextNoteId()); | ||||
| } | ||||
|  | ||||
| export async function showNoteRevisionsDialog(noteId, noteRevisionId) { | ||||
|     utils.openDialog($dialog); | ||||
|  | ||||
|     await loadNoteRevisions(noteId, noteRevisionId); | ||||
| } | ||||
|  | ||||
| async function loadNoteRevisions(noteId, noteRevId) { | ||||
|     $list.empty(); | ||||
|     $content.empty(); | ||||
|     $titleButtons.empty(); | ||||
|  | ||||
|     note = appContext.tabManager.getActiveContextNote(); | ||||
|     revisionItems = await server.get(`notes/${noteId}/revisions`); | ||||
|  | ||||
|     for (const item of revisionItems) { | ||||
|         $list.append( | ||||
|             $('<a class="dropdown-item" tabindex="0">') | ||||
|                 .text(item.dateLastEdited.substr(0, 16) + ` (${item.contentLength} bytes)`) | ||||
|                 .attr('data-note-revision-id', item.noteRevisionId) | ||||
|                 .attr('title', 'This revision was last edited on ' + item.dateLastEdited) | ||||
|         ); | ||||
|     } | ||||
|  | ||||
|     $listDropdown.dropdown('show'); | ||||
|  | ||||
|     noteRevisionId = noteRevId; | ||||
|  | ||||
|     if (revisionItems.length > 0) { | ||||
|         if (!noteRevisionId) { | ||||
|             noteRevisionId = revisionItems[0].noteRevisionId; | ||||
|         } | ||||
|     } else { | ||||
|         $title.text("No revisions for this note yet..."); | ||||
|         noteRevisionId = null; | ||||
|     } | ||||
|  | ||||
|     $eraseAllRevisionsButton.toggle(revisionItems.length > 0); | ||||
| } | ||||
|  | ||||
| $dialog.on('shown.bs.modal', () => { | ||||
|     $list.find(`[data-note-revision-id="${noteRevisionId}"]`) | ||||
|         .trigger('focus'); | ||||
| }); | ||||
|  | ||||
| async function setContentPane() { | ||||
|     const noteRevisionId = $list.find(".active").attr('data-note-revision-id'); | ||||
|  | ||||
|     const revisionItem = revisionItems.find(r => r.noteRevisionId === noteRevisionId); | ||||
|  | ||||
|     $titleButtons.empty(); | ||||
|     $content.empty(); | ||||
|  | ||||
|     $title.html(revisionItem.title); | ||||
|  | ||||
|     const $restoreRevisionButton = $('<button class="btn btn-sm" type="button">Restore this revision</button>'); | ||||
|  | ||||
|     $restoreRevisionButton.on('click', async () => { | ||||
|         const confirmDialog = await import('../dialogs/confirm.js'); | ||||
|         const text = 'Do you want to restore this revision? This will overwrite current title/content of the note with this revision.'; | ||||
|  | ||||
|         if (await confirmDialog.confirm(text)) { | ||||
|             await server.put(`notes/${revisionItem.noteId}/restore-revision/${revisionItem.noteRevisionId}`); | ||||
|  | ||||
|             $dialog.modal('hide'); | ||||
|  | ||||
|             toastService.showMessage('Note revision has been restored.'); | ||||
|         } | ||||
|     }); | ||||
|  | ||||
|     const $eraseRevisionButton = $('<button class="btn btn-sm" type="button">Delete this revision</button>'); | ||||
|  | ||||
|     $eraseRevisionButton.on('click', async () => { | ||||
|         const confirmDialog = await import('../dialogs/confirm.js'); | ||||
|         const text = 'Do you want to delete this revision? This action will delete revision title and content, but still preserve revision metadata.'; | ||||
|  | ||||
|         if (await confirmDialog.confirm(text)) { | ||||
|             await server.remove(`notes/${revisionItem.noteId}/revisions/${revisionItem.noteRevisionId}`); | ||||
|  | ||||
|             loadNoteRevisions(revisionItem.noteId); | ||||
|  | ||||
|             toastService.showMessage('Note revision has been deleted.'); | ||||
|         } | ||||
|     }); | ||||
|  | ||||
|     $titleButtons | ||||
|         .append($restoreRevisionButton) | ||||
|         .append('   ') | ||||
|         .append($eraseRevisionButton) | ||||
|         .append('   '); | ||||
|  | ||||
|     const $downloadButton = $('<button class="btn btn-sm btn-primary" type="button">Download</button>'); | ||||
|  | ||||
|     $downloadButton.on('click', () => openService.downloadNoteRevision(revisionItem.noteId, revisionItem.noteRevisionId)); | ||||
|  | ||||
|     $titleButtons.append($downloadButton); | ||||
|  | ||||
|     const fullNoteRevision = await server.get(`notes/${revisionItem.noteId}/revisions/${revisionItem.noteRevisionId}`); | ||||
|  | ||||
|     if (revisionItem.type === 'text') { | ||||
|         $content.html(fullNoteRevision.content); | ||||
|  | ||||
|         if ($content.find('span.math-tex').length > 0) { | ||||
|             await libraryLoader.requireLibrary(libraryLoader.KATEX); | ||||
|  | ||||
|             renderMathInElement($content[0], {trust: true}); | ||||
|         } | ||||
|     } | ||||
|     else if (revisionItem.type === 'code') { | ||||
|         $content.html($("<pre>").text(fullNoteRevision.content)); | ||||
|     } | ||||
|     else if (revisionItem.type === 'image') { | ||||
|         $content.html($("<img>") | ||||
|             // reason why we put this inline as base64 is that we do not want to let user to copy this | ||||
|             // as a URL to be used in a note. Instead if they copy and paste it into a note, it will be a uploaded as a new note | ||||
|             .attr("src", `data:${note.mime};base64,` + fullNoteRevision.content) | ||||
|             .css("max-width", "100%") | ||||
|             .css("max-height", "100%")); | ||||
|     } | ||||
|     else if (revisionItem.type === 'file') { | ||||
|         const $table = $("<table cellpadding='10'>") | ||||
|             .append($("<tr>").append( | ||||
|                 $("<th>").text("MIME: "), | ||||
|                 $("<td>").text(revisionItem.mime) | ||||
|             )) | ||||
|             .append($("<tr>").append( | ||||
|                 $("<th>").text("File size:"), | ||||
|                 $("<td>").text(revisionItem.contentLength + " bytes") | ||||
|             )); | ||||
|  | ||||
|         if (fullNoteRevision.content) { | ||||
|             $table.append($("<tr>").append( | ||||
|                 $('<td colspan="2">').append( | ||||
|                     $('<div style="font-weight: bold;">').text("Preview:"), | ||||
|                     $('<pre class="file-preview-content"></pre>') | ||||
|                         .text(fullNoteRevision.content) | ||||
|                 ) | ||||
|             )); | ||||
|         } | ||||
|  | ||||
|         $content.html($table); | ||||
|     } | ||||
|     else { | ||||
|         $content.text("Preview isn't available for this note type."); | ||||
|     } | ||||
| } | ||||
|  | ||||
| $eraseAllRevisionsButton.on('click', async () => { | ||||
|     const confirmDialog = await import('../dialogs/confirm.js'); | ||||
|     const text = 'Do you want to delete all revisions of this note? This action will erase revision title and content, but still preserve revision metadata.'; | ||||
|  | ||||
|     if (await confirmDialog.confirm(text)) { | ||||
|         await server.remove(`notes/${note.noteId}/revisions`); | ||||
|  | ||||
|         $dialog.modal('hide'); | ||||
|  | ||||
|         toastService.showMessage('Note revisions has been deleted.'); | ||||
|     } | ||||
| }); | ||||
|  | ||||
| $list.on('click', '.dropdown-item', e => { | ||||
|    e.preventDefault(); | ||||
|    return false; | ||||
| }); | ||||
|  | ||||
| $list.on('focus', '.dropdown-item', e => { | ||||
|     $list.find('.dropdown-item').each((i, el) => { | ||||
|         $(el).toggleClass('active', el === e.target); | ||||
|     }); | ||||
|  | ||||
|     setContentPane(); | ||||
| }); | ||||
| @@ -1,40 +0,0 @@ | ||||
| import appContext from "../services/app_context.js"; | ||||
| import utils from "../services/utils.js"; | ||||
|  | ||||
| const $dialog = $("#note-source-dialog"); | ||||
| const $noteSource = $("#note-source"); | ||||
|  | ||||
| export async function showDialog() { | ||||
|     utils.openDialog($dialog); | ||||
|  | ||||
|     const noteCompletement = await appContext.tabManager.getActiveContext().getNoteComplement(); | ||||
|  | ||||
|     $noteSource.text(formatHtml(noteCompletement.content)); | ||||
| } | ||||
|  | ||||
| function formatHtml(str) { | ||||
|     const div = document.createElement('div'); | ||||
|     div.innerHTML = str.trim(); | ||||
|  | ||||
|     return formatNode(div, 0).innerHTML.trim(); | ||||
| } | ||||
|  | ||||
| function formatNode(node, level) { | ||||
|     const indentBefore = new Array(level++ + 1).join('  '); | ||||
|     const indentAfter  = new Array(level - 1).join('  '); | ||||
|     let textNode; | ||||
|  | ||||
|     for (let i = 0; i < node.children.length; i++) { | ||||
|         textNode = document.createTextNode('\n' + indentBefore); | ||||
|         node.insertBefore(textNode, node.children[i]); | ||||
|  | ||||
|         formatNode(node.children[i], level); | ||||
|  | ||||
|         if (node.lastElementChild === node.children[i]) { | ||||
|             textNode = document.createTextNode('\n' + indentAfter); | ||||
|             node.appendChild(textNode); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     return node; | ||||
| } | ||||
| @@ -1,34 +0,0 @@ | ||||
| "use strict"; | ||||
|  | ||||
| import server from '../services/server.js'; | ||||
| import utils from "../services/utils.js"; | ||||
|  | ||||
| const $dialog = $("#options-dialog"); | ||||
|  | ||||
| export async function showDialog(openTab) { | ||||
|     const options = await server.get('options'); | ||||
|  | ||||
|     utils.openDialog($dialog); | ||||
|  | ||||
|     (await Promise.all([ | ||||
|         import('./options/appearance.js'), | ||||
|         import('./options/shortcuts.js'), | ||||
|         import('./options/code_notes.js'), | ||||
|         import('./options/password.js'), | ||||
|         import('./options/etapi.js'), | ||||
|         import('./options/backup.js'), | ||||
|         import('./options/sync.js'), | ||||
|         import('./options/other.js'), | ||||
|         import('./options/advanced.js') | ||||
|     ])) | ||||
|         .map(m => new m.default) | ||||
|         .forEach(tab => { | ||||
|             if (tab.optionsLoaded) { | ||||
|                 tab.optionsLoaded(options) | ||||
|             } | ||||
|         }); | ||||
|  | ||||
|     if (openTab) { | ||||
|         $(`.nav-link[href='#options-${openTab}']`).trigger("click"); | ||||
|     } | ||||
| } | ||||
| @@ -1,13 +0,0 @@ | ||||
| import utils from "../services/utils.js"; | ||||
| import appContext from "../services/app_context.js"; | ||||
|  | ||||
| export function show() { | ||||
|     const $dialog = $("#password-not-set-dialog"); | ||||
|     const $openPasswordOptionsButton = $("#open-password-options-button"); | ||||
|  | ||||
|     utils.openDialog($dialog); | ||||
|  | ||||
|     $openPasswordOptionsButton.on("click", () => { | ||||
|         appContext.triggerCommand("showOptions", { openTab: 'password' }); | ||||
|     }); | ||||
| } | ||||
| @@ -1,59 +0,0 @@ | ||||
| import utils from "../services/utils.js"; | ||||
|  | ||||
| const $dialog = $("#prompt-dialog"); | ||||
| const $dialogBody = $dialog.find(".modal-body"); | ||||
|  | ||||
| let $question; | ||||
| let $answer; | ||||
|  | ||||
| const $form = $("#prompt-dialog-form"); | ||||
|  | ||||
| let resolve; | ||||
| let shownCb; | ||||
|  | ||||
| export function ask({ title, message, defaultValue, shown }) { | ||||
|     shownCb = shown; | ||||
|  | ||||
|     $("#prompt-title").text(title || "Prompt"); | ||||
|  | ||||
|     $question = $("<label>") | ||||
|         .prop("for", "prompt-dialog-answer") | ||||
|         .text(message); | ||||
|  | ||||
|     $answer = $("<input>") | ||||
|         .prop("type", "text") | ||||
|         .prop("id", "prompt-dialog-answer") | ||||
|         .addClass("form-control") | ||||
|         .val(defaultValue || ""); | ||||
|  | ||||
|     $dialogBody.empty().append( | ||||
|         $("<div>") | ||||
|             .addClass("form-group") | ||||
|             .append($question) | ||||
|             .append($answer)); | ||||
|  | ||||
|     utils.openDialog($dialog, false); | ||||
|  | ||||
|     return new Promise((res, rej) => { resolve = res; }); | ||||
| } | ||||
|  | ||||
| $dialog.on('shown.bs.modal', () => { | ||||
|     if (shownCb) { | ||||
|         shownCb({ $dialog, $question, $answer, $form }); | ||||
|     } | ||||
|  | ||||
|     $answer.trigger('focus').select(); | ||||
| }); | ||||
|  | ||||
| $dialog.on("hidden.bs.modal", () => { | ||||
|     if (resolve) { | ||||
|         resolve(null); | ||||
|     } | ||||
| }); | ||||
|  | ||||
| $form.on('submit', e => { | ||||
|     e.preventDefault(); | ||||
|     resolve($answer.val()); | ||||
|  | ||||
|     $dialog.modal('hide'); | ||||
| }); | ||||
| @@ -1,29 +0,0 @@ | ||||
| import protectedSessionService from "../services/protected_session.js"; | ||||
| import utils from "../services/utils.js"; | ||||
|  | ||||
| const $dialog = $("#protected-session-password-dialog"); | ||||
| const $passwordForm = $dialog.find(".protected-session-password-form"); | ||||
| const $passwordInput = $dialog.find(".protected-session-password"); | ||||
|  | ||||
| export function show() { | ||||
|     utils.openDialog($dialog); | ||||
|  | ||||
|     $passwordInput.trigger('focus'); | ||||
| } | ||||
|  | ||||
| export function close() { | ||||
|     // this may fail if the dialog has not been previously opened (not sure if still true with Bootstrap modal) | ||||
|     try { | ||||
|         $dialog.modal('hide'); | ||||
|     } | ||||
|     catch (e) {} | ||||
| } | ||||
|  | ||||
| $passwordForm.on('submit', () => { | ||||
|     const password = $passwordInput.val(); | ||||
|     $passwordInput.val(""); | ||||
|  | ||||
|     protectedSessionService.setupProtectedSession(password); | ||||
|  | ||||
|     return false; | ||||
| }); | ||||
| @@ -1,112 +0,0 @@ | ||||
| import linkService from '../services/link.js'; | ||||
| import utils from '../services/utils.js'; | ||||
| import server from '../services/server.js'; | ||||
| import treeService from "../services/tree.js"; | ||||
| import froca from "../services/froca.js"; | ||||
| import appContext from "../services/app_context.js"; | ||||
| import hoistedNoteService from "../services/hoisted_note.js"; | ||||
|  | ||||
| const $dialog = $("#recent-changes-dialog"); | ||||
| const $content = $("#recent-changes-content"); | ||||
|  | ||||
| export async function showDialog(ancestorNoteId) { | ||||
|     utils.openDialog($dialog); | ||||
|  | ||||
|     if (!ancestorNoteId) { | ||||
|         ancestorNoteId = hoistedNoteService.getHoistedNoteId(); | ||||
|     } | ||||
|  | ||||
|     const recentChangesRows = await server.get('recent-changes/' + ancestorNoteId); | ||||
|  | ||||
|     // preload all notes into cache | ||||
|     await froca.getNotes(recentChangesRows.map(r => r.noteId), true); | ||||
|  | ||||
|     $content.empty(); | ||||
|  | ||||
|     if (recentChangesRows.length === 0) { | ||||
|         $content.append("No changes yet ..."); | ||||
|     } | ||||
|  | ||||
|     const groupedByDate = groupByDate(recentChangesRows); | ||||
|  | ||||
|     for (const [dateDay, dayChanges] of groupedByDate) { | ||||
|         const $changesList = $('<ul>'); | ||||
|  | ||||
|         const dayEl = $('<div>').append($('<b>').text(dateDay)).append($changesList); | ||||
|  | ||||
|         for (const change of dayChanges) { | ||||
|             const formattedTime = change.date.substr(11, 5); | ||||
|  | ||||
|             let $noteLink; | ||||
|  | ||||
|             if (change.current_isDeleted) { | ||||
|                 $noteLink = $("<span>").text(change.current_title); | ||||
|  | ||||
|                 if (change.canBeUndeleted) { | ||||
|                     const $undeleteLink = $(`<a href="javascript:">`) | ||||
|                         .text("undelete") | ||||
|                         .on('click', async () => { | ||||
|                             const confirmDialog = await import('../dialogs/confirm.js'); | ||||
|                             const text = 'Do you want to undelete this note and its sub-notes?'; | ||||
|  | ||||
|                             if (await confirmDialog.confirm(text)) { | ||||
|                                 await server.put(`notes/${change.noteId}/undelete`); | ||||
|  | ||||
|                                 $dialog.modal('hide'); | ||||
|  | ||||
|                                 await froca.reloadNotes([change.noteId]); | ||||
|  | ||||
|                                 appContext.tabManager.getActiveContext().setNote(change.noteId); | ||||
|                             } | ||||
|                         }); | ||||
|  | ||||
|                     $noteLink | ||||
|                         .append(' (') | ||||
|                         .append($undeleteLink) | ||||
|                         .append(')'); | ||||
|                 } | ||||
|             } | ||||
|             else { | ||||
|                 const note = await froca.getNote(change.noteId); | ||||
|                 const notePath = treeService.getSomeNotePath(note); | ||||
|  | ||||
|                 if (notePath) { | ||||
|                     $noteLink = await linkService.createNoteLink(notePath, { | ||||
|                         title: change.title, | ||||
|                         showNotePath: true | ||||
|                     }); | ||||
|                 } | ||||
|                 else { | ||||
|                     $noteLink = $("<span>").text(note.title); | ||||
|                 } | ||||
|             } | ||||
|  | ||||
|             $changesList.append($('<li>') | ||||
|                 .append( | ||||
|                     $("<span>") | ||||
|                         .text(formattedTime) | ||||
|                         .attr("title", change.date) | ||||
|                 ) | ||||
|                 .append(' - ') | ||||
|                 .append($noteLink)); | ||||
|         } | ||||
|  | ||||
|         $content.append(dayEl); | ||||
|     } | ||||
| } | ||||
|  | ||||
| function groupByDate(rows) { | ||||
|     const groupedByDate = new Map(); | ||||
|  | ||||
|     for (const row of rows) { | ||||
|         const dateDay = row.date.substr(0, 10); | ||||
|  | ||||
|         if (!groupedByDate.has(dateDay)) { | ||||
|             groupedByDate.set(dateDay, []); | ||||
|         } | ||||
|  | ||||
|         groupedByDate.get(dateDay).push(row); | ||||
|     } | ||||
|  | ||||
|     return groupedByDate; | ||||
| } | ||||
| @@ -1,24 +0,0 @@ | ||||
| import server from "../services/server.js"; | ||||
| import utils from "../services/utils.js"; | ||||
|  | ||||
| const $dialog = $("#sort-child-notes-dialog"); | ||||
| const $form = $("#sort-child-notes-form"); | ||||
|  | ||||
| let parentNoteId = null; | ||||
|  | ||||
| $form.on('submit', async () => { | ||||
|     const sortBy = $form.find("input[name='sort-by']:checked").val(); | ||||
|     const sortDirection = $form.find("input[name='sort-direction']:checked").val(); | ||||
|  | ||||
|     await server.put(`notes/${parentNoteId}/sort-children`, {sortBy, sortDirection}); | ||||
|  | ||||
|     utils.closeActiveDialog(); | ||||
| }); | ||||
|  | ||||
| export async function showDialog(noteId) { | ||||
|     parentNoteId = noteId; | ||||
|  | ||||
|     utils.openDialog($dialog); | ||||
|  | ||||
|     $form.find('input:first').focus(); | ||||
| } | ||||
| @@ -16,7 +16,9 @@ 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", | ||||
|     "web-view": "bx bx-globe-alt" | ||||
| }; | ||||
|  | ||||
| /** | ||||
| @@ -124,7 +126,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; | ||||
|         } | ||||
| @@ -261,7 +263,11 @@ class NoteShort { | ||||
|                 const templateNote = this.froca.notes[templateAttr.value]; | ||||
|  | ||||
|                 if (templateNote && templateNote.noteId !== this.noteId) { | ||||
|                     attrArrs.push(templateNote.__getCachedAttributes(newPath)); | ||||
|                     attrArrs.push( | ||||
|                         templateNote.__getCachedAttributes(newPath) | ||||
|                             // template attr is used as a marker for templates, but it's not meant to be inherited | ||||
|                             .filter(attr => !(attr.type === 'label' && attr.name === 'template')) | ||||
|                     ); | ||||
|                 } | ||||
|             } | ||||
|  | ||||
| @@ -634,13 +640,18 @@ class NoteShort { | ||||
|             return []; | ||||
|         } | ||||
|  | ||||
|         return this.getAttributes() | ||||
|         const promotedAttrs = this.getAttributes() | ||||
|             .filter(attr => attr.isDefinition()) | ||||
|             .filter(attr => { | ||||
|                 const def = attr.getDefinition(); | ||||
|  | ||||
|                 return def && def.isPromoted; | ||||
|             }); | ||||
|  | ||||
|         // attrs are not resorted if position changes after initial load | ||||
|         promotedAttrs.sort((a, b) => a.position < b.position ? -1 : 1); | ||||
|  | ||||
|         return promotedAttrs; | ||||
|     } | ||||
|  | ||||
|     hasAncestor(ancestorNoteId, visitedNoteIds = null) { | ||||
|   | ||||
| @@ -48,6 +48,33 @@ 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"; | ||||
| import TocWidget from "../widgets/toc.js"; | ||||
| import BulkActionsDialog from "../widgets/dialogs/bulk_actions.js"; | ||||
| import AboutDialog from "../widgets/dialogs/about.js"; | ||||
| import NoteSourceDialog from "../widgets/dialogs/note_source.js"; | ||||
| import HelpDialog from "../widgets/dialogs/help.js"; | ||||
| import RecentChangesDialog from "../widgets/dialogs/recent_changes.js"; | ||||
| import BackendLogDialog from "../widgets/dialogs/backend_log.js"; | ||||
| import BranchPrefixDialog from "../widgets/dialogs/branch_prefix.js"; | ||||
| import SortChildNotesDialog from "../widgets/dialogs/sort_child_notes.js"; | ||||
| import PasswordNoteSetDialog from "../widgets/dialogs/password_not_set.js"; | ||||
| import IncludeNoteDialog from "../widgets/dialogs/include_note.js"; | ||||
| import NoteTypeChooserDialog from "../widgets/dialogs/note_type_chooser.js"; | ||||
| import JumpToNoteDialog from "../widgets/dialogs/jump_to_note.js"; | ||||
| import AddLinkDialog from "../widgets/dialogs/add_link.js"; | ||||
| import CloneToDialog from "../widgets/dialogs/clone_to.js"; | ||||
| import MoveToDialog from "../widgets/dialogs/move_to.js"; | ||||
| import ImportDialog from "../widgets/dialogs/import.js"; | ||||
| import ExportDialog from "../widgets/dialogs/export.js"; | ||||
| import MarkdownImportDialog from "../widgets/dialogs/markdown_import.js"; | ||||
| import ProtectedSessionPasswordDialog from "../widgets/dialogs/protected_session_password.js"; | ||||
| import NoteRevisionsDialog from "../widgets/dialogs/note_revisions.js"; | ||||
| import DeleteNotesDialog from "../widgets/dialogs/delete_notes.js"; | ||||
| import InfoDialog from "../widgets/dialogs/info.js"; | ||||
| import ConfirmDialog from "../widgets/dialogs/confirm.js"; | ||||
| import PromptDialog from "../widgets/dialogs/prompt.js"; | ||||
| import OptionsDialog from "../widgets/dialogs/options.js"; | ||||
|  | ||||
| export default class DesktopLayout { | ||||
|     constructor(customWidgets) { | ||||
| @@ -161,15 +188,42 @@ export default class DesktopLayout { | ||||
|                                         .child(new SearchResultWidget()) | ||||
|                                         .child(new SqlResultWidget()) | ||||
|                                 ) | ||||
|                                 .child(new FindWidget()) | ||||
|                                 .child(...this.customWidgets.get('node-detail-pane')) | ||||
|                             ) | ||||
|                         ) | ||||
|                         .child(...this.customWidgets.get('center-pane')) | ||||
|                     ) | ||||
|                     .child(new RightPaneContainer() | ||||
|                         .child(new TocWidget()) | ||||
|                         .child(...this.customWidgets.get('right-pane')) | ||||
|                     ) | ||||
|                 ) | ||||
|             ); | ||||
|             ) | ||||
|             .child(new BulkActionsDialog()) | ||||
|             .child(new AboutDialog()) | ||||
|             .child(new NoteSourceDialog()) | ||||
|             .child(new HelpDialog()) | ||||
|             .child(new RecentChangesDialog()) | ||||
|             .child(new BackendLogDialog()) | ||||
|             .child(new BranchPrefixDialog()) | ||||
|             .child(new SortChildNotesDialog()) | ||||
|             .child(new PasswordNoteSetDialog()) | ||||
|             .child(new IncludeNoteDialog()) | ||||
|             .child(new NoteTypeChooserDialog()) | ||||
|             .child(new JumpToNoteDialog()) | ||||
|             .child(new AddLinkDialog()) | ||||
|             .child(new CloneToDialog()) | ||||
|             .child(new MoveToDialog()) | ||||
|             .child(new ImportDialog()) | ||||
|             .child(new ExportDialog()) | ||||
|             .child(new MarkdownImportDialog()) | ||||
|             .child(new ProtectedSessionPasswordDialog()) | ||||
|             .child(new NoteRevisionsDialog()) | ||||
|             .child(new DeleteNotesDialog()) | ||||
|             .child(new InfoDialog()) | ||||
|             .child(new ConfirmDialog()) | ||||
|             .child(new PromptDialog()) | ||||
|             .child(new OptionsDialog()); | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -8,6 +8,8 @@ import CloseDetailButtonWidget from "../widgets/mobile_widgets/close_detail_butt | ||||
| import MobileDetailMenuWidget from "../widgets/mobile_widgets/mobile_detail_menu.js"; | ||||
| import ScreenContainer from "../widgets/mobile_widgets/screen_container.js"; | ||||
| import ScrollingContainer from "../widgets/containers/scrolling_container.js"; | ||||
| import ProtectedSessionPasswordDialog from "../widgets/dialogs/protected_session_password.js"; | ||||
| import ConfirmDialog from "../widgets/dialogs/confirm.js"; | ||||
|  | ||||
| const MOBILE_CSS = ` | ||||
| <style> | ||||
| @@ -128,6 +130,8 @@ export default class MobileLayout { | ||||
|                                 .css('padding', '5px 20px 10px 0') | ||||
|                         ) | ||||
|                 ) | ||||
|             ); | ||||
|             ) | ||||
|             .child(new ProtectedSessionPasswordDialog()) | ||||
|             .child(new ConfirmDialog()); | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -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 { | ||||
|   | ||||
| @@ -4,6 +4,7 @@ import toastService from "./toast.js"; | ||||
| import froca from "./froca.js"; | ||||
| import hoistedNoteService from "./hoisted_note.js"; | ||||
| import ws from "./ws.js"; | ||||
| import appContext from "./app_context.js"; | ||||
|  | ||||
| async function moveBeforeBranch(branchIdsToMove, beforeBranchId) { | ||||
|     branchIdsToMove = filterRootNote(branchIdsToMove); | ||||
| @@ -81,8 +82,8 @@ async function deleteNotes(branchIdsToDelete) { | ||||
|         deleteAllClones = false; | ||||
|     } | ||||
|     else { | ||||
|         const deleteNotesDialog = await import("../dialogs/delete_notes.js"); | ||||
|         ({proceed, deleteAllClones, eraseNotes} = await deleteNotesDialog.showDialog(branchIdsToDelete)); | ||||
|         ({proceed, deleteAllClones, eraseNotes} = await new Promise(res => | ||||
|             appContext.triggerCommand('showDeleteNotesDialog', {branchIdsToDelete, callback: res}))); | ||||
|     } | ||||
|  | ||||
|     if (!proceed) { | ||||
|   | ||||
							
								
								
									
										94
									
								
								src/public/app/services/bulk_action.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										94
									
								
								src/public/app/services/bulk_action.js
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,94 @@ | ||||
| import server from "./server.js"; | ||||
| import ws from "./ws.js"; | ||||
| import MoveNoteBulkAction from "../widgets/bulk_actions/note/move_note.js"; | ||||
| import DeleteNoteBulkAction from "../widgets/bulk_actions/note/delete_note.js"; | ||||
| import DeleteNoteRevisionsBulkAction from "../widgets/bulk_actions/note/delete_note_revisions.js"; | ||||
| import DeleteLabelBulkAction from "../widgets/bulk_actions/label/delete_label.js"; | ||||
| import DeleteRelationBulkAction from "../widgets/bulk_actions/relation/delete_relation.js"; | ||||
| import RenameLabelBulkAction from "../widgets/bulk_actions/label/rename_label.js"; | ||||
| import RenameRelationBulkAction from "../widgets/bulk_actions/relation/rename_relation.js"; | ||||
| import UpdateLabelValueBulkAction from "../widgets/bulk_actions/label/update_label_value.js"; | ||||
| import UpdateRelationTargetBulkAction from "../widgets/bulk_actions/relation/update_relation_target.js"; | ||||
| import ExecuteScriptBulkAction from "../widgets/bulk_actions/execute_script.js"; | ||||
| import AddLabelBulkAction from "../widgets/bulk_actions/label/add_label.js"; | ||||
| import AddRelationBulkAction from "../widgets/bulk_actions/relation/add_relation.js"; | ||||
| import RenameNoteBulkAction from "../widgets/bulk_actions/note/rename_note.js"; | ||||
|  | ||||
| const ACTION_GROUPS = [ | ||||
|     { | ||||
|         title: 'Labels', | ||||
|         actions: [AddLabelBulkAction, UpdateLabelValueBulkAction, RenameLabelBulkAction, DeleteLabelBulkAction] | ||||
|     }, | ||||
|     { | ||||
|         title: 'Relations', | ||||
|         actions: [AddRelationBulkAction, UpdateRelationTargetBulkAction, RenameRelationBulkAction, DeleteRelationBulkAction] | ||||
|     }, | ||||
|     { | ||||
|         title: 'Notes', | ||||
|         actions: [RenameNoteBulkAction, MoveNoteBulkAction, DeleteNoteBulkAction, DeleteNoteRevisionsBulkAction], | ||||
|     }, | ||||
|     { | ||||
|         title: 'Other', | ||||
|         actions: [ExecuteScriptBulkAction] | ||||
|     } | ||||
| ]; | ||||
|  | ||||
| const ACTION_CLASSES = [ | ||||
|     RenameNoteBulkAction, | ||||
|     MoveNoteBulkAction, | ||||
|     DeleteNoteBulkAction, | ||||
|     DeleteNoteRevisionsBulkAction, | ||||
|     DeleteLabelBulkAction, | ||||
|     DeleteRelationBulkAction, | ||||
|     RenameLabelBulkAction, | ||||
|     RenameRelationBulkAction, | ||||
|     AddLabelBulkAction, | ||||
|     AddRelationBulkAction, | ||||
|     UpdateLabelValueBulkAction, | ||||
|     UpdateRelationTargetBulkAction, | ||||
|     ExecuteScriptBulkAction | ||||
| ]; | ||||
|  | ||||
| async function addAction(noteId, actionName) { | ||||
|     await server.post(`notes/${noteId}/attributes`, { | ||||
|         type: 'label', | ||||
|         name: 'action', | ||||
|         value: JSON.stringify({ | ||||
|             name: actionName | ||||
|         }) | ||||
|     }); | ||||
|  | ||||
|     await ws.waitForMaxKnownEntityChangeId(); | ||||
| } | ||||
|  | ||||
| function parseActions(note) { | ||||
|     const actionLabels = note.getLabels('action'); | ||||
|  | ||||
|     return actionLabels.map(actionAttr => { | ||||
|         let actionDef; | ||||
|  | ||||
|         try { | ||||
|             actionDef = JSON.parse(actionAttr.value); | ||||
|         } catch (e) { | ||||
|             logError(`Parsing of attribute: '${actionAttr.value}' failed with error: ${e.message}`); | ||||
|             return null; | ||||
|         } | ||||
|  | ||||
|         const ActionClass = ACTION_CLASSES.find(actionClass => actionClass.actionName === actionDef.name); | ||||
|  | ||||
|         if (!ActionClass) { | ||||
|             logError(`No action class for '${actionDef.name}' found.`); | ||||
|             return null; | ||||
|         } | ||||
|  | ||||
|         return new ActionClass(actionAttr, actionDef); | ||||
|     }) | ||||
|         .filter(action => !!action); | ||||
| } | ||||
|  | ||||
| export default { | ||||
|     addAction, | ||||
|     parseActions, | ||||
|     ACTION_CLASSES, | ||||
|     ACTION_GROUPS | ||||
| }; | ||||
| @@ -82,7 +82,7 @@ class ContextMenu { | ||||
|                 const $icon = $("<span>"); | ||||
|  | ||||
|                 if (item.uiIcon) { | ||||
|                     $icon.addClass("bx bx-" + item.uiIcon); | ||||
|                     $icon.addClass(item.uiIcon); | ||||
|                 } else { | ||||
|                     $icon.append(" "); | ||||
|                 } | ||||
|   | ||||
							
								
								
									
										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; | ||||
| @@ -5,7 +5,6 @@ import server from "./server.js"; | ||||
| import appContext from "./app_context.js"; | ||||
| import Component from "../widgets/component.js"; | ||||
| import toastService from "./toast.js"; | ||||
| import noteCreateService from "./note_create.js"; | ||||
| import ws from "./ws.js"; | ||||
| import bundleService from "./bundle.js"; | ||||
|  | ||||
| @@ -19,18 +18,6 @@ export default class Entrypoints extends Component { | ||||
|             jQuery.hotkeys.options.filterContentEditable = false; | ||||
|             jQuery.hotkeys.options.filterTextInputs = false; | ||||
|         } | ||||
|  | ||||
|         $(document).on('click', "a[data-action='note-revision']", async event => { | ||||
|             const linkEl = $(event.target); | ||||
|             const noteId = linkEl.attr('data-note-path'); | ||||
|             const noteRevisionId = linkEl.attr('data-note-revision-id'); | ||||
|  | ||||
|             const attributesDialog = await import("../dialogs/note_revisions.js"); | ||||
|  | ||||
|             attributesDialog.showNoteRevisionsDialog(noteId, noteRevisionId); | ||||
|  | ||||
|             return false; | ||||
|         }); | ||||
|     } | ||||
|  | ||||
|     openDevToolsCommand() { | ||||
| @@ -39,34 +26,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() | ||||
|   | ||||
Some files were not shown because too many files have changed in this diff Show More
		Reference in New Issue
	
	Block a user