add api to skip adding commands to undo queue#394
add api to skip adding commands to undo queue#394abhinayagarwal wants to merge 4 commits intogluonhq:mainfrom
Conversation
| execute(cmd, false); | ||
| } | ||
|
|
||
| public void execute(AbstractCommand<T> cmd, boolean skipUndo) { |
There was a problem hiding this comment.
This seems a good fix, but there are many internal uses of CommandManager::execute, which are only exposed via ActionCmdFactory (i.e. ActionCmdFactory::decorate calls ActionCmdDecorate::apply that calls viewModel.getCommandManager().execute(new DecorateCmd(Objects.requireNonNull(decorations)));).
So this API change would only work for direct usage of execute, which I don't think is happening, given that the CommandManager is typically used only internally by the RTA view model, and not by developers, isn't it?
| */ | ||
| package com.gluonhq.richtextarea.viewmodel; | ||
|
|
||
| public interface EditActionCmd extends ActionCmd { |
There was a problem hiding this comment.
You don't need a new interface. ActionCmd could have:
public interface ActionCmd {
void apply(RichTextAreaViewModel viewModel);
default void apply(RichTextAreaViewModel viewModel, boolean skipUndo) {
apply(viewModel);
}
...
And then you could add the new apply where needed (ActionCmdXXX)
There was a problem hiding this comment.
DecorateAction and subclasses don't expose this.
BasicAction::execute doesn't expose this.
There was a problem hiding this comment.
DecorateAction doesn’t directly use the CommandManager. DecorateAction is extended by TextDecorateAction and ParagraphDecorateAction with both the later using ACTION_CMD_FACTORY.decorate internally. Should skipUndo be added as a constructor parameter to DecorateAction ?
Fixes #364