@contentful/field-editor-rich-text 1.1.3 → 2.0.0-next.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 (190) hide show
  1. package/CHANGELOG.md +0 -60
  2. package/README.md +1 -1
  3. package/dist/ContentfulEditorProvider.d.ts +8 -0
  4. package/dist/RichTextEditor.d.ts +18 -60
  5. package/dist/RichTextEditor.styles.d.ts +7 -0
  6. package/dist/SdkProvider.d.ts +7 -0
  7. package/dist/Toolbar/components/EmbedEntityWidget.d.ts +5 -0
  8. package/dist/Toolbar/components/EmbeddedEntityDropdownButton.d.ts +9 -0
  9. package/dist/Toolbar/components/StickyToolbarWrapper.d.ts +7 -0
  10. package/dist/Toolbar/index.d.ts +5 -20
  11. package/dist/TrackingProvider.d.ts +11 -0
  12. package/dist/constants/Schema.d.ts +93 -11
  13. package/dist/dialogs/openRichTextDialog.d.ts +2 -1
  14. package/dist/dialogs/renderRichTextDialog.d.ts +2 -1
  15. package/dist/field-editor-rich-text.cjs.development.js +4749 -5125
  16. package/dist/field-editor-rich-text.cjs.development.js.map +1 -1
  17. package/dist/field-editor-rich-text.cjs.production.min.js +1 -1
  18. package/dist/field-editor-rich-text.cjs.production.min.js.map +1 -1
  19. package/dist/field-editor-rich-text.esm.js +4729 -5105
  20. package/dist/field-editor-rich-text.esm.js.map +1 -1
  21. package/dist/helpers/editor.d.ts +43 -0
  22. package/dist/helpers/environment.d.ts +2 -0
  23. package/dist/helpers/extractNodes.d.ts +7 -0
  24. package/dist/helpers/formatDateAndTime.d.ts +15 -0
  25. package/dist/helpers/getLinkedContentTypeIdsForNodeType.d.ts +26 -2
  26. package/dist/helpers/newEntitySelectorConfigFromRichTextField.d.ts +5 -1
  27. package/dist/helpers/sanitizeSlateDoc.d.ts +5 -0
  28. package/dist/helpers/transformers.d.ts +8 -0
  29. package/dist/helpers/validations.d.ts +10 -0
  30. package/dist/plugins/Break/createExitBreakPlugin.d.ts +2 -0
  31. package/dist/plugins/Break/createSoftBreakPlugin.d.ts +2 -0
  32. package/dist/plugins/Break/index.d.ts +3 -0
  33. package/dist/plugins/DragAndDrop/index.d.ts +2 -0
  34. package/dist/plugins/EmbeddedEntityBlock/LinkedEntityBlock.d.ts +14 -0
  35. package/dist/plugins/EmbeddedEntityBlock/ToolbarIcon.d.ts +11 -10
  36. package/dist/plugins/EmbeddedEntityBlock/Util.d.ts +2 -23
  37. package/dist/plugins/EmbeddedEntityBlock/index.d.ts +6 -26
  38. package/dist/plugins/EmbeddedEntityInline/FetchingWrappedInlineEntryCard.d.ts +13 -0
  39. package/dist/plugins/EmbeddedEntityInline/Util.d.ts +16 -0
  40. package/dist/plugins/EmbeddedEntityInline/index.d.ts +11 -0
  41. package/dist/plugins/Heading/components/Heading.d.ts +11 -0
  42. package/dist/plugins/Heading/components/ToolbarHeadingButton.d.ts +4 -0
  43. package/dist/plugins/Heading/createHeadingPlugin.d.ts +2 -0
  44. package/dist/plugins/Heading/index.d.ts +2 -380
  45. package/dist/plugins/Hr/index.d.ts +12 -61
  46. package/dist/plugins/Hyperlink/EntryAssetTooltip.d.ts +9 -0
  47. package/dist/plugins/Hyperlink/HyperlinkModal.d.ts +16 -0
  48. package/dist/plugins/Hyperlink/index.d.ts +9 -9
  49. package/dist/plugins/Hyperlink/truncate.d.ts +1 -1
  50. package/dist/plugins/Hyperlink/utils.d.ts +3 -0
  51. package/dist/plugins/List/components/List.d.ts +3 -0
  52. package/dist/plugins/List/components/ListItem.d.ts +2 -0
  53. package/dist/plugins/List/components/ToolbarListButton.d.ts +4 -0
  54. package/dist/plugins/List/createListPlugin.d.ts +2 -0
  55. package/dist/plugins/List/index.d.ts +2 -114
  56. package/dist/plugins/List/insertListBreak.d.ts +2 -0
  57. package/dist/plugins/List/insertListFragment.d.ts +2 -0
  58. package/dist/plugins/List/transforms/insertListItem.d.ts +5 -0
  59. package/dist/plugins/List/utils.d.ts +14 -0
  60. package/dist/plugins/List/withList.d.ts +3 -0
  61. package/dist/plugins/Marks/Bold.d.ts +9 -0
  62. package/dist/plugins/Marks/Code.d.ts +9 -0
  63. package/dist/plugins/Marks/Italic.d.ts +9 -0
  64. package/dist/plugins/Marks/Underline.d.ts +9 -0
  65. package/dist/plugins/Marks/index.d.ts +2 -0
  66. package/dist/plugins/Normalizer/baseRules.d.ts +2 -0
  67. package/dist/plugins/Normalizer/createNormalizerPlugin.d.ts +2 -0
  68. package/dist/plugins/Normalizer/index.d.ts +2 -0
  69. package/dist/plugins/Normalizer/types.d.ts +39 -0
  70. package/dist/plugins/Normalizer/utils.d.ts +8 -0
  71. package/dist/plugins/Normalizer/withNormalizer.d.ts +2 -0
  72. package/dist/plugins/Paragraph/Paragraph.d.ts +2 -0
  73. package/dist/plugins/Paragraph/createParagraphPlugin.d.ts +2 -0
  74. package/dist/plugins/Paragraph/index.d.ts +1 -5
  75. package/dist/plugins/Paragraph/utils.d.ts +2 -0
  76. package/dist/plugins/PasteHTML/createPasteHTMLPlugin.d.ts +2 -0
  77. package/dist/plugins/PasteHTML/index.d.ts +1 -0
  78. package/dist/plugins/PasteHTML/utils/sanitizeHTML.d.ts +1 -0
  79. package/dist/plugins/PasteHTML/utils/sanitizeSheets.d.ts +4 -0
  80. package/dist/plugins/Quote/components/Quote.d.ts +2 -0
  81. package/dist/plugins/Quote/components/ToolbarQuoteButton.d.ts +4 -0
  82. package/dist/plugins/Quote/createQuotePlugin.d.ts +2 -0
  83. package/dist/plugins/Quote/index.d.ts +2 -59
  84. package/dist/plugins/Quote/toggleQuote.d.ts +3 -0
  85. package/dist/plugins/SelectOnBackspace/createSelectOnBackspacePlugin.d.ts +2 -0
  86. package/dist/plugins/SelectOnBackspace/index.d.ts +1 -0
  87. package/dist/plugins/Table/actions/addColumn.d.ts +4 -0
  88. package/dist/plugins/Table/actions/addRow.d.ts +3 -0
  89. package/dist/plugins/Table/actions/index.d.ts +3 -0
  90. package/dist/plugins/Table/actions/setHeader.d.ts +2 -0
  91. package/dist/plugins/Table/addTableTrackingEvents.d.ts +3 -0
  92. package/dist/plugins/Table/components/Cell.d.ts +2 -0
  93. package/dist/plugins/Table/components/HeaderCell.d.ts +2 -0
  94. package/dist/plugins/Table/components/Row.d.ts +2 -0
  95. package/dist/plugins/Table/components/Table.d.ts +2 -0
  96. package/dist/plugins/Table/components/TableActions.d.ts +4 -0
  97. package/dist/plugins/Table/components/ToolbarButton.d.ts +4 -0
  98. package/dist/plugins/Table/createTablePlugin.d.ts +3 -0
  99. package/dist/plugins/Table/helpers.d.ts +15 -0
  100. package/dist/plugins/Table/index.d.ts +2 -0
  101. package/dist/plugins/Text/createTextPlugin.d.ts +2 -0
  102. package/dist/plugins/Text/index.d.ts +1 -0
  103. package/dist/plugins/TrailingParagraph/index.d.ts +1 -0
  104. package/dist/plugins/Voids/createVoidsPlugin.d.ts +2 -0
  105. package/dist/plugins/Voids/index.d.ts +1 -0
  106. package/dist/plugins/Voids/transformVoid.d.ts +6 -0
  107. package/dist/plugins/index.d.ts +6 -1
  108. package/dist/plugins/links-tracking.d.ts +7 -0
  109. package/dist/plugins/shared/EntityStatusIcon.d.ts +7 -0
  110. package/dist/plugins/shared/FetchingWrappedAssetCard.d.ts +23 -0
  111. package/dist/plugins/shared/FetchingWrappedEntryCard.d.ts +13 -0
  112. package/dist/plugins/shared/ToolbarButton.d.ts +11 -0
  113. package/dist/test-utils/assertOutput.d.ts +8 -0
  114. package/dist/test-utils/createEditor.d.ts +14 -0
  115. package/dist/test-utils/index.d.ts +4 -0
  116. package/dist/test-utils/jsx.d.ts +28 -0
  117. package/dist/test-utils/mockPlugin.d.ts +2 -0
  118. package/dist/test-utils/randomId.d.ts +4 -0
  119. package/dist/test-utils/setEmptyDataAttribute.d.ts +6 -0
  120. package/dist/test-utils/validation.d.ts +1 -0
  121. package/dist/types.d.ts +42 -0
  122. package/package.json +40 -34
  123. package/LICENSE +0 -21
  124. package/dist/RichTextEditor.spec.d.ts +0 -1
  125. package/dist/Toolbar/StickyToolbarWrapper.d.ts +0 -12
  126. package/dist/Toolbar/Toolbar.spec.d.ts +0 -1
  127. package/dist/helpers/browserSupport.d.ts +0 -1
  128. package/dist/plugins/Bold/index.d.ts +0 -64
  129. package/dist/plugins/Code/index.d.ts +0 -64
  130. package/dist/plugins/CommandPalette/CommandMark.d.ts +0 -12
  131. package/dist/plugins/CommandPalette/CommandPalette.d.ts +0 -10
  132. package/dist/plugins/CommandPalette/CommandPaletteService.d.ts +0 -20
  133. package/dist/plugins/CommandPalette/CommandPanel/CommandPanelMenu.d.ts +0 -43
  134. package/dist/plugins/CommandPalette/CommandPanel/InViewport/InViewport.d.ts +0 -37
  135. package/dist/plugins/CommandPalette/CommandPanel/index.d.ts +0 -37
  136. package/dist/plugins/CommandPalette/Util.d.ts +0 -5
  137. package/dist/plugins/CommandPalette/index.d.ts +0 -7
  138. package/dist/plugins/EmbeddedEntityBlock/EmbeddedEntityBlock.d.ts +0 -20
  139. package/dist/plugins/EmbeddedEntityBlock/EmbeddedEntityBlock.styles.d.ts +0 -3
  140. package/dist/plugins/EmbeddedEntityBlock/FetchingWrappedAssetCard.d.ts +0 -15
  141. package/dist/plugins/EmbeddedEntityBlock/FetchingWrappedEntryCard.d.ts +0 -15
  142. package/dist/plugins/EmbeddedEntryInline/EmbeddedEntryInline.d.ts +0 -21
  143. package/dist/plugins/EmbeddedEntryInline/EmbeddedEntryInline.styles.d.ts +0 -4
  144. package/dist/plugins/EmbeddedEntryInline/FetchingWrappedInlineEntryCard.d.ts +0 -14
  145. package/dist/plugins/EmbeddedEntryInline/ToolbarIcon.d.ts +0 -11
  146. package/dist/plugins/EmbeddedEntryInline/Utils.d.ts +0 -4
  147. package/dist/plugins/EmbeddedEntryInline/index.d.ts +0 -12
  148. package/dist/plugins/EntryEmbedDropdown/index.d.ts +0 -14
  149. package/dist/plugins/Heading/HeadingDropdown.d.ts +0 -28
  150. package/dist/plugins/Heading/HeadingDropdownItem.d.ts +0 -57
  151. package/dist/plugins/Heading/Paragraph.d.ts +0 -58
  152. package/dist/plugins/Hyperlink/Hyperlink.d.ts +0 -13
  153. package/dist/plugins/Hyperlink/ToolbarIcon.d.ts +0 -7
  154. package/dist/plugins/Hyperlink/Util.d.ts +0 -43
  155. package/dist/plugins/Hyperlink/styles.d.ts +0 -12
  156. package/dist/plugins/Hyperlink/useRequestStatus.d.ts +0 -6
  157. package/dist/plugins/InsertBeforeFirstVoidBlock/Util.d.ts +0 -14
  158. package/dist/plugins/InsertBeforeFirstVoidBlock/index.d.ts +0 -3
  159. package/dist/plugins/Italic/index.d.ts +0 -64
  160. package/dist/plugins/List/EditListWrapper.d.ts +0 -2
  161. package/dist/plugins/List/ToolbarDecorator.d.ts +0 -62
  162. package/dist/plugins/NewLinePlugin/index.d.ts +0 -3
  163. package/dist/plugins/Paste/Paste.d.ts +0 -1
  164. package/dist/plugins/Paste/Paste.spec.d.ts +0 -1
  165. package/dist/plugins/Paste/index.d.ts +0 -7
  166. package/dist/plugins/Paste/index.spec.d.ts +0 -1
  167. package/dist/plugins/PasteHtml/PasteHtml.spec.d.ts +0 -1
  168. package/dist/plugins/PasteHtml/Serializer.d.ts +0 -1
  169. package/dist/plugins/PasteHtml/index.d.ts +0 -3
  170. package/dist/plugins/PasteText/PasteText.spec.d.ts +0 -1
  171. package/dist/plugins/PasteText/index.d.ts +0 -3
  172. package/dist/plugins/Quote/QuotePlugin.d.ts +0 -10
  173. package/dist/plugins/Quote/Util.d.ts +0 -2
  174. package/dist/plugins/Underlined/index.d.ts +0 -64
  175. package/dist/plugins/shared/BlockSelectDecorator.d.ts +0 -63
  176. package/dist/plugins/shared/BlockToggleDecorator.d.ts +0 -65
  177. package/dist/plugins/shared/MarkDecorator.d.ts +0 -12
  178. package/dist/plugins/shared/MarkPlugin.d.ts +0 -9
  179. package/dist/plugins/shared/MarkToggleDecorator.d.ts +0 -62
  180. package/dist/plugins/shared/NodeDecorator.d.ts +0 -15
  181. package/dist/plugins/shared/PasteTestHelpers.d.ts +0 -35
  182. package/dist/plugins/shared/PluginApi.d.ts +0 -31
  183. package/dist/plugins/shared/PropTypes.d.ts +0 -15
  184. package/dist/plugins/shared/ToolbarDropdownListItem.d.ts +0 -14
  185. package/dist/plugins/shared/ToolbarIcon.d.ts +0 -16
  186. package/dist/plugins/shared/Util.d.ts +0 -1
  187. package/dist/plugins/shared/UtilHave.d.ts +0 -24
  188. package/dist/setupTests.d.ts +0 -1
  189. package/dist/validations/index.d.ts +0 -9
  190. package/dist/validations/validations.spec.d.ts +0 -1
