@contentful/field-editor-rich-text 1.1.0 → 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.
- package/README.md +1 -1
- package/dist/ContentfulEditorProvider.d.ts +8 -0
- package/dist/RichTextEditor.d.ts +18 -60
- package/dist/RichTextEditor.styles.d.ts +7 -0
- package/dist/SdkProvider.d.ts +7 -0
- package/dist/Toolbar/components/EmbedEntityWidget.d.ts +5 -0
- package/dist/Toolbar/components/EmbeddedEntityDropdownButton.d.ts +9 -0
- package/dist/Toolbar/components/StickyToolbarWrapper.d.ts +7 -0
- package/dist/Toolbar/index.d.ts +5 -20
- package/dist/TrackingProvider.d.ts +11 -0
- package/dist/constants/Schema.d.ts +93 -11
- package/dist/dialogs/openRichTextDialog.d.ts +2 -1
- package/dist/dialogs/renderRichTextDialog.d.ts +2 -1
- package/dist/field-editor-rich-text.cjs.development.js +4738 -5118
- package/dist/field-editor-rich-text.cjs.development.js.map +1 -1
- package/dist/field-editor-rich-text.cjs.production.min.js +1 -1
- package/dist/field-editor-rich-text.cjs.production.min.js.map +1 -1
- package/dist/field-editor-rich-text.esm.js +4715 -5095
- package/dist/field-editor-rich-text.esm.js.map +1 -1
- package/dist/helpers/editor.d.ts +43 -0
- package/dist/helpers/environment.d.ts +2 -0
- package/dist/helpers/extractNodes.d.ts +7 -0
- package/dist/helpers/formatDateAndTime.d.ts +15 -0
- package/dist/helpers/getLinkedContentTypeIdsForNodeType.d.ts +26 -2
- package/dist/helpers/newEntitySelectorConfigFromRichTextField.d.ts +5 -1
- package/dist/helpers/sanitizeSlateDoc.d.ts +5 -0
- package/dist/helpers/transformers.d.ts +8 -0
- package/dist/helpers/validations.d.ts +10 -0
- package/dist/plugins/Break/createExitBreakPlugin.d.ts +2 -0
- package/dist/plugins/Break/createSoftBreakPlugin.d.ts +2 -0
- package/dist/plugins/Break/index.d.ts +3 -0
- package/dist/plugins/DragAndDrop/index.d.ts +2 -0
- package/dist/plugins/EmbeddedEntityBlock/LinkedEntityBlock.d.ts +14 -0
- package/dist/plugins/EmbeddedEntityBlock/ToolbarIcon.d.ts +11 -10
- package/dist/plugins/EmbeddedEntityBlock/Util.d.ts +2 -23
- package/dist/plugins/EmbeddedEntityBlock/index.d.ts +6 -26
- package/dist/plugins/EmbeddedEntityInline/FetchingWrappedInlineEntryCard.d.ts +13 -0
- package/dist/plugins/EmbeddedEntityInline/Util.d.ts +16 -0
- package/dist/plugins/EmbeddedEntityInline/index.d.ts +11 -0
- package/dist/plugins/Heading/components/Heading.d.ts +11 -0
- package/dist/plugins/Heading/components/ToolbarHeadingButton.d.ts +4 -0
- package/dist/plugins/Heading/createHeadingPlugin.d.ts +2 -0
- package/dist/plugins/Heading/index.d.ts +2 -380
- package/dist/plugins/Hr/index.d.ts +12 -61
- package/dist/plugins/Hyperlink/EntryAssetTooltip.d.ts +9 -0
- package/dist/plugins/Hyperlink/HyperlinkModal.d.ts +16 -0
- package/dist/plugins/Hyperlink/index.d.ts +9 -9
- package/dist/plugins/Hyperlink/truncate.d.ts +1 -1
- package/dist/plugins/Hyperlink/utils.d.ts +3 -0
- package/dist/plugins/List/components/List.d.ts +3 -0
- package/dist/plugins/List/components/ListItem.d.ts +2 -0
- package/dist/plugins/List/components/ToolbarListButton.d.ts +4 -0
- package/dist/plugins/List/createListPlugin.d.ts +2 -0
- package/dist/plugins/List/index.d.ts +2 -114
- package/dist/plugins/List/insertListBreak.d.ts +2 -0
- package/dist/plugins/List/insertListFragment.d.ts +2 -0
- package/dist/plugins/List/transforms/insertListItem.d.ts +5 -0
- package/dist/plugins/List/utils.d.ts +14 -0
- package/dist/plugins/List/withList.d.ts +3 -0
- package/dist/plugins/Marks/Bold.d.ts +9 -0
- package/dist/plugins/Marks/Code.d.ts +9 -0
- package/dist/plugins/Marks/Italic.d.ts +9 -0
- package/dist/plugins/Marks/Underline.d.ts +9 -0
- package/dist/plugins/Marks/index.d.ts +2 -0
- package/dist/plugins/Normalizer/baseRules.d.ts +2 -0
- package/dist/plugins/Normalizer/createNormalizerPlugin.d.ts +2 -0
- package/dist/plugins/Normalizer/index.d.ts +2 -0
- package/dist/plugins/Normalizer/types.d.ts +39 -0
- package/dist/plugins/Normalizer/utils.d.ts +8 -0
- package/dist/plugins/Normalizer/withNormalizer.d.ts +2 -0
- package/dist/plugins/Paragraph/Paragraph.d.ts +2 -0
- package/dist/plugins/Paragraph/createParagraphPlugin.d.ts +2 -0
- package/dist/plugins/Paragraph/index.d.ts +1 -5
- package/dist/plugins/Paragraph/utils.d.ts +2 -0
- package/dist/plugins/PasteHTML/createPasteHTMLPlugin.d.ts +2 -0
- package/dist/plugins/PasteHTML/index.d.ts +1 -0
- package/dist/plugins/PasteHTML/utils/sanitizeHTML.d.ts +1 -0
- package/dist/plugins/PasteHTML/utils/sanitizeSheets.d.ts +4 -0
- package/dist/plugins/Quote/components/Quote.d.ts +2 -0
- package/dist/plugins/Quote/components/ToolbarQuoteButton.d.ts +4 -0
- package/dist/plugins/Quote/createQuotePlugin.d.ts +2 -0
- package/dist/plugins/Quote/index.d.ts +2 -59
- package/dist/plugins/Quote/toggleQuote.d.ts +3 -0
- package/dist/plugins/SelectOnBackspace/createSelectOnBackspacePlugin.d.ts +2 -0
- package/dist/plugins/SelectOnBackspace/index.d.ts +1 -0
- package/dist/plugins/Table/actions/addColumn.d.ts +4 -0
- package/dist/plugins/Table/actions/addRow.d.ts +3 -0
- package/dist/plugins/Table/actions/index.d.ts +3 -0
- package/dist/plugins/Table/actions/setHeader.d.ts +2 -0
- package/dist/plugins/Table/addTableTrackingEvents.d.ts +3 -0
- package/dist/plugins/Table/components/Cell.d.ts +2 -0
- package/dist/plugins/Table/components/HeaderCell.d.ts +2 -0
- package/dist/plugins/Table/components/Row.d.ts +2 -0
- package/dist/plugins/Table/components/Table.d.ts +2 -0
- package/dist/plugins/Table/components/TableActions.d.ts +4 -0
- package/dist/plugins/Table/components/ToolbarButton.d.ts +4 -0
- package/dist/plugins/Table/createTablePlugin.d.ts +3 -0
- package/dist/plugins/Table/helpers.d.ts +15 -0
- package/dist/plugins/Table/index.d.ts +2 -0
- package/dist/plugins/Text/createTextPlugin.d.ts +2 -0
- package/dist/plugins/Text/index.d.ts +1 -0
- package/dist/plugins/TrailingParagraph/index.d.ts +1 -0
- package/dist/plugins/Voids/createVoidsPlugin.d.ts +2 -0
- package/dist/plugins/Voids/index.d.ts +1 -0
- package/dist/plugins/Voids/transformVoid.d.ts +6 -0
- package/dist/plugins/index.d.ts +6 -1
- package/dist/plugins/links-tracking.d.ts +7 -0
- package/dist/plugins/shared/EntityStatusIcon.d.ts +7 -0
- package/dist/plugins/shared/FetchingWrappedAssetCard.d.ts +23 -0
- package/dist/plugins/shared/FetchingWrappedEntryCard.d.ts +13 -0
- package/dist/plugins/shared/ToolbarButton.d.ts +11 -0
- package/dist/test-utils/assertOutput.d.ts +8 -0
- package/dist/test-utils/createEditor.d.ts +14 -0
- package/dist/test-utils/index.d.ts +4 -0
- package/dist/test-utils/jsx.d.ts +28 -0
- package/dist/test-utils/mockPlugin.d.ts +2 -0
- package/dist/test-utils/randomId.d.ts +4 -0
- package/dist/test-utils/setEmptyDataAttribute.d.ts +6 -0
- package/dist/test-utils/validation.d.ts +1 -0
- package/dist/types.d.ts +42 -0
- package/package.json +40 -34
- package/CHANGELOG.md +0 -454
- package/LICENSE +0 -21
- package/dist/RichTextEditor.spec.d.ts +0 -1
- package/dist/Toolbar/StickyToolbarWrapper.d.ts +0 -12
- package/dist/Toolbar/Toolbar.spec.d.ts +0 -1
- package/dist/helpers/browserSupport.d.ts +0 -1
- package/dist/plugins/Bold/index.d.ts +0 -64
- package/dist/plugins/Code/index.d.ts +0 -64
- package/dist/plugins/CommandPalette/CommandMark.d.ts +0 -12
- package/dist/plugins/CommandPalette/CommandPalette.d.ts +0 -10
- package/dist/plugins/CommandPalette/CommandPaletteService.d.ts +0 -20
- package/dist/plugins/CommandPalette/CommandPanel/CommandPanelMenu.d.ts +0 -43
- package/dist/plugins/CommandPalette/CommandPanel/InViewport/InViewport.d.ts +0 -37
- package/dist/plugins/CommandPalette/CommandPanel/index.d.ts +0 -37
- package/dist/plugins/CommandPalette/Util.d.ts +0 -5
- package/dist/plugins/CommandPalette/index.d.ts +0 -7
- package/dist/plugins/EmbeddedEntityBlock/EmbeddedEntityBlock.d.ts +0 -20
- package/dist/plugins/EmbeddedEntityBlock/EmbeddedEntityBlock.styles.d.ts +0 -3
- package/dist/plugins/EmbeddedEntityBlock/FetchingWrappedAssetCard.d.ts +0 -15
- package/dist/plugins/EmbeddedEntityBlock/FetchingWrappedEntryCard.d.ts +0 -15
- package/dist/plugins/EmbeddedEntryInline/EmbeddedEntryInline.d.ts +0 -21
- package/dist/plugins/EmbeddedEntryInline/EmbeddedEntryInline.styles.d.ts +0 -4
- package/dist/plugins/EmbeddedEntryInline/FetchingWrappedInlineEntryCard.d.ts +0 -14
- package/dist/plugins/EmbeddedEntryInline/ToolbarIcon.d.ts +0 -11
- package/dist/plugins/EmbeddedEntryInline/Utils.d.ts +0 -4
- package/dist/plugins/EmbeddedEntryInline/index.d.ts +0 -12
- package/dist/plugins/EntryEmbedDropdown/index.d.ts +0 -14
- package/dist/plugins/Heading/HeadingDropdown.d.ts +0 -28
- package/dist/plugins/Heading/HeadingDropdownItem.d.ts +0 -57
- package/dist/plugins/Heading/Paragraph.d.ts +0 -58
- package/dist/plugins/Hyperlink/Hyperlink.d.ts +0 -13
- package/dist/plugins/Hyperlink/ToolbarIcon.d.ts +0 -7
- package/dist/plugins/Hyperlink/Util.d.ts +0 -43
- package/dist/plugins/Hyperlink/styles.d.ts +0 -12
- package/dist/plugins/Hyperlink/useRequestStatus.d.ts +0 -6
- package/dist/plugins/InsertBeforeFirstVoidBlock/Util.d.ts +0 -14
- package/dist/plugins/InsertBeforeFirstVoidBlock/index.d.ts +0 -3
- package/dist/plugins/Italic/index.d.ts +0 -64
- package/dist/plugins/List/EditListWrapper.d.ts +0 -2
- package/dist/plugins/List/ToolbarDecorator.d.ts +0 -62
- package/dist/plugins/NewLinePlugin/index.d.ts +0 -3
- package/dist/plugins/Paste/Paste.d.ts +0 -1
- package/dist/plugins/Paste/Paste.spec.d.ts +0 -1
- package/dist/plugins/Paste/index.d.ts +0 -7
- package/dist/plugins/Paste/index.spec.d.ts +0 -1
- package/dist/plugins/PasteHtml/PasteHtml.spec.d.ts +0 -1
- package/dist/plugins/PasteHtml/Serializer.d.ts +0 -1
- package/dist/plugins/PasteHtml/index.d.ts +0 -3
- package/dist/plugins/PasteText/PasteText.spec.d.ts +0 -1
- package/dist/plugins/PasteText/index.d.ts +0 -3
- package/dist/plugins/Quote/QuotePlugin.d.ts +0 -10
- package/dist/plugins/Quote/Util.d.ts +0 -2
- package/dist/plugins/Underlined/index.d.ts +0 -64
- package/dist/plugins/shared/BlockSelectDecorator.d.ts +0 -63
- package/dist/plugins/shared/BlockToggleDecorator.d.ts +0 -65
- package/dist/plugins/shared/MarkDecorator.d.ts +0 -12
- package/dist/plugins/shared/MarkPlugin.d.ts +0 -9
- package/dist/plugins/shared/MarkToggleDecorator.d.ts +0 -62
- package/dist/plugins/shared/NodeDecorator.d.ts +0 -15
- package/dist/plugins/shared/PasteTestHelpers.d.ts +0 -35
- package/dist/plugins/shared/PluginApi.d.ts +0 -31
- package/dist/plugins/shared/PropTypes.d.ts +0 -15
- package/dist/plugins/shared/ToolbarDropdownListItem.d.ts +0 -14
- package/dist/plugins/shared/ToolbarIcon.d.ts +0 -16
- package/dist/plugins/shared/Util.d.ts +0 -1
- package/dist/plugins/shared/UtilHave.d.ts +0 -24
- package/dist/setupTests.d.ts +0 -1
- package/dist/validations/index.d.ts +0 -9
- package/dist/validations/validations.spec.d.ts +0 -1
|
@@ -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,9 @@
|
|
|
1
|
+
import * as Slate from 'slate-react';
|
|
2
|
+
import { RichTextPlugin } from '../../types';
|
|
3
|
+
interface ToolbarBoldButtonProps {
|
|
4
|
+
isDisabled?: boolean;
|
|
5
|
+
}
|
|
6
|
+
export declare function ToolbarBoldButton(props: ToolbarBoldButtonProps): JSX.Element | null;
|
|
7
|
+
export declare function Bold(props: Slate.RenderLeafProps): JSX.Element;
|
|
8
|
+
export declare const createBoldPlugin: () => RichTextPlugin;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as Slate from 'slate-react';
|
|
2
|
+
import { RichTextPlugin } from '../../types';
|
|
3
|
+
interface ToolbarCodeButtonProps {
|
|
4
|
+
isDisabled?: boolean;
|
|
5
|
+
}
|
|
6
|
+
export declare function ToolbarCodeButton(props: ToolbarCodeButtonProps): JSX.Element | null;
|
|
7
|
+
export declare function Code(props: Slate.RenderLeafProps): JSX.Element;
|
|
8
|
+
export declare const createCodePlugin: () => RichTextPlugin;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as Slate from 'slate-react';
|
|
2
|
+
import { RichTextPlugin } from '../../types';
|
|
3
|
+
interface ToolbarItalicButtonProps {
|
|
4
|
+
isDisabled?: boolean;
|
|
5
|
+
}
|
|
6
|
+
export declare function ToolbarItalicButton(props: ToolbarItalicButtonProps): JSX.Element | null;
|
|
7
|
+
export declare function Italic(props: Slate.RenderLeafProps): JSX.Element;
|
|
8
|
+
export declare const createItalicPlugin: () => RichTextPlugin;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as Slate from 'slate-react';
|
|
2
|
+
import { RichTextPlugin } from '../../types';
|
|
3
|
+
interface ToolbarUnderlineButtonProps {
|
|
4
|
+
isDisabled?: boolean;
|
|
5
|
+
}
|
|
6
|
+
export declare function ToolbarUnderlineButton(props: ToolbarUnderlineButtonProps): JSX.Element | null;
|
|
7
|
+
export declare function Underline(props: Slate.RenderLeafProps): JSX.Element;
|
|
8
|
+
export declare const createUnderlinePlugin: () => RichTextPlugin;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,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 @@
|
|
|
1
|
+
export * from './createPasteHTMLPlugin';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const sanitizeHTML: (html: string) => string;
|
|
@@ -1,59 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
handleToggle: (event: any) => any;
|
|
4
|
-
render(): JSX.Element;
|
|
5
|
-
context: any;
|
|
6
|
-
setState<K extends string | number | symbol>(state: any, callback?: (() => void) | undefined): void;
|
|
7
|
-
forceUpdate(callback?: (() => void) | undefined): void;
|
|
8
|
-
readonly props: Readonly<any> & Readonly<{
|
|
9
|
-
children?: React.ReactNode;
|
|
10
|
-
}>;
|
|
11
|
-
state: Readonly<any>;
|
|
12
|
-
refs: {
|
|
13
|
-
[key: string]: React.ReactInstance;
|
|
14
|
-
};
|
|
15
|
-
componentDidMount?(): void;
|
|
16
|
-
shouldComponentUpdate?(nextProps: Readonly<any>, nextState: Readonly<any>, nextContext: any): boolean;
|
|
17
|
-
componentWillUnmount?(): void;
|
|
18
|
-
componentDidCatch?(error: Error, errorInfo: React.ErrorInfo): void;
|
|
19
|
-
getSnapshotBeforeUpdate?(prevProps: Readonly<any>, prevState: Readonly<any>): any;
|
|
20
|
-
componentDidUpdate?(prevProps: Readonly<any>, prevState: Readonly<any>, snapshot?: any): void;
|
|
21
|
-
componentWillMount?(): void;
|
|
22
|
-
UNSAFE_componentWillMount?(): void;
|
|
23
|
-
componentWillReceiveProps?(nextProps: Readonly<any>, nextContext: any): void;
|
|
24
|
-
UNSAFE_componentWillReceiveProps?(nextProps: Readonly<any>, nextContext: any): void;
|
|
25
|
-
componentWillUpdate?(nextProps: Readonly<any>, nextState: Readonly<any>, nextContext: any): void;
|
|
26
|
-
UNSAFE_componentWillUpdate?(nextProps: Readonly<any>, nextState: Readonly<any>, nextContext: any): void;
|
|
27
|
-
};
|
|
28
|
-
new (props: any, context: any): {
|
|
29
|
-
handleToggle: (event: any) => any;
|
|
30
|
-
render(): JSX.Element;
|
|
31
|
-
context: any;
|
|
32
|
-
setState<K extends string | number | symbol>(state: any, callback?: (() => void) | undefined): void;
|
|
33
|
-
forceUpdate(callback?: (() => void) | undefined): void;
|
|
34
|
-
readonly props: Readonly<any> & Readonly<{
|
|
35
|
-
children?: React.ReactNode;
|
|
36
|
-
}>;
|
|
37
|
-
state: Readonly<any>;
|
|
38
|
-
refs: {
|
|
39
|
-
[key: string]: React.ReactInstance;
|
|
40
|
-
};
|
|
41
|
-
componentDidMount?(): void;
|
|
42
|
-
shouldComponentUpdate?(nextProps: Readonly<any>, nextState: Readonly<any>, nextContext: any): boolean;
|
|
43
|
-
componentWillUnmount?(): void;
|
|
44
|
-
componentDidCatch?(error: Error, errorInfo: React.ErrorInfo): void;
|
|
45
|
-
getSnapshotBeforeUpdate?(prevProps: Readonly<any>, prevState: Readonly<any>): any;
|
|
46
|
-
componentDidUpdate?(prevProps: Readonly<any>, prevState: Readonly<any>, snapshot?: any): void;
|
|
47
|
-
componentWillMount?(): void;
|
|
48
|
-
UNSAFE_componentWillMount?(): void;
|
|
49
|
-
componentWillReceiveProps?(nextProps: Readonly<any>, nextContext: any): void;
|
|
50
|
-
UNSAFE_componentWillReceiveProps?(nextProps: Readonly<any>, nextContext: any): void;
|
|
51
|
-
componentWillUpdate?(nextProps: Readonly<any>, nextState: Readonly<any>, nextContext: any): void;
|
|
52
|
-
UNSAFE_componentWillUpdate?(nextProps: Readonly<any>, nextState: Readonly<any>, nextContext: any): void;
|
|
53
|
-
};
|
|
54
|
-
propTypes: any;
|
|
55
|
-
contextType?: React.Context<any> | undefined;
|
|
56
|
-
};
|
|
57
|
-
export default _default;
|
|
58
|
-
export { default as QuotePlugin } from "./QuotePlugin";
|
|
59
|
-
import React from "react";
|
|
1
|
+
export * from './createQuotePlugin';
|
|
2
|
+
export * from './components/ToolbarQuoteButton';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './createSelectOnBackspacePlugin';
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { PlateEditor } from '@udecode/plate-core';
|
|
2
|
+
import { TablePluginOptions } from '@udecode/plate-table';
|
|
3
|
+
export declare const addColumnRight: (editor: PlateEditor, options: TablePluginOptions) => void;
|
|
4
|
+
export declare const addColumnLeft: (editor: PlateEditor, options: TablePluginOptions) => void;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { PlateEditor } from '@udecode/plate-core';
|
|
2
|
+
import { Node, NodeEntry } from 'slate';
|
|
3
|
+
export declare function insertTableAndFocusFirstCell(editor: PlateEditor): void;
|
|
4
|
+
export declare function isTableActive(editor: PlateEditor): boolean;
|
|
5
|
+
export declare function isTableHeaderEnabled(editor: PlateEditor): boolean;
|
|
6
|
+
export declare function replaceEmptyParagraphWithTable(editor: PlateEditor): void;
|
|
7
|
+
/**
|
|
8
|
+
* Returns the number of cells in a given row vs the table width
|
|
9
|
+
*
|
|
10
|
+
* Note: We should only get different table rows cell counts in between
|
|
11
|
+
* normalization cycles.
|
|
12
|
+
*/
|
|
13
|
+
export declare const getNoOfMissingTableCellsInRow: (editor: PlateEditor, [, rowPath]: NodeEntry<Node>) => number;
|
|
14
|
+
export declare const createEmptyTableCells: (count: number) => Node[];
|
|
15
|
+
export declare const isNotEmpty: (editor: PlateEditor, [, path]: NodeEntry<Node>) => boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './createTextPlugin';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const createTrailingParagraphPlugin: () => import("@udecode/plate-core").PlatePlugin<{}, import("@udecode/plate-trailing-block").TrailingBlockPlugin>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './createVoidsPlugin';
|
package/dist/plugins/index.d.ts
CHANGED
|
@@ -1 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
import { FieldExtensionSDK } from '@contentful/app-sdk';
|
|
2
|
+
import { PlateProps } from '@udecode/plate-core';
|
|
3
|
+
import { TrackingProvider } from '../TrackingProvider';
|
|
4
|
+
import { RichTextPlugin } from '../types';
|
|
5
|
+
export declare const getPlugins: (sdk: FieldExtensionSDK, tracking: TrackingProvider) => RichTextPlugin[];
|
|
6
|
+
export declare const disableCorePlugins: PlateProps['disableCorePlugins'];
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React, { ComponentProps } from 'react';
|
|
2
|
+
import { TrackingProvider } from '../TrackingProvider';
|
|
3
|
+
declare type WithEntityFetchProps = {
|
|
4
|
+
onEntityFetchComplete: VoidFunction;
|
|
5
|
+
} & JSX.IntrinsicAttributes;
|
|
6
|
+
export declare function withLinkTracking(tracking: TrackingProvider, Component: React.ComponentType<WithEntityFetchProps>): (props: ComponentProps<typeof Component>) => JSX.Element;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Entry, Asset } from '@contentful/field-editor-shared';
|
|
2
|
+
interface EntityStatusIconProps {
|
|
3
|
+
entity: Entry | Asset;
|
|
4
|
+
entityType: 'Entry' | 'Asset';
|
|
5
|
+
}
|
|
6
|
+
export declare function EntityStatusIcon({ entity, entityType }: EntityStatusIconProps): JSX.Element;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { FieldExtensionSDK } from '@contentful/app-sdk';
|
|
2
|
+
import { File } from '@contentful/field-editor-shared';
|
|
3
|
+
interface FetchingWrappedAssetCardProps {
|
|
4
|
+
assetId: string;
|
|
5
|
+
isDisabled: boolean;
|
|
6
|
+
isSelected: boolean;
|
|
7
|
+
locale: string;
|
|
8
|
+
onEdit?: () => void;
|
|
9
|
+
onRemove?: () => unknown;
|
|
10
|
+
sdk: FieldExtensionSDK;
|
|
11
|
+
onEntityFetchComplete?: VoidFunction;
|
|
12
|
+
}
|
|
13
|
+
export declare function renderAssetInfo(props: {
|
|
14
|
+
entityFile: File;
|
|
15
|
+
}): ("" | JSX.Element)[];
|
|
16
|
+
export declare function renderActions(props: {
|
|
17
|
+
onEdit?: () => void;
|
|
18
|
+
onRemove?: () => void;
|
|
19
|
+
isDisabled: boolean;
|
|
20
|
+
entityFile?: File;
|
|
21
|
+
}): (JSX.Element | null)[];
|
|
22
|
+
export declare function FetchingWrappedAssetCard(props: FetchingWrappedAssetCardProps): JSX.Element;
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { FieldExtensionSDK } from '@contentful/app-sdk';
|
|
2
|
+
interface FetchingWrappedEntryCardProps {
|
|
3
|
+
entryId: string;
|
|
4
|
+
isDisabled: boolean;
|
|
5
|
+
isSelected: boolean;
|
|
6
|
+
locale: string;
|
|
7
|
+
sdk: FieldExtensionSDK;
|
|
8
|
+
onEntityFetchComplete?: VoidFunction;
|
|
9
|
+
onEdit?: VoidFunction;
|
|
10
|
+
onRemove?: VoidFunction;
|
|
11
|
+
}
|
|
12
|
+
export declare function FetchingWrappedEntryCard(props: FetchingWrappedEntryCardProps): JSX.Element;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
interface ToolbarButtonProps {
|
|
2
|
+
onClick: () => void;
|
|
3
|
+
isActive?: boolean;
|
|
4
|
+
isDisabled?: boolean;
|
|
5
|
+
children: any;
|
|
6
|
+
title: string;
|
|
7
|
+
className?: string;
|
|
8
|
+
testId?: string;
|
|
9
|
+
}
|
|
10
|
+
export declare function ToolbarButton(props: ToolbarButtonProps): JSX.Element;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { FieldExtensionSDK } from '@contentful/app-sdk';
|
|
2
|
+
import { PlateEditor } from '@udecode/plate-core';
|
|
3
|
+
import { TrackingProvider } from '../TrackingProvider';
|
|
4
|
+
import { RichTextPlugin } from '../types';
|
|
5
|
+
export declare const normalize: (editor: PlateEditor) => void;
|
|
6
|
+
export declare const createTestEditor: (options: {
|
|
7
|
+
input?: any;
|
|
8
|
+
sdk?: FieldExtensionSDK;
|
|
9
|
+
tracking?: TrackingProvider;
|
|
10
|
+
plugins?: RichTextPlugin[];
|
|
11
|
+
}) => {
|
|
12
|
+
editor: PlateEditor<{}>;
|
|
13
|
+
normalize: () => void;
|
|
14
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Mapping for JSX => Slate Node types
|
|
3
|
+
*
|
|
4
|
+
* Add items as needed. Don't forget to adjust hyperscript.d.ts
|
|
5
|
+
*/
|
|
6
|
+
export declare const jsx: <S extends "selection" | "text" | "element" | "editor" | "focus" | "anchor" | "cursor" | "fragment">(tagName: S, attributes?: Object | undefined, ...children: any[]) => ReturnType<({
|
|
7
|
+
anchor: typeof import("slate-hyperscript/dist/creators").createAnchor;
|
|
8
|
+
cursor: typeof import("slate-hyperscript/dist/creators").createCursor;
|
|
9
|
+
editor: (tagName: string, attributes: {
|
|
10
|
+
[key: string]: any;
|
|
11
|
+
}, children: any[]) => import("slate").BaseEditor;
|
|
12
|
+
element: typeof import("slate-hyperscript/dist/creators").createElement;
|
|
13
|
+
focus: typeof import("slate-hyperscript/dist/creators").createFocus;
|
|
14
|
+
fragment: typeof import("slate-hyperscript/dist/creators").createFragment;
|
|
15
|
+
selection: typeof import("slate-hyperscript/dist/creators").createSelection;
|
|
16
|
+
text: typeof import("slate-hyperscript/dist/creators").createText;
|
|
17
|
+
} | {
|
|
18
|
+
anchor: typeof import("slate-hyperscript/dist/creators").createAnchor;
|
|
19
|
+
cursor: typeof import("slate-hyperscript/dist/creators").createCursor;
|
|
20
|
+
editor: (tagName: string, attributes: {
|
|
21
|
+
[key: string]: any;
|
|
22
|
+
}, children: any[]) => import("slate").BaseEditor;
|
|
23
|
+
element: typeof import("slate-hyperscript/dist/creators").createElement;
|
|
24
|
+
focus: typeof import("slate-hyperscript/dist/creators").createFocus;
|
|
25
|
+
fragment: typeof import("slate-hyperscript/dist/creators").createFragment;
|
|
26
|
+
selection: typeof import("slate-hyperscript/dist/creators").createSelection;
|
|
27
|
+
text: typeof import("slate-hyperscript/dist/creators").createText;
|
|
28
|
+
})[S]>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function validateRichTextDocument(document: any): never[];
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { MARKS } from '@contentful/rich-text-types';
|
|
2
|
+
import { PlatePlugin } from '@udecode/plate-core';
|
|
3
|
+
import { RenderElementProps } from 'slate-react';
|
|
4
|
+
import type { SoftBreakRule, ExitBreakRule } from './plugins/Break';
|
|
5
|
+
import type { NormalizerRule } from './plugins/Normalizer';
|
|
6
|
+
export declare type CustomText = {
|
|
7
|
+
text: string;
|
|
8
|
+
[MARKS.BOLD]?: boolean;
|
|
9
|
+
[MARKS.CODE]?: boolean;
|
|
10
|
+
[MARKS.ITALIC]?: boolean;
|
|
11
|
+
[MARKS.UNDERLINE]?: boolean;
|
|
12
|
+
};
|
|
13
|
+
export declare type TextOrCustomElement = CustomElement | CustomText;
|
|
14
|
+
export declare type CustomElement<T = unknown> = {
|
|
15
|
+
type: string;
|
|
16
|
+
children: TextOrCustomElement[];
|
|
17
|
+
data: T;
|
|
18
|
+
isVoid?: boolean;
|
|
19
|
+
};
|
|
20
|
+
export declare type CustomRenderElementProps<T = any, O = any> = Omit<RenderElementProps, 'element'> & {
|
|
21
|
+
element: CustomElement<T>;
|
|
22
|
+
} & O;
|
|
23
|
+
declare module 'slate' {
|
|
24
|
+
interface CustomTypes {
|
|
25
|
+
Element: CustomElement;
|
|
26
|
+
Text: CustomText;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
export interface RichTextPlugin extends PlatePlugin {
|
|
30
|
+
/**
|
|
31
|
+
* @see createSoftBreakPlugin
|
|
32
|
+
*/
|
|
33
|
+
softBreak?: SoftBreakRule[];
|
|
34
|
+
/**
|
|
35
|
+
* @see createExitBreakPlugin
|
|
36
|
+
*/
|
|
37
|
+
exitBreak?: ExitBreakRule[];
|
|
38
|
+
/**
|
|
39
|
+
* @see createNormalizerPlugin
|
|
40
|
+
*/
|
|
41
|
+
normalizer?: NormalizerRule[];
|
|
42
|
+
}
|