From 95cbbe49df3ef8091341fbb5c2f4b5003643dc9a Mon Sep 17 00:00:00 2001 From: Shulhan Date: Wed, 15 Nov 2023 02:52:20 +0700 Subject: editor: add method to set content editable or not --- editor/editor.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/editor/editor.ts b/editor/editor.ts index dc11438..c7ce506 100644 --- a/editor/editor.ts +++ b/editor/editor.ts @@ -81,6 +81,15 @@ export class WuiEditor { this.render(this.content); } + setEditable(yes: boolean) { + this.isEditable = yes; + if (yes) { + this.elContent.setAttribute("contenteditable", "true"); + } else { + this.elContent.setAttribute("contenteditable", "false"); + } + } + private addNewLine() { this.totalLine++; const elLine = document.createElement("div"); -- cgit v1.3