Skip to content

Commit bc7d570

Browse files
committed
fix #1095 Allow extending the rich text editor with more commands
1 parent 084fc5d commit bc7d570

File tree

3 files changed

+26
-5
lines changed

3 files changed

+26
-5
lines changed

domino-ui/src/main/java/org/dominokit/domino/ui/richtext/RichTextActions.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
import org.dominokit.domino.ui.richtext.commands.UnderLineCommand;
5454
import org.dominokit.domino.ui.richtext.commands.UndoCommand;
5555

56-
public enum RichTextActions {
56+
public enum RichTextActions implements RichTextActionsGroup {
5757
COPY_PASTE(
5858
editor ->
5959
ButtonsGroup.create()
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/*
2+
* Copyright © 2019 Dominokit
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package org.dominokit.domino.ui.richtext;
17+
18+
import java.util.function.Function;
19+
import org.dominokit.domino.ui.IsElement;
20+
21+
public interface RichTextActionsGroup extends Function<RichTextEditor, IsElement<?>> {}

domino-ui/src/main/java/org/dominokit/domino/ui/richtext/RichTextEditor.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ public static RichTextEditor create() {
8080
* @param actions A list of actions to be added to the editor toolbars.
8181
* @return a new instance of {@link RichTextEditor}
8282
*/
83-
public static RichTextEditor create(RichTextActions... actions) {
83+
public static RichTextEditor create(RichTextActionsGroup... actions) {
8484
return new RichTextEditor(actions);
8585
}
8686

@@ -90,7 +90,7 @@ public static RichTextEditor create(RichTextActions... actions) {
9090
* @param actions A list of actions to be added to the editor toolbars.
9191
* @return a new instance of {@link RichTextEditor}
9292
*/
93-
public static RichTextEditor create(Collection<RichTextActions> actions) {
93+
public static RichTextEditor create(Collection<RichTextActionsGroup> actions) {
9494
return new RichTextEditor(actions);
9595
}
9696

@@ -99,7 +99,7 @@ public static RichTextEditor create(Collection<RichTextActions> actions) {
9999
*
100100
* @param actions A list of actions to be added to the editor toolbars.
101101
*/
102-
public RichTextEditor(RichTextActions... actions) {
102+
public RichTextEditor(RichTextActionsGroup... actions) {
103103
this(Arrays.asList(actions));
104104
}
105105

@@ -113,7 +113,7 @@ public RichTextEditor() {
113113
*
114114
* @param actions A list of actions to be added to the editor toolbars.
115115
*/
116-
public RichTextEditor(Collection<RichTextActions> actions) {
116+
public RichTextEditor(Collection<RichTextActionsGroup> actions) {
117117
this.root =
118118
div()
119119
.addCss(dui_rich_text)

0 commit comments

Comments
 (0)