@contentful/field-editor-rich-text 3.0.0-next.0 → 3.0.2

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 (172) hide show
  1. package/CHANGELOG.md +698 -0
  2. package/LICENSE +21 -0
  3. package/README.md +25 -3
  4. package/dist/ContentfulEditorProvider.d.ts +6 -5
  5. package/dist/RichTextEditor.d.ts +2 -3
  6. package/dist/SdkProvider.d.ts +1 -1
  7. package/dist/Toolbar/{EmbedEntityWidget.d.ts → components/EmbedEntityWidget.d.ts} +1 -2
  8. package/dist/{plugins/EmbeddedEntity/index.d.ts → Toolbar/components/EmbeddedEntityDropdownButton.d.ts} +1 -2
  9. package/dist/Toolbar/{StickyToolbarWrapper.d.ts → components/StickyToolbarWrapper.d.ts} +0 -0
  10. package/dist/Toolbar/index.d.ts +0 -1
  11. package/dist/dialogs/HypelinkDialog/HyperlinkDialog.d.ts +3 -3
  12. package/dist/dialogs/renderRichTextDialog.d.ts +0 -1
  13. package/dist/field-editor-rich-text.cjs.development.js +6503 -4337
  14. package/dist/field-editor-rich-text.cjs.development.js.map +1 -1
  15. package/dist/field-editor-rich-text.cjs.production.min.js +1 -1
  16. package/dist/field-editor-rich-text.cjs.production.min.js.map +1 -1
  17. package/dist/field-editor-rich-text.esm.js +6485 -4319
  18. package/dist/field-editor-rich-text.esm.js.map +1 -1
  19. package/dist/helpers/editor.d.ts +21 -23
  20. package/dist/helpers/environment.d.ts +2 -1
  21. package/dist/helpers/extractNodes.d.ts +6 -0
  22. package/dist/helpers/removeInternalMarks.d.ts +1 -0
  23. package/dist/helpers/sanitizeIncomingSlateDoc.d.ts +6 -0
  24. package/dist/helpers/transformers.d.ts +8 -0
  25. package/dist/helpers/validations.d.ts +1 -1
  26. package/dist/plugins/Break/createExitBreakPlugin.d.ts +2 -0
  27. package/dist/plugins/Break/createResetNodePlugin.d.ts +2 -0
  28. package/dist/plugins/Break/createSoftBreakPlugin.d.ts +2 -0
  29. package/dist/plugins/Break/index.d.ts +5 -0
  30. package/dist/plugins/CommandPalette/components/CommandList.d.ts +7 -0
  31. package/dist/plugins/CommandPalette/components/CommandList.styles.d.ts +13 -0
  32. package/dist/plugins/CommandPalette/components/CommandPrompt.d.ts +2 -0
  33. package/dist/plugins/CommandPalette/constants.d.ts +1 -0
  34. package/dist/plugins/CommandPalette/createCommandPalettePlugin.d.ts +13 -0
  35. package/dist/plugins/CommandPalette/hooks/useCommandList.d.ts +4 -0
  36. package/dist/plugins/CommandPalette/index.d.ts +1 -0
  37. package/dist/plugins/CommandPalette/onKeyDown.d.ts +3 -0
  38. package/dist/plugins/CommandPalette/useCommands.d.ts +14 -0
  39. package/dist/plugins/CommandPalette/utils/createInlineEntryNode.d.ts +16 -0
  40. package/dist/plugins/CommandPalette/utils/fetchAssets.d.ts +8 -0
  41. package/dist/plugins/CommandPalette/utils/fetchEntries.d.ts +9 -0
  42. package/dist/plugins/CommandPalette/utils/insertBlock.d.ts +1 -0
  43. package/dist/plugins/CommandPalette/utils/trimLeadingSlash.d.ts +7 -0
  44. package/dist/plugins/DragAndDrop/index.d.ts +2 -2
  45. package/dist/plugins/EmbeddedEntityBlock/LinkedEntityBlock.d.ts +3 -2
  46. package/dist/plugins/EmbeddedEntityBlock/ToolbarIcon.d.ts +1 -4
  47. package/dist/plugins/EmbeddedEntityBlock/Util.d.ts +2 -1
  48. package/dist/plugins/EmbeddedEntityBlock/index.d.ts +3 -9
  49. package/dist/plugins/EmbeddedEntityInline/FetchingWrappedInlineEntryCard.d.ts +1 -0
  50. package/dist/plugins/EmbeddedEntityInline/index.d.ts +3 -6
  51. package/dist/plugins/Heading/components/Heading.d.ts +10 -0
  52. package/dist/plugins/Heading/components/ToolbarHeadingButton.d.ts +4 -0
  53. package/dist/plugins/Heading/createHeadingPlugin.d.ts +2 -0
  54. package/dist/plugins/Heading/index.d.ts +2 -20
  55. package/dist/plugins/Hr/index.d.ts +3 -5
  56. package/dist/plugins/Hyperlink/HyperlinkModal.d.ts +6 -6
  57. package/dist/plugins/Hyperlink/components/EntityHyperlink.d.ts +9 -0
  58. package/dist/plugins/Hyperlink/components/ToolbarHyperlinkButton.d.ts +5 -0
  59. package/dist/plugins/Hyperlink/components/UrlHyperlink.d.ts +9 -0
  60. package/dist/plugins/Hyperlink/components/styles.d.ts +4 -0
  61. package/dist/plugins/Hyperlink/createHyperlinkPlugin.d.ts +3 -0
  62. package/dist/plugins/Hyperlink/index.d.ts +2 -12
  63. package/dist/plugins/Hyperlink/useEntityInfo.d.ts +16 -0
  64. package/dist/plugins/Hyperlink/utils.d.ts +5 -0
  65. package/dist/plugins/List/components/List.d.ts +3 -0
  66. package/dist/plugins/List/components/ListItem.d.ts +2 -0
  67. package/dist/plugins/List/components/ToolbarListButton.d.ts +4 -0
  68. package/dist/plugins/List/createListPlugin.d.ts +2 -0
  69. package/dist/plugins/List/index.d.ts +2 -15
  70. package/dist/plugins/List/insertListBreak.d.ts +2 -0
  71. package/dist/plugins/List/insertListFragment.d.ts +3 -0
  72. package/dist/plugins/List/onKeyDownList.d.ts +7 -0
  73. package/dist/plugins/List/transforms/deleteBackwardList.d.ts +2 -0
  74. package/dist/plugins/List/transforms/insertListItem.d.ts +5 -0
  75. package/dist/plugins/List/transforms/moveListItemDown.d.ts +11 -0
  76. package/dist/plugins/List/transforms/moveListItems.d.ts +10 -0
  77. package/dist/plugins/List/transforms/toggleList.d.ts +4 -0
  78. package/dist/plugins/List/transforms/unwrapList.d.ts +5 -0
  79. package/dist/plugins/List/utils.d.ts +15 -0
  80. package/dist/plugins/List/withList.d.ts +4 -0
  81. package/dist/plugins/Marks/Bold.d.ts +11 -0
  82. package/dist/plugins/Marks/Code.d.ts +11 -0
  83. package/dist/plugins/Marks/Italic.d.ts +11 -0
  84. package/dist/plugins/Marks/Underline.d.ts +11 -0
  85. package/dist/plugins/Marks/components/MarkToolbarButton.d.ts +13 -0
  86. package/dist/plugins/Marks/helpers.d.ts +4 -0
  87. package/dist/plugins/Marks/index.d.ts +2 -0
  88. package/dist/plugins/Normalizer/baseRules.d.ts +2 -0
  89. package/dist/plugins/Normalizer/createNormalizerPlugin.d.ts +2 -0
  90. package/dist/plugins/Normalizer/index.d.ts +2 -0
  91. package/dist/plugins/Normalizer/types.d.ts +40 -0
  92. package/dist/plugins/Normalizer/utils.d.ts +8 -0
  93. package/dist/plugins/Normalizer/withNormalizer.d.ts +2 -0
  94. package/dist/plugins/Paragraph/Paragraph.d.ts +2 -0
  95. package/dist/plugins/Paragraph/createParagraphPlugin.d.ts +2 -0
  96. package/dist/plugins/Paragraph/index.d.ts +1 -7
  97. package/dist/plugins/Paragraph/utils.d.ts +2 -0
  98. package/dist/plugins/PasteHTML/createPasteHTMLPlugin.d.ts +8 -0
  99. package/dist/plugins/PasteHTML/index.d.ts +1 -0
  100. package/dist/plugins/PasteHTML/utils/sanitizeHTML.d.ts +1 -0
  101. package/dist/plugins/PasteHTML/utils/sanitizeSheets.d.ts +4 -0
  102. package/dist/plugins/Quote/components/Quote.d.ts +2 -0
  103. package/dist/plugins/Quote/components/ToolbarQuoteButton.d.ts +4 -0
  104. package/dist/plugins/Quote/createQuotePlugin.d.ts +2 -0
  105. package/dist/plugins/Quote/index.d.ts +2 -13
  106. package/dist/plugins/Quote/shouldResetQuote.d.ts +8 -0
  107. package/dist/plugins/Quote/toggleQuote.d.ts +5 -0
  108. package/dist/plugins/Quote/withQuote.d.ts +3 -0
  109. package/dist/plugins/SelectOnBackspace/createSelectOnBackspacePlugin.d.ts +2 -0
  110. package/dist/plugins/SelectOnBackspace/index.d.ts +1 -0
  111. package/dist/plugins/Table/actions/addColumn.d.ts +3 -3
  112. package/dist/plugins/Table/actions/addRow.d.ts +3 -3
  113. package/dist/plugins/Table/actions/setHeader.d.ts +2 -2
  114. package/dist/plugins/Table/components/Cell.d.ts +2 -0
  115. package/dist/plugins/Table/components/HeaderCell.d.ts +2 -0
  116. package/dist/plugins/Table/components/Row.d.ts +2 -0
  117. package/dist/plugins/Table/components/Table.d.ts +2 -0
  118. package/dist/plugins/Table/components/TableActions.d.ts +4 -0
  119. package/dist/plugins/Table/components/ToolbarButton.d.ts +4 -0
  120. package/dist/plugins/Table/createTablePlugin.d.ts +2 -0
  121. package/dist/plugins/Table/helpers.d.ts +16 -4
  122. package/dist/plugins/Table/index.d.ts +2 -189
  123. package/dist/plugins/Table/insertTableFragment.d.ts +3 -0
  124. package/dist/plugins/Table/onKeyDownTable.d.ts +3 -0
  125. package/dist/plugins/Table/tableTracking.d.ts +4 -0
  126. package/dist/plugins/Text/createTextPlugin.d.ts +2 -0
  127. package/dist/plugins/Text/index.d.ts +1 -0
  128. package/dist/plugins/Tracking/createTrackingPlugin.d.ts +11 -0
  129. package/dist/plugins/Tracking/index.d.ts +1 -0
  130. package/dist/plugins/Tracking/utils.d.ts +2 -0
  131. package/dist/plugins/TrailingParagraph/index.d.ts +2 -1
  132. package/dist/plugins/Voids/createVoidsPlugin.d.ts +2 -0
  133. package/dist/plugins/Voids/index.d.ts +1 -0
  134. package/dist/plugins/Voids/transformVoid.d.ts +6 -0
  135. package/dist/plugins/index.d.ts +6 -0
  136. package/dist/plugins/links-tracking.d.ts +6 -0
  137. package/dist/plugins/shared/FetchingWrappedAssetCard.d.ts +1 -11
  138. package/dist/plugins/shared/FetchingWrappedEntryCard.d.ts +4 -4
  139. package/dist/plugins/shared/ToolbarButton.d.ts +0 -1
  140. package/dist/prepareDocument.d.ts +20 -0
  141. package/dist/test-utils/assertOutput.d.ts +7 -0
  142. package/dist/test-utils/createEditor.d.ts +13 -0
  143. package/dist/test-utils/index.d.ts +4 -0
  144. package/dist/test-utils/jsx.d.ts +28 -0
  145. package/dist/test-utils/mockPlugin.d.ts +2 -0
  146. package/dist/test-utils/randomId.d.ts +4 -0
  147. package/dist/test-utils/setEmptyDataAttribute.d.ts +6 -0
  148. package/dist/test-utils/validation.d.ts +1 -0
  149. package/dist/types.d.ts +34 -9
  150. package/dist/useOnValueChanged.d.ts +8 -0
  151. package/package.json +34 -29
  152. package/dist/TrackingProvider.d.ts +0 -11
  153. package/dist/helpers/deserializer.d.ts +0 -3
  154. package/dist/helpers/sanitizeSlateDoc.d.ts +0 -18
  155. package/dist/helpers/truncate.d.ts +0 -1
  156. package/dist/plugins/Bold/index.d.ts +0 -12
  157. package/dist/plugins/Code/index.d.ts +0 -12
  158. package/dist/plugins/CommandPalette/CommandPanel/InViewport/InViewport.d.ts +0 -37
  159. package/dist/plugins/Hyperlink/EntryAssetTooltip.d.ts +0 -10
  160. package/dist/plugins/InsertBeforeFirstVoidBlock/index.d.ts +0 -2
  161. package/dist/plugins/Italic/index.d.ts +0 -12
  162. package/dist/plugins/List/getListInsertFragment.d.ts +0 -6
  163. package/dist/plugins/NewLine/index.d.ts +0 -2
  164. package/dist/plugins/Paste/index.d.ts +0 -2
  165. package/dist/plugins/Paste/sanitizers/helpers.d.ts +0 -7
  166. package/dist/plugins/Paste/sanitizers/index.d.ts +0 -3
  167. package/dist/plugins/Paste/sanitizers/removeComments.d.ts +0 -2
  168. package/dist/plugins/Paste/sanitizers/sanitizeEntityBlocks.d.ts +0 -6
  169. package/dist/plugins/Paste/sanitizers/sanitizeTables.d.ts +0 -2
  170. package/dist/plugins/Table/TableActions.d.ts +0 -5
  171. package/dist/plugins/Underline/index.d.ts +0 -12
  172. package/dist/plugins/shared/EntityStatusIcon.d.ts +0 -8
