fix access to editor instance if active note is not text

This commit is contained in:
zadam
2019-05-19 09:13:13 +02:00
parent 8c46e96397
commit 722380e7b8
4 changed files with 30 additions and 14 deletions

View File

@@ -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;