@web-atoms/web-controls 2.1.14 → 2.1.20

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 (61) hide show
  1. package/dist/basic/FormField.d.ts +1 -1
  2. package/dist/basic/FormField.d.ts.map +1 -1
  3. package/dist/basic/FormField.js +9 -2
  4. package/dist/basic/FormField.js.map +1 -1
  5. package/dist/form/AtomField.d.ts +4 -17
  6. package/dist/form/AtomField.d.ts.map +1 -1
  7. package/dist/form/AtomField.js +22 -63
  8. package/dist/form/AtomField.js.map +1 -1
  9. package/dist/html-editor/HtmlEditor.d.ts +6 -5
  10. package/dist/html-editor/HtmlEditor.d.ts.map +1 -1
  11. package/dist/html-editor/HtmlEditor.js +38 -38
  12. package/dist/html-editor/HtmlEditor.js.map +1 -1
  13. package/dist/html-editor/commands/AddImage.d.ts +4 -5
  14. package/dist/html-editor/commands/AddImage.d.ts.map +1 -1
  15. package/dist/html-editor/commands/AddImage.js +6 -2
  16. package/dist/html-editor/commands/AddImage.js.map +1 -1
  17. package/dist/html-editor/commands/AddLink.d.ts +1 -1
  18. package/dist/html-editor/commands/AddLink.d.ts.map +1 -1
  19. package/dist/html-editor/commands/AddLink.js +4 -2
  20. package/dist/html-editor/commands/AddLink.js.map +1 -1
  21. package/dist/html-editor/commands/Align.js.map +1 -1
  22. package/dist/html-editor/commands/ChangeColor.js.map +1 -1
  23. package/dist/html-editor/commands/ChangeFont.js.map +1 -1
  24. package/dist/html-editor/commands/ChangeFontSize.js.map +1 -1
  25. package/dist/html-editor/commands/Command.d.ts +3 -3
  26. package/dist/html-editor/commands/Command.d.ts.map +1 -1
  27. package/dist/html-editor/commands/Command.js.map +1 -1
  28. package/dist/html-editor/commands/CommandButton.d.ts +7 -2
  29. package/dist/html-editor/commands/CommandButton.d.ts.map +1 -1
  30. package/dist/html-editor/commands/CommandButton.js +12 -4
  31. package/dist/html-editor/commands/CommandButton.js.map +1 -1
  32. package/dist/html-editor/commands/Headings.js.map +1 -1
  33. package/dist/html-editor/commands/HtmlCommands.d.ts +59 -0
  34. package/dist/html-editor/commands/HtmlCommands.d.ts.map +1 -0
  35. package/dist/html-editor/commands/HtmlCommands.js +81 -0
  36. package/dist/html-editor/commands/HtmlCommands.js.map +1 -0
  37. package/dist/html-editor/commands/Source.d.ts +4 -1
  38. package/dist/html-editor/commands/Source.d.ts.map +1 -1
  39. package/dist/html-editor/commands/Source.js +4 -3
  40. package/dist/html-editor/commands/Source.js.map +1 -1
  41. package/dist/html-editor/commands/Unlink.d.ts +3 -1
  42. package/dist/html-editor/commands/Unlink.d.ts.map +1 -1
  43. package/dist/html-editor/commands/Unlink.js +10 -6
  44. package/dist/html-editor/commands/Unlink.js.map +1 -1
  45. package/dist/tsconfig.tsbuildinfo +1 -1
  46. package/package.json +2 -2
  47. package/src/basic/FormField.tsx +11 -1
  48. package/src/form/AtomField.tsx +18 -68
  49. package/src/html-editor/HtmlEditor.tsx +36 -26
  50. package/src/html-editor/commands/AddImage.tsx +7 -5
  51. package/src/html-editor/commands/AddLink.tsx +5 -3
  52. package/src/html-editor/commands/Align.tsx +5 -5
  53. package/src/html-editor/commands/ChangeColor.tsx +3 -3
  54. package/src/html-editor/commands/ChangeFont.tsx +4 -4
  55. package/src/html-editor/commands/ChangeFontSize.tsx +3 -3
  56. package/src/html-editor/commands/Command.tsx +7 -7
  57. package/src/html-editor/commands/CommandButton.tsx +24 -6
  58. package/src/html-editor/commands/Headings.tsx +2 -2
  59. package/src/html-editor/commands/HtmlCommands.ts +78 -0
  60. package/src/html-editor/commands/Source.tsx +5 -4
  61. package/src/html-editor/commands/Unlink.tsx +9 -9
