Skip to content

Rich text editor: setting delta value breaking on some value change modes #8854

@stefanuebe

Description

@stefanuebe

Description

When using the value change modes lazy or timeout, it is not possible to set an initial delta value via asDelta().setValue(myDelta) . The RTE stays empty.

A workaround is to delegate the setting:

editor.getElement()
    .executeJs("")
    .then(_unused -> editor.asDelta().setValue(initialValue));

Expected outcome

All value change modes should work.

Minimal reproducible example

@Route("")
public class RteView extends VerticalLayout {

    public RteView() {
        var editor = new RichTextEditor();
        editor.setValueChangeMode(ValueChangeMode.LAZY);
        editor.asDelta().setValue("[" +
                "{\"insert\":\"Stock \"}," +
                "{\"insert\":\"RTE\",\"attributes\":{\"bold\":true}}," +
                "{\"insert\":\" from Vaadin 25\\n" +
                "This is the unmodified Vaadin Rich Text Editor for comparison.\\n\"}" +
                "]");
    }
}

Steps to reproduce

Download a starter, add the view and load the app. The RTE stays empty.

Remove the value change mode and it works.

Environment

Vaadin version(s): 25.0.6
OS: Kubuntu 25

Browsers

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions