@uxf/wysiwyg 11.128.2 → 11.130.0

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 (148) hide show
  1. package/README.md +9 -7
  2. package/create-all-plugins-with-ui.d.ts +78 -14
  3. package/create-all-plugins-with-ui.js +3 -5
  4. package/create-plugins-with-ui.d.ts +2 -2
  5. package/create-plugins-with-ui.js +25 -30
  6. package/data-format.test.d.ts +1 -0
  7. package/data-format.test.js +132 -0
  8. package/editor-smoke.test.d.ts +1 -0
  9. package/editor-smoke.test.js +9 -0
  10. package/hooks.d.ts +1971 -8
  11. package/hooks.js +18 -11
  12. package/package.json +21 -53
  13. package/plugins/blockquote/create-blockquote-plugin.d.ts +9 -3
  14. package/plugins/blockquote/create-blockquote-plugin.js +31 -3
  15. package/plugins/blockquote/create-blockquote-plugin.test.d.ts +1 -0
  16. package/plugins/blockquote/create-blockquote-plugin.test.js +55 -0
  17. package/plugins/blockquote/types.d.ts +1 -1
  18. package/plugins/blockquote/types.js +2 -2
  19. package/plugins/button/create-button-plugin.d.ts +1 -2
  20. package/plugins/button/create-button-plugin.js +3 -5
  21. package/plugins/button/transforms/is-button-active.js +1 -2
  22. package/plugins/button/transforms/update-button.js +1 -2
  23. package/plugins/constants.test.d.ts +1 -0
  24. package/plugins/constants.test.js +52 -0
  25. package/plugins/embedded/types.d.ts +6 -0
  26. package/plugins/embedded/types.js +2 -0
  27. package/plugins/embedded/utils.d.ts +2 -1
  28. package/plugins/embedded/utils.js +4 -4
  29. package/plugins/embedded/video/create-video-plugin.d.ts +10 -3
  30. package/plugins/embedded/video/create-video-plugin.js +8 -9
  31. package/plugins/embedded/video/create-video-plugin.test.d.ts +1 -0
  32. package/plugins/embedded/video/create-video-plugin.test.js +30 -0
  33. package/plugins/embedded/video/update-video.js +1 -2
  34. package/plugins/exit-break/create-exit-break-plugin.d.ts +8 -3
  35. package/plugins/exit-break/create-exit-break-plugin.js +8 -25
  36. package/plugins/heading/create-headings-plugin.d.ts +13 -4
  37. package/plugins/heading/create-headings-plugin.js +22 -36
  38. package/plugins/heading/create-headings-plugin.test.d.ts +1 -0
  39. package/plugins/heading/create-headings-plugin.test.js +42 -0
  40. package/plugins/highlight/createHighlightPlugin.d.ts +4 -2
  41. package/plugins/highlight/createHighlightPlugin.js +8 -21
  42. package/plugins/highlight/types.d.ts +1 -2
  43. package/plugins/image/create-image-plugin.d.ts +3 -3
  44. package/plugins/image/create-image-plugin.js +58 -91
  45. package/plugins/image/create-image-plugin.test.d.ts +1 -0
  46. package/plugins/image/create-image-plugin.test.js +33 -0
  47. package/plugins/image/transforms/is-image-active.js +1 -2
  48. package/plugins/image/transforms/update-image.js +1 -2
  49. package/plugins/image/types.d.ts +6 -3
  50. package/plugins/image/types.js +2 -2
  51. package/plugins/image/utils/is-image-url.js +2 -2
  52. package/plugins/image/with-paste-image-url.d.ts +5 -5
  53. package/plugins/image/with-paste-image-url.js +29 -25
  54. package/plugins/image/with-paste-image.d.ts +4 -7
  55. package/plugins/image/with-paste-image.js +41 -39
  56. package/plugins/link/constants.d.ts +1 -1
  57. package/plugins/link/constants.js +2 -2
  58. package/plugins/link/create-link-plugin.d.ts +38 -3
  59. package/plugins/link/create-link-plugin.js +9 -7
  60. package/plugins/link/create-link-plugin.test.d.ts +1 -0
  61. package/plugins/link/create-link-plugin.test.js +24 -0
  62. package/plugins/link/floating-link-wrapper.d.ts +14 -7
  63. package/plugins/link/floating-link-wrapper.js +46 -17
  64. package/plugins/link/hooks/index.d.ts +1 -1
  65. package/plugins/link/hooks/index.js +2 -2
  66. package/plugins/link/hooks/use-floating-link-selectors.d.ts +8 -0
  67. package/plugins/link/hooks/use-floating-link-selectors.js +21 -0
  68. package/plugins/link/hooks/use-link-actions.d.ts +991 -8
  69. package/plugins/link/hooks/use-link-actions.js +22 -19
  70. package/plugins/link/hooks/use-link-cancel-on-escape.d.ts +1 -1
  71. package/plugins/link/hooks/use-link-cancel-on-escape.js +2 -2
  72. package/plugins/link/hooks/use-link-submit-on-enter.js +5 -5
  73. package/plugins/link/transforms/get-active-link.d.ts +1 -1
  74. package/plugins/link/transforms/get-active-link.js +3 -5
  75. package/plugins/link/transforms/insert-link.js +9 -9
  76. package/plugins/link/transforms/submit-link.d.ts +2 -3
  77. package/plugins/link/transforms/submit-link.js +13 -13
  78. package/plugins/link/transforms/trigger-link-insert-or-edit.js +2 -2
  79. package/plugins/link/transforms/unwrap-link.js +2 -2
  80. package/plugins/list/constants.d.ts +11 -3
  81. package/plugins/list/constants.js +14 -10
  82. package/plugins/list/create-list-plugin.d.ts +26 -4
  83. package/plugins/list/create-list-plugin.js +13 -12
  84. package/plugins/list/create-list-plugin.test.d.ts +1 -0
  85. package/plugins/list/create-list-plugin.test.js +20 -0
  86. package/plugins/mark-bold/create-bold-plugin.d.ts +3 -3
  87. package/plugins/mark-bold/create-bold-plugin.js +2 -2
  88. package/plugins/mark-bold/types.d.ts +2 -2
  89. package/plugins/mark-bold/types.js +3 -3
  90. package/plugins/mark-code/create-code-plugin.d.ts +7 -3
  91. package/plugins/mark-code/create-code-plugin.js +6 -2
  92. package/plugins/mark-code/types.d.ts +2 -2
  93. package/plugins/mark-code/types.js +3 -3
  94. package/plugins/mark-italic/create-italic-plugin.d.ts +3 -3
  95. package/plugins/mark-italic/create-italic-plugin.js +2 -2
  96. package/plugins/mark-italic/types.d.ts +2 -2
  97. package/plugins/mark-italic/types.js +3 -3
  98. package/plugins/mark-underline/create-underline-plugin.d.ts +3 -3
  99. package/plugins/mark-underline/create-underline-plugin.js +2 -2
  100. package/plugins/mark-underline/types.d.ts +2 -2
  101. package/plugins/mark-underline/types.js +3 -3
  102. package/plugins/marks.test.d.ts +1 -0
  103. package/plugins/marks.test.js +42 -0
  104. package/plugins/node-id/add-ids-to-nodes.d.ts +1 -1
  105. package/plugins/node-id/create-node-id-plugin.d.ts +22 -3
  106. package/plugins/node-id/create-node-id-plugin.js +3 -2
  107. package/plugins/paragraph/create-paragraph-plugin.d.ts +1 -3
  108. package/plugins/paragraph/create-paragraph-plugin.js +3 -4
  109. package/plugins/paragraph/types.d.ts +1 -1
  110. package/plugins/paragraph/types.js +2 -2
  111. package/plugins/structural.test.d.ts +1 -0
  112. package/plugins/structural.test.js +29 -0
  113. package/plugins/trailing-block/create-trailing-block-plugin.d.ts +13 -3
  114. package/plugins/trailing-block/create-trailing-block-plugin.js +8 -2
  115. package/serializers/serialize-to-plaintext.js +2 -2
  116. package/styles/styles.css +1 -0
  117. package/types.d.ts +23 -14
  118. package/ui/floating-link.js +28 -28
  119. package/ui/highlight-mark.d.ts +2 -3
  120. package/ui/highlight-mark.js +4 -1
  121. package/ui/link-element.js +6 -3
  122. package/ui/toolbar/buttons/button-toolbar-button.d.ts +1 -1
  123. package/ui/toolbar/buttons/element-toolbar-button.d.ts +1 -1
  124. package/ui/toolbar/buttons/image-toolbar-button.d.ts +1 -1
  125. package/ui/toolbar/buttons/link-toolbar-button.d.ts +1 -1
  126. package/ui/toolbar/buttons/link-toolbar-button.js +1 -1
  127. package/ui/toolbar/buttons/list-toolbar-button.d.ts +1 -1
  128. package/ui/toolbar/buttons/list-toolbar-button.js +3 -3
  129. package/ui/toolbar/buttons/mark-toolbar-button.d.ts +1 -1
  130. package/ui/toolbar/buttons/undo-redo-button-group.d.ts +1 -1
  131. package/ui/toolbar/buttons/video-toolbar-button.d.ts +1 -1
  132. package/ui/toolbar/types.d.ts +1 -1
  133. package/ui/utils.js +1 -1
  134. package/utils.d.ts +18 -19
  135. package/utils.js +31 -28
  136. package/utils.test.d.ts +1 -0
  137. package/utils.test.js +23 -0
  138. package/wysiwyg-editor.d.ts +2 -2
  139. package/wysiwyg-editor.js +29 -23
  140. package/wysiwyg-editor.test.js +111 -6
  141. package/plugins/image/with-image.d.ts +0 -7
  142. package/plugins/image/with-image.js +0 -19
  143. package/plugins/reset-node/create-reset-node.d.ts +0 -3
  144. package/plugins/reset-node/create-reset-node.js +0 -28
  145. package/plugins/select-on-backspace/create-select-on-backspace-plugin.d.ts +0 -3
  146. package/plugins/select-on-backspace/create-select-on-backspace-plugin.js +0 -14
  147. package/plugins/soft-break/create-soft-break-plugin.d.ts +0 -3
  148. package/plugins/soft-break/create-soft-break-plugin.js +0 -22
@@ -1,48 +1,51 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.useLinkActions = void 0;
4
- const plate_link_1 = require("@udecode/plate-link");
4
+ const react_1 = require("@platejs/link/react");
5
5
  const hooks_1 = require("../../../hooks");
6
6
  const get_active_link_1 = require("../transforms/get-active-link");
7
+ const use_floating_link_selectors_1 = require("./use-floating-link-selectors");
7
8
  const use_link_cancel_on_escape_1 = require("./use-link-cancel-on-escape");
8
9
  const use_link_submit_on_enter_1 = require("./use-link-submit-on-enter");
10
+ /**
11
+ * The floating-link store is `LinkPlugin` options in Plate 53. The returned shape is unchanged except
12
+ * `editor`, which used to be `editor.current` and so always `undefined`. Nothing reads it.
13
+ */
9
14
  const useLinkActions = () => {
10
15
  const editor = (0, hooks_1.useUxfEditorRef)();
11
16
  (0, use_link_submit_on_enter_1.useLinkSubmitOnEnter)();
12
17
  (0, use_link_cancel_on_escape_1.useLinkCancelOnEscape)();
13
- const floatingLinkSelectors = (0, plate_link_1.useFloatingLinkSelectors)();
18
+ const floatingLinkSelectors = (0, use_floating_link_selectors_1.useFloatingLinkSelectors)();
14
19
  const setUrl = (url) => {
15
- plate_link_1.floatingLinkActions.url(url);
16
- plate_link_1.floatingLinkActions.isEditing(true);
20
+ editor.setOption(react_1.LinkPlugin, "url", url);
21
+ editor.setOption(react_1.LinkPlugin, "isEditing", true);
17
22
  };
18
23
  const setText = (text) => {
19
- plate_link_1.floatingLinkActions.text(text);
20
- plate_link_1.floatingLinkActions.isEditing(true);
24
+ editor.setOption(react_1.LinkPlugin, "text", text);
25
+ editor.setOption(react_1.LinkPlugin, "isEditing", true);
21
26
  };
22
27
  const setTarget = (target) => {
23
- plate_link_1.floatingLinkActions.newTab(target === "_blank");
24
- plate_link_1.floatingLinkActions.isEditing(true);
28
+ editor.setOption(react_1.LinkPlugin, "newTab", target === "_blank");
29
+ editor.setOption(react_1.LinkPlugin, "isEditing", true);
25
30
  };
26
31
  const setAllValues = (url, text, target) => {
27
32
  setUrl(url);
28
33
  setText(text);
29
34
  setTarget(target);
30
- plate_link_1.floatingLinkActions.isEditing(true);
31
- // floatingLinkActions.show("edit", editor.id);
35
+ editor.setOption(react_1.LinkPlugin, "isEditing", true);
32
36
  };
33
37
  const getActiveLinkValue = () => (0, get_active_link_1.getActiveLink)(editor);
34
38
  return {
35
- editor: editor.current,
36
- setUrl,
37
- getUrl: floatingLinkSelectors.url(),
38
- setText,
39
- getText: floatingLinkSelectors.text(),
40
- setTarget,
41
- getTarget: floatingLinkSelectors.newTab() ? "_blank" : "_self",
42
- setAllValues,
39
+ editor,
43
40
  getActiveLinkValue,
44
- // isLinkActive: linkActive,
41
+ getTarget: floatingLinkSelectors.newTab() ? "_blank" : "_self",
42
+ getText: floatingLinkSelectors.text(),
43
+ getUrl: floatingLinkSelectors.url(),
45
44
  isEditing: floatingLinkSelectors.isEditing(),
45
+ setAllValues,
46
+ setTarget,
47
+ setText,
48
+ setUrl,
46
49
  };
47
50
  };
