From df1c0ab2fe2403c24a34935eca58bd8d7a2c56e2 Mon Sep 17 00:00:00 2001 From: Marcin Kazimierczak Date: Mon, 8 Apr 2019 10:05:06 +0200 Subject: [PATCH] Add read-oly mode switch Resolve #535 --- src/editor/js/editor.base.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/editor/js/editor.base.js b/src/editor/js/editor.base.js index b5dcab30..e592d2d6 100644 --- a/src/editor/js/editor.base.js +++ b/src/editor/js/editor.base.js @@ -118,7 +118,10 @@ gj.editor.config = { buttonsGroup: 'gj-button-md-group', button: 'gj-button-md', buttonActive: 'active' - } + }, + + /** Allow set read-only mode */ + contenteditable: true }, bootstrap: { @@ -219,7 +222,7 @@ gj.editor.methods = { body.innerHTML = editor.element.innerText; } } - body.setAttribute('contenteditable', true); + body.setAttribute('contenteditable', data.contenteditable); body.addEventListener('keydown', function (e) { var key = e.keyCode || e.charCode; if (gj.editor.events.changing(editor.element) === false && key !== 8 && key !== 46) {