@@ -0,0 +1,78 @@
1
+ import type HtmlEditor from "../HtmlEditor";
2
+
3
+ function query(name: keyof typeof HtmlCommands): IHtmlCommand {
4
+ return {
5
+ canExecute(e: HtmlEditor): boolean {
6
+ return e.queryCommandState(name);
7
+ },
8
+ execute(e: HtmlEditor, showUI?: boolean, value?: string): boolean {
9
+ return e.executeCommand(name, showUI, value);
10
+ }
11
+ };
12
+ }
13
+
14
+ export interface IHtmlCommand {
15
+ canExecute(e: HtmlEditor): boolean;
16
+ execute(e: HtmlEditor, showUI?: boolean, value?: string): boolean;
17
+ }
18
+
19
+ export default class HtmlCommands {
20
+
21
+ public static backColor = query("backColor");
22
+ public static bold = query("bold");
23
+ public static contentReadOnly = query("contentReadOnly");
24
+ public static copy = query("copy");
25
+ public static createLink = query("createLink");
26
+ public static cut = query("cut");
27
+ public static decreaseFontSize = query("decreaseFontSize");
28
+ public static defaultParagraphSeparator = query("defaultParagraphSeparator");
29
+ public static enableAbsolutePositionEditor = query("enableAbsolutePositionEditor");
30
+ public static enableInlineTableEditing = query("enableInlineTableEditing");
31
+ public static enableObjectResizing = query("enableObjectResizing");
32
+ public static fontName = query("fontName");
33
+ public static fontSize = query("fontSize");
34
+ public static foreColor = query("foreColor");
35
+ public static formatBlock = query("formatBlock");
36
+ public static forwardDelete = query("forwardDelete");
37
+ public static heading = query("heading");
38
+ public static hiliteColor = query("hiliteColor");
39
+ public static increaseFontSize = query("increaseFontSize");
40
+ public static indent = query("indent");
41
+ public static insertBrOnReturn = query("insertBrOnReturn");
42
+ public static insertHorizontalRule = query("insertHorizontalRule");
43
+ public static insertHTML = query("insertHTML");
44
+ public static insertImage = query("insertImage");
45
+ public static insertOrderedList = query("insertOrderedList");
46
+ public static insertUnorderedList = query("insertUnorderedList");
47
+ public static insertParagraph = query("insertParagraph");
48
+ public static insertText = query("insertText");
49
+ public static italic = query("italic");
50
+ public static justifyCenter = query("justifyCenter");
51
+ public static justifyFull = query("justifyFull");
52
+ public static justifyLeft = query("justifyLeft");
53
+ public static justifyRight = query("justifyRight");
54
+ public static outdent = query("outdent");
55
+ public static paste = query("paste");
56
+ public static redo = query("redo");
57
+ public static removeFormat = query("removeFormat");
58
+ public static selectAll = query("selectAll");
59
+ public static strikeThrough = query("strikeThrough");
60
+ public static subscript = query("subscript");
61
+ public static superscript = query("superscript");
62
+ public static underline = query("underline");
63
+ public static undo = query("undo");
64
+ public static unlink = query("unlink");
65
+ public static useCSS = query("useCSS");
66
+ public static styleWithCSS = query("styleWithCSS");
67
+ public static AutoUrlDetect = query("AutoUrlDetect");
68
+
69
+ public static enabled = {
70
+ canExecute(e) {
71
+ return true;
72
+ },
73
+ execute() {
74
+ throw new Error("not supported");
75
+ }
76
+ };
77
+
78
+ }
@@ -4,8 +4,9 @@ import XNode from "@web-atoms/core/dist/core/XNode";
4
4
  import StyleRule from "@web-atoms/core/dist/style/StyleRule";
5
5
  import PopupService, { PopupWindow } from "@web-atoms/core/dist/web/services/PopupService";
6
6
  import CSS from "@web-atoms/core/dist/web/styles/CSS";
7
- import { HtmlEditorControl } from "../HtmlEditor";
7
+ import type HtmlEditor from "../HtmlEditor";
8
8
  import CommandButton from "./CommandButton";
9
+ import HtmlCommands from "./HtmlCommands";
9
10
 
10
11
  const css = CSS(StyleRule()
11
12
  .child(StyleRule("textarea")
@@ -14,7 +15,7 @@ const css = CSS(StyleRule()
14
15
  )
15
16
  );
16
17
 
17
- async function showDialog(s: HtmlEditorControl, e: Event): Promise<string> {
18
+ async function showDialog(s: HtmlEditor, e: Event): Promise<string> {
18
19
 
19
20
  class SourceDialog extends PopupWindow {
20
21
 
@@ -41,12 +42,12 @@ async function showDialog(s: HtmlEditorControl, e: Event): Promise<string> {
41
42
  }
42
43
 
43
44
  export default function Source({
44
- insertCommand = "createLink"
45
+ insertCommand = HtmlCommands.enabled
45
46
  }) {
46
47
  return CommandButton({
47
48
  icon: "ri-edit-box-fill",
48
49
  insertCommand,
49
50
  eventInsertHtml: showDialog,
50
- title: "Create Hyper Link"
51
+ title: "Edit Source Code"
51
52
  });
52
53
  }
@@ -1,13 +1,13 @@
1
- import Command from "./Command";
1
+ import CommandButton from "./CommandButton";
2
+ import HtmlCommands from "./HtmlCommands";
2
3
 
3
- export default function Unlink(cmd: any) {
4
- return Command({
4
+ export default function Unlink({
5
+ insertCommand = HtmlCommands.unlink
6
+ }) {
7
+ return CommandButton({
5
8
  icon: "ri-link-unlink-m",
6
- queryState: "unlink",
7
- title: "Remove Link",
8
- ... cmd,
9
- command(editor) {
10
- editor.executeCommand("unlink");
11
- }
9
+ insertCommand,
10
+ eventInsertHtml: () => "",
11
+ title: "Remove Hyperlink"
12
12
  });
13
13
  }