Project

General

Profile

Actions

Improvements #11267

closed
DM RM

Improvements #11272: WTextEdit / TinyMCE improvements

Support changing readonly state after editor is rendered.

Improvements #11267: Support changing readonly state after editor is rendered.

Added by Dries Mys over 3 years ago. Updated about 1 year ago.

Status:
Closed
Priority:
Normal
Target version:
Start date:
01/19/2023
Due date:
% Done:

100%

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);

RS Updated by Roel Standaert over 3 years ago Actions #1

  • Parent task set to #11272

RS Updated by Roel Standaert over 3 years ago Actions #2

  • Target version set to future

MV Updated by Matthias Van Ceulebroeck about 2 years ago Actions #3

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

RM Updated by Romain Mardulyn about 2 years ago Actions #4

  • Status changed from New to InProgress

RM Updated by Romain Mardulyn about 2 years ago Actions #5

  • Status changed from InProgress to Review

RM Updated by Romain Mardulyn about 2 years ago Actions #6

  • Status changed from Review to InProgress

RM Updated by Romain Mardulyn about 2 years ago Actions #7

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

MV Updated by Matthias Van Ceulebroeck almost 2 years ago Actions #8

  • Target version changed from 4.11.1 to 4.11.2

MV Updated by Matthias Van Ceulebroeck over 1 year ago Actions #9

  • Target version changed from 4.11.2 to 4.11.3

MV Updated by Matthias Van Ceulebroeck over 1 year ago Actions #10

  • Target version changed from 4.11.3 to 4.11.4

MV Updated by Matthias Van Ceulebroeck over 1 year ago Actions #11

  • Target version changed from 4.11.4 to 4.12.0

MV Updated by Matthias Van Ceulebroeck over 1 year ago Actions #12

  • Assignee set to Romain Mardulyn
  • % Done changed from 0 to 100

MV Updated by Matthias Van Ceulebroeck over 1 year ago Actions #13

  • Status changed from Review to Implemented @Emweb

MV Updated by Matthias Van Ceulebroeck about 1 year ago Actions #14

  • Status changed from Implemented @Emweb to Implemented @Test

MV Updated by Matthias Van Ceulebroeck about 1 year ago Actions #15

  • Status changed from Implemented @Test to Closed
Actions

Also available in: PDF Atom