@@ -0,0 +1,5 @@
1
+ import { PlateEditor } from '@udecode/plate-core';
2
+ /**
3
+ * Insert list item if selection is in li>p.
4
+ */
5
+ export declare const insertListItem: (editor: PlateEditor) => boolean;
@@ -0,0 +1,14 @@
1
+ import { PlateEditor } from '@udecode/plate-core';
2
+ import { NodeEntry, Node } from 'slate';
3
+ import { CustomElement } from '../../types';
4
+ export declare const hasListAsDirectParent: (editor: PlateEditor, [, path]: NodeEntry<Node>) => boolean;
5
+ /**
6
+ * Places orphaned list items in a list. If there's a list somewhere
7
+ * in the node's ancestors, defaults to that list type, else places
8
+ * the list item in an unordered list.
9
+ */
10
+ export declare const normalizeOrphanedListItem: (editor: PlateEditor, [, path]: NodeEntry<Node>) => void;
11
+ export declare const isNonEmptyListItem: (editor: PlateEditor, [, path]: NodeEntry<Node>) => boolean;
12
+ export declare const firstNodeIsNotList: (_editor: PlateEditor, [node]: NodeEntry<CustomElement<unknown>>) => boolean;
13
+ export declare const insertParagraphAsChild: (editor: PlateEditor, [, path]: NodeEntry<Node>) => void;
14
+ export declare const replaceNodeWithListItems: (editor: any, entry: any) => void;
@@ -0,0 +1,3 @@
1
+ import { WithOverride } from '@udecode/plate-core';
2
+ import { ListPlugin } from '@udecode/plate-list';
3
+ export declare const withList: WithOverride<{}, ListPlugin>;
@@ -0,0 +1,9 @@
1
+ import * as Slate from 'slate-react';
2
+ import { RichTextPlugin } from '../../types';
3
+ interface ToolbarBoldButtonProps {
4
+ isDisabled?: boolean;
5
+ }
6
+ export declare function ToolbarBoldButton(props: ToolbarBoldButtonProps): JSX.Element | null;
7
+ export declare function Bold(props: Slate.RenderLeafProps): JSX.Element;
8
+ export declare const createBoldPlugin: () => RichTextPlugin;
9
+ export {};
@@ -0,0 +1,9 @@
1
+ import * as Slate from 'slate-react';
2
+ import { RichTextPlugin } from '../../types';
3
+ interface ToolbarCodeButtonProps {
4
+ isDisabled?: boolean;
5
+ }
6
+ export declare function ToolbarCodeButton(props: ToolbarCodeButtonProps): JSX.Element | null;
7
+ export declare function Code(props: Slate.RenderLeafProps): JSX.Element;
8
+ export declare const createCodePlugin: () => RichTextPlugin;
9
+ export {};
@@ -0,0 +1,9 @@
1
+ import * as Slate from 'slate-react';
2
+ import { RichTextPlugin } from '../../types';
3
+ interface ToolbarItalicButtonProps {
4
+ isDisabled?: boolean;
5
+ }
6
+ export declare function ToolbarItalicButton(props: ToolbarItalicButtonProps): JSX.Element | null;
7
+ export declare function Italic(props: Slate.RenderLeafProps): JSX.Element;
8
+ export declare const createItalicPlugin: () => RichTextPlugin;
9
+ export {};
@@ -0,0 +1,9 @@
1
+ import * as Slate from 'slate-react';
2
+ import { RichTextPlugin } from '../../types';
3
+ interface ToolbarUnderlineButtonProps {
4
+ isDisabled?: boolean;
5
+ }
6
+ export declare function ToolbarUnderlineButton(props: ToolbarUnderlineButtonProps): JSX.Element | null;
7
+ export declare function Underline(props: Slate.RenderLeafProps): JSX.Element;
8
+ export declare const createUnderlinePlugin: () => RichTextPlugin;
9
+ export {};
@@ -0,0 +1,2 @@
1
+ import { RichTextPlugin } from '../../types';
2
+ export declare const createMarksPlugin: () => RichTextPlugin;
@@ -0,0 +1,2 @@
1
+ import { NormalizerRule } from './types';
2
+ export declare const baseRules: Required<NormalizerRule>[];
@@ -0,0 +1,2 @@
1
+ import { RichTextPlugin } from '../../types';
2
+ export declare const createNormalizerPlugin: () => RichTextPlugin;
@@ -0,0 +1,2 @@
1
+ export * from './types';
2
+ export * from './createNormalizerPlugin';
@@ -0,0 +1,39 @@
1
+ import { PlateEditor, NodeMatch } from '@udecode/plate-core';
2
+ import { NodeEntry } from 'slate';
3
+ export declare type NodeTransformer = (editor: PlateEditor, entry: NodeEntry) => void;
4
+ export declare type NodeValidator = (editor: PlateEditor, entry: NodeEntry) => boolean;
5
+ declare type BaseRule = {
6
+ /**
7
+ * A helper to return a Node to which valid* rules are applied
8
+ * against.
9
+ *
10
+ * By default it returns only Elements of type `plugin.type`.
11
+ */
12
+ match?: NodeMatch;
13
+ /**
14
+ * A helper to normalize invalid Node(s). By default it removes
15
+ * invalid nodes.
16
+ *
17
+ * Transformations are automatically wrapped in a
18
+ * `Editor.withoutNormalization()` call to avoid unnecessary
19
+ * normalization cycles.
20
+ */
21
+ transform?: NodeTransformer | Record<string | 'default', NodeTransformer>;
22
+ };
23
+ export declare type ValidNodeRule = BaseRule & {
24
+ /**
25
+ * Checks if matching Node(s) are valid.
26
+ */
27
+ validNode: NodeValidator;
28
+ };
29
+ export declare type ValidChildrenRule = BaseRule & {
30
+ /**
31
+ * Checks if matching Node's children are valid.
32
+ *
33
+ * The value can be an array of strings as a shorthand to indicate
34
+ * valid children types.
35
+ */
36
+ validChildren: NodeValidator | string[];
37
+ };
38
+ export declare type NormalizerRule = ValidNodeRule | ValidChildrenRule;
39
+ export {};
@@ -0,0 +1,8 @@
1
+ import { PlateEditor } from '@udecode/plate-core';
2
+ import { NodeEntry, Node } from 'slate';
3
+ import { NodeValidator, NodeTransformer } from './types';
4
+ export declare class NormalizerError extends Error {
5
+ }
6
+ export declare const createValidatorFromTypes: (types: string[]) => NodeValidator;
7
+ export declare const getChildren: (editor: PlateEditor, [node, path]: NodeEntry<Node>) => NodeEntry[];
8
+ export declare const createTransformerFromObject: (transforms: Record<string, NodeTransformer>) => NodeTransformer;
@@ -0,0 +1,2 @@
1
+ import { WithOverride } from '@udecode/plate-core';
2
+ export declare const withNormalizer: WithOverride;
@@ -0,0 +1,2 @@
1
+ import { RenderElementProps } from 'slate-react';
2
+ export declare function Paragraph(props: RenderElementProps): JSX.Element;
@@ -0,0 +1,2 @@
1
+ import { RichTextPlugin } from '../../types';
2
+ export declare const createParagraphPlugin: () => RichTextPlugin;
@@ -1,5 +1 @@
1
- export function ParagraphPlugin(type?: BLOCKS): {
2
- renderNode: (props: any, _editor: any, next: any) => any;
3
- onKeyDown: (e: any, editor: any, next: any) => any;
4
- };
5
- import { BLOCKS } from "@contentful/rich-text-types";
1
+ export * from './createParagraphPlugin';
@@ -0,0 +1,2 @@
1
+ export declare function isEmbedElement(element: HTMLElement): boolean;
2
+ export declare function isEmptyElement(element: HTMLElement): boolean;
@@ -0,0 +1,2 @@
1
+ import { RichTextPlugin } from '../../types';
2
+ export declare const createPasteHTMLPlugin: () => RichTextPlugin;
@@ -0,0 +1 @@
1
+ export * from './createPasteHTMLPlugin';
@@ -0,0 +1 @@
1
+ export declare const sanitizeHTML: (html: string) => string;
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Remove empty spreadsheets columns/rows for performance reasons.
3
+ */
4
+ export declare const sanitizeSheets: (doc: Document) => Document;
@@ -0,0 +1,2 @@
1
+ import { RenderElementProps } from 'slate-react';
2
+ export declare function Quote(props: RenderElementProps): JSX.Element;
@@ -0,0 +1,4 @@
1
+ export interface ToolbarQuoteButtonProps {
2
+ isDisabled?: boolean;
3
+ }
4
+ export declare function ToolbarQuoteButton(props: ToolbarQuoteButtonProps): JSX.Element | null;
@@ -0,0 +1,2 @@
1
+ import { RichTextPlugin } from '../../types';
2
+ export declare function createQuotePlugin(): RichTextPlugin;
@@ -1,59 +1,2 @@
1
- declare var _default: {
2
- new (props: any): {
3
- handleToggle: (event: any) => any;
4
- render(): JSX.Element;
5
- context: any;
6
- setState<K extends string | number | symbol>(state: any, callback?: (() => void) | undefined): void;
7
- forceUpdate(callback?: (() => void) | undefined): void;
8
- readonly props: Readonly<any> & Readonly<{
9
- children?: React.ReactNode;
10
- }>;
11
- state: Readonly<any>;
12
- refs: {
13
- [key: string]: React.ReactInstance;
14
- };
15
- componentDidMount?(): void;
16
- shouldComponentUpdate?(nextProps: Readonly<any>, nextState: Readonly<any>, nextContext: any): boolean;
17
- componentWillUnmount?(): void;
18
- componentDidCatch?(error: Error, errorInfo: React.ErrorInfo): void;
19
- getSnapshotBeforeUpdate?(prevProps: Readonly<any>, prevState: Readonly<any>): any;
20
- componentDidUpdate?(prevProps: Readonly<any>, prevState: Readonly<any>, snapshot?: any): void;
21
- componentWillMount?(): void;
22
- UNSAFE_componentWillMount?(): void;
23
- componentWillReceiveProps?(nextProps: Readonly<any>, nextContext: any): void;
24
- UNSAFE_componentWillReceiveProps?(nextProps: Readonly<any>, nextContext: any): void;
25
- componentWillUpdate?(nextProps: Readonly<any>, nextState: Readonly<any>, nextContext: any): void;
26
- UNSAFE_componentWillUpdate?(nextProps: Readonly<any>, nextState: Readonly<any>, nextContext: any): void;
27
- };
28
- new (props: any, context: any): {
29
- handleToggle: (event: any) => any;
30
- render(): JSX.Element;
31
- context: any;
32
- setState<K extends string | number | symbol>(state: any, callback?: (() => void) | undefined): void;
33
- forceUpdate(callback?: (() => void) | undefined): void;
34
- readonly props: Readonly<any> & Readonly<{
35
- children?: React.ReactNode;
36
- }>;
37
- state: Readonly<any>;
38
- refs: {
39
- [key: string]: React.ReactInstance;
40
- };
41
- componentDidMount?(): void;
42
- shouldComponentUpdate?(nextProps: Readonly<any>, nextState: Readonly<any>, nextContext: any): boolean;
43
- componentWillUnmount?(): void;
44
- componentDidCatch?(error: Error, errorInfo: React.ErrorInfo): void;
45
- getSnapshotBeforeUpdate?(prevProps: Readonly<any>, prevState: Readonly<any>): any;
46
- componentDidUpdate?(prevProps: Readonly<any>, prevState: Readonly<any>, snapshot?: any): void;
47
- componentWillMount?(): void;
48
- UNSAFE_componentWillMount?(): void;
49
- componentWillReceiveProps?(nextProps: Readonly<any>, nextContext: any): void;
50
- UNSAFE_componentWillReceiveProps?(nextProps: Readonly<any>, nextContext: any): void;
51
- componentWillUpdate?(nextProps: Readonly<any>, nextState: Readonly<any>, nextContext: any): void;
52
- UNSAFE_componentWillUpdate?(nextProps: Readonly<any>, nextState: Readonly<any>, nextContext: any): void;
53
- };
54
- propTypes: any;
55
- contextType?: React.Context<any> | undefined;
56
- };
57
- export default _default;
58
- export { default as QuotePlugin } from "./QuotePlugin";
59
- import React from "react";
1
+ export * from './createQuotePlugin';
2
+ export * from './components/ToolbarQuoteButton';
@@ -0,0 +1,3 @@
1
+ import { HotkeyPlugin, KeyboardHandler, PlateEditor } from '@udecode/plate-core';
2
+ export declare function toggleQuote(editor: PlateEditor): void;
3
+ export declare const onKeyDownToggleQuote: KeyboardHandler<{}, HotkeyPlugin>;
@@ -0,0 +1,2 @@
1
+ import { RichTextPlugin } from '../../types';
2
+ export declare const createSelectOnBackspacePlugin: () => RichTextPlugin;
@@ -0,0 +1 @@
1
+ export * from './createSelectOnBackspacePlugin';
@@ -0,0 +1,4 @@
1
+ import { PlateEditor } from '@udecode/plate-core';
2
+ import { TablePluginOptions } from '@udecode/plate-table';
3
+ export declare const addColumnRight: (editor: PlateEditor, options: TablePluginOptions) => void;
4
+ export declare const addColumnLeft: (editor: PlateEditor, options: TablePluginOptions) => void;
@@ -0,0 +1,3 @@
1
+ import { PlateEditor } from '@udecode/plate-core';
2
+ export declare const addRowBelow: (editor: PlateEditor) => void;
3
+ export declare const addRowAbove: (editor: PlateEditor) => void;
@@ -0,0 +1,3 @@
1
+ export * from './addRow';
2
+ export * from './addColumn';
3
+ export * from './setHeader';
@@ -0,0 +1,2 @@
1
+ import { PlateEditor } from '@udecode/plate-core';
2
+ export declare const setHeader: (editor: PlateEditor, enable?: boolean | undefined) => void;
@@ -0,0 +1,3 @@
1
+ import { PlateEditor } from '@udecode/plate-core';
2
+ import { TrackingProvider } from '../../TrackingProvider';
3
+ export declare function addTableTrackingEvents(editor: PlateEditor, { onViewportAction }: TrackingProvider): void;
@@ -0,0 +1,2 @@
1
+ import * as Slate from 'slate-react';
2
+ export declare const Cell: (props: Slate.RenderElementProps) => JSX.Element;
@@ -0,0 +1,2 @@
1
+ import * as Slate from 'slate-react';
2
+ export declare const HeaderCell: (props: Slate.RenderElementProps) => JSX.Element;
@@ -0,0 +1,2 @@
1
+ import * as Slate from 'slate-react';
2
+ export declare const Row: (props: Slate.RenderElementProps) => JSX.Element;
@@ -0,0 +1,2 @@
1
+ import * as Slate from 'slate-react';
2
+ export declare const Table: (props: Slate.RenderElementProps) => JSX.Element;
@@ -0,0 +1,4 @@
1
+ export declare const styles: {
2
+ topRight: string;
3
+ };
4
+ export declare const TableActions: () => JSX.Element | null;
@@ -0,0 +1,4 @@
1
+ export interface ToolbarTableButtonProps {
2
+ isDisabled: boolean | undefined;
3
+ }
4
+ export declare function ToolbarTableButton(props: ToolbarTableButtonProps): JSX.Element | null;
@@ -0,0 +1,3 @@
1
+ import { TrackingProvider } from '../../TrackingProvider';
2
+ import { RichTextPlugin } from '../../types';
3
+ export declare const createTablePlugin: (tracking: TrackingProvider) => RichTextPlugin;
@@ -0,0 +1,15 @@
1
+ import { PlateEditor } from '@udecode/plate-core';
2
+ import { Node, NodeEntry } from 'slate';
3
+ export declare function insertTableAndFocusFirstCell(editor: PlateEditor): void;
4
+ export declare function isTableActive(editor: PlateEditor): boolean;
5
+ export declare function isTableHeaderEnabled(editor: PlateEditor): boolean;
6
+ export declare function replaceEmptyParagraphWithTable(editor: PlateEditor): void;
7
+ /**
8
+ * Returns the number of cells in a given row vs the table width
9
+ *
10
+ * Note: We should only get different table rows cell counts in between
11
+ * normalization cycles.
12
+ */
13
+ export declare const getNoOfMissingTableCellsInRow: (editor: PlateEditor, [, rowPath]: NodeEntry<Node>) => number;
14
+ export declare const createEmptyTableCells: (count: number) => Node[];
15
+ export declare const isNotEmpty: (editor: PlateEditor, [, path]: NodeEntry<Node>) => boolean;
@@ -0,0 +1,2 @@
1
+ export * from './createTablePlugin';
2
+ export * from './components/ToolbarButton';
@@ -0,0 +1,2 @@
1
+ import { RichTextPlugin } from '../../types';
2
+ export declare function createTextPlugin(): RichTextPlugin;
@@ -0,0 +1 @@
1
+ export * from './createTextPlugin';
@@ -0,0 +1 @@
1
+ export declare const createTrailingParagraphPlugin: () => import("@udecode/plate-core").PlatePlugin<{}, import("@udecode/plate-trailing-block").TrailingBlockPlugin>;
@@ -0,0 +1,2 @@
1
+ import { RichTextPlugin } from '../../types';
2
+ export declare const createVoidsPlugin: () => RichTextPlugin;
@@ -0,0 +1 @@
1
+ export * from './createVoidsPlugin';
@@ -0,0 +1,6 @@
1
+ import { PlateEditor } from '@udecode/plate-core';
2
+ import { NodeEntry } from 'slate';
3
+ /**
4
+ * Re-creates a void node with valid children.
5
+ */
6
+ export declare const transformVoid: (editor: PlateEditor, [node, path]: NodeEntry<import("slate").Node>) => void;
@@ -1 +1,6 @@
1
- export function buildPlugins(richTextAPI: any): any[];
1
+ import { FieldExtensionSDK } from '@contentful/app-sdk';
2
+ import { PlateProps } from '@udecode/plate-core';
3
+ import { TrackingProvider } from '../TrackingProvider';
4
+ import { RichTextPlugin } from '../types';
5
+ export declare const getPlugins: (sdk: FieldExtensionSDK, tracking: TrackingProvider) => RichTextPlugin[];
6
+ export declare const disableCorePlugins: PlateProps['disableCorePlugins'];
@@ -0,0 +1,7 @@
1
+ import React, { ComponentProps } from 'react';
2
+ import { TrackingProvider } from '../TrackingProvider';
3
+ declare type WithEntityFetchProps = {
4
+ onEntityFetchComplete: VoidFunction;
5
+ } & JSX.IntrinsicAttributes;
6
+ export declare function withLinkTracking(tracking: TrackingProvider, Component: React.ComponentType<WithEntityFetchProps>): (props: ComponentProps<typeof Component>) => JSX.Element;
7
+ export {};
@@ -0,0 +1,7 @@
1
+ import { Entry, Asset } from '@contentful/field-editor-shared';
2
+ interface EntityStatusIconProps {
3
+ entity: Entry | Asset;
4
+ entityType: 'Entry' | 'Asset';
5
+ }
6
+ export declare function EntityStatusIcon({ entity, entityType }: EntityStatusIconProps): JSX.Element;
7
+ export {};
@@ -0,0 +1,23 @@
1
+ import { FieldExtensionSDK } from '@contentful/app-sdk';
2
+ import { File } from '@contentful/field-editor-shared';
3
+ interface FetchingWrappedAssetCardProps {
4
+ assetId: string;
5
+ isDisabled: boolean;
6
+ isSelected: boolean;
7
+ locale: string;
8
+ onEdit?: () => void;
9
+ onRemove?: () => unknown;
10
+ sdk: FieldExtensionSDK;
11
+ onEntityFetchComplete?: VoidFunction;
12
+ }
13
+ export declare function renderAssetInfo(props: {
14
+ entityFile: File;
15
+ }): ("" | JSX.Element)[];
16
+ export declare function renderActions(props: {
17
+ onEdit?: () => void;
18
+ onRemove?: () => void;
19
+ isDisabled: boolean;
20
+ entityFile?: File;
21
+ }): (JSX.Element | null)[];
22
+ export declare function FetchingWrappedAssetCard(props: FetchingWrappedAssetCardProps): JSX.Element;
23
+ export {};
@@ -0,0 +1,13 @@
1
+ import { FieldExtensionSDK } from '@contentful/app-sdk';
2
+ interface FetchingWrappedEntryCardProps {
3
+ entryId: string;
4
+ isDisabled: boolean;
5
+ isSelected: boolean;
6
+ locale: string;
7
+ sdk: FieldExtensionSDK;
8
+ onEntityFetchComplete?: VoidFunction;
9
+ onEdit?: VoidFunction;
10
+ onRemove?: VoidFunction;
11
+ }
12
+ export declare function FetchingWrappedEntryCard(props: FetchingWrappedEntryCardProps): JSX.Element;
13
+ export {};
@@ -0,0 +1,11 @@
1
+ interface ToolbarButtonProps {
2
+ onClick: () => void;
3
+ isActive?: boolean;
4
+ isDisabled?: boolean;
5
+ children: any;
6
+ title: string;
7
+ className?: string;
8
+ testId?: string;
9
+ }
10
+ export declare function ToolbarButton(props: ToolbarButtonProps): JSX.Element;
11
+ export {};
@@ -0,0 +1,8 @@
1
+ import { PlateEditor } from '@udecode/plate-core';
2
+ export declare const assertOutput: (options: {
3
+ input?: any;
4
+ expected: any;
5
+ editor?: PlateEditor;
6
+ log?: boolean;
7
+ skipCursor?: boolean;
8
+ }) => void;
@@ -0,0 +1,14 @@
1
+ import { FieldExtensionSDK } from '@contentful/app-sdk';
2
+ import { PlateEditor } from '@udecode/plate-core';
3
+ import { TrackingProvider } from '../TrackingProvider';
4
+ import { RichTextPlugin } from '../types';
5
+ export declare const normalize: (editor: PlateEditor) => void;
6
+ export declare const createTestEditor: (options: {
7
+ input?: any;
8
+ sdk?: FieldExtensionSDK;
9
+ tracking?: TrackingProvider;
10
+ plugins?: RichTextPlugin[];
11
+ }) => {
12
+ editor: PlateEditor<{}>;
13
+ normalize: () => void;
14
+ };
@@ -0,0 +1,4 @@
1
+ export * from './jsx';
2
+ export * from './createEditor';
3
+ export * from './mockPlugin';
4
+ export * from './assertOutput';
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Mapping for JSX => Slate Node types
3
+ *
4
+ * Add items as needed. Don't forget to adjust hyperscript.d.ts
5
+ */
6
+ export declare const jsx: <S extends "editor" | "selection" | "text" | "element" | "focus" | "anchor" | "cursor" | "fragment">(tagName: S, attributes?: Object | undefined, ...children: any[]) => ReturnType<({
7
+ anchor: typeof import("slate-hyperscript/dist/creators").createAnchor;
8
+ cursor: typeof import("slate-hyperscript/dist/creators").createCursor;
9
+ editor: (tagName: string, attributes: {
10
+ [key: string]: any;
11
+ }, children: any[]) => import("slate").BaseEditor;
12
+ element: typeof import("slate-hyperscript/dist/creators").createElement;
13
+ focus: typeof import("slate-hyperscript/dist/creators").createFocus;
14
+ fragment: typeof import("slate-hyperscript/dist/creators").createFragment;
15
+ selection: typeof import("slate-hyperscript/dist/creators").createSelection;
16
+ text: typeof import("slate-hyperscript/dist/creators").createText;
17
+ } | {
18
+ anchor: typeof import("slate-hyperscript/dist/creators").createAnchor;
19
+ cursor: typeof import("slate-hyperscript/dist/creators").createCursor;
20
+ editor: (tagName: string, attributes: {
21
+ [key: string]: any;
22
+ }, children: any[]) => import("slate").BaseEditor;
23
+ element: typeof import("slate-hyperscript/dist/creators").createElement;
24
+ focus: typeof import("slate-hyperscript/dist/creators").createFocus;
25
+ fragment: typeof import("slate-hyperscript/dist/creators").createFragment;
26
+ selection: typeof import("slate-hyperscript/dist/creators").createSelection;
27
+ text: typeof import("slate-hyperscript/dist/creators").createText;
28
+ })[S]>;
@@ -0,0 +1,2 @@
1
+ import { RichTextPlugin } from '../types';
2
+ export declare const mockPlugin: (p: Partial<RichTextPlugin>) => import("@udecode/plate-core").WithRequired<import("@udecode/plate-core").PlatePlugin<{}, {}>, "type" | "options" | "inject" | "editor">;
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Used to guarantee a unique editor and plugin keys for tests.
3
+ */
4
+ export declare const randomId: (prefix?: string) => string;
@@ -0,0 +1,6 @@
1
+ import { PlateEditor } from '@udecode/plate-core';
2
+ /**
3
+ * Sets empty node.data attributes. Helpful when testing against
4
+ * output generated by a 3rd-party library e.g. Plate.
5
+ */
6
+ export declare const setEmptyDataAttribute: (root: PlateEditor) => void;
@@ -0,0 +1 @@
1
+ export declare function validateRichTextDocument(document: any): never[];
@@ -0,0 +1,42 @@
1
+ import { MARKS } from '@contentful/rich-text-types';
2
+ import { PlatePlugin } from '@udecode/plate-core';
3
+ import { RenderElementProps } from 'slate-react';
4
+ import type { SoftBreakRule, ExitBreakRule } from './plugins/Break';
5
+ import type { NormalizerRule } from './plugins/Normalizer';
6
+ export declare type CustomText = {
7
+ text: string;
8
+ [MARKS.BOLD]?: boolean;
9
+ [MARKS.CODE]?: boolean;
10
+ [MARKS.ITALIC]?: boolean;
11
+ [MARKS.UNDERLINE]?: boolean;
12
+ };
13
+ export declare type TextOrCustomElement = CustomElement | CustomText;
14
+ export declare type CustomElement<T = unknown> = {
15
+ type: string;
16
+ children: TextOrCustomElement[];
17
+ data: T;
18
+ isVoid?: boolean;
19
+ };
20
+ export declare type CustomRenderElementProps<T = any, O = any> = Omit<RenderElementProps, 'element'> & {
21
+ element: CustomElement<T>;
22
+ } & O;
23
+ declare module 'slate' {
24
+ interface CustomTypes {
25
+ Element: CustomElement;
26
+ Text: CustomText;
27
+ }
28
+ }
29
+ export interface RichTextPlugin extends PlatePlugin {
30
+ /**
31
+ * @see createSoftBreakPlugin
32
+ */
33
+ softBreak?: SoftBreakRule[];
34
+ /**
35
+ * @see createExitBreakPlugin
36
+ */
37
+ exitBreak?: ExitBreakRule[];
38
+ /**
39
+ * @see createNormalizerPlugin
40
+ */
41
+ normalizer?: NormalizerRule[];
42
+ }