[MGNLUI-6958] ReadOnly RichTextField still accepts new lines Created: 22/Nov/21  Updated: 09/Jan/24

Status: Open
Project: Magnolia UI
Component/s: dialogs
Affects Version/s: 6.2.13, 6.2.27
Fix Version/s: None

Type: Bug Priority: Neutral
Reporter: Chris Jennings Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: RichTextEditor, VN-Analysis, richtext
Remaining Estimate: Not Specified
Time Spent: 3h
Original Estimate: Not Specified

Attachments: Zip Archive headless-workflow-example.zip    
Issue Links:
Relates
relates to MGNLUI-7884 RichText fields are editable tho the ... Closed
causality
duplicate
is duplicated by MGNLUI-7223 As a developer I can configure readOn... Closed
is duplicated by MGNLUI-7270 Disable save action when showing vers... Closed
Template:
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Bug DoR:
[ ]* Steps to reproduce, expected, and actual results filled
[ ]* Affected version filled
Date of First Response:
Epic Link: FieldsMaintenance
Team: Nucleus

 Description   

Steps to reproduce

  1. Create a dialog that incorporates a richTextField where readOnly = true.
  2. Open said dialog and attempt to edit the field. You cannot enter any characters and any preset information is uneditable but new lines can be inserted.
  3. (See attached zip archive for an example content app with a 'preview' action)

Expected results

  1. As the field is uneditable, it should not allow users to think they are making changes.

Actual results

  1. The user can insert new lines in the body of text.
  2. Note: On using a save action, the new lines are not persisted.

Development notes

  1. This does not appear in the CKEditor 4 issues list. See: https://github.com/ckeditor/ckeditor4/issues?page=1&q=is%3Aissue+readonly


 Comments   
Comment by Quach Hao Thien [ 15/Mar/23 ]

Discovery

To make it consistent with other fields, we could override the setReadOnly() in http://git.magnolia-cms.com/projects/PLATFORM/repos/ui/browse/magnolia-ui-vaadin-common-widgets/src/main/java/info/magnolia/ui/vaadin/ckeditor/MagnoliaCKEditorTextField.java

@Override
public void setReadOnly(boolean readOnly) {
    super.setReadOnly(readOnly);
    setViewWithoutEditor(readOnly);
} 

This will hide the editor and all control of ckeditor, then restyling the field with css

Generated at Mon Feb 12 09:41:42 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.