@contentful/field-editor-rich-text 2.0.0-next.0 → 2.0.0-next.4
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/dist/RichTextEditor.d.ts +1 -2
- package/dist/Toolbar/{EmbedEntityWidget.d.ts → components/EmbedEntityWidget.d.ts} +0 -1
- package/dist/{plugins/EmbeddedEntity/index.d.ts → Toolbar/components/EmbeddedEntityDropdownButton.d.ts} +1 -2
- package/dist/Toolbar/{StickyToolbarWrapper.d.ts → components/StickyToolbarWrapper.d.ts} +0 -0
- package/dist/Toolbar/index.d.ts +0 -1
- package/dist/dialogs/renderRichTextDialog.d.ts +0 -1
- package/dist/field-editor-rich-text.cjs.development.js +3485 -2892
- 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 +3473 -2880
- package/dist/field-editor-rich-text.esm.js.map +1 -1
- package/dist/helpers/editor.d.ts +18 -11
- package/dist/helpers/environment.d.ts +1 -0
- package/dist/helpers/extractNodes.d.ts +7 -0
- package/dist/helpers/sanitizeSlateDoc.d.ts +1 -14
- package/dist/helpers/transformers.d.ts +8 -0
- package/dist/helpers/validations.d.ts +1 -1
- 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 +0 -1
- package/dist/plugins/EmbeddedEntityBlock/ToolbarIcon.d.ts +0 -1
- package/dist/plugins/EmbeddedEntityBlock/index.d.ts +3 -9
- package/dist/plugins/EmbeddedEntityInline/index.d.ts +2 -5
- 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 -20
- package/dist/plugins/Hr/index.d.ts +4 -5
- package/dist/plugins/Hyperlink/EntryAssetTooltip.d.ts +0 -1
- package/dist/plugins/Hyperlink/HyperlinkModal.d.ts +4 -5
- package/dist/plugins/Hyperlink/index.d.ts +2 -6
- package/dist/plugins/Hyperlink/truncate.d.ts +1 -0
- 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/getListInsertFragment.d.ts +6 -0
- package/dist/plugins/List/index.d.ts +2 -15
- package/dist/plugins/List/utils.d.ts +11 -0
- package/dist/plugins/List/withList.d.ts +3 -0
- package/dist/plugins/{Bold/index.d.ts → Marks/Bold.d.ts} +2 -5
- package/dist/plugins/{Code/index.d.ts → Marks/Code.d.ts} +2 -5
- package/dist/plugins/{Italic/index.d.ts → Marks/Italic.d.ts} +2 -5
- package/dist/plugins/{Underline/index.d.ts → Marks/Underline.d.ts} +2 -5
- 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 -7
- 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 -13
- package/dist/plugins/Quote/toggleQuote.d.ts +2 -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 +3 -3
- package/dist/plugins/Table/actions/addRow.d.ts +3 -3
- package/dist/plugins/Table/actions/setHeader.d.ts +2 -2
- 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 -4
- package/dist/plugins/Table/index.d.ts +2 -186
- package/dist/plugins/Text/index.d.ts +2 -0
- package/dist/plugins/TrailingParagraph/index.d.ts +1 -1
- 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 -0
- package/dist/plugins/shared/EntityStatusIcon.d.ts +0 -1
- package/dist/plugins/shared/FetchingWrappedAssetCard.d.ts +0 -1
- package/dist/plugins/shared/FetchingWrappedEntryCard.d.ts +0 -1
- package/dist/plugins/shared/ToolbarButton.d.ts +2 -6
- package/dist/test-utils/assertOutput.d.ts +7 -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 +26 -9
- package/package.json +27 -23
- package/dist/helpers/deserializer.d.ts +0 -3
- package/dist/helpers/truncate.d.ts +0 -1
- package/dist/plugins/CommandPalette/CommandPanel/InViewport/InViewport.d.ts +0 -37
- package/dist/plugins/InsertBeforeFirstVoidBlock/index.d.ts +0 -2
- package/dist/plugins/NewLine/index.d.ts +0 -2
- package/dist/plugins/Paste/index.d.ts +0 -2
- package/dist/plugins/Paste/sanitizers/helpers.d.ts +0 -7
- package/dist/plugins/Paste/sanitizers/index.d.ts +0 -3
- package/dist/plugins/Paste/sanitizers/removeComments.d.ts +0 -2
- package/dist/plugins/Paste/sanitizers/sanitizeEntityBlocks.d.ts +0 -6
- package/dist/plugins/Paste/sanitizers/sanitizeTables.d.ts +0 -2
- package/dist/plugins/Table/TableActions.d.ts +0 -5
package/dist/helpers/editor.d.ts
CHANGED
|
@@ -1,23 +1,20 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Link } from '@contentful/field-editor-reference/dist/types';
|
|
2
2
|
import { BLOCKS, INLINES } from '@contentful/rich-text-types';
|
|
3
|
+
import { PlateEditor } from '@udecode/plate-core';
|
|
4
|
+
import { Path, Node } from 'slate';
|
|
3
5
|
import { CustomElement } from '../types';
|
|
4
|
-
import { Link } from '@contentful/field-editor-reference/dist/types';
|
|
5
|
-
import { SPEditor } from '@udecode/plate-core';
|
|
6
6
|
export declare const LINK_TYPES: INLINES[];
|
|
7
7
|
export declare function isBlockSelected(editor: any, type: string): boolean;
|
|
8
|
-
export declare function
|
|
8
|
+
export declare function isRootLevel(path: Path): boolean;
|
|
9
9
|
export declare function hasSelectionText(editor: any): boolean;
|
|
10
10
|
declare type NodeEntry = [CustomElement, Path];
|
|
11
11
|
declare type NodeType = BLOCKS | INLINES;
|
|
12
12
|
export declare function getNodeEntryFromSelection(editor: any, nodeTypeOrTypes: NodeType | NodeType[]): NodeEntry | [];
|
|
13
13
|
export declare function isNodeTypeSelected(editor: any, nodeType: BLOCKS | INLINES): boolean;
|
|
14
14
|
export declare function moveToTheNextLine(editor: any): void;
|
|
15
|
-
export declare function
|
|
16
|
-
export declare function toggleBlock(editor: any, type: string): void;
|
|
17
|
-
export declare function getElementFromCurrentSelection(editor: any): (import("slate").BaseEditor | CustomElement<unknown> | import("slate").BaseText | Path)[];
|
|
15
|
+
export declare function getElementFromCurrentSelection(editor: any): (import("slate").BaseEditor | CustomElement<unknown> | import("../types").CustomText | Path)[];
|
|
18
16
|
export declare function isList(editor: any): boolean;
|
|
19
17
|
export declare function getTableSize(table: CustomElement): Record<'numRows' | 'numColumns', number> | null;
|
|
20
|
-
export declare function isFirstChild(path: Path): boolean;
|
|
21
18
|
interface InsertLinkOptions {
|
|
22
19
|
text: string;
|
|
23
20
|
type: INLINES.HYPERLINK | INLINES.ENTRY_HYPERLINK | INLINES.ASSET_HYPERLINK;
|
|
@@ -29,7 +26,17 @@ export declare function insertLink(editor: any, options: InsertLinkOptions): voi
|
|
|
29
26
|
export declare function isLinkActive(editor: any): boolean;
|
|
30
27
|
export declare function unwrapLink(editor: any): void;
|
|
31
28
|
export declare function wrapLink(editor: any, { text, url, target, type, path }: InsertLinkOptions): void;
|
|
32
|
-
export declare function getAncestorPathFromSelection(editor:
|
|
33
|
-
export declare function shouldUnwrapBlockquote(editor:
|
|
34
|
-
export declare function unwrapFromRoot(editor:
|
|
29
|
+
export declare function getAncestorPathFromSelection(editor: PlateEditor): Path | undefined;
|
|
30
|
+
export declare function shouldUnwrapBlockquote(editor: PlateEditor, type: BLOCKS): boolean;
|
|
31
|
+
export declare function unwrapFromRoot(editor: PlateEditor): void;
|
|
32
|
+
export declare const isAtEndOfTextSelection: (editor: PlateEditor) => boolean;
|
|
33
|
+
export declare function currentSelectionStartsTableCell(editor: PlateEditor): boolean;
|
|
34
|
+
/**
|
|
35
|
+
* This traversal strategy is unfortunately necessary because Slate doesn't
|
|
36
|
+
* expose something like Node.next(editor).
|
|
37
|
+
*/
|
|
38
|
+
export declare function getNextNode(editor: PlateEditor): CustomElement | null;
|
|
39
|
+
export declare function currentSelectionPrecedesTableCell(editor: PlateEditor): boolean;
|
|
40
|
+
export declare const INLINE_TYPES: string[];
|
|
41
|
+
export declare const isInlineOrText: (node: Node) => boolean;
|
|
35
42
|
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const HAS_BEFORE_INPUT_SUPPORT: boolean;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { PlateEditor } from '@udecode/plate-core';
|
|
2
|
+
import { Path } from 'slate';
|
|
3
|
+
import { CustomElement } from '../types';
|
|
4
|
+
/**
|
|
5
|
+
* It filters out all paragraphs and headings from a path and convert them into paragraphs.
|
|
6
|
+
*/
|
|
7
|
+
export declare function extractParagraphs(editor: PlateEditor, path: Path): CustomElement[];
|
|
@@ -1,18 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { TextOrCustomElement } from 'types';
|
|
3
|
-
declare type NodeType = BLOCKS | INLINES | Text['nodeType'];
|
|
4
|
-
/**
|
|
5
|
-
* Ensures "orphaned" text node elements (those without a parent capable of
|
|
6
|
-
* validly rendering a text child node) are wrapped with a suitable parent
|
|
7
|
-
* element to prevent failures on the validation layer.
|
|
8
|
-
*
|
|
9
|
-
* It is commonplace for third party plugins (including udecode) to reconcile
|
|
10
|
-
* deletion events by inserting such nodes into their schema. This
|
|
11
|
-
* subprocedure is intended as a guard against such cases.
|
|
12
|
-
*/
|
|
13
|
-
export declare function sanitizeSlateDoc(nodes?: TextOrCustomElement[], parentNodeType?: NodeType): TextOrCustomElement[];
|
|
1
|
+
import { TextOrCustomElement } from '../types';
|
|
14
2
|
/**
|
|
15
3
|
* Ensures incoming void nodes have a child leaf text element.
|
|
16
4
|
*/
|
|
17
5
|
export declare function sanitizeIncomingSlateDoc(nodes?: TextOrCustomElement[]): TextOrCustomElement[];
|
|
18
|
-
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { BLOCKS, INLINES } from '@contentful/rich-text-types';
|
|
2
|
+
import { PlateEditor } from '@udecode/plate-core';
|
|
3
|
+
import { NodeEntry } from 'slate';
|
|
4
|
+
export declare const transformRemove: (editor: PlateEditor, [, path]: NodeEntry<import("slate").Node>) => void;
|
|
5
|
+
export declare const transformParagraphs: (editor: PlateEditor, entry: NodeEntry<import("slate").Node>) => void;
|
|
6
|
+
export declare const transformUnwrap: (editor: PlateEditor, [, path]: NodeEntry<import("slate").Node>) => void;
|
|
7
|
+
export declare const transformWrapIn: (type: BLOCKS | INLINES) => (editor: PlateEditor, [, path]: NodeEntry<import("slate").Node>) => void;
|
|
8
|
+
export declare const transformLift: (editor: PlateEditor, [, path]: NodeEntry<import("slate").Node>) => void;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { BLOCKS, INLINES } from '@contentful/rich-text-types';
|
|
2
1
|
import { FieldExtensionSDK } from '@contentful/app-sdk';
|
|
2
|
+
import { BLOCKS, INLINES } from '@contentful/rich-text-types';
|
|
3
3
|
export declare const VALIDATIONS: {
|
|
4
4
|
ENABLED_MARKS: string;
|
|
5
5
|
ENABLED_NODE_TYPES: string;
|
|
@@ -1,11 +1,5 @@
|
|
|
1
|
-
import { KeyboardEvent } from 'react';
|
|
2
|
-
import { BLOCKS } from '@contentful/rich-text-types';
|
|
3
|
-
import { PlatePlugin, SPEditor } from '@udecode/plate-core';
|
|
4
|
-
import { CustomSlatePluginOptions } from 'types';
|
|
5
1
|
import { FieldExtensionSDK } from '@contentful/app-sdk';
|
|
2
|
+
import { RichTextPlugin } from '../../types';
|
|
6
3
|
export { EmbeddedEntityBlockToolbarIcon as ToolbarIcon } from './ToolbarIcon';
|
|
7
|
-
export declare const createEmbeddedEntryBlockPlugin: (sdk: FieldExtensionSDK) =>
|
|
8
|
-
export declare const createEmbeddedAssetBlockPlugin: (sdk: FieldExtensionSDK) =>
|
|
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: SPEditor) => (event: KeyboardEvent) => void;
|
|
4
|
+
export declare const createEmbeddedEntryBlockPlugin: (sdk: FieldExtensionSDK) => RichTextPlugin;
|
|
5
|
+
export declare const createEmbeddedAssetBlockPlugin: (sdk: FieldExtensionSDK) => RichTextPlugin;
|
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
import { PlatePlugin } from '@udecode/plate-core';
|
|
3
|
-
import { CustomSlatePluginOptions } from '../../types';
|
|
1
|
+
import { RichTextPlugin } from '../../types';
|
|
4
2
|
interface ToolbarEmbeddedEntityInlineButtonProps {
|
|
5
3
|
onClose: () => void;
|
|
6
4
|
isDisabled: boolean;
|
|
7
5
|
isButton?: boolean;
|
|
8
6
|
}
|
|
9
7
|
export declare function ToolbarEmbeddedEntityInlineButton(props: ToolbarEmbeddedEntityInlineButtonProps): JSX.Element;
|
|
10
|
-
export declare function createEmbeddedEntityInlinePlugin(sdk: any):
|
|
11
|
-
export declare const withEmbeddedEntityInlineOptions: CustomSlatePluginOptions;
|
|
8
|
+
export declare function createEmbeddedEntityInlinePlugin(sdk: any): RichTextPlugin;
|
|
12
9
|
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { BLOCKS } from '@contentful/rich-text-types';
|
|
3
|
+
import * as Slate from 'slate-react';
|
|
4
|
+
export declare const HeadingComponents: {
|
|
5
|
+
"heading-1": React.MemoExoticComponent<(props: Slate.RenderElementProps) => JSX.Element>;
|
|
6
|
+
"heading-2": React.MemoExoticComponent<(props: Slate.RenderElementProps) => JSX.Element>;
|
|
7
|
+
"heading-3": React.MemoExoticComponent<(props: Slate.RenderElementProps) => JSX.Element>;
|
|
8
|
+
"heading-4": React.MemoExoticComponent<(props: Slate.RenderElementProps) => JSX.Element>;
|
|
9
|
+
"heading-5": React.MemoExoticComponent<(props: Slate.RenderElementProps) => JSX.Element>;
|
|
10
|
+
"heading-6": React.MemoExoticComponent<(props: Slate.RenderElementProps) => JSX.Element>;
|
|
11
|
+
};
|
|
@@ -1,20 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import { BLOCKS } from '@contentful/rich-text-types';
|
|
4
|
-
import { PlatePlugin, SPEditor } from '@udecode/plate-core';
|
|
5
|
-
import { CustomSlatePluginOptions } from '../../types';
|
|
6
|
-
export declare function withHeadingEvents(editor: SPEditor): (event: React.KeyboardEvent) => void;
|
|
7
|
-
interface ToolbarHeadingButtonProps {
|
|
8
|
-
isDisabled?: boolean;
|
|
9
|
-
}
|
|
10
|
-
export declare function ToolbarHeadingButton(props: ToolbarHeadingButtonProps): JSX.Element | null;
|
|
11
|
-
export declare function createHeading(Tag: any, block: BLOCKS): (props: Slate.RenderElementProps) => JSX.Element;
|
|
12
|
-
export declare const H1: (props: Slate.RenderElementProps) => JSX.Element;
|
|
13
|
-
export declare const H2: (props: Slate.RenderElementProps) => JSX.Element;
|
|
14
|
-
export declare const H3: (props: Slate.RenderElementProps) => JSX.Element;
|
|
15
|
-
export declare const H4: (props: Slate.RenderElementProps) => JSX.Element;
|
|
16
|
-
export declare const H5: (props: Slate.RenderElementProps) => JSX.Element;
|
|
17
|
-
export declare const H6: (props: Slate.RenderElementProps) => JSX.Element;
|
|
18
|
-
export declare function createHeadingPlugin(): PlatePlugin;
|
|
19
|
-
export declare const withHeadingOptions: CustomSlatePluginOptions;
|
|
20
|
-
export {};
|
|
1
|
+
export * from './components/ToolbarHeadingButton';
|
|
2
|
+
export * from './createHeadingPlugin';
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import { PlateEditor } from '@udecode/plate-core';
|
|
2
3
|
import * as Slate from 'slate-react';
|
|
3
|
-
import {
|
|
4
|
-
import { CustomSlatePluginOptions } from '../../types';
|
|
4
|
+
import { RichTextPlugin } from '../../types';
|
|
5
5
|
interface ToolbarHrButtonProps {
|
|
6
6
|
isDisabled?: boolean;
|
|
7
7
|
}
|
|
8
|
-
export declare function withHrEvents(editor:
|
|
8
|
+
export declare function withHrEvents(editor: PlateEditor): (event: React.KeyboardEvent) => void;
|
|
9
9
|
export declare function ToolbarHrButton(props: ToolbarHrButtonProps): JSX.Element | null;
|
|
10
10
|
export declare function Hr(props: Slate.RenderLeafProps): JSX.Element;
|
|
11
|
-
export declare
|
|
12
|
-
export declare const withHrOptions: CustomSlatePluginOptions;
|
|
11
|
+
export declare const createHrPlugin: () => RichTextPlugin;
|
|
13
12
|
export {};
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
import { Link } from '@contentful/field-editor-reference/dist/types';
|
|
2
2
|
import { FieldExtensionSDK } from '@contentful/field-editor-shared';
|
|
3
|
-
import {
|
|
4
|
-
import { ReactEditor } from 'slate-react';
|
|
3
|
+
import { PlateEditor } from '@udecode/plate-core';
|
|
5
4
|
import { HistoryEditor } from 'slate-history';
|
|
6
|
-
import {
|
|
5
|
+
import { ReactEditor } from 'slate-react';
|
|
7
6
|
interface HyperlinkModalProps {
|
|
8
7
|
linkText?: string;
|
|
9
8
|
linkType?: string;
|
|
@@ -13,5 +12,5 @@ interface HyperlinkModalProps {
|
|
|
13
12
|
sdk: FieldExtensionSDK;
|
|
14
13
|
}
|
|
15
14
|
export declare function HyperlinkModal(props: HyperlinkModalProps): JSX.Element;
|
|
16
|
-
export declare function addOrEditLink(editor: ReactEditor & HistoryEditor &
|
|
15
|
+
export declare function addOrEditLink(editor: ReactEditor & HistoryEditor & PlateEditor, sdk: FieldExtensionSDK): Promise<void>;
|
|
17
16
|
export {};
|
|
@@ -1,12 +1,8 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { PlatePlugin } from '@udecode/plate-core';
|
|
3
1
|
import { FieldExtensionSDK } from '@contentful/app-sdk';
|
|
4
|
-
import {
|
|
5
|
-
export declare function createHyperlinkPlugin(sdk: FieldExtensionSDK): PlatePlugin;
|
|
6
|
-
export declare function buildHyperlinkEventHandler(sdk: any): (editor: any) => (event: React.KeyboardEvent) => void;
|
|
2
|
+
import { RichTextPlugin } from '../../types';
|
|
7
3
|
interface ToolbarHyperlinkButtonProps {
|
|
8
4
|
isDisabled: boolean | undefined;
|
|
9
5
|
}
|
|
10
6
|
export declare function ToolbarHyperlinkButton(props: ToolbarHyperlinkButtonProps): JSX.Element | null;
|
|
11
|
-
export declare const
|
|
7
|
+
export declare const createHyperlinkPlugin: (sdk: FieldExtensionSDK) => RichTextPlugin;
|
|
12
8
|
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function truncate(str: string, length: number): string;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A copy of Plate's list plugin with a few adjustments
|
|
3
|
+
* to support pasting any element
|
|
4
|
+
*/
|
|
5
|
+
import { PlateEditor, TDescendant } from '@udecode/plate-core';
|
|
6
|
+
export declare const getListInsertFragment: (editor: PlateEditor) => (fragment: TDescendant[]) => void;
|
|
@@ -1,15 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import { BLOCKS } from '@contentful/rich-text-types';
|
|
4
|
-
import { CustomSlatePluginOptions } from '../../types';
|
|
5
|
-
interface ToolbarListButtonProps {
|
|
6
|
-
isDisabled?: boolean;
|
|
7
|
-
}
|
|
8
|
-
export declare function ToolbarListButton(props: ToolbarListButtonProps): JSX.Element | null;
|
|
9
|
-
export declare function createList(Tag: any, block: BLOCKS): (props: Slate.RenderElementProps) => JSX.Element;
|
|
10
|
-
export declare const UL: (props: Slate.RenderElementProps) => JSX.Element;
|
|
11
|
-
export declare const OL: (props: Slate.RenderElementProps) => JSX.Element;
|
|
12
|
-
export declare const LI: (props: Slate.RenderElementProps) => JSX.Element;
|
|
13
|
-
export declare const withListOptions: CustomSlatePluginOptions;
|
|
14
|
-
export declare const createListPlugin: () => import("@udecode/plate-core").PlatePlugin<import("@udecode/plate-core").SPEditor>;
|
|
15
|
-
export {};
|
|
1
|
+
export * from './createListPlugin';
|
|
2
|
+
export * from './components/ToolbarListButton';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { PlateEditor } from '@udecode/plate-core';
|
|
2
|
+
import { NodeEntry, Node } from 'slate';
|
|
3
|
+
export declare const hasListAsDirectParent: (editor: PlateEditor, [, path]: NodeEntry<Node>) => boolean;
|
|
4
|
+
/**
|
|
5
|
+
* Places orphaned list items in a list. If there's a list somewhere
|
|
6
|
+
* in the node's ancestors, defaults to that list type, else places
|
|
7
|
+
* the list item in an unordered list.
|
|
8
|
+
*/
|
|
9
|
+
export declare const normalizeOrphanedListItem: (editor: PlateEditor, [, path]: NodeEntry<Node>) => void;
|
|
10
|
+
export declare const isNonEmptyListItem: (editor: PlateEditor, [, path]: NodeEntry<Node>) => boolean;
|
|
11
|
+
export declare const insertParagraphAsChild: (editor: PlateEditor, [, path]: NodeEntry<Node>) => void;
|
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import * as Slate from 'slate-react';
|
|
3
|
-
import {
|
|
4
|
-
import { CustomSlatePluginOptions } from 'types';
|
|
2
|
+
import { RichTextPlugin } from '../../types';
|
|
5
3
|
interface ToolbarBoldButtonProps {
|
|
6
4
|
isDisabled?: boolean;
|
|
7
5
|
}
|
|
8
6
|
export declare function ToolbarBoldButton(props: ToolbarBoldButtonProps): JSX.Element | null;
|
|
9
7
|
export declare function Bold(props: Slate.RenderLeafProps): JSX.Element;
|
|
10
|
-
export declare
|
|
11
|
-
export declare const withBoldOptions: CustomSlatePluginOptions;
|
|
8
|
+
export declare const createBoldPlugin: () => RichTextPlugin;
|
|
12
9
|
export {};
|
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import * as Slate from 'slate-react';
|
|
3
|
-
import {
|
|
4
|
-
import { CustomSlatePluginOptions } from 'types';
|
|
2
|
+
import { RichTextPlugin } from '../../types';
|
|
5
3
|
interface ToolbarCodeButtonProps {
|
|
6
4
|
isDisabled?: boolean;
|
|
7
5
|
}
|
|
8
6
|
export declare function ToolbarCodeButton(props: ToolbarCodeButtonProps): JSX.Element | null;
|
|
9
7
|
export declare function Code(props: Slate.RenderLeafProps): JSX.Element;
|
|
10
|
-
export declare
|
|
11
|
-
export declare const withCodeOptions: CustomSlatePluginOptions;
|
|
8
|
+
export declare const createCodePlugin: () => RichTextPlugin;
|
|
12
9
|
export {};
|
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import * as Slate from 'slate-react';
|
|
3
|
-
import {
|
|
4
|
-
import { CustomSlatePluginOptions } from '../../types';
|
|
2
|
+
import { RichTextPlugin } from '../../types';
|
|
5
3
|
interface ToolbarItalicButtonProps {
|
|
6
4
|
isDisabled?: boolean;
|
|
7
5
|
}
|
|
8
6
|
export declare function ToolbarItalicButton(props: ToolbarItalicButtonProps): JSX.Element | null;
|
|
9
7
|
export declare function Italic(props: Slate.RenderLeafProps): JSX.Element;
|
|
10
|
-
export declare
|
|
11
|
-
export declare const withItalicOptions: CustomSlatePluginOptions;
|
|
8
|
+
export declare const createItalicPlugin: () => RichTextPlugin;
|
|
12
9
|
export {};
|
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import * as Slate from 'slate-react';
|
|
3
|
-
import {
|
|
4
|
-
import { CustomSlatePluginOptions } from 'types';
|
|
2
|
+
import { RichTextPlugin } from '../../types';
|
|
5
3
|
interface ToolbarUnderlineButtonProps {
|
|
6
4
|
isDisabled?: boolean;
|
|
7
5
|
}
|
|
8
6
|
export declare function ToolbarUnderlineButton(props: ToolbarUnderlineButtonProps): JSX.Element | null;
|
|
9
7
|
export declare function Underline(props: Slate.RenderLeafProps): JSX.Element;
|
|
10
|
-
export declare
|
|
11
|
-
export declare const withUnderlineOptions: CustomSlatePluginOptions;
|
|
8
|
+
export declare const createUnderlinePlugin: () => RichTextPlugin;
|
|
12
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;
|
|
@@ -1,7 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { RenderElementProps } from 'slate-react';
|
|
3
|
-
import { PlatePlugin } from '@udecode/plate-core';
|
|
4
|
-
import { CustomSlatePluginOptions } from '../../types';
|
|
5
|
-
export declare function Paragraph(props: RenderElementProps): JSX.Element;
|
|
6
|
-
export declare function createParagraphPlugin(): PlatePlugin;
|
|
7
|
-
export declare const withParagraphOptions: CustomSlatePluginOptions;
|
|
1
|
+
export * from './createParagraphPlugin';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './createPasteHTMLPlugin';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const sanitizeHTML: (html: string) => string;
|
|
@@ -1,13 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import { PlatePlugin, SPEditor } from '@udecode/plate-core';
|
|
4
|
-
import { CustomSlatePluginOptions } from 'types';
|
|
5
|
-
interface ToolbarQuoteButtonProps {
|
|
6
|
-
isDisabled?: boolean;
|
|
7
|
-
}
|
|
8
|
-
export declare function withQuoteEvents(editor: SPEditor): (event: React.KeyboardEvent) => void;
|
|
9
|
-
export declare function ToolbarQuoteButton(props: ToolbarQuoteButtonProps): JSX.Element | null;
|
|
10
|
-
export declare function Quote(props: Slate.RenderLeafProps): JSX.Element;
|
|
11
|
-
export declare function createQuotePlugin(): PlatePlugin;
|
|
12
|
-
export declare const withQuoteOptions: CustomSlatePluginOptions;
|
|
13
|
-
export {};
|
|
1
|
+
export * from './createQuotePlugin';
|
|
2
|
+
export * from './components/ToolbarQuoteButton';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './createSelectOnBackspacePlugin';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { PlateEditor } from '@udecode/plate-core';
|
|
2
2
|
import { TablePluginOptions } from '@udecode/plate-table';
|
|
3
|
-
export declare const addColumnRight: (editor:
|
|
4
|
-
export declare const addColumnLeft: (editor:
|
|
3
|
+
export declare const addColumnRight: (editor: PlateEditor, options: TablePluginOptions) => void;
|
|
4
|
+
export declare const addColumnLeft: (editor: PlateEditor, options: TablePluginOptions) => void;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare const addRowBelow: (editor:
|
|
3
|
-
export declare const addRowAbove: (editor:
|
|
1
|
+
import { PlateEditor } from '@udecode/plate-core';
|
|
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 '@udecode/plate-core';
|
|
2
|
+
export declare const setHeader: (editor: PlateEditor, enable?: boolean | undefined) => void;
|