From e2858f70695bb0b2c0d250e0ee1d2505a8cca795 Mon Sep 17 00:00:00 2001 From: "ala'n (Alexey Stsefanovich)" Date: Mon, 15 Apr 2024 16:59:54 +0200 Subject: [PATCH] fix(uip-editor): fix editor is not editable in FF due to `contentEditable` partial support Closes: #722 --- src/plugins/editor/editor.tsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/plugins/editor/editor.tsx b/src/plugins/editor/editor.tsx index de549e10..568c8de6 100644 --- a/src/plugins/editor/editor.tsx +++ b/src/plugins/editor/editor.tsx @@ -84,7 +84,13 @@ export class UIPEditor extends UIPPluginPanel { /** Changes editor readonly mode */ public set editable(value: boolean) { this.$$cls('readonly', !value); - this.$code.setAttribute('contenteditable', value ? 'plaintext-only' : 'false'); + if (value) { + this.$code.contentEditable = 'plaintext-only'; + // FF doesn't support 'plaintext-only' mode + if (this.$code.contentEditable !== 'plaintext-only') this.$code.contentEditable = 'true'; + } else { + this.$code.contentEditable = 'false'; + } } /** @returns if the editor is in js readonly mode */