Skip to content

Build your personal knowledge base with Trilium Notes

removed frontend APIs to modify code note types

zadamecb485c8bcf2
diff --git a/docs/frontend_api/FrontendScriptApi.html b/docs/frontend_api/FrontendScriptApi.html
index 9168cc1a51..b6a5c68574 100644
--- a/docs/frontend_api/FrontendScriptApi.html
+++ b/docs/frontend_api/FrontendScriptApi.html
@@ -1683,112 +1683,6 @@
- <h4 class="name" id="getCodeMimeTypes"><span class="type-signature"></span>getCodeMimeTypes<span class="signature">()</span><span class="type-signature"> &rarr; {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"> &rarr; {Promise.&lt;<a href="NoteShort.html">NoteShort</a>>}</span></h4>
@@ -1890,7 +1784,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#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>
@@ -1944,112 +1838,6 @@
- <h4 class="name" id="getDefaultCodeMimeTypes"><span class="type-signature"></span>getDefaultCodeMimeTypes<span class="signature">()</span><span class="type-signature"> &rarr; {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"> &rarr; {string}</span></h4>
@@ -2258,7 +2046,7 @@ if some action needs to happen on only one specific instance.
<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#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>
@@ -2721,7 +2509,7 @@ otherwise (by e.g. createNoteLink())
<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#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>
@@ -2876,7 +2664,7 @@ otherwise (by e.g. createNoteLink())
<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#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>
@@ -3379,7 +3167,7 @@ note.
<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#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>
@@ -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>
<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>
diff --git a/docs/frontend_api/services_frontend_script_api.js.html b/docs/frontend_api/services_frontend_script_api.js.html
index 203536ab3f..40e144f138 100644
--- a/docs/frontend_api/services_frontend_script_api.js.html
+++ b/docs/frontend_api/services_frontend_script_api.js.html
@@ -332,24 +332,6 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null, tabConte
*/
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
* @param {object} $el - jquery object on which to setup the tooltip
diff --git a/src/public/javascripts/services/frontend_script_api.js b/src/public/javascripts/services/frontend_script_api.js
index 13d29f20da..846a9471f5 100644
--- a/src/public/javascripts/services/frontend_script_api.js
+++ b/src/public/javascripts/services/frontend_script_api.js
@@ -304,24 +304,6 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null, tabConte
*/
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
* @param {object} $el - jquery object on which to setup the tooltip
diff --git a/src/public/javascripts/services/note_type.js b/src/public/javascripts/services/note_type.js
index 3d0b9b59dc..9665bb7cd8 100644
--- a/src/public/javascripts/services/note_type.js
+++ b/src/public/javascripts/services/note_type.js
@@ -1,7 +1,6 @@
import treeService from './tree.js';
import noteDetailService from './note_detail.js';
import server from './server.js';
-import infoService from "./info.js";
const NOTE_TYPES = [
{ type: "file", title: "File", selectable: false },
@@ -53,7 +52,7 @@ const DEFAULT_MIME_TYPES = [
let mimeTypes = DEFAULT_MIME_TYPES;
-class NoteTypeContext {
+export default class NoteTypeContext {
/**
* @param {TabContext} ctx
*/
@@ -76,6 +75,7 @@ class NoteTypeContext {
this.$noteTypeDesc.text(this.findTypeTitle(this.ctx.note.type));
}
+ /** actual body is rendered lazily on note-type button click */
renderDropdown() {
this.$noteTypeDropdown.empty();
@@ -153,14 +153,4 @@ class NoteTypeContext {
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?");
}
-}
-
-export default {
- getDefaultCodeMimeTypes: () => DEFAULT_MIME_TYPES.slice(),
- getCodeMimeTypes: () => mimeTypes,
- setCodeMimeTypes: types => { mimeTypes = types; }
-};
-
-export {
- NoteTypeContext
-};
\ No newline at end of file
+}
\ No newline at end of file
diff --git a/src/public/javascripts/services/tab_context.js b/src/public/javascripts/services/tab_context.js
index e283befadc..3d97f7831c 100644
--- a/src/public/javascripts/services/tab_context.js
+++ b/src/public/javascripts/services/tab_context.js
@@ -5,7 +5,7 @@ import bundleService from "./bundle.js";
import Attributes from "./attributes.js";
import treeUtils from "./tree_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 noteDetailEmpty from "./note_detail_empty.js";
import noteDetailText from "./note_detail_text.js";