@web-atoms/web-controls 2.1.10 → 2.1.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (122) hide show
  1. package/dist/basic/PopupButton.d.ts +2 -1
  2. package/dist/basic/PopupButton.d.ts.map +1 -1
  3. package/dist/basic/PopupButton.js +7 -2
  4. package/dist/basic/PopupButton.js.map +1 -1
  5. package/dist/html-editor/HtmlEditor.d.ts +23 -0
  6. package/dist/html-editor/HtmlEditor.d.ts.map +1 -0
  7. package/dist/html-editor/HtmlEditor.js +206 -0
  8. package/dist/html-editor/HtmlEditor.js.map +1 -0
  9. package/dist/html-editor/commands/AddImage.d.ts +5 -0
  10. package/dist/html-editor/commands/AddImage.d.ts.map +1 -0
  11. package/dist/html-editor/commands/AddImage.js +23 -0
  12. package/dist/html-editor/commands/AddImage.js.map +1 -0
  13. package/dist/html-editor/commands/AddLink.d.ts +5 -0
  14. package/dist/html-editor/commands/AddLink.d.ts.map +1 -0
  15. package/dist/html-editor/commands/AddLink.js +23 -0
  16. package/dist/html-editor/commands/AddLink.js.map +1 -0
  17. package/dist/html-editor/commands/Align.d.ts +2 -0
  18. package/dist/html-editor/commands/Align.d.ts.map +1 -0
  19. package/dist/html-editor/commands/Align.js +24 -0
  20. package/dist/html-editor/commands/Align.js.map +1 -0
  21. package/dist/html-editor/commands/Bold.d.ts +3 -0
  22. package/dist/html-editor/commands/Bold.d.ts.map +1 -0
  23. package/dist/html-editor/commands/Bold.js +20 -0
  24. package/dist/html-editor/commands/Bold.js.map +1 -0
  25. package/dist/html-editor/commands/ChangeColor.d.ts +2 -0
  26. package/dist/html-editor/commands/ChangeColor.d.ts.map +1 -0
  27. package/dist/html-editor/commands/ChangeColor.js +146 -0
  28. package/dist/html-editor/commands/ChangeColor.js.map +1 -0
  29. package/dist/html-editor/commands/ChangeFont.d.ts +6 -0
  30. package/dist/html-editor/commands/ChangeFont.d.ts.map +1 -0
  31. package/dist/html-editor/commands/ChangeFont.js +72 -0
  32. package/dist/html-editor/commands/ChangeFont.js.map +1 -0
  33. package/dist/html-editor/commands/ChangeFontSize.d.ts +3 -0
  34. package/dist/html-editor/commands/ChangeFontSize.d.ts.map +1 -0
  35. package/dist/html-editor/commands/ChangeFontSize.js +22 -0
  36. package/dist/html-editor/commands/ChangeFontSize.js.map +1 -0
  37. package/dist/html-editor/commands/Command.d.ts +12 -0
  38. package/dist/html-editor/commands/Command.d.ts.map +1 -0
  39. package/dist/html-editor/commands/Command.js +43 -0
  40. package/dist/html-editor/commands/Command.js.map +1 -0
  41. package/dist/html-editor/commands/CommandButton.d.ts +19 -0
  42. package/dist/html-editor/commands/CommandButton.d.ts.map +1 -0
  43. package/dist/html-editor/commands/CommandButton.js +53 -0
  44. package/dist/html-editor/commands/CommandButton.js.map +1 -0
  45. package/dist/html-editor/commands/Headings.d.ts +2 -0
  46. package/dist/html-editor/commands/Headings.d.ts.map +1 -0
  47. package/dist/html-editor/commands/Headings.js +26 -0
  48. package/dist/html-editor/commands/Headings.js.map +1 -0
  49. package/dist/html-editor/commands/HorizontalRule.d.ts +3 -0
  50. package/dist/html-editor/commands/HorizontalRule.d.ts.map +1 -0
  51. package/dist/html-editor/commands/HorizontalRule.js +20 -0
  52. package/dist/html-editor/commands/HorizontalRule.js.map +1 -0
  53. package/dist/html-editor/commands/IndentLess.d.ts +2 -0
  54. package/dist/html-editor/commands/IndentLess.d.ts.map +1 -0
  55. package/dist/html-editor/commands/IndentLess.js +20 -0
  56. package/dist/html-editor/commands/IndentLess.js.map +1 -0
  57. package/dist/html-editor/commands/IndentMore.d.ts +2 -0
  58. package/dist/html-editor/commands/IndentMore.d.ts.map +1 -0
  59. package/dist/html-editor/commands/IndentMore.js +20 -0
  60. package/dist/html-editor/commands/IndentMore.js.map +1 -0
  61. package/dist/html-editor/commands/Italic.d.ts +3 -0
  62. package/dist/html-editor/commands/Italic.d.ts.map +1 -0
  63. package/dist/html-editor/commands/Italic.js +20 -0
  64. package/dist/html-editor/commands/Italic.js.map +1 -0
  65. package/dist/html-editor/commands/NumberedList.d.ts +2 -0
  66. package/dist/html-editor/commands/NumberedList.d.ts.map +1 -0
  67. package/dist/html-editor/commands/NumberedList.js +20 -0
  68. package/dist/html-editor/commands/NumberedList.js.map +1 -0
  69. package/dist/html-editor/commands/Quote.d.ts +2 -0
  70. package/dist/html-editor/commands/Quote.d.ts.map +1 -0
  71. package/dist/html-editor/commands/Quote.js +20 -0
  72. package/dist/html-editor/commands/Quote.js.map +1 -0
  73. package/dist/html-editor/commands/RemoveFormat.d.ts +2 -0
  74. package/dist/html-editor/commands/RemoveFormat.d.ts.map +1 -0
  75. package/dist/html-editor/commands/RemoveFormat.js +20 -0
  76. package/dist/html-editor/commands/RemoveFormat.js.map +1 -0
  77. package/dist/html-editor/commands/Separator.d.ts +2 -0
  78. package/dist/html-editor/commands/Separator.d.ts.map +1 -0
  79. package/dist/html-editor/commands/Separator.js +29 -0
  80. package/dist/html-editor/commands/Separator.js.map +1 -0
  81. package/dist/html-editor/commands/StrikeThrough.d.ts +3 -0
  82. package/dist/html-editor/commands/StrikeThrough.d.ts.map +1 -0
  83. package/dist/html-editor/commands/StrikeThrough.js +20 -0
  84. package/dist/html-editor/commands/StrikeThrough.js.map +1 -0
  85. package/dist/html-editor/commands/Underline.d.ts +3 -0
  86. package/dist/html-editor/commands/Underline.d.ts.map +1 -0
  87. package/dist/html-editor/commands/Underline.js +20 -0
  88. package/dist/html-editor/commands/Underline.js.map +1 -0
  89. package/dist/html-editor/commands/Unlink.d.ts +2 -0
  90. package/dist/html-editor/commands/Unlink.d.ts.map +1 -0
  91. package/dist/html-editor/commands/Unlink.js +20 -0
  92. package/dist/html-editor/commands/Unlink.js.map +1 -0
  93. package/dist/html-editor/commands/UnorderedList.d.ts +2 -0
  94. package/dist/html-editor/commands/UnorderedList.d.ts.map +1 -0
  95. package/dist/html-editor/commands/UnorderedList.js +20 -0
  96. package/dist/html-editor/commands/UnorderedList.js.map +1 -0
  97. package/dist/tsconfig.tsbuildinfo +1 -1
  98. package/package.json +2 -2
  99. package/src/basic/PopupButton.tsx +9 -2
  100. package/src/html-editor/HtmlEditor.tsx +206 -0
  101. package/src/html-editor/commands/AddImage.tsx +13 -0
  102. package/src/html-editor/commands/AddLink.tsx +13 -0
  103. package/src/html-editor/commands/Align.tsx +32 -0
  104. package/src/html-editor/commands/Bold.ts +13 -0
  105. package/src/html-editor/commands/ChangeColor.tsx +178 -0
  106. package/src/html-editor/commands/ChangeFont.tsx +75 -0
  107. package/src/html-editor/commands/ChangeFontSize.tsx +18 -0
  108. package/src/html-editor/commands/Command.tsx +44 -0
  109. package/src/html-editor/commands/CommandButton.tsx +66 -0
  110. package/src/html-editor/commands/Headings.tsx +24 -0
  111. package/src/html-editor/commands/HorizontalRule.tsx +12 -0
  112. package/src/html-editor/commands/IndentLess.tsx +13 -0
  113. package/src/html-editor/commands/IndentMore.tsx +13 -0
  114. package/src/html-editor/commands/Italic.ts +13 -0
  115. package/src/html-editor/commands/NumberedList.tsx +13 -0
  116. package/src/html-editor/commands/Quote.tsx +13 -0
  117. package/src/html-editor/commands/RemoveFormat.tsx +13 -0
  118. package/src/html-editor/commands/Separator.tsx +18 -0
  119. package/src/html-editor/commands/StrikeThrough.ts +13 -0
  120. package/src/html-editor/commands/Underline.ts +13 -0
  121. package/src/html-editor/commands/Unlink.tsx +13 -0
  122. package/src/html-editor/commands/UnorderedList.tsx +13 -0
@@ -0,0 +1,178 @@
1
+ import Bind from "@web-atoms/core/dist/core/Bind";
2
+ import XNode from "@web-atoms/core/dist/core/XNode";
3
+ import StyleRule from "@web-atoms/core/dist/style/StyleRule";
4
+ import CSS from "@web-atoms/core/dist/web/styles/CSS";
5
+ import PopupButton from "../../basic/PopupButton";
6
+ import type { HtmlEditorControl } from "../HtmlEditor";
7
+
8
+ const gray = [
9
+ "rgb(0,0,0)",
10
+ "rgb(68,68,68)",
11
+ "rgb(102,102,102)",
12
+ "rgb(153,153,153)",
13
+ "rgb(204,204,204)",
14
+ "rgb(238,238,238)",
15
+ "rgb(243,243,243)",
16
+ "rgb(255,255,255)"
17
+ ];
18
+
19
+ const primary = [
20
+ "rgb(255,0,0)",
21
+ "rgb(255,153,0)",
22
+ "rgb(255,255,0)",
23
+ "rgb(0,255,0)",
24
+ "rgb(0,255,255)",
25
+ "rgb(0,0,255)",
26
+ "rgb(153,0,255)",
27
+ "rgb(255,0,255)"
28
+ ];
29
+
30
+ const all = [
31
+ [
32
+ "rgb(244,204,204)",
33
+ "rgb(252,229,205)",
34
+ "rgb(255,242,204)",
35
+ "rgb(217,234,211)",
36
+ "rgb(208,224,227)",
37
+ "rgb(207,226,243)",
38
+ "rgb(217,210,233)",
39
+ "rgb(234,209,220)"
40
+ ],
41
+ [
42
+ "rgb(234,153,153)",
43
+ "rgb(249,203,156)",
44
+ "rgb(255,229,153)",
45
+ "rgb(182,215,168)",
46
+ "rgb(162,196,201)",
47
+ "rgb(159,197,232)",
48
+ "rgb(180,167,214)",
49
+ "rgb(213,166,189)"
50
+ ],
51
+ [
52
+ "rgb(224,102,102)",
53
+ "rgb(246,178,107)",
54
+ "rgb(255,217,102)",
55
+ "rgb(147,196,125)",
56
+ "rgb(118,165,175)",
57
+ "rgb(111,168,220)",
58
+ "rgb(142,124,195)",
59
+ "rgb(194,123,160)"
60
+ ],
61
+ [
62
+ "rgb(204,0,0)",
63
+ "rgb(230,145,56)",
64
+ "rgb(241,194,50)",
65
+ "rgb(106,168,79)",
66
+ "rgb(69,129,142)",
67
+ "rgb(61,133,198)",
68
+ "rgb(103,78,167)",
69
+ "rgb(166,77,121)"
70
+ ],
71
+ [
72
+ "rgb(153,0,0)",
73
+ "rgb(180,95,6)",
74
+ "rgb(191,144,0)",
75
+ "rgb(56,118,29)",
76
+ "rgb(19,79,92)",
77
+ "rgb(11,83,148)",
78
+ "rgb(53,28,117)",
79
+ "rgb(116,27,71)"
80
+ ],
81
+ [
82
+ "rgb(102,0,0)",
83
+ "rgb(120,63,4)",
84
+ "rgb(127,96,0)",
85
+ "rgb(39,78,19)",
86
+ "rgb(12,52,61)",
87
+ "rgb(7,55,99)",
88
+ "rgb(32,18,77)",
89
+ "rgb(76,17,48)"
90
+ ]
91
+ ];
92
+
93
+ const colorSelectorCss = CSS(StyleRule("color-selector")
94
+ .width(400)
95
+ .display("flex")
96
+ .justifyContent("space-evenly" as any)
97
+ .child(StyleRule("table")
98
+ .display("inline-table")
99
+ )
100
+ .nested(StyleRule(".color-button")
101
+ .display("inline-block")
102
+ .width(20)
103
+ .height(20)
104
+ .borderWidth(1)
105
+ .margin(1)
106
+ .cursor("pointer")
107
+ .borderStyle("solid")
108
+ .borderColor("transparent")
109
+ .hover(StyleRule()
110
+ .borderColor("black")
111
+ )
112
+ )
113
+ );
114
+
115
+ function TextColor(color: string) {
116
+ return <div
117
+ class="color-button"
118
+ eventClick={Bind.event((e: HtmlEditorControl) => e.executeCommand("foreColor", false, color))}
119
+ styleBackgroundColor={color.toLowerCase()} title={color}></div>;
120
+ }
121
+
122
+ function BackgroundColor(color: string) {
123
+ return <div
124
+ class="color-button"
125
+ eventClick={Bind.event((e: HtmlEditorControl) => e.executeCommand("hiliteColor", false, color))}
126
+ styleBackgroundColor={color.toLowerCase()} title={color}></div>;
127
+ }
128
+
129
+ export default function ChangeColor() {
130
+ return <PopupButton title="Change Color" class="command" icon="ri-font-color">
131
+ <div class={colorSelectorCss}>
132
+ <table>
133
+ <thead>
134
+ <tr>
135
+ <th colSpan={8}>Text Color</th>
136
+ </tr>
137
+ </thead>
138
+ <thead>
139
+ <tr>
140
+ { ... gray.map(TextColor)}
141
+ </tr>
142
+ </thead>
143
+ <thead>
144
+ <tr>
145
+ { ... primary.map(TextColor)}
146
+ </tr>
147
+ </thead>
148
+ <tbody>
149
+ { ... all.map((row) => <tr>
150
+ { ... row.map(TextColor)}
151
+ </tr>)}
152
+ </tbody>
153
+ </table>
154
+ <table class="background-color">
155
+ <thead>
156
+ <tr>
157
+ <th colSpan={8}>Background Color</th>
158
+ </tr>
159
+ </thead>
160
+ <thead>
161
+ <tr>
162
+ { ... gray.map(BackgroundColor)}
163
+ </tr>
164
+ </thead>
165
+ <thead>
166
+ <tr>
167
+ { ... primary.map(BackgroundColor)}
168
+ </tr>
169
+ </thead>
170
+ <tbody>
171
+ { ... all.map((row) => <tr>
172
+ { ... row.map(BackgroundColor)}
173
+ </tr>)}
174
+ </tbody>
175
+ </table>
176
+ </div>
177
+ </PopupButton>;
178
+ }
@@ -0,0 +1,75 @@
1
+ import Bind from "@web-atoms/core/dist/core/Bind";
2
+ import Colors from "@web-atoms/core/dist/core/Colors";
3
+ import XNode from "@web-atoms/core/dist/core/XNode";
4
+ import StyleRule from "@web-atoms/core/dist/style/StyleRule";
5
+ import CSS from "@web-atoms/core/dist/web/styles/CSS";
6
+ import PopupButton from "../../basic/PopupButton";
7
+ import type { HtmlEditorControl } from "../HtmlEditor";
8
+
9
+ const fontMenuCSS = CSS(StyleRule()
10
+ .padding(5)
11
+ .child(StyleRule(".menu")
12
+ .padding(5)
13
+ .hoverBackgroundColor(Colors.lightGreen)
14
+ .child(StyleRule("i")
15
+ .opacity("0")
16
+ .and(StyleRule(".selected")
17
+ .opacity("1")
18
+ )
19
+ )
20
+ )
21
+ );
22
+
23
+ const fonts = [
24
+ ["Sans Serif", ["arial", "sans-serif"]],
25
+ ["Serif", [`"times new roman"`, "serif"]],
26
+ ["Fixed Width", ["monospace"]],
27
+ ["Wide", [`"arial black"`, "sans-serif"]],
28
+ ["Narrow", [`"arial narrow"`, "sans-serif"]],
29
+ ["Comic Sans MS", [`"comic sans ms"`, "sans-serif"]],
30
+ ["Garamond", ["garamond", `"times new roman"`, "serif"]],
31
+ ["Georgia", ["georgia"]],
32
+ ["Tahoma", ["tahoma"]],
33
+ ["Trebuchet MS", [`"trebuchet ms"`]],
34
+ ["Verdana", ["verdana"]]
35
+ ];
36
+
37
+ export function FontMenu({ name, value }) {
38
+ const cssName = value.join(" ");
39
+ return <div
40
+ class="menu"
41
+ eventClick={Bind.event((e: HtmlEditorControl) => e.executeCommand("fontName", false, cssName) )}>
42
+ <i class={Bind.oneWay((e: HtmlEditorControl) => ({
43
+ "ri-check-line": 1,
44
+ "selected": e.getStyle("fontFamily", e.version)
45
+ .toLowerCase()
46
+ .indexOf(value[0].toLowerCase()) !== -1
47
+ }))}/>
48
+ <label styleFontFamily={name}>{name}</label>
49
+ </div>;
50
+ }
51
+
52
+ function selectFont(name: string) {
53
+ if (name === null) {
54
+ return "Font";
55
+ }
56
+ for (const [display, value] of fonts) {
57
+ for (const iterator of value) {
58
+ if (name.indexOf(iterator) !== -1) {
59
+ return display;
60
+ }
61
+ }
62
+ }
63
+ return "Font";
64
+ }
65
+
66
+ export default function ChangeFont() {
67
+ return <PopupButton
68
+ class="command"
69
+ text={Bind.oneWay((e: HtmlEditorControl) => selectFont(e.getStyle("fontFamily", e.version)))}
70
+ title="Change Font">
71
+ <div class={fontMenuCSS}>
72
+ { ... fonts.map((x) => <FontMenu name={x[0]} value={x[1]}/>)}
73
+ </div>
74
+ </PopupButton>;
75
+ }
@@ -0,0 +1,18 @@
1
+ import Bind from "@web-atoms/core/dist/core/Bind";
2
+ import XNode from "@web-atoms/core/dist/core/XNode";
3
+ import PopupButton, { MenuItem } from "../../basic/PopupButton";
4
+ import type { HtmlEditorControl } from "../HtmlEditor";
5
+ import Command, { ICommand } from "./Command";
6
+
7
+ export default function ChangeFontSize(cmd: ICommand) {
8
+ return <PopupButton
9
+ class="command"
10
+ icon="ri-font-size-2"
11
+ title="Change Font Size">
12
+ <MenuItem icon="ri-add-line" label="Increase" eventClick={Bind.event((e: HtmlEditorControl) =>
13
+ e.executeCommand("increaseFontSize"))}/>
14
+ <MenuItem icon="ri-subtract-line" label="Decrease" eventClick={Bind.event((e: HtmlEditorControl) =>
15
+ e.executeCommand("decreaseFontSize"))}/>
16
+ </PopupButton>;
17
+
18
+ }
@@ -0,0 +1,44 @@
1
+ import Bind from "@web-atoms/core/dist/core/Bind";
2
+ import XNode from "@web-atoms/core/dist/core/XNode";
3
+ import type { HtmlEditorControl } from "../HtmlEditor";
4
+
5
+ export interface ICommand {
6
+ label?: string;
7
+ icon?: string;
8
+ queryState?: string;
9
+ enabled?: boolean;
10
+ title?: string;
11
+ command?: (editor: HtmlEditorControl) => void;
12
+ query?: (editor: HtmlEditorControl) => boolean;
13
+ }
14
+
15
+ export default function Command({
16
+ icon,
17
+ label,
18
+ command,
19
+ queryState = "none",
20
+ query,
21
+ ... others
22
+ }: ICommand) {
23
+ if (label) {
24
+ return <div
25
+ eventClick={Bind.event((e) => command(e as HtmlEditorControl))}
26
+ styleClass={Bind.oneWay((e: HtmlEditorControl) => ({
27
+ command: e.version,
28
+ pressed: !e.queryCommandState(queryState)
29
+ }))}
30
+ { ... others }>
31
+ <i class={icon}/>
32
+ <label class="label" text={label}/>
33
+ </div>;
34
+ }
35
+ return <div
36
+ eventClick={Bind.event((e) => command(e as HtmlEditorControl))}
37
+ styleClass={Bind.oneWay((e: HtmlEditorControl) => ({
38
+ command: e.version,
39
+ pressed: e.queryCommandState(queryState)
40
+ }))}
41
+ { ... others }>
42
+ <i class={icon}/>
43
+ </div>;
44
+ }
@@ -0,0 +1,66 @@
1
+ import Bind from "@web-atoms/core/dist/core/Bind";
2
+ import XNode from "@web-atoms/core/dist/core/XNode";
3
+ import type { HtmlEditorControl } from "../HtmlEditor";
4
+
5
+ export interface ICommandButton {
6
+ icon?: string;
7
+ label?: string;
8
+ /**
9
+ * On click, you must return a promise of string or a string that will be inserted
10
+ */
11
+ eventInsertHtml?: any;
12
+
13
+ /**
14
+ * Default is insertHTML but you can change it.
15
+ */
16
+ insertCommand: any;
17
+
18
+ /**
19
+ * Tooltip
20
+ */
21
+ title?: string;
22
+ }
23
+
24
+ export function notSet(text: string) {
25
+ return () => {
26
+ alert(`Command ${text} not set`);
27
+ };
28
+ }
29
+
30
+ function insert(callback: (s: HtmlEditorControl, e: Event) => Promise<string> | string, command: string): any {
31
+ return async (s: HtmlEditorControl, e: Event) => {
32
+ let r = callback(s, e);
33
+ if (typeof r !== "string") {
34
+ if (r.then) {
35
+ r = await r;
36
+ }
37
+ }
38
+ s.executeCommand(command ?? "insertHTML", false, r as string);
39
+ };
40
+ }
41
+
42
+ export default function CommandButton({
43
+ icon,
44
+ label,
45
+ eventInsertHtml,
46
+ insertCommand,
47
+ title
48
+ }: ICommandButton) {
49
+ if (label) {
50
+ return <button
51
+ class="command"
52
+ eventClick={Bind.event(insert(eventInsertHtml, insertCommand))}
53
+ title={title}>
54
+ <label class="label">
55
+ <i class={icon} />
56
+ <span text={label}/>
57
+ </label>
58
+ </button>;
59
+ }
60
+ return <button
61
+ title={title}
62
+ class="command"
63
+ eventClick={Bind.event(insert(eventInsertHtml, insertCommand))}>
64
+ <i class={icon} />
65
+ </button>;
66
+ }
@@ -0,0 +1,24 @@
1
+ import Bind from "@web-atoms/core/dist/core/Bind";
2
+ import XNode from "@web-atoms/core/dist/core/XNode";
3
+ import PopupButton, { MenuItem } from "../../basic/PopupButton";
4
+ import type { HtmlEditorControl } from "../HtmlEditor";
5
+
6
+ export default function Headings() {
7
+ return <PopupButton
8
+ class="command"
9
+ icon="ri-heading"
10
+ title="Apply Heading">
11
+ <MenuItem icon="ri-h-1" eventClick={Bind.event((e: HtmlEditorControl) =>
12
+ e.executeCommand("formatBlock", false, "H1"))}/>
13
+ <MenuItem icon="ri-h-2" eventClick={Bind.event((e: any) =>
14
+ e.executeCommand("formatBlock", false, "H2"))}/>
15
+ <MenuItem icon="ri-h-3" eventClick={Bind.event((e: any) =>
16
+ e.executeCommand("formatBlock", false, "H3"))}/>
17
+ <MenuItem icon="ri-h-4" eventClick={Bind.event((e: any) =>
18
+ e.executeCommand("formatBlock", false, "H4"))}/>
19
+ <MenuItem icon="ri-h-5" eventClick={Bind.event((e: any) =>
20
+ e.executeCommand("formatBlock", false, "H5"))}/>
21
+ <MenuItem icon="ri-h-6" eventClick={Bind.event((e: any) =>
22
+ e.executeCommand("formatBlock", false, "H6"))}/>
23
+ </PopupButton>;
24
+ }
@@ -0,0 +1,12 @@
1
+ import Command, { ICommand } from "./Command";
2
+
3
+ export default function HorizontalRule(cmd: ICommand) {
4
+ return Command({
5
+ icon: "ri-separator",
6
+ title: "Insert Horizontal Line",
7
+ ... cmd,
8
+ command(editor) {
9
+ editor.executeCommand("insertHorizontalRule");
10
+ }
11
+ });
12
+ }
@@ -0,0 +1,13 @@
1
+ import Command from "./Command";
2
+
3
+ export default function IndentLess(cmd: any) {
4
+ return Command({
5
+ icon: "ri-indent-decrease",
6
+ queryState: "outdent",
7
+ title: "Indent Less",
8
+ ... cmd,
9
+ command(editor) {
10
+ editor.executeCommand("outdent");
11
+ }
12
+ });
13
+ }
@@ -0,0 +1,13 @@
1
+ import Command from "./Command";
2
+
3
+ export default function IndentMore(cmd: any) {
4
+ return Command({
5
+ icon: "ri-indent-increase",
6
+ queryState: "indent",
7
+ title: "Indent More",
8
+ ... cmd,
9
+ command(editor) {
10
+ editor.executeCommand("indent");
11
+ }
12
+ });
13
+ }
@@ -0,0 +1,13 @@
1
+ import Command, { ICommand } from "./Command";
2
+
3
+ export default function Italic(cmd: ICommand) {
4
+ return Command({
5
+ icon: "ri-italic",
6
+ queryState: "italic",
7
+ title: "Italic",
8
+ ... cmd,
9
+ command(editor) {
10
+ editor.executeCommand("italic");
11
+ }
12
+ });
13
+ }
@@ -0,0 +1,13 @@
1
+ import Command from "./Command";
2
+
3
+ export default function NumberedList(cmd: any) {
4
+ return Command({
5
+ icon: "ri-list-ordered",
6
+ queryState: "insertOrderedList",
7
+ title: "Create Numbered List",
8
+ ... cmd,
9
+ command(editor) {
10
+ editor.executeCommand("insertOrderedList");
11
+ }
12
+ });
13
+ }
@@ -0,0 +1,13 @@
1
+ import Command from "./Command";
2
+
3
+ export default function IndentMore(cmd: any) {
4
+ return Command({
5
+ icon: "ri-double-quotes",
6
+ queryState: "formatBlock",
7
+ title: "Insert Quote",
8
+ ... cmd,
9
+ command(editor) {
10
+ editor.executeCommand("formatBlock");
11
+ }
12
+ });
13
+ }
@@ -0,0 +1,13 @@
1
+ import Command from "./Command";
2
+
3
+ export default function RemoveFormat(cmd: any) {
4
+ return Command({
5
+ icon: "ri-format-clear",
6
+ queryState: "removeFormat",
7
+ title: "Clear Formatting",
8
+ ... cmd,
9
+ command(editor) {
10
+ editor.executeCommand("removeFormat");
11
+ }
12
+ });
13
+ }
@@ -0,0 +1,18 @@
1
+ import Colors from "@web-atoms/core/dist/core/Colors";
2
+ import XNode from "@web-atoms/core/dist/core/XNode";
3
+ import StyleRule from "@web-atoms/core/dist/style/StyleRule";
4
+ import CSS from "@web-atoms/core/dist/web/styles/CSS";
5
+
6
+ const separatorCss = CSS(StyleRule()
7
+ .backgroundColor(Colors.darkGray)
8
+ .marginLeft(4)
9
+ .marginRight(4)
10
+ .display("inline-block")
11
+ .marginTop(4)
12
+ .height(20)
13
+ .width(2)
14
+ );
15
+
16
+ export default function Separator() {
17
+ return <div class={separatorCss}></div>;
18
+ }
@@ -0,0 +1,13 @@
1
+ import Command, { ICommand } from "./Command";
2
+
3
+ export default function StrikeThrough(cmd: ICommand) {
4
+ return Command({
5
+ icon: "ri-strikethrough",
6
+ queryState: "strikeThrough",
7
+ title: "Strike Through",
8
+ ... cmd,
9
+ command(editor) {
10
+ editor.executeCommand("strikeThrough");
11
+ }
12
+ });
13
+ }
@@ -0,0 +1,13 @@
1
+ import Command, { ICommand } from "./Command";
2
+
3
+ export default function Underline(cmd: ICommand) {
4
+ return Command({
5
+ icon: "ri-underline",
6
+ queryState: "underline",
7
+ title: "Underline",
8
+ ... cmd,
9
+ command(editor) {
10
+ editor.executeCommand("underline");
11
+ }
12
+ });
13
+ }
@@ -0,0 +1,13 @@
1
+ import Command from "./Command";
2
+
3
+ export default function Unlink(cmd: any) {
4
+ return Command({
5
+ icon: "ri-link-unlink-m",
6
+ queryState: "unlink",
7
+ title: "Remove Link",
8
+ ... cmd,
9
+ command(editor) {
10
+ editor.executeCommand("unlink");
11
+ }
12
+ });
13
+ }
@@ -0,0 +1,13 @@
1
+ import Command from "./Command";
2
+
3
+ export default function UnorderedList(cmd: any) {
4
+ return Command({
5
+ icon: "ri-list-unordered",
6
+ queryState: "insertUnorderedList",
7
+ title: "Create List",
8
+ ... cmd,
9
+ command(editor) {
10
+ editor.executeCommand("insertUnorderedList");
11
+ }
12
+ });
13
+ }