mirror of
https://github.com/zadam/trilium.git
synced 2025-03-01 14:22:32 +01:00
added readOnly attribute which puts text editor into readonly mode #371
This commit is contained in:
parent
54de4d236d
commit
76fbff68ba
@ -107,6 +107,7 @@ function init() {
|
|||||||
$(document).on('click', "a[data-action='note']", goToLink);
|
$(document).on('click', "a[data-action='note']", goToLink);
|
||||||
$(document).on('click', 'div.popover-content a, div.ui-tooltip-content a', goToLink);
|
$(document).on('click', 'div.popover-content a, div.ui-tooltip-content a', goToLink);
|
||||||
$(document).on('dblclick', '#note-detail-text a', goToLink);
|
$(document).on('dblclick', '#note-detail-text a', goToLink);
|
||||||
|
$(document).on('click', '#note-detail-text.ck-read-only a', goToLink);
|
||||||
$(document).on('click', 'span.ck-button__label', e => {
|
$(document).on('click', 'span.ck-button__label', e => {
|
||||||
// this is a link preview dialog from CKEditor link editing
|
// this is a link preview dialog from CKEditor link editing
|
||||||
// for some reason clicked element is span
|
// for some reason clicked element is span
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import libraryLoader from "./library_loader.js";
|
import libraryLoader from "./library_loader.js";
|
||||||
import noteDetailService from './note_detail.js';
|
import noteDetailService from './note_detail.js';
|
||||||
import treeService from './tree.js';
|
import treeService from './tree.js';
|
||||||
|
import attributeService from "./attributes.js";
|
||||||
|
|
||||||
const $component = $('#note-detail-text');
|
const $component = $('#note-detail-text');
|
||||||
|
|
||||||
@ -19,6 +20,8 @@ async function show() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
textEditor.isReadOnly = await isReadOnly();
|
||||||
|
|
||||||
textEditor.setData(noteDetailService.getCurrentNote().content);
|
textEditor.setData(noteDetailService.getCurrentNote().content);
|
||||||
|
|
||||||
$component.show();
|
$component.show();
|
||||||
@ -36,6 +39,12 @@ function getContent() {
|
|||||||
return content;
|
return content;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function isReadOnly() {
|
||||||
|
const attributes = await attributeService.getAttributes();
|
||||||
|
|
||||||
|
return attributes.some(attr => attr.type === 'label' && attr.name === 'readOnly');
|
||||||
|
}
|
||||||
|
|
||||||
function focus() {
|
function focus() {
|
||||||
$component.focus();
|
$component.focus();
|
||||||
}
|
}
|
||||||
|
4
src/public/libraries/ckeditor/ckeditor.js
vendored
4
src/public/libraries/ckeditor/ckeditor.js
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -17,6 +17,7 @@ const BUILTIN_ATTRIBUTES = [
|
|||||||
{ type: 'label', name: 'appCss' },
|
{ type: 'label', name: 'appCss' },
|
||||||
{ type: 'label', name: 'hideChildrenOverview' },
|
{ type: 'label', name: 'hideChildrenOverview' },
|
||||||
{ type: 'label', name: 'hidePromotedAttributes' },
|
{ type: 'label', name: 'hidePromotedAttributes' },
|
||||||
|
{ type: 'label', name: 'readOnly' },
|
||||||
|
|
||||||
// relation names
|
// relation names
|
||||||
{ type: 'relation', name: 'runOnNoteView' },
|
{ type: 'relation', name: 'runOnNoteView' },
|
||||||
|
Loading…
x
Reference in New Issue
Block a user