aboutsummaryrefslogtreecommitdiff
path: root/editor/editor.ts
diff options
context:
space:
mode:
authorShulhan <ms@kilabit.info>2023-11-15 02:52:20 +0700
committerShulhan <ms@kilabit.info>2023-11-15 02:52:20 +0700
commit95cbbe49df3ef8091341fbb5c2f4b5003643dc9a (patch)
tree3c41e6687bc5ff18b9a47766d9b4950968eeeee9 /editor/editor.ts
parente38aeae379593b9e4a34042d3da998a91d38d4ef (diff)
downloadpakakeh.ts-95cbbe49df3ef8091341fbb5c2f4b5003643dc9a.tar.xz
editor: add method to set content editable or not
Diffstat (limited to 'editor/editor.ts')
-rw-r--r--editor/editor.ts9
1 files changed, 9 insertions, 0 deletions
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");