@contentful/field-editor-rich-text 2.0.0-next.1 → 2.0.0-next.10

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 (119) hide show
  1. package/dist/RichTextEditor.d.ts +1 -2
  2. package/dist/Toolbar/{EmbedEntityWidget.d.ts → components/EmbedEntityWidget.d.ts} +0 -1
  3. package/dist/{plugins/EmbeddedEntity/index.d.ts → Toolbar/components/EmbeddedEntityDropdownButton.d.ts} +1 -2
  4. package/dist/Toolbar/{StickyToolbarWrapper.d.ts → components/StickyToolbarWrapper.d.ts} +0 -0
  5. package/dist/Toolbar/index.d.ts +0 -1
  6. package/dist/TrackingProvider.d.ts +1 -1
  7. package/dist/dialogs/renderRichTextDialog.d.ts +0 -1
  8. package/dist/field-editor-rich-text.cjs.development.js +4271 -3635
  9. package/dist/field-editor-rich-text.cjs.development.js.map +1 -1
  10. package/dist/field-editor-rich-text.cjs.production.min.js +1 -1
  11. package/dist/field-editor-rich-text.cjs.production.min.js.map +1 -1
  12. package/dist/field-editor-rich-text.esm.js +4343 -3707
  13. package/dist/field-editor-rich-text.esm.js.map +1 -1
  14. package/dist/helpers/editor.d.ts +8 -8
  15. package/dist/helpers/environment.d.ts +1 -0
  16. package/dist/helpers/extractNodes.d.ts +7 -0
  17. package/dist/helpers/sanitizeSlateDoc.d.ts +1 -14
  18. package/dist/helpers/transformers.d.ts +8 -0
  19. package/dist/helpers/validations.d.ts +1 -1
  20. package/dist/plugins/Break/createExitBreakPlugin.d.ts +2 -0
  21. package/dist/plugins/Break/createSoftBreakPlugin.d.ts +2 -0
  22. package/dist/plugins/Break/index.d.ts +3 -0
  23. package/dist/plugins/DragAndDrop/index.d.ts +2 -2
  24. package/dist/plugins/EmbeddedEntityBlock/LinkedEntityBlock.d.ts +3 -2
  25. package/dist/plugins/EmbeddedEntityBlock/ToolbarIcon.d.ts +0 -1
  26. package/dist/plugins/EmbeddedEntityBlock/index.d.ts +4 -9
  27. package/dist/plugins/EmbeddedEntityInline/FetchingWrappedInlineEntryCard.d.ts +1 -0
  28. package/dist/plugins/EmbeddedEntityInline/index.d.ts +4 -5
  29. package/dist/plugins/Heading/components/Heading.d.ts +11 -0
  30. package/dist/plugins/Heading/components/ToolbarHeadingButton.d.ts +4 -0
  31. package/dist/plugins/Heading/createHeadingPlugin.d.ts +2 -0
  32. package/dist/plugins/Heading/index.d.ts +2 -20
  33. package/dist/plugins/Hr/index.d.ts +3 -4
  34. package/dist/plugins/Hyperlink/EntryAssetTooltip.d.ts +0 -1
  35. package/dist/plugins/Hyperlink/HyperlinkModal.d.ts +2 -3
  36. package/dist/plugins/Hyperlink/index.d.ts +3 -6
  37. package/dist/plugins/Hyperlink/truncate.d.ts +1 -0
  38. package/dist/plugins/Hyperlink/utils.d.ts +3 -0
  39. package/dist/plugins/List/components/List.d.ts +3 -0
  40. package/dist/plugins/List/components/ListItem.d.ts +2 -0
  41. package/dist/plugins/List/components/ToolbarListButton.d.ts +4 -0
  42. package/dist/plugins/List/createListPlugin.d.ts +2 -0
  43. package/dist/plugins/List/index.d.ts +2 -15
  44. package/dist/plugins/List/insertListBreak.d.ts +2 -0
  45. package/dist/plugins/List/insertListFragment.d.ts +2 -0
  46. package/dist/plugins/List/transforms/insertListItem.d.ts +5 -0
  47. package/dist/plugins/List/utils.d.ts +14 -0
  48. package/dist/plugins/List/withList.d.ts +3 -0
  49. package/dist/plugins/{Bold/index.d.ts → Marks/Bold.d.ts} +2 -5
  50. package/dist/plugins/{Code/index.d.ts → Marks/Code.d.ts} +2 -5
  51. package/dist/plugins/{Italic/index.d.ts → Marks/Italic.d.ts} +2 -5
  52. package/dist/plugins/{Underline/index.d.ts → Marks/Underline.d.ts} +2 -5
  53. package/dist/plugins/Marks/index.d.ts +2 -0
  54. package/dist/plugins/Normalizer/baseRules.d.ts +2 -0
  55. package/dist/plugins/Normalizer/createNormalizerPlugin.d.ts +2 -0
  56. package/dist/plugins/Normalizer/index.d.ts +2 -0
  57. package/dist/plugins/Normalizer/types.d.ts +39 -0
  58. package/dist/plugins/Normalizer/utils.d.ts +8 -0
  59. package/dist/plugins/Normalizer/withNormalizer.d.ts +2 -0
  60. package/dist/plugins/Paragraph/Paragraph.d.ts +2 -0
  61. package/dist/plugins/Paragraph/createParagraphPlugin.d.ts +2 -0
  62. package/dist/plugins/Paragraph/index.d.ts +1 -7
  63. package/dist/plugins/Paragraph/utils.d.ts +2 -0
  64. package/dist/plugins/PasteHTML/createPasteHTMLPlugin.d.ts +2 -0
  65. package/dist/plugins/PasteHTML/index.d.ts +1 -0
  66. package/dist/plugins/PasteHTML/utils/sanitizeHTML.d.ts +1 -0
  67. package/dist/plugins/PasteHTML/utils/sanitizeSheets.d.ts +4 -0
  68. package/dist/plugins/Quote/components/Quote.d.ts +2 -0
  69. package/dist/plugins/Quote/components/ToolbarQuoteButton.d.ts +4 -0
  70. package/dist/plugins/Quote/createQuotePlugin.d.ts +2 -0
  71. package/dist/plugins/Quote/index.d.ts +2 -13
  72. package/dist/plugins/Quote/toggleQuote.d.ts +3 -0
  73. package/dist/plugins/SelectOnBackspace/createSelectOnBackspacePlugin.d.ts +2 -0
  74. package/dist/plugins/SelectOnBackspace/index.d.ts +1 -0
  75. package/dist/plugins/Table/addTableTrackingEvents.d.ts +3 -0
  76. package/dist/plugins/Table/components/Cell.d.ts +2 -0
  77. package/dist/plugins/Table/components/HeaderCell.d.ts +2 -0
  78. package/dist/plugins/Table/components/Row.d.ts +2 -0
  79. package/dist/plugins/Table/components/Table.d.ts +2 -0
  80. package/dist/plugins/Table/components/TableActions.d.ts +4 -0
  81. package/dist/plugins/Table/components/ToolbarButton.d.ts +4 -0
  82. package/dist/plugins/Table/createTablePlugin.d.ts +3 -0
  83. package/dist/plugins/Table/helpers.d.ts +11 -0
  84. package/dist/plugins/Table/index.d.ts +2 -189
  85. package/dist/plugins/Text/createTextPlugin.d.ts +2 -0
  86. package/dist/plugins/Text/index.d.ts +1 -0
  87. package/dist/plugins/TrailingParagraph/index.d.ts +1 -1
  88. package/dist/plugins/Voids/createVoidsPlugin.d.ts +2 -0
  89. package/dist/plugins/Voids/index.d.ts +1 -0
  90. package/dist/plugins/Voids/transformVoid.d.ts +6 -0
  91. package/dist/plugins/index.d.ts +6 -0
  92. package/dist/plugins/links-tracking.d.ts +7 -0
  93. package/dist/plugins/shared/EntityStatusIcon.d.ts +0 -1
  94. package/dist/plugins/shared/FetchingWrappedAssetCard.d.ts +1 -1
  95. package/dist/plugins/shared/FetchingWrappedEntryCard.d.ts +3 -3
  96. package/dist/plugins/shared/ToolbarButton.d.ts +0 -1
  97. package/dist/test-utils/assertOutput.d.ts +8 -0
  98. package/dist/test-utils/createEditor.d.ts +14 -0
  99. package/dist/test-utils/index.d.ts +4 -0
  100. package/dist/test-utils/jsx.d.ts +28 -0
  101. package/dist/test-utils/mockPlugin.d.ts +2 -0
  102. package/dist/test-utils/randomId.d.ts +4 -0
  103. package/dist/test-utils/setEmptyDataAttribute.d.ts +6 -0
  104. package/dist/test-utils/validation.d.ts +1 -0
  105. package/dist/types.d.ts +26 -9
  106. package/package.json +27 -24
  107. package/dist/helpers/deserializer.d.ts +0 -3
  108. package/dist/helpers/truncate.d.ts +0 -1
  109. package/dist/plugins/CommandPalette/CommandPanel/InViewport/InViewport.d.ts +0 -37
  110. package/dist/plugins/InsertBeforeFirstVoidBlock/index.d.ts +0 -2
  111. package/dist/plugins/List/getListInsertFragment.d.ts +0 -6
  112. package/dist/plugins/NewLine/index.d.ts +0 -2
  113. package/dist/plugins/Paste/index.d.ts +0 -2
  114. package/dist/plugins/Paste/sanitizers/helpers.d.ts +0 -7
  115. package/dist/plugins/Paste/sanitizers/index.d.ts +0 -3
  116. package/dist/plugins/Paste/sanitizers/removeComments.d.ts +0 -2
  117. package/dist/plugins/Paste/sanitizers/sanitizeEntityBlocks.d.ts +0 -6
  118. package/dist/plugins/Paste/sanitizers/sanitizeTables.d.ts +0 -2
  119. package/dist/plugins/Table/TableActions.d.ts +0 -5