@@ -1,23 +1,21 @@
1
- import { Path } from 'slate';
2
- import { BLOCKS, INLINES } from '@contentful/rich-text-types';
3
- import { CustomElement } from '../types';
4
1
  import { Link } from '@contentful/field-editor-reference/dist/types';
5
- import { PlateEditor } from '@udecode/plate-core';
2
+ import { BLOCKS, INLINES } from '@contentful/rich-text-types';
3
+ import { EditorNodesOptions, PlateEditor, ToggleNodeTypeOptions } from '@udecode/plate-core';
4
+ import { Path, Node } from 'slate';
5
+ import { CustomElement, RichTextEditor } from '../types';
6
6
  export declare const LINK_TYPES: INLINES[];
7
- export declare function isBlockSelected(editor: any, type: string): boolean;
8
- export declare function isVoid(editor: any, element: any): boolean;
9
- export declare function hasSelectionText(editor: any): boolean;
7
+ export declare function isBlockSelected(editor: PlateEditor, type: string): boolean;
8
+ export declare function isRootLevel(path: Path): boolean;
10
9
  declare type NodeEntry = [CustomElement, Path];
11
10
  declare type NodeType = BLOCKS | INLINES;
12
- export declare function getNodeEntryFromSelection(editor: any, nodeTypeOrTypes: NodeType | NodeType[]): NodeEntry | [];
13
- export declare function isNodeTypeSelected(editor: any, nodeType: BLOCKS | INLINES): boolean;
14
- export declare function moveToTheNextLine(editor: any): void;
15
- export declare function moveToThePreviousLine(editor: any): void;
16
- export declare function toggleBlock(editor: any, type: string): void;
17
- export declare function getElementFromCurrentSelection(editor: any): (import("slate").BaseEditor | CustomElement<unknown> | import("slate").BaseText | Path)[];
18
- export declare function isList(editor: any): boolean;
11
+ export declare function getNodeEntryFromSelection(editor: RichTextEditor, nodeTypeOrTypes: NodeType | NodeType[], path?: Path): NodeEntry | [];
12
+ export declare function isNodeTypeSelected(editor: RichTextEditor, nodeType: BLOCKS | INLINES): boolean;
13
+ export declare function moveToTheNextLine(editor: RichTextEditor): void;
14
+ export declare function moveToTheNextChar(editor: RichTextEditor): void;
15
+ export declare function insertEmptyParagraph(editor: RichTextEditor, options?: any): void;
16
+ export declare function getElementFromCurrentSelection(editor: RichTextEditor): (Node | Path)[];
17
+ export declare function isList(editor?: RichTextEditor): boolean;
19
18
  export declare function getTableSize(table: CustomElement): Record<'numRows' | 'numColumns', number> | null;
