@contentful/field-editor-rich-text 3.3.5 → 3.4.0
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/CHANGELOG.md +6 -0
- package/dist/ContentfulEditorProvider.d.ts +3 -3
- package/dist/field-editor-rich-text.cjs.development.js +785 -466
- 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 +727 -408
- package/dist/field-editor-rich-text.esm.js.map +1 -1
- package/dist/helpers/editor.d.ts +15 -16
- package/dist/helpers/extractNodes.d.ts +2 -3
- package/dist/helpers/sanitizeIncomingSlateDoc.d.ts +1 -1
- package/dist/helpers/transformers.d.ts +6 -7
- package/dist/internal/constants.d.ts +1 -0
- package/dist/internal/hooks.d.ts +1 -0
- package/dist/internal/index.d.ts +4 -0
- package/dist/internal/misc.d.ts +35 -0
- package/dist/internal/queries.d.ts +78 -0
- package/dist/internal/transforms.d.ts +33 -0
- package/dist/internal/types/editor.d.ts +70 -0
- package/dist/internal/types/index.d.ts +2 -0
- package/dist/internal/types/plugins.d.ts +12 -0
- package/dist/plugins/Break/createExitBreakPlugin.d.ts +2 -2
- package/dist/plugins/Break/createResetNodePlugin.d.ts +2 -2
- package/dist/plugins/Break/createSoftBreakPlugin.d.ts +2 -2
- package/dist/plugins/CommandPalette/components/CommandList.d.ts +2 -2
- package/dist/plugins/CommandPalette/components/CommandPrompt.d.ts +4 -2
- package/dist/plugins/CommandPalette/createCommandPalettePlugin.d.ts +2 -2
- package/dist/plugins/CommandPalette/onKeyDown.d.ts +2 -3
- package/dist/plugins/CommandPalette/useCommands.d.ts +2 -2
- package/dist/plugins/DragAndDrop/index.d.ts +2 -2
- package/dist/plugins/EmbeddedEntityBlock/LinkedEntityBlock.d.ts +1 -1
- package/dist/plugins/EmbeddedEntityBlock/Util.d.ts +2 -1
- package/dist/plugins/EmbeddedEntityBlock/index.d.ts +3 -3
- package/dist/plugins/EmbeddedEntityInline/index.d.ts +2 -2
- package/dist/plugins/Heading/createHeadingPlugin.d.ts +2 -2
- package/dist/plugins/Hr/index.d.ts +3 -3
- package/dist/plugins/Hyperlink/HyperlinkModal.d.ts +2 -3
- package/dist/plugins/Hyperlink/components/EntityHyperlink.d.ts +1 -1
- package/dist/plugins/Hyperlink/components/UrlHyperlink.d.ts +1 -1
- package/dist/plugins/Hyperlink/createHyperlinkPlugin.d.ts +2 -2
- package/dist/plugins/Hyperlink/utils.d.ts +3 -3
- package/dist/plugins/List/createListPlugin.d.ts +2 -2
- package/dist/plugins/List/insertListBreak.d.ts +2 -2
- package/dist/plugins/List/insertListFragment.d.ts +2 -3
- package/dist/plugins/List/onKeyDownList.d.ts +3 -3
- package/dist/plugins/List/transforms/deleteBackwardList.d.ts +2 -2
- package/dist/plugins/List/transforms/insertListItem.d.ts +2 -2
- package/dist/plugins/List/transforms/moveListItemDown.d.ts +3 -8
- package/dist/plugins/List/transforms/moveListItems.d.ts +2 -6
- package/dist/plugins/List/transforms/toggleList.d.ts +2 -2
- package/dist/plugins/List/transforms/unwrapList.d.ts +2 -3
- package/dist/plugins/List/utils.d.ts +8 -9
- package/dist/plugins/List/withList.d.ts +2 -4
- package/dist/plugins/Marks/Bold.d.ts +3 -4
- package/dist/plugins/Marks/Code.d.ts +3 -4
- package/dist/plugins/Marks/Italic.d.ts +3 -4
- package/dist/plugins/Marks/Subscript.d.ts +3 -4
- package/dist/plugins/Marks/Superscript.d.ts +3 -4
- package/dist/plugins/Marks/Underline.d.ts +3 -4
- package/dist/plugins/Marks/helpers.d.ts +3 -5
- package/dist/plugins/Marks/index.d.ts +2 -2
- package/dist/plugins/Normalizer/createNormalizerPlugin.d.ts +2 -2
- package/dist/plugins/Normalizer/types.d.ts +3 -5
- package/dist/plugins/Normalizer/utils.d.ts +0 -3
- package/dist/plugins/Normalizer/withNormalizer.d.ts +2 -2
- package/dist/plugins/Paragraph/Paragraph.d.ts +1 -1
- package/dist/plugins/Paragraph/createParagraphPlugin.d.ts +2 -2
- package/dist/plugins/PasteHTML/createPasteHTMLPlugin.d.ts +2 -2
- package/dist/plugins/Quote/components/Quote.d.ts +1 -1
- package/dist/plugins/Quote/createQuotePlugin.d.ts +2 -2
- package/dist/plugins/Quote/shouldResetQuote.d.ts +1 -1
- package/dist/plugins/Quote/toggleQuote.d.ts +2 -3
- package/dist/plugins/Quote/withQuote.d.ts +2 -3
- package/dist/plugins/SelectOnBackspace/createSelectOnBackspacePlugin.d.ts +2 -2
- package/dist/plugins/Table/actions/addColumn.d.ts +7 -4
- package/dist/plugins/Table/actions/addRow.d.ts +3 -3
- package/dist/plugins/Table/actions/setHeader.d.ts +2 -2
- package/dist/plugins/Table/components/Cell.d.ts +2 -2
- package/dist/plugins/Table/components/HeaderCell.d.ts +2 -2
- package/dist/plugins/Table/createTablePlugin.d.ts +2 -2
- package/dist/plugins/Table/helpers.d.ts +8 -9
- package/dist/plugins/Table/insertTableFragment.d.ts +3 -3
- package/dist/plugins/Table/onKeyDownTable.d.ts +2 -3
- package/dist/plugins/Table/tableTracking.d.ts +2 -2
- package/dist/plugins/Text/createTextPlugin.d.ts +2 -2
- package/dist/plugins/Tracking/createTrackingPlugin.d.ts +2 -2
- package/dist/plugins/Tracking/utils.d.ts +2 -2
- package/dist/plugins/TrailingParagraph/index.d.ts +2 -2
- package/dist/plugins/Voids/createVoidsPlugin.d.ts +2 -2
- package/dist/plugins/Voids/transformVoid.d.ts +2 -3
- package/dist/plugins/index.d.ts +2 -2
- package/dist/prepareDocument.d.ts +5 -6
- package/dist/test-utils/assertOutput.d.ts +2 -2
- package/dist/test-utils/createEditor.d.ts +22 -4
- package/dist/test-utils/jsx.d.ts +1 -1
- package/dist/test-utils/mockPlugin.d.ts +2 -2
- package/dist/test-utils/setEmptyDataAttribute.d.ts +2 -2
- package/package.json +17 -16
- package/dist/types.d.ts +0 -52
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
* Credit: Modified version of Plate's list plugin
|
|
3
|
-
* See: https://github.com/udecode/plate/blob/main/packages/nodes/list
|
|
4
|
-
*/
|
|
5
|
-
import { EditorNodesOptions, PlateEditor } from '@udecode/plate-core';
|
|
1
|
+
import { Span, Location, PlateEditor } from '../../../internal/types';
|
|
6
2
|
export declare type MoveListItemsOptions = {
|
|
7
3
|
increase?: boolean;
|
|
8
|
-
at?:
|
|
4
|
+
at?: Location | Span | undefined;
|
|
9
5
|
};
|
|
10
6
|
export declare const moveListItems: (editor: PlateEditor, { increase, at }?: MoveListItemsOptions) => void;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { PlateEditor } from '
|
|
2
|
-
import { Path } from 'slate';
|
|
1
|
+
import { PlateEditor, Path } from '../../../internal/types';
|
|
3
2
|
export declare const unwrapList: (editor: PlateEditor, { at }?: {
|
|
4
|
-
at?: Path | undefined;
|
|
3
|
+
at?: import("slate").Path | undefined;
|
|
5
4
|
}) => void;
|
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
import { BLOCKS } from '@contentful/rich-text-types';
|
|
2
|
-
import { NodeEntry,
|
|
3
|
-
|
|
4
|
-
export declare const hasListAsDirectParent: (editor: RichTextEditor, [, path]: NodeEntry<Node>) => boolean;
|
|
2
|
+
import { Node, NodeEntry, PlateEditor, Element } from '../../internal/types';
|
|
3
|
+
export declare const hasListAsDirectParent: (editor: PlateEditor, [, path]: NodeEntry<Node>) => boolean;
|
|
5
4
|
/**
|
|
6
5
|
* Places orphaned list items in a list. If there's a list somewhere
|
|
7
6
|
* in the node's ancestors, defaults to that list type, else places
|
|
8
7
|
* the list item in an unordered list.
|
|
9
8
|
*/
|
|
10
|
-
export declare const normalizeOrphanedListItem: (editor:
|
|
11
|
-
export declare const isNonEmptyListItem: (
|
|
12
|
-
export declare const firstNodeIsNotList: (_editor:
|
|
13
|
-
export declare const insertParagraphAsChild: (editor:
|
|
14
|
-
export declare const replaceNodeWithListItems: (editor:
|
|
15
|
-
export declare const isListTypeActive: (editor:
|
|
9
|
+
export declare const normalizeOrphanedListItem: (editor: PlateEditor, [, path]: NodeEntry<Node>) => void;
|
|
10
|
+
export declare const isNonEmptyListItem: (_: PlateEditor, entry: NodeEntry<Node>) => boolean;
|
|
11
|
+
export declare const firstNodeIsNotList: (_editor: PlateEditor, [node]: NodeEntry<Element>) => boolean;
|
|
12
|
+
export declare const insertParagraphAsChild: (editor: PlateEditor, [, path]: NodeEntry<Node>) => void;
|
|
13
|
+
export declare const replaceNodeWithListItems: (editor: PlateEditor, entry: NodeEntry<Element>) => void;
|
|
14
|
+
export declare const isListTypeActive: (editor: PlateEditor, type: BLOCKS) => boolean;
|
|
@@ -1,4 +1,2 @@
|
|
|
1
|
-
import { WithOverride } from '
|
|
2
|
-
|
|
3
|
-
import { RichTextEditor } from '../../types';
|
|
4
|
-
export declare const withList: WithOverride<RichTextEditor, ListPlugin>;
|
|
1
|
+
import { WithOverride } from '../../internal/types';
|
|
2
|
+
export declare const withList: WithOverride;
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { MARKS } from '@contentful/rich-text-types';
|
|
2
|
-
import
|
|
3
|
-
import { RichTextPlugin } from '../../types';
|
|
2
|
+
import { PlatePlugin, RenderLeafProps } from '../../internal/types';
|
|
4
3
|
export declare const ToolbarBoldButton: {
|
|
5
4
|
({ isDisabled }: {
|
|
6
5
|
isDisabled?: boolean | undefined;
|
|
7
6
|
}): JSX.Element | null;
|
|
8
7
|
displayName: MARKS;
|
|
9
8
|
};
|
|
10
|
-
export declare function Bold(props:
|
|
11
|
-
export declare const createBoldPlugin: () =>
|
|
9
|
+
export declare function Bold(props: RenderLeafProps): JSX.Element;
|
|
10
|
+
export declare const createBoldPlugin: () => PlatePlugin;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { MARKS } from '@contentful/rich-text-types';
|
|
2
|
-
import
|
|
3
|
-
import { RichTextPlugin } from '../../types';
|
|
2
|
+
import { PlatePlugin, RenderLeafProps } from '../../internal/types';
|
|
4
3
|
export declare const ToolbarCodeButton: {
|
|
5
4
|
({ isDisabled }: {
|
|
6
5
|
isDisabled?: boolean | undefined;
|
|
@@ -13,5 +12,5 @@ export declare const ToolbarDropdownCodeButton: {
|
|
|
13
12
|
}): JSX.Element | null;
|
|
14
13
|
displayName: MARKS;
|
|
15
14
|
};
|
|
16
|
-
export declare function Code(props:
|
|
17
|
-
export declare const createCodePlugin: () =>
|
|
15
|
+
export declare function Code(props: RenderLeafProps): JSX.Element;
|
|
16
|
+
export declare const createCodePlugin: () => PlatePlugin;
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { MARKS } from '@contentful/rich-text-types';
|
|
2
|
-
import
|
|
3
|
-
import { RichTextPlugin } from '../../types';
|
|
2
|
+
import { PlatePlugin, RenderLeafProps } from '../../internal/types';
|
|
4
3
|
export declare const ToolbarItalicButton: {
|
|
5
4
|
({ isDisabled }: {
|
|
6
5
|
isDisabled?: boolean | undefined;
|
|
7
6
|
}): JSX.Element | null;
|
|
8
7
|
displayName: MARKS;
|
|
9
8
|
};
|
|
10
|
-
export declare function Italic(props:
|
|
11
|
-
export declare const createItalicPlugin: () =>
|
|
9
|
+
export declare function Italic(props: RenderLeafProps): JSX.Element;
|
|
10
|
+
export declare const createItalicPlugin: () => PlatePlugin;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { MARKS } from '@contentful/rich-text-types';
|
|
2
|
-
import
|
|
3
|
-
import { RichTextPlugin } from '../../types';
|
|
2
|
+
import { PlatePlugin, RenderLeafProps } from '../../internal/types';
|
|
4
3
|
export declare const ToolbarSubscriptButton: {
|
|
5
4
|
({ isDisabled }: {
|
|
6
5
|
isDisabled?: boolean | undefined;
|
|
@@ -13,5 +12,5 @@ export declare const ToolbarDropdownSubscriptButton: {
|
|
|
13
12
|
}): JSX.Element | null;
|
|
14
13
|
displayName: MARKS;
|
|
15
14
|
};
|
|
16
|
-
export declare function Subscript(props:
|
|
17
|
-
export declare const createSubscriptPlugin: () =>
|
|
15
|
+
export declare function Subscript(props: RenderLeafProps): JSX.Element;
|
|
16
|
+
export declare const createSubscriptPlugin: () => PlatePlugin;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { MARKS } from '@contentful/rich-text-types';
|
|
2
|
-
import
|
|
3
|
-
import { RichTextPlugin } from '../../types';
|
|
2
|
+
import { PlatePlugin, RenderLeafProps } from '../../internal/types';
|
|
4
3
|
export declare const ToolbarSuperscriptButton: {
|
|
5
4
|
({ isDisabled }: {
|
|
6
5
|
isDisabled?: boolean | undefined;
|
|
@@ -13,5 +12,5 @@ export declare const ToolbarDropdownSuperscriptButton: {
|
|
|
13
12
|
}): JSX.Element | null;
|
|
14
13
|
displayName: MARKS;
|
|
15
14
|
};
|
|
16
|
-
export declare function Superscript(props:
|
|
17
|
-
export declare const createSuperscriptPlugin: () =>
|
|
15
|
+
export declare function Superscript(props: RenderLeafProps): JSX.Element;
|
|
16
|
+
export declare const createSuperscriptPlugin: () => PlatePlugin;
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { MARKS } from '@contentful/rich-text-types';
|
|
2
|
-
import
|
|
3
|
-
import { RichTextPlugin } from '../../types';
|
|
2
|
+
import { PlatePlugin, RenderLeafProps } from '../../internal/types';
|
|
4
3
|
export declare const ToolbarUnderlineButton: {
|
|
5
4
|
({ isDisabled }: {
|
|
6
5
|
isDisabled?: boolean | undefined;
|
|
7
6
|
}): JSX.Element | null;
|
|
8
7
|
displayName: MARKS;
|
|
9
8
|
};
|
|
10
|
-
export declare function Underline(props:
|
|
11
|
-
export declare const createUnderlinePlugin: () =>
|
|
9
|
+
export declare function Underline(props: RenderLeafProps): JSX.Element;
|
|
10
|
+
export declare const createUnderlinePlugin: () => PlatePlugin;
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import { MARKS } from '@contentful/rich-text-types';
|
|
2
|
-
import { HotkeyPlugin, KeyboardHandler } from '
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
export declare const toggleMarkAndDeactivateConflictingMarks: (editor: PlateEditor<RichTextEditor>, mark: MARKS) => void;
|
|
6
|
-
export declare const buildMarkEventHandler: (type: MARKS) => KeyboardHandler<RichTextEditor, HotkeyPlugin>;
|
|
2
|
+
import { PlateEditor, HotkeyPlugin, KeyboardHandler } from '../../internal/types';
|
|
3
|
+
export declare const toggleMarkAndDeactivateConflictingMarks: (editor: PlateEditor, mark: MARKS) => void;
|
|
4
|
+
export declare const buildMarkEventHandler: (type: MARKS) => KeyboardHandler<HotkeyPlugin>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare const createMarksPlugin: () =>
|
|
1
|
+
import { PlatePlugin } from '../../internal/types';
|
|
2
|
+
export declare const createMarksPlugin: () => PlatePlugin;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare const createNormalizerPlugin: () =>
|
|
1
|
+
import { PlatePlugin } from '../../internal/types';
|
|
2
|
+
export declare const createNormalizerPlugin: () => PlatePlugin;
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import { NodeMatch } from '
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export declare type NodeTransformer = (editor: RichTextEditor, entry: NodeEntry) => void;
|
|
5
|
-
export declare type NodeValidator = (editor: RichTextEditor, entry: NodeEntry) => boolean;
|
|
1
|
+
import { NodeEntry, NodeMatch, PlateEditor } from '../../internal/types';
|
|
2
|
+
export declare type NodeTransformer = (editor: PlateEditor, entry: NodeEntry) => void;
|
|
3
|
+
export declare type NodeValidator = (editor: PlateEditor, entry: NodeEntry) => boolean;
|
|
6
4
|
declare type BaseRule = {
|
|
7
5
|
/**
|
|
8
6
|
* A helper to return a Node to which valid* rules are applied
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
import { NodeEntry, Node } from 'slate';
|
|
2
|
-
import { RichTextEditor } from 'types';
|
|
3
1
|
import { NodeValidator, NodeTransformer } from './types';
|
|
4
2
|
export declare class NormalizerError extends Error {
|
|
5
3
|
}
|
|
6
4
|
export declare const createValidatorFromTypes: (types: string[]) => NodeValidator;
|
|
7
|
-
export declare const getChildren: (editor: RichTextEditor, [node, path]: NodeEntry<Node>) => NodeEntry[];
|
|
8
5
|
export declare const createTransformerFromObject: (transforms: Record<string, NodeTransformer>) => NodeTransformer;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare const withNormalizer: (editor:
|
|
1
|
+
import { PlateEditor } from '../../internal/types';
|
|
2
|
+
export declare const withNormalizer: (editor: PlateEditor) => PlateEditor;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { RenderElementProps } from '
|
|
1
|
+
import { RenderElementProps } from '../../internal/types';
|
|
2
2
|
export declare function Paragraph(props: RenderElementProps): JSX.Element;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare const createParagraphPlugin: () =>
|
|
1
|
+
import { PlatePlugin } from '../../internal/types';
|
|
2
|
+
export declare const createParagraphPlugin: () => PlatePlugin;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { PlatePlugin } from '../../internal/types';
|
|
2
2
|
export declare const getSlateFragmentAttribute: (dataTransfer: DataTransfer) => string | void;
|
|
3
3
|
/**
|
|
4
4
|
* Get the x-slate-fragment attribute that exist in text/html data
|
|
5
5
|
* and append it to the DataTransfer object
|
|
6
6
|
*/
|
|
7
7
|
export declare const ensureXSlateFragment: (dataTransfer: DataTransfer) => DataTransfer;
|
|
8
|
-
export declare const createPasteHTMLPlugin: () =>
|
|
8
|
+
export declare const createPasteHTMLPlugin: () => PlatePlugin;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { RenderElementProps } from '
|
|
1
|
+
import { RenderElementProps } from '../../../internal/types';
|
|
2
2
|
export declare function Quote(props: RenderElementProps): JSX.Element;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare function createQuotePlugin():
|
|
1
|
+
import { PlatePlugin } from '../../internal/types';
|
|
2
|
+
export declare function createQuotePlugin(): PlatePlugin;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { KeyboardHandler, HotkeyPlugin, PlateEditor } from '../../internal/types';
|
|
2
2
|
import { TrackingPluginActions } from '../../plugins/Tracking';
|
|
3
|
-
import { RichTextEditor } from '../../types';
|
|
4
3
|
export declare function toggleQuote(editor: PlateEditor, logAction?: TrackingPluginActions['onShortcutAction'] | TrackingPluginActions['onToolbarAction']): void;
|
|
5
|
-
export declare const onKeyDownToggleQuote: KeyboardHandler<
|
|
4
|
+
export declare const onKeyDownToggleQuote: KeyboardHandler<HotkeyPlugin>;
|
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
import { WithOverride } from '
|
|
2
|
-
|
|
3
|
-
export declare const withQuote: WithOverride<RichTextEditor>;
|
|
1
|
+
import { WithOverride } from '../../internal/types';
|
|
2
|
+
export declare const withQuote: WithOverride;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare const createSelectOnBackspacePlugin: () =>
|
|
1
|
+
import { PlatePlugin } from '../../internal/types';
|
|
2
|
+
export declare const createSelectOnBackspacePlugin: () => PlatePlugin;
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { PlateEditor } from '../../../internal/types';
|
|
2
|
+
interface AddColumnOptions {
|
|
3
|
+
header?: boolean;
|
|
4
|
+
}
|
|
5
|
+
export declare const addColumnRight: (editor: PlateEditor, options: AddColumnOptions) => void;
|
|
6
|
+
export declare const addColumnLeft: (editor: PlateEditor, options: AddColumnOptions) => void;
|
|
7
|
+
export {};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare const addRowBelow: (editor:
|
|
3
|
-
export declare const addRowAbove: (editor:
|
|
1
|
+
import { PlateEditor } from '../../../internal/types';
|
|
2
|
+
export declare const addRowBelow: (editor: PlateEditor) => void;
|
|
3
|
+
export declare const addRowAbove: (editor: PlateEditor) => void;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare const setHeader: (editor:
|
|
1
|
+
import { PlateEditor } from '../../../internal/types';
|
|
2
|
+
export declare const setHeader: (editor: PlateEditor, enable?: boolean | undefined) => void;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
export declare const Cell: (props:
|
|
1
|
+
import { RenderElementProps } from '../../../internal/types';
|
|
2
|
+
export declare const Cell: (props: RenderElementProps) => JSX.Element;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
export declare const HeaderCell: (props:
|
|
1
|
+
import { RenderElementProps } from '../../../internal/types';
|
|
2
|
+
export declare const HeaderCell: (props: RenderElementProps) => JSX.Element;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare const createTablePlugin: () =>
|
|
1
|
+
import { PlatePlugin } from '../../internal/types';
|
|
2
|
+
export declare const createTablePlugin: () => PlatePlugin;
|
|
@@ -1,16 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
export declare function
|
|
4
|
-
export declare function
|
|
5
|
-
export declare function
|
|
6
|
-
export declare function replaceEmptyParagraphWithTable(editor: RichTextEditor): void;
|
|
1
|
+
import { PlateEditor, NodeEntry, Node } from '../../internal/types';
|
|
2
|
+
export declare function insertTableAndFocusFirstCell(editor: PlateEditor): void;
|
|
3
|
+
export declare function isTableActive(editor: PlateEditor): boolean;
|
|
4
|
+
export declare function isTableHeaderEnabled(editor: PlateEditor): boolean;
|
|
5
|
+
export declare function replaceEmptyParagraphWithTable(editor: PlateEditor): void;
|
|
7
6
|
/**
|
|
8
7
|
* Returns the number of cells in a given row vs the table width
|
|
9
8
|
*
|
|
10
9
|
* Note: We should only get different table rows cell counts in between
|
|
11
10
|
* normalization cycles.
|
|
12
11
|
*/
|
|
13
|
-
export declare const getNoOfMissingTableCellsInRow: (editor:
|
|
12
|
+
export declare const getNoOfMissingTableCellsInRow: (editor: PlateEditor, rowEntry: NodeEntry<Node>) => number;
|
|
14
13
|
export declare const createEmptyTableCells: (count: number) => Node[];
|
|
15
|
-
export declare const isNotEmpty: (
|
|
16
|
-
export declare const isTable: (node:
|
|
14
|
+
export declare const isNotEmpty: (_: PlateEditor, entry: NodeEntry<Node>) => boolean;
|
|
15
|
+
export declare const isTable: (node: Node) => boolean;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { Node } from '
|
|
2
|
-
import {
|
|
3
|
-
export declare const insertTableFragment: (editor:
|
|
1
|
+
import { Node } from '../../internal/types';
|
|
2
|
+
import { PlateEditor } from '../../internal/types';
|
|
3
|
+
export declare const insertTableFragment: (editor: PlateEditor) => (fragments: Node[]) => void;
|
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
export declare const onKeyDownTable: KeyboardHandler<RichTextEditor, HotkeyPlugin>;
|
|
1
|
+
import { KeyboardHandler, HotkeyPlugin } from '../../internal/types';
|
|
2
|
+
export declare const onKeyDownTable: KeyboardHandler<HotkeyPlugin>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { PlateEditor } from '../../internal/types';
|
|
2
2
|
import type { NodeTransformer } from '../Normalizer';
|
|
3
|
-
export declare function addTableTrackingEvents(editor:
|
|
3
|
+
export declare function addTableTrackingEvents(editor: PlateEditor): void;
|
|
4
4
|
export declare const withInvalidCellChildrenTracking: (transformer: NodeTransformer) => NodeTransformer;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare function createTextPlugin(restrictedMarks?: string[]):
|
|
1
|
+
import { PlatePlugin } from '../../internal/types';
|
|
2
|
+
export declare function createTextPlugin(restrictedMarks?: string[]): PlatePlugin;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { PlatePlugin } from '../../internal/types';
|
|
2
2
|
export declare type RichTextTrackingActionName = 'edit' | 'insert' | 'remove' | 'mark' | 'unmark' | 'insertTable' | 'insertTableRow' | 'insertTableColumn' | 'removeTable' | 'removeTableRow' | 'removeTableColumn' | 'paste' | 'invalidTablePaste' | 'cancelCreateHyperlinkDialog' | 'cancelEditHyperlinkDialog' | 'linkRendered' | 'openCreateHyperlinkDialog' | 'openEditHyperlinkDialog' | 'unlinkHyperlinks' | 'openCreateEmbedDialog' | 'cancelCreateEmbedDialog' | 'openRichTextCommandPalette' | 'cancelRichTextCommandPalette';
|
|
3
3
|
export declare type RichTextTrackingActionHandler = (name: RichTextTrackingActionName, data: Record<string, unknown>) => unknown;
|
|
4
4
|
export interface TrackingPluginActions {
|
|
@@ -8,4 +8,4 @@ export interface TrackingPluginActions {
|
|
|
8
8
|
onCommandPaletteAction: (actionName: RichTextTrackingActionName, data?: Record<string, unknown>) => ReturnType<RichTextTrackingActionHandler>;
|
|
9
9
|
}
|
|
10
10
|
export declare function getPastingSource(data: DataTransfer): "Google Docs" | "Google Spreadsheets" | "Microsoft Excel" | "Microsoft Word" | "Microsoft Word Online" | "Apple Notes" | "Slack" | "Unknown";
|
|
11
|
-
export declare const createTrackingPlugin: (onAction: RichTextTrackingActionHandler) =>
|
|
11
|
+
export declare const createTrackingPlugin: (onAction: RichTextTrackingActionHandler) => PlatePlugin;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare function getCharacterCount(editor:
|
|
1
|
+
import { PlateEditor } from '../../internal/types';
|
|
2
|
+
export declare function getCharacterCount(editor: PlateEditor): number;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare const createTrailingParagraphPlugin: () =>
|
|
1
|
+
import { PlatePlugin } from '../../internal/types';
|
|
2
|
+
export declare const createTrailingParagraphPlugin: () => PlatePlugin;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare const createVoidsPlugin: () =>
|
|
1
|
+
import { PlatePlugin } from '../../internal/types';
|
|
2
|
+
export declare const createVoidsPlugin: () => PlatePlugin;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { NodeEntry } from '
|
|
2
|
-
import { RichTextEditor } from '../../types';
|
|
1
|
+
import { NodeEntry, PlateEditor } from '../../internal/types';
|
|
3
2
|
/**
|
|
4
3
|
* Re-creates a void node with valid children.
|
|
5
4
|
*/
|
|
6
|
-
export declare const transformVoid: (editor:
|
|
5
|
+
export declare const transformVoid: (editor: PlateEditor, [node, path]: NodeEntry<import("../../internal/types").Node>) => void;
|
package/dist/plugins/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { FieldExtensionSDK } from '@contentful/app-sdk';
|
|
2
2
|
import { PlateProps } from '@udecode/plate-core';
|
|
3
|
-
import {
|
|
3
|
+
import { PlatePlugin } from '../internal/types';
|
|
4
4
|
import { RichTextTrackingActionHandler } from './Tracking';
|
|
5
|
-
export declare const getPlugins: (sdk: FieldExtensionSDK, onAction: RichTextTrackingActionHandler, restrictedMarks?: string[] | undefined) =>
|
|
5
|
+
export declare const getPlugins: (sdk: FieldExtensionSDK, onAction: RichTextTrackingActionHandler, restrictedMarks?: string[] | undefined) => PlatePlugin[];
|
|
6
6
|
export declare const disableCorePlugins: PlateProps['disableCorePlugins'];
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { Document } from '@contentful/rich-text-types';
|
|
2
|
-
import { CreatePlateEditorOptions } from '
|
|
3
|
-
import {
|
|
4
|
-
import { RichTextEditor } from 'types';
|
|
2
|
+
import { CreatePlateEditorOptions } from './internal';
|
|
3
|
+
import { Value, PlateEditor, Node } from './internal/types';
|
|
5
4
|
/**
|
|
6
5
|
* For legacy reasons, a document may not have any content at all
|
|
7
6
|
* e.g:
|
|
@@ -11,10 +10,10 @@ import { RichTextEditor } from 'types';
|
|
|
11
10
|
* Rendering such document will break the Slate editor
|
|
12
11
|
*/
|
|
13
12
|
export declare const hasContent: (doc?: Document | undefined) => boolean;
|
|
14
|
-
export declare const setEditorContent: (editor:
|
|
13
|
+
export declare const setEditorContent: (editor: PlateEditor, nodes?: Node[] | undefined) => void;
|
|
15
14
|
/**
|
|
16
15
|
* Converts a Contentful rich text document to the corresponding slate editor
|
|
17
16
|
* value
|
|
18
17
|
*/
|
|
19
|
-
export declare const documentToEditorValue: (doc
|
|
20
|
-
export declare const normalizeEditorValue: (value:
|
|
18
|
+
export declare const documentToEditorValue: (doc?: Document | undefined) => import("./internal").TextOrCustomElement[];
|
|
19
|
+
export declare const normalizeEditorValue: (value: Value, options?: Omit<CreatePlateEditorOptions, "id" | "editor"> | undefined) => Value;
|
|
@@ -1,13 +1,31 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import { FieldExtensionSDK } from '@contentful/app-sdk';
|
|
3
|
+
import { PlateEditor, PlatePlugin, Value } from '../internal/types';
|
|
2
4
|
import { RichTextTrackingActionHandler } from '../plugins/Tracking';
|
|
3
|
-
import { RichTextEditor, RichTextPlugin } from '../types';
|
|
4
|
-
export declare const normalize: (editor: RichTextEditor) => void;
|
|
5
5
|
export declare const createTestEditor: (options: {
|
|
6
6
|
input?: any;
|
|
7
7
|
sdk?: FieldExtensionSDK;
|
|
8
8
|
trackingHandler?: RichTextTrackingActionHandler;
|
|
9
|
-
plugins?:
|
|
9
|
+
plugins?: PlatePlugin[];
|
|
10
10
|
}) => {
|
|
11
|
-
editor: import("
|
|
11
|
+
editor: PlateEditor & Omit<import("slate").BaseEditor, "children" | "operations" | "marks" | "isInline" | "isVoid" | "normalizeNode" | "apply" | "getFragment" | "insertFragment" | "insertNode"> & {
|
|
12
|
+
children: Value;
|
|
13
|
+
operations: import("@udecode/plate-core").TOperation<import("@udecode/plate-core").TDescendant>[];
|
|
14
|
+
marks: Record<string, any> | null;
|
|
15
|
+
isInline: <N extends import("@udecode/plate-core").TElement>(element: N) => boolean;
|
|
16
|
+
isVoid: <N_1 extends import("@udecode/plate-core").TElement>(element: N_1) => boolean;
|
|
17
|
+
normalizeNode: <N_2 extends import("@udecode/plate-core").TNode>(entry: import("@udecode/plate-core").TNodeEntry<N_2>) => void;
|
|
18
|
+
apply: <N_3 extends import("@udecode/plate-core").TDescendant>(operation: import("@udecode/plate-core").TOperation<N_3>) => void;
|
|
19
|
+
getFragment: <N_4 extends import("@udecode/plate-core").TDescendant>() => N_4[];
|
|
20
|
+
insertFragment: <N_5 extends import("@udecode/plate-core").TDescendant>(fragment: N_5[]) => void;
|
|
21
|
+
insertNode: <N_6 extends import("@udecode/plate-core").TDescendant>(node: N_6 | N_6[]) => void;
|
|
22
|
+
} & import("@udecode/plate-core").UnknownObject & Pick<import("slate-history").HistoryEditor, "history" | "undo" | "redo"> & Pick<import("slate-react").ReactEditor, "insertData" | "insertFragmentData" | "setFragmentData" | "insertTextData" | "hasRange"> & {
|
|
23
|
+
key: any;
|
|
24
|
+
id: string;
|
|
25
|
+
plugins: import("@udecode/plate-core").WithPlatePlugin<{}, Value, import("@udecode/plate-core").PlateEditor<Value>>[];
|
|
26
|
+
pluginsByKey: Record<string, import("@udecode/plate-core").WithPlatePlugin<{}, Value, import("@udecode/plate-core").PlateEditor<Value>>>;
|
|
27
|
+
prevSelection: import("slate").BaseRange | null;
|
|
28
|
+
currentKeyboardEvent: import("react").KeyboardEvent<Element> | null;
|
|
29
|
+
};
|
|
12
30
|
normalize: () => void;
|
|
13
31
|
};
|
package/dist/test-utils/jsx.d.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Add items as needed. Don't forget to adjust hyperscript.d.ts
|
|
5
5
|
*/
|
|
6
|
-
export declare const jsx: <S extends "
|
|
6
|
+
export declare const jsx: <S extends "text" | "anchor" | "editor" | "focus" | "cursor" | "element" | "selection" | "fragment">(tagName: S, attributes?: Object | undefined, ...children: any[]) => ReturnType<({
|
|
7
7
|
anchor: typeof import("slate-hyperscript/dist/creators").createAnchor;
|
|
8
8
|
cursor: typeof import("slate-hyperscript/dist/creators").createCursor;
|
|
9
9
|
editor: (tagName: string, attributes: {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare const mockPlugin: (p: Partial<
|
|
1
|
+
import { PlatePlugin } from '../internal/types';
|
|
2
|
+
export declare const mockPlugin: (p: Partial<PlatePlugin>) => any;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { PlateEditor } from '../internal/types';
|
|
2
2
|
/**
|
|
3
3
|
* Sets empty node.data attributes. Helpful when testing against
|
|
4
4
|
* output generated by a 3rd-party library e.g. Plate.
|
|
5
5
|
*/
|
|
6
|
-
export declare const setEmptyDataAttribute: (root:
|
|
6
|
+
export declare const setEmptyDataAttribute: (root: PlateEditor) => void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentful/field-editor-rich-text",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.4.0",
|
|
4
4
|
"source": "./src/index.tsx",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "dist/field-editor-rich-text.esm.js",
|
|
@@ -35,24 +35,25 @@
|
|
|
35
35
|
"@contentful/rich-text-plain-text-renderer": "^15.12.1",
|
|
36
36
|
"@contentful/rich-text-types": "15.14.1",
|
|
37
37
|
"@popperjs/core": "^2.11.5",
|
|
38
|
-
"@udecode/plate-basic-marks": "
|
|
39
|
-
"@udecode/plate-break": "
|
|
40
|
-
"@udecode/plate-core": "
|
|
41
|
-
"@udecode/plate-list": "
|
|
42
|
-
"@udecode/plate-paragraph": "
|
|
43
|
-
"@udecode/plate-reset-node": "
|
|
44
|
-
"@udecode/plate-select": "
|
|
45
|
-
"@udecode/plate-serializer-docx": "
|
|
46
|
-
"@udecode/plate-
|
|
47
|
-
"@udecode/plate-
|
|
38
|
+
"@udecode/plate-basic-marks": "16.8.0",
|
|
39
|
+
"@udecode/plate-break": "16.8.0",
|
|
40
|
+
"@udecode/plate-core": "16.8.0",
|
|
41
|
+
"@udecode/plate-list": "16.8.0",
|
|
42
|
+
"@udecode/plate-paragraph": "16.8.0",
|
|
43
|
+
"@udecode/plate-reset-node": "16.8.0",
|
|
44
|
+
"@udecode/plate-select": "16.8.0",
|
|
45
|
+
"@udecode/plate-serializer-docx": "16.8.0",
|
|
46
|
+
"@udecode/plate-serializer-html": "16.8.0",
|
|
47
|
+
"@udecode/plate-table": "16.8.0",
|
|
48
|
+
"@udecode/plate-trailing-block": "16.8.0",
|
|
48
49
|
"fast-deep-equal": "^3.1.3",
|
|
49
50
|
"is-hotkey": "^0.2.0",
|
|
50
51
|
"is-plain-obj": "^3.0.0",
|
|
51
52
|
"react-popper": "^2.3.0",
|
|
52
|
-
"slate": "
|
|
53
|
-
"slate-history": "
|
|
54
|
-
"slate-hyperscript": "
|
|
55
|
-
"slate-react": "
|
|
53
|
+
"slate": "0.80.0",
|
|
54
|
+
"slate-history": "0.66.0",
|
|
55
|
+
"slate-hyperscript": "0.67.0",
|
|
56
|
+
"slate-react": "0.80.0"
|
|
56
57
|
},
|
|
57
58
|
"peerDependencies": {
|
|
58
59
|
"react": ">=16.14.0",
|
|
@@ -73,5 +74,5 @@
|
|
|
73
74
|
"@udecode/plate-test-utils": "^3.2.0",
|
|
74
75
|
"react": ">=16.14.0"
|
|
75
76
|
},
|
|
76
|
-
"gitHead": "
|
|
77
|
+
"gitHead": "20d09902b8943916f4e45a712f48284d4373b8e3"
|
|
77
78
|
}
|