@@ -1,23 +1,20 @@
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';
2
+ import { BLOCKS, INLINES } from '@contentful/rich-text-types';
5
3
  import { PlateEditor } from '@udecode/plate-core';
4
+ import { Path, Node } from 'slate';
5
+ import { CustomElement } from '../types';
6
6
  export declare const LINK_TYPES: INLINES[];
7
7
  export declare function isBlockSelected(editor: any, type: string): boolean;
8
- export declare function isVoid(editor: any, element: any): boolean;
8
+ export declare function isRootLevel(path: Path): boolean;
9
9
  export declare function hasSelectionText(editor: any): boolean;
10
10
  declare type NodeEntry = [CustomElement, Path];
11
11
  declare type NodeType = BLOCKS | INLINES;
12
12
  export declare function getNodeEntryFromSelection(editor: any, nodeTypeOrTypes: NodeType | NodeType[]): NodeEntry | [];
13
13
  export declare function isNodeTypeSelected(editor: any, nodeType: BLOCKS | INLINES): boolean;
14
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)[];
15
+ export declare function getElementFromCurrentSelection(editor: any): (import("slate").BaseEditor | CustomElement<unknown> | import("../types").CustomText | Path)[];
18
16
  export declare function isList(editor: any): boolean;
19
17
  export declare function getTableSize(table: CustomElement): Record<'numRows' | 'numColumns', number> | null;
