@contentful/field-editor-rich-text 2.0.0-next.1 → 2.0.0-next.13
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 +410 -0
- 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/TrackingProvider.d.ts +1 -1
- package/dist/dialogs/renderRichTextDialog.d.ts +0 -1
- package/dist/field-editor-rich-text.cjs.development.js +4037 -3402
- 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 +4162 -3527
- package/dist/field-editor-rich-text.esm.js.map +1 -1
- package/dist/helpers/editor.d.ts +14 -15
- package/dist/helpers/environment.d.ts +1 -0
- package/dist/helpers/extractNodes.d.ts +7 -0
- 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 -2
- package/dist/plugins/EmbeddedEntityBlock/LinkedEntityBlock.d.ts +3 -2
- package/dist/plugins/EmbeddedEntityBlock/ToolbarIcon.d.ts +0 -1
- package/dist/plugins/EmbeddedEntityBlock/index.d.ts +4 -9
- package/dist/plugins/EmbeddedEntityInline/FetchingWrappedInlineEntryCard.d.ts +1 -0
- package/dist/plugins/EmbeddedEntityInline/index.d.ts +4 -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 +3 -4
- package/dist/plugins/Hyperlink/EntryAssetTooltip.d.ts +0 -1
- package/dist/plugins/Hyperlink/HyperlinkModal.d.ts +2 -3
- package/dist/plugins/Hyperlink/index.d.ts +3 -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/index.d.ts +2 -15
- 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/{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 +3 -0
- package/dist/plugins/SelectOnBackspace/createSelectOnBackspacePlugin.d.ts +2 -0
- package/dist/plugins/SelectOnBackspace/index.d.ts +1 -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 +11 -0
- package/dist/plugins/Table/index.d.ts +2 -189
- 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 -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/links-tracking.d.ts +7 -0
- package/dist/plugins/shared/EntityStatusIcon.d.ts +0 -1
- package/dist/plugins/shared/FetchingWrappedAssetCard.d.ts +1 -1
- package/dist/plugins/shared/FetchingWrappedEntryCard.d.ts +3 -3
- package/dist/plugins/shared/ToolbarButton.d.ts +0 -1
- 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 +26 -9
- package/dist/useNormalizedSlateValue.d.ts +7 -0
- package/package.json +27 -24
- package/dist/helpers/deserializer.d.ts +0 -3
- package/dist/helpers/sanitizeSlateDoc.d.ts +0 -18
- 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/List/getListInsertFragment.d.ts +0 -6
- 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,19 @@
|
|
|
1
|
-
import { Path } from 'slate';
|
|
2
|
-
import { BLOCKS, INLINES } from '@contentful/rich-text-types';
|
|
3
|
-
import { CustomElement } from '../types';
|
|
4
1
|
import { Link } from '@contentful/field-editor-reference/dist/types';
|
|
2
|
+
import { BLOCKS, INLINES } from '@contentful/rich-text-types';
|
|
5
3
|
import { PlateEditor } from '@udecode/plate-core';
|
|
4
|
+
import { Path, Node } from 'slate';
|
|
5
|
+
import { CustomElement } from '../types';
|
|
6
6
|
export declare const LINK_TYPES: INLINES[];
|
|
7
|
-
export declare function isBlockSelected(editor:
|
|
8
|
-
export declare function
|
|
9
|
-
export declare function hasSelectionText(editor: any): boolean;
|
|
7
|
+
export declare function isBlockSelected(editor: PlateEditor, type: string): boolean;
|
|
8
|
+
export declare function isRootLevel(path: Path): boolean;
|
|
10
9
|
declare type NodeEntry = [CustomElement, Path];
|
|
11
10
|
declare type NodeType = BLOCKS | INLINES;
|
|
12
|
-
export declare function getNodeEntryFromSelection(editor:
|
|
13
|
-
export declare function isNodeTypeSelected(editor:
|
|
14
|
-
export declare function moveToTheNextLine(editor:
|
|
15
|
-
export declare function
|
|
16
|
-
export declare function
|
|
17
|
-
export declare function getElementFromCurrentSelection(editor: any): (import("slate").BaseEditor | CustomElement<unknown> | import("slate").BaseText | Path)[];
|
|
18
|
-
export declare function isList(editor: any): boolean;
|
|
11
|
+
export declare function getNodeEntryFromSelection(editor: PlateEditor, nodeTypeOrTypes: NodeType | NodeType[]): NodeEntry | [];
|
|
12
|
+
export declare function isNodeTypeSelected(editor: PlateEditor, nodeType: BLOCKS | INLINES): boolean;
|
|
13
|
+
export declare function moveToTheNextLine(editor: PlateEditor): void;
|
|
14
|
+
export declare function getElementFromCurrentSelection(editor: PlateEditor): (import("slate").BaseEditor | CustomElement<unknown> | import("../types").CustomText | Path)[];
|
|
15
|
+
export declare function isList(editor?: PlateEditor): boolean;
|
|
19
16
|
export declare function getTableSize(table: CustomElement): Record<'numRows' | 'numColumns', number> | null;
|
|
20
|
-
export declare function isFirstChild(path: Path): boolean;
|
|
21
17
|
interface InsertLinkOptions {
|
|
22
18
|
text: string;
|
|
23
19
|
type: INLINES.HYPERLINK | INLINES.ENTRY_HYPERLINK | INLINES.ASSET_HYPERLINK;
|
|
@@ -26,7 +22,7 @@ interface InsertLinkOptions {
|
|
|
26
22
|
path?: Path;
|
|
27
23
|
}
|
|
28
24
|
export declare function insertLink(editor: any, options: InsertLinkOptions): void;
|
|
29
|
-
export declare function isLinkActive(editor
|
|
25
|
+
export declare function isLinkActive(editor?: PlateEditor): boolean;
|
|
30
26
|
export declare function unwrapLink(editor: any): void;
|
|
31
27
|
export declare function wrapLink(editor: any, { text, url, target, type, path }: InsertLinkOptions): void;
|
|
32
28
|
export declare function getAncestorPathFromSelection(editor: PlateEditor): Path | undefined;
|
|
@@ -40,4 +36,7 @@ export declare function currentSelectionStartsTableCell(editor: PlateEditor): bo
|
|
|
40
36
|
*/
|
|
41
37
|
export declare function getNextNode(editor: PlateEditor): CustomElement | null;
|
|
42
38
|
export declare function currentSelectionPrecedesTableCell(editor: PlateEditor): boolean;
|
|
39
|
+
export declare const INLINE_TYPES: string[];
|
|
40
|
+
export declare const isInlineOrText: (node: Node) => boolean;
|
|
41
|
+
export declare const focus: (editor: PlateEditor) => void;
|
|
43
42
|
export {};
|
|
@@ -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[];
|
|
@@ -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,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare function createDragAndDropPlugin():
|
|
1
|
+
import { RichTextPlugin } from '../../types';
|
|
2
|
+
export declare function createDragAndDropPlugin(): RichTextPlugin;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { CustomRenderElementProps } from '../../types';
|
|
3
2
|
declare type LinkedEntityBlockProps = CustomRenderElementProps<{
|
|
4
3
|
target: {
|
|
@@ -8,6 +7,8 @@ declare type LinkedEntityBlockProps = CustomRenderElementProps<{
|
|
|
8
7
|
type: 'Link';
|
|
9
8
|
};
|
|
10
9
|
};
|
|
11
|
-
}
|
|
10
|
+
}> & {
|
|
11
|
+
onEntityFetchComplete: VoidFunction;
|
|
12
|
+
};
|
|
12
13
|
export declare function LinkedEntityBlock(props: LinkedEntityBlockProps): JSX.Element;
|
|
13
14
|
export {};
|
|
@@ -1,11 +1,6 @@
|
|
|
1
|
-
import { KeyboardEvent } from 'react';
|
|
2
|
-
import { BLOCKS } from '@contentful/rich-text-types';
|
|
3
|
-
import { PlatePlugin, PlateEditor } from '@udecode/plate-core';
|
|
4
|
-
import { CustomSlatePluginOptions } from 'types';
|
|
5
1
|
import { FieldExtensionSDK } from '@contentful/app-sdk';
|
|
2
|
+
import { TrackingProvider } from 'TrackingProvider';
|
|
3
|
+
import { RichTextPlugin } from '../../types';
|
|
6
4
|
export { EmbeddedEntityBlockToolbarIcon as ToolbarIcon } from './ToolbarIcon';
|
|
7
|
-
export declare const createEmbeddedEntryBlockPlugin: (sdk: FieldExtensionSDK) =>
|
|
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: PlateEditor) => (event: KeyboardEvent) => void;
|
|
5
|
+
export declare const createEmbeddedEntryBlockPlugin: (sdk: FieldExtensionSDK, tracking: TrackingProvider) => RichTextPlugin;
|
|
6
|
+
export declare const createEmbeddedAssetBlockPlugin: (sdk: FieldExtensionSDK, tracking: TrackingProvider) => RichTextPlugin;
|
|
@@ -7,6 +7,7 @@ interface FetchingWrappedInlineEntryCardProps {
|
|
|
7
7
|
isDisabled: boolean;
|
|
8
8
|
onEdit: (event: React.MouseEvent<Element, MouseEvent>) => void;
|
|
9
9
|
onRemove: (event: React.MouseEvent<Element, MouseEvent>) => void;
|
|
10
|
+
onEntityFetchComplete?: VoidFunction;
|
|
10
11
|
}
|
|
11
12
|
export declare function FetchingWrappedInlineEntryCard(props: FetchingWrappedInlineEntryCardProps): JSX.Element;
|
|
12
13
|
export {};
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { FieldExtensionSDK } from '@contentful/app-sdk';
|
|
2
|
+
import { TrackingProvider } from 'TrackingProvider';
|
|
3
|
+
import { RichTextPlugin } from '../../types';
|
|
4
4
|
interface ToolbarEmbeddedEntityInlineButtonProps {
|
|
5
5
|
onClose: () => void;
|
|
6
6
|
isDisabled: boolean;
|
|
7
7
|
isButton?: boolean;
|
|
8
8
|
}
|
|
9
9
|
export declare function ToolbarEmbeddedEntityInlineButton(props: ToolbarEmbeddedEntityInlineButtonProps): JSX.Element;
|
|
10
|
-
export declare function createEmbeddedEntityInlinePlugin(sdk:
|
|
11
|
-
export declare const withEmbeddedEntityInlineOptions: CustomSlatePluginOptions;
|
|
10
|
+
export declare function createEmbeddedEntityInlinePlugin(sdk: FieldExtensionSDK, tracking: TrackingProvider): RichTextPlugin;
|
|
12
11
|
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { BLOCKS } from '@contentful/rich-text-types';
|
|
3
|
+
import * as Slate from 'slate-react';
|
|
4
|
+
export declare const HeadingComponents: {
|
|
5
|
+
"heading-1": React.MemoExoticComponent<(props: Slate.RenderElementProps) => JSX.Element>;
|
|
6
|
+
"heading-2": React.MemoExoticComponent<(props: Slate.RenderElementProps) => JSX.Element>;
|
|
7
|
+
"heading-3": React.MemoExoticComponent<(props: Slate.RenderElementProps) => JSX.Element>;
|
|
8
|
+
"heading-4": React.MemoExoticComponent<(props: Slate.RenderElementProps) => JSX.Element>;
|
|
9
|
+
"heading-5": React.MemoExoticComponent<(props: Slate.RenderElementProps) => JSX.Element>;
|
|
10
|
+
"heading-6": React.MemoExoticComponent<(props: Slate.RenderElementProps) => JSX.Element>;
|
|
11
|
+
};
|
|
@@ -1,20 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import { BLOCKS } from '@contentful/rich-text-types';
|
|
4
|
-
import { PlatePlugin, PlateEditor } from '@udecode/plate-core';
|
|
5
|
-
import { CustomSlatePluginOptions } from '../../types';
|
|
6
|
-
export declare function withHeadingEvents(editor: PlateEditor): (event: React.KeyboardEvent) => void;
|
|
7
|
-
interface ToolbarHeadingButtonProps {
|
|
8
|
-
isDisabled?: boolean;
|
|
9
|
-
}
|
|
10
|
-
export declare function ToolbarHeadingButton(props: ToolbarHeadingButtonProps): JSX.Element | null;
|
|
11
|
-
export declare function createHeading(Tag: any, block: BLOCKS): (props: Slate.RenderElementProps) => JSX.Element;
|
|
12
|
-
export declare const H1: (props: Slate.RenderElementProps) => JSX.Element;
|
|
13
|
-
export declare const H2: (props: Slate.RenderElementProps) => JSX.Element;
|
|
14
|
-
export declare const H3: (props: Slate.RenderElementProps) => JSX.Element;
|
|
15
|
-
export declare const H4: (props: Slate.RenderElementProps) => JSX.Element;
|
|
16
|
-
export declare const H5: (props: Slate.RenderElementProps) => JSX.Element;
|
|
17
|
-
export declare const H6: (props: Slate.RenderElementProps) => JSX.Element;
|
|
18
|
-
export declare function createHeadingPlugin(): PlatePlugin;
|
|
19
|
-
export declare const withHeadingOptions: CustomSlatePluginOptions;
|
|
20
|
-
export {};
|
|
1
|
+
export * from './components/ToolbarHeadingButton';
|
|
2
|
+
export * from './createHeadingPlugin';
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import { PlateEditor } from '@udecode/plate-core';
|
|
2
3
|
import * as Slate from 'slate-react';
|
|
3
|
-
import {
|
|
4
|
-
import { CustomSlatePluginOptions } from '../../types';
|
|
4
|
+
import { RichTextPlugin } from '../../types';
|
|
5
5
|
interface ToolbarHrButtonProps {
|
|
6
6
|
isDisabled?: boolean;
|
|
7
7
|
}
|
|
8
8
|
export declare function withHrEvents(editor: PlateEditor): (event: React.KeyboardEvent) => void;
|
|
9
9
|
export declare function ToolbarHrButton(props: ToolbarHrButtonProps): JSX.Element | null;
|
|
10
10
|
export declare function Hr(props: Slate.RenderLeafProps): JSX.Element;
|
|
11
|
-
export declare
|
|
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
3
|
import { PlateEditor } from '@udecode/plate-core';
|
|
4
|
-
import { ReactEditor } from 'slate-react';
|
|
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;
|
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { PlatePlugin } from '@udecode/plate-core';
|
|
3
1
|
import { FieldExtensionSDK } from '@contentful/app-sdk';
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
export declare function buildHyperlinkEventHandler(sdk: any): (editor: any) => (event: React.KeyboardEvent) => void;
|
|
2
|
+
import { TrackingProvider } from 'TrackingProvider';
|
|
3
|
+
import { RichTextPlugin } from '../../types';
|
|
7
4
|
interface ToolbarHyperlinkButtonProps {
|
|
8
5
|
isDisabled: boolean | undefined;
|
|
9
6
|
}
|
|
10
7
|
export declare function ToolbarHyperlinkButton(props: ToolbarHyperlinkButtonProps): JSX.Element | null;
|
|
11
|
-
export declare const
|
|
8
|
+
export declare const createHyperlinkPlugin: (sdk: FieldExtensionSDK, tracking: TrackingProvider) => RichTextPlugin;
|
|
12
9
|
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function truncate(str: string, length: number): string;
|
|
@@ -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<{}>;
|
|
15
|
-
export {};
|
|
1
|
+
export * from './createListPlugin';
|
|
2
|
+
export * from './components/ToolbarListButton';
|
|
@@ -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;
|
|
@@ -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, PlateEditor } from '@udecode/plate-core';
|
|
4
|
-
import { CustomSlatePluginOptions } from 'types';
|
|
5
|
-
interface ToolbarQuoteButtonProps {
|
|
6
|
-
isDisabled?: boolean;
|
|
7
|
-
}
|
|
8
|
-
export declare function withQuoteEvents(editor: PlateEditor): (event: React.KeyboardEvent) => void;
|
|
9
|
-
export declare function ToolbarQuoteButton(props: ToolbarQuoteButtonProps): JSX.Element | null;
|
|
10
|
-
export declare function Quote(props: Slate.RenderLeafProps): JSX.Element;
|
|
11
|
-
export declare function createQuotePlugin(): PlatePlugin;
|
|
12
|
-
export declare const withQuoteOptions: CustomSlatePluginOptions;
|
|
13
|
-
export {};
|
|
1
|
+
export * from './createQuotePlugin';
|
|
2
|
+
export * from './components/ToolbarQuoteButton';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './createSelectOnBackspacePlugin';
|