diff --git a/docs/frontend_api/FrontendScriptApi.html b/docs/frontend_api/FrontendScriptApi.html index 4197e7611..f556d7d72 100644 --- a/docs/frontend_api/FrontendScriptApi.html +++ b/docs/frontend_api/FrontendScriptApi.html @@ -1240,6 +1240,143 @@ + + + + + + +

addTextToActiveTabEditor(text)

+ + + + + + +
+ Adds given text to the editor cursor +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
text + + +string + + + +
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + @@ -1366,7 +1503,7 @@
Source:
@@ -1785,7 +1922,7 @@
Source:
@@ -1891,7 +2028,7 @@
Source:
@@ -1949,6 +2086,119 @@ +

getActiveTabTextEditor() → {Editor|null}

+ + + + + + +
+ See https://ckeditor.com/docs/ckeditor5/latest/api/module_core_editor_editor-Editor.html for a documentation on the returned instance. +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + +
Returns:
+ + +
+ CKEditor instance or null (e.g. if active note is not a text note) +
+ + + +
+
+ Type +
+
+ +Editor +| + +null + + +
+
+ + + + + + + + + + + + +

getDateNote(date) → {Promise.<NoteShort>}

@@ -2050,7 +2300,7 @@
Source:
@@ -2312,7 +2562,7 @@ if some action needs to happen on only one specific instance.
Source:
@@ -2775,7 +3025,7 @@ otherwise (by e.g. createNoteLink())
Source:
@@ -2930,7 +3180,7 @@ otherwise (by e.g. createNoteLink())
Source:
@@ -3039,7 +3289,7 @@ note.
Source:
@@ -3194,7 +3444,7 @@ note.
Source:
@@ -3433,7 +3683,7 @@ note.
Source:
@@ -4606,7 +4856,7 @@ Internally this serializes the anonymous function into string and sends it to ba
Source:
@@ -4757,7 +5007,7 @@ Internally this serializes the anonymous function into string and sends it to ba
Source:
@@ -5123,7 +5373,7 @@ Typical use case is when new note has been created, we should wait until it is s
Source:
diff --git a/docs/frontend_api/services_frontend_script_api.js.html b/docs/frontend_api/services_frontend_script_api.js.html index 460941ea9..3b73eabad 100644 --- a/docs/frontend_api/services_frontend_script_api.js.html +++ b/docs/frontend_api/services_frontend_script_api.js.html @@ -324,12 +324,28 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null, tabConte */ this.createNoteLink = linkService.createNoteLink; + /** + * Adds given text to the editor cursor + * + * @param {string} text + * @method + */ + this.addTextToActiveTabEditor = linkService.addTextToEditor; + /** * @method * @returns {NoteFull} active note (loaded into right pane) */ this.getActiveTabNote = noteDetailService.getActiveTabNote; + /** + * See https://ckeditor.com/docs/ckeditor5/latest/api/module_core_editor_editor-Editor.html for a documentation on the returned instance. + * + * @method + * @returns {Editor|null} CKEditor instance or null (e.g. if active note is not a text note) + */ + this.getActiveTabTextEditor = noteDetailService.getActiveEditor; + /** * @method * @returns {Promise<string|null>} returns note path of active note or null if there isn't active note diff --git a/package-lock.json b/package-lock.json index 76afd8529..790b8c19b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "trilium", - "version": "0.39.3", + "version": "0.39.5", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/src/entities/note.js b/src/entities/note.js index 2662d4048..2dc113032 100644 --- a/src/entities/note.js +++ b/src/entities/note.js @@ -806,7 +806,7 @@ class Note extends Entity { WHERE noteId = ? AND isDeleted = 0 AND type = 'relation' AND - name IN ('internalLink', 'imageLink', 'relationMapLink')`, [this.noteId]); + name IN ('internalLink', 'imageLink', 'relationMapLink', 'includeNoteLink')`, [this.noteId]); } /** diff --git a/src/public/javascripts/dialogs/options/other.js b/src/public/javascripts/dialogs/options/other.js index 67114aa57..dc8bec45e 100644 --- a/src/public/javascripts/dialogs/options/other.js +++ b/src/public/javascripts/dialogs/options/other.js @@ -6,7 +6,7 @@ const TPL = `

Spell check

-

These options apply only for desktop builds, browsers will use their own native spell check.

+

These options apply only for desktop builds, browsers will use their own native spell check. App restart is required after change.

diff --git a/src/public/javascripts/services/frontend_script_api.js b/src/public/javascripts/services/frontend_script_api.js index a141c8f19..1760e21c0 100644 --- a/src/public/javascripts/services/frontend_script_api.js +++ b/src/public/javascripts/services/frontend_script_api.js @@ -296,12 +296,28 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null, tabConte */ this.createNoteLink = linkService.createNoteLink; + /** + * Adds given text to the editor cursor + * + * @param {string} text - this must be clear text, HTML is not supported. + * @method + */ + this.addTextToActiveTabEditor = linkService.addTextToEditor; + /** * @method * @returns {NoteFull} active note (loaded into right pane) */ this.getActiveTabNote = noteDetailService.getActiveTabNote; + /** + * See https://ckeditor.com/docs/ckeditor5/latest/api/module_core_editor_editor-Editor.html for a documentation on the returned instance. + * + * @method + * @returns {Editor|null} CKEditor instance or null (e.g. if active note is not a text note) + */ + this.getActiveTabTextEditor = noteDetailService.getActiveEditor; + /** * @method * @returns {Promise} returns note path of active note or null if there isn't active note diff --git a/src/public/javascripts/services/spell_check.js b/src/public/javascripts/services/spell_check.js index f75e33157..aee0f379c 100644 --- a/src/public/javascripts/services/spell_check.js +++ b/src/public/javascripts/services/spell_check.js @@ -3,15 +3,16 @@ import optionsService from "./options.js"; export async function initSpellCheck() { const options = await optionsService.waitForOptions(); - if (!options.is('spellCheckEnabled')) { - return; - } - const {SpellCheckHandler, ContextMenuListener, ContextMenuBuilder} = require('electron-spellchecker'); const {remote, shell} = require('electron'); const spellCheckHandler = new SpellCheckHandler(); - spellCheckHandler.attachToInput(); + + // not fully disabling the spellcheck since we want to preserve the context menu + // this will just get rid of the "red squiggles" + if (options.is('spellCheckEnabled')) { + spellCheckHandler.attachToInput(); + } spellCheckHandler.switchLanguage(options.get('spellCheckLanguageCode')); diff --git a/src/services/import/tar.js b/src/services/import/tar.js index 49bedc41b..8b0b58ce1 100644 --- a/src/services/import/tar.js +++ b/src/services/import/tar.js @@ -147,7 +147,7 @@ async function importTar(taskContext, fileBuffer, importRootNote) { continue; } - if (attr.type === 'relation' && ['internalLink', 'imageLink', 'relationMapLink'].includes(attr.name)) { + if (attr.type === 'relation' && ['internalLink', 'imageLink', 'relationMapLink', 'includeNoteLink'].includes(attr.name)) { // these relations are created automatically and as such don't need to be duplicated in the import continue; } diff --git a/src/services/notes.js b/src/services/notes.js index 9eb23cb79..518b81e6c 100644 --- a/src/services/notes.js +++ b/src/services/notes.js @@ -242,6 +242,20 @@ function findInternalLinks(content, foundLinks) { return content.replace(/href="[^"]*#root/g, 'href="#root'); } +function findIncludeNoteLinks(content, foundLinks) { + const re = /
/g; + let match; + + while (match = re.exec(content)) { + foundLinks.push({ + name: 'includeNoteLink', + value: match[1] + }); + } + + return content; +} + function findRelationMapLinks(content, foundLinks) { const obj = JSON.parse(content); @@ -263,10 +277,11 @@ async function saveLinks(note, content) { } const foundLinks = []; - +console.log("Scanning", content); if (note.type === 'text') { content = findImageLinks(content, foundLinks); content = findInternalLinks(content, foundLinks); + content = findIncludeNoteLinks(content, foundLinks); } else if (note.type === 'relation-map') { findRelationMapLinks(content, foundLinks); diff --git a/src/views/dialogs/about.ejs b/src/views/dialogs/about.ejs index aabb27221..1ce633e43 100644 --- a/src/views/dialogs/about.ejs +++ b/src/views/dialogs/about.ejs @@ -9,7 +9,7 @@