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

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 (135) hide show
  1. package/README.md +1 -1
  2. package/dist/ContentfulEditorProvider.d.ts +8 -0
  3. package/dist/RichTextEditor.d.ts +19 -60
  4. package/dist/RichTextEditor.styles.d.ts +7 -0
  5. package/dist/SdkProvider.d.ts +7 -0
  6. package/dist/Toolbar/EmbedEntityWidget.d.ts +6 -0
  7. package/dist/Toolbar/StickyToolbarWrapper.d.ts +6 -11
  8. package/dist/Toolbar/index.d.ts +6 -20
  9. package/dist/TrackingProvider.d.ts +11 -0
  10. package/dist/constants/Schema.d.ts +93 -11
  11. package/dist/dialogs/openRichTextDialog.d.ts +2 -1
  12. package/dist/dialogs/renderRichTextDialog.d.ts +3 -1
  13. package/dist/field-editor-rich-text.cjs.development.js +4243 -5265
  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 +4275 -5297
  18. package/dist/field-editor-rich-text.esm.js.map +1 -1
  19. package/dist/helpers/deserializer.d.ts +3 -0
  20. package/dist/helpers/editor.d.ts +43 -0
  21. package/dist/helpers/environment.d.ts +1 -0
  22. package/dist/helpers/formatDateAndTime.d.ts +15 -0
  23. package/dist/helpers/getLinkedContentTypeIdsForNodeType.d.ts +26 -2
  24. package/dist/helpers/newEntitySelectorConfigFromRichTextField.d.ts +5 -1
  25. package/dist/helpers/sanitizeSlateDoc.d.ts +18 -0
  26. package/dist/helpers/truncate.d.ts +1 -0
  27. package/dist/helpers/validations.d.ts +10 -0
  28. package/dist/plugins/Bold/index.d.ts +12 -64
  29. package/dist/plugins/Code/index.d.ts +12 -64
  30. package/dist/plugins/DragAndDrop/index.d.ts +2 -0
  31. package/dist/plugins/EmbeddedEntity/index.d.ts +10 -0
  32. package/dist/plugins/EmbeddedEntityBlock/LinkedEntityBlock.d.ts +13 -0
  33. package/dist/plugins/EmbeddedEntityBlock/ToolbarIcon.d.ts +12 -10
  34. package/dist/plugins/EmbeddedEntityBlock/Util.d.ts +2 -23
  35. package/dist/plugins/EmbeddedEntityBlock/index.d.ts +11 -26
  36. package/dist/plugins/EmbeddedEntityInline/FetchingWrappedInlineEntryCard.d.ts +12 -0
  37. package/dist/plugins/EmbeddedEntityInline/Util.d.ts +16 -0
  38. package/dist/plugins/EmbeddedEntityInline/index.d.ts +12 -0
  39. package/dist/plugins/Heading/index.d.ts +20 -380
  40. package/dist/plugins/Hr/index.d.ts +13 -61
  41. package/dist/plugins/Hyperlink/EntryAssetTooltip.d.ts +10 -0
  42. package/dist/plugins/Hyperlink/HyperlinkModal.d.ts +17 -0
  43. package/dist/plugins/Hyperlink/index.d.ts +12 -9
  44. package/dist/plugins/InsertBeforeFirstVoidBlock/index.d.ts +2 -3
  45. package/dist/plugins/Italic/index.d.ts +12 -64
  46. package/dist/plugins/List/getListInsertFragment.d.ts +6 -0
  47. package/dist/plugins/List/index.d.ts +15 -114
  48. package/dist/plugins/NewLine/index.d.ts +2 -0
  49. package/dist/plugins/Paragraph/index.d.ts +7 -5
  50. package/dist/plugins/Paste/index.d.ts +2 -7
  51. package/dist/plugins/Paste/sanitizers/helpers.d.ts +7 -0
  52. package/dist/plugins/Paste/sanitizers/index.d.ts +3 -0
  53. package/dist/plugins/Paste/sanitizers/removeComments.d.ts +2 -0
  54. package/dist/plugins/Paste/sanitizers/sanitizeEntityBlocks.d.ts +6 -0
  55. package/dist/plugins/Paste/sanitizers/sanitizeTables.d.ts +2 -0
  56. package/dist/plugins/Quote/index.d.ts +13 -59
  57. package/dist/plugins/Table/TableActions.d.ts +5 -0
  58. package/dist/plugins/Table/actions/addColumn.d.ts +4 -0
  59. package/dist/plugins/Table/actions/addRow.d.ts +3 -0
  60. package/dist/plugins/Table/actions/index.d.ts +3 -0
  61. package/dist/plugins/Table/actions/setHeader.d.ts +2 -0
  62. package/dist/plugins/Table/helpers.d.ts +4 -0
  63. package/dist/plugins/Table/index.d.ts +189 -0
  64. package/dist/plugins/TrailingParagraph/index.d.ts +1 -0
  65. package/dist/plugins/Underline/index.d.ts +12 -0
  66. package/dist/plugins/shared/EntityStatusIcon.d.ts +8 -0
  67. package/dist/plugins/shared/FetchingWrappedAssetCard.d.ts +23 -0
  68. package/dist/plugins/shared/FetchingWrappedEntryCard.d.ts +13 -0
  69. package/dist/plugins/shared/ToolbarButton.d.ts +12 -0
  70. package/dist/types.d.ts +25 -0
  71. package/package.json +32 -29
  72. package/CHANGELOG.md +0 -414
  73. package/LICENSE +0 -21
  74. package/dist/RichTextEditor.spec.d.ts +0 -1
  75. package/dist/Toolbar/Toolbar.spec.d.ts +0 -1
  76. package/dist/helpers/browserSupport.d.ts +0 -1
  77. package/dist/plugins/CommandPalette/CommandMark.d.ts +0 -12
  78. package/dist/plugins/CommandPalette/CommandPalette.d.ts +0 -10
  79. package/dist/plugins/CommandPalette/CommandPaletteService.d.ts +0 -20
  80. package/dist/plugins/CommandPalette/CommandPanel/CommandPanelMenu.d.ts +0 -43
  81. package/dist/plugins/CommandPalette/CommandPanel/index.d.ts +0 -37
  82. package/dist/plugins/CommandPalette/Util.d.ts +0 -5
  83. package/dist/plugins/CommandPalette/index.d.ts +0 -7
  84. package/dist/plugins/EmbeddedEntityBlock/EmbeddedEntityBlock.d.ts +0 -20
  85. package/dist/plugins/EmbeddedEntityBlock/EmbeddedEntityBlock.styles.d.ts +0 -3
  86. package/dist/plugins/EmbeddedEntityBlock/FetchingWrappedAssetCard.d.ts +0 -15
  87. package/dist/plugins/EmbeddedEntityBlock/FetchingWrappedEntryCard.d.ts +0 -15
  88. package/dist/plugins/EmbeddedEntryInline/EmbeddedEntryInline.d.ts +0 -21
  89. package/dist/plugins/EmbeddedEntryInline/EmbeddedEntryInline.styles.d.ts +0 -4
  90. package/dist/plugins/EmbeddedEntryInline/FetchingWrappedInlineEntryCard.d.ts +0 -14
  91. package/dist/plugins/EmbeddedEntryInline/ToolbarIcon.d.ts +0 -11
  92. package/dist/plugins/EmbeddedEntryInline/Utils.d.ts +0 -4
  93. package/dist/plugins/EmbeddedEntryInline/index.d.ts +0 -12
  94. package/dist/plugins/EntryEmbedDropdown/index.d.ts +0 -14
  95. package/dist/plugins/Heading/HeadingDropdown.d.ts +0 -28
  96. package/dist/plugins/Heading/HeadingDropdownItem.d.ts +0 -57
  97. package/dist/plugins/Heading/Paragraph.d.ts +0 -58
  98. package/dist/plugins/Hyperlink/Hyperlink.d.ts +0 -13
  99. package/dist/plugins/Hyperlink/ToolbarIcon.d.ts +0 -7
  100. package/dist/plugins/Hyperlink/Util.d.ts +0 -43
  101. package/dist/plugins/Hyperlink/styles.d.ts +0 -12
  102. package/dist/plugins/Hyperlink/truncate.d.ts +0 -1
  103. package/dist/plugins/Hyperlink/useRequestStatus.d.ts +0 -6
  104. package/dist/plugins/InsertBeforeFirstVoidBlock/Util.d.ts +0 -14
  105. package/dist/plugins/List/EditListWrapper.d.ts +0 -2
  106. package/dist/plugins/List/ToolbarDecorator.d.ts +0 -62
  107. package/dist/plugins/NewLinePlugin/index.d.ts +0 -3
  108. package/dist/plugins/Paste/Paste.d.ts +0 -1
  109. package/dist/plugins/Paste/Paste.spec.d.ts +0 -1
  110. package/dist/plugins/Paste/index.spec.d.ts +0 -1
  111. package/dist/plugins/PasteHtml/PasteHtml.spec.d.ts +0 -1
  112. package/dist/plugins/PasteHtml/Serializer.d.ts +0 -1
  113. package/dist/plugins/PasteHtml/index.d.ts +0 -3
  114. package/dist/plugins/PasteText/PasteText.spec.d.ts +0 -1
  115. package/dist/plugins/PasteText/index.d.ts +0 -3
  116. package/dist/plugins/Quote/QuotePlugin.d.ts +0 -10
  117. package/dist/plugins/Quote/Util.d.ts +0 -2
  118. package/dist/plugins/Underlined/index.d.ts +0 -64
  119. package/dist/plugins/index.d.ts +0 -1
  120. package/dist/plugins/shared/BlockSelectDecorator.d.ts +0 -63
  121. package/dist/plugins/shared/BlockToggleDecorator.d.ts +0 -65
  122. package/dist/plugins/shared/MarkDecorator.d.ts +0 -12
  123. package/dist/plugins/shared/MarkPlugin.d.ts +0 -9
  124. package/dist/plugins/shared/MarkToggleDecorator.d.ts +0 -62
  125. package/dist/plugins/shared/NodeDecorator.d.ts +0 -15
  126. package/dist/plugins/shared/PasteTestHelpers.d.ts +0 -35
  127. package/dist/plugins/shared/PluginApi.d.ts +0 -31
  128. package/dist/plugins/shared/PropTypes.d.ts +0 -15
  129. package/dist/plugins/shared/ToolbarDropdownListItem.d.ts +0 -14
  130. package/dist/plugins/shared/ToolbarIcon.d.ts +0 -16
  131. package/dist/plugins/shared/Util.d.ts +0 -1
  132. package/dist/plugins/shared/UtilHave.d.ts +0 -24
  133. package/dist/setupTests.d.ts +0 -1
  134. package/dist/validations/index.d.ts +0 -9
  135. package/dist/validations/validations.spec.d.ts +0 -1
