@contentful/field-editor-rich-text 1.0.0-alpha.3 → 2.0.0-next.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 +410 -0
- package/README.md +9 -20
- package/dist/ContentfulEditorProvider.d.ts +8 -0
- package/dist/RichTextEditor.d.ts +19 -70
- package/dist/RichTextEditor.styles.d.ts +7 -0
- package/dist/SdkProvider.d.ts +7 -0
- package/dist/Toolbar/EmbedEntityWidget.d.ts +6 -0
- package/dist/Toolbar/StickyToolbarWrapper.d.ts +6 -11
- package/dist/Toolbar/index.d.ts +6 -28
- package/dist/TrackingProvider.d.ts +11 -0
- package/dist/constants/Schema.d.ts +93 -11
- package/dist/dialogs/HypelinkDialog/HyperlinkDialog.d.ts +54 -0
- package/dist/dialogs/openRichTextDialog.d.ts +2 -0
- package/dist/dialogs/renderRichTextDialog.d.ts +3 -0
- package/dist/field-editor-rich-text.cjs.development.js +4690 -4354
- 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 +4674 -4338
- package/dist/field-editor-rich-text.esm.js.map +1 -1
- package/dist/helpers/deserializer.d.ts +3 -0
- package/dist/helpers/editor.d.ts +35 -0
- package/dist/helpers/formatDateAndTime.d.ts +15 -0
- package/dist/helpers/getLinkedContentTypeIdsForNodeType.d.ts +26 -2
- package/dist/helpers/newEntitySelectorConfigFromRichTextField.d.ts +5 -1
- package/dist/helpers/sanitizeSlateDoc.d.ts +18 -0
- package/dist/helpers/truncate.d.ts +1 -0
- package/dist/helpers/validations.d.ts +10 -0
- package/dist/index.d.ts +2 -2
- package/dist/plugins/Bold/index.d.ts +12 -64
- package/dist/plugins/Code/index.d.ts +12 -64
- package/dist/plugins/CommandPalette/CommandPanel/InViewport/InViewport.d.ts +37 -0
- package/dist/plugins/EmbeddedEntity/index.d.ts +10 -0
- package/dist/plugins/EmbeddedEntityBlock/LinkedEntityBlock.d.ts +13 -0
- package/dist/plugins/EmbeddedEntityBlock/ToolbarIcon.d.ts +12 -10
- package/dist/plugins/EmbeddedEntityBlock/Util.d.ts +2 -23
- package/dist/plugins/EmbeddedEntityBlock/index.d.ts +11 -27
- package/dist/plugins/EmbeddedEntityInline/FetchingWrappedInlineEntryCard.d.ts +12 -0
- package/dist/plugins/EmbeddedEntityInline/Util.d.ts +16 -0
- package/dist/plugins/EmbeddedEntityInline/index.d.ts +12 -0
- package/dist/plugins/Heading/index.d.ts +20 -50
- package/dist/plugins/Hr/index.d.ts +13 -61
- package/dist/plugins/Hyperlink/EntryAssetTooltip.d.ts +10 -0
- package/dist/plugins/Hyperlink/HyperlinkModal.d.ts +17 -0
- package/dist/plugins/Hyperlink/index.d.ts +12 -9
- package/dist/plugins/InsertBeforeFirstVoidBlock/index.d.ts +2 -3
- package/dist/plugins/Italic/index.d.ts +12 -64
- package/dist/plugins/List/index.d.ts +15 -114
- package/dist/plugins/NewLine/index.d.ts +2 -0
- package/dist/plugins/Paragraph/index.d.ts +7 -5
- package/dist/plugins/Paste/index.d.ts +2 -7
- package/dist/plugins/Paste/sanitizers/helpers.d.ts +7 -0
- package/dist/plugins/Paste/sanitizers/index.d.ts +3 -0
- package/dist/plugins/Paste/sanitizers/removeComments.d.ts +2 -0
- package/dist/plugins/Paste/sanitizers/sanitizeEntityBlocks.d.ts +6 -0
- package/dist/plugins/Paste/sanitizers/sanitizeTables.d.ts +2 -0
- package/dist/plugins/Quote/index.d.ts +13 -59
- package/dist/plugins/Table/TableActions.d.ts +5 -0
- package/dist/plugins/Table/actions/addColumn.d.ts +4 -0
- package/dist/plugins/Table/actions/addRow.d.ts +3 -0
- package/dist/plugins/Table/actions/index.d.ts +3 -0
- package/dist/plugins/Table/actions/setHeader.d.ts +2 -0
- package/dist/plugins/Table/helpers.d.ts +4 -0
- package/dist/plugins/Table/index.d.ts +186 -0
- package/dist/plugins/TrailingParagraph/index.d.ts +1 -0
- package/dist/plugins/Underline/index.d.ts +12 -0
- package/dist/plugins/shared/EntityStatusIcon.d.ts +8 -0
- package/dist/plugins/shared/FetchingWrappedAssetCard.d.ts +23 -0
- package/dist/plugins/shared/FetchingWrappedEntryCard.d.ts +13 -0
- package/dist/plugins/shared/ToolbarButton.d.ts +15 -0
- package/dist/types.d.ts +25 -0
- package/package.json +44 -31
- package/LICENSE +0 -21
- package/dist/RichTextEditor.spec.d.ts +0 -1
- package/dist/Toolbar/Toolbar.spec.d.ts +0 -1
- package/dist/helpers/browserSupport.d.ts +0 -1
- package/dist/plugins/CommandPalette/CommandMark.d.ts +0 -13
- package/dist/plugins/CommandPalette/CommandPalette.d.ts +0 -14
- package/dist/plugins/CommandPalette/CommandPaletteService.d.ts +0 -12
- package/dist/plugins/CommandPalette/CommandPanel/CommandPanelMenu.d.ts +0 -48
- package/dist/plugins/CommandPalette/CommandPanel/index.d.ts +0 -51
- package/dist/plugins/CommandPalette/Util.d.ts +0 -5
- package/dist/plugins/CommandPalette/index.d.ts +0 -7
- package/dist/plugins/EmbeddedEntityBlock/EmbeddedEntityBlock.d.ts +0 -29
- package/dist/plugins/EmbeddedEntryInline/EmbeddedEntryInline.d.ts +0 -29
- package/dist/plugins/EmbeddedEntryInline/ToolbarIcon.d.ts +0 -11
- package/dist/plugins/EmbeddedEntryInline/Utils.d.ts +0 -4
- package/dist/plugins/EmbeddedEntryInline/index.d.ts +0 -13
- package/dist/plugins/EntryEmbedDropdown/index.d.ts +0 -15
- package/dist/plugins/Heading/Heading1.d.ts +0 -2
- package/dist/plugins/Heading/Heading2.d.ts +0 -2
- package/dist/plugins/Heading/Heading3.d.ts +0 -2
- package/dist/plugins/Heading/Heading4.d.ts +0 -2
- package/dist/plugins/Heading/Heading5.d.ts +0 -2
- package/dist/plugins/Heading/Heading6.d.ts +0 -2
- package/dist/plugins/Heading/HeadingDropdown.d.ts +0 -29
- package/dist/plugins/Heading/Paragraph.d.ts +0 -2
- package/dist/plugins/Hyperlink/Hyperlink.d.ts +0 -25
- package/dist/plugins/Hyperlink/ToolbarIcon.d.ts +0 -8
- package/dist/plugins/Hyperlink/Util.d.ts +0 -43
- package/dist/plugins/Hyperlink/styles.d.ts +0 -7
- package/dist/plugins/InsertBeforeFirstVoidBlock/Util.d.ts +0 -14
- package/dist/plugins/List/EditListWrapper.d.ts +0 -2
- package/dist/plugins/List/ToolbarDecorator.d.ts +0 -62
- package/dist/plugins/NewLinePlugin/index.d.ts +0 -3
- package/dist/plugins/Paste/Paste.d.ts +0 -1
- package/dist/plugins/Paste/Paste.spec.d.ts +0 -1
- package/dist/plugins/Paste/index.spec.d.ts +0 -1
- package/dist/plugins/PasteHtml/PasteHtml.spec.d.ts +0 -1
- package/dist/plugins/PasteHtml/Serializer.d.ts +0 -1
- package/dist/plugins/PasteHtml/index.d.ts +0 -3
- package/dist/plugins/PasteText/PasteText.spec.d.ts +0 -1
- package/dist/plugins/PasteText/index.d.ts +0 -3
- package/dist/plugins/Quote/QuotePlugin.d.ts +0 -10
- package/dist/plugins/Quote/Util.d.ts +0 -2
- package/dist/plugins/Underlined/index.d.ts +0 -64
- package/dist/plugins/index.d.ts +0 -1
- package/dist/plugins/shared/BlockSelectDecorator.d.ts +0 -63
- package/dist/plugins/shared/BlockToggleDecorator.d.ts +0 -65
- package/dist/plugins/shared/MarkDecorator.d.ts +0 -12
- package/dist/plugins/shared/MarkPlugin.d.ts +0 -9
- package/dist/plugins/shared/MarkToggleDecorator.d.ts +0 -62
- package/dist/plugins/shared/NodeDecorator.d.ts +0 -15
- package/dist/plugins/shared/PasteTestHelpers.d.ts +0 -35
- package/dist/plugins/shared/PluginApi.d.ts +0 -26
- package/dist/plugins/shared/PropTypes.d.ts +0 -15
- package/dist/plugins/shared/ToolbarDropdownListItem.d.ts +0 -15
- package/dist/plugins/shared/ToolbarIcon.d.ts +0 -16
- package/dist/plugins/shared/UtilHave.d.ts +0 -24
- package/dist/setupTests.d.ts +0 -1
- package/dist/validations/index.d.ts +0 -9
- package/dist/validations/validations.spec.d.ts +0 -1
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { Deserialize, GetNodeDeserializerRule } from '@udecode/plate-core';
|
|
2
|
+
export declare function deserializeLeaf(type: string, rules: GetNodeDeserializerRule[]): Deserialize;
|
|
3
|
+
export declare function deserializeElement(type: string, rules: GetNodeDeserializerRule[]): Deserialize;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { Path } from 'slate';
|
|
2
|
+
import { BLOCKS, INLINES } from '@contentful/rich-text-types';
|
|
3
|
+
import { CustomElement } from '../types';
|
|
4
|
+
import { Link } from '@contentful/field-editor-reference/dist/types';
|
|
5
|
+
import { SPEditor } from '@udecode/plate-core';
|
|
6
|
+
export declare const LINK_TYPES: INLINES[];
|
|
7
|
+
export declare function isBlockSelected(editor: any, type: string): boolean;
|
|
8
|
+
export declare function isVoid(editor: any, element: any): boolean;
|
|
9
|
+
export declare function hasSelectionText(editor: any): boolean;
|
|
10
|
+
declare type NodeEntry = [CustomElement, Path];
|
|
11
|
+
declare type NodeType = BLOCKS | INLINES;
|
|
12
|
+
export declare function getNodeEntryFromSelection(editor: any, nodeTypeOrTypes: NodeType | NodeType[]): NodeEntry | [];
|
|
13
|
+
export declare function isNodeTypeSelected(editor: any, nodeType: BLOCKS | INLINES): boolean;
|
|
14
|
+
export declare function moveToTheNextLine(editor: any): void;
|
|
15
|
+
export declare function moveToThePreviousLine(editor: any): void;
|
|
16
|
+
export declare function toggleBlock(editor: any, type: string): void;
|
|
17
|
+
export declare function getElementFromCurrentSelection(editor: any): (import("slate").BaseEditor | CustomElement<unknown> | import("slate").BaseText | Path)[];
|
|
18
|
+
export declare function isList(editor: any): boolean;
|
|
19
|
+
export declare function getTableSize(table: CustomElement): Record<'numRows' | 'numColumns', number> | null;
|
|
20
|
+
export declare function isFirstChild(path: Path): boolean;
|
|
21
|
+
interface InsertLinkOptions {
|
|
22
|
+
text: string;
|
|
23
|
+
type: INLINES.HYPERLINK | INLINES.ENTRY_HYPERLINK | INLINES.ASSET_HYPERLINK;
|
|
24
|
+
url?: string;
|
|
25
|
+
target?: Link;
|
|
26
|
+
path?: Path;
|
|
27
|
+
}
|
|
28
|
+
export declare function insertLink(editor: any, options: InsertLinkOptions): void;
|
|
29
|
+
export declare function isLinkActive(editor: any): boolean;
|
|
30
|
+
export declare function unwrapLink(editor: any): void;
|
|
31
|
+
export declare function wrapLink(editor: any, { text, url, target, type, path }: InsertLinkOptions): void;
|
|
32
|
+
export declare function getAncestorPathFromSelection(editor: SPEditor): Path | undefined;
|
|
33
|
+
export declare function shouldUnwrapBlockquote(editor: SPEditor, type: BLOCKS): boolean;
|
|
34
|
+
export declare function unwrapFromRoot(editor: SPEditor): void;
|
|
35
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
declare type DateFormatFn = (date: Date | string, short?: boolean) => string;
|
|
2
|
+
/**
|
|
3
|
+
* @param {Date|string} date A valid constructor argument for moment()
|
|
4
|
+
* @param {boolean=} short Render only Today/Tomorrow/Yesterday if valid. Defaults to false
|
|
5
|
+
*/
|
|
6
|
+
export declare const formatDate: DateFormatFn;
|
|
7
|
+
/**
|
|
8
|
+
* Returns the time portion of a date in the local time in the format H:MM AM/PM
|
|
9
|
+
*
|
|
10
|
+
* == Examples
|
|
11
|
+
* * `T15:36:45.000Z` => 3:36 PM (if in +0:00 offset)
|
|
12
|
+
*/
|
|
13
|
+
export declare const formatTime: DateFormatFn;
|
|
14
|
+
export declare const formatDateAndTime: DateFormatFn;
|
|
15
|
+
export {};
|
|
@@ -1,2 +1,26 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Given a field object and a rich text node type, return a list of valid
|
|
3
|
+
* content type IDs associated with the node type, based on that node type's
|
|
4
|
+
* `linkContentType` validation.
|
|
5
|
+
*
|
|
6
|
+
* If there is no such validation or the validation is empty, return an empty
|
|
7
|
+
* array.
|
|
8
|
+
*
|
|
9
|
+
* The navigation here is explained by the `nodes` validation having signature:
|
|
10
|
+
* { nodes: { [nodeType]: validationObject[] } }
|
|
11
|
+
*
|
|
12
|
+
* We defensively navigate through this object because
|
|
13
|
+
* 1) the field may not have a `validations` array,
|
|
14
|
+
* 2) the `validations` array may be empty,
|
|
15
|
+
* 3) the `validations` array may not have a `nodes` validation,
|
|
16
|
+
* 4) the `nodes` validation may not validate the `nodeType`, and
|
|
17
|
+
* 5) the `nodeType` validations may not have a `linkContentType` validation.
|
|
18
|
+
*
|
|
19
|
+
* Note that passing an empty array will result in all possible content types
|
|
20
|
+
* being whitelisted.
|
|
21
|
+
*
|
|
22
|
+
* @param {object} field
|
|
23
|
+
* @param {string} nodeType
|
|
24
|
+
* @returns {string[]}
|
|
25
|
+
*/
|
|
26
|
+
export default function getLinkedContentTypeIdsForNodeType(field: any, nodeType: any): string[];
|
|
@@ -7,4 +7,8 @@
|
|
|
7
7
|
* @param {string} nodeType
|
|
8
8
|
* @returns {object}
|
|
9
9
|
*/
|
|
10
|
-
export default function newEntitySelectorConfigFromRichTextField(field: any, nodeType:
|
|
10
|
+
export default function newEntitySelectorConfigFromRichTextField(field: any, nodeType: any): {
|
|
11
|
+
entityType: "Entry" | "Asset";
|
|
12
|
+
locale: any;
|
|
13
|
+
contentTypes: string[];
|
|
14
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { BLOCKS, INLINES, Text } from '@contentful/rich-text-types';
|
|
2
|
+
import { TextOrCustomElement } from 'types';
|
|
3
|
+
declare type NodeType = BLOCKS | INLINES | Text['nodeType'];
|
|
4
|
+
/**
|
|
5
|
+
* Ensures "orphaned" text node elements (those without a parent capable of
|
|
6
|
+
* validly rendering a text child node) are wrapped with a suitable parent
|
|
7
|
+
* element to prevent failures on the validation layer.
|
|
8
|
+
*
|
|
9
|
+
* It is commonplace for third party plugins (including udecode) to reconcile
|
|
10
|
+
* deletion events by inserting such nodes into their schema. This
|
|
11
|
+
* subprocedure is intended as a guard against such cases.
|
|
12
|
+
*/
|
|
13
|
+
export declare function sanitizeSlateDoc(nodes?: TextOrCustomElement[], parentNodeType?: NodeType): TextOrCustomElement[];
|
|
14
|
+
/**
|
|
15
|
+
* Ensures incoming void nodes have a child leaf text element.
|
|
16
|
+
*/
|
|
17
|
+
export declare function sanitizeIncomingSlateDoc(nodes?: TextOrCustomElement[]): TextOrCustomElement[];
|
|
18
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function truncate(str: any, length: any): any;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { BLOCKS, INLINES } from '@contentful/rich-text-types';
|
|
2
|
+
import { FieldExtensionSDK } from '@contentful/app-sdk';
|
|
3
|
+
export declare const VALIDATIONS: {
|
|
4
|
+
ENABLED_MARKS: string;
|
|
5
|
+
ENABLED_NODE_TYPES: string;
|
|
6
|
+
};
|
|
7
|
+
export declare const DEFAULT_ENABLED_NODE_TYPES: string[];
|
|
8
|
+
export declare const VALIDATABLE_NODE_TYPES: (BLOCKS | INLINES)[];
|
|
9
|
+
export declare const isNodeTypeEnabled: (field: FieldExtensionSDK['field'], nodeType: any) => boolean;
|
|
10
|
+
export declare const isMarkEnabled: (field: FieldExtensionSDK['field'], mark: any) => boolean;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { default as RichTextEditor } from './RichTextEditor';
|
|
2
2
|
export { ConnectedRichTextEditor } from './RichTextEditor';
|
|
3
|
-
export {
|
|
4
|
-
export {
|
|
3
|
+
export { openRichTextDialog } from './dialogs/openRichTextDialog';
|
|
4
|
+
export { renderRichTextDialog } from './dialogs/renderRichTextDialog';
|
|
@@ -1,64 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
}
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
forceUpdate(callback?: (() => void) | undefined): void;
|
|
14
|
-
readonly props: Readonly<any> & Readonly<{
|
|
15
|
-
children?: React.ReactNode;
|
|
16
|
-
}>;
|
|
17
|
-
state: Readonly<any>;
|
|
18
|
-
refs: {
|
|
19
|
-
[key: string]: React.ReactInstance;
|
|
20
|
-
};
|
|
21
|
-
componentDidMount?(): void;
|
|
22
|
-
shouldComponentUpdate?(nextProps: Readonly<any>, nextState: Readonly<any>, nextContext: any): boolean;
|
|
23
|
-
componentWillUnmount?(): void;
|
|
24
|
-
componentDidCatch?(error: Error, errorInfo: React.ErrorInfo): void;
|
|
25
|
-
getSnapshotBeforeUpdate?(prevProps: Readonly<any>, prevState: Readonly<any>): any;
|
|
26
|
-
componentDidUpdate?(prevProps: Readonly<any>, prevState: Readonly<any>, snapshot?: any): void;
|
|
27
|
-
componentWillMount?(): void;
|
|
28
|
-
UNSAFE_componentWillMount?(): void;
|
|
29
|
-
componentWillReceiveProps?(nextProps: Readonly<any>, nextContext: any): void;
|
|
30
|
-
UNSAFE_componentWillReceiveProps?(nextProps: Readonly<any>, nextContext: any): void;
|
|
31
|
-
componentWillUpdate?(nextProps: Readonly<any>, nextState: Readonly<any>, nextContext: any): void;
|
|
32
|
-
UNSAFE_componentWillUpdate?(nextProps: Readonly<any>, nextState: Readonly<any>, nextContext: any): void;
|
|
33
|
-
};
|
|
34
|
-
new (props: any, context?: any): {
|
|
35
|
-
handleToggle: (e: any) => void;
|
|
36
|
-
render(): JSX.Element;
|
|
37
|
-
context: any;
|
|
38
|
-
setState<K extends string | number | symbol>(state: any, callback?: (() => void) | undefined): void;
|
|
39
|
-
forceUpdate(callback?: (() => void) | undefined): void;
|
|
40
|
-
readonly props: Readonly<any> & Readonly<{
|
|
41
|
-
children?: React.ReactNode;
|
|
42
|
-
}>;
|
|
43
|
-
state: Readonly<any>;
|
|
44
|
-
refs: {
|
|
45
|
-
[key: string]: React.ReactInstance;
|
|
46
|
-
};
|
|
47
|
-
componentDidMount?(): void;
|
|
48
|
-
shouldComponentUpdate?(nextProps: Readonly<any>, nextState: Readonly<any>, nextContext: any): boolean;
|
|
49
|
-
componentWillUnmount?(): void;
|
|
50
|
-
componentDidCatch?(error: Error, errorInfo: React.ErrorInfo): void;
|
|
51
|
-
getSnapshotBeforeUpdate?(prevProps: Readonly<any>, prevState: Readonly<any>): any;
|
|
52
|
-
componentDidUpdate?(prevProps: Readonly<any>, prevState: Readonly<any>, snapshot?: any): void;
|
|
53
|
-
componentWillMount?(): void;
|
|
54
|
-
UNSAFE_componentWillMount?(): void;
|
|
55
|
-
componentWillReceiveProps?(nextProps: Readonly<any>, nextContext: any): void;
|
|
56
|
-
UNSAFE_componentWillReceiveProps?(nextProps: Readonly<any>, nextContext: any): void;
|
|
57
|
-
componentWillUpdate?(nextProps: Readonly<any>, nextState: Readonly<any>, nextContext: any): void;
|
|
58
|
-
UNSAFE_componentWillUpdate?(nextProps: Readonly<any>, nextState: Readonly<any>, nextContext: any): void;
|
|
59
|
-
};
|
|
60
|
-
propTypes: any;
|
|
61
|
-
contextType?: React.Context<any> | undefined;
|
|
62
|
-
};
|
|
63
|
-
export default _default;
|
|
64
|
-
import React from "react";
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import * as Slate from 'slate-react';
|
|
3
|
+
import { PlatePlugin } from '@udecode/plate-core';
|
|
4
|
+
import { CustomSlatePluginOptions } from 'types';
|
|
5
|
+
interface ToolbarBoldButtonProps {
|
|
6
|
+
isDisabled?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare function ToolbarBoldButton(props: ToolbarBoldButtonProps): JSX.Element | null;
|
|
9
|
+
export declare function Bold(props: Slate.RenderLeafProps): JSX.Element;
|
|
10
|
+
export declare function createBoldPlugin(): PlatePlugin;
|
|
11
|
+
export declare const withBoldOptions: CustomSlatePluginOptions;
|
|
12
|
+
export {};
|
|
@@ -1,64 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
}
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
forceUpdate(callback?: (() => void) | undefined): void;
|
|
14
|
-
readonly props: Readonly<any> & Readonly<{
|
|
15
|
-
children?: React.ReactNode;
|
|
16
|
-
}>;
|
|
17
|
-
state: Readonly<any>;
|
|
18
|
-
refs: {
|
|
19
|
-
[key: string]: React.ReactInstance;
|
|
20
|
-
};
|
|
21
|
-
componentDidMount?(): void;
|
|
22
|
-
shouldComponentUpdate?(nextProps: Readonly<any>, nextState: Readonly<any>, nextContext: any): boolean;
|
|
23
|
-
componentWillUnmount?(): void;
|
|
24
|
-
componentDidCatch?(error: Error, errorInfo: React.ErrorInfo): void;
|
|
25
|
-
getSnapshotBeforeUpdate?(prevProps: Readonly<any>, prevState: Readonly<any>): any;
|
|
26
|
-
componentDidUpdate?(prevProps: Readonly<any>, prevState: Readonly<any>, snapshot?: any): void;
|
|
27
|
-
componentWillMount?(): void;
|
|
28
|
-
UNSAFE_componentWillMount?(): void;
|
|
29
|
-
componentWillReceiveProps?(nextProps: Readonly<any>, nextContext: any): void;
|
|
30
|
-
UNSAFE_componentWillReceiveProps?(nextProps: Readonly<any>, nextContext: any): void;
|
|
31
|
-
componentWillUpdate?(nextProps: Readonly<any>, nextState: Readonly<any>, nextContext: any): void;
|
|
32
|
-
UNSAFE_componentWillUpdate?(nextProps: Readonly<any>, nextState: Readonly<any>, nextContext: any): void;
|
|
33
|
-
};
|
|
34
|
-
new (props: any, context?: any): {
|
|
35
|
-
handleToggle: (e: any) => void;
|
|
36
|
-
render(): JSX.Element;
|
|
37
|
-
context: any;
|
|
38
|
-
setState<K extends string | number | symbol>(state: any, callback?: (() => void) | undefined): void;
|
|
39
|
-
forceUpdate(callback?: (() => void) | undefined): void;
|
|
40
|
-
readonly props: Readonly<any> & Readonly<{
|
|
41
|
-
children?: React.ReactNode;
|
|
42
|
-
}>;
|
|
43
|
-
state: Readonly<any>;
|
|
44
|
-
refs: {
|
|
45
|
-
[key: string]: React.ReactInstance;
|
|
46
|
-
};
|
|
47
|
-
componentDidMount?(): void;
|
|
48
|
-
shouldComponentUpdate?(nextProps: Readonly<any>, nextState: Readonly<any>, nextContext: any): boolean;
|
|
49
|
-
componentWillUnmount?(): void;
|
|
50
|
-
componentDidCatch?(error: Error, errorInfo: React.ErrorInfo): void;
|
|
51
|
-
getSnapshotBeforeUpdate?(prevProps: Readonly<any>, prevState: Readonly<any>): any;
|
|
52
|
-
componentDidUpdate?(prevProps: Readonly<any>, prevState: Readonly<any>, snapshot?: any): void;
|
|
53
|
-
componentWillMount?(): void;
|
|
54
|
-
UNSAFE_componentWillMount?(): void;
|
|
55
|
-
componentWillReceiveProps?(nextProps: Readonly<any>, nextContext: any): void;
|
|
56
|
-
UNSAFE_componentWillReceiveProps?(nextProps: Readonly<any>, nextContext: any): void;
|
|
57
|
-
componentWillUpdate?(nextProps: Readonly<any>, nextState: Readonly<any>, nextContext: any): void;
|
|
58
|
-
UNSAFE_componentWillUpdate?(nextProps: Readonly<any>, nextState: Readonly<any>, nextContext: any): void;
|
|
59
|
-
};
|
|
60
|
-
propTypes: any;
|
|
61
|
-
contextType?: React.Context<any> | undefined;
|
|
62
|
-
};
|
|
63
|
-
export default _default;
|
|
64
|
-
import React from "react";
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import * as Slate from 'slate-react';
|
|
3
|
+
import { PlatePlugin } from '@udecode/plate-core';
|
|
4
|
+
import { CustomSlatePluginOptions } from 'types';
|
|
5
|
+
interface ToolbarCodeButtonProps {
|
|
6
|
+
isDisabled?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare function ToolbarCodeButton(props: ToolbarCodeButtonProps): JSX.Element | null;
|
|
9
|
+
export declare function Code(props: Slate.RenderLeafProps): JSX.Element;
|
|
10
|
+
export declare function createCodePlugin(): PlatePlugin;
|
|
11
|
+
export declare const withCodeOptions: CustomSlatePluginOptions;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export class InViewport extends React.Component<any, any, any> {
|
|
2
|
+
static defaultProps: {
|
|
3
|
+
testId: string;
|
|
4
|
+
offset: number;
|
|
5
|
+
};
|
|
6
|
+
constructor(props: any);
|
|
7
|
+
constructor(props: any, context: any);
|
|
8
|
+
tGetDomPosition: any;
|
|
9
|
+
nodeRef: any;
|
|
10
|
+
lastOverflowAt: any;
|
|
11
|
+
tOnOverflowTop: (...args: any[]) => any;
|
|
12
|
+
tOnOverflowBottom: (...args: any[]) => any;
|
|
13
|
+
tOnOverflowRight: (...args: any[]) => any;
|
|
14
|
+
tOnOverflowLeft: (...args: any[]) => any;
|
|
15
|
+
getDomPosition: () => void;
|
|
16
|
+
bindEventListeners: () => void;
|
|
17
|
+
handleOverflow: ({ top, left, bottom, right }: {
|
|
18
|
+
top: any;
|
|
19
|
+
left: any;
|
|
20
|
+
bottom: any;
|
|
21
|
+
right: any;
|
|
22
|
+
}, windowWidth: any, windowHeight: any) => void;
|
|
23
|
+
}
|
|
24
|
+
export namespace InViewport {
|
|
25
|
+
export namespace propTypes {
|
|
26
|
+
export const offset: PropTypes.Requireable<number>;
|
|
27
|
+
export const onOverflowTop: PropTypes.Requireable<(...args: any[]) => any>;
|
|
28
|
+
export const onOverflowRight: PropTypes.Requireable<(...args: any[]) => any>;
|
|
29
|
+
export const onOverflowBottom: PropTypes.Requireable<(...args: any[]) => any>;
|
|
30
|
+
export const onOverflowLeft: PropTypes.Requireable<(...args: any[]) => any>;
|
|
31
|
+
export const className: PropTypes.Requireable<string>;
|
|
32
|
+
export const children: PropTypes.Requireable<any>;
|
|
33
|
+
export const testId: PropTypes.Requireable<string>;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
import React from "react";
|
|
37
|
+
import PropTypes from "prop-types";
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
interface EmbeddedEntityDropdownButtonProps {
|
|
3
|
+
children: React.ReactNode;
|
|
4
|
+
isDisabled: boolean | undefined;
|
|
5
|
+
isOpen: boolean;
|
|
6
|
+
onClose: () => void;
|
|
7
|
+
onToggle: () => void;
|
|
8
|
+
}
|
|
9
|
+
export declare function EmbeddedEntityDropdownButton({ children, isDisabled, isOpen, onClose, onToggle, }: EmbeddedEntityDropdownButtonProps): JSX.Element;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { CustomRenderElementProps } from '../../types';
|
|
3
|
+
declare type LinkedEntityBlockProps = CustomRenderElementProps<{
|
|
4
|
+
target: {
|
|
5
|
+
sys: {
|
|
6
|
+
id: string;
|
|
7
|
+
linkType: 'Entry' | 'Asset';
|
|
8
|
+
type: 'Link';
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
}>;
|
|
12
|
+
export declare function LinkedEntityBlock(props: LinkedEntityBlockProps): JSX.Element;
|
|
13
|
+
export {};
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const styles: {
|
|
3
|
+
icon: string;
|
|
4
|
+
};
|
|
5
|
+
interface EmbeddedEntityBlockToolbarIconProps {
|
|
6
|
+
isButton?: boolean;
|
|
7
|
+
isDisabled: boolean;
|
|
8
|
+
logAction?: () => void;
|
|
9
|
+
nodeType: string;
|
|
10
|
+
onClose: () => void;
|
|
10
11
|
}
|
|
11
|
-
|
|
12
|
+
export declare function EmbeddedEntityBlockToolbarIcon({ isButton, isDisabled, logAction, nodeType, onClose, }: EmbeddedEntityBlockToolbarIconProps): JSX.Element;
|
|
13
|
+
export {};
|
|
@@ -1,23 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
* @param {string} nodeType
|
|
4
|
-
* @param {WidgetAPI} widgetAPI
|
|
5
|
-
* @param {slate.Editor} editor
|
|
6
|
-
* @param {function} logAction
|
|
7
|
-
*/
|
|
8
|
-
export function selectEntityAndInsert(nodeType: string, widgetAPI: any, editor: any, logAction: Function): Promise<void>;
|
|
9
|
-
export function insertBlock(editor: any, nodeType: any, entity: any, focusNextLine?: boolean): void;
|
|
10
|
-
export function hasBlockOfType(editor: any, type: string): boolean;
|
|
11
|
-
export function createNode(nodeType: any, entity: any): {
|
|
12
|
-
type: any;
|
|
13
|
-
object: string;
|
|
14
|
-
data: {
|
|
15
|
-
target: {
|
|
16
|
-
sys: {
|
|
17
|
-
id: any;
|
|
18
|
-
type: string;
|
|
19
|
-
linkType: any;
|
|
20
|
-
};
|
|
21
|
-
};
|
|
22
|
-
};
|
|
23
|
-
};
|
|
1
|
+
export declare function selectEntityAndInsert(nodeType: any, sdk: any, editor: any, logAction: any): Promise<void>;
|
|
2
|
+
export declare function insertBlock(editor: any, nodeType: any, entity: any): void;
|
|
@@ -1,27 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
renderNode: (props: any, _editor: any, next: any) => any;
|
|
13
|
-
onKeyDown(e: any, editor: any, next: any): any;
|
|
14
|
-
};
|
|
15
|
-
export function EmbeddedEntryBlockPlugin({ richTextAPI }: {
|
|
16
|
-
richTextAPI: any;
|
|
17
|
-
}): {
|
|
18
|
-
renderNode: (props: any, _editor: any, next: any) => any;
|
|
19
|
-
onKeyDown(e: any, editor: any, next: any): any;
|
|
20
|
-
};
|
|
21
|
-
export function EmbeddedAssetBlockPlugin({ richTextAPI }: {
|
|
22
|
-
richTextAPI: any;
|
|
23
|
-
}): {
|
|
24
|
-
renderNode: (props: any, _editor: any, next: any) => any;
|
|
25
|
-
onKeyDown(e: any, editor: any, next: any): any;
|
|
26
|
-
};
|
|
27
|
-
import ToolbarIcon from "./ToolbarIcon";
|
|
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
|
+
import { FieldExtensionSDK } from '@contentful/app-sdk';
|
|
6
|
+
export { EmbeddedEntityBlockToolbarIcon as ToolbarIcon } from './ToolbarIcon';
|
|
7
|
+
export declare const createEmbeddedEntryBlockPlugin: (sdk: FieldExtensionSDK) => PlatePlugin;
|
|
8
|
+
export declare const createEmbeddedAssetBlockPlugin: (sdk: FieldExtensionSDK) => PlatePlugin;
|
|
9
|
+
export declare const withEmbeddedEntryBlockOptions: CustomSlatePluginOptions;
|
|
10
|
+
export declare const withEmbeddedAssetBlockOptions: CustomSlatePluginOptions;
|
|
11
|
+
export declare function getWithEmbeddedEntityEvents(nodeType: BLOCKS.EMBEDDED_ENTRY | BLOCKS.EMBEDDED_ASSET, sdk: FieldExtensionSDK): (editor: SPEditor) => (event: KeyboardEvent) => void;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { FieldExtensionSDK } from '@contentful/field-editor-shared';
|
|
3
|
+
interface FetchingWrappedInlineEntryCardProps {
|
|
4
|
+
entryId: string;
|
|
5
|
+
sdk: FieldExtensionSDK;
|
|
6
|
+
isSelected: boolean;
|
|
7
|
+
isDisabled: boolean;
|
|
8
|
+
onEdit: (event: React.MouseEvent<Element, MouseEvent>) => void;
|
|
9
|
+
onRemove: (event: React.MouseEvent<Element, MouseEvent>) => void;
|
|
10
|
+
}
|
|
11
|
+
export declare function FetchingWrappedInlineEntryCard(props: FetchingWrappedInlineEntryCardProps): JSX.Element;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { INLINES } from '@contentful/rich-text-types';
|
|
2
|
+
export declare function createInlineEntryNode(id: string): {
|
|
3
|
+
type: INLINES;
|
|
4
|
+
children: {
|
|
5
|
+
text: string;
|
|
6
|
+
}[];
|
|
7
|
+
data: {
|
|
8
|
+
target: {
|
|
9
|
+
sys: {
|
|
10
|
+
id: string;
|
|
11
|
+
type: string;
|
|
12
|
+
linkType: string;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { PlatePlugin } from '@udecode/plate-core';
|
|
3
|
+
import { CustomSlatePluginOptions } from '../../types';
|
|
4
|
+
interface ToolbarEmbeddedEntityInlineButtonProps {
|
|
5
|
+
onClose: () => void;
|
|
6
|
+
isDisabled: boolean;
|
|
7
|
+
isButton?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export declare function ToolbarEmbeddedEntityInlineButton(props: ToolbarEmbeddedEntityInlineButtonProps): JSX.Element;
|
|
10
|
+
export declare function createEmbeddedEntityInlinePlugin(sdk: any): PlatePlugin;
|
|
11
|
+
export declare const withEmbeddedEntityInlineOptions: CustomSlatePluginOptions;
|
|
12
|
+
export {};
|
|
@@ -1,50 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
export
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
};
|
|
22
|
-
export function Heading4Plugin({ type, richTextAPI }: {
|
|
23
|
-
type?: any;
|
|
24
|
-
richTextAPI: any;
|
|
25
|
-
}): {
|
|
26
|
-
renderNode: (props: any, _editor: any, next: any) => any;
|
|
27
|
-
onKeyDown: (e: any, editor: any, next: any) => any;
|
|
28
|
-
};
|
|
29
|
-
export function Heading5Plugin({ type, richTextAPI }: {
|
|
30
|
-
type?: any;
|
|
31
|
-
richTextAPI: any;
|
|
32
|
-
}): {
|
|
33
|
-
renderNode: (props: any, _editor: any, next: any) => any;
|
|
34
|
-
onKeyDown: (e: any, editor: any, next: any) => any;
|
|
35
|
-
};
|
|
36
|
-
export function Heading6Plugin({ type, richTextAPI }: {
|
|
37
|
-
type?: any;
|
|
38
|
-
richTextAPI: any;
|
|
39
|
-
}): {
|
|
40
|
-
renderNode: (props: any, _editor: any, next: any) => any;
|
|
41
|
-
onKeyDown: (e: any, editor: any, next: any) => any;
|
|
42
|
-
};
|
|
43
|
-
export { default as Heading1 } from "./Heading1";
|
|
44
|
-
export { default as Heading2 } from "./Heading2";
|
|
45
|
-
export { default as Heading3 } from "./Heading3";
|
|
46
|
-
export { default as Heading4 } from "./Heading4";
|
|
47
|
-
export { default as Heading5 } from "./Heading5";
|
|
48
|
-
export { default as Heading6 } from "./Heading6";
|
|
49
|
-
export { default as Paragraph } from "./Paragraph";
|
|
50
|
-
export { default as HeadingDropdown } from "./HeadingDropdown";
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import * as Slate from 'slate-react';
|
|
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 {};
|