mirror of
https://github.com/zadam/trilium.git
synced 2025-11-08 06:15:48 +01:00
fix access to editor instance if active note is not text
This commit is contained in:
@@ -93,7 +93,7 @@ $form.submit(() => {
|
||||
$dialog.modal('hide');
|
||||
|
||||
const linkHref = '#' + notePath;
|
||||
const editor = noteDetailService.getActiveComponent().getEditor();
|
||||
const editor = noteDetailService.getActiveEditor();
|
||||
|
||||
if (hasSelection()) {
|
||||
editor.execute('link', linkHref);
|
||||
@@ -128,7 +128,7 @@ $form.submit(() => {
|
||||
|
||||
// returns true if user selected some text, false if there's no selection
|
||||
function hasSelection() {
|
||||
const model = noteDetailService.getActiveComponent().getEditor().model;
|
||||
const model = noteDetailService.getActiveEditor().model;
|
||||
const selection = model.document.selection;
|
||||
|
||||
return !selection.isCollapsed;
|
||||
|
||||
Reference in New Issue
Block a user