@@ -0,0 +1,3 @@
1
+ import { Deserialize, GetNodeDeserializerRule } from '@udecode/plate-core';
2
+ export declare function deserializeLeaf(type: string, rules: GetNodeDeserializerRule[]): Deserialize;
3
+ export declare function deserializeElement(type: string, rules: GetNodeDeserializerRule[]): Deserialize;
@@ -0,0 +1,43 @@
1
+ import { Path } from 'slate';
2
+ import { BLOCKS, INLINES } from '@contentful/rich-text-types';
3
+ import { CustomElement } from '../types';
4
+ import { Link } from '@contentful/field-editor-reference/dist/types';
5
+ import { PlateEditor } from '@udecode/plate-core';
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;
10
+ declare type NodeEntry = [CustomElement, Path];
11
+ 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;
19
+ export declare function getTableSize(table: CustomElement): Record<'numRows' | 'numColumns', number> | null;
20
+ export declare function isFirstChild(path: Path): boolean;
21
+ interface InsertLinkOptions {
22
+ text: string;
23
+ type: INLINES.HYPERLINK | INLINES.ENTRY_HYPERLINK | INLINES.ASSET_HYPERLINK;
24
+ url?: string;
25
+ target?: Link;
26
+ path?: Path;
27
+ }
28
+ export declare function insertLink(editor: any, options: InsertLinkOptions): void;
29
+ export declare function isLinkActive(editor: any): boolean;
30
+ export declare function unwrapLink(editor: any): void;
31
+ 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;
37
+ /**
38
+ * This traversal strategy is unfortunately necessary because Slate doesn't
39
+ * expose something like Node.next(editor).
40
+ */
41
+ export declare function getNextNode(editor: PlateEditor): CustomElement | null;
42
+ export declare function currentSelectionPrecedesTableCell(editor: PlateEditor): boolean;
43
+ export {};
@@ -0,0 +1 @@
1
+ export declare const HAS_BEFORE_INPUT_SUPPORT: boolean;
@@ -0,0 +1,15 @@
1
+ declare type DateFormatFn = (date: Date | string, short?: boolean) => string;
2
+ /**
3
+ * @param {Date|string} date A valid constructor argument for moment()
4
+ * @param {boolean=} short Render only Today/Tomorrow/Yesterday if valid. Defaults to false
5
+ */
6
+ export declare const formatDate: DateFormatFn;
7
+ /**
8
+ * Returns the time portion of a date in the local time in the format H:MM AM/PM
9
+ *
10
+ * == Examples
11
+ * * `T15:36:45.000Z` => 3:36 PM (if in +0:00 offset)
12
+ */
13
+ export declare const formatTime: DateFormatFn;
14
+ export declare const formatDateAndTime: DateFormatFn;
15
+ export {};
@@ -1,2 +1,26 @@
1
- declare function _default(field: object, nodeType: string): string[];
2
- export default _default;
1
+ /**
2
+ * Given a field object and a rich text node type, return a list of valid
3
+ * content type IDs associated with the node type, based on that node type's
4
+ * `linkContentType` validation.
5
+ *
6
+ * If there is no such validation or the validation is empty, return an empty
7
+ * array.
8
+ *
9
+ * The navigation here is explained by the `nodes` validation having signature:
10
+ * { nodes: { [nodeType]: validationObject[] } }
11
+ *
12
+ * We defensively navigate through this object because
13
+ * 1) the field may not have a `validations` array,
14
+ * 2) the `validations` array may be empty,
15
+ * 3) the `validations` array may not have a `nodes` validation,
16
+ * 4) the `nodes` validation may not validate the `nodeType`, and
17
+ * 5) the `nodeType` validations may not have a `linkContentType` validation.
18
+ *
19
+ * Note that passing an empty array will result in all possible content types
20
+ * being whitelisted.
21
+ *
22
+ * @param {object} field
23
+ * @param {string} nodeType
24
+ * @returns {string[]}
25
+ */
26
+ export default function getLinkedContentTypeIdsForNodeType(field: any, nodeType: any): string[];
@@ -7,4 +7,8 @@
7
7
  * @param {string} nodeType