20
- export declare function isFirstChild(path: Path): boolean;
21
19
  interface InsertLinkOptions {
22
20
  text: string;
23
21
  type: INLINES.HYPERLINK | INLINES.ENTRY_HYPERLINK | INLINES.ASSET_HYPERLINK;
@@ -26,18 +24,18 @@ interface InsertLinkOptions {
26
24
  path?: Path;
27
25
  }
28
26
  export declare function insertLink(editor: any, options: InsertLinkOptions): void;
29
- export declare function isLinkActive(editor: any): boolean;
27
+ export declare function isLinkActive(editor?: RichTextEditor): boolean;
30
28
  export declare function unwrapLink(editor: any): void;
31
29
  export declare function wrapLink(editor: any, { text, url, target, type, path }: InsertLinkOptions): void;
32
- export declare function getAncestorPathFromSelection(editor: PlateEditor): Path | undefined;
33
- export declare function shouldUnwrapBlockquote(editor: PlateEditor, type: BLOCKS): boolean;
34
- export declare function unwrapFromRoot(editor: PlateEditor): void;
35
- export declare const isAtEndOfTextSelection: (editor: PlateEditor) => boolean;
36
- export declare function currentSelectionStartsTableCell(editor: PlateEditor): boolean;
30
+ export declare function getAncestorPathFromSelection(editor: RichTextEditor): Path | undefined;
31
+ export declare const isAtEndOfTextSelection: (editor: RichTextEditor) => boolean;
37
32
  /**
38
33
  * This traversal strategy is unfortunately necessary because Slate doesn't
39
34
  * expose something like Node.next(editor).
40
35
  */
41
- export declare function getNextNode(editor: PlateEditor): CustomElement | null;
42
- export declare function currentSelectionPrecedesTableCell(editor: PlateEditor): boolean;
36
+ export declare function getNextNode(editor: RichTextEditor): CustomElement | null;
37
+ export declare const INLINE_TYPES: string[];
38
+ export declare const isInlineOrText: (node: Node) => boolean;
39
+ export declare const focus: (editor: RichTextEditor) => void;
40
+ export declare function toggleElement(editor: RichTextEditor, options: ToggleNodeTypeOptions, editorOptions?: Omit<EditorNodesOptions, 'match'>): void;
43
41
  export {};
@@ -1 +1,2 @@
1
- export declare const HAS_BEFORE_INPUT_SUPPORT: boolean;
1
+ export declare const IS_SAFARI: boolean;
2
+ export declare const IS_CHROME: boolean;
@@ -0,0 +1,6 @@
1
+ import { Path } from 'slate';
2
+ import { CustomElement, RichTextEditor } from '../types';
3
+ /**
4
+ * It filters out all paragraphs and headings from a path and convert them into paragraphs.
5
+ */
6
+ export declare function extractParagraphs(editor: RichTextEditor, path: Path): CustomElement[];
@@ -0,0 +1 @@
1
+ export declare const removeInternalMarks: (document: Record<string, unknown>) => any;
@@ -0,0 +1,6 @@
1
+ import { TextOrCustomElement } from '../types';
2
+ /**
3
+ * Ensures all nodes have a child leaf text element. This should be handled by
4
+ * Slate but its behavior has proven to be buggy and unpredictable.
5
+ */
6
+ export declare function sanitizeIncomingSlateDoc(nodes?: TextOrCustomElement[]): TextOrCustomElement[];
@@ -0,0 +1,8 @@
1
+ import { BLOCKS, INLINES } from '@contentful/rich-text-types';
2
+ import { NodeEntry } from 'slate';
3
+ import { RichTextEditor } from '../types';
4
+ export declare const transformRemove: (editor: RichTextEditor, [, path]: NodeEntry<import("slate").Node>) => void;
5
+ export declare const transformParagraphs: (editor: RichTextEditor, entry: NodeEntry<import("slate").Node>) => void;
6
+ export declare const transformUnwrap: (editor: RichTextEditor, [, path]: NodeEntry<import("slate").Node>) => void;
7
+ export declare const transformWrapIn: (type: BLOCKS | INLINES) => (editor: RichTextEditor, [, path]: NodeEntry<import("slate").Node>) => void;
8
+ export declare const transformLift: (editor: RichTextEditor, [, path]: NodeEntry<import("slate").Node>) => void;
@@ -1,5 +1,5 @@
1
- import { BLOCKS, INLINES } from '@contentful/rich-text-types';
2
1
  import { FieldExtensionSDK } from '@contentful/app-sdk';
2
+ import { BLOCKS, INLINES } from '@contentful/rich-text-types';
3
3
  export declare const VALIDATIONS: {
4
4
  ENABLED_MARKS: string;
5
5
  ENABLED_NODE_TYPES: string;
@@ -0,0 +1,2 @@
1
+ import { RichTextPlugin } from '../../types';
2
+ export declare const createExitBreakPlugin: () => RichTextPlugin;
@@ -0,0 +1,2 @@
1
+ import { RichTextPlugin } from '../../types';
2
+ export declare const createResetNodePlugin: () => RichTextPlugin;
@@ -0,0 +1,2 @@
1
+ import { RichTextPlugin } from '../../types';
2
+ export declare const createSoftBreakPlugin: () => RichTextPlugin;
@@ -0,0 +1,5 @@
1
+ export type { SoftBreakRule, ExitBreakRule } from '@udecode/plate-break';
2
+ export type { ResetNodePluginRule } from '@udecode/plate-reset-node';
3
+ export * from './createSoftBreakPlugin';
4
+ export * from './createExitBreakPlugin';
5
+ export * from './createResetNodePlugin';
@@ -0,0 +1,7 @@
1
+ import { RichTextEditor } from '../../../types';
2
+ export interface CommandListProps {
3
+ query: string;
4
+ editor: RichTextEditor;
5
+ textContainer?: HTMLSpanElement;
6
+ }
7
+ export declare const CommandList: ({ query, editor, textContainer }: CommandListProps) => JSX.Element | null;
@@ -0,0 +1,13 @@
1
+ declare const styles: {
2
+ container: string;
3
+ menuContent: string;
4
+ menuList: string;
5
+ menuItem: string;
6
+ menuItemSelected: string;
7
+ menuDivider: string;
8
+ menuHeader: string;
9
+ menuFooter: string;
10
+ footerList: string;
11
+ thumbnail: string;
12
+ };
13
+ export default styles;
@@ -0,0 +1,2 @@
1
+ import { PlateRenderLeafProps } from '@udecode/plate-core';
2
+ export declare const CommandPrompt: (props: PlateRenderLeafProps) => JSX.Element;
@@ -0,0 +1 @@
1
+ export declare const COMMAND_PROMPT = "command-prompt";
@@ -0,0 +1,13 @@
1
+ import { RichTextPlugin } from '../../types';
2
+ /**
3
+ * A command palette plugin (aka slash commands)
4
+ *
5
+ * How does it work?
6
+ * * When the user presses the slash key, the editor will show a command palette
7
+ * * When the user presses a key, the command palette will show the command suggestions
8
+ * * When the user presses enter, the command palette will execute the command
9
+ * * When the user presses escape, the command palette will hide
10
+ * * When the user presses a letter, number, or space, the command palette will show the command suggestions
11
+ * * When the user presses backspace, the command palette will remove the last character from the command string
12
+ */
13
+ export declare const createCommandPalettePlugin: () => RichTextPlugin;
@@ -0,0 +1,4 @@
1
+ export declare const useCommandList: (commandItems: any, container: any) => {
2
+ selectedItem: string;
3
+ isOpen: boolean;
4
+ };
@@ -0,0 +1 @@
1
+ export { createCommandPalettePlugin } from './createCommandPalettePlugin';
@@ -0,0 +1,3 @@
1
+ import { KeyboardHandler } from '@udecode/plate-core';
2
+ import { RichTextEditor } from '../../types';
3
+ export declare const createOnKeyDown: () => KeyboardHandler<RichTextEditor>;
@@ -0,0 +1,14 @@
1
+ import { FieldExtensionSDK } from '@contentful/app-sdk';
2
+ import { RichTextEditor } from 'types';
3
+ export interface Command {
4
+ id: string;
5
+ thumbnail?: string;
6
+ label: string;
7
+ callback?: () => void;
8
+ }
9
+ export interface CommandGroup {
10
+ group: string;
11
+ commands: Command[];
12
+ }
13
+ export declare type CommandList = (Command | CommandGroup)[];
14
+ export declare const useCommands: (sdk: FieldExtensionSDK, query: string, editor: RichTextEditor) => CommandList;
@@ -0,0 +1,16 @@
1
+ import { INLINES } from '@contentful/rich-text-types';
2
+ export declare function createInlineEntryNode(id: string): {
3
+ type: INLINES;
4
+ children: {
5
+ text: string;
6
+ }[];
7
+ data: {
8
+ target: {
9
+ sys: {
10
+ id: string;
11
+ type: string;
12
+ linkType: string;
13
+ };
14
+ };
15
+ };
16
+ };
@@ -0,0 +1,8 @@
1
+ import { FieldExtensionSDK } from '@contentful/app-sdk';
2
+ export declare function fetchAssets(sdk: FieldExtensionSDK, query: string): Promise<{
3
+ contentTypeName: string;
4
+ displayTitle: string;
5
+ id: string;
6
+ entity: import("@contentful/app-sdk").Asset;
7
+ thumbnail: string;
8
+ }[]>;
@@ -0,0 +1,9 @@
1
+ import { FieldExtensionSDK } from '@contentful/app-sdk';
2
+ import { ContentTypeProps } from 'contentful-management/types';
3
+ export declare function fetchEntries(sdk: FieldExtensionSDK, contentType: ContentTypeProps, query: string): Promise<{
4
+ contentTypeName: string;
5
+ displayTitle: string;
6
+ id: string;
7
+ description: string;
8
+ entry: import("@contentful/app-sdk").Entry<unknown>;
9
+ }[]>;
@@ -0,0 +1 @@
1
+ export declare function insertBlock(editor: any, nodeType: any, entity: any): void;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Trim leading slash character if found. Bails otherwise.
3
+ *
4
+ * @example
5
+ * trimLeadingSlash("/my query") // --> "my query"
6
+ */
7
+ export declare function trimLeadingSlash(text: string): string;
@@ -1,2 +1,2 @@
1
- import { PlatePlugin } from '@udecode/plate-core';
2
- export declare function createDragAndDropPlugin(): PlatePlugin;
1
+ import { RichTextPlugin } from '../../types';
2
+ export declare function createDragAndDropPlugin(): RichTextPlugin;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { CustomRenderElementProps } from '../../types';
3
2
  declare type LinkedEntityBlockProps = CustomRenderElementProps<{
4
3
  target: {
@@ -8,6 +7,8 @@ declare type LinkedEntityBlockProps = CustomRenderElementProps<{
8
7
  type: 'Link';
9
8
  };
10
9
  };
11
- }>;
10
+ }> & {
11
+ onEntityFetchComplete: VoidFunction;
12
+ };
12
13
  export declare function LinkedEntityBlock(props: LinkedEntityBlockProps): JSX.Element;
13
14
  export {};
@@ -1,13 +1,10 @@
1
- /// <reference types="react" />
2
1
  export declare const styles: {
3
2
  icon: string;
4
3
  };
5
4
  interface EmbeddedEntityBlockToolbarIconProps {
6
- isButton?: boolean;
7
5
  isDisabled: boolean;
8
- logAction?: () => void;
9
6
  nodeType: string;
10
7
  onClose: () => void;
11
8
  }
12
- export declare function EmbeddedEntityBlockToolbarIcon({ isButton, isDisabled, logAction, nodeType, onClose, }: EmbeddedEntityBlockToolbarIconProps): JSX.Element;
9
+ export declare function EmbeddedEntityBlockToolbarIcon({ isDisabled, nodeType, onClose, }: EmbeddedEntityBlockToolbarIconProps): JSX.Element;
13
10
  export {};
@@ -1,2 +1,3 @@
1
- export declare function selectEntityAndInsert(nodeType: any, sdk: any, editor: any, logAction: any): Promise<void>;
1
+ import { TrackingPluginActions } from '../../plugins/Tracking';
2
+ export declare function selectEntityAndInsert(nodeType: any, sdk: any, editor: any, logAction: TrackingPluginActions['onToolbarAction'] | TrackingPluginActions['onShortcutAction']): Promise<void>;
2
3
  export declare function insertBlock(editor: any, nodeType: any, entity: any): void;
@@ -1,11 +1,5 @@
1
- import { KeyboardEvent } from 'react';
2
- import { BLOCKS } from '@contentful/rich-text-types';
3
- import { PlatePlugin, PlateEditor } from '@udecode/plate-core';
4
- import { CustomSlatePluginOptions } from 'types';
5
1
  import { FieldExtensionSDK } from '@contentful/app-sdk';
2
+ import { RichTextPlugin } from '../../types';
6
3
  export { EmbeddedEntityBlockToolbarIcon as ToolbarIcon } from './ToolbarIcon';
7
- export declare const createEmbeddedEntryBlockPlugin: (sdk: FieldExtensionSDK) => PlatePlugin;
8
- export declare const createEmbeddedAssetBlockPlugin: (sdk: FieldExtensionSDK) => PlatePlugin;
9
- export declare const withEmbeddedEntryBlockOptions: CustomSlatePluginOptions;
10
- export declare const withEmbeddedAssetBlockOptions: CustomSlatePluginOptions;
11
- export declare function getWithEmbeddedEntityEvents(nodeType: BLOCKS.EMBEDDED_ENTRY | BLOCKS.EMBEDDED_ASSET, sdk: FieldExtensionSDK): (editor: PlateEditor) => (event: KeyboardEvent) => void;
4
+ export declare const createEmbeddedEntryBlockPlugin: (sdk: FieldExtensionSDK) => RichTextPlugin;
5
+ export declare const createEmbeddedAssetBlockPlugin: (sdk: FieldExtensionSDK) => RichTextPlugin;
@@ -7,6 +7,7 @@ interface FetchingWrappedInlineEntryCardProps {
7
7
  isDisabled: boolean;
8
8
  onEdit: (event: React.MouseEvent<Element, MouseEvent>) => void;
9
9
  onRemove: (event: React.MouseEvent<Element, MouseEvent>) => void;
10
+ onEntityFetchComplete?: VoidFunction;
10
11
  }
11
12
  export declare function FetchingWrappedInlineEntryCard(props: FetchingWrappedInlineEntryCardProps): JSX.Element;
12
13
  export {};
@@ -1,12 +1,9 @@
1
- /// <reference types="react" />
2
- import { PlatePlugin } from '@udecode/plate-core';
3
- import { CustomSlatePluginOptions } from '../../types';
1
+ import { FieldExtensionSDK } from '@contentful/app-sdk';
2
+ import { RichTextPlugin } from '../../types';
4
3
  interface ToolbarEmbeddedEntityInlineButtonProps {
5
4
  onClose: () => void;
6
5
  isDisabled: boolean;
7
- isButton?: boolean;
8
6
  }
9
7
  export declare function ToolbarEmbeddedEntityInlineButton(props: ToolbarEmbeddedEntityInlineButtonProps): JSX.Element;
10
- export declare function createEmbeddedEntityInlinePlugin(sdk: any): PlatePlugin;
11
- export declare const withEmbeddedEntityInlineOptions: CustomSlatePluginOptions;
8
+ export declare function createEmbeddedEntityInlinePlugin(sdk: FieldExtensionSDK): RichTextPlugin;
12
9
  export {};
@@ -0,0 +1,10 @@
1
+ import * as React from 'react';
2
+ import * as Slate from 'slate-react';
3
+ export declare const HeadingComponents: {
4
+ "heading-1": React.MemoExoticComponent<(props: Slate.RenderElementProps) => JSX.Element>;
5
+ "heading-2": React.MemoExoticComponent<(props: Slate.RenderElementProps) => JSX.Element>;
6
+ "heading-3": React.MemoExoticComponent<(props: Slate.RenderElementProps) => JSX.Element>;
7
+ "heading-4": React.MemoExoticComponent<(props: Slate.RenderElementProps) => JSX.Element>;
8
+ "heading-5": React.MemoExoticComponent<(props: Slate.RenderElementProps) => JSX.Element>;
9
+ "heading-6": React.MemoExoticComponent<(props: Slate.RenderElementProps) => JSX.Element>;
10
+ };
@@ -0,0 +1,4 @@
1
+ export interface ToolbarHeadingButtonProps {
2
+ isDisabled?: boolean;
3
+ }
4
+ export declare function ToolbarHeadingButton(props: ToolbarHeadingButtonProps): JSX.Element | null;
@@ -0,0 +1,2 @@
1
+ import { RichTextPlugin } from '../../types';
2
+ export declare const createHeadingPlugin: () => RichTextPlugin;
@@ -1,20 +1,2 @@
1
- import * as React from 'react';
2
- import * as Slate from 'slate-react';
3
- import { BLOCKS } from '@contentful/rich-text-types';
4
- import { PlatePlugin, PlateEditor } from '@udecode/plate-core';
5
- import { CustomSlatePluginOptions } from '../../types';
6
- export declare function withHeadingEvents(editor: PlateEditor): (event: React.KeyboardEvent) => void;
7
- interface ToolbarHeadingButtonProps {
8
- isDisabled?: boolean;
9
- }
10
- export declare function ToolbarHeadingButton(props: ToolbarHeadingButtonProps): JSX.Element | null;
11
- export declare function createHeading(Tag: any, block: BLOCKS): (props: Slate.RenderElementProps) => JSX.Element;
12
- export declare const H1: (props: Slate.RenderElementProps) => JSX.Element;
13
- export declare const H2: (props: Slate.RenderElementProps) => JSX.Element;
14
- export declare const H3: (props: Slate.RenderElementProps) => JSX.Element;
15
- export declare const H4: (props: Slate.RenderElementProps) => JSX.Element;
16
- export declare const H5: (props: Slate.RenderElementProps) => JSX.Element;
17
- export declare const H6: (props: Slate.RenderElementProps) => JSX.Element;
18
- export declare function createHeadingPlugin(): PlatePlugin;
19
- export declare const withHeadingOptions: CustomSlatePluginOptions;
20
- export {};
1
+ export * from './components/ToolbarHeadingButton';
2
+ export * from './createHeadingPlugin';
@@ -1,13 +1,11 @@
1
1
  import * as React from 'react';
2
2
  import * as Slate from 'slate-react';
3
- import { PlatePlugin, PlateEditor } from '@udecode/plate-core';
4
- import { CustomSlatePluginOptions } from '../../types';
3
+ import { RichTextEditor, RichTextPlugin } from '../../types';
5
4
  interface ToolbarHrButtonProps {
6
5
  isDisabled?: boolean;
7
6
  }
8
- export declare function withHrEvents(editor: PlateEditor): (event: React.KeyboardEvent) => void;
7
+ export declare function withHrEvents(editor: RichTextEditor): (event: React.KeyboardEvent) => void;
9
8
  export declare function ToolbarHrButton(props: ToolbarHrButtonProps): JSX.Element | null;
10
9
  export declare function Hr(props: Slate.RenderLeafProps): JSX.Element;
11
- export declare function createHrPlugin(): PlatePlugin;
12
- export declare const withHrOptions: CustomSlatePluginOptions;
10
+ export declare const createHrPlugin: () => RichTextPlugin;
13
11
  export {};
@@ -1,9 +1,8 @@
1
- /// <reference types="react" />
2
- import { FieldExtensionSDK } from '@contentful/field-editor-shared';
3
- import { PlateEditor } from '@udecode/plate-core';
4
- import { ReactEditor } from 'slate-react';
5
- import { HistoryEditor } from 'slate-history';
6
1
  import { Link } from '@contentful/field-editor-reference/dist/types';
2
+ import { FieldExtensionSDK } from '@contentful/field-editor-shared';
3
+ import { Path } from 'slate';
4
+ import { TrackingPluginActions } from '../../plugins/Tracking';
5
+ import { RichTextEditor } from '../../types';
7
6
  interface HyperlinkModalProps {
8
7
  linkText?: string;
9
8
  linkType?: string;
@@ -11,7 +10,8 @@ interface HyperlinkModalProps {
11
10
  linkEntity?: Link;
12
11
  onClose: (value: unknown) => void;
13
12
  sdk: FieldExtensionSDK;
13
+ readonly: boolean;
14
14
  }
15
15
  export declare function HyperlinkModal(props: HyperlinkModalProps): JSX.Element;
16
- export declare function addOrEditLink(editor: ReactEditor & HistoryEditor & PlateEditor, sdk: FieldExtensionSDK): Promise<void>;
16
+ export declare function addOrEditLink(editor: RichTextEditor, sdk: FieldExtensionSDK, logAction: TrackingPluginActions['onToolbarAction'] | TrackingPluginActions['onShortcutAction'] | TrackingPluginActions['onViewportAction'], targetPath?: Path): Promise<void>;
17
17
  export {};
@@ -0,0 +1,9 @@
1
+ import { Link } from '@contentful/app-sdk';
2
+ import { CustomRenderElementProps } from '../../../types';
3
+ declare type HyperlinkElementProps = CustomRenderElementProps<{
4
+ uri?: string;
5
+ target?: Link;
6
+ onEntityFetchComplete?: VoidFunction;
7
+ }>;
8
+ export declare function EntityHyperlink(props: HyperlinkElementProps): JSX.Element | null;
9
+ export {};
@@ -0,0 +1,5 @@
1
+ interface ToolbarHyperlinkButtonProps {
2
+ isDisabled: boolean | undefined;
3
+ }
4
+ export declare function ToolbarHyperlinkButton(props: ToolbarHyperlinkButtonProps): JSX.Element | null;
5
+ export {};
@@ -0,0 +1,9 @@
1
+ import { Link } from '@contentful/app-sdk';
2
+ import { CustomRenderElementProps } from '../../../types';
3
+ declare type HyperlinkElementProps = CustomRenderElementProps<{
4
+ uri?: string;
5
+ target?: Link;
6
+ onEntityFetchComplete?: VoidFunction;
7
+ }>;
8
+ export declare function UrlHyperlink(props: HyperlinkElementProps): JSX.Element;
9
+ export {};
@@ -0,0 +1,4 @@
1
+ export declare const styles: {
2
+ hyperlinkWrapper: string;
3
+ hyperlink: string;
4
+ };
@@ -0,0 +1,3 @@
1
+ import { FieldExtensionSDK } from '@contentful/app-sdk';
2
+ import { RichTextPlugin } from '../../types';
3
+ export declare const createHyperlinkPlugin: (sdk: FieldExtensionSDK) => RichTextPlugin;
@@ -1,12 +1,2 @@
1
- import * as React from 'react';
2
- import { PlatePlugin } from '@udecode/plate-core';
3
- import { FieldExtensionSDK } from '@contentful/app-sdk';
4
- import { CustomSlatePluginOptions } from '../../types';
5
- export declare function createHyperlinkPlugin(sdk: FieldExtensionSDK): PlatePlugin;
6
- export declare function buildHyperlinkEventHandler(sdk: any): (editor: any) => (event: React.KeyboardEvent) => void;
7
- interface ToolbarHyperlinkButtonProps {
8
- isDisabled: boolean | undefined;
9
- }
10
- export declare function ToolbarHyperlinkButton(props: ToolbarHyperlinkButtonProps): JSX.Element | null;
11
- export declare const withHyperlinkOptions: CustomSlatePluginOptions;
12
- export {};
1
+ export { ToolbarHyperlinkButton } from './components/ToolbarHyperlinkButton';
2
+ export { createHyperlinkPlugin } from './createHyperlinkPlugin';
@@ -0,0 +1,16 @@
1
+ import { FieldExtensionSDK, Link, Entry, Asset, ScheduledAction } from '@contentful/app-sdk';
2
+ import { entityHelpers } from '@contentful/field-editor-shared';
3
+ export declare type FetchedEntityData = {
4
+ jobs: ScheduledAction[];
5
+ entity: Entry | Asset;
6
+ entityTitle: string;
7
+ entityDescription: string;
8
+ entityStatus: ReturnType<typeof entityHelpers.getEntryStatus>;
9
+ contentTypeName: string;
10
+ };
11
+ export declare type EntityInfoProps = {
12
+ target: Link;
13
+ sdk: FieldExtensionSDK;
14
+ onEntityFetchComplete?: VoidFunction;
15
+ };
16
+ export declare function useEntityInfo(props: EntityInfoProps): string;
@@ -0,0 +1,5 @@
1
+ import { NodeEntry, Node } from 'slate';
2
+ import { RichTextEditor } from '../../types';
3
+ import { FetchedEntityData } from './useEntityInfo';
4
+ export declare const hasText: (editor: RichTextEditor, entry: NodeEntry<Node>) => boolean;
5
+ export declare function getEntityInfo(data?: FetchedEntityData): string;
@@ -0,0 +1,3 @@
1
+ import * as Slate from 'slate-react';
2
+ export declare const ListUL: (props: Slate.RenderElementProps) => JSX.Element;
3
+ export declare const ListOL: (props: Slate.RenderElementProps) => JSX.Element;
@@ -0,0 +1,2 @@
1
+ import * as Slate from 'slate-react';
2
+ export declare function ListItem(props: Slate.RenderElementProps): JSX.Element;
@@ -0,0 +1,4 @@
1
+ export interface ToolbarListButtonProps {
2
+ isDisabled?: boolean;
3
+ }
4
+ export declare function ToolbarListButton(props: ToolbarListButtonProps): JSX.Element | null;
@@ -0,0 +1,2 @@
1
+ import { RichTextPlugin } from '../../types';
2
+ export declare const createListPlugin: () => RichTextPlugin;
@@ -1,15 +1,2 @@
1
- /// <reference types="react" />
2
- import * as Slate from 'slate-react';
3
- import { BLOCKS } from '@contentful/rich-text-types';
4
- import { CustomSlatePluginOptions } from '../../types';
5
- interface ToolbarListButtonProps {
6
- isDisabled?: boolean;
7
- }
8
- export declare function ToolbarListButton(props: ToolbarListButtonProps): JSX.Element | null;
9
- export declare function createList(Tag: any, block: BLOCKS): (props: Slate.RenderElementProps) => JSX.Element;
10
- export declare const UL: (props: Slate.RenderElementProps) => JSX.Element;
11
- export declare const OL: (props: Slate.RenderElementProps) => JSX.Element;
12
- export declare const LI: (props: Slate.RenderElementProps) => JSX.Element;
13
- export declare const withListOptions: CustomSlatePluginOptions;
14
- export declare const createListPlugin: () => import("@udecode/plate-core").PlatePlugin<{}>;
15
- export {};
1
+ export * from './createListPlugin';
2
+ export * from './components/ToolbarListButton';
@@ -0,0 +1,2 @@
1
+ import { RichTextEditor } from '../../types';
2
+ export declare const insertListBreak: (editor: RichTextEditor) => () => void;
@@ -0,0 +1,3 @@
1
+ import { TDescendant } from '@udecode/plate-core';
2
+ import { RichTextEditor } from '../../types';
3
+ export declare const insertListFragment: (editor: RichTextEditor) => (fragment: TDescendant[]) => void;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Credit: Modified version of Plate's list plugin
3
+ * See: https://github.com/udecode/plate/blob/main/packages/nodes/list
4
+ */
5
+ import { HotkeyPlugin, KeyboardHandler } from '@udecode/plate-core';
6
+ import { RichTextEditor } from '../../types';
7
+ export declare const onKeyDownList: KeyboardHandler<RichTextEditor, HotkeyPlugin>;
@@ -0,0 +1,2 @@
1
+ import { RichTextEditor } from '../../../types';
2
+ export declare const deleteBackwardList: (editor: RichTextEditor, unit: 'character' | 'word' | 'line' | 'block') => boolean;
@@ -0,0 +1,5 @@
1
+ import { RichTextEditor } from '../../../types';
2
+ /**
3
+ * Insert list item if selection is in li>p.
4
+ */
5
+ export declare const insertListItem: (editor: RichTextEditor) => boolean;
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Credit: Modified version of Plate's list plugin
3
+ * See: https://github.com/udecode/plate/blob/main/packages/nodes/list
4
+ */
5
+ import { PlateEditor, TElement } from '@udecode/plate-core';
6
+ import { NodeEntry } from 'slate';
7
+ export interface MoveListItemDownOptions {
8
+ list: NodeEntry<TElement>;
9
+ listItem: NodeEntry<TElement>;
10
+ }
11
+ export declare const moveListItemDown: (editor: PlateEditor, { list, listItem }: MoveListItemDownOptions) => void;
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Credit: Modified version of Plate's list plugin
3
+ * See: https://github.com/udecode/plate/blob/main/packages/nodes/list
4
+ */
5
+ import { EditorNodesOptions, PlateEditor } from '@udecode/plate-core';
6
+ export declare type MoveListItemsOptions = {
7
+ increase?: boolean;
8
+ at?: EditorNodesOptions['at'];
9
+ };
10
+ export declare const moveListItems: (editor: PlateEditor, { increase, at }?: MoveListItemsOptions) => void;
@@ -0,0 +1,4 @@
1
+ import { PlateEditor } from '@udecode/plate-core';
2
+ export declare const toggleList: (editor: PlateEditor, { type }: {
3
+ type: string;
4
+ }) => void;