I just tested multiple VaadinCKEditors on the same page and tried to rea

I just tested multiple VaadinCKEditors on the same page and tried to react on value changes directly as the user edits the text in the editor (like Vaadins ValueChangeMode.EAGER on TextFields). In my opinion, the best approach should be to use the provided Autosave-Feature because the editor itself updates its value only on blur (as far as I noticed).

The problem I'm facing right now is, the AutosaveAction is registered globally/statically (not like events on a specific instance) and I can't seem to find a way to identify which editor changed.

The docs show some kind of editorId provided to the AutosaveAction but that seems outdated, because the current code does not provide any editorId.

VaadinCKEditorAction.registerAction(VaadinCKEditorAction.AUTOSAVE, new AutosaveAction() {
      @Override
      public void accept(String editorId, String editorData) {
        System.out.println("My new save action");
      }
});

I'm using Version 4.0.0

My Questions:

  • Was the editorId removed consciously? Why?
  • Is there another (recommended) way to get the value of a editor-instance eagerly?

You could extend the AutosaveAction.

public class SaveAction extends AutosaveAction {
Optional<String> id;

SaveAction(Optional<String> editorId) {
    id=editorId;
}

@Override
public void accept(String editorData) {
    System.out.println("saving " + editorData +" for editor with id = "+ id);
}

}

Then register your save action class after editor built.

VaadinCKEditor editor = new VaadinCKEditorBuilder().with(builder -> {

builder.editorType = EditorType.CLASSIC;
builder.autosave = true;
builder.waitingTime = 5000;

}).createVaadinCKEditor();
VaadinCKEditorAction.registerAction(VaadinCKEditorAction.AUTOSAVE, new SaveAction(editor.getId()));