20
- export declare function isFirstChild(path: Path): boolean;
21
18
  interface InsertLinkOptions {
22
19
  text: string;
23
20
  type: INLINES.HYPERLINK | INLINES.ENTRY_HYPERLINK | INLINES.ASSET_HYPERLINK;
@@ -40,4 +37,7 @@ export declare function currentSelectionStartsTableCell(editor: PlateEditor): bo
40
37
  */
41
38
  export declare function getNextNode(editor: PlateEditor): CustomElement | null;
42
39
  export declare function currentSelectionPrecedesTableCell(editor: PlateEditor): boolean;
40
+ export declare const INLINE_TYPES: string[];
41
+ export declare const isInlineOrText: (node: Node) => boolean;
42
+ export declare const focus: (editor: PlateEditor) => void;
43
43
  export {};
@@ -1 +1,2 @@
1
1
  export declare const HAS_BEFORE_INPUT_SUPPORT: boolean;
2
+ export declare const IS_SAFARI: boolean;
@@ -0,0 +1,7 @@
1
+ import { PlateEditor } from '@udecode/plate-core';
2
+ import { Path } from 'slate';
3
+ import { CustomElement } from '../types';
4
+ /**
5
+ * It filters out all paragraphs and headings from a path and convert them into paragraphs.
6
+ */
7
+ export declare function extractParagraphs(editor: PlateEditor, path: Path): CustomElement[];
@@ -1,18 +1,5 @@
1
- import { BLOCKS, INLINES, Text } from '@contentful/rich-text-types';
2
- import { TextOrCustomElement } from 'types';
3
- declare type NodeType = BLOCKS | INLINES | Text['nodeType'];
4
- /**
5
- * Ensures "orphaned" text node elements (those without a parent capable of
6
- * validly rendering a text child node) are wrapped with a suitable parent
7
- * element to prevent failures on the validation layer.
8
- *
9
- * It is commonplace for third party plugins (including udecode) to reconcile
10
- * deletion events by inserting such nodes into their schema. This
11
- * subprocedure is intended as a guard against such cases.
12
- */
13
- export declare function sanitizeSlateDoc(nodes?: TextOrCustomElement[], parentNodeType?: NodeType): TextOrCustomElement[];
1
+ import { TextOrCustomElement } from '../types';
14
2
  /**
15
3
  * Ensures incoming void nodes have a child leaf text element.
16
4
  */
17
5
  export declare function sanitizeIncomingSlateDoc(nodes?: TextOrCustomElement[]): TextOrCustomElement[];
18
- export {};
@@ -0,0 +1,8 @@
1
+ import { BLOCKS, INLINES } from '@contentful/rich-text-types';
2
+ import { PlateEditor } from '@udecode/plate-core';
3
+ import { NodeEntry } from 'slate';
4
+ export declare const transformRemove: (editor: PlateEditor, [, path]: NodeEntry<import("slate").Node>) => void;
5
+ export declare const transformParagraphs: (editor: PlateEditor, entry: NodeEntry<import("slate").Node>) => void;
6
+ export declare const transformUnwrap: (editor: PlateEditor, [, path]: NodeEntry<import("slate").Node>) => void;
7
+ export declare const transformWrapIn: (type: BLOCKS | INLINES) => (editor: PlateEditor, [, path]: NodeEntry<import("slate").Node>) => void;
8
+ export declare const transformLift: (editor: PlateEditor, [, 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 createSoftBreakPlugin: () => RichTextPlugin;
@@ -0,0 +1,3 @@
1
+ export type { SoftBreakRule, ExitBreakRule } from '@udecode/plate-break';
2
+ export * from './createSoftBreakPlugin';
3
+ export * from './createExitBreakPlugin';
@@ -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,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  export declare const styles: {
3
2
  icon: string;
4
3
  };
@@ -1,11 +1,6 @@
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 { TrackingProvider } from 'TrackingProvider';
3
+ import { RichTextPlugin } from '../../types';
6
4
  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;
5
+ export declare const createEmbeddedEntryBlockPlugin: (sdk: FieldExtensionSDK, tracking: TrackingProvider) => RichTextPlugin;
6
+ export declare const createEmbeddedAssetBlockPlugin: (sdk: FieldExtensionSDK, tracking: TrackingProvider) => 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,11 @@
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 { TrackingProvider } from 'TrackingProvider';
3
+ import { RichTextPlugin } from '../../types';
4
4
  interface ToolbarEmbeddedEntityInlineButtonProps {
5
5
  onClose: () => void;
6
6
  isDisabled: boolean;
7
7
  isButton?: boolean;
8
8
  }
9
9
  export declare function ToolbarEmbeddedEntityInlineButton(props: ToolbarEmbeddedEntityInlineButtonProps): JSX.Element;
10
- export declare function createEmbeddedEntityInlinePlugin(sdk: any): PlatePlugin;
11
- export declare const withEmbeddedEntityInlineOptions: CustomSlatePluginOptions;
10
+ export declare function createEmbeddedEntityInlinePlugin(sdk: FieldExtensionSDK, tracking: TrackingProvider): RichTextPlugin;
12
11
  export {};
@@ -0,0 +1,11 @@
1
+ import * as React from 'react';
2
+ import { BLOCKS } from '@contentful/rich-text-types';
3
+ import * as Slate from 'slate-react';
4
+ export declare const HeadingComponents: {
5
+ "heading-1": React.MemoExoticComponent<(props: Slate.RenderElementProps) => JSX.Element>;
6
+ "heading-2": React.MemoExoticComponent<(props: Slate.RenderElementProps) => JSX.Element>;
7
+ "heading-3": React.MemoExoticComponent<(props: Slate.RenderElementProps) => JSX.Element>;
8
+ "heading-4": React.MemoExoticComponent<(props: Slate.RenderElementProps) => JSX.Element>;
9
+ "heading-5": React.MemoExoticComponent<(props: Slate.RenderElementProps) => JSX.Element>;
10
+ "heading-6": React.MemoExoticComponent<(props: Slate.RenderElementProps) => JSX.Element>;
11
+ };
@@ -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,12 @@
1
1
  import * as React from 'react';
2
+ import { PlateEditor } from '@udecode/plate-core';
2
3
  import * as Slate from 'slate-react';
3
- import { PlatePlugin, PlateEditor } from '@udecode/plate-core';
4
- import { CustomSlatePluginOptions } from '../../types';
4
+ import { RichTextPlugin } from '../../types';
5
5
  interface ToolbarHrButtonProps {
6
6
  isDisabled?: boolean;
7
7
  }
8
8
  export declare function withHrEvents(editor: PlateEditor): (event: React.KeyboardEvent) => void;
9
9
  export declare function ToolbarHrButton(props: ToolbarHrButtonProps): JSX.Element | null;
10
10
  export declare function Hr(props: Slate.RenderLeafProps): JSX.Element;
11
- export declare function createHrPlugin(): PlatePlugin;
12
- export declare const withHrOptions: CustomSlatePluginOptions;
11
+ export declare const createHrPlugin: () => RichTextPlugin;
13
12
  export {};
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { ContentEntityType as EntityType } from '@contentful/field-editor-reference/dist/types';
3
2
  import { FieldExtensionSDK } from '@contentful/field-editor-shared';
4
3
  interface EntryAssetTooltipProps {
@@ -1,9 +1,8 @@
1
- /// <reference types="react" />
1
+ import { Link } from '@contentful/field-editor-reference/dist/types';
2
2
  import { FieldExtensionSDK } from '@contentful/field-editor-shared';
3
3
  import { PlateEditor } from '@udecode/plate-core';
4
- import { ReactEditor } from 'slate-react';
5
4
  import { HistoryEditor } from 'slate-history';
6
- import { Link } from '@contentful/field-editor-reference/dist/types';
5
+ import { ReactEditor } from 'slate-react';
7
6
  interface HyperlinkModalProps {
8
7
  linkText?: string;
9
8
  linkType?: string;
@@ -1,12 +1,9 @@
1
- import * as React from 'react';
2
- import { PlatePlugin } from '@udecode/plate-core';
3
1
  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;
2
+ import { TrackingProvider } from 'TrackingProvider';
3
+ import { RichTextPlugin } from '../../types';
7
4
  interface ToolbarHyperlinkButtonProps {
8
5
  isDisabled: boolean | undefined;
9
6
  }
10
7
  export declare function ToolbarHyperlinkButton(props: ToolbarHyperlinkButtonProps): JSX.Element | null;
11
- export declare const withHyperlinkOptions: CustomSlatePluginOptions;
8
+ export declare const createHyperlinkPlugin: (sdk: FieldExtensionSDK, tracking: TrackingProvider) => RichTextPlugin;
12
9
  export {};
@@ -0,0 +1 @@
1
+ export declare function truncate(str: string, length: number): string;
@@ -0,0 +1,3 @@
1
+ import { PlateEditor } from '@udecode/plate-core';
2
+ import { NodeEntry, Node } from 'slate';
3
+ export declare const hasText: (editor: PlateEditor, entry: NodeEntry<Node>) => boolean;
@@ -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 { PlateEditor } from '@udecode/plate-core';
2
+ export declare const insertListBreak: (editor: PlateEditor) => () => void;
@@ -0,0 +1,2 @@
1
+ import { PlateEditor, TDescendant } from '@udecode/plate-core';
2
+ export declare const insertListFragment: (editor: PlateEditor) => (fragment: TDescendant[]) => void;
@@ -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>;
@@ -1,12 +1,9 @@
1
- /// <reference types="react" />
2
1
  import * as Slate from 'slate-react';
3
- import { PlatePlugin } from '@udecode/plate-core';
4
- import { CustomSlatePluginOptions } from 'types';
2
+ import { RichTextPlugin } from '../../types';
5
3
  interface ToolbarBoldButtonProps {
6
4
  isDisabled?: boolean;
7
5
  }
8
6
  export declare function ToolbarBoldButton(props: ToolbarBoldButtonProps): JSX.Element | null;
9
7
  export declare function Bold(props: Slate.RenderLeafProps): JSX.Element;
10
- export declare function createBoldPlugin(): PlatePlugin;
11
- export declare const withBoldOptions: CustomSlatePluginOptions;
8
+ export declare const createBoldPlugin: () => RichTextPlugin;
12
9
  export {};
@@ -1,12 +1,9 @@
1
- /// <reference types="react" />
2
1
  import * as Slate from 'slate-react';
3
- import { PlatePlugin } from '@udecode/plate-core';
4
- import { CustomSlatePluginOptions } from 'types';
2
+ import { RichTextPlugin } from '../../types';
5
3
  interface ToolbarCodeButtonProps {
6
4
  isDisabled?: boolean;
7
5
  }
8
6
  export declare function ToolbarCodeButton(props: ToolbarCodeButtonProps): JSX.Element | null;
9
7
  export declare function Code(props: Slate.RenderLeafProps): JSX.Element;
10
- export declare function createCodePlugin(): PlatePlugin;
11
- export declare const withCodeOptions: CustomSlatePluginOptions;
8
+ export declare const createCodePlugin: () => RichTextPlugin;
12
9
  export {};
@@ -1,12 +1,9 @@
1
- /// <reference types="react" />
2
1
  import * as Slate from 'slate-react';
3
- import { PlatePlugin } from '@udecode/plate-core';
4
- import { CustomSlatePluginOptions } from '../../types';
2
+ import { RichTextPlugin } from '../../types';
5
3
  interface ToolbarItalicButtonProps {
6
4
  isDisabled?: boolean;
7
5
  }
8
6
  export declare function ToolbarItalicButton(props: ToolbarItalicButtonProps): JSX.Element | null;
9
7
  export declare function Italic(props: Slate.RenderLeafProps): JSX.Element;
10
- export declare function createItalicPlugin(): PlatePlugin;
11
- export declare const withItalicOptions: CustomSlatePluginOptions;
8
+ export declare const createItalicPlugin: () => RichTextPlugin;
12
9
  export {};
@@ -1,12 +1,9 @@
1
- /// <reference types="react" />
2
1
  import * as Slate from 'slate-react';
3
- import { PlatePlugin } from '@udecode/plate-core';
4
- import { CustomSlatePluginOptions } from 'types';
2
+ import { RichTextPlugin } from '../../types';
5
3
  interface ToolbarUnderlineButtonProps {
6
4
  isDisabled?: boolean;
7
5
  }
8
6
  export declare function ToolbarUnderlineButton(props: ToolbarUnderlineButtonProps): JSX.Element | null;
9
7
  export declare function Underline(props: Slate.RenderLeafProps): JSX.Element;
10
- export declare function createUnderlinePlugin(): PlatePlugin;
11
- export declare const withUnderlineOptions: CustomSlatePluginOptions;
8
+ export declare const createUnderlinePlugin: () => RichTextPlugin;
12
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,7 +1 @@
1
- /// <reference types="react" />
2
- import { RenderElementProps } from 'slate-react';
3
- import { PlatePlugin } from '@udecode/plate-core';
4
- import { CustomSlatePluginOptions } from '../../types';
5
- export declare function Paragraph(props: RenderElementProps): JSX.Element;
6
- export declare function createParagraphPlugin(): PlatePlugin;
7
- export declare const withParagraphOptions: CustomSlatePluginOptions;
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,13 +1,2 @@
1
- import * as React from 'react';
2
- import * as Slate from 'slate-react';
3
- import { PlatePlugin, PlateEditor } from '@udecode/plate-core';
4
- import { CustomSlatePluginOptions } from 'types';
5
- interface ToolbarQuoteButtonProps {
6
- isDisabled?: boolean;
7
- }
8
- export declare function withQuoteEvents(editor: PlateEditor): (event: React.KeyboardEvent) => void;
9
- export declare function ToolbarQuoteButton(props: ToolbarQuoteButtonProps): JSX.Element | null;
10
- export declare function Quote(props: Slate.RenderLeafProps): JSX.Element;
11
- export declare function createQuotePlugin(): PlatePlugin;
12
- export declare const withQuoteOptions: CustomSlatePluginOptions;
13
- export {};
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,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;