@contentful/field-editor-rich-text 2.0.0-next.8 → 2.0.2
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 +536 -0
- package/LICENSE +21 -0
- package/README.md +25 -3
- package/dist/ContentfulEditorProvider.d.ts +6 -5
- package/dist/RichTextEditor.d.ts +1 -1
- package/dist/Toolbar/components/EmbedEntityWidget.d.ts +1 -1
- package/dist/field-editor-rich-text.cjs.development.js +2403 -1407
- 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 +2412 -1416
- package/dist/field-editor-rich-text.esm.js.map +1 -1
- package/dist/helpers/editor.d.ts +16 -18
- package/dist/helpers/environment.d.ts +1 -1
- package/dist/helpers/extractNodes.d.ts +2 -3
- package/dist/helpers/{sanitizeSlateDoc.d.ts → sanitizeIncomingSlateDoc.d.ts} +2 -1
- package/dist/helpers/transformers.d.ts +6 -6
- package/dist/plugins/Break/createResetNodePlugin.d.ts +2 -0
- package/dist/plugins/Break/index.d.ts +2 -0
- package/dist/plugins/CommandPalette/CommandPanel/InViewport/InViewport.d.ts +37 -0
- package/dist/plugins/EmbeddedEntityBlock/FetchingWrappedAssetCard.d.ts +15 -0
- package/dist/plugins/EmbeddedEntityBlock/FetchingWrappedEntryCard.d.ts +15 -0
- package/dist/plugins/EmbeddedEntityBlock/ToolbarIcon.d.ts +1 -3
- package/dist/plugins/EmbeddedEntityBlock/Util.d.ts +2 -1
- package/dist/plugins/EmbeddedEntityBlock/index.d.ts +2 -3
- package/dist/plugins/EmbeddedEntityInline/index.d.ts +1 -3
- package/dist/plugins/EmbeddedEntryInline/FetchingWrappedInlineEntryCard.d.ts +14 -0
- package/dist/plugins/Hr/index.d.ts +2 -3
- package/dist/plugins/Hyperlink/Hyperlink.d.ts +13 -0
- package/dist/plugins/Hyperlink/HyperlinkModal.d.ts +5 -4
- package/dist/plugins/Hyperlink/components/EntityHyperlink.d.ts +9 -0
- package/dist/plugins/Hyperlink/components/ToolbarHyperlinkButton.d.ts +5 -0
- package/dist/plugins/Hyperlink/components/UrlHyperlink.d.ts +9 -0
- package/dist/plugins/Hyperlink/components/styles.d.ts +4 -0
- package/dist/plugins/Hyperlink/createHyperlinkPlugin.d.ts +3 -0
- package/dist/plugins/Hyperlink/index.d.ts +2 -9
- package/dist/plugins/Hyperlink/useEntityInfo.d.ts +16 -0
- package/dist/plugins/Hyperlink/utils.d.ts +4 -2
- package/dist/plugins/List/insertListBreak.d.ts +2 -2
- package/dist/plugins/List/insertListFragment.d.ts +3 -2
- package/dist/plugins/List/onKeyDownList.d.ts +7 -0
- package/dist/plugins/List/transforms/deleteBackwardList.d.ts +2 -0
- package/dist/plugins/List/transforms/insertListItem.d.ts +2 -2
- package/dist/plugins/List/transforms/moveListItemDown.d.ts +11 -0
- package/dist/plugins/List/transforms/moveListItems.d.ts +10 -0
- package/dist/plugins/List/transforms/toggleList.d.ts +4 -0
- package/dist/plugins/List/transforms/unwrapList.d.ts +5 -0
- package/dist/plugins/List/utils.d.ts +9 -5
- package/dist/plugins/List/withList.d.ts +2 -1
- package/dist/plugins/Marks/Bold.d.ts +7 -5
- package/dist/plugins/Marks/Code.d.ts +7 -5
- package/dist/plugins/Marks/Italic.d.ts +7 -5
- package/dist/plugins/Marks/Underline.d.ts +7 -5
- package/dist/plugins/Marks/components/MarkToolbarButton.d.ts +13 -0
- package/dist/plugins/Marks/helpers.d.ts +4 -0
- package/dist/plugins/Normalizer/types.d.ts +4 -3
- package/dist/plugins/Normalizer/utils.d.ts +2 -2
- package/dist/plugins/Normalizer/withNormalizer.d.ts +2 -2
- package/dist/plugins/PasteHTML/createPasteHTMLPlugin.d.ts +6 -0
- package/dist/plugins/Quote/shouldResetQuote.d.ts +8 -0
- package/dist/plugins/Quote/toggleQuote.d.ts +4 -2
- package/dist/plugins/Quote/withQuote.d.ts +3 -0
- package/dist/plugins/SlashCommands/SlashCommandsPalette.d.ts +5 -0
- package/dist/plugins/SlashCommands/createSlashCommandsPlugin.d.ts +2 -0
- package/dist/plugins/SlashCommands/helpers.d.ts +6 -0
- package/dist/plugins/SlashCommands/index.d.ts +2 -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/createTablePlugin.d.ts +1 -2
- package/dist/plugins/Table/helpers.d.ts +8 -7
- package/dist/plugins/Table/insertTableFragment.d.ts +3 -0
- package/dist/plugins/Table/onKeyDownTable.d.ts +3 -0
- package/dist/plugins/Table/tableTracking.d.ts +4 -0
- package/dist/plugins/Tracking/createTrackingPlugin.d.ts +11 -0
- package/dist/plugins/Tracking/index.d.ts +1 -0
- package/dist/plugins/Tracking/utils.d.ts +2 -0
- package/dist/plugins/TrailingParagraph/index.d.ts +2 -1
- package/dist/plugins/Voids/transformVoid.d.ts +2 -2
- package/dist/plugins/index.d.ts +2 -2
- package/dist/plugins/links-tracking.d.ts +1 -2
- package/dist/plugins/shared/FetchingWrappedAssetCard.d.ts +0 -10
- package/dist/plugins/shared/FetchingWrappedEntryCard.d.ts +1 -1
- package/dist/plugins/shared/useFetchedEntity.d.ts +8 -0
- package/dist/prepareDocument.d.ts +20 -0
- package/dist/test-utils/assertOutput.d.ts +2 -3
- package/dist/test-utils/createEditor.d.ts +5 -6
- package/dist/test-utils/jsx.d.ts +1 -1
- package/dist/test-utils/mockPlugin.d.ts +1 -1
- package/dist/test-utils/setEmptyDataAttribute.d.ts +2 -2
- package/dist/types.d.ts +11 -3
- package/dist/useOnValueChanged.d.ts +8 -0
- package/package.json +25 -25
- package/dist/TrackingProvider.d.ts +0 -11
- package/dist/plugins/Hyperlink/EntryAssetTooltip.d.ts +0 -9
- package/dist/plugins/Hyperlink/truncate.d.ts +0 -1
- package/dist/plugins/Table/addTableTrackingEvents.d.ts +0 -3
- package/dist/plugins/shared/EntityStatusIcon.d.ts +0 -7
package/dist/helpers/editor.d.ts
CHANGED
|
@@ -1,19 +1,20 @@
|
|
|
1
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';
|
|
3
|
+
import { EditorNodesOptions, PlateEditor, ToggleNodeTypeOptions } from '@udecode/plate-core';
|
|
4
4
|
import { Path, Node } from 'slate';
|
|
5
|
-
import { CustomElement } from '../types';
|
|
5
|
+
import { CustomElement, RichTextEditor } from '../types';
|
|
6
6
|
export declare const LINK_TYPES: INLINES[];
|
|
7
|
-
export declare function isBlockSelected(editor:
|
|
7
|
+
export declare function isBlockSelected(editor: PlateEditor, type: string): boolean;
|
|
8
8
|
export declare function isRootLevel(path: Path): boolean;
|
|
9
|
-
export declare function hasSelectionText(editor: any): 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
|
|
11
|
+
export declare function getNodeEntryFromSelection(editor: RichTextEditor, nodeTypeOrTypes: NodeType | NodeType[], path?: Path): NodeEntry | [];
|
|
12
|
+
export declare function isNodeTypeSelected(editor: RichTextEditor, nodeType: BLOCKS | INLINES): boolean;
|
|
13
|
+
export declare function moveToTheNextLine(editor: RichTextEditor): void;
|
|
14
|
+
export declare function moveToTheNextChar(editor: RichTextEditor): void;
|
|
15
|
+
export declare function insertEmptyParagraph(editor: RichTextEditor, options?: any): void;
|
|
16
|
+
export declare function getElementFromCurrentSelection(editor: RichTextEditor): (import("slate").BaseEditor | CustomElement<unknown> | import("../types").CustomText | Path)[];
|
|
17
|
+
export declare function isList(editor?: RichTextEditor): boolean;
|
|
17
18
|
export declare function getTableSize(table: CustomElement): Record<'numRows' | 'numColumns', number> | null;
|
|
18
19
|
interface InsertLinkOptions {
|
|
19
20
|
text: string;
|
|
@@ -23,21 +24,18 @@ interface InsertLinkOptions {
|
|
|
23
24
|
path?: Path;
|
|
24
25
|
}
|
|
25
26
|
export declare function insertLink(editor: any, options: InsertLinkOptions): void;
|
|
26
|
-
export declare function isLinkActive(editor
|
|
27
|
+
export declare function isLinkActive(editor?: RichTextEditor): boolean;
|
|
27
28
|
export declare function unwrapLink(editor: any): void;
|
|
28
29
|
export declare function wrapLink(editor: any, { text, url, target, type, path }: InsertLinkOptions): void;
|
|
29
|
-
export declare function getAncestorPathFromSelection(editor:
|
|
30
|
-
export declare
|
|
31
|
-
export declare function unwrapFromRoot(editor: PlateEditor): void;
|
|
32
|
-
export declare const isAtEndOfTextSelection: (editor: PlateEditor) => boolean;
|
|
33
|
-
export declare function currentSelectionStartsTableCell(editor: PlateEditor): boolean;
|
|
30
|
+
export declare function getAncestorPathFromSelection(editor: RichTextEditor): Path | undefined;
|
|
31
|
+
export declare const isAtEndOfTextSelection: (editor: RichTextEditor) => boolean;
|
|
34
32
|
/**
|
|
35
33
|
* This traversal strategy is unfortunately necessary because Slate doesn't
|
|
36
34
|
* expose something like Node.next(editor).
|
|
37
35
|
*/
|
|
38
|
-
export declare function getNextNode(editor:
|
|
39
|
-
export declare function currentSelectionPrecedesTableCell(editor: PlateEditor): boolean;
|
|
36
|
+
export declare function getNextNode(editor: RichTextEditor): CustomElement | null;
|
|
40
37
|
export declare const INLINE_TYPES: string[];
|
|
41
38
|
export declare const isInlineOrText: (node: Node) => boolean;
|
|
42
|
-
export declare const focus: (editor:
|
|
39
|
+
export declare const focus: (editor: RichTextEditor) => void;
|
|
40
|
+
export declare function toggleElement(editor: RichTextEditor, options: ToggleNodeTypeOptions, editorOptions?: Omit<EditorNodesOptions, 'match'>): void;
|
|
43
41
|
export {};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { PlateEditor } from '@udecode/plate-core';
|
|
2
1
|
import { Path } from 'slate';
|
|
3
|
-
import { CustomElement } from '../types';
|
|
2
|
+
import { CustomElement, RichTextEditor } from '../types';
|
|
4
3
|
/**
|
|
5
4
|
* It filters out all paragraphs and headings from a path and convert them into paragraphs.
|
|
6
5
|
*/
|
|
7
|
-
export declare function extractParagraphs(editor:
|
|
6
|
+
export declare function extractParagraphs(editor: RichTextEditor, path: Path): CustomElement[];
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { TextOrCustomElement } from '../types';
|
|
2
2
|
/**
|
|
3
|
-
* Ensures
|
|
3
|
+
* Ensures all nodes have a child leaf text element. This should be handled by
|
|
4
|
+
* Slate but its behavior has proven to be buggy and unpredictable.
|
|
4
5
|
*/
|
|
5
6
|
export declare function sanitizeIncomingSlateDoc(nodes?: TextOrCustomElement[]): TextOrCustomElement[];
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { BLOCKS, INLINES } from '@contentful/rich-text-types';
|
|
2
|
-
import { PlateEditor } from '@udecode/plate-core';
|
|
3
2
|
import { NodeEntry } from 'slate';
|
|
4
|
-
|
|
5
|
-
export declare const
|
|
6
|
-
export declare const
|
|
7
|
-
export declare const
|
|
8
|
-
export declare const
|
|
3
|
+
import { RichTextEditor } from '../types';
|
|
4
|
+
export declare const transformRemove: (editor: RichTextEditor, [, path]: NodeEntry<import("slate").Node>) => void;
|
|
5
|
+
export declare const transformParagraphs: (editor: RichTextEditor, entry: NodeEntry<import("slate").Node>) => void;
|
|
6
|
+
export declare const transformUnwrap: (editor: RichTextEditor, [, path]: NodeEntry<import("slate").Node>) => void;
|
|
7
|
+
export declare const transformWrapIn: (type: BLOCKS | INLINES) => (editor: RichTextEditor, [, path]: NodeEntry<import("slate").Node>) => void;
|
|
8
|
+
export declare const transformLift: (editor: RichTextEditor, [, path]: NodeEntry<import("slate").Node>) => void;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
export type { SoftBreakRule, ExitBreakRule } from '@udecode/plate-break';
|
|
2
|
+
export type { ResetNodePluginRule } from '@udecode/plate-reset-node';
|
|
2
3
|
export * from './createSoftBreakPlugin';
|
|
3
4
|
export * from './createExitBreakPlugin';
|
|
5
|
+
export * from './createResetNodePlugin';
|
|
@@ -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,15 @@
|
|
|
1
|
+
export function FetchingWrappedAssetCard(props: any): JSX.Element;
|
|
2
|
+
export namespace FetchingWrappedAssetCard {
|
|
3
|
+
export namespace propTypes {
|
|
4
|
+
export const sdk: PropTypes.Validator<object>;
|
|
5
|
+
export const locale: PropTypes.Validator<string>;
|
|
6
|
+
export const assetId: PropTypes.Validator<string>;
|
|
7
|
+
export const isDisabled: PropTypes.Validator<boolean>;
|
|
8
|
+
export const isSelected: PropTypes.Validator<boolean>;
|
|
9
|
+
export const onRemove: PropTypes.Requireable<(...args: any[]) => any>;
|
|
10
|
+
export const onEdit: PropTypes.Requireable<(...args: any[]) => any>;
|
|
11
|
+
export const getAssetUrl: PropTypes.Requireable<(...args: any[]) => any>;
|
|
12
|
+
export const onEntityFetchComplete: PropTypes.Requireable<(...args: any[]) => any>;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
import PropTypes from "prop-types";
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export function FetchingWrappedEntryCard(props: any): JSX.Element;
|
|
2
|
+
export namespace FetchingWrappedEntryCard {
|
|
3
|
+
export namespace propTypes {
|
|
4
|
+
export const sdk: PropTypes.Validator<object>;
|
|
5
|
+
export const entryId: PropTypes.Validator<string>;
|
|
6
|
+
export const locale: PropTypes.Validator<string>;
|
|
7
|
+
export const isDisabled: PropTypes.Validator<boolean>;
|
|
8
|
+
export const isSelected: PropTypes.Validator<boolean>;
|
|
9
|
+
export const onRemove: PropTypes.Requireable<(...args: any[]) => any>;
|
|
10
|
+
export const onEdit: PropTypes.Requireable<(...args: any[]) => any>;
|
|
11
|
+
export const getEntryUrl: PropTypes.Requireable<(...args: any[]) => any>;
|
|
12
|
+
export const onEntityFetchComplete: PropTypes.Requireable<(...args: any[]) => any>;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
import PropTypes from "prop-types";
|
|
@@ -2,11 +2,9 @@ export declare const styles: {
|
|
|
2
2
|
icon: string;
|
|
3
3
|
};
|
|
4
4
|
interface EmbeddedEntityBlockToolbarIconProps {
|
|
5
|
-
isButton?: boolean;
|
|
6
5
|
isDisabled: boolean;
|
|
7
|
-
logAction?: () => void;
|
|
8
6
|
nodeType: string;
|
|
9
7
|
onClose: () => void;
|
|
10
8
|
}
|
|
11
|
-
export declare function EmbeddedEntityBlockToolbarIcon({
|
|
9
|
+
export declare function EmbeddedEntityBlockToolbarIcon({ isDisabled, nodeType, onClose, }: EmbeddedEntityBlockToolbarIconProps): JSX.Element;
|
|
12
10
|
export {};
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
import { TrackingPluginActions } from '../../plugins/Tracking';
|
|
2
|
+
export declare function selectEntityAndInsert(nodeType: any, sdk: any, editor: any, logAction: TrackingPluginActions['onToolbarAction'] | TrackingPluginActions['onShortcutAction']): Promise<void>;
|
|
2
3
|
export declare function insertBlock(editor: any, nodeType: any, entity: any): void;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { FieldExtensionSDK } from '@contentful/app-sdk';
|
|
2
|
-
import { TrackingProvider } from 'TrackingProvider';
|
|
3
2
|
import { RichTextPlugin } from '../../types';
|
|
4
3
|
export { EmbeddedEntityBlockToolbarIcon as ToolbarIcon } from './ToolbarIcon';
|
|
5
|
-
export declare const createEmbeddedEntryBlockPlugin: (sdk: FieldExtensionSDK
|
|
6
|
-
export declare const createEmbeddedAssetBlockPlugin: (sdk: FieldExtensionSDK
|
|
4
|
+
export declare const createEmbeddedEntryBlockPlugin: (sdk: FieldExtensionSDK) => RichTextPlugin;
|
|
5
|
+
export declare const createEmbeddedAssetBlockPlugin: (sdk: FieldExtensionSDK) => RichTextPlugin;
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import { FieldExtensionSDK } from '@contentful/app-sdk';
|
|
2
|
-
import { TrackingProvider } from 'TrackingProvider';
|
|
3
2
|
import { RichTextPlugin } from '../../types';
|
|
4
3
|
interface ToolbarEmbeddedEntityInlineButtonProps {
|
|
5
4
|
onClose: () => void;
|
|
6
5
|
isDisabled: boolean;
|
|
7
|
-
isButton?: boolean;
|
|
8
6
|
}
|
|
9
7
|
export declare function ToolbarEmbeddedEntityInlineButton(props: ToolbarEmbeddedEntityInlineButtonProps): JSX.Element;
|
|
10
|
-
export declare function createEmbeddedEntityInlinePlugin(sdk: FieldExtensionSDK
|
|
8
|
+
export declare function createEmbeddedEntityInlinePlugin(sdk: FieldExtensionSDK): RichTextPlugin;
|
|
11
9
|
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export function FetchingWrappedInlineEntryCard(props: any): JSX.Element;
|
|
2
|
+
export namespace FetchingWrappedInlineEntryCard {
|
|
3
|
+
export namespace propTypes {
|
|
4
|
+
export const sdk: PropTypes.Validator<object>;
|
|
5
|
+
export const entryId: PropTypes.Validator<string>;
|
|
6
|
+
export const isDisabled: PropTypes.Validator<boolean>;
|
|
7
|
+
export const isSelected: PropTypes.Validator<boolean>;
|
|
8
|
+
export const isReadOnly: PropTypes.Validator<boolean>;
|
|
9
|
+
export const onRemove: PropTypes.Validator<(...args: any[]) => any>;
|
|
10
|
+
export const onEdit: PropTypes.Validator<(...args: any[]) => any>;
|
|
11
|
+
export const onEntityFetchComplete: PropTypes.Requireable<(...args: any[]) => any>;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
import PropTypes from "prop-types";
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { PlateEditor } from '@udecode/plate-core';
|
|
3
2
|
import * as Slate from 'slate-react';
|
|
4
|
-
import { RichTextPlugin } from '../../types';
|
|
3
|
+
import { RichTextEditor, RichTextPlugin } from '../../types';
|
|
5
4
|
interface ToolbarHrButtonProps {
|
|
6
5
|
isDisabled?: boolean;
|
|
7
6
|
}
|
|
8
|
-
export declare function withHrEvents(editor:
|
|
7
|
+
export declare function withHrEvents(editor: RichTextEditor): (event: React.KeyboardEvent) => void;
|
|
9
8
|
export declare function ToolbarHrButton(props: ToolbarHrButtonProps): JSX.Element | null;
|
|
10
9
|
export declare function Hr(props: Slate.RenderLeafProps): JSX.Element;
|
|
11
10
|
export declare const createHrPlugin: () => RichTextPlugin;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
declare function Hyperlink(props: any): JSX.Element;
|
|
2
|
+
declare namespace Hyperlink {
|
|
3
|
+
export namespace propTypes {
|
|
4
|
+
export const attributes: PropTypes.Validator<object>;
|
|
5
|
+
export const node: PropTypes.Validator<object>;
|
|
6
|
+
export const children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
7
|
+
export const editor: PropTypes.Requireable<object>;
|
|
8
|
+
export const richTextAPI: PropTypes.Validator<object>;
|
|
9
|
+
export const onEdit: PropTypes.Requireable<(...args: any[]) => any>;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
export default Hyperlink;
|
|
13
|
+
import PropTypes from "prop-types";
|
|
@@ -1,8 +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 {
|
|
5
|
-
import {
|
|
3
|
+
import { Path } from 'slate';
|
|
4
|
+
import { TrackingPluginActions } from '../../plugins/Tracking';
|
|
5
|
+
import { RichTextEditor } from '../../types';
|
|
6
6
|
interface HyperlinkModalProps {
|
|
7
7
|
linkText?: string;
|
|
8
8
|
linkType?: string;
|
|
@@ -10,7 +10,8 @@ interface HyperlinkModalProps {
|
|
|
10
10
|
linkEntity?: Link;
|
|
11
11
|
onClose: (value: unknown) => void;
|
|
12
12
|
sdk: FieldExtensionSDK;
|
|
13
|
+
readonly: boolean;
|
|
13
14
|
}
|
|
14
15
|
export declare function HyperlinkModal(props: HyperlinkModalProps): JSX.Element;
|
|
15
|
-
export declare function addOrEditLink(editor:
|
|
16
|
+
export declare function addOrEditLink(editor: RichTextEditor, sdk: FieldExtensionSDK, logAction: TrackingPluginActions['onToolbarAction'] | TrackingPluginActions['onShortcutAction'] | TrackingPluginActions['onViewportAction'], targetPath?: Path): Promise<void>;
|
|
16
17
|
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Link } from '@contentful/app-sdk';
|
|
2
|
+
import { CustomRenderElementProps } from '../../../types';
|
|
3
|
+
declare type HyperlinkElementProps = CustomRenderElementProps<{
|
|
4
|
+
uri?: string;
|
|
5
|
+
target?: Link;
|
|
6
|
+
onEntityFetchComplete?: VoidFunction;
|
|
7
|
+
}>;
|
|
8
|
+
export declare function EntityHyperlink(props: HyperlinkElementProps): JSX.Element | null;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Link } from '@contentful/app-sdk';
|
|
2
|
+
import { CustomRenderElementProps } from '../../../types';
|
|
3
|
+
declare type HyperlinkElementProps = CustomRenderElementProps<{
|
|
4
|
+
uri?: string;
|
|
5
|
+
target?: Link;
|
|
6
|
+
onEntityFetchComplete?: VoidFunction;
|
|
7
|
+
}>;
|
|
8
|
+
export declare function UrlHyperlink(props: HyperlinkElementProps): JSX.Element;
|
|
9
|
+
export {};
|
|
@@ -1,9 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import { RichTextPlugin } from '../../types';
|
|
4
|
-
interface ToolbarHyperlinkButtonProps {
|
|
5
|
-
isDisabled: boolean | undefined;
|
|
6
|
-
}
|
|
7
|
-
export declare function ToolbarHyperlinkButton(props: ToolbarHyperlinkButtonProps): JSX.Element | null;
|
|
8
|
-
export declare const createHyperlinkPlugin: (sdk: FieldExtensionSDK, tracking: TrackingProvider) => RichTextPlugin;
|
|
9
|
-
export {};
|
|
1
|
+
export { ToolbarHyperlinkButton } from './components/ToolbarHyperlinkButton';
|
|
2
|
+
export { createHyperlinkPlugin } from './createHyperlinkPlugin';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { FieldExtensionSDK, Link, Entry, Asset, ScheduledAction } from '@contentful/app-sdk';
|
|
2
|
+
import { entityHelpers } from '@contentful/field-editor-shared';
|
|
3
|
+
export declare type FetchedEntityData = {
|
|
4
|
+
jobs: ScheduledAction[];
|
|
5
|
+
entity: Entry | Asset;
|
|
6
|
+
entityTitle: string;
|
|
7
|
+
entityDescription: string;
|
|
8
|
+
entityStatus: ReturnType<typeof entityHelpers.getEntryStatus>;
|
|
9
|
+
contentTypeName: string;
|
|
10
|
+
};
|
|
11
|
+
export declare type EntityInfoProps = {
|
|
12
|
+
target: Link;
|
|
13
|
+
sdk: FieldExtensionSDK;
|
|
14
|
+
onEntityFetchComplete?: VoidFunction;
|
|
15
|
+
};
|
|
16
|
+
export declare function useEntityInfo(props: EntityInfoProps): string;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
-
import { PlateEditor } from '@udecode/plate-core';
|
|
2
1
|
import { NodeEntry, Node } from 'slate';
|
|
3
|
-
|
|
2
|
+
import { RichTextEditor } from '../../types';
|
|
3
|
+
import { FetchedEntityData } from './useEntityInfo';
|
|
4
|
+
export declare const hasText: (editor: RichTextEditor, entry: NodeEntry<Node>) => boolean;
|
|
5
|
+
export declare function getEntityInfo(data?: FetchedEntityData): string;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare const insertListBreak: (editor:
|
|
1
|
+
import { RichTextEditor } from '../../types';
|
|
2
|
+
export declare const insertListBreak: (editor: RichTextEditor) => () => void;
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { TDescendant } from '@udecode/plate-core';
|
|
2
|
+
import { RichTextEditor } from '../../types';
|
|
3
|
+
export declare const insertListFragment: (editor: RichTextEditor) => (fragment: TDescendant[]) => void;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Credit: Modified version of Plate's list plugin
|
|
3
|
+
* See: https://github.com/udecode/plate/blob/main/packages/nodes/list
|
|
4
|
+
*/
|
|
5
|
+
import { HotkeyPlugin, KeyboardHandler } from '@udecode/plate-core';
|
|
6
|
+
import { RichTextEditor } from '../../types';
|
|
7
|
+
export declare const onKeyDownList: KeyboardHandler<RichTextEditor, HotkeyPlugin>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { RichTextEditor } from '../../../types';
|
|
2
2
|
/**
|
|
3
3
|
* Insert list item if selection is in li>p.
|
|
4
4
|
*/
|
|
5
|
-
export declare const insertListItem: (editor:
|
|
5
|
+
export declare const insertListItem: (editor: RichTextEditor) => boolean;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Credit: Modified version of Plate's list plugin
|
|
3
|
+
* See: https://github.com/udecode/plate/blob/main/packages/nodes/list
|
|
4
|
+
*/
|
|
5
|
+
import { PlateEditor, TElement } from '@udecode/plate-core';
|
|
6
|
+
import { NodeEntry } from 'slate';
|
|
7
|
+
export interface MoveListItemDownOptions {
|
|
8
|
+
list: NodeEntry<TElement>;
|
|
9
|
+
listItem: NodeEntry<TElement>;
|
|
10
|
+
}
|
|
11
|
+
export declare const moveListItemDown: (editor: PlateEditor, { list, listItem }: MoveListItemDownOptions) => void;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Credit: Modified version of Plate's list plugin
|
|
3
|
+
* See: https://github.com/udecode/plate/blob/main/packages/nodes/list
|
|
4
|
+
*/
|
|
5
|
+
import { EditorNodesOptions, PlateEditor } from '@udecode/plate-core';
|
|
6
|
+
export declare type MoveListItemsOptions = {
|
|
7
|
+
increase?: boolean;
|
|
8
|
+
at?: EditorNodesOptions['at'];
|
|
9
|
+
};
|
|
10
|
+
export declare const moveListItems: (editor: PlateEditor, { increase, at }?: MoveListItemsOptions) => void;
|
|
@@ -1,11 +1,15 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { BLOCKS } from '@contentful/rich-text-types';
|
|
2
2
|
import { NodeEntry, Node } from 'slate';
|
|
3
|
-
|
|
3
|
+
import { CustomElement, RichTextEditor } from '../../types';
|
|
4
|
+
export declare const hasListAsDirectParent: (editor: RichTextEditor, [, path]: NodeEntry<Node>) => boolean;
|
|
4
5
|
/**
|
|
5
6
|
* Places orphaned list items in a list. If there's a list somewhere
|
|
6
7
|
* in the node's ancestors, defaults to that list type, else places
|
|
7
8
|
* the list item in an unordered list.
|
|
8
9
|
*/
|
|
9
|
-
export declare const normalizeOrphanedListItem: (editor:
|
|
10
|
-
export declare const isNonEmptyListItem: (editor:
|
|
11
|
-
export declare const
|
|
10
|
+
export declare const normalizeOrphanedListItem: (editor: RichTextEditor, [, path]: NodeEntry<Node>) => void;
|
|
11
|
+
export declare const isNonEmptyListItem: (editor: RichTextEditor, [, path]: NodeEntry<Node>) => boolean;
|
|
12
|
+
export declare const firstNodeIsNotList: (_editor: RichTextEditor, [node]: NodeEntry<CustomElement<unknown>>) => boolean;
|
|
13
|
+
export declare const insertParagraphAsChild: (editor: RichTextEditor, [, path]: NodeEntry<Node>) => void;
|
|
14
|
+
export declare const replaceNodeWithListItems: (editor: any, entry: any) => void;
|
|
15
|
+
export declare const isListTypeActive: (editor: RichTextEditor, type: BLOCKS) => boolean;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import { WithOverride } from '@udecode/plate-core';
|
|
2
2
|
import { ListPlugin } from '@udecode/plate-list';
|
|
3
|
-
|
|
3
|
+
import { RichTextEditor } from '../../types';
|
|
4
|
+
export declare const withList: WithOverride<RichTextEditor, ListPlugin>;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
import { MARKS } from '@contentful/rich-text-types';
|
|
1
2
|
import * as Slate from 'slate-react';
|
|
2
3
|
import { RichTextPlugin } from '../../types';
|
|
3
|
-
|
|
4
|
-
isDisabled
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
export declare const ToolbarBoldButton: {
|
|
5
|
+
({ isDisabled }: {
|
|
6
|
+
isDisabled?: boolean | undefined;
|
|
7
|
+
}): JSX.Element | null;
|
|
8
|
+
displayName: MARKS;
|
|
9
|
+
};
|
|
7
10
|
export declare function Bold(props: Slate.RenderLeafProps): JSX.Element;
|
|
8
11
|
export declare const createBoldPlugin: () => RichTextPlugin;
|
|
9
|
-
export {};
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
import { MARKS } from '@contentful/rich-text-types';
|
|
1
2
|
import * as Slate from 'slate-react';
|
|
2
3
|
import { RichTextPlugin } from '../../types';
|
|
3
|
-
|
|
4
|
-
isDisabled
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
export declare const ToolbarCodeButton: {
|
|
5
|
+
({ isDisabled }: {
|
|
6
|
+
isDisabled?: boolean | undefined;
|
|
7
|
+
}): JSX.Element | null;
|
|
8
|
+
displayName: MARKS;
|
|
9
|
+
};
|
|
7
10
|
export declare function Code(props: Slate.RenderLeafProps): JSX.Element;
|
|
8
11
|
export declare const createCodePlugin: () => RichTextPlugin;
|
|
9
|
-
export {};
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
import { MARKS } from '@contentful/rich-text-types';
|
|
1
2
|
import * as Slate from 'slate-react';
|
|
2
3
|
import { RichTextPlugin } from '../../types';
|
|
3
|
-
|
|
4
|
-
isDisabled
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
export declare const ToolbarItalicButton: {
|
|
5
|
+
({ isDisabled }: {
|
|
6
|
+
isDisabled?: boolean | undefined;
|
|
7
|
+
}): JSX.Element | null;
|
|
8
|
+
displayName: MARKS;
|
|
9
|
+
};
|
|
7
10
|
export declare function Italic(props: Slate.RenderLeafProps): JSX.Element;
|
|
8
11
|
export declare const createItalicPlugin: () => RichTextPlugin;
|
|
9
|
-
export {};
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
import { MARKS } from '@contentful/rich-text-types';
|
|
1
2
|
import * as Slate from 'slate-react';
|
|
2
3
|
import { RichTextPlugin } from '../../types';
|
|
3
|
-
|
|
4
|
-
isDisabled
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
export declare const ToolbarUnderlineButton: {
|
|
5
|
+
({ isDisabled }: {
|
|
6
|
+
isDisabled?: boolean | undefined;
|
|
7
|
+
}): JSX.Element | null;
|
|
8
|
+
displayName: MARKS;
|
|
9
|
+
};
|
|
7
10
|
export declare function Underline(props: Slate.RenderLeafProps): JSX.Element;
|
|
8
11
|
export declare const createUnderlinePlugin: () => RichTextPlugin;
|
|
9
|
-
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { MARKS } from '@contentful/rich-text-types';
|
|
3
|
+
export interface MarkOptions {
|
|
4
|
+
mark: MARKS;
|
|
5
|
+
title: string;
|
|
6
|
+
icon: React.ReactElement;
|
|
7
|
+
}
|
|
8
|
+
export declare const createMarkToolbarButton: ({ mark, title, icon }: MarkOptions) => {
|
|
9
|
+
({ isDisabled }: {
|
|
10
|
+
isDisabled?: boolean | undefined;
|
|
11
|
+
}): JSX.Element | null;
|
|
12
|
+
displayName: MARKS;
|
|
13
|
+
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { MARKS } from '@contentful/rich-text-types';
|
|
2
|
+
import { HotkeyPlugin, KeyboardHandler } from '@udecode/plate-core';
|
|
3
|
+
import { RichTextEditor } from '../../types';
|
|
4
|
+
export declare const buildMarkEventHandler: (type: MARKS) => KeyboardHandler<RichTextEditor, HotkeyPlugin>;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { NodeMatch } from '@udecode/plate-core';
|
|
2
2
|
import { NodeEntry } from 'slate';
|
|
3
|
-
|
|
4
|
-
export declare type
|
|
3
|
+
import { RichTextEditor } from '../../types';
|
|
4
|
+
export declare type NodeTransformer = (editor: RichTextEditor, entry: NodeEntry) => void;
|
|
5
|
+
export declare type NodeValidator = (editor: RichTextEditor, entry: NodeEntry) => boolean;
|
|
5
6
|
declare type BaseRule = {
|
|
6
7
|
/**
|
|
7
8
|
* A helper to return a Node to which valid* rules are applied
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { PlateEditor } from '@udecode/plate-core';
|
|
2
1
|
import { NodeEntry, Node } from 'slate';
|
|
2
|
+
import { RichTextEditor } from 'types';
|
|
3
3
|
import { NodeValidator, NodeTransformer } from './types';
|
|
4
4
|
export declare class NormalizerError extends Error {
|
|
5
5
|
}
|
|
6
6
|
export declare const createValidatorFromTypes: (types: string[]) => NodeValidator;
|
|
7
|
-
export declare const getChildren: (editor:
|
|
7
|
+
export declare const getChildren: (editor: RichTextEditor, [node, path]: NodeEntry<Node>) => NodeEntry[];
|
|
8
8
|
export declare const createTransformerFromObject: (transforms: Record<string, NodeTransformer>) => NodeTransformer;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare const withNormalizer:
|
|
1
|
+
import { RichTextEditor } from '../../types';
|
|
2
|
+
export declare const withNormalizer: (editor: RichTextEditor) => RichTextEditor;
|
|
@@ -1,2 +1,8 @@
|
|
|
1
1
|
import { RichTextPlugin } from '../../types';
|
|
2
|
+
export declare const getSlateFragmentAttribute: (dataTransfer: DataTransfer) => string | void;
|
|
3
|
+
/**
|
|
4
|
+
* Get the x-slate-fragment attribute that exist in text/html data
|
|
5
|
+
* and append it to the DataTransfer object
|
|
6
|
+
*/
|
|
7
|
+
export declare const ensureXSlateFragment: (dataTransfer: DataTransfer) => DataTransfer;
|
|
2
8
|
export declare const createPasteHTMLPlugin: () => RichTextPlugin;
|