48
51
  exports.useLinkActions = useLinkActions;
@@ -1 +1 @@
1
- export { useFloatingLinkEscape as useLinkCancelOnEscape } from "@udecode/plate-link";
1
+ export { useFloatingLinkEscape as useLinkCancelOnEscape } from "@platejs/link/react";
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.useLinkCancelOnEscape = void 0;
4
- var plate_link_1 = require("@udecode/plate-link");
5
- Object.defineProperty(exports, "useLinkCancelOnEscape", { enumerable: true, get: function () { return plate_link_1.useFloatingLinkEscape; } });
4
+ var react_1 = require("@platejs/link/react");
5
+ Object.defineProperty(exports, "useLinkCancelOnEscape", { enumerable: true, get: function () { return react_1.useFloatingLinkEscape; } });
@@ -1,14 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.useLinkSubmitOnEnter = void 0;
4
- const plate_core_1 = require("@udecode/plate-core");
5
- const plate_link_1 = require("@udecode/plate-link");
4
+ const react_1 = require("platejs/react");
6
5
  const hooks_1 = require("../../../hooks");
7
6
  const submit_link_1 = require("../transforms/submit-link");
7
+ const use_floating_link_selectors_1 = require("./use-floating-link-selectors");
8
8
  const useLinkSubmitOnEnter = () => {
9
9
  const editor = (0, hooks_1.useUxfEditorRef)();
10
- const open = (0, plate_link_1.useFloatingLinkSelectors)().isEditing();
11
- (0, plate_core_1.useHotkeys)("*", (e) => {
10
+ const open = (0, use_floating_link_selectors_1.useFloatingLinkSelectors)().isEditing();
11
+ (0, react_1.useHotkeys)("*", (e) => {
12
12
  if (e.key !== "Enter") {
13
13
  return;
14
14
  }
@@ -16,8 +16,8 @@ const useLinkSubmitOnEnter = () => {
16
16
  e.preventDefault();
17
17
  }
18
18
  }, {
19
- enabled: open,
20
19
  enableOnFormTags: ["INPUT"],
20
+ enabled: open,
21
21
  }, []);
22
22
  };
23
23
  exports.useLinkSubmitOnEnter = useLinkSubmitOnEnter;
@@ -1,3 +1,3 @@
1
- import { TLinkElement } from "@udecode/plate-link";
2
1
  import { UxfEditor } from "../../../types";
2
+ import { TLinkElement } from "../types";
3
3
  export declare const getActiveLink: (editor: UxfEditor) => TLinkElement | undefined;
@@ -1,12 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getActiveLink = void 0;
4
- const plate_core_1 = require("@udecode/plate-core");
5
- const plate_link_1 = require("@udecode/plate-link");
6
- const slate_1 = require("@udecode/slate");
4
+ const constants_1 = require("../constants");
7
5
  const getActiveLink = (editor) => {
8
- const entry = (0, slate_1.findNode)(editor, {
9
- match: { type: (0, plate_core_1.getPluginType)(editor, plate_link_1.ELEMENT_LINK) },
6
+ const entry = editor.api.node({
7
+ match: { type: editor.getType(constants_1.ELEMENT_LINK) },
10
8
  });
11
9
  if (!entry) {
12
10
  return;
@@ -1,26 +1,26 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.insertLink = void 0;
4
- const plate_common_1 = require("@udecode/plate-common");
5
- const plate_core_1 = require("@udecode/plate-core");
6
- const plate_link_1 = require("@udecode/plate-link");
4
+ const link_1 = require("@platejs/link");
5
+ const react_1 = require("@platejs/link/react");
6
+ const utils_1 = require("../../../utils");
7
7
  const insertLink = (editor, url, text, target) => {
8
8
  if (!editor.selection) {
9
9
  return false;
10
10
  }
11
- const { isUrl, forceSubmit } = (0, plate_core_1.getPluginOptions)(editor, plate_link_1.ELEMENT_LINK);
11
+ const { isUrl, forceSubmit } = editor.getOptions(react_1.LinkPlugin);
12
12
  const isValid = (isUrl === null || isUrl === void 0 ? void 0 : isUrl(url)) || forceSubmit;
13
13
  if (!isValid) {
14
14
  return false;
15
15
  }
16
- (0, plate_link_1.upsertLink)(editor, {
17
- url,
18
- text,
19
- target,
16
+ (0, link_1.upsertLink)(editor, {
20
17
  skipValidation: true,
18
+ target,
19
+ text,
20
+ url,
21
21
  });
22
22
  setTimeout(() => {
23
- (0, plate_common_1.focusEditor)(editor, editor.selection || undefined);
23
+ (0, utils_1.focusEditor)(editor, editor.selection || undefined);
24
24
  }, 0);
25
25
  return true;
26
26
  };
@@ -1,8 +1,7 @@
1
- import { PlateEditor } from "@udecode/plate-core";
2
- import { Value } from "@udecode/slate";
1
+ import { UxfEditor } from "../../../types";
3
2
  /**
4
3
  * Insert transforms if url is valid from store
5
4
  * Text is url if empty.
6
5
  * Focus editor.
7
6
  */
8
- export declare const submitLink: <V extends Value>(editor: PlateEditor<V>) => true | undefined;
7
+ export declare const submitLink: (editor: UxfEditor) => true | undefined;
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.submitLink = void 0;
4
- const plate_common_1 = require("@udecode/plate-common");
5
- const plate_core_1 = require("@udecode/plate-core");
6
- const plate_link_1 = require("@udecode/plate-link");
4
+ const link_1 = require("@platejs/link");
5
+ const react_1 = require("@platejs/link/react");
6
+ const utils_1 = require("../../../utils");
7
7
  /**
8
8
  * Insert transforms if url is valid from store
9
9
  * Text is url if empty.
@@ -13,23 +13,23 @@ const submitLink = (editor) => {
13
13
  if (!editor.selection) {
14
14
  return;
15
15
  }
16
- const { isUrl, forceSubmit } = (0, plate_core_1.getPluginOptions)(editor, plate_link_1.ELEMENT_LINK);
17
- const url = plate_link_1.floatingLinkSelectors.url();
16
+ const { isUrl, forceSubmit } = editor.getOptions(react_1.LinkPlugin);
17
+ const url = editor.getOption(react_1.LinkPlugin, "url");
18
18
  const isValid = (isUrl === null || isUrl === void 0 ? void 0 : isUrl(url)) || forceSubmit;
19
19
  if (!isValid) {
20
20
  return;
21
21
  }
22
- const text = plate_link_1.floatingLinkSelectors.text();
23
- const target = plate_link_1.floatingLinkSelectors.newTab() ? "_blank" : "_self";
24
- (0, plate_link_1.upsertLink)(editor, {
25
- url,
26
- text,
27
- target,
22
+ const text = editor.getOption(react_1.LinkPlugin, "text");
23
+ const target = editor.getOption(react_1.LinkPlugin, "newTab") ? "_blank" : "_self";
24
+ (0, link_1.upsertLink)(editor, {
28
25
  skipValidation: true,
26
+ target,
27
+ text,
28
+ url,
29
29
  });
30
- plate_link_1.floatingLinkActions.reset();
30
+ editor.getApi(react_1.LinkPlugin).floatingLink.reset();
31
31
  setTimeout(() => {
32
- (0, plate_common_1.focusEditor)(editor, editor.selection || undefined);
32
+ (0, utils_1.focusEditor)(editor, editor.selection || undefined);
33
33
  }, 0);
34
34
  return true;
35
35
  };
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.triggerLinkInsertOrEdit = void 0;
4
- const plate_link_1 = require("@udecode/plate-link");
5
- const triggerLinkInsertOrEdit = (editor, focused = false) => (0, plate_link_1.triggerFloatingLink)(editor, { focused });
4
+ const react_1 = require("@platejs/link/react");
5
+ const triggerLinkInsertOrEdit = (editor, focused = false) => (0, react_1.triggerFloatingLink)(editor, { focused });
6
6
  exports.triggerLinkInsertOrEdit = triggerLinkInsertOrEdit;
@@ -1,10 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.removeLink = void 0;
4
- const plate_link_1 = require("@udecode/plate-link");
4
+ const link_1 = require("@platejs/link");
5
5
  const utils_1 = require("../../../utils");
6
6
  const removeLink = (editor) => {
7
- (0, plate_link_1.unwrapLink)(editor);
7
+ (0, link_1.unwrapLink)(editor);
8
8
  (0, utils_1.focusEditor)(editor);
9
9
  };
10
10
  exports.removeLink = removeLink;
@@ -1,4 +1,12 @@
1
+ /**
2
+ * Derived from the plugins, never from `KEYS`: `KEYS.ul` is "disc" and `KEYS.ol` is "decimal", the new
3
+ * indent list's style types. Reading them from `KEYS` silently empties the toolbar's list group.
4
+ */
1
5
  export declare const LIST_PLUGIN_KEY = "list";
2
- export declare const LIST_ORDERED_TYPE = "ol";
3
- export declare const LIST_UNORDERED_TYPE = "ul";
4
- export { ELEMENT_LI, ELEMENT_LIC, ELEMENT_OL, ELEMENT_UL, getListItemEntry, toggleList } from "@udecode/plate-list";
6
+ export declare const LIST_ORDERED_TYPE: "ol";
7
+ export declare const LIST_UNORDERED_TYPE: "ul";
8
+ export declare const ELEMENT_LI: "li";
9
+ export declare const ELEMENT_LIC: "lic";
10
+ export declare const ELEMENT_OL: "ol";
11
+ export declare const ELEMENT_UL: "ul";
12
+ export { getListItemEntry, toggleList } from "@platejs/list-classic";
@@ -1,14 +1,18 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.toggleList = exports.getListItemEntry = exports.ELEMENT_UL = exports.ELEMENT_OL = exports.ELEMENT_LIC = exports.ELEMENT_LI = exports.LIST_UNORDERED_TYPE = exports.LIST_ORDERED_TYPE = exports.LIST_PLUGIN_KEY = void 0;
4
- const plate_list_1 = require("@udecode/plate-list");
4
+ const list_classic_1 = require("@platejs/list-classic");
5
+ /**
6
+ * Derived from the plugins, never from `KEYS`: `KEYS.ul` is "disc" and `KEYS.ol` is "decimal", the new
7
+ * indent list's style types. Reading them from `KEYS` silently empties the toolbar's list group.
8
+ */
5
9
  exports.LIST_PLUGIN_KEY = "list";
6
- exports.LIST_ORDERED_TYPE = plate_list_1.ELEMENT_OL;
7
- exports.LIST_UNORDERED_TYPE = plate_list_1.ELEMENT_UL;
8
- var plate_list_2 = require("@udecode/plate-list");
9
- Object.defineProperty(exports, "ELEMENT_LI", { enumerable: true, get: function () { return plate_list_2.ELEMENT_LI; } });
10
- Object.defineProperty(exports, "ELEMENT_LIC", { enumerable: true, get: function () { return plate_list_2.ELEMENT_LIC; } });
11
- Object.defineProperty(exports, "ELEMENT_OL", { enumerable: true, get: function () { return plate_list_2.ELEMENT_OL; } });
12
- Object.defineProperty(exports, "ELEMENT_UL", { enumerable: true, get: function () { return plate_list_2.ELEMENT_UL; } });
13
- Object.defineProperty(exports, "getListItemEntry", { enumerable: true, get: function () { return plate_list_2.getListItemEntry; } });
14
- Object.defineProperty(exports, "toggleList", { enumerable: true, get: function () { return plate_list_2.toggleList; } });
10
+ exports.LIST_ORDERED_TYPE = list_classic_1.BaseNumberedListPlugin.key;
11
+ exports.LIST_UNORDERED_TYPE = list_classic_1.BaseBulletedListPlugin.key;
12
+ exports.ELEMENT_LI = list_classic_1.BaseListItemPlugin.key;
13
+ exports.ELEMENT_LIC = list_classic_1.BaseListItemContentPlugin.key;
14
+ exports.ELEMENT_OL = list_classic_1.BaseNumberedListPlugin.key;
15
+ exports.ELEMENT_UL = list_classic_1.BaseBulletedListPlugin.key;
16
+ var list_classic_2 = require("@platejs/list-classic");
17
+ Object.defineProperty(exports, "getListItemEntry", { enumerable: true, get: function () { return list_classic_2.getListItemEntry; } });
18
+ Object.defineProperty(exports, "toggleList", { enumerable: true, get: function () { return list_classic_2.toggleList; } });
@@ -1,4 +1,26 @@
1
- import { ListPlugin } from "@udecode/plate-list";
2
- import { UxfPlatePlugin } from "../../types";
3
- export { getListItemEntry, toggleList } from "@udecode/plate-list";
4
- export declare const createListPlugin: () => UxfPlatePlugin<ListPlugin>;
1
+ export { getListItemEntry, toggleList } from "@platejs/list-classic";
2
+ /**
3
+ * list-classic, not the newer indent-based `@platejs/list`: it yields exactly `ul` / `ol` / `li` /
4
+ * `lic`, the shape every stored document already has.
5
+ *
6
+ * `taskList` is new in Plate 53 and must stay off, or a pasted checkbox list writes a node type the
7
+ * stored format has never contained. Disabled through the parent, which carries `withList`'s editor
8
+ * overrides; registering the four children individually would lose them.
9
+ */
10
+ export declare const createListPlugin: () => import("platejs/react").PlatePlugin<import("platejs").PluginConfig<"listClassic", {
11
+ enableResetOnShiftTab?: boolean;
12
+ inheritCheckStateOnLineEndBreak?: boolean;
13
+ inheritCheckStateOnLineStartBreak?: boolean;
14
+ validLiChildrenTypes?: string[];
15
+ }, {}, {
16
+ toggle: {
17
+ bulletedList: (() => boolean) & (() => boolean);
18
+ list: ((args_0: {
19
+ type: string;
20
+ }) => boolean) & ((args_0: {
21
+ type: string;
22
+ }) => boolean);
23
+ numberedList: (() => boolean) & (() => boolean);
24
+ taskList: ((defaultChecked?: boolean | undefined) => boolean) & ((defaultChecked?: boolean | undefined) => boolean);
25
+ };
26
+ }, {}>>;
@@ -1,16 +1,17 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.createListPlugin = exports.toggleList = exports.getListItemEntry = void 0;
4
- const plate_list_1 = require("@udecode/plate-list");
5
- const types_1 = require("../paragraph/types");
6
- var plate_list_2 = require("@udecode/plate-list");
7
- Object.defineProperty(exports, "getListItemEntry", { enumerable: true, get: function () { return plate_list_2.getListItemEntry; } });
8
- Object.defineProperty(exports, "toggleList", { enumerable: true, get: function () { return plate_list_2.toggleList; } });
9
- const createListPlugin = () => (0, plate_list_1.createListPlugin)({
10
- inject: {
11
- props: {
12
- validTypes: [types_1.PARAGRAPH_PLUGIN_KEY],
13
- },
14
- },
15
- });
4
+ const react_1 = require("@platejs/list-classic/react");
5
+ var list_classic_1 = require("@platejs/list-classic");
6
+ Object.defineProperty(exports, "getListItemEntry", { enumerable: true, get: function () { return list_classic_1.getListItemEntry; } });
7
+ Object.defineProperty(exports, "toggleList", { enumerable: true, get: function () { return list_classic_1.toggleList; } });
8
+ /**
9
+ * list-classic, not the newer indent-based `@platejs/list`: it yields exactly `ul` / `ol` / `li` /
10
+ * `lic`, the shape every stored document already has.
11
+ *
12
+ * `taskList` is new in Plate 53 and must stay off, or a pasted checkbox list writes a node type the
13
+ * stored format has never contained. Disabled through the parent, which carries `withList`'s editor
14
+ * overrides; registering the four children individually would lose them.
15
+ */
16
+ const createListPlugin = () => react_1.ListPlugin.configure({ override: { enabled: { taskList: false } } });
16
17
  exports.createListPlugin = createListPlugin;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const platejs_1 = require("platejs");
4
+ const create_paragraph_plugin_1 = require("../paragraph/create-paragraph-plugin");
5
+ const create_list_plugin_1 = require("./create-list-plugin");
6
+ const editor = (0, platejs_1.createSlateEditor)({ plugins: [(0, create_paragraph_plugin_1.createParagraphPlugin)(), (0, create_list_plugin_1.createListPlugin)()] });
7
+ describe("lists", () => {
8
+ it("registers exactly the four classic list types", () => {
9
+ const registered = ["ul", "ol", "li", "lic"].filter((key) => Boolean(editor.plugins[key]));
10
+ expect(registered).toEqual(["ul", "ol", "li", "lic"]);
11
+ });
12
+ // Plate 53 adds taskList, which would let a pasted checkbox list write an unknown node type.
13
+ it("does not register taskList", () => {
14
+ expect(editor.plugins.taskList).toBeUndefined();
15
+ });
16
+ // Registering the four children individually would lose withList's editor overrides.
17
+ it("keeps the parent plugin that carries the list editor overrides", () => {
18
+ expect(editor.plugins.listClassic).toBeDefined();
19
+ });
20
+ });
@@ -1,3 +1,3 @@
1
- import { ToggleMarkPlugin } from "@udecode/plate-core";
2
- import { UxfEditor, WysiwygContent } from "../../types";
3
- export declare const createBoldPlugin: () => import("@udecode/plate-core").PlatePlugin<ToggleMarkPlugin, WysiwygContent, UxfEditor>;
1
+ export declare const createBoldPlugin: () => import("platejs/react").PlatePlugin<import("platejs").PluginConfig<"bold", {}, {}, Record<"bold", {
2
+ toggle: () => void;
3
+ }>, {}>>;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.createBoldPlugin = void 0;
4
- const plate_basic_marks_1 = require("@udecode/plate-basic-marks");
5
- const createBoldPlugin = () => (0, plate_basic_marks_1.createBoldPlugin)();
4
+ const react_1 = require("@platejs/basic-nodes/react");
5
+ const createBoldPlugin = () => react_1.BoldPlugin;
6
6
  exports.createBoldPlugin = createBoldPlugin;
@@ -1,2 +1,2 @@
1
- export declare const BOLD_PLUGIN_KEY = "bold";
2
- export declare const BOLD_PLUGIN_TYPE = "bold";
1
+ export declare const BOLD_PLUGIN_KEY: "bold";
2
+ export declare const BOLD_PLUGIN_TYPE: "bold";
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.BOLD_PLUGIN_TYPE = exports.BOLD_PLUGIN_KEY = void 0;
4
- const plate_basic_marks_1 = require("@udecode/plate-basic-marks");
5
- exports.BOLD_PLUGIN_KEY = plate_basic_marks_1.MARK_BOLD;
6
- exports.BOLD_PLUGIN_TYPE = plate_basic_marks_1.MARK_BOLD;
4
+ const platejs_1 = require("platejs");
5
+ exports.BOLD_PLUGIN_KEY = platejs_1.KEYS.bold;
6
+ exports.BOLD_PLUGIN_TYPE = platejs_1.KEYS.bold;
@@ -1,3 +1,7 @@
1
- import { ToggleMarkPlugin } from "@udecode/plate-core";
2
- import { UxfEditor, WysiwygContent } from "../../types";
3
- export declare const createCodePlugin: () => import("@udecode/plate-core").PlatePlugin<ToggleMarkPlugin, WysiwygContent, UxfEditor>;
1
+ /**
2
+ * Plate 53 registers no shortcut for the code mark, while Plate 20's `createCodePlugin` defaulted to
3
+ * `mod+e`. Configured explicitly so the hotkey does not silently disappear.
4
+ */
5
+ export declare const createCodePlugin: () => import("platejs/react").PlatePlugin<import("platejs").PluginConfig<"code", {}, {}, Record<"code", {
6
+ toggle: () => void;
7
+ }>, {}>>;
@@ -1,6 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.createCodePlugin = void 0;
4
- const plate_basic_marks_1 = require("@udecode/plate-basic-marks");
5
- const createCodePlugin = () => (0, plate_basic_marks_1.createCodePlugin)();
4
+ const react_1 = require("@platejs/basic-nodes/react");
5
+ /**
6
+ * Plate 53 registers no shortcut for the code mark, while Plate 20's `createCodePlugin` defaulted to
7
+ * `mod+e`. Configured explicitly so the hotkey does not silently disappear.
8
+ */
9
+ const createCodePlugin = () => react_1.CodePlugin.configure({ shortcuts: { toggle: { keys: "mod+e" } } });
6
10
  exports.createCodePlugin = createCodePlugin;
@@ -1,2 +1,2 @@
1
- export declare const CODE_PLUGIN_KEY = "code";
2
- export declare const CODE_PLUGIN_TYPE = "code";
1
+ export declare const CODE_PLUGIN_KEY: "code";
2
+ export declare const CODE_PLUGIN_TYPE: "code";
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.CODE_PLUGIN_TYPE = exports.CODE_PLUGIN_KEY = void 0;
4
- const plate_basic_marks_1 = require("@udecode/plate-basic-marks");
5
- exports.CODE_PLUGIN_KEY = plate_basic_marks_1.MARK_CODE;
6
- exports.CODE_PLUGIN_TYPE = plate_basic_marks_1.MARK_CODE;
4
+ const platejs_1 = require("platejs");
5
+ exports.CODE_PLUGIN_KEY = platejs_1.KEYS.code;
6
+ exports.CODE_PLUGIN_TYPE = platejs_1.KEYS.code;
@@ -1,3 +1,3 @@
1
- import { ToggleMarkPlugin } from "@udecode/plate-core";
2
- import { UxfEditor, WysiwygContent } from "../../types";
3
- export declare const createItalicPlugin: () => import("@udecode/plate-core").PlatePlugin<ToggleMarkPlugin, WysiwygContent, UxfEditor>;
1
+ export declare const createItalicPlugin: () => import("platejs/react").PlatePlugin<import("platejs").PluginConfig<"italic", {}, {}, Record<"italic", {
2
+ toggle: () => void;
3
+ }>, {}>>;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.createItalicPlugin = void 0;
4
- const plate_basic_marks_1 = require("@udecode/plate-basic-marks");
5
- const createItalicPlugin = () => (0, plate_basic_marks_1.createItalicPlugin)();
4
+ const react_1 = require("@platejs/basic-nodes/react");
5
+ const createItalicPlugin = () => react_1.ItalicPlugin;
6
6
  exports.createItalicPlugin = createItalicPlugin;
@@ -1,2 +1,2 @@
1
- export declare const ITALIC_PLUGIN_KEY = "italic";
2
- export declare const ITALIC_PLUGIN_TYPE = "italic";
1
+ export declare const ITALIC_PLUGIN_KEY: "italic";
2
+ export declare const ITALIC_PLUGIN_TYPE: "italic";
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ITALIC_PLUGIN_TYPE = exports.ITALIC_PLUGIN_KEY = void 0;
4
- const plate_basic_marks_1 = require("@udecode/plate-basic-marks");
5
- exports.ITALIC_PLUGIN_KEY = plate_basic_marks_1.MARK_ITALIC;
6
- exports.ITALIC_PLUGIN_TYPE = plate_basic_marks_1.MARK_ITALIC;
4
+ const platejs_1 = require("platejs");
5
+ exports.ITALIC_PLUGIN_KEY = platejs_1.KEYS.italic;
6
+ exports.ITALIC_PLUGIN_TYPE = platejs_1.KEYS.italic;
@@ -1,3 +1,3 @@
1
- import { ToggleMarkPlugin } from "@udecode/plate-core";
2
- import { UxfEditor, WysiwygContent } from "../../types";
3
- export declare const createUnderlinePlugin: () => import("@udecode/plate-core").PlatePlugin<ToggleMarkPlugin, WysiwygContent, UxfEditor>;
1
+ export declare const createUnderlinePlugin: () => import("platejs/react").PlatePlugin<import("platejs").PluginConfig<"underline", {}, {}, Record<"underline", {
2
+ toggle: () => void;
3
+ }>, {}>>;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.createUnderlinePlugin = void 0;
4
- const plate_basic_marks_1 = require("@udecode/plate-basic-marks");
5
- const createUnderlinePlugin = () => (0, plate_basic_marks_1.createUnderlinePlugin)();
4
+ const react_1 = require("@platejs/basic-nodes/react");
5
+ const createUnderlinePlugin = () => react_1.UnderlinePlugin;
6
6
  exports.createUnderlinePlugin = createUnderlinePlugin;
@@ -1,2 +1,2 @@
1
- export declare const UNDER_LINE_PLUGIN_KEY = "underline";
2
- export declare const UNDER_LINE_PLUGIN_TYPE = "underline";
1
+ export declare const UNDER_LINE_PLUGIN_KEY: "underline";
2
+ export declare const UNDER_LINE_PLUGIN_TYPE: "underline";
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.UNDER_LINE_PLUGIN_TYPE = exports.UNDER_LINE_PLUGIN_KEY = void 0;
4
- const plate_basic_marks_1 = require("@udecode/plate-basic-marks");
5
- exports.UNDER_LINE_PLUGIN_KEY = plate_basic_marks_1.MARK_UNDERLINE;
6
- exports.UNDER_LINE_PLUGIN_TYPE = plate_basic_marks_1.MARK_UNDERLINE;
4
+ const platejs_1 = require("platejs");
5
+ exports.UNDER_LINE_PLUGIN_KEY = platejs_1.KEYS.underline;
6
+ exports.UNDER_LINE_PLUGIN_TYPE = platejs_1.KEYS.underline;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const platejs_1 = require("platejs");
4
+ const createHighlightPlugin_1 = require("./highlight/createHighlightPlugin");
5
+ const create_bold_plugin_1 = require("./mark-bold/create-bold-plugin");
6
+ const create_code_plugin_1 = require("./mark-code/create-code-plugin");
7
+ const create_italic_plugin_1 = require("./mark-italic/create-italic-plugin");
8
+ const create_underline_plugin_1 = require("./mark-underline/create-underline-plugin");
9
+ const editor = (0, platejs_1.createSlateEditor)({
10
+ plugins: [
11
+ (0, create_bold_plugin_1.createBoldPlugin)(),
12
+ (0, create_italic_plugin_1.createItalicPlugin)(),
13
+ (0, create_underline_plugin_1.createUnderlinePlugin)(),
14
+ (0, create_code_plugin_1.createCodePlugin)(),
15
+ (0, createHighlightPlugin_1.createHighlightPlugin)("red"),
16
+ ],
17
+ });
18
+ describe("marks", () => {
19
+ it.each(["bold", "italic", "underline", "code", "highlight"])("registers %s as a leaf under its stored type", (key) => {
20
+ expect(editor.plugins[key].node.type).toBe(key);
21
+ expect(editor.plugins[key].node.isLeaf).toBe(true);
22
+ });
23
+ // `isDecoration` is Plate 53's default for every leaf plugin, so it distinguishes nothing. What
24
+ // matters is that all five agree. The markup itself is asserted by the render test.
25
+ it("renders every mark through the same leaf path", () => {
26
+ const isDecoration = ["bold", "italic", "underline", "code", "highlight"].map((key) => editor.plugins[key].node.isDecoration);
27
+ expect(new Set(isDecoration).size).toBe(1);
28
+ });
29
+ it("keeps the configurable highlight colour", () => {
30
+ expect(editor.plugins.highlight.options.color).toBe("red");
31
+ });
32
+ // Plate 20 defaults. Plate 53 ships all but mod+e.
33
+ it.each([
34
+ ["bold", "b"],
35
+ ["italic", "i"],
36
+ ["underline", "u"],
37
+ ["code", "e"],
38
+ ])("keeps the %s hotkey", (key, letter) => {
39
+ var _a;
40
+ expect(JSON.stringify((_a = editor.plugins[key].shortcuts.toggle) === null || _a === void 0 ? void 0 : _a.keys)).toContain(letter);
41
+ });
42
+ });
@@ -1,3 +1,3 @@
1
- import { AnyObject } from "@udecode/plate-common";
1
+ import { AnyObject } from "@uxf/core/types";
2
2
  import { WysiwygContent } from "../../types";
3
3
  export declare const addIdsToNodes: (nodes: AnyObject[]) => WysiwygContent;