From a7ab016236f35986018a2860c91aa3e2741f8a44 Mon Sep 17 00:00:00 2001 From: tHBp Date: Mon, 28 Nov 2016 16:02:42 +0530 Subject: [PATCH] Added support for readOnly editor --- README.md | 3 ++- source/Editor.js | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index aedae61..70e5e6d 100644 --- a/README.md +++ b/README.md @@ -62,7 +62,8 @@ pass a set of attributes to apply to each default block: var editor = new Squire( document, { blockTag: 'P', - blockAttributes: { style: 'font-size: 16px;' } + blockAttributes: { style: 'font-size: 16px;' }, + readOnly: false // default is true }) If using the simple setup, call `editor.setConfig(…);` with your diff --git a/source/Editor.js b/source/Editor.js index d16ab84..d55b1e6 100644 --- a/source/Editor.js +++ b/source/Editor.js @@ -146,7 +146,7 @@ function Squire ( root, config ) { }; } - root.setAttribute( 'contenteditable', 'true' ); + root.setAttribute( 'contenteditable', !(config.readOnly || false) ); // Remove Firefox's built-in controls try {