added readOnly attribute which puts text editor into readonly mode #371

This commit is contained in:
azivner
2019-01-27 13:10:03 +01:00
parent 54de4d236d
commit 76fbff68ba
5 changed files with 14 additions and 3 deletions

View File

@@ -1,6 +1,7 @@
import libraryLoader from "./library_loader.js";
import noteDetailService from './note_detail.js';
import treeService from './tree.js';
import attributeService from "./attributes.js";
const $component = $('#note-detail-text');
@@ -19,6 +20,8 @@ async function show() {
}
}
textEditor.isReadOnly = await isReadOnly();
textEditor.setData(noteDetailService.getCurrentNote().content);
$component.show();
@@ -36,6 +39,12 @@ function getContent() {
return content;
}
async function isReadOnly() {
const attributes = await attributeService.getAttributes();
return attributes.some(attr => attr.type === 'label' && attr.name === 'readOnly');
}
function focus() {
$component.focus();
}