8
8
  * @returns {object}
9
9
  */
10
- export default function newEntitySelectorConfigFromRichTextField(field: object, nodeType: string): object;
10
+ export default function newEntitySelectorConfigFromRichTextField(field: any, nodeType: any): {
11
+ entityType: "Entry" | "Asset";
12
+ locale: any;
13
+ contentTypes: string[];
14
+ };
@@ -0,0 +1,18 @@
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[];
14
+ /**
15
+ * Ensures incoming void nodes have a child leaf text element.
16
+ */
17
+ export declare function sanitizeIncomingSlateDoc(nodes?: TextOrCustomElement[]): TextOrCustomElement[];
18
+ export {};
@@ -0,0 +1 @@
1
+ export declare function truncate(str: any, length: any): any;
@@ -0,0 +1,10 @@
1
+ import { BLOCKS, INLINES } from '@contentful/rich-text-types';
2
+ import { FieldExtensionSDK } from '@contentful/app-sdk';
3
+ export declare const VALIDATIONS: {
4
+ ENABLED_MARKS: string;
5
+ ENABLED_NODE_TYPES: string;
6
+ };
7
+ export declare const DEFAULT_ENABLED_NODE_TYPES: string[];
8
+ export declare const VALIDATABLE_NODE_TYPES: (BLOCKS | INLINES)[];
9
+ export declare const isNodeTypeEnabled: (field: FieldExtensionSDK['field'], nodeType: any) => boolean;
10
+ export declare const isMarkEnabled: (field: FieldExtensionSDK['field'], mark: any) => boolean;
@@ -1,64 +1,12 @@
1
- export function BoldPlugin({ richTextAPI }: {
2
- richTextAPI: any;
3
- }): {
4
- renderMark: (props: any, _editor: any, next: any) => any;
5
- onKeyDown(event: any, editor: any, next: any): any;
6
- };
7
- declare var _default: {
8
- new (props: any): {
9
- handleToggle: (event: any) => any;
10
- render(): JSX.Element;
11
- context: any;
12
- setState<K extends string | number | symbol>(state: any, callback?: (() => void) | undefined): void;
13
- forceUpdate(callback?: (() => void) | undefined): void;
14
- readonly props: Readonly<any> & Readonly<{
15
- children?: React.ReactNode;
16
- }>;
17
- state: Readonly<any>;
18
- refs: {
19
- [key: string]: React.ReactInstance;
20
- };
21
- componentDidMount?(): void;
22
- shouldComponentUpdate?(nextProps: Readonly<any>, nextState: Readonly<any>, nextContext: any): boolean;
23
- componentWillUnmount?(): void;
24
- componentDidCatch?(error: Error, errorInfo: React.ErrorInfo): void;
25
- getSnapshotBeforeUpdate?(prevProps: Readonly<any>, prevState: Readonly<any>): any;
26
- componentDidUpdate?(prevProps: Readonly<any>, prevState: Readonly<any>, snapshot?: any): void;
27
- componentWillMount?(): void;
28
- UNSAFE_componentWillMount?(): void;
29
- componentWillReceiveProps?(nextProps: Readonly<any>, nextContext: any): void;
30
- UNSAFE_componentWillReceiveProps?(nextProps: Readonly<any>, nextContext: any): void;
31
- componentWillUpdate?(nextProps: Readonly<any>, nextState: Readonly<any>, nextContext: any): void;
32
- UNSAFE_componentWillUpdate?(nextProps: Readonly<any>, nextState: Readonly<any>, nextContext: any): void;
33
- };
34
- new (props: any, context: any): {
35
- handleToggle: (event: any) => any;
36
- render(): JSX.Element;
37
- context: any;
38
- setState<K extends string | number | symbol>(state: any, callback?: (() => void) | undefined): void;
39
- forceUpdate(callback?: (() => void) | undefined): void;
40
- readonly props: Readonly<any> & Readonly<{
41
- children?: React.ReactNode;
42
- }>;
43
- state: Readonly<any>;
44
- refs: {
45
- [key: string]: React.ReactInstance;
46
- };
47
- componentDidMount?(): void;
48
- shouldComponentUpdate?(nextProps: Readonly<any>, nextState: Readonly<any>, nextContext: any): boolean;
49
- componentWillUnmount?(): void;
50
- componentDidCatch?(error: Error, errorInfo: React.ErrorInfo): void;
51
- getSnapshotBeforeUpdate?(prevProps: Readonly<any>, prevState: Readonly<any>): any;
52
- componentDidUpdate?(prevProps: Readonly<any>, prevState: Readonly<any>, snapshot?: any): void;
53
- componentWillMount?(): void;
54
- UNSAFE_componentWillMount?(): void;
55
- componentWillReceiveProps?(nextProps: Readonly<any>, nextContext: any): void;
56
- UNSAFE_componentWillReceiveProps?(nextProps: Readonly<any>, nextContext: any): void;
57
- componentWillUpdate?(nextProps: Readonly<any>, nextState: Readonly<any>, nextContext: any): void;
58
- UNSAFE_componentWillUpdate?(nextProps: Readonly<any>, nextState: Readonly<any>, nextContext: any): void;
59
- };
60
- propTypes: any;
61
- contextType?: React.Context<any> | undefined;
62
- };
63
- export default _default;
64
- import React from "react";
1
+ /// <reference types="react" />
2
+ import * as Slate from 'slate-react';
3
+ import { PlatePlugin } from '@udecode/plate-core';
4
+ import { CustomSlatePluginOptions } from 'types';
5
+ interface ToolbarBoldButtonProps {
6
+ isDisabled?: boolean;
7
+ }
8
+ export declare function ToolbarBoldButton(props: ToolbarBoldButtonProps): JSX.Element | null;
9
+ export declare function Bold(props: Slate.RenderLeafProps): JSX.Element;
10
+ export declare function createBoldPlugin(): PlatePlugin;
11
+ export declare const withBoldOptions: CustomSlatePluginOptions;
12
+ export {};
@@ -1,64 +1,12 @@
1
- export function CodePlugin({ richTextAPI }: {
2
- richTextAPI: any;
3
- }): {
4
- renderMark: (props: any, _editor: any, next: any) => any;
5
- onKeyDown(event: any, editor: any, next: any): any;
6
- };
7
- declare var _default: {
8
- new (props: any): {
9
- handleToggle: (event: any) => any;
10
- render(): JSX.Element;
11
- context: any;
12
- setState<K extends string | number | symbol>(state: any, callback?: (() => void) | undefined): void;
13
- forceUpdate(callback?: (() => void) | undefined): void;
14
- readonly props: Readonly<any> & Readonly<{
15
- children?: React.ReactNode;
16
- }>;
17
- state: Readonly<any>;
18
- refs: {
19
- [key: string]: React.ReactInstance;
20
- };
21
- componentDidMount?(): void;
22
- shouldComponentUpdate?(nextProps: Readonly<any>, nextState: Readonly<any>, nextContext: any): boolean;
23
- componentWillUnmount?(): void;
24
- componentDidCatch?(error: Error, errorInfo: React.ErrorInfo): void;
25
- getSnapshotBeforeUpdate?(prevProps: Readonly<any>, prevState: Readonly<any>): any;
26
- componentDidUpdate?(prevProps: Readonly<any>, prevState: Readonly<any>, snapshot?: any): void;
27
- componentWillMount?(): void;
28
- UNSAFE_componentWillMount?(): void;
29
- componentWillReceiveProps?(nextProps: Readonly<any>, nextContext: any): void;
30
- UNSAFE_componentWillReceiveProps?(nextProps: Readonly<any>, nextContext: any): void;
31
- componentWillUpdate?(nextProps: Readonly<any>, nextState: Readonly<any>, nextContext: any): void;
32
- UNSAFE_componentWillUpdate?(nextProps: Readonly<any>, nextState: Readonly<any>, nextContext: any): void;
33
- };
34
- new (props: any, context: any): {
35
- handleToggle: (event: any) => any;
36
- render(): JSX.Element;
37
- context: any;
38
- setState<K extends string | number | symbol>(state: any, callback?: (() => void) | undefined): void;
39
- forceUpdate(callback?: (() => void) | undefined): void;
40
- readonly props: Readonly<any> & Readonly<{
41
- children?: React.ReactNode;
42
- }>;
43
- state: Readonly<any>;
44
- refs: {
45
- [key: string]: React.ReactInstance;
46
- };
47
- componentDidMount?(): void;
48
- shouldComponentUpdate?(nextProps: Readonly<any>, nextState: Readonly<any>, nextContext: any): boolean;
49
- componentWillUnmount?(): void;
50
- componentDidCatch?(error: Error, errorInfo: React.ErrorInfo): void;
51
- getSnapshotBeforeUpdate?(prevProps: Readonly<any>, prevState: Readonly<any>): any;
52
- componentDidUpdate?(prevProps: Readonly<any>, prevState: Readonly<any>, snapshot?: any): void;
53
- componentWillMount?(): void;
54
- UNSAFE_componentWillMount?(): void;
55
- componentWillReceiveProps?(nextProps: Readonly<any>, nextContext: any): void;
56
- UNSAFE_componentWillReceiveProps?(nextProps: Readonly<any>, nextContext: any): void;
57
- componentWillUpdate?(nextProps: Readonly<any>, nextState: Readonly<any>, nextContext: any): void;
58
- UNSAFE_componentWillUpdate?(nextProps: Readonly<any>, nextState: Readonly<any>, nextContext: any): void;
59
- };
60
- propTypes: any;
61
- contextType?: React.Context<any> | undefined;
62
- };
63
- export default _default;
64
- import React from "react";
1
+ /// <reference types="react" />
2
+ import * as Slate from 'slate-react';
3
+ import { PlatePlugin } from '@udecode/plate-core';
4
+ import { CustomSlatePluginOptions } from 'types';
5
+ interface ToolbarCodeButtonProps {
6
+ isDisabled?: boolean;
7
+ }
8
+ export declare function ToolbarCodeButton(props: ToolbarCodeButtonProps): JSX.Element | null;
9
+ export declare function Code(props: Slate.RenderLeafProps): JSX.Element;
10
+ export declare function createCodePlugin(): PlatePlugin;
11
+ export declare const withCodeOptions: CustomSlatePluginOptions;
12
+ export {};
@@ -0,0 +1,2 @@
1
+ import { PlatePlugin } from '@udecode/plate-core';
2
+ export declare function createDragAndDropPlugin(): PlatePlugin;
@@ -0,0 +1,10 @@
1
+ import * as React from 'react';
2
+ interface EmbeddedEntityDropdownButtonProps {
3
+ children: React.ReactNode;
4
+ isDisabled: boolean | undefined;
5
+ isOpen: boolean;
6
+ onClose: () => void;
7
+ onToggle: () => void;
8
+ }
9
+ export declare function EmbeddedEntityDropdownButton({ children, isDisabled, isOpen, onClose, onToggle, }: EmbeddedEntityDropdownButtonProps): JSX.Element;
10
+ export {};
@@ -0,0 +1,13 @@
1
+ /// <reference types="react" />
2
+ import { CustomRenderElementProps } from '../../types';
3
+ declare type LinkedEntityBlockProps = CustomRenderElementProps<{
4
+ target: {
5
+ sys: {
6
+ id: string;
7
+ linkType: 'Entry' | 'Asset';
8
+ type: 'Link';
9
+ };
10
+ };
11
+ }>;
12
+ export declare function LinkedEntityBlock(props: LinkedEntityBlockProps): JSX.Element;
13
+ export {};
@@ -1,11 +1,13 @@
1
- export default class EntityLinkToolbarIcon extends React.Component<any, any, any> {
2
- static propTypes: any;
3
- static defaultProps: {
4
- isButton: boolean;
5
- };
6
- constructor(props: any);
7
- constructor(props: any, context: any);
8
- handleClick: (e: any) => void;
9
- handleAction: (event: any) => any;
1
+ /// <reference types="react" />
2
+ export declare const styles: {
3
+ icon: string;
4
+ };
5
+ interface EmbeddedEntityBlockToolbarIconProps {
6
+ isButton?: boolean;
7
+ isDisabled: boolean;
8
+ logAction?: () => void;
9
+ nodeType: string;
10
+ onClose: () => void;
10
11
  }
11
- import React from "react";
12
+ export declare function EmbeddedEntityBlockToolbarIcon({ isButton, isDisabled, logAction, nodeType, onClose, }: EmbeddedEntityBlockToolbarIconProps): JSX.Element;
13
+ export {};
@@ -1,23 +1,2 @@
1
- /**
2
- * Invokes entity selector modal and inserts block embed.
3
- * @param {string} nodeType
4
- * @param {import('@contentful/field-editor-reference/dist/types').FieldExtensionSDK} sdk
5
- * @param {slate.Editor} editor
6
- * @param {function} logAction
7
- */
8
- export function selectEntityAndInsert(nodeType: string, sdk: import('@contentful/field-editor-reference/dist/types').FieldExtensionSDK, editor: any, logAction: Function): Promise<void>;
9
- export function insertBlock(editor: any, nodeType: any, entity: any, focusNextLine?: boolean): void;
10
- export function hasBlockOfType(editor: any, type: string): boolean;
11
- export function createNode(nodeType: any, entity: any): {
12
- type: any;
13
- object: string;
14
- data: {
15
- target: {
16
- sys: {
17
- id: any;
18
- type: string;
19
- linkType: any;
20
- };
21
- };
22
- };
23
- };
1
+ export declare function selectEntityAndInsert(nodeType: any, sdk: any, editor: any, logAction: any): Promise<void>;
2
+ export declare function insertBlock(editor: any, nodeType: any, entity: any): void;
@@ -1,26 +1,11 @@
1
- export default ToolbarIcon;
2
- export function EmbeddedEntityBlockPlugin({ richTextAPI: { sdk, logShortcutAction, logViewportAction }, nodeType, hotkey, }: {
3
- richTextAPI: {
4
- sdk: any;
5
- logShortcutAction: any;
6
- logViewportAction: any;
7
- };
8
- nodeType: any;
9
- hotkey: any;
10
- }): {
11
- renderNode: (props: any, _editor: any, next: any) => any;
12
- onKeyDown(e: any, editor: any, next: any): any;
13
- };
14
- export function EmbeddedEntryBlockPlugin({ richTextAPI }: {
15
- richTextAPI: any;
16
- }): {
17
- renderNode: (props: any, _editor: any, next: any) => any;
18
- onKeyDown(e: any, editor: any, next: any): any;
19
- };
20
- export function EmbeddedAssetBlockPlugin({ richTextAPI }: {
21
- richTextAPI: any;
22
- }): {
23
- renderNode: (props: any, _editor: any, next: any) => any;
24
- onKeyDown(e: any, editor: any, next: any): any;
25
- };
26
- import ToolbarIcon from "./ToolbarIcon";
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
+ import { FieldExtensionSDK } from '@contentful/app-sdk';
6
+ 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;
@@ -0,0 +1,12 @@
1
+ import React from 'react';
2
+ import { FieldExtensionSDK } from '@contentful/field-editor-shared';
3
+ interface FetchingWrappedInlineEntryCardProps {
4
+ entryId: string;
5
+ sdk: FieldExtensionSDK;
6
+ isSelected: boolean;
7
+ isDisabled: boolean;
8
+ onEdit: (event: React.MouseEvent<Element, MouseEvent>) => void;
9
+ onRemove: (event: React.MouseEvent<Element, MouseEvent>) => void;
10
+ }
11
+ export declare function FetchingWrappedInlineEntryCard(props: FetchingWrappedInlineEntryCardProps): JSX.Element;
12
+ export {};
@@ -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,12 @@
1
+ /// <reference types="react" />
2
+ import { PlatePlugin } from '@udecode/plate-core';
3
+ import { CustomSlatePluginOptions } from '../../types';
4
+ interface ToolbarEmbeddedEntityInlineButtonProps {
5
+ onClose: () => void;
6
+ isDisabled: boolean;
7
+ isButton?: boolean;
8
+ }
9
+ export declare function ToolbarEmbeddedEntityInlineButton(props: ToolbarEmbeddedEntityInlineButtonProps): JSX.Element;
10
+ export declare function createEmbeddedEntityInlinePlugin(sdk: any): PlatePlugin;
11
+ export declare const withEmbeddedEntityInlineOptions: CustomSlatePluginOptions;
12
+ export {};