From 95fb88780dc8e68101bb6f84016364b9e9306447 Mon Sep 17 00:00:00 2001 From: "Ahmad K. Bawaneh" Date: Thu, 19 Sep 2024 15:06:33 +0300 Subject: [PATCH] fix #962 Add configuration for RichTextEditor buttons and toolbars --- .../domino/ui/config/RichTextConfig.java | 27 ++++ .../dominokit/domino/ui/config/UIConfig.java | 3 +- .../domino/ui/richtext/IsRichTextEditor.java | 25 ++++ .../domino/ui/richtext/RichTextActions.java | 139 ++++++++++++++++++ .../domino/ui/richtext/RichTextCommand.java | 14 +- .../domino/ui/richtext/RichTextEditor.java | 114 +++++++------- .../richtext/commands/BackColorCommand.java | 16 +- .../ui/richtext/commands/BoldCommand.java | 16 +- .../ui/richtext/commands/CopyCommand.java | 16 +- .../ui/richtext/commands/CutCommand.java | 16 +- .../commands/DecreaseFontCommand.java | 20 +-- .../ui/richtext/commands/FontNameCommand.java | 14 +- .../richtext/commands/ForeColorCommand.java | 14 +- .../ui/richtext/commands/HeadingCommand.java | 14 +- .../richtext/commands/HiliteColorCommand.java | 14 +- .../commands/HorizontalRuleCommand.java | 14 +- .../commands/IncreaseFontCommand.java | 18 +-- .../ui/richtext/commands/IndentCommand.java | 14 +- .../richtext/commands/InsertHtmlCommand.java | 15 +- .../richtext/commands/InsertImageCommand.java | 14 +- .../commands/InsertImageLinkCommand.java | 14 +- .../richtext/commands/InsertLinkCommand.java | 14 +- .../commands/InsertOrderedListCommand.java | 14 +- .../commands/InsertParagraphCommand.java | 14 +- .../commands/InsertUnorderedListCommand.java | 14 +- .../ui/richtext/commands/ItalicCommand.java | 14 +- .../commands/JustifyCenterCommand.java | 14 +- .../richtext/commands/JustifyFullCommand.java | 14 +- .../richtext/commands/JustifyLeftCommand.java | 14 +- .../commands/JustifyRightCommand.java | 14 +- .../ui/richtext/commands/OutdentCommand.java | 14 +- .../ui/richtext/commands/PasteCommand.java | 16 +- .../ui/richtext/commands/RedoCommand.java | 14 +- .../commands/RemoveFormatCommand.java | 14 +- .../richtext/commands/RemoveLinkCommand.java | 14 +- .../commands/StrikeThroughCommand.java | 14 +- .../richtext/commands/SubscriptCommand.java | 14 +- .../richtext/commands/SuperscriptCommand.java | 14 +- .../richtext/commands/UnderLineCommand.java | 14 +- .../ui/richtext/commands/UndoCommand.java | 14 +- 40 files changed, 498 insertions(+), 321 deletions(-) create mode 100644 domino-ui/src/main/java/org/dominokit/domino/ui/config/RichTextConfig.java create mode 100644 domino-ui/src/main/java/org/dominokit/domino/ui/richtext/IsRichTextEditor.java create mode 100644 domino-ui/src/main/java/org/dominokit/domino/ui/richtext/RichTextActions.java diff --git a/domino-ui/src/main/java/org/dominokit/domino/ui/config/RichTextConfig.java b/domino-ui/src/main/java/org/dominokit/domino/ui/config/RichTextConfig.java new file mode 100644 index 000000000..84bf5c8fb --- /dev/null +++ b/domino-ui/src/main/java/org/dominokit/domino/ui/config/RichTextConfig.java @@ -0,0 +1,27 @@ +/* + * Copyright © 2019 Dominokit + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.dominokit.domino.ui.config; + +import java.util.Arrays; +import java.util.Collection; +import org.dominokit.domino.ui.richtext.RichTextActions; + +public interface RichTextConfig extends ComponentConfig { + + default Collection getDefaultRichTextActions() { + return Arrays.asList(RichTextActions.values()); + } +} diff --git a/domino-ui/src/main/java/org/dominokit/domino/ui/config/UIConfig.java b/domino-ui/src/main/java/org/dominokit/domino/ui/config/UIConfig.java index 9d3c58307..ba167e6c4 100644 --- a/domino-ui/src/main/java/org/dominokit/domino/ui/config/UIConfig.java +++ b/domino-ui/src/main/java/org/dominokit/domino/ui/config/UIConfig.java @@ -32,4 +32,5 @@ public interface UIConfig TimePickerConfig, DelayedActionConfig, DatatableConfig, - CarouselConfig {} + CarouselConfig, + RichTextConfig {} diff --git a/domino-ui/src/main/java/org/dominokit/domino/ui/richtext/IsRichTextEditor.java b/domino-ui/src/main/java/org/dominokit/domino/ui/richtext/IsRichTextEditor.java new file mode 100644 index 000000000..4821d5e9a --- /dev/null +++ b/domino-ui/src/main/java/org/dominokit/domino/ui/richtext/IsRichTextEditor.java @@ -0,0 +1,25 @@ +/* + * Copyright © 2019 Dominokit + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.dominokit.domino.ui.richtext; + +import org.dominokit.domino.ui.elements.DivElement; +import org.dominokit.domino.ui.utils.Counter; + +public interface IsRichTextEditor { + DivElement getEditableElement(); + + Counter getDefaultFontSizeCounter(); +} diff --git a/domino-ui/src/main/java/org/dominokit/domino/ui/richtext/RichTextActions.java b/domino-ui/src/main/java/org/dominokit/domino/ui/richtext/RichTextActions.java new file mode 100644 index 000000000..4e1336ea3 --- /dev/null +++ b/domino-ui/src/main/java/org/dominokit/domino/ui/richtext/RichTextActions.java @@ -0,0 +1,139 @@ +/* + * Copyright © 2019 Dominokit + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.dominokit.domino.ui.richtext; + +import java.util.function.Function; +import org.dominokit.domino.ui.IsElement; +import org.dominokit.domino.ui.button.group.ButtonsGroup; +import org.dominokit.domino.ui.richtext.commands.BackColorCommand; +import org.dominokit.domino.ui.richtext.commands.BoldCommand; +import org.dominokit.domino.ui.richtext.commands.CopyCommand; +import org.dominokit.domino.ui.richtext.commands.CutCommand; +import org.dominokit.domino.ui.richtext.commands.DecreaseFontCommand; +import org.dominokit.domino.ui.richtext.commands.FontNameCommand; +import org.dominokit.domino.ui.richtext.commands.ForeColorCommand; +import org.dominokit.domino.ui.richtext.commands.HeadingCommand; +import org.dominokit.domino.ui.richtext.commands.HiliteColorCommand; +import org.dominokit.domino.ui.richtext.commands.HorizontalRuleCommand; +import org.dominokit.domino.ui.richtext.commands.IncreaseFontCommand; +import org.dominokit.domino.ui.richtext.commands.IndentCommand; +import org.dominokit.domino.ui.richtext.commands.InsertHtmlCommand; +import org.dominokit.domino.ui.richtext.commands.InsertImageCommand; +import org.dominokit.domino.ui.richtext.commands.InsertImageLinkCommand; +import org.dominokit.domino.ui.richtext.commands.InsertLinkCommand; +import org.dominokit.domino.ui.richtext.commands.InsertOrderedListCommand; +import org.dominokit.domino.ui.richtext.commands.InsertParagraphCommand; +import org.dominokit.domino.ui.richtext.commands.InsertUnorderedListCommand; +import org.dominokit.domino.ui.richtext.commands.ItalicCommand; +import org.dominokit.domino.ui.richtext.commands.JustifyCenterCommand; +import org.dominokit.domino.ui.richtext.commands.JustifyFullCommand; +import org.dominokit.domino.ui.richtext.commands.JustifyLeftCommand; +import org.dominokit.domino.ui.richtext.commands.JustifyRightCommand; +import org.dominokit.domino.ui.richtext.commands.OutdentCommand; +import org.dominokit.domino.ui.richtext.commands.PasteCommand; +import org.dominokit.domino.ui.richtext.commands.RedoCommand; +import org.dominokit.domino.ui.richtext.commands.RemoveFormatCommand; +import org.dominokit.domino.ui.richtext.commands.RemoveLinkCommand; +import org.dominokit.domino.ui.richtext.commands.StrikeThroughCommand; +import org.dominokit.domino.ui.richtext.commands.SubscriptCommand; +import org.dominokit.domino.ui.richtext.commands.SuperscriptCommand; +import org.dominokit.domino.ui.richtext.commands.UnderLineCommand; +import org.dominokit.domino.ui.richtext.commands.UndoCommand; + +public enum RichTextActions { + COPY_PASTE( + editor -> + ButtonsGroup.create() + .appendChild(CopyCommand.create(editor)) + .appendChild(CutCommand.create(editor)) + .appendChild(PasteCommand.create(editor))), + + TEXT_STYLE( + editor -> + ButtonsGroup.create() + .appendChild(BoldCommand.create(editor)) + .appendChild(ItalicCommand.create(editor)) + .appendChild(StrikeThroughCommand.create(editor)) + .appendChild(UnderLineCommand.create(editor))), + + TEXT_JUSTIFY( + editor -> + ButtonsGroup.create() + .appendChild(JustifyFullCommand.create(editor)) + .appendChild(JustifyCenterCommand.create(editor)) + .appendChild(JustifyLeftCommand.create(editor)) + .appendChild(JustifyRightCommand.create(editor))), + + TEXT_INDENT( + editor -> + ButtonsGroup.create() + .appendChild(IndentCommand.create(editor)) + .appendChild(OutdentCommand.create(editor))), + + TEXT_SIZE( + editor -> + ButtonsGroup.create() + .appendChild(IncreaseFontCommand.create(editor)) + .appendChild(DecreaseFontCommand.create(editor)) + .appendChild(SubscriptCommand.create(editor)) + .appendChild(SuperscriptCommand.create(editor))), + + TEXT_FONT(editor -> ButtonsGroup.create().appendChild(FontNameCommand.create(editor))), + + HEADING(editor -> ButtonsGroup.create().appendChild(HeadingCommand.create(editor))), + + INSERT_ELEMENTS( + editor -> + ButtonsGroup.create() + .appendChild(HorizontalRuleCommand.create(editor)) + .appendChild(InsertLinkCommand.create(editor)) + .appendChild(RemoveLinkCommand.create(editor)) + .appendChild(InsertHtmlCommand.create(editor)) + .appendChild(InsertOrderedListCommand.create(editor)) + .appendChild(InsertUnorderedListCommand.create(editor)) + .appendChild(InsertParagraphCommand.create(editor)) + .appendChild(InsertImageCommand.create(editor)) + .appendChild(InsertImageLinkCommand.create(editor))), + + INSERT_IMAGE( + editor -> + ButtonsGroup.create() + .appendChild(InsertImageCommand.create(editor)) + .appendChild(InsertImageLinkCommand.create(editor))), + + CLEAR_FORMAT(editor -> ButtonsGroup.create().appendChild(RemoveFormatCommand.create(editor))), + + BACK_COLOR(BackColorCommand::create), + FORE_COLOR(ForeColorCommand::create), + HILITE_COLOR(HiliteColorCommand::create), + + UNDO_REDO( + editor -> + ButtonsGroup.create() + .appendChild(UndoCommand.create(editor)) + .appendChild(RedoCommand.create(editor))), + ; + + private final Function> handler; + + RichTextActions(Function> handler) { + this.handler = handler; + } + + public IsElement apply(RichTextEditor editor) { + return this.handler.apply(editor); + } +} diff --git a/domino-ui/src/main/java/org/dominokit/domino/ui/richtext/RichTextCommand.java b/domino-ui/src/main/java/org/dominokit/domino/ui/richtext/RichTextCommand.java index a9f015870..7d6a4a92f 100644 --- a/domino-ui/src/main/java/org/dominokit/domino/ui/richtext/RichTextCommand.java +++ b/domino-ui/src/main/java/org/dominokit/domino/ui/richtext/RichTextCommand.java @@ -16,14 +16,12 @@ package org.dominokit.domino.ui.richtext; import static java.util.Objects.nonNull; -import static org.dominokit.domino.ui.utils.Domino.*; import elemental2.dom.DomGlobal; import elemental2.dom.HTMLElement; import elemental2.dom.Range; import elemental2.dom.Selection; import java.util.Optional; -import org.dominokit.domino.ui.elements.DivElement; import org.dominokit.domino.ui.i18n.HasLabels; import org.dominokit.domino.ui.i18n.RichTextLabels; import org.dominokit.domino.ui.utils.BaseDominoElement; @@ -50,15 +48,15 @@ */ public abstract class RichTextCommand> extends BaseDominoElement implements HasLabels { - protected final DivElement editableElement; + protected final IsRichTextEditor isRichTextEditor; /** * Creates a new command for a given editable element. * - * @param editableElement The editable content area on which the command operates. + * @param isRichTextEditor The editable content area on which the command operates. */ - public RichTextCommand(DivElement editableElement) { - this.editableElement = editableElement; + public RichTextCommand(IsRichTextEditor isRichTextEditor) { + this.isRichTextEditor = isRichTextEditor; } /** Executes the specific implementation of the rich text command. */ @@ -88,7 +86,9 @@ protected Optional getSelectedRange() { private boolean withinElement(Selection sel) { if (sel.rangeCount > 0) { for (int i = 0; i < sel.rangeCount; ++i) { - if (!editableElement.contains(sel.getRangeAt(i).commonAncestorContainer)) { + if (!isRichTextEditor + .getEditableElement() + .contains(sel.getRangeAt(i).commonAncestorContainer)) { return false; } } diff --git a/domino-ui/src/main/java/org/dominokit/domino/ui/richtext/RichTextEditor.java b/domino-ui/src/main/java/org/dominokit/domino/ui/richtext/RichTextEditor.java index 8a125c20a..a3f1c42b5 100644 --- a/domino-ui/src/main/java/org/dominokit/domino/ui/richtext/RichTextEditor.java +++ b/domino-ui/src/main/java/org/dominokit/domino/ui/richtext/RichTextEditor.java @@ -18,7 +18,8 @@ import static org.dominokit.domino.ui.utils.Domino.*; import elemental2.dom.HTMLDivElement; -import org.dominokit.domino.ui.button.group.ButtonsGroup; +import java.util.Arrays; +import java.util.Collection; import org.dominokit.domino.ui.elements.DivElement; import org.dominokit.domino.ui.i18n.HasLabels; import org.dominokit.domino.ui.i18n.RichTextLabels; @@ -26,6 +27,7 @@ import org.dominokit.domino.ui.utils.BaseDominoElement; import org.dominokit.domino.ui.utils.ChildHandler; import org.dominokit.domino.ui.utils.Counter; +import org.dominokit.domino.ui.utils.DominoUIConfig; import org.dominokit.domino.ui.utils.HasValue; import org.gwtproject.editor.client.LeafValueEditor; import org.gwtproject.editor.client.TakesValue; @@ -55,10 +57,11 @@ public class RichTextEditor extends BaseDominoElement, LeafValueEditor, - HasValue { + HasValue, + IsRichTextEditor { private final DivElement root; - private final DivElement editableElement; + private final DivElement editableElement = div().addCss(dui_rich_text_editable); private final DivElement toolbars; private Counter fontSize = new Counter(3, 1, 7); @@ -71,9 +74,46 @@ public static RichTextEditor create() { return new RichTextEditor(); } + /** + * Factory method to create a new instance of {@link RichTextEditor}. + * + * @param actions A list of actions to be added to the editor toolbars. + * @return a new instance of {@link RichTextEditor} + */ + public static RichTextEditor create(RichTextActions... actions) { + return new RichTextEditor(actions); + } + + /** + * Factory method to create a new instance of {@link RichTextEditor}. + * + * @param actions A list of actions to be added to the editor toolbars. + * @return a new instance of {@link RichTextEditor} + */ + public static RichTextEditor create(Collection actions) { + return new RichTextEditor(actions); + } + + /** + * Constructs a new {@link RichTextEditor} with default configuration and commands. + * + * @param actions A list of actions to be added to the editor toolbars. + */ + public RichTextEditor(RichTextActions... actions) { + this(Arrays.asList(actions)); + } + /** Constructs a new {@link RichTextEditor} with default configuration and commands. */ public RichTextEditor() { - editableElement = div().addCss(dui_rich_text_editable); + this(DominoUIConfig.CONFIG.getUIConfig().getDefaultRichTextActions()); + } + + /** + * Constructs a new {@link RichTextEditor} with default configuration and commands. + * + * @param actions A list of actions to be added to the editor toolbars. + */ + public RichTextEditor(Collection actions) { this.root = div() .addCss(dui_rich_text) @@ -81,60 +121,9 @@ public RichTextEditor() { toolbars = div() .addCss(dui_rich_text_toolbars) - .appendChild( - ButtonsGroup.create() - .appendChild(CopyCommand.create(editableElement)) - .appendChild(CutCommand.create(editableElement)) - .appendChild(PasteCommand.create(editableElement))) - .appendChild( - ButtonsGroup.create() - .appendChild(BoldCommand.create(editableElement)) - .appendChild(ItalicCommand.create(editableElement)) - .appendChild(StrikeThroughCommand.create(editableElement)) - .appendChild(UnderLineCommand.create(editableElement))) - .appendChild( - ButtonsGroup.create() - .appendChild(JustifyFullCommand.create(editableElement)) - .appendChild(JustifyCenterCommand.create(editableElement)) - .appendChild(JustifyLeftCommand.create(editableElement)) - .appendChild(JustifyRightCommand.create(editableElement))) - .appendChild( - ButtonsGroup.create() - .appendChild(IndentCommand.create(editableElement)) - .appendChild(OutdentCommand.create(editableElement))) - .appendChild( - ButtonsGroup.create() - .appendChild(IncreaseFontCommand.create(editableElement, fontSize)) - .appendChild(DecreaseFontCommand.create(editableElement, fontSize)) - .appendChild(SubscriptCommand.create(editableElement)) - .appendChild(SuperscriptCommand.create(editableElement))) - .appendChild( - ButtonsGroup.create() - .appendChild(FontNameCommand.create(editableElement))) - .appendChild( - ButtonsGroup.create() - .appendChild(HeadingCommand.create(editableElement))) - .appendChild( - ButtonsGroup.create() - .appendChild(HorizontalRuleCommand.create(editableElement)) - .appendChild(InsertLinkCommand.create(editableElement)) - .appendChild(RemoveLinkCommand.create(editableElement)) - .appendChild(InsertHtmlCommand.create(editableElement)) - .appendChild(InsertOrderedListCommand.create(editableElement)) - .appendChild(InsertUnorderedListCommand.create(editableElement)) - .appendChild(InsertParagraphCommand.create(editableElement)) - .appendChild(InsertImageCommand.create(editableElement)) - .appendChild(InsertImageLinkCommand.create(editableElement))) - .appendChild( - ButtonsGroup.create() - .appendChild(RemoveFormatCommand.create(editableElement))) - .appendChild(BackColorCommand.create(editableElement)) - .appendChild(ForeColorCommand.create(editableElement)) - .appendChild(HiliteColorCommand.create(editableElement)) - .appendChild( - ButtonsGroup.create() - .appendChild(UndoCommand.create(editableElement)) - .appendChild(RedoCommand.create(editableElement)))) + .apply( + self -> + actions.forEach(action -> self.appendChild(action.apply(this))))) .appendChild(editableElement.setAttribute("contenteditable", "true")); init(this); } @@ -153,6 +142,15 @@ public RichTextEditor withValue(String value) { return this; } + public DivElement getEditableElement() { + return editableElement; + } + + @Override + public Counter getDefaultFontSizeCounter() { + return fontSize; + } + /** * Sets the value of the rich text editor with an option to remain silent and returns the editor * instance for chaining. diff --git a/domino-ui/src/main/java/org/dominokit/domino/ui/richtext/commands/BackColorCommand.java b/domino-ui/src/main/java/org/dominokit/domino/ui/richtext/commands/BackColorCommand.java index 303b09a52..39f4a6459 100644 --- a/domino-ui/src/main/java/org/dominokit/domino/ui/richtext/commands/BackColorCommand.java +++ b/domino-ui/src/main/java/org/dominokit/domino/ui/richtext/commands/BackColorCommand.java @@ -15,12 +15,10 @@ */ package org.dominokit.domino.ui.richtext.commands; -import static org.dominokit.domino.ui.utils.Domino.*; - import elemental2.dom.HTMLElement; -import org.dominokit.domino.ui.elements.DivElement; import org.dominokit.domino.ui.richtext.BackgroundColorPicker; import org.dominokit.domino.ui.richtext.ColorPickerButton; +import org.dominokit.domino.ui.richtext.IsRichTextEditor; import org.dominokit.domino.ui.richtext.RichTextCommand; import org.dominokit.domino.ui.utils.DominoDom; @@ -46,20 +44,20 @@ public class BackColorCommand extends RichTextCommand { /** * Factory method to create a new instance of BackColorCommand. * - * @param editableElement The div element where the rich text is edited. + * @param isRichTextEditor The div element where the rich text is edited. * @return A new instance of BackColorCommand. */ - public static BackColorCommand create(DivElement editableElement) { - return new BackColorCommand(editableElement); + public static BackColorCommand create(IsRichTextEditor isRichTextEditor) { + return new BackColorCommand(isRichTextEditor); } /** * Constructs a new BackColorCommand instance for the specified editable element. * - * @param editableElement The div element where the rich text is edited. + * @param isRichTextEditor The div element where the rich text is edited. */ - public BackColorCommand(DivElement editableElement) { - super(editableElement); + public BackColorCommand(IsRichTextEditor isRichTextEditor) { + super(isRichTextEditor); this.backgroundColorPicker = BackgroundColorPicker.create() .setTooltip(getLabels().backgroundColor()) diff --git a/domino-ui/src/main/java/org/dominokit/domino/ui/richtext/commands/BoldCommand.java b/domino-ui/src/main/java/org/dominokit/domino/ui/richtext/commands/BoldCommand.java index efe53e8fd..73704c6dd 100644 --- a/domino-ui/src/main/java/org/dominokit/domino/ui/richtext/commands/BoldCommand.java +++ b/domino-ui/src/main/java/org/dominokit/domino/ui/richtext/commands/BoldCommand.java @@ -15,12 +15,10 @@ */ package org.dominokit.domino.ui.richtext.commands; -import static org.dominokit.domino.ui.utils.Domino.*; - import elemental2.dom.HTMLElement; import org.dominokit.domino.ui.button.Button; -import org.dominokit.domino.ui.elements.DivElement; import org.dominokit.domino.ui.icons.lib.Icons; +import org.dominokit.domino.ui.richtext.IsRichTextEditor; import org.dominokit.domino.ui.richtext.RichTextCommand; import org.dominokit.domino.ui.utils.DominoDom; @@ -46,20 +44,20 @@ public class BoldCommand extends RichTextCommand { /** * Factory method to create a new instance of BoldCommand. * - * @param editableElement The div element where the rich text is edited. + * @param isRichTextEditor The div element where the rich text is edited. * @return A new instance of BoldCommand. */ - public static BoldCommand create(DivElement editableElement) { - return new BoldCommand(editableElement); + public static BoldCommand create(IsRichTextEditor isRichTextEditor) { + return new BoldCommand(isRichTextEditor); } /** * Constructs a new BoldCommand instance for the specified editable element. * - * @param editableElement The div element where the rich text is edited. + * @param isRichTextEditor The div element where the rich text is edited. */ - public BoldCommand(DivElement editableElement) { - super(editableElement); + public BoldCommand(IsRichTextEditor isRichTextEditor) { + super(isRichTextEditor); this.button = Button.create(Icons.format_bold()) .setTooltip(getLabels().bold()) diff --git a/domino-ui/src/main/java/org/dominokit/domino/ui/richtext/commands/CopyCommand.java b/domino-ui/src/main/java/org/dominokit/domino/ui/richtext/commands/CopyCommand.java index fc3a4312f..26be240d9 100644 --- a/domino-ui/src/main/java/org/dominokit/domino/ui/richtext/commands/CopyCommand.java +++ b/domino-ui/src/main/java/org/dominokit/domino/ui/richtext/commands/CopyCommand.java @@ -15,12 +15,10 @@ */ package org.dominokit.domino.ui.richtext.commands; -import static org.dominokit.domino.ui.utils.Domino.*; - import elemental2.dom.HTMLElement; import org.dominokit.domino.ui.button.Button; -import org.dominokit.domino.ui.elements.DivElement; import org.dominokit.domino.ui.icons.lib.Icons; +import org.dominokit.domino.ui.richtext.IsRichTextEditor; import org.dominokit.domino.ui.richtext.RichTextCommand; import org.dominokit.domino.ui.utils.DominoDom; @@ -45,20 +43,20 @@ public class CopyCommand extends RichTextCommand { /** * Factory method to create a new instance of CopyCommand. * - * @param editableElement The div element where the rich text is edited. + * @param isRichTextEditor The div element where the rich text is edited. * @return A new instance of CopyCommand. */ - public static CopyCommand create(DivElement editableElement) { - return new CopyCommand(editableElement); + public static CopyCommand create(IsRichTextEditor isRichTextEditor) { + return new CopyCommand(isRichTextEditor); } /** * Constructs a new CopyCommand instance for the specified editable element. * - * @param editableElement The div element where the rich text is edited. + * @param isRichTextEditor The div element where the rich text is edited. */ - public CopyCommand(DivElement editableElement) { - super(editableElement); + public CopyCommand(IsRichTextEditor isRichTextEditor) { + super(isRichTextEditor); this.button = Button.create(Icons.content_copy()) .setTooltip(getLabels().copy()) diff --git a/domino-ui/src/main/java/org/dominokit/domino/ui/richtext/commands/CutCommand.java b/domino-ui/src/main/java/org/dominokit/domino/ui/richtext/commands/CutCommand.java index 5d1b4163b..9933ecedf 100644 --- a/domino-ui/src/main/java/org/dominokit/domino/ui/richtext/commands/CutCommand.java +++ b/domino-ui/src/main/java/org/dominokit/domino/ui/richtext/commands/CutCommand.java @@ -15,12 +15,10 @@ */ package org.dominokit.domino.ui.richtext.commands; -import static org.dominokit.domino.ui.utils.Domino.*; - import elemental2.dom.HTMLElement; import org.dominokit.domino.ui.button.Button; -import org.dominokit.domino.ui.elements.DivElement; import org.dominokit.domino.ui.icons.lib.Icons; +import org.dominokit.domino.ui.richtext.IsRichTextEditor; import org.dominokit.domino.ui.richtext.RichTextCommand; import org.dominokit.domino.ui.utils.DominoDom; @@ -46,20 +44,20 @@ public class CutCommand extends RichTextCommand { /** * Factory method to create a new instance of CutCommand. * - * @param editableElement The div element where the rich text is edited. + * @param isRichTextEditor The div element where the rich text is edited. * @return A new instance of CutCommand. */ - public static CutCommand create(DivElement editableElement) { - return new CutCommand(editableElement); + public static CutCommand create(IsRichTextEditor isRichTextEditor) { + return new CutCommand(isRichTextEditor); } /** * Constructs a new CutCommand instance for the specified editable element. * - * @param editableElement The div element where the rich text is edited. + * @param isRichTextEditor The div element where the rich text is edited. */ - public CutCommand(DivElement editableElement) { - super(editableElement); + public CutCommand(IsRichTextEditor isRichTextEditor) { + super(isRichTextEditor); this.button = Button.create(Icons.content_cut()) .setTooltip(getLabels().cut()) diff --git a/domino-ui/src/main/java/org/dominokit/domino/ui/richtext/commands/DecreaseFontCommand.java b/domino-ui/src/main/java/org/dominokit/domino/ui/richtext/commands/DecreaseFontCommand.java index ada285986..2ba4f9544 100644 --- a/domino-ui/src/main/java/org/dominokit/domino/ui/richtext/commands/DecreaseFontCommand.java +++ b/domino-ui/src/main/java/org/dominokit/domino/ui/richtext/commands/DecreaseFontCommand.java @@ -15,12 +15,10 @@ */ package org.dominokit.domino.ui.richtext.commands; -import static org.dominokit.domino.ui.utils.Domino.*; - import elemental2.dom.HTMLElement; import org.dominokit.domino.ui.button.Button; -import org.dominokit.domino.ui.elements.DivElement; import org.dominokit.domino.ui.icons.lib.Icons; +import org.dominokit.domino.ui.richtext.IsRichTextEditor; import org.dominokit.domino.ui.richtext.RichTextCommand; import org.dominokit.domino.ui.utils.Counter; import org.dominokit.domino.ui.utils.DominoDom; @@ -49,23 +47,21 @@ public class DecreaseFontCommand extends RichTextCommand { /** * Factory method to create a new instance of DecreaseFontCommand. * - * @param editableElement The div element where the rich text is edited. - * @param fontSize The counter to keep track of the font size. + * @param isRichTextEditor The div element where the rich text is edited. * @return A new instance of DecreaseFontCommand. */ - public static DecreaseFontCommand create(DivElement editableElement, Counter fontSize) { - return new DecreaseFontCommand(editableElement, fontSize); + public static DecreaseFontCommand create(IsRichTextEditor isRichTextEditor) { + return new DecreaseFontCommand(isRichTextEditor); } /** * Constructs a new DecreaseFontCommand instance for the specified editable element. * - * @param editableElement The div element where the rich text is edited. - * @param fontSize The counter to keep track of the font size. + * @param isRichTextEditor The div element where the rich text is edited. */ - public DecreaseFontCommand(DivElement editableElement, Counter fontSize) { - super(editableElement); - this.fontSize = fontSize; + public DecreaseFontCommand(IsRichTextEditor isRichTextEditor) { + super(isRichTextEditor); + this.fontSize = isRichTextEditor.getDefaultFontSizeCounter(); this.button = Button.create(Icons.format_font_size_decrease()) .setTooltip(getLabels().decreaseFontSize()) diff --git a/domino-ui/src/main/java/org/dominokit/domino/ui/richtext/commands/FontNameCommand.java b/domino-ui/src/main/java/org/dominokit/domino/ui/richtext/commands/FontNameCommand.java index 4788d9e4c..5fabbebc0 100644 --- a/domino-ui/src/main/java/org/dominokit/domino/ui/richtext/commands/FontNameCommand.java +++ b/domino-ui/src/main/java/org/dominokit/domino/ui/richtext/commands/FontNameCommand.java @@ -18,8 +18,8 @@ import static org.dominokit.domino.ui.utils.Domino.*; import elemental2.dom.HTMLElement; -import org.dominokit.domino.ui.elements.DivElement; import org.dominokit.domino.ui.richtext.FontPicker; +import org.dominokit.domino.ui.richtext.IsRichTextEditor; import org.dominokit.domino.ui.richtext.RichTextCommand; import org.dominokit.domino.ui.utils.DominoDom; @@ -47,20 +47,20 @@ public class FontNameCommand extends RichTextCommand { /** * Factory method to create a new instance of FontNameCommand. * - * @param editableElement The div element where the rich text is edited. + * @param isRichTextEditor The div element where the rich text is edited. * @return A new instance of FontNameCommand. */ - public static FontNameCommand create(DivElement editableElement) { - return new FontNameCommand(editableElement); + public static FontNameCommand create(IsRichTextEditor isRichTextEditor) { + return new FontNameCommand(isRichTextEditor); } /** * Constructs a new FontNameCommand instance for the specified editable element. * - * @param editableElement The div element where the rich text is edited. + * @param isRichTextEditor The div element where the rich text is edited. */ - public FontNameCommand(DivElement editableElement) { - super(editableElement); + public FontNameCommand(IsRichTextEditor isRichTextEditor) { + super(isRichTextEditor); this.fontPicker = FontPicker.create() .setTooltip(getLabels().fontFamily()) diff --git a/domino-ui/src/main/java/org/dominokit/domino/ui/richtext/commands/ForeColorCommand.java b/domino-ui/src/main/java/org/dominokit/domino/ui/richtext/commands/ForeColorCommand.java index 0a963fbff..8d36c6e23 100644 --- a/domino-ui/src/main/java/org/dominokit/domino/ui/richtext/commands/ForeColorCommand.java +++ b/domino-ui/src/main/java/org/dominokit/domino/ui/richtext/commands/ForeColorCommand.java @@ -18,9 +18,9 @@ import static org.dominokit.domino.ui.utils.Domino.*; import elemental2.dom.HTMLElement; -import org.dominokit.domino.ui.elements.DivElement; import org.dominokit.domino.ui.richtext.ColorPickerButton; import org.dominokit.domino.ui.richtext.ForegroundColorPicker; +import org.dominokit.domino.ui.richtext.IsRichTextEditor; import org.dominokit.domino.ui.richtext.RichTextCommand; import org.dominokit.domino.ui.utils.DominoDom; @@ -47,20 +47,20 @@ public class ForeColorCommand extends RichTextCommand { /** * Factory method to create a new instance of ForeColorCommand. * - * @param editableElement The div element where the rich text is edited. + * @param isRichTextEditor The div element where the rich text is edited. * @return A new instance of ForeColorCommand. */ - public static ForeColorCommand create(DivElement editableElement) { - return new ForeColorCommand(editableElement); + public static ForeColorCommand create(IsRichTextEditor isRichTextEditor) { + return new ForeColorCommand(isRichTextEditor); } /** * Constructs a new ForeColorCommand instance for the specified editable element. * - * @param editableElement The div element where the rich text is edited. + * @param isRichTextEditor The div element where the rich text is edited. */ - public ForeColorCommand(DivElement editableElement) { - super(editableElement); + public ForeColorCommand(IsRichTextEditor isRichTextEditor) { + super(isRichTextEditor); this.foregroundColorPicker = ForegroundColorPicker.create() .setTooltip(getLabels().foreColor()) diff --git a/domino-ui/src/main/java/org/dominokit/domino/ui/richtext/commands/HeadingCommand.java b/domino-ui/src/main/java/org/dominokit/domino/ui/richtext/commands/HeadingCommand.java index e68000d82..bd7e13aa0 100644 --- a/domino-ui/src/main/java/org/dominokit/domino/ui/richtext/commands/HeadingCommand.java +++ b/domino-ui/src/main/java/org/dominokit/domino/ui/richtext/commands/HeadingCommand.java @@ -21,11 +21,11 @@ import org.dominokit.domino.ui.button.Button; import org.dominokit.domino.ui.button.DropdownButton; import org.dominokit.domino.ui.button.group.ButtonsGroup; -import org.dominokit.domino.ui.elements.DivElement; import org.dominokit.domino.ui.icons.lib.Icons; import org.dominokit.domino.ui.menu.CustomMenuItem; import org.dominokit.domino.ui.menu.Menu; import org.dominokit.domino.ui.menu.direction.DropDirection; +import org.dominokit.domino.ui.richtext.IsRichTextEditor; import org.dominokit.domino.ui.richtext.RichTextCommand; import org.dominokit.domino.ui.utils.DominoDom; @@ -53,20 +53,20 @@ public class HeadingCommand extends RichTextCommand { /** * Factory method to create a new instance of HeadingCommand. * - * @param editableElement The div element where the rich text is edited. + * @param isRichTextEditor The div element where the rich text is edited. * @return A new instance of HeadingCommand. */ - public static HeadingCommand create(DivElement editableElement) { - return new HeadingCommand(editableElement); + public static HeadingCommand create(IsRichTextEditor isRichTextEditor) { + return new HeadingCommand(isRichTextEditor); } /** * Constructs a new HeadingCommand instance for the specified editable element. * - * @param editableElement The div element where the rich text is edited. + * @param isRichTextEditor The div element where the rich text is edited. */ - public HeadingCommand(DivElement editableElement) { - super(editableElement); + public HeadingCommand(IsRichTextEditor isRichTextEditor) { + super(isRichTextEditor); this.button = ButtonsGroup.create( mainButton = diff --git a/domino-ui/src/main/java/org/dominokit/domino/ui/richtext/commands/HiliteColorCommand.java b/domino-ui/src/main/java/org/dominokit/domino/ui/richtext/commands/HiliteColorCommand.java index ba8bdf0df..564bb2143 100644 --- a/domino-ui/src/main/java/org/dominokit/domino/ui/richtext/commands/HiliteColorCommand.java +++ b/domino-ui/src/main/java/org/dominokit/domino/ui/richtext/commands/HiliteColorCommand.java @@ -18,9 +18,9 @@ import static org.dominokit.domino.ui.utils.Domino.*; import elemental2.dom.HTMLElement; -import org.dominokit.domino.ui.elements.DivElement; import org.dominokit.domino.ui.richtext.ColorPickerButton; import org.dominokit.domino.ui.richtext.HiliteColorPicker; +import org.dominokit.domino.ui.richtext.IsRichTextEditor; import org.dominokit.domino.ui.richtext.RichTextCommand; import org.dominokit.domino.ui.utils.DominoDom; @@ -46,20 +46,20 @@ public class HiliteColorCommand extends RichTextCommand { /** * Factory method to create a new instance of HiliteColorCommand. * - * @param editableElement The div element where the rich text is edited. + * @param isRichTextEditor The div element where the rich text is edited. * @return A new instance of HiliteColorCommand. */ - public static HiliteColorCommand create(DivElement editableElement) { - return new HiliteColorCommand(editableElement); + public static HiliteColorCommand create(IsRichTextEditor isRichTextEditor) { + return new HiliteColorCommand(isRichTextEditor); } /** * Constructs a new HiliteColorCommand instance for the specified editable element. * - * @param editableElement The div element where the rich text is edited. + * @param isRichTextEditor The div element where the rich text is edited. */ - public HiliteColorCommand(DivElement editableElement) { - super(editableElement); + public HiliteColorCommand(IsRichTextEditor isRichTextEditor) { + super(isRichTextEditor); this.foregroundColorPicker = HiliteColorPicker.create() .setTooltip(getLabels().highlightColor()) diff --git a/domino-ui/src/main/java/org/dominokit/domino/ui/richtext/commands/HorizontalRuleCommand.java b/domino-ui/src/main/java/org/dominokit/domino/ui/richtext/commands/HorizontalRuleCommand.java index 25030863e..7dc08ae57 100644 --- a/domino-ui/src/main/java/org/dominokit/domino/ui/richtext/commands/HorizontalRuleCommand.java +++ b/domino-ui/src/main/java/org/dominokit/domino/ui/richtext/commands/HorizontalRuleCommand.java @@ -19,8 +19,8 @@ import elemental2.dom.HTMLElement; import org.dominokit.domino.ui.button.Button; -import org.dominokit.domino.ui.elements.DivElement; import org.dominokit.domino.ui.icons.lib.Icons; +import org.dominokit.domino.ui.richtext.IsRichTextEditor; import org.dominokit.domino.ui.richtext.RichTextCommand; import org.dominokit.domino.ui.utils.DominoDom; @@ -45,20 +45,20 @@ public class HorizontalRuleCommand extends RichTextCommand { /** * Factory method to create a new instance of IncreaseFontCommand. * - * @param editableElement The div element where the rich text is edited. - * @param fontSize A counter to manage the font size incrementally. + * @param isRichTextEditor The div element where the rich text is edited. * @return A new instance of IncreaseFontCommand. */ - public static IncreaseFontCommand create(DivElement editableElement, Counter fontSize) { - return new IncreaseFontCommand(editableElement, fontSize); + public static IncreaseFontCommand create(IsRichTextEditor isRichTextEditor) { + return new IncreaseFontCommand(isRichTextEditor); } /** * Constructs a new IncreaseFontCommand instance for the specified editable element and font size * counter. * - * @param editableElement The div element where the rich text is edited. - * @param fontSize A counter to manage the font size incrementally. + * @param isRichTextEditor The div element where the rich text is edited. */ - public IncreaseFontCommand(DivElement editableElement, Counter fontSize) { - super(editableElement); - this.fontSize = fontSize; + public IncreaseFontCommand(IsRichTextEditor isRichTextEditor) { + super(isRichTextEditor); + this.fontSize = isRichTextEditor.getDefaultFontSizeCounter(); this.button = Button.create(Icons.format_font_size_increase()) .setTooltip(getLabels().increaseFontSize()) diff --git a/domino-ui/src/main/java/org/dominokit/domino/ui/richtext/commands/IndentCommand.java b/domino-ui/src/main/java/org/dominokit/domino/ui/richtext/commands/IndentCommand.java index f7cdbaa03..dd6e8285d 100644 --- a/domino-ui/src/main/java/org/dominokit/domino/ui/richtext/commands/IndentCommand.java +++ b/domino-ui/src/main/java/org/dominokit/domino/ui/richtext/commands/IndentCommand.java @@ -19,8 +19,8 @@ import elemental2.dom.HTMLElement; import org.dominokit.domino.ui.button.Button; -import org.dominokit.domino.ui.elements.DivElement; import org.dominokit.domino.ui.icons.lib.Icons; +import org.dominokit.domino.ui.richtext.IsRichTextEditor; import org.dominokit.domino.ui.richtext.RichTextCommand; import org.dominokit.domino.ui.utils.DominoDom; @@ -45,20 +45,20 @@ public class IndentCommand extends RichTextCommand { /** * Factory method to create a new instance of IndentCommand. * - * @param editableElement The div element where the rich text is edited. + * @param isRichTextEditor The div element where the rich text is edited. * @return A new instance of IndentCommand. */ - public static IndentCommand create(DivElement editableElement) { - return new IndentCommand(editableElement); + public static IndentCommand create(IsRichTextEditor isRichTextEditor) { + return new IndentCommand(isRichTextEditor); } /** * Constructs a new IndentCommand instance for the specified editable div element. * - * @param editableElement The div element where the rich text is edited. + * @param isRichTextEditor The div element where the rich text is edited. */ - public IndentCommand(DivElement editableElement) { - super(editableElement); + public IndentCommand(IsRichTextEditor isRichTextEditor) { + super(isRichTextEditor); this.button = Button.create(Icons.format_indent_increase()) .setTooltip(getLabels().increaseIndent()) diff --git a/domino-ui/src/main/java/org/dominokit/domino/ui/richtext/commands/InsertHtmlCommand.java b/domino-ui/src/main/java/org/dominokit/domino/ui/richtext/commands/InsertHtmlCommand.java index 0e92e5662..2eae8ee7a 100644 --- a/domino-ui/src/main/java/org/dominokit/domino/ui/richtext/commands/InsertHtmlCommand.java +++ b/domino-ui/src/main/java/org/dominokit/domino/ui/richtext/commands/InsertHtmlCommand.java @@ -26,6 +26,7 @@ import org.dominokit.domino.ui.elements.DivElement; import org.dominokit.domino.ui.forms.TextAreaBox; import org.dominokit.domino.ui.icons.lib.Icons; +import org.dominokit.domino.ui.richtext.IsRichTextEditor; import org.dominokit.domino.ui.richtext.RichTextCommand; import org.dominokit.domino.ui.utils.DOMParser; @@ -56,21 +57,21 @@ public class InsertHtmlCommand extends RichTextCommand { /** * Factory method to create a new instance of InsertHtmlCommand. * - * @param editableElement The div element where the rich text is edited. + * @param isRichTextEditor The div element where the rich text is edited. * @return A new instance of InsertHtmlCommand. */ - public static InsertHtmlCommand create(DivElement editableElement) { - return new InsertHtmlCommand(editableElement); + public static InsertHtmlCommand create(IsRichTextEditor isRichTextEditor) { + return new InsertHtmlCommand(isRichTextEditor); } /** * Constructs a new InsertHtmlCommand instance for the specified editable div element. * - * @param editableElement The div element where the rich text is edited. + * @param isRichTextEditor The div element where the rich text is edited. */ - public InsertHtmlCommand(DivElement editableElement) { - super(editableElement); - this.editableElement = editableElement; + public InsertHtmlCommand(IsRichTextEditor isRichTextEditor) { + super(isRichTextEditor); + this.editableElement = isRichTextEditor.getEditableElement(); this.dialog = ConfirmationDialog.create() diff --git a/domino-ui/src/main/java/org/dominokit/domino/ui/richtext/commands/InsertImageCommand.java b/domino-ui/src/main/java/org/dominokit/domino/ui/richtext/commands/InsertImageCommand.java index 6594dedad..f2ef58d1f 100644 --- a/domino-ui/src/main/java/org/dominokit/domino/ui/richtext/commands/InsertImageCommand.java +++ b/domino-ui/src/main/java/org/dominokit/domino/ui/richtext/commands/InsertImageCommand.java @@ -22,9 +22,9 @@ import org.dominokit.domino.ui.button.Button; import org.dominokit.domino.ui.dialogs.ConfirmationDialog; import org.dominokit.domino.ui.dialogs.DialogSize; -import org.dominokit.domino.ui.elements.DivElement; import org.dominokit.domino.ui.forms.UploadBox; import org.dominokit.domino.ui.icons.lib.Icons; +import org.dominokit.domino.ui.richtext.IsRichTextEditor; import org.dominokit.domino.ui.richtext.RichTextCommand; import org.dominokit.domino.ui.utils.URL; @@ -55,20 +55,20 @@ public class InsertImageCommand extends RichTextCommand { /** * Factory method to create a new instance of InsertImageCommand. * - * @param editableElement The div element where the rich text is edited. + * @param isRichTextEditor The div element where the rich text is edited. * @return A new instance of InsertImageCommand. */ - public static InsertImageCommand create(DivElement editableElement) { - return new InsertImageCommand(editableElement); + public static InsertImageCommand create(IsRichTextEditor isRichTextEditor) { + return new InsertImageCommand(isRichTextEditor); } /** * Constructs a new InsertImageCommand instance for the specified editable div element. * - * @param editableElement The div element where the rich text is edited. + * @param isRichTextEditor The div element where the rich text is edited. */ - public InsertImageCommand(DivElement editableElement) { - super(editableElement); + public InsertImageCommand(IsRichTextEditor isRichTextEditor) { + super(isRichTextEditor); this.dialog = ConfirmationDialog.create() .setStretchWidth(DialogSize.MEDIUM) diff --git a/domino-ui/src/main/java/org/dominokit/domino/ui/richtext/commands/InsertImageLinkCommand.java b/domino-ui/src/main/java/org/dominokit/domino/ui/richtext/commands/InsertImageLinkCommand.java index 0c1121bbc..2cd51894d 100644 --- a/domino-ui/src/main/java/org/dominokit/domino/ui/richtext/commands/InsertImageLinkCommand.java +++ b/domino-ui/src/main/java/org/dominokit/domino/ui/richtext/commands/InsertImageLinkCommand.java @@ -23,9 +23,9 @@ import org.dominokit.domino.ui.button.Button; import org.dominokit.domino.ui.dialogs.ConfirmationDialog; import org.dominokit.domino.ui.dialogs.DialogSize; -import org.dominokit.domino.ui.elements.DivElement; import org.dominokit.domino.ui.forms.TextBox; import org.dominokit.domino.ui.icons.lib.Icons; +import org.dominokit.domino.ui.richtext.IsRichTextEditor; import org.dominokit.domino.ui.richtext.RichTextCommand; /** @@ -54,20 +54,20 @@ public class InsertImageLinkCommand extends RichTextCommand { /** * Factory method to create a new instance of InsertLinkCommand. * - * @param editableElement The div element where the rich text is edited. + * @param isRichTextEditor The div element where the rich text is edited. * @return A new instance of InsertLinkCommand. */ - public static InsertLinkCommand create(DivElement editableElement) { - return new InsertLinkCommand(editableElement); + public static InsertLinkCommand create(IsRichTextEditor isRichTextEditor) { + return new InsertLinkCommand(isRichTextEditor); } /** * Constructs a new InsertLinkCommand instance for the specified editable div element. * - * @param editableElement The div element where the rich text is edited. + * @param isRichTextEditor The div element where the rich text is edited. */ - public InsertLinkCommand(DivElement editableElement) { - super(editableElement); + public InsertLinkCommand(IsRichTextEditor isRichTextEditor) { + super(isRichTextEditor); this.dialog = ConfirmationDialog.create() .setStretchWidth(DialogSize.MEDIUM) diff --git a/domino-ui/src/main/java/org/dominokit/domino/ui/richtext/commands/InsertOrderedListCommand.java b/domino-ui/src/main/java/org/dominokit/domino/ui/richtext/commands/InsertOrderedListCommand.java index 663403121..d692b90f5 100644 --- a/domino-ui/src/main/java/org/dominokit/domino/ui/richtext/commands/InsertOrderedListCommand.java +++ b/domino-ui/src/main/java/org/dominokit/domino/ui/richtext/commands/InsertOrderedListCommand.java @@ -19,8 +19,8 @@ import elemental2.dom.HTMLElement; import org.dominokit.domino.ui.button.Button; -import org.dominokit.domino.ui.elements.DivElement; import org.dominokit.domino.ui.icons.lib.Icons; +import org.dominokit.domino.ui.richtext.IsRichTextEditor; import org.dominokit.domino.ui.richtext.RichTextCommand; import org.dominokit.domino.ui.utils.DominoDom; @@ -47,20 +47,20 @@ public class InsertOrderedListCommand extends RichTextCommand { /** * Factory method to create a new instance of ItalicCommand. * - * @param editableElement The div element where the rich text is edited. + * @param isRichTextEditor The div element where the rich text is edited. * @return A new instance of ItalicCommand. */ - public static ItalicCommand create(DivElement editableElement) { - return new ItalicCommand(editableElement); + public static ItalicCommand create(IsRichTextEditor isRichTextEditor) { + return new ItalicCommand(isRichTextEditor); } /** * Constructs a new ItalicCommand instance for the specified editable div element. * - * @param editableElement The div element where the rich text is edited. + * @param isRichTextEditor The div element where the rich text is edited. */ - public ItalicCommand(DivElement editableElement) { - super(editableElement); + public ItalicCommand(IsRichTextEditor isRichTextEditor) { + super(isRichTextEditor); this.button = Button.create(Icons.format_italic()) .setTooltip(getLabels().italic()) diff --git a/domino-ui/src/main/java/org/dominokit/domino/ui/richtext/commands/JustifyCenterCommand.java b/domino-ui/src/main/java/org/dominokit/domino/ui/richtext/commands/JustifyCenterCommand.java index 0d005c185..f0817f632 100644 --- a/domino-ui/src/main/java/org/dominokit/domino/ui/richtext/commands/JustifyCenterCommand.java +++ b/domino-ui/src/main/java/org/dominokit/domino/ui/richtext/commands/JustifyCenterCommand.java @@ -19,8 +19,8 @@ import elemental2.dom.HTMLElement; import org.dominokit.domino.ui.button.Button; -import org.dominokit.domino.ui.elements.DivElement; import org.dominokit.domino.ui.icons.lib.Icons; +import org.dominokit.domino.ui.richtext.IsRichTextEditor; import org.dominokit.domino.ui.richtext.RichTextCommand; import org.dominokit.domino.ui.utils.DominoDom; @@ -47,20 +47,20 @@ public class JustifyCenterCommand extends RichTextCommand /** * Factory method to create a new instance of JustifyCenterCommand. * - * @param editableElement The div element where the rich text is edited. + * @param isRichTextEditor The div element where the rich text is edited. * @return A new instance of JustifyCenterCommand. */ - public static JustifyCenterCommand create(DivElement editableElement) { - return new JustifyCenterCommand(editableElement); + public static JustifyCenterCommand create(IsRichTextEditor isRichTextEditor) { + return new JustifyCenterCommand(isRichTextEditor); } /** * Constructs a new JustifyCenterCommand instance for the specified editable div element. * - * @param editableElement The div element where the rich text is edited. + * @param isRichTextEditor The div element where the rich text is edited. */ - public JustifyCenterCommand(DivElement editableElement) { - super(editableElement); + public JustifyCenterCommand(IsRichTextEditor isRichTextEditor) { + super(isRichTextEditor); this.button = Button.create(Icons.format_align_center()) .setTooltip(getLabels().justifyCenter()) diff --git a/domino-ui/src/main/java/org/dominokit/domino/ui/richtext/commands/JustifyFullCommand.java b/domino-ui/src/main/java/org/dominokit/domino/ui/richtext/commands/JustifyFullCommand.java index 10910986f..afe37ef9e 100644 --- a/domino-ui/src/main/java/org/dominokit/domino/ui/richtext/commands/JustifyFullCommand.java +++ b/domino-ui/src/main/java/org/dominokit/domino/ui/richtext/commands/JustifyFullCommand.java @@ -19,8 +19,8 @@ import elemental2.dom.HTMLElement; import org.dominokit.domino.ui.button.Button; -import org.dominokit.domino.ui.elements.DivElement; import org.dominokit.domino.ui.icons.lib.Icons; +import org.dominokit.domino.ui.richtext.IsRichTextEditor; import org.dominokit.domino.ui.richtext.RichTextCommand; import org.dominokit.domino.ui.utils.DominoDom; @@ -47,20 +47,20 @@ public class JustifyFullCommand extends RichTextCommand { /** * Factory method to create a new instance of JustifyFullCommand. * - * @param editableElement The div element where the rich text is edited. + * @param isRichTextEditor The div element where the rich text is edited. * @return A new instance of JustifyFullCommand. */ - public static JustifyFullCommand create(DivElement editableElement) { - return new JustifyFullCommand(editableElement); + public static JustifyFullCommand create(IsRichTextEditor isRichTextEditor) { + return new JustifyFullCommand(isRichTextEditor); } /** * Constructs a new JustifyFullCommand instance for the specified editable div element. * - * @param editableElement The div element where the rich text is edited. + * @param isRichTextEditor The div element where the rich text is edited. */ - public JustifyFullCommand(DivElement editableElement) { - super(editableElement); + public JustifyFullCommand(IsRichTextEditor isRichTextEditor) { + super(isRichTextEditor); this.button = Button.create(Icons.format_align_justify()) .setTooltip(getLabels().justify()) diff --git a/domino-ui/src/main/java/org/dominokit/domino/ui/richtext/commands/JustifyLeftCommand.java b/domino-ui/src/main/java/org/dominokit/domino/ui/richtext/commands/JustifyLeftCommand.java index f55e6b2ae..c5ac6649a 100644 --- a/domino-ui/src/main/java/org/dominokit/domino/ui/richtext/commands/JustifyLeftCommand.java +++ b/domino-ui/src/main/java/org/dominokit/domino/ui/richtext/commands/JustifyLeftCommand.java @@ -19,8 +19,8 @@ import elemental2.dom.HTMLElement; import org.dominokit.domino.ui.button.Button; -import org.dominokit.domino.ui.elements.DivElement; import org.dominokit.domino.ui.icons.lib.Icons; +import org.dominokit.domino.ui.richtext.IsRichTextEditor; import org.dominokit.domino.ui.richtext.RichTextCommand; import org.dominokit.domino.ui.utils.DominoDom; @@ -47,20 +47,20 @@ public class JustifyLeftCommand extends RichTextCommand { /** * Factory method to create a new instance of JustifyLeftCommand. * - * @param editableElement The div element where the rich text is edited. + * @param isRichTextEditor The div element where the rich text is edited. * @return A new instance of JustifyLeftCommand. */ - public static JustifyLeftCommand create(DivElement editableElement) { - return new JustifyLeftCommand(editableElement); + public static JustifyLeftCommand create(IsRichTextEditor isRichTextEditor) { + return new JustifyLeftCommand(isRichTextEditor); } /** * Constructs a new JustifyLeftCommand instance for the specified editable div element. * - * @param editableElement The div element where the rich text is edited. + * @param isRichTextEditor The div element where the rich text is edited. */ - public JustifyLeftCommand(DivElement editableElement) { - super(editableElement); + public JustifyLeftCommand(IsRichTextEditor isRichTextEditor) { + super(isRichTextEditor); this.button = Button.create(Icons.format_align_left()) .setTooltip(getLabels().justifyLeft()) diff --git a/domino-ui/src/main/java/org/dominokit/domino/ui/richtext/commands/JustifyRightCommand.java b/domino-ui/src/main/java/org/dominokit/domino/ui/richtext/commands/JustifyRightCommand.java index e8dcfeceb..90e9865e3 100644 --- a/domino-ui/src/main/java/org/dominokit/domino/ui/richtext/commands/JustifyRightCommand.java +++ b/domino-ui/src/main/java/org/dominokit/domino/ui/richtext/commands/JustifyRightCommand.java @@ -19,8 +19,8 @@ import elemental2.dom.HTMLElement; import org.dominokit.domino.ui.button.Button; -import org.dominokit.domino.ui.elements.DivElement; import org.dominokit.domino.ui.icons.lib.Icons; +import org.dominokit.domino.ui.richtext.IsRichTextEditor; import org.dominokit.domino.ui.richtext.RichTextCommand; import org.dominokit.domino.ui.utils.DominoDom; @@ -47,20 +47,20 @@ public class JustifyRightCommand extends RichTextCommand { /** * Factory method to create a new instance of JustifyRightCommand. * - * @param editableElement The div element where the rich text is edited. + * @param isRichTextEditor The div element where the rich text is edited. * @return A new instance of JustifyRightCommand. */ - public static JustifyRightCommand create(DivElement editableElement) { - return new JustifyRightCommand(editableElement); + public static JustifyRightCommand create(IsRichTextEditor isRichTextEditor) { + return new JustifyRightCommand(isRichTextEditor); } /** * Constructs a new JustifyRightCommand instance for the specified editable div element. * - * @param editableElement The div element where the rich text is edited. + * @param isRichTextEditor The div element where the rich text is edited. */ - public JustifyRightCommand(DivElement editableElement) { - super(editableElement); + public JustifyRightCommand(IsRichTextEditor isRichTextEditor) { + super(isRichTextEditor); this.button = Button.create(Icons.format_align_right()) .setTooltip(getLabels().justifyRight()) diff --git a/domino-ui/src/main/java/org/dominokit/domino/ui/richtext/commands/OutdentCommand.java b/domino-ui/src/main/java/org/dominokit/domino/ui/richtext/commands/OutdentCommand.java index 838a56a8d..e3907c9dd 100644 --- a/domino-ui/src/main/java/org/dominokit/domino/ui/richtext/commands/OutdentCommand.java +++ b/domino-ui/src/main/java/org/dominokit/domino/ui/richtext/commands/OutdentCommand.java @@ -19,8 +19,8 @@ import elemental2.dom.HTMLElement; import org.dominokit.domino.ui.button.Button; -import org.dominokit.domino.ui.elements.DivElement; import org.dominokit.domino.ui.icons.lib.Icons; +import org.dominokit.domino.ui.richtext.IsRichTextEditor; import org.dominokit.domino.ui.richtext.RichTextCommand; import org.dominokit.domino.ui.utils.DominoDom; @@ -47,20 +47,20 @@ public class OutdentCommand extends RichTextCommand { /** * Factory method to create a new instance of OutdentCommand. * - * @param editableElement The div element where the rich text is edited. + * @param isRichTextEditor The div element where the rich text is edited. * @return A new instance of OutdentCommand. */ - public static OutdentCommand create(DivElement editableElement) { - return new OutdentCommand(editableElement); + public static OutdentCommand create(IsRichTextEditor isRichTextEditor) { + return new OutdentCommand(isRichTextEditor); } /** * Constructs a new OutdentCommand instance for the specified editable div element. * - * @param editableElement The div element where the rich text is edited. + * @param isRichTextEditor The div element where the rich text is edited. */ - public OutdentCommand(DivElement editableElement) { - super(editableElement); + public OutdentCommand(IsRichTextEditor isRichTextEditor) { + super(isRichTextEditor); this.button = Button.create(Icons.format_indent_decrease()) .setTooltip(getLabels().reduceIndent()) diff --git a/domino-ui/src/main/java/org/dominokit/domino/ui/richtext/commands/PasteCommand.java b/domino-ui/src/main/java/org/dominokit/domino/ui/richtext/commands/PasteCommand.java index b6ec5653d..c2d273ce6 100644 --- a/domino-ui/src/main/java/org/dominokit/domino/ui/richtext/commands/PasteCommand.java +++ b/domino-ui/src/main/java/org/dominokit/domino/ui/richtext/commands/PasteCommand.java @@ -21,8 +21,8 @@ import elemental2.dom.HTMLElement; import jsinterop.base.Js; import org.dominokit.domino.ui.button.Button; -import org.dominokit.domino.ui.elements.DivElement; import org.dominokit.domino.ui.icons.lib.Icons; +import org.dominokit.domino.ui.richtext.IsRichTextEditor; import org.dominokit.domino.ui.richtext.RichTextCommand; import org.dominokit.domino.ui.utils.DominoNavigator; @@ -52,26 +52,26 @@ public class PasteCommand extends RichTextCommand { /** * Factory method to create a new instance of PasteCommand. * - * @param editableElement The div element where the rich text is edited. + * @param isRichTextEditor The div element where the rich text is edited. * @return A new instance of PasteCommand. */ - public static PasteCommand create(DivElement editableElement) { - return new PasteCommand(editableElement); + public static PasteCommand create(IsRichTextEditor isRichTextEditor) { + return new PasteCommand(isRichTextEditor); } /** * Constructs a new PasteCommand instance for the specified editable div element. * - * @param editableElement The div element where the rich text is edited. + * @param isRichTextEditor The div element where the rich text is edited. */ - public PasteCommand(DivElement editableElement) { - super(editableElement); + public PasteCommand(IsRichTextEditor isRichTextEditor) { + super(isRichTextEditor); this.button = Button.create(Icons.content_paste()) .setTooltip(getLabels().paste()) .addClickListener( evt -> { - editableElement.element().focus(); + isRichTextEditor.getEditableElement().element().focus(); Js.uncheckedCast(DomGlobal.window.navigator) .clipboard .readText() diff --git a/domino-ui/src/main/java/org/dominokit/domino/ui/richtext/commands/RedoCommand.java b/domino-ui/src/main/java/org/dominokit/domino/ui/richtext/commands/RedoCommand.java index abe1a5cb2..5d1a6a19f 100644 --- a/domino-ui/src/main/java/org/dominokit/domino/ui/richtext/commands/RedoCommand.java +++ b/domino-ui/src/main/java/org/dominokit/domino/ui/richtext/commands/RedoCommand.java @@ -19,8 +19,8 @@ import elemental2.dom.HTMLElement; import org.dominokit.domino.ui.button.Button; -import org.dominokit.domino.ui.elements.DivElement; import org.dominokit.domino.ui.icons.lib.Icons; +import org.dominokit.domino.ui.richtext.IsRichTextEditor; import org.dominokit.domino.ui.richtext.RichTextCommand; import org.dominokit.domino.ui.utils.DominoDom; @@ -48,20 +48,20 @@ public class RedoCommand extends RichTextCommand { /** * Factory method to create a new instance of RedoCommand. * - * @param editableElement The div element where the rich text is edited. + * @param isRichTextEditor The div element where the rich text is edited. * @return A new instance of RedoCommand. */ - public static RedoCommand create(DivElement editableElement) { - return new RedoCommand(editableElement); + public static RedoCommand create(IsRichTextEditor isRichTextEditor) { + return new RedoCommand(isRichTextEditor); } /** * Constructs a new RedoCommand instance for the specified editable div element. * - * @param editableElement The div element where the rich text is edited. + * @param isRichTextEditor The div element where the rich text is edited. */ - public RedoCommand(DivElement editableElement) { - super(editableElement); + public RedoCommand(IsRichTextEditor isRichTextEditor) { + super(isRichTextEditor); this.button = Button.create(Icons.redo()) .setTooltip(getLabels().redo()) diff --git a/domino-ui/src/main/java/org/dominokit/domino/ui/richtext/commands/RemoveFormatCommand.java b/domino-ui/src/main/java/org/dominokit/domino/ui/richtext/commands/RemoveFormatCommand.java index 65fb0b5b3..5bbade482 100644 --- a/domino-ui/src/main/java/org/dominokit/domino/ui/richtext/commands/RemoveFormatCommand.java +++ b/domino-ui/src/main/java/org/dominokit/domino/ui/richtext/commands/RemoveFormatCommand.java @@ -19,8 +19,8 @@ import elemental2.dom.HTMLElement; import org.dominokit.domino.ui.button.Button; -import org.dominokit.domino.ui.elements.DivElement; import org.dominokit.domino.ui.icons.lib.Icons; +import org.dominokit.domino.ui.richtext.IsRichTextEditor; import org.dominokit.domino.ui.richtext.RichTextCommand; import org.dominokit.domino.ui.utils.DominoDom; @@ -49,20 +49,20 @@ public class RemoveFormatCommand extends RichTextCommand { /** * Factory method to create a new instance of RemoveFormatCommand. * - * @param editableElement The div element where the rich text is edited. + * @param isRichTextEditor The div element where the rich text is edited. * @return A new instance of RemoveFormatCommand. */ - public static RemoveFormatCommand create(DivElement editableElement) { - return new RemoveFormatCommand(editableElement); + public static RemoveFormatCommand create(IsRichTextEditor isRichTextEditor) { + return new RemoveFormatCommand(isRichTextEditor); } /** * Constructs a new RemoveFormatCommand instance for the specified editable div element. * - * @param editableElement The div element where the rich text is edited. + * @param isRichTextEditor The div element where the rich text is edited. */ - public RemoveFormatCommand(DivElement editableElement) { - super(editableElement); + public RemoveFormatCommand(IsRichTextEditor isRichTextEditor) { + super(isRichTextEditor); this.button = Button.create(Icons.format_color_marker_cancel()) .setTooltip(getLabels().removeFormat()) diff --git a/domino-ui/src/main/java/org/dominokit/domino/ui/richtext/commands/RemoveLinkCommand.java b/domino-ui/src/main/java/org/dominokit/domino/ui/richtext/commands/RemoveLinkCommand.java index f8e08877c..78d6b85d7 100644 --- a/domino-ui/src/main/java/org/dominokit/domino/ui/richtext/commands/RemoveLinkCommand.java +++ b/domino-ui/src/main/java/org/dominokit/domino/ui/richtext/commands/RemoveLinkCommand.java @@ -23,8 +23,8 @@ import elemental2.dom.HTMLElement; import elemental2.dom.NodeList; import org.dominokit.domino.ui.button.Button; -import org.dominokit.domino.ui.elements.DivElement; import org.dominokit.domino.ui.icons.lib.Icons; +import org.dominokit.domino.ui.richtext.IsRichTextEditor; import org.dominokit.domino.ui.richtext.RichTextCommand; /** @@ -52,20 +52,20 @@ public class RemoveLinkCommand extends RichTextCommand { /** * Factory method to create a new instance of RemoveFormatCommand. * - * @param editableElement The div element where the rich text is edited. + * @param isRichTextEditor The div element where the rich text is edited. * @return A new instance of RemoveFormatCommand. */ - public static RemoveLinkCommand create(DivElement editableElement) { - return new RemoveLinkCommand(editableElement); + public static RemoveLinkCommand create(IsRichTextEditor isRichTextEditor) { + return new RemoveLinkCommand(isRichTextEditor); } /** * Constructs a new RemoveFormatCommand instance for the specified editable div element. * - * @param editableElement The div element where the rich text is edited. + * @param isRichTextEditor The div element where the rich text is edited. */ - public RemoveLinkCommand(DivElement editableElement) { - super(editableElement); + public RemoveLinkCommand(IsRichTextEditor isRichTextEditor) { + super(isRichTextEditor); this.button = Button.create(Icons.link_off()) diff --git a/domino-ui/src/main/java/org/dominokit/domino/ui/richtext/commands/StrikeThroughCommand.java b/domino-ui/src/main/java/org/dominokit/domino/ui/richtext/commands/StrikeThroughCommand.java index 4439f854c..7285ca39d 100644 --- a/domino-ui/src/main/java/org/dominokit/domino/ui/richtext/commands/StrikeThroughCommand.java +++ b/domino-ui/src/main/java/org/dominokit/domino/ui/richtext/commands/StrikeThroughCommand.java @@ -19,8 +19,8 @@ import elemental2.dom.HTMLElement; import org.dominokit.domino.ui.button.Button; -import org.dominokit.domino.ui.elements.DivElement; import org.dominokit.domino.ui.icons.lib.Icons; +import org.dominokit.domino.ui.richtext.IsRichTextEditor; import org.dominokit.domino.ui.richtext.RichTextCommand; import org.dominokit.domino.ui.utils.DominoDom; @@ -49,20 +49,20 @@ public class StrikeThroughCommand extends RichTextCommand /** * Factory method to create a new instance of StrikeThroughCommand. * - * @param editableElement The div element where the rich text is edited. + * @param isRichTextEditor The div element where the rich text is edited. * @return A new instance of StrikeThroughCommand. */ - public static StrikeThroughCommand create(DivElement editableElement) { - return new StrikeThroughCommand(editableElement); + public static StrikeThroughCommand create(IsRichTextEditor isRichTextEditor) { + return new StrikeThroughCommand(isRichTextEditor); } /** * Constructs a new StrikeThroughCommand instance for the specified editable div element. * - * @param editableElement The div element where the rich text is edited. + * @param isRichTextEditor The div element where the rich text is edited. */ - public StrikeThroughCommand(DivElement editableElement) { - super(editableElement); + public StrikeThroughCommand(IsRichTextEditor isRichTextEditor) { + super(isRichTextEditor); this.button = Button.create(Icons.format_strikethrough()) .setTooltip(getLabels().strikeThrough()) diff --git a/domino-ui/src/main/java/org/dominokit/domino/ui/richtext/commands/SubscriptCommand.java b/domino-ui/src/main/java/org/dominokit/domino/ui/richtext/commands/SubscriptCommand.java index 7f2ffe36d..cd5431a7c 100644 --- a/domino-ui/src/main/java/org/dominokit/domino/ui/richtext/commands/SubscriptCommand.java +++ b/domino-ui/src/main/java/org/dominokit/domino/ui/richtext/commands/SubscriptCommand.java @@ -19,8 +19,8 @@ import elemental2.dom.HTMLElement; import org.dominokit.domino.ui.button.Button; -import org.dominokit.domino.ui.elements.DivElement; import org.dominokit.domino.ui.icons.lib.Icons; +import org.dominokit.domino.ui.richtext.IsRichTextEditor; import org.dominokit.domino.ui.richtext.RichTextCommand; import org.dominokit.domino.ui.utils.DominoDom; @@ -49,20 +49,20 @@ public class SubscriptCommand extends RichTextCommand { /** * Factory method to create a new instance of SubscriptCommand. * - * @param editableElement The div element where the rich text is edited. + * @param isRichTextEditor The div element where the rich text is edited. * @return A new instance of SubscriptCommand. */ - public static SubscriptCommand create(DivElement editableElement) { - return new SubscriptCommand(editableElement); + public static SubscriptCommand create(IsRichTextEditor isRichTextEditor) { + return new SubscriptCommand(isRichTextEditor); } /** * Constructs a new SubscriptCommand instance for the specified editable div element. * - * @param editableElement The div element where the rich text is edited. + * @param isRichTextEditor The div element where the rich text is edited. */ - public SubscriptCommand(DivElement editableElement) { - super(editableElement); + public SubscriptCommand(IsRichTextEditor isRichTextEditor) { + super(isRichTextEditor); this.button = Button.create(Icons.format_subscript()) .setTooltip(getLabels().subscript()) diff --git a/domino-ui/src/main/java/org/dominokit/domino/ui/richtext/commands/SuperscriptCommand.java b/domino-ui/src/main/java/org/dominokit/domino/ui/richtext/commands/SuperscriptCommand.java index b698d16ff..e5b4653a5 100644 --- a/domino-ui/src/main/java/org/dominokit/domino/ui/richtext/commands/SuperscriptCommand.java +++ b/domino-ui/src/main/java/org/dominokit/domino/ui/richtext/commands/SuperscriptCommand.java @@ -19,8 +19,8 @@ import elemental2.dom.HTMLElement; import org.dominokit.domino.ui.button.Button; -import org.dominokit.domino.ui.elements.DivElement; import org.dominokit.domino.ui.icons.lib.Icons; +import org.dominokit.domino.ui.richtext.IsRichTextEditor; import org.dominokit.domino.ui.richtext.RichTextCommand; import org.dominokit.domino.ui.utils.DominoDom; @@ -49,20 +49,20 @@ public class SuperscriptCommand extends RichTextCommand { /** * Factory method to create a new instance of SuperscriptCommand. * - * @param editableElement The div element where the rich text is edited. + * @param isRichTextEditor The div element where the rich text is edited. * @return A new instance of SuperscriptCommand. */ - public static SuperscriptCommand create(DivElement editableElement) { - return new SuperscriptCommand(editableElement); + public static SuperscriptCommand create(IsRichTextEditor isRichTextEditor) { + return new SuperscriptCommand(isRichTextEditor); } /** * Constructs a new SuperscriptCommand instance for the specified editable div element. * - * @param editableElement The div element where the rich text is edited. + * @param isRichTextEditor The div element where the rich text is edited. */ - public SuperscriptCommand(DivElement editableElement) { - super(editableElement); + public SuperscriptCommand(IsRichTextEditor isRichTextEditor) { + super(isRichTextEditor); this.button = Button.create(Icons.format_superscript()) .setTooltip(getLabels().superscript()) diff --git a/domino-ui/src/main/java/org/dominokit/domino/ui/richtext/commands/UnderLineCommand.java b/domino-ui/src/main/java/org/dominokit/domino/ui/richtext/commands/UnderLineCommand.java index e2044fe22..5a43fefce 100644 --- a/domino-ui/src/main/java/org/dominokit/domino/ui/richtext/commands/UnderLineCommand.java +++ b/domino-ui/src/main/java/org/dominokit/domino/ui/richtext/commands/UnderLineCommand.java @@ -19,8 +19,8 @@ import elemental2.dom.HTMLElement; import org.dominokit.domino.ui.button.Button; -import org.dominokit.domino.ui.elements.DivElement; import org.dominokit.domino.ui.icons.lib.Icons; +import org.dominokit.domino.ui.richtext.IsRichTextEditor; import org.dominokit.domino.ui.richtext.RichTextCommand; import org.dominokit.domino.ui.utils.DominoDom; @@ -49,20 +49,20 @@ public class UnderLineCommand extends RichTextCommand { /** * Factory method to create a new instance of UnderLineCommand. * - * @param editableElement The div element where the rich text is edited. + * @param isRichTextEditor The div element where the rich text is edited. * @return A new instance of UnderLineCommand. */ - public static UnderLineCommand create(DivElement editableElement) { - return new UnderLineCommand(editableElement); + public static UnderLineCommand create(IsRichTextEditor isRichTextEditor) { + return new UnderLineCommand(isRichTextEditor); } /** * Constructs a new UnderLineCommand instance for the specified editable div element. * - * @param editableElement The div element where the rich text is edited. + * @param isRichTextEditor The div element where the rich text is edited. */ - public UnderLineCommand(DivElement editableElement) { - super(editableElement); + public UnderLineCommand(IsRichTextEditor isRichTextEditor) { + super(isRichTextEditor); this.button = Button.create(Icons.format_underline()) .setTooltip(getLabels().underline()) diff --git a/domino-ui/src/main/java/org/dominokit/domino/ui/richtext/commands/UndoCommand.java b/domino-ui/src/main/java/org/dominokit/domino/ui/richtext/commands/UndoCommand.java index 5eaa83af1..5a0c5ee5d 100644 --- a/domino-ui/src/main/java/org/dominokit/domino/ui/richtext/commands/UndoCommand.java +++ b/domino-ui/src/main/java/org/dominokit/domino/ui/richtext/commands/UndoCommand.java @@ -19,8 +19,8 @@ import elemental2.dom.HTMLElement; import org.dominokit.domino.ui.button.Button; -import org.dominokit.domino.ui.elements.DivElement; import org.dominokit.domino.ui.icons.lib.Icons; +import org.dominokit.domino.ui.richtext.IsRichTextEditor; import org.dominokit.domino.ui.richtext.RichTextCommand; import org.dominokit.domino.ui.utils.DominoDom; @@ -49,20 +49,20 @@ public class UndoCommand extends RichTextCommand { /** * Factory method to create a new instance of UndoCommand. * - * @param editableElement The div element where the rich text is edited. + * @param isRichTextEditor The div element where the rich text is edited. * @return A new instance of UndoCommand. */ - public static UndoCommand create(DivElement editableElement) { - return new UndoCommand(editableElement); + public static UndoCommand create(IsRichTextEditor isRichTextEditor) { + return new UndoCommand(isRichTextEditor); } /** * Constructs a new UndoCommand instance for the specified editable div element. * - * @param editableElement The div element where the rich text is edited. + * @param isRichTextEditor The div element where the rich text is edited. */ - public UndoCommand(DivElement editableElement) { - super(editableElement); + public UndoCommand(IsRichTextEditor isRichTextEditor) { + super(isRichTextEditor); this.button = Button.create(Icons.undo()) .setTooltip(getLabels().undo())