@d4gger/design-system 4.2.2 → 4.2.3

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 (144) hide show
  1. package/dist/blocks/kits/runsPage/RunsPage.cjs +4 -2
  2. package/dist/blocks/kits/runsPage/RunsPage.cjs.map +2 -2
  3. package/dist/blocks/kits/runsPage/RunsPage.d.cts.map +1 -1
  4. package/dist/blocks/kits/runsPage/RunsPage.d.mts.map +1 -1
  5. package/dist/blocks/kits/runsPage/RunsPage.d.ts.map +1 -1
  6. package/dist/blocks/kits/runsPage/RunsPage.js +4 -2
  7. package/dist/blocks/kits/runsPage/RunsPage.js.map +2 -2
  8. package/dist/components/articleNodes/articleExtensions.cjs +7 -1
  9. package/dist/components/articleNodes/articleExtensions.cjs.map +3 -3
  10. package/dist/components/articleNodes/articleExtensions.d.cts.map +1 -1
  11. package/dist/components/articleNodes/articleExtensions.d.mts.map +1 -1
  12. package/dist/components/articleNodes/articleExtensions.d.ts.map +1 -1
  13. package/dist/components/articleNodes/articleExtensions.js +7 -1
  14. package/dist/components/articleNodes/articleExtensions.js.map +2 -2
  15. package/dist/components/carousel/Carousel.cjs +15 -0
  16. package/dist/components/carousel/Carousel.cjs.map +2 -2
  17. package/dist/components/carousel/Carousel.d.cts.map +1 -1
  18. package/dist/components/carousel/Carousel.d.mts.map +1 -1
  19. package/dist/components/carousel/Carousel.d.ts.map +1 -1
  20. package/dist/components/carousel/Carousel.js +15 -0
  21. package/dist/components/carousel/Carousel.js.map +2 -2
  22. package/dist/components/data-table.css +3 -1
  23. package/dist/components/dataTable/DataTable.cjs +4 -1
  24. package/dist/components/dataTable/DataTable.cjs.map +2 -2
  25. package/dist/components/dataTable/DataTable.d.cts.map +1 -1
  26. package/dist/components/dataTable/DataTable.d.mts.map +1 -1
  27. package/dist/components/dataTable/DataTable.d.ts.map +1 -1
  28. package/dist/components/dataTable/DataTable.js +4 -1
  29. package/dist/components/dataTable/DataTable.js.map +2 -2
  30. package/dist/components/icon/Icon.cjs +24 -0
  31. package/dist/components/icon/Icon.cjs.map +2 -2
  32. package/dist/components/icon/Icon.d.cts +33 -1
  33. package/dist/components/icon/Icon.d.cts.map +1 -1
  34. package/dist/components/icon/Icon.d.mts +33 -1
  35. package/dist/components/icon/Icon.d.mts.map +1 -1
  36. package/dist/components/icon/Icon.d.ts +33 -1
  37. package/dist/components/icon/Icon.d.ts.map +1 -1
  38. package/dist/components/icon/Icon.js +32 -0
  39. package/dist/components/icon/Icon.js.map +2 -2
  40. package/dist/components/icon/icons.cjs +16 -0
  41. package/dist/components/icon/icons.cjs.map +2 -2
  42. package/dist/components/icon/icons.d.cts +40 -0
  43. package/dist/components/icon/icons.d.cts.map +1 -1
  44. package/dist/components/icon/icons.d.mts +40 -0
  45. package/dist/components/icon/icons.d.mts.map +1 -1
  46. package/dist/components/icon/icons.d.ts +40 -0
  47. package/dist/components/icon/icons.d.ts.map +1 -1
  48. package/dist/components/icon/icons.js +16 -0
  49. package/dist/components/icon/icons.js.map +2 -2
  50. package/dist/components/index.cjs +2 -0
  51. package/dist/components/index.cjs.map +2 -2
  52. package/dist/components/index.d.cts +2 -0
  53. package/dist/components/index.d.cts.map +1 -1
  54. package/dist/components/index.d.mts +2 -0
  55. package/dist/components/index.d.mts.map +1 -1
  56. package/dist/components/index.d.ts +2 -0
  57. package/dist/components/index.d.ts.map +1 -1
  58. package/dist/components/index.js +2 -0
  59. package/dist/components/index.js.map +2 -2
  60. package/dist/components/reactions/Reactions.cjs +176 -0
  61. package/dist/components/reactions/Reactions.cjs.map +7 -0
  62. package/dist/components/reactions/Reactions.d.cts +55 -0
  63. package/dist/components/reactions/Reactions.d.cts.map +1 -0
  64. package/dist/components/reactions/Reactions.d.mts +55 -0
  65. package/dist/components/reactions/Reactions.d.mts.map +1 -0
  66. package/dist/components/reactions/Reactions.d.ts +55 -0
  67. package/dist/components/reactions/Reactions.d.ts.map +1 -0
  68. package/dist/components/reactions/Reactions.js +146 -0
  69. package/dist/components/reactions/Reactions.js.map +7 -0
  70. package/dist/components/reactions/reactions.props.cjs +38 -0
  71. package/dist/components/reactions/reactions.props.cjs.map +7 -0
  72. package/dist/components/reactions/reactions.props.d.cts +17 -0
  73. package/dist/components/reactions/reactions.props.d.cts.map +1 -0
  74. package/dist/components/reactions/reactions.props.d.mts +17 -0
  75. package/dist/components/reactions/reactions.props.d.mts.map +1 -0
  76. package/dist/components/reactions/reactions.props.d.ts +17 -0
  77. package/dist/components/reactions/reactions.props.d.ts.map +1 -0
  78. package/dist/components/reactions/reactions.props.js +18 -0
  79. package/dist/components/reactions/reactions.props.js.map +7 -0
  80. package/dist/components/reactions.css +106 -0
  81. package/dist/components/rich-text-editor.css +15 -0
  82. package/dist/components/richTextEditor/EditorTools.cjs +278 -21
  83. package/dist/components/richTextEditor/EditorTools.cjs.map +2 -2
  84. package/dist/components/richTextEditor/EditorTools.d.cts +29 -2
  85. package/dist/components/richTextEditor/EditorTools.d.cts.map +1 -1
  86. package/dist/components/richTextEditor/EditorTools.d.mts +29 -2
  87. package/dist/components/richTextEditor/EditorTools.d.mts.map +1 -1
  88. package/dist/components/richTextEditor/EditorTools.d.ts +29 -2
  89. package/dist/components/richTextEditor/EditorTools.d.ts.map +1 -1
  90. package/dist/components/richTextEditor/EditorTools.js +278 -21
  91. package/dist/components/richTextEditor/EditorTools.js.map +2 -2
  92. package/dist/components/richTextEditor/RichTextEditor.cjs +3 -1
  93. package/dist/components/richTextEditor/RichTextEditor.cjs.map +2 -2
  94. package/dist/components/richTextEditor/RichTextEditor.d.cts.map +1 -1
  95. package/dist/components/richTextEditor/RichTextEditor.d.mts.map +1 -1
  96. package/dist/components/richTextEditor/RichTextEditor.d.ts.map +1 -1
  97. package/dist/components/richTextEditor/RichTextEditor.js +4 -2
  98. package/dist/components/richTextEditor/RichTextEditor.js.map +2 -2
  99. package/dist/components/share/Share.cjs +108 -0
  100. package/dist/components/share/Share.cjs.map +7 -0
  101. package/dist/components/share/Share.d.cts +28 -0
  102. package/dist/components/share/Share.d.cts.map +1 -0
  103. package/dist/components/share/Share.d.mts +28 -0
  104. package/dist/components/share/Share.d.mts.map +1 -0
  105. package/dist/components/share/Share.d.ts +28 -0
  106. package/dist/components/share/Share.d.ts.map +1 -0
  107. package/dist/components/share/Share.js +78 -0
  108. package/dist/components/share/Share.js.map +7 -0
  109. package/dist/components/share/share.props.cjs +34 -0
  110. package/dist/components/share/share.props.cjs.map +7 -0
  111. package/dist/components/share/share.props.d.cts +12 -0
  112. package/dist/components/share/share.props.d.cts.map +1 -0
  113. package/dist/components/share/share.props.d.mts +12 -0
  114. package/dist/components/share/share.props.d.mts.map +1 -0
  115. package/dist/components/share/share.props.d.ts +12 -0
  116. package/dist/components/share/share.props.d.ts.map +1 -0
  117. package/dist/components/share/share.props.js +14 -0
  118. package/dist/components/share/share.props.js.map +7 -0
  119. package/dist/components/share.css +25 -0
  120. package/dist/components/sortable-list.css +1 -0
  121. package/dist/components/sortableList/SortableList.cjs +2 -2
  122. package/dist/components/sortableList/SortableList.cjs.map +2 -2
  123. package/dist/components/sortableList/SortableList.js +3 -3
  124. package/dist/components/sortableList/SortableList.js.map +2 -2
  125. package/dist/components/sortableList/sortableList.props.cjs.map +1 -1
  126. package/dist/components/sortableList/sortableList.props.d.cts +2 -0
  127. package/dist/components/sortableList/sortableList.props.d.cts.map +1 -1
  128. package/dist/components/sortableList/sortableList.props.d.mts +2 -0
  129. package/dist/components/sortableList/sortableList.props.d.mts.map +1 -1
  130. package/dist/components/sortableList/sortableList.props.d.ts +2 -0
  131. package/dist/components/sortableList/sortableList.props.d.ts.map +1 -1
  132. package/dist/components.css +2 -0
  133. package/dist/docs/README.md +2 -0
  134. package/dist/docs/component-contract.md +5 -3
  135. package/dist/docs/component-index.json +17 -1
  136. package/dist/docs/components/carousel.md +3 -2
  137. package/dist/docs/components/data-table.md +3 -1
  138. package/dist/docs/components/reactions.md +106 -0
  139. package/dist/docs/components/rich-text-editor.md +13 -7
  140. package/dist/docs/components/share.md +103 -0
  141. package/dist/docs/components/sortable-list.md +2 -2
  142. package/dist/styles.css +156 -1
  143. package/dist/tokens.dtcg.json +1 -1
  144. package/package.json +48 -10
@@ -1,12 +1,14 @@
1
1
  import type { Editor } from '@tiptap/react';
2
2
  type Level = 1 | 2 | 3 | 4 | 5 | 6;
3
3
  import type { EditorVariable, EditorMention } from './editorTokens.cjs';
4
- export type EditorTool = 'style' | 'bold' | 'italic' | 'strike' | 'code' | 'bulletList' | 'orderedList' | 'blockquote' | 'codeBlock' | 'link' | 'clear' | 'history';
4
+ export type EditorTool = 'style' | 'bold' | 'italic' | 'strike' | 'code' | 'underline' | 'highlight' | 'textColor' | 'align' | 'bulletList' | 'orderedList' | 'taskList' | 'blockquote' | 'codeBlock' | 'link' | 'clear' | 'history';
5
5
  export interface EditorInsertItem {
6
6
  id: string;
7
7
  label: string;
8
- insert: (editor: Editor) => void;
8
+ insert: (editor: Editor) => void; /** Schema node that must exist for the item to render (e.g. 'table', 'image'). Omitted = always shown. */
9
+ node?: string;
9
10
  }
11
+ export declare function defaultArticleInsertItems(locale: RichTextEditorLocaleText): EditorInsertItem[];
10
12
  export interface EditorToolsOptions {
11
13
  tools?: readonly EditorTool[];
12
14
  headingLevels?: readonly Level[];
@@ -36,6 +38,7 @@ export interface RichTextEditorLocaleText {
36
38
  inlineCode: string;
37
39
  bulletList: string;
38
40
  orderedList: string;
41
+ taskList: string;
39
42
  link: string;
40
43
  clearFormatting: string;
41
44
  undo: string;
@@ -61,6 +64,30 @@ export interface RichTextEditorLocaleText {
61
64
  mentionSuggestions: string;
62
65
  peopleMatching: (query: string) => string;
63
66
  noMatchingPeople: string;
67
+ underline: string;
68
+ highlight: string;
69
+ textColor: string;
70
+ highlightColor: string;
71
+ colorDialogTitle: string;
72
+ colorDialogDescription: string;
73
+ applyTextColor: string;
74
+ applyHighlightColor: string;
75
+ clearTextColor: string;
76
+ clearHighlightColor: string;
77
+ textAlign: string;
78
+ alignLeft: string;
79
+ alignCenter: string;
80
+ alignRight: string;
81
+ alignJustify: string;
82
+ insertTable: string;
83
+ insertDivider: string;
84
+ insertImage: string;
85
+ imageDialogTitle: string;
86
+ imageDialogDescription: string;
87
+ insertImageAction: string;
88
+ selectionBar: string;
89
+ slashMenu: string;
90
+ noMatchingBlocks: string;
64
91
  }
65
92
  export declare const defaultRichTextEditorLocaleText: RichTextEditorLocaleText;
66
93
  export declare function resolveRichTextEditorLocaleText(localeText?: Partial<RichTextEditorLocaleText>): RichTextEditorLocaleText;
@@ -1 +1 @@
1
- {"version":3,"file":"EditorTools.d.cts","sourceRoot":"","sources":["../../../src/components/richTextEditor/EditorTools.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAC3C,KAAK,KAAK,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;AASlC,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAA;AAEnE,MAAM,MAAM,UAAU,GAAG,OAAO,GAAG,MAAM,GAAG,QAAQ,GAAG,QAAQ,GAAG,MAAM,GAAG,YAAY,GAAG,aAAa,GAAG,YAAY,GAAG,WAAW,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,CAAA;AACnK,MAAM,WAAW,gBAAgB;IAAG,EAAE,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAA;CAAE;AACjG,MAAM,WAAW,kBAAkB;IACjC,KAAK,CAAC,EAAE,SAAS,UAAU,EAAE,CAAA;IAC7B,aAAa,CAAC,EAAE,SAAS,KAAK,EAAE,CAAA;IAChC,WAAW,CAAC,EAAE,SAAS,gBAAgB,EAAE,CAAA;IACzC,SAAS,CAAC,EAAE,SAAS,cAAc,EAAE,CAAA;IACrC,QAAQ,CAAC,EAAE,SAAS,aAA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M,CAAA;IAC3B,SAAS,EAAE,MAAM,CAAA;IACjB,SAAS,EAAE,MAAM,CAAA;IACjB,WAAW,EAAE,MAAM,CAAA;IACnB,UAAU,EAAE,MAAM,CAAA;IAClB,YAAY,EAAE,MAAM,CAAA;IACpB,WAAW,EAAE,MAAM,CAAA;IACnB,aAAa,EAAE,MAAM,CAAA;IACrB,WAAW,EAAE,MAAM,CAAA;IACnB,gBAAgB,EAAE,MAAM,CAAA;IACxB,sBAAsB,EAAE,MAAM,CAAA;IAC9B,iBAAiB,EAAE,MAAM,CAAA;IACzB,YAAY,EAAE,MAAM,CAAA;IACpB,SAAS,EAAE,MAAM,CAAA;IACjB,gBAAgB,EAAE,MAAM,CAAA;CACzB;AACD,eAAO,MAAM,+BAA+B,EAAE,wBAuE7C,CAAA;AACD,wBAAgB,+BAA+B,CAAC,UAAU,CAAC,EAAE,OAAO,CAAC,wBAAwB,CAAC,GAAG,wBAAwB,CAExH;AAoMD,wBAAgB,WAAW,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAgB,EAAE,aAAa,EAAE,WAAgB,EAAE,SAAc,EAAE,QAAa,EAAE,UAAU,EAAE,EAAE,kBAAkB,GAAG;IAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,QAAQ,EAAE,OAAO,CAAA;CAAE,2CAmDhN"}
@@ -1,12 +1,14 @@
1
1
  import type { Editor } from '@tiptap/react';
2
2
  type Level = 1 | 2 | 3 | 4 | 5 | 6;
3
3
  import type { EditorVariable, EditorMention } from './editorTokens.js';
4
- export type EditorTool = 'style' | 'bold' | 'italic' | 'strike' | 'code' | 'bulletList' | 'orderedList' | 'blockquote' | 'codeBlock' | 'link' | 'clear' | 'history';
4
+ export type EditorTool = 'style' | 'bold' | 'italic' | 'strike' | 'code' | 'underline' | 'highlight' | 'textColor' | 'align' | 'bulletList' | 'orderedList' | 'taskList' | 'blockquote' | 'codeBlock' | 'link' | 'clear' | 'history';
5
5
  export interface EditorInsertItem {
6
6
  id: string;
7
7
  label: string;
8
- insert: (editor: Editor) => void;
8
+ insert: (editor: Editor) => void; /** Schema node that must exist for the item to render (e.g. 'table', 'image'). Omitted = always shown. */
9
+ node?: string;
9
10
  }
11
+ export declare function defaultArticleInsertItems(locale: RichTextEditorLocaleText): EditorInsertItem[];
10
12
  export interface EditorToolsOptions {
11
13
  tools?: readonly EditorTool[];
12
14
  headingLevels?: readonly Level[];
@@ -36,6 +38,7 @@ export interface RichTextEditorLocaleText {
36
38
  inlineCode: string;
37
39
  bulletList: string;
38
40
  orderedList: string;
41
+ taskList: string;
39
42
  link: string;
40
43
  clearFormatting: string;
41
44
  undo: string;
@@ -61,6 +64,30 @@ export interface RichTextEditorLocaleText {
61
64
  mentionSuggestions: string;
62
65
  peopleMatching: (query: string) => string;
63
66
  noMatchingPeople: string;
67
+ underline: string;
68
+ highlight: string;
69
+ textColor: string;
70
+ highlightColor: string;
71
+ colorDialogTitle: string;
72
+ colorDialogDescription: string;
73
+ applyTextColor: string;
74
+ applyHighlightColor: string;
75
+ clearTextColor: string;
76
+ clearHighlightColor: string;
77
+ textAlign: string;
78
+ alignLeft: string;
79
+ alignCenter: string;
80
+ alignRight: string;
81
+ alignJustify: string;
82
+ insertTable: string;
83
+ insertDivider: string;
84
+ insertImage: string;
85
+ imageDialogTitle: string;
86
+ imageDialogDescription: string;
87
+ insertImageAction: string;
88
+ selectionBar: string;
89
+ slashMenu: string;
90
+ noMatchingBlocks: string;
64
91
  }
65
92
  export declare const defaultRichTextEditorLocaleText: RichTextEditorLocaleText;
66
93
  export declare function resolveRichTextEditorLocaleText(localeText?: Partial<RichTextEditorLocaleText>): RichTextEditorLocaleText;
@@ -1 +1 @@
1
- {"version":3,"file":"EditorTools.d.mts","sourceRoot":"","sources":["../../../src/components/richTextEditor/EditorTools.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAC3C,KAAK,KAAK,GAAG,CAAC,GAAG,CAA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AC,UAAU,CAAC,EAAE,OAAO,CAAC,wBAAwB,CAAC,GAAG,wBAAwB,CAExH;AAoMD,wBAAgB,WAAW,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAgB,EAAE,aAAa,EAAE,WAAgB,EAAE,SAAc,EAAE,QAAa,EAAE,UAAU,EAAE,EAAE,kBAAkB,GAAG;IAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,QAAQ,EAAE,OAAO,CAAA;CAAE,2CAmDhN"}
@@ -1,12 +1,14 @@
1
1
  import type { Editor } from '@tiptap/react';
2
2
  type Level = 1 | 2 | 3 | 4 | 5 | 6;
3
3
  import type { EditorVariable, EditorMention } from './editorTokens.js';
4
- export type EditorTool = 'style' | 'bold' | 'italic' | 'strike' | 'code' | 'bulletList' | 'orderedList' | 'blockquote' | 'codeBlock' | 'link' | 'clear' | 'history';
4
+ export type EditorTool = 'style' | 'bold' | 'italic' | 'strike' | 'code' | 'underline' | 'highlight' | 'textColor' | 'align' | 'bulletList' | 'orderedList' | 'taskList' | 'blockquote' | 'codeBlock' | 'link' | 'clear' | 'history';
5
5
  export interface EditorInsertItem {
6
6
  id: string;
7
7
  label: string;
8
- insert: (editor: Editor) => void;
8
+ insert: (editor: Editor) => void; /** Schema node that must exist for the item to render (e.g. 'table', 'image'). Omitted = always shown. */
9
+ node?: string;
9
10
  }
11
+ export declare function defaultArticleInsertItems(locale: RichTextEditorLocaleText): EditorInsertItem[];
10
12
  export interface EditorToolsOptions {
11
13
  tools?: readonly EditorTool[];
12
14
  headingLevels?: readonly Level[];
@@ -36,6 +38,7 @@ export interface RichTextEditorLocaleText {
36
38
  inlineCode: string;
37
39
  bulletList: string;
38
40
  orderedList: string;
41
+ taskList: string;
39
42
  link: string;
40
43
  clearFormatting: string;
41
44
  undo: string;
@@ -61,6 +64,30 @@ export interface RichTextEditorLocaleText {
61
64
  mentionSuggestions: string;
62
65
  peopleMatching: (query: string) => string;
63
66
  noMatchingPeople: string;
67
+ underline: string;
68
+ highlight: string;
69
+ textColor: string;
70
+ highlightColor: string;
71
+ colorDialogTitle: string;
72
+ colorDialogDescription: string;
73
+ applyTextColor: string;
74
+ applyHighlightColor: string;
75
+ clearTextColor: string;
76
+ clearHighlightColor: string;
77
+ textAlign: string;
78
+ alignLeft: string;
79
+ alignCenter: string;
80
+ alignRight: string;
81
+ alignJustify: string;
82
+ insertTable: string;
83
+ insertDivider: string;
84
+ insertImage: string;
85
+ imageDialogTitle: string;
86
+ imageDialogDescription: string;
87
+ insertImageAction: string;
88
+ selectionBar: string;
89
+ slashMenu: string;
90
+ noMatchingBlocks: string;
64
91
  }
65
92
  export declare const defaultRichTextEditorLocaleText: RichTextEditorLocaleText;
66
93
  export declare function resolveRichTextEditorLocaleText(localeText?: Partial<RichTextEditorLocaleText>): RichTextEditorLocaleText;
@@ -1 +1 @@
1
- {"version":3,"file":"EditorTools.d.ts","sourceRoot":"","sources":["../../../src/components/richTextEditor/EditorTools.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAC3C,KAAK,KAAK,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;AASlC,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAA;AAEnE,MAAM,MAAM,UAAU,GAAG,OAAO,GAAG,MAAM,GAAG,QAAQ,GAAG,QAAQ,GAAG,MAAM,GAAG,YAAY,GAAG,aAAa,GAAG,YAAY,GAAG,WAAW,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,CAAA;AACnK,MAAM,WAAW,gBAAgB;IAAG,EAAE,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAA;CAAE;AACjG,MAAM,WAAW,kBAAkB;IACjC,KAAK,CAAC,EAAE,SAAS,UAAU,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AAM,CAAA;IACtB,gBAAgB,EAAE,MAAM,CAAA;IACxB,sBAAsB,EAAE,MAAM,CAAA;IAC9B,cAAc,EAAE,MAAM,CAAA;IACtB,mBAAmB,EAAE,MAAM,CAAA;IAC3B,cAAc,EAAE,MAAM,CAAA;IACtB,mBAAmB,EAAE,MAAM,CAAA;IAC3B,SAAS,EAAE,MAAM,CAAA;IACjB,SAAS,EAAE,MAAM,CAAA;IACjB,WAAW,EAAE,MAAM,CAAA;IACnB,UAAU,EAAE,MAAM,CAAA;IAClB,YAAY,EAAE,MAAM,CAAA;IACpB,WAAW,EAAE,MAAM,CAAA;IACnB,aAAa,EAAE,MAAM,CAAA;IACrB,WAAW,EAAE,MAAM,CAAA;IACnB,gBAAgB,EAAE,MAAM,CAAA;IACxB,sBAAsB,EAAE,MAAM,CAAA;IAC9B,iBAAiB,EAAE,MAAM,CAAA;IACzB,YAAY,EAAE,MAAM,CAAA;IACpB,SAAS,EAAE,MAAM,CAAA;IACjB,gBAAgB,EAAE,MAAM,CAAA;CACzB;AACD,eAAO,MAAM,+BAA+B,EAAE,wBAuE7C,CAAA;AACD,wBAAgB,+BAA+B,CAAC,UAAU,CAAC,EAAE,OAAO,CAAC,wBAAwB,CAAC,GAAG,wBAAwB,CAExH;AAoMD,wBAAgB,WAAW,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAgB,EAAE,aAAa,EAAE,WAAgB,EAAE,SAAc,EAAE,QAAa,EAAE,UAAU,EAAE,EAAE,kBAAkB,GAAG;IAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,QAAQ,EAAE,OAAO,CAAA;CAAE,2CAmDhN"}
@@ -9,6 +9,22 @@ import { TextField } from "../textField/TextField.js";
9
9
  import { VisuallyHidden } from "../visuallyHidden/VisuallyHidden.js";
10
10
  import { MentionSuggestions } from "./MentionSuggestions.js";
11
11
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
12
+ function defaultArticleInsertItems(locale) {
13
+ return [
14
+ { id: "quote", label: locale.quoteBlock, insert: (editor) => {
15
+ editor.chain().focus().toggleBlockquote().run();
16
+ }, node: "blockquote" },
17
+ { id: "code-block", label: locale.codeBlock, insert: (editor) => {
18
+ editor.chain().focus().toggleCodeBlock().run();
19
+ }, node: "codeBlock" },
20
+ { id: "table", label: locale.insertTable, insert: (editor) => {
21
+ editor.chain().focus().insertTable({ rows: 3, cols: 3, withHeaderRow: true }).run();
22
+ }, node: "table" },
23
+ { id: "divider", label: locale.insertDivider, insert: (editor) => {
24
+ editor.chain().focus().setHorizontalRule().run();
25
+ }, node: "horizontalRule" }
26
+ ];
27
+ }
12
28
  const defaultRichTextEditorLocaleText = {
13
29
  loading: "Editor loading",
14
30
  empty: "Ready to write",
@@ -30,6 +46,7 @@ const defaultRichTextEditorLocaleText = {
30
46
  inlineCode: "Inline code",
31
47
  bulletList: "Bulleted list",
32
48
  orderedList: "Numbered list",
49
+ taskList: "Task list",
33
50
  link: "Link",
34
51
  clearFormatting: "Clear formatting",
35
52
  undo: "Undo",
@@ -54,12 +71,36 @@ const defaultRichTextEditorLocaleText = {
54
71
  removeLink: "Remove link",
55
72
  mentionSuggestions: "Mention suggestions",
56
73
  peopleMatching: (query) => `People matching @${query}`,
57
- noMatchingPeople: "No matching people"
74
+ noMatchingPeople: "No matching people",
75
+ underline: "Underline",
76
+ highlight: "Highlight",
77
+ textColor: "Text color",
78
+ highlightColor: "Highlight color",
79
+ colorDialogTitle: "Text and highlight color",
80
+ colorDialogDescription: "Apply a hex color to selected text, or clear it.",
81
+ applyTextColor: "Apply text color",
82
+ applyHighlightColor: "Apply highlight color",
83
+ clearTextColor: "Clear text color",
84
+ clearHighlightColor: "Clear highlight color",
85
+ textAlign: "Text alignment",
86
+ alignLeft: "Align left",
87
+ alignCenter: "Align center",
88
+ alignRight: "Align right",
89
+ alignJustify: "Justify",
90
+ insertTable: "Table",
91
+ insertDivider: "Divider",
92
+ insertImage: "Image",
93
+ imageDialogTitle: "Insert image",
94
+ imageDialogDescription: "Add an image by URL.",
95
+ insertImageAction: "Insert image",
96
+ selectionBar: "Selection formatting",
97
+ slashMenu: "Insert block",
98
+ noMatchingBlocks: "No matching blocks"
58
99
  };
59
100
  function resolveRichTextEditorLocaleText(localeText) {
60
101
  return { ...defaultRichTextEditorLocaleText, ...localeText };
61
102
  }
62
- const defaults = ["style", "bold", "italic", "strike", "code", "bulletList", "orderedList", "blockquote", "codeBlock", "link", "clear", "history"];
103
+ const defaults = ["style", "bold", "italic", "strike", "code", "underline", "highlight", "textColor", "align", "bulletList", "orderedList", "taskList", "blockquote", "codeBlock", "link", "clear", "history"];
63
104
  const Control = React.forwardRef(
64
105
  function Control2({ children, ...props }, forwardedRef) {
65
106
  return /* @__PURE__ */ jsx(Toolbar.Button, { asChild: true, disabled: props.disabled, children: /* @__PURE__ */ jsx(Button, { type: "button", size: "sm", variant: "ghost", className: "dsx-rich-text-editor__toolbar-button", ...props, ref: forwardedRef, children }) });
@@ -172,6 +213,209 @@ function LinkControl({ editor, disabled, localeText }) {
172
213
  ] })
173
214
  ] });
174
215
  }
216
+ function ImageControl({ editor, disabled, localeText }) {
217
+ const locale = resolveRichTextEditorLocaleText(localeText);
218
+ const [open, setOpen] = React.useState(false);
219
+ const [url, setUrl] = React.useState("");
220
+ const [error, setError] = React.useState("");
221
+ const urlId = React.useId();
222
+ const insert = () => {
223
+ let href;
224
+ try {
225
+ const parsed = new URL(url);
226
+ if (!["https:", "http:"].includes(parsed.protocol)) throw new Error();
227
+ href = parsed.href;
228
+ } catch {
229
+ setError(locale.urlInvalid);
230
+ return;
231
+ }
232
+ editor.chain().focus().setImage({ src: href }).run();
233
+ setOpen(false);
234
+ };
235
+ return /* @__PURE__ */ jsxs(Popover, { open, onOpenChange: (next) => {
236
+ if (next) {
237
+ setUrl("");
238
+ setError("");
239
+ }
240
+ ;
241
+ setOpen(next);
242
+ }, children: [
243
+ /* @__PURE__ */ jsx(Popover.Trigger, { asChild: true, children: /* @__PURE__ */ jsx(Control, { disabled, "aria-label": locale.insertImage, children: /* @__PURE__ */ jsx(Icon, { name: "image", size: "sm" }) }) }),
244
+ /* @__PURE__ */ jsxs(Popover.Content, { className: "dsx-editor-tools__popover dsx-editor-tools__link", align: "start", onCloseAutoFocus: (event) => {
245
+ event.preventDefault();
246
+ if (!editor.isDestroyed) editor.commands.focus();
247
+ }, children: [
248
+ /* @__PURE__ */ jsx(Popover.Title, { children: locale.imageDialogTitle }),
249
+ /* @__PURE__ */ jsx(VisuallyHidden, { asChild: true, children: /* @__PURE__ */ jsx(Popover.Description, { children: locale.imageDialogDescription }) }),
250
+ /* @__PURE__ */ jsx(TextField, { id: urlId, label: locale.urlLabel, errorText: error || void 0, invalid: Boolean(error), children: /* @__PURE__ */ jsx(TextField.Input, { value: url, onChange: (event) => {
251
+ setUrl(event.target.value);
252
+ setError("");
253
+ }, onKeyDown: (event) => {
254
+ if (event.key === "Enter") {
255
+ event.preventDefault();
256
+ insert();
257
+ }
258
+ } }) }),
259
+ /* @__PURE__ */ jsx("div", { className: "dsx-editor-tools__actions", children: /* @__PURE__ */ jsx(Button, { type: "button", size: "md", onClick: insert, children: locale.insertImageAction }) })
260
+ ] })
261
+ ] });
262
+ }
263
+ const HEX_COLOR_PATTERN = /^#[0-9a-fA-F]{6}([0-9a-fA-F]{2})?$/;
264
+ function normalizeHexInput(value) {
265
+ const withHash = value.startsWith("#") ? value : `#${value}`;
266
+ return HEX_COLOR_PATTERN.test(withHash) ? withHash.toUpperCase() : null;
267
+ }
268
+ function ColorControl({ editor, disabled, localeText }) {
269
+ const locale = resolveRichTextEditorLocaleText(localeText);
270
+ const [open, setOpen] = React.useState(false);
271
+ const [text, setText] = React.useState("");
272
+ const [highlight, setHighlight] = React.useState("");
273
+ const textId = React.useId();
274
+ const highlightId = React.useId();
275
+ const selection = React.useRef({ from: 0, to: 0 });
276
+ const openWithCurrent = () => {
277
+ selection.current = { from: editor.state.selection.from, to: editor.state.selection.to };
278
+ setText(editor.getAttributes("textStyle").color ?? "");
279
+ setHighlight(editor.getAttributes("highlight").color ?? "");
280
+ setOpen(true);
281
+ };
282
+ const applyText = () => {
283
+ const color = normalizeHexInput(text);
284
+ if (color) editor.chain().setTextSelection(selection.current).setColor(color).run();
285
+ };
286
+ const applyHighlight = () => {
287
+ const color = normalizeHexInput(highlight);
288
+ if (!color) return;
289
+ editor.chain().setTextSelection(selection.current).unsetHighlight().toggleHighlight({ color }).run();
290
+ };
291
+ return /* @__PURE__ */ jsxs(Popover, { open, onOpenChange: (next) => {
292
+ if (next) openWithCurrent();
293
+ else setOpen(false);
294
+ }, children: [
295
+ /* @__PURE__ */ jsx(Popover.Trigger, { asChild: true, children: /* @__PURE__ */ jsx(Control, { disabled, "aria-label": locale.textColor, children: /* @__PURE__ */ jsx(Icon, { name: "baseline", size: "sm" }) }) }),
296
+ /* @__PURE__ */ jsxs(Popover.Content, { className: "dsx-editor-tools__popover dsx-editor-tools__link", align: "start", onCloseAutoFocus: (event) => {
297
+ event.preventDefault();
298
+ if (!editor.isDestroyed) editor.commands.focus();
299
+ }, children: [
300
+ /* @__PURE__ */ jsx(Popover.Title, { children: locale.colorDialogTitle }),
301
+ /* @__PURE__ */ jsx(VisuallyHidden, { asChild: true, children: /* @__PURE__ */ jsx(Popover.Description, { children: locale.colorDialogDescription }) }),
302
+ /* @__PURE__ */ jsx(TextField, { id: textId, label: locale.textColor, children: /* @__PURE__ */ jsx(TextField.Input, { value: text, placeholder: "#RRGGBB", "aria-label": locale.textColor, onChange: (event) => setText(event.target.value), onKeyDown: (event) => {
303
+ if (event.key === "Enter") {
304
+ event.preventDefault();
305
+ applyText();
306
+ }
307
+ } }) }),
308
+ /* @__PURE__ */ jsxs("div", { className: "dsx-editor-tools__actions", children: [
309
+ /* @__PURE__ */ jsx(Button, { type: "button", size: "md", disabled: !normalizeHexInput(text), onClick: applyText, "aria-label": locale.applyTextColor, children: locale.applyTextColor }),
310
+ /* @__PURE__ */ jsx(Button, { type: "button", size: "md", variant: "outline", "aria-label": locale.clearTextColor, onClick: () => {
311
+ editor.chain().setTextSelection(selection.current).unsetColor().run();
312
+ setText("");
313
+ }, children: locale.clearTextColor })
314
+ ] }),
315
+ /* @__PURE__ */ jsx(TextField, { id: highlightId, label: locale.highlightColor, children: /* @__PURE__ */ jsx(TextField.Input, { value: highlight, placeholder: "#RRGGBB", "aria-label": locale.highlightColor, onChange: (event) => setHighlight(event.target.value), onKeyDown: (event) => {
316
+ if (event.key === "Enter") {
317
+ event.preventDefault();
318
+ applyHighlight();
319
+ }
320
+ } }) }),
321
+ /* @__PURE__ */ jsxs("div", { className: "dsx-editor-tools__actions", children: [
322
+ /* @__PURE__ */ jsx(Button, { type: "button", size: "md", disabled: !normalizeHexInput(highlight), onClick: applyHighlight, "aria-label": locale.applyHighlightColor, children: locale.applyHighlightColor }),
323
+ /* @__PURE__ */ jsx(Button, { type: "button", size: "md", variant: "outline", "aria-label": locale.clearHighlightColor, onClick: () => {
324
+ editor.chain().setTextSelection(selection.current).unsetHighlight().run();
325
+ setHighlight("");
326
+ }, children: locale.clearHighlightColor })
327
+ ] })
328
+ ] })
329
+ ] });
330
+ }
331
+ function SelectionBar({ editor, disabled, tools, localeText }) {
332
+ const locale = resolveRichTextEditorLocaleText(localeText);
333
+ const [, refresh] = React.useReducer((value) => value + 1, 0);
334
+ React.useEffect(() => {
335
+ editor.on("selectionUpdate", refresh);
336
+ editor.on("transaction", refresh);
337
+ return () => {
338
+ editor.off("selectionUpdate", refresh);
339
+ editor.off("transaction", refresh);
340
+ };
341
+ }, [editor]);
342
+ const selection = editor.state.selection;
343
+ const visible = !disabled && editor.isEditable && !selection.empty && !(selection instanceof NodeSelection) && (tools.includes("bold") || tools.includes("italic") || tools.includes("underline") || tools.includes("link"));
344
+ if (!visible) return null;
345
+ const markAvailable = (tool, name) => tools.includes(tool) && Boolean(editor.schema.marks[name]);
346
+ return /* @__PURE__ */ jsxs("div", { className: "dsx-editor-tools__bubble", role: "toolbar", "aria-label": locale.selectionBar, children: [
347
+ markAvailable("bold", "bold") ? /* @__PURE__ */ jsx(Button, { type: "button", size: "sm", variant: "ghost", "aria-label": locale.bold, "aria-pressed": editor.isActive("bold"), onMouseDown: (event) => event.preventDefault(), onClick: () => editor.chain().focus().toggleBold().run(), children: /* @__PURE__ */ jsx(Icon, { name: "bold", size: "sm" }) }) : null,
348
+ markAvailable("italic", "italic") ? /* @__PURE__ */ jsx(Button, { type: "button", size: "sm", variant: "ghost", "aria-label": locale.italic, "aria-pressed": editor.isActive("italic"), onMouseDown: (event) => event.preventDefault(), onClick: () => editor.chain().focus().toggleItalic().run(), children: /* @__PURE__ */ jsx(Icon, { name: "italic", size: "sm" }) }) : null,
349
+ markAvailable("underline", "underline") ? /* @__PURE__ */ jsx(Button, { type: "button", size: "sm", variant: "ghost", "aria-label": locale.underline, "aria-pressed": editor.isActive("underline"), onMouseDown: (event) => event.preventDefault(), onClick: () => editor.chain().focus().toggleUnderline().run(), children: /* @__PURE__ */ jsx(Icon, { name: "underline", size: "sm" }) }) : null
350
+ ] });
351
+ }
352
+ const SLASH_PATTERN = /(?:^|\s)\/([^/\s]*)$/;
353
+ function SlashMenu({ editor, insertItems, localeText }) {
354
+ const locale = resolveRichTextEditorLocaleText(localeText);
355
+ const [query, setQuery] = React.useState(null);
356
+ const [active, setActive] = React.useState(0);
357
+ const available = insertItems.filter((item) => !item.node || editor.schema.nodes[item.node]);
358
+ const matches = available.filter((item) => item.label.toLowerCase().includes(query?.text.toLowerCase() ?? ""));
359
+ const activeIndex = Math.min(active, Math.max(0, matches.length - 1));
360
+ const state = React.useRef({ query, active, matches });
361
+ state.current = { query, active: activeIndex, matches };
362
+ React.useEffect(() => {
363
+ const update = () => {
364
+ const selection = editor.state.selection;
365
+ if (!selection.empty || !editor.isEditable) {
366
+ setQuery(null);
367
+ return;
368
+ }
369
+ const before = selection.$from.parent.textBetween(0, selection.$from.parentOffset, "", "\uFFFC");
370
+ const match = before.match(SLASH_PATTERN);
371
+ setQuery(match ? { text: match[1], from: selection.from - match[1].length - 1, to: selection.from } : null);
372
+ setActive(0);
373
+ };
374
+ const apply = (index) => {
375
+ const current = state.current;
376
+ const item = current.matches[index];
377
+ if (!current.query || !item) return;
378
+ editor.chain().focus().deleteRange({ from: current.query.from, to: current.query.to }).run();
379
+ item.insert(editor);
380
+ setQuery(null);
381
+ };
382
+ const keydown = (event) => {
383
+ const current = state.current;
384
+ if (!current.query) return;
385
+ if (event.key === "Escape") {
386
+ event.preventDefault();
387
+ event.stopPropagation();
388
+ setQuery(null);
389
+ }
390
+ if (event.key === "ArrowDown" || event.key === "ArrowUp") {
391
+ event.preventDefault();
392
+ event.stopPropagation();
393
+ setActive((index) => Math.max(0, Math.min(current.matches.length - 1, index + (event.key === "ArrowDown" ? 1 : -1))));
394
+ }
395
+ if (event.key === "Enter" && current.matches.length) {
396
+ event.preventDefault();
397
+ event.stopPropagation();
398
+ apply(current.active);
399
+ }
400
+ };
401
+ editor.on("transaction", update);
402
+ editor.view.dom.addEventListener("keydown", keydown, true);
403
+ return () => {
404
+ editor.off("transaction", update);
405
+ editor.view.dom.removeEventListener("keydown", keydown, true);
406
+ };
407
+ }, [editor]);
408
+ if (!query) return null;
409
+ return /* @__PURE__ */ jsxs("div", { className: "dsx-editor-tools__slash", role: "listbox", "aria-label": locale.slashMenu, children: [
410
+ /* @__PURE__ */ jsx("span", { children: locale.slashMenu }),
411
+ matches.map((item, index) => /* @__PURE__ */ jsx(Button, { type: "button", role: "option", "aria-selected": activeIndex === index, size: "lg", variant: activeIndex === index ? "secondary" : "ghost", onMouseDown: (event) => event.preventDefault(), onClick: () => {
412
+ editor.chain().focus().deleteRange({ from: query.from, to: query.to }).run();
413
+ item.insert(editor);
414
+ setQuery(null);
415
+ }, children: item.label }, item.id)),
416
+ !matches.length ? /* @__PURE__ */ jsx("span", { role: "status", children: locale.noMatchingBlocks }) : null
417
+ ] });
418
+ }
175
419
  function EditorTools({ editor, disabled, tools = defaults, headingLevels, insertItems = [], variables = [], mentions = [], localeText }) {
176
420
  const locale = resolveRichTextEditorLocaleText(localeText);
177
421
  const [, refresh] = React.useReducer((value) => value + 1, 0);
@@ -186,32 +430,42 @@ function EditorTools({ editor, disabled, tools = defaults, headingLevels, insert
186
430
  const levels = headingLevels ?? editor?.extensionManager.extensions.find((extension) => extension.name === "heading")?.options.levels ?? [1, 2, 3];
187
431
  const format = (label, icon, name, run) => /* @__PURE__ */ jsx(Control, { disabled, "aria-label": label, "aria-pressed": editor?.isActive(name), onMouseDown: (event) => event.preventDefault(), onClick: run, children: /* @__PURE__ */ jsx(Icon, { name: icon, size: "sm" }) }, name);
188
432
  return /* @__PURE__ */ jsxs(Fragment, { children: [
189
- available("style") ? /* @__PURE__ */ jsx("div", { className: "dsx-rich-text-editor__toolbar-group", role: "group", "aria-label": locale.blockStyleGroup, children: /* @__PURE__ */ jsxs(DropdownMenu, { children: [
190
- /* @__PURE__ */ jsx(DropdownMenu.Trigger, { asChild: true, children: /* @__PURE__ */ jsxs(Control, { disabled, children: [
191
- locale.textStyle,
192
- " ",
193
- /* @__PURE__ */ jsx(Icon, { name: "chevron-down", size: "sm" })
194
- ] }) }),
195
- /* @__PURE__ */ jsxs(DropdownMenu.Content, { onCloseAutoFocus: (event) => {
196
- event.preventDefault();
197
- editor?.commands.focus();
198
- }, children: [
199
- /* @__PURE__ */ jsx(DropdownMenu.Item, { onSelect: () => editor?.chain().focus().setParagraph().run(), children: locale.paragraph }),
200
- editor?.schema.nodes.heading ? levels.map((level) => /* @__PURE__ */ jsx(DropdownMenu.Item, { onSelect: () => editor.chain().focus().toggleHeading({ level }).run(), children: locale.heading(level) }, level)) : null,
201
- available("blockquote", "blockquote") ? /* @__PURE__ */ jsx(DropdownMenu.Item, { onSelect: () => editor?.chain().focus().toggleBlockquote().run(), children: locale.quoteBlock }) : null,
202
- available("codeBlock", "codeBlock") ? /* @__PURE__ */ jsx(DropdownMenu.Item, { onSelect: () => editor?.chain().focus().toggleCodeBlock().run(), children: locale.codeBlock }) : null
203
- ] })
204
- ] }) }) : null,
205
433
  /* @__PURE__ */ jsxs("div", { className: "dsx-rich-text-editor__toolbar-group", role: "group", "aria-label": locale.textStyleGroup, children: [
434
+ available("style") ? /* @__PURE__ */ jsxs(DropdownMenu, { children: [
435
+ /* @__PURE__ */ jsx(DropdownMenu.Trigger, { asChild: true, children: /* @__PURE__ */ jsxs(Control, { disabled, children: [
436
+ locale.textStyle,
437
+ " ",
438
+ /* @__PURE__ */ jsx(Icon, { name: "chevron-down", size: "sm" })
439
+ ] }) }),
440
+ /* @__PURE__ */ jsxs(DropdownMenu.Content, { onCloseAutoFocus: (event) => {
441
+ event.preventDefault();
442
+ if (editor && !editor.isDestroyed) editor.commands.focus();
443
+ }, children: [
444
+ /* @__PURE__ */ jsx(DropdownMenu.Item, { onSelect: () => editor?.chain().focus().setParagraph().run(), children: locale.paragraph }),
445
+ editor?.schema.nodes.heading ? levels.map((level) => /* @__PURE__ */ jsx(DropdownMenu.Item, { onSelect: () => editor.chain().focus().toggleHeading({ level }).run(), children: locale.heading(level) }, level)) : null
446
+ ] })
447
+ ] }) : null,
206
448
  available("bold", "bold") ? format(locale.bold, "bold", "bold", () => editor?.chain().focus().toggleBold().run()) : null,
207
449
  available("italic", "italic") ? format(locale.italic, "italic", "italic", () => editor?.chain().focus().toggleItalic().run()) : null,
208
450
  available("strike", "strike") ? format(locale.strikethrough, "strikethrough", "strike", () => editor?.chain().focus().toggleStrike().run()) : null,
209
451
  available("code", "code") ? format(locale.inlineCode, "code", "code", () => editor?.chain().focus().toggleCode().run()) : null,
452
+ available("underline", "underline") ? format(locale.underline, "underline", "underline", () => editor?.chain().focus().toggleUnderline().run()) : null,
453
+ available("highlight", "highlight") ? format(locale.highlight, "highlight", "highlight", () => editor?.chain().focus().toggleHighlight().run()) : null,
454
+ available("align") && editor?.schema.nodes.paragraph ? /* @__PURE__ */ jsxs(DropdownMenu, { children: [
455
+ /* @__PURE__ */ jsx(DropdownMenu.Trigger, { asChild: true, children: /* @__PURE__ */ jsx(Control, { disabled, "aria-label": locale.textAlign, children: /* @__PURE__ */ jsx(Icon, { name: "align-left", size: "sm" }) }) }),
456
+ /* @__PURE__ */ jsx(DropdownMenu.Content, { onCloseAutoFocus: (event) => {
457
+ event.preventDefault();
458
+ if (editor && !editor.isDestroyed) editor.commands.focus();
459
+ }, children: [["left", locale.alignLeft], ["center", locale.alignCenter], ["right", locale.alignRight], ["justify", locale.alignJustify]].map(([align, label]) => /* @__PURE__ */ jsx(DropdownMenu.Item, { onSelect: () => editor?.chain().focus().setTextAlign(align).run(), children: label }, align)) })
460
+ ] }) : null,
461
+ available("textColor") && editor?.schema.marks["textStyle"] ? /* @__PURE__ */ jsx(ColorControl, { editor, disabled, localeText }) : null,
210
462
  available("bulletList", "bulletList") ? format(locale.bulletList, "list", "bulletList", () => editor?.chain().focus().toggleBulletList().run()) : null,
211
- available("orderedList", "orderedList") ? format(locale.orderedList, "list-ordered", "orderedList", () => editor?.chain().focus().toggleOrderedList().run()) : null
463
+ available("orderedList", "orderedList") ? format(locale.orderedList, "list-ordered", "orderedList", () => editor?.chain().focus().toggleOrderedList().run()) : null,
464
+ available("taskList", "taskList") ? format(locale.taskList, "list-todo", "taskList", () => editor?.chain().focus().toggleTaskList().run()) : null
212
465
  ] }),
213
466
  editor ? /* @__PURE__ */ jsxs("div", { className: "dsx-rich-text-editor__toolbar-group", role: "group", "aria-label": locale.insertGroup, children: [
214
467
  available("link", "link") ? /* @__PURE__ */ jsx(LinkControl, { editor, disabled, localeText }) : null,
468
+ editor.schema.nodes.image ? /* @__PURE__ */ jsx(ImageControl, { editor, disabled, localeText }) : null,
215
469
  insertItems.length ? /* @__PURE__ */ jsxs(DropdownMenu, { children: [
216
470
  /* @__PURE__ */ jsx(DropdownMenu.Trigger, { asChild: true, children: /* @__PURE__ */ jsxs(Control, { disabled, children: [
217
471
  locale.insert,
@@ -221,7 +475,7 @@ function EditorTools({ editor, disabled, tools = defaults, headingLevels, insert
221
475
  /* @__PURE__ */ jsx(DropdownMenu.Content, { onCloseAutoFocus: (event) => {
222
476
  event.preventDefault();
223
477
  if (!editor.isDestroyed) editor.commands.focus();
224
- }, children: insertItems.map((item) => /* @__PURE__ */ jsx(DropdownMenu.Item, { onSelect: () => {
478
+ }, children: insertItems.filter((item) => !item.node || editor.schema.nodes[item.node]).map((item) => /* @__PURE__ */ jsx(DropdownMenu.Item, { onSelect: () => {
225
479
  if (editor.state.selection instanceof NodeSelection) editor.commands.command(({ tr }) => {
226
480
  const paragraph = editor.schema.nodes.paragraph;
227
481
  if (!paragraph) return false;
@@ -242,11 +496,14 @@ function EditorTools({ editor, disabled, tools = defaults, headingLevels, insert
242
496
  /* @__PURE__ */ jsx(Control, { disabled: disabled || !editor?.can().undo(), "aria-label": locale.undo, onMouseDown: (event) => event.preventDefault(), onClick: () => editor?.chain().focus().undo().run(), children: /* @__PURE__ */ jsx(Icon, { name: "undo", size: "sm" }) }),
243
497
  /* @__PURE__ */ jsx(Control, { disabled: disabled || !editor?.can().redo(), "aria-label": locale.redo, onMouseDown: (event) => event.preventDefault(), onClick: () => editor?.chain().focus().redo().run(), children: /* @__PURE__ */ jsx(Icon, { name: "redo", size: "sm" }) })
244
498
  ] }) : null,
245
- editor && mentions.length && editor.schema.nodes.dsxMention ? /* @__PURE__ */ jsx(MentionSuggestions, { editor, mentions, localeText }) : null
499
+ editor && mentions.length && editor.schema.nodes.dsxMention ? /* @__PURE__ */ jsx(MentionSuggestions, { editor, mentions, localeText }) : null,
500
+ editor ? /* @__PURE__ */ jsx(SelectionBar, { editor, disabled, tools, localeText }) : null,
501
+ editor && insertItems.length ? /* @__PURE__ */ jsx(SlashMenu, { editor, insertItems, localeText }) : null
246
502
  ] });
247
503
  }
248
504
  export {
249
505
  EditorTools,
506
+ defaultArticleInsertItems,
250
507
  defaultRichTextEditorLocaleText,
251
508
  resolveRichTextEditorLocaleText
252
509
  };