mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 02:16:05 +01:00 
			
		
		
		
	removed frontend APIs to modify code note types
This commit is contained in:
		| @@ -1683,112 +1683,6 @@ | |||||||
|      |      | ||||||
|  |  | ||||||
|      |      | ||||||
|     <h4 class="name" id="getCodeMimeTypes"><span class="type-signature"></span>getCodeMimeTypes<span class="signature">()</span><span class="type-signature"> → {array}</span></h4> |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| <dl class="details"> |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|     <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#line317">line 317</a> |  | ||||||
|     </li></ul></dd> |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
| </dl> |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| <h5>Returns:</h5> |  | ||||||
|  |  | ||||||
|          |  | ||||||
| <div class="param-desc"> |  | ||||||
|     list of currently used code mime types |  | ||||||
| </div> |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| <dl> |  | ||||||
|     <dt> |  | ||||||
|         Type |  | ||||||
|     </dt> |  | ||||||
|     <dd> |  | ||||||
|          |  | ||||||
| <span class="param-type">array</span> |  | ||||||
|  |  | ||||||
|  |  | ||||||
|     </dd> |  | ||||||
| </dl> |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|          |  | ||||||
|              |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|     <h4 class="name" id="getDateNote"><span class="type-signature"></span>getDateNote<span class="signature">(date)</span><span class="type-signature"> → {Promise.<<a href="NoteShort.html">NoteShort</a>>}</span></h4> |     <h4 class="name" id="getDateNote"><span class="type-signature"></span>getDateNote<span class="signature">(date)</span><span class="type-signature"> → {Promise.<<a href="NoteShort.html">NoteShort</a>>}</span></h4> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -1890,7 +1784,7 @@ | |||||||
|      |      | ||||||
|     <dt class="tag-source">Source:</dt> |     <dt class="tag-source">Source:</dt> | ||||||
|     <dd class="tag-source"><ul class="dummy"><li> |     <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#line351">line 351</a> |         <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line333">line 333</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -1944,112 +1838,6 @@ | |||||||
|      |      | ||||||
|  |  | ||||||
|      |      | ||||||
|     <h4 class="name" id="getDefaultCodeMimeTypes"><span class="type-signature"></span>getDefaultCodeMimeTypes<span class="signature">()</span><span class="type-signature"> → {array}</span></h4> |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| <dl class="details"> |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|     <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#line311">line 311</a> |  | ||||||
|     </li></ul></dd> |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
| </dl> |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| <h5>Returns:</h5> |  | ||||||
|  |  | ||||||
|          |  | ||||||
| <div class="param-desc"> |  | ||||||
|     list of default code mime types |  | ||||||
| </div> |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| <dl> |  | ||||||
|     <dt> |  | ||||||
|         Type |  | ||||||
|     </dt> |  | ||||||
|     <dd> |  | ||||||
|          |  | ||||||
| <span class="param-type">array</span> |  | ||||||
|  |  | ||||||
|  |  | ||||||
|     </dd> |  | ||||||
| </dl> |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|          |  | ||||||
|              |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|     <h4 class="name" id="getInstanceName"><span class="type-signature"></span>getInstanceName<span class="signature">()</span><span class="type-signature"> → {string}</span></h4> |     <h4 class="name" id="getInstanceName"><span class="type-signature"></span>getInstanceName<span class="signature">()</span><span class="type-signature"> → {string}</span></h4> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -2258,7 +2046,7 @@ if some action needs to happen on only one specific instance. | |||||||
|      |      | ||||||
|     <dt class="tag-source">Source:</dt> |     <dt class="tag-source">Source:</dt> | ||||||
|     <dd class="tag-source"><ul class="dummy"><li> |     <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#line360">line 360</a> |         <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line342">line 342</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -2721,7 +2509,7 @@ otherwise (by e.g. createNoteLink()) | |||||||
|      |      | ||||||
|     <dt class="tag-source">Source:</dt> |     <dt class="tag-source">Source:</dt> | ||||||
|     <dd class="tag-source"><ul class="dummy"><li> |     <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#line342">line 342</a> |         <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line324">line 324</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -2876,7 +2664,7 @@ otherwise (by e.g. createNoteLink()) | |||||||
|      |      | ||||||
|     <dt class="tag-source">Source:</dt> |     <dt class="tag-source">Source:</dt> | ||||||
|     <dd class="tag-source"><ul class="dummy"><li> |     <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#line369">line 369</a> |         <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line351">line 351</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -3379,7 +3167,7 @@ note. | |||||||
|      |      | ||||||
|     <dt class="tag-source">Source:</dt> |     <dt class="tag-source">Source:</dt> | ||||||
|     <dd class="tag-source"><ul class="dummy"><li> |     <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#line334">line 334</a> |         <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line316">line 316</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
|  |  | ||||||
| @@ -4276,139 +4064,6 @@ Internally this serializes the anonymous function into string and sends it to ba | |||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|          |  | ||||||
|              |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|     <h4 class="name" id="setCodeMimeTypes"><span class="type-signature"></span>setCodeMimeTypes<span class="signature">(types)</span><span class="type-signature"></span></h4> |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|     <h5>Parameters:</h5> |  | ||||||
|      |  | ||||||
|  |  | ||||||
| <table class="params"> |  | ||||||
|     <thead> |  | ||||||
|     <tr> |  | ||||||
|          |  | ||||||
|         <th>Name</th> |  | ||||||
|          |  | ||||||
|  |  | ||||||
|         <th>Type</th> |  | ||||||
|  |  | ||||||
|          |  | ||||||
|  |  | ||||||
|          |  | ||||||
|  |  | ||||||
|         <th class="last">Description</th> |  | ||||||
|     </tr> |  | ||||||
|     </thead> |  | ||||||
|  |  | ||||||
|     <tbody> |  | ||||||
|      |  | ||||||
|  |  | ||||||
|         <tr> |  | ||||||
|              |  | ||||||
|                 <td class="name"><code>types</code></td> |  | ||||||
|              |  | ||||||
|  |  | ||||||
|             <td class="type"> |  | ||||||
|              |  | ||||||
|                  |  | ||||||
| <span class="param-type">array</span> |  | ||||||
|  |  | ||||||
|  |  | ||||||
|              |  | ||||||
|             </td> |  | ||||||
|  |  | ||||||
|              |  | ||||||
|  |  | ||||||
|              |  | ||||||
|  |  | ||||||
|             <td class="description last">list of mime types to be used</td> |  | ||||||
|         </tr> |  | ||||||
|  |  | ||||||
|      |  | ||||||
|     </tbody> |  | ||||||
| </table> |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| <dl class="details"> |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|     <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#line323">line 323</a> |  | ||||||
|     </li></ul></dd> |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
|  |  | ||||||
|      |  | ||||||
| </dl> |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|          |          | ||||||
|              |              | ||||||
|  |  | ||||||
| @@ -4512,7 +4167,7 @@ Internally this serializes the anonymous function into string and sends it to ba | |||||||
|      |      | ||||||
|     <dt class="tag-source">Source:</dt> |     <dt class="tag-source">Source:</dt> | ||||||
|     <dd class="tag-source"><ul class="dummy"><li> |     <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#line329">line 329</a> |         <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line311">line 311</a> | ||||||
|     </li></ul></dd> |     </li></ul></dd> | ||||||
|      |      | ||||||
|  |  | ||||||
|   | |||||||
| @@ -332,24 +332,6 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null, tabConte | |||||||
|      */ |      */ | ||||||
|     this.onNoteChange = noteDetailService.onNoteChange; |     this.onNoteChange = noteDetailService.onNoteChange; | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * @method |  | ||||||
|      * @returns {array} list of default code mime types |  | ||||||
|      */ |  | ||||||
|     this.getDefaultCodeMimeTypes = noteTypeService.getDefaultCodeMimeTypes; |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * @method |  | ||||||
|      * @returns {array} list of currently used code mime types |  | ||||||
|      */ |  | ||||||
|     this.getCodeMimeTypes = noteTypeService.getCodeMimeTypes; |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * @method |  | ||||||
|      * @param {array} types - list of mime types to be used |  | ||||||
|      */ |  | ||||||
|     this.setCodeMimeTypes = noteTypeService.setCodeMimeTypes; |  | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * @method |      * @method | ||||||
|      * @param {object} $el - jquery object on which to setup the tooltip |      * @param {object} $el - jquery object on which to setup the tooltip | ||||||
|   | |||||||
| @@ -304,24 +304,6 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null, tabConte | |||||||
|      */ |      */ | ||||||
|     this.onNoteChange = noteDetailService.onNoteChange; |     this.onNoteChange = noteDetailService.onNoteChange; | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * @method |  | ||||||
|      * @returns {array} list of default code mime types |  | ||||||
|      */ |  | ||||||
|     this.getDefaultCodeMimeTypes = noteTypeService.getDefaultCodeMimeTypes; |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * @method |  | ||||||
|      * @returns {array} list of currently used code mime types |  | ||||||
|      */ |  | ||||||
|     this.getCodeMimeTypes = noteTypeService.getCodeMimeTypes; |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * @method |  | ||||||
|      * @param {array} types - list of mime types to be used |  | ||||||
|      */ |  | ||||||
|     this.setCodeMimeTypes = noteTypeService.setCodeMimeTypes; |  | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * @method |      * @method | ||||||
|      * @param {object} $el - jquery object on which to setup the tooltip |      * @param {object} $el - jquery object on which to setup the tooltip | ||||||
|   | |||||||
| @@ -1,7 +1,6 @@ | |||||||
| import treeService from './tree.js'; | import treeService from './tree.js'; | ||||||
| import noteDetailService from './note_detail.js'; | import noteDetailService from './note_detail.js'; | ||||||
| import server from './server.js'; | import server from './server.js'; | ||||||
| import infoService from "./info.js"; |  | ||||||
|  |  | ||||||
| const NOTE_TYPES = [ | const NOTE_TYPES = [ | ||||||
|     { type: "file", title: "File", selectable: false }, |     { type: "file", title: "File", selectable: false }, | ||||||
| @@ -53,7 +52,7 @@ const DEFAULT_MIME_TYPES = [ | |||||||
|  |  | ||||||
| let mimeTypes = DEFAULT_MIME_TYPES; | let mimeTypes = DEFAULT_MIME_TYPES; | ||||||
|  |  | ||||||
| class NoteTypeContext { | export default class NoteTypeContext { | ||||||
|     /** |     /** | ||||||
|      * @param {TabContext} ctx |      * @param {TabContext} ctx | ||||||
|      */ |      */ | ||||||
| @@ -76,6 +75,7 @@ class NoteTypeContext { | |||||||
|         this.$noteTypeDesc.text(this.findTypeTitle(this.ctx.note.type)); |         this.$noteTypeDesc.text(this.findTypeTitle(this.ctx.note.type)); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |     /** actual body is rendered lazily on note-type button click */ | ||||||
|     renderDropdown() { |     renderDropdown() { | ||||||
|         this.$noteTypeDropdown.empty(); |         this.$noteTypeDropdown.empty(); | ||||||
|  |  | ||||||
| @@ -153,14 +153,4 @@ class NoteTypeContext { | |||||||
|         const confirmDialog = await import("../dialogs/confirm.js"); |         const confirmDialog = await import("../dialogs/confirm.js"); | ||||||
|         return await confirmDialog.confirm("It is not recommended to change note type when note content is not empty. Do you want to continue anyway?"); |         return await confirmDialog.confirm("It is not recommended to change note type when note content is not empty. Do you want to continue anyway?"); | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  |  | ||||||
| export default { |  | ||||||
|     getDefaultCodeMimeTypes: () => DEFAULT_MIME_TYPES.slice(), |  | ||||||
|     getCodeMimeTypes: () => mimeTypes, |  | ||||||
|     setCodeMimeTypes: types => { mimeTypes = types; } |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| export { |  | ||||||
|     NoteTypeContext |  | ||||||
| }; |  | ||||||
| @@ -5,7 +5,7 @@ import bundleService from "./bundle.js"; | |||||||
| import Attributes from "./attributes.js"; | import Attributes from "./attributes.js"; | ||||||
| import treeUtils from "./tree_utils.js"; | import treeUtils from "./tree_utils.js"; | ||||||
| import utils from "./utils.js"; | import utils from "./utils.js"; | ||||||
| import {NoteTypeContext} from "./note_type.js"; | import NoteTypeContext from "./note_type.js"; | ||||||
| import noteDetailService from "./note_detail.js"; | import noteDetailService from "./note_detail.js"; | ||||||
| import noteDetailEmpty from "./note_detail_empty.js"; | import noteDetailEmpty from "./note_detail_empty.js"; | ||||||
| import noteDetailText from "./note_detail_text.js"; | import noteDetailText from "./note_detail_text.js"; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user