Project

General

Profile

Actions

Improvements #11267

open

Improvements #11272: WTextEdit / TinyMCE improvements

Support changing readonly state after editor is rendered.

Added by Dries Mys almost 2 years ago. Updated about 1 month ago.

Status:
Review
Priority:
Normal
Assignee:
-
Target version:
Start date:
01/19/2023
Due date:
% Done:

0%

Estimated time:

Description

Currently the readonly attribute is only correctly applied on first render. Later changes are applied on the hidden textarea, but are not applied to the tinyMCE editor.

Possible solution:

Explicitly update the tinyMCE mode to reflect the readonly state, by adding the following code to the end of WTextEdit::setReadOnly:

if (isRendered()) {
  if (readOnly)
    doJavaScript(jsRef() + ".ed.mode.set('readonly');");
  else
    doJavaScript(jsRef() + ".ed.mode.set('design');");
}

See TinyMCE documentation: https://www.tiny.cloud/docs/tinymce/6/apis/tinymce.editormode/#set

Note that this does not seem to work (when the editor is initially readonly), due to a bad initial readonly configuration setting. Wt uses std::string("1") and cpp17::any() (see WTextEdit::setReadOnly), although the documented values are true and false.

See TinyMCE documentation: https://www.tiny.cloud/docs/tinymce/6/editor-important-options/#starting-the-editor-in-a-read-only-state

Correctly using true and false inside WTextEdit::setReadOnly, resolves this issue:

if (readOnly)
  setConfigurationSetting("readonly", true);
else
  setConfigurationSetting("readonly", false);
Actions #1

Updated by Roel Standaert almost 2 years ago

  • Parent task set to #11272
Actions #2

Updated by Roel Standaert almost 2 years ago

  • Target version set to future
Actions #3

Updated by Matthias Van Ceulebroeck 3 months ago

  • Assignee set to Romain Mardulyn
  • Target version changed from future to 4.11.1
Actions #4

Updated by Romain Mardulyn 3 months ago

  • Status changed from New to InProgress
Actions #5

Updated by Romain Mardulyn 3 months ago

  • Status changed from InProgress to Review
Actions #6

Updated by Romain Mardulyn 3 months ago

  • Status changed from Review to InProgress
Actions #7

Updated by Romain Mardulyn 3 months ago

  • Status changed from InProgress to Review
  • Assignee deleted (Romain Mardulyn)
Actions #8

Updated by Matthias Van Ceulebroeck about 1 month ago

  • Target version changed from 4.11.1 to 4.11.2
Actions

Also available in: Atom PDF