@contentful/field-editor-rich-text 2.0.0-next.21 → 2.0.0-next.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/field-editor-rich-text.cjs.development.js +774 -493
- 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 +776 -495
- package/dist/field-editor-rich-text.esm.js.map +1 -1
- package/dist/helpers/editor.d.ts +1 -1
- package/dist/plugins/Hyperlink/HyperlinkModal.d.ts +2 -1
- package/dist/plugins/List/onKeyDownList.d.ts +7 -0
- package/dist/plugins/List/transforms/moveListItemDown.d.ts +11 -0
- package/dist/plugins/List/transforms/moveListItems.d.ts +10 -0
- package/dist/prepareDocument.d.ts +20 -0
- package/dist/useOnValueChanged.d.ts +4 -3
- package/package.json +13 -13
- package/dist/useNormalizedSlateValue.d.ts +0 -7
package/dist/helpers/editor.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ export declare function isBlockSelected(editor: PlateEditor, type: string): bool
|
|
|
8
8
|
export declare function isRootLevel(path: Path): boolean;
|
|
9
9
|
declare type NodeEntry = [CustomElement, Path];
|
|
10
10
|
declare type NodeType = BLOCKS | INLINES;
|
|
11
|
-
export declare function getNodeEntryFromSelection(editor: RichTextEditor, nodeTypeOrTypes: NodeType | NodeType[]): NodeEntry | [];
|
|
11
|
+
export declare function getNodeEntryFromSelection(editor: RichTextEditor, nodeTypeOrTypes: NodeType | NodeType[], path?: Path): NodeEntry | [];
|
|
12
12
|
export declare function isNodeTypeSelected(editor: RichTextEditor, nodeType: BLOCKS | INLINES): boolean;
|
|
13
13
|
export declare function moveToTheNextLine(editor: RichTextEditor): void;
|
|
14
14
|
export declare function moveToTheNextChar(editor: RichTextEditor): void;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Link } from '@contentful/field-editor-reference/dist/types';
|
|
2
2
|
import { FieldExtensionSDK } from '@contentful/field-editor-shared';
|
|
3
|
+
import { Path } from 'slate';
|
|
3
4
|
import { TrackingPluginActions } from '../../plugins/Tracking';
|
|
4
5
|
import { RichTextEditor } from '../../types';
|
|
5
6
|
interface HyperlinkModalProps {
|
|
@@ -11,5 +12,5 @@ interface HyperlinkModalProps {
|
|
|
11
12
|
sdk: FieldExtensionSDK;
|
|
12
13
|
}
|
|
13
14
|
export declare function HyperlinkModal(props: HyperlinkModalProps): JSX.Element;
|
|
14
|
-
export declare function addOrEditLink(editor: RichTextEditor, sdk: FieldExtensionSDK, logAction: TrackingPluginActions['onToolbarAction'] | TrackingPluginActions['onShortcutAction'] | TrackingPluginActions['onViewportAction']): Promise<void>;
|
|
15
|
+
export declare function addOrEditLink(editor: RichTextEditor, sdk: FieldExtensionSDK, logAction: TrackingPluginActions['onToolbarAction'] | TrackingPluginActions['onShortcutAction'] | TrackingPluginActions['onViewportAction'], targetPath?: Path): Promise<void>;
|
|
15
16
|
export {};
|
|
@@ -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>;
|
|
@@ -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;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Document } from '@contentful/rich-text-types';
|
|
2
|
+
import { CreatePlateEditorOptions } from '@udecode/plate-core';
|
|
3
|
+
import { Descendant, Editor, Node } from 'slate';
|
|
4
|
+
import { RichTextEditor } from 'types';
|
|
5
|
+
/**
|
|
6
|
+
* For legacy reasons, a document may not have any content at all
|
|
7
|
+
* e.g:
|
|
8
|
+
*
|
|
9
|
+
* {nodeType: document, data: {}, content: []}
|
|
10
|
+
*
|
|
11
|
+
* Rendering such document will break the Slate editor
|
|
12
|
+
*/
|
|
13
|
+
export declare const hasContent: (doc?: Document | undefined) => boolean;
|
|
14
|
+
export declare const setEditorContent: (editor: Editor, nodes?: Node[] | undefined) => void;
|
|
15
|
+
/**
|
|
16
|
+
* Converts a contenful rich text document to the corresponding slate editor
|
|
17
|
+
* value
|
|
18
|
+
*/
|
|
19
|
+
export declare const documentToEditorValue: (doc: any) => any;
|
|
20
|
+
export declare const normalizeEditorValue: (value: Descendant[], options?: Pick<CreatePlateEditorOptions<RichTextEditor>, "plugins" | "disableCorePlugins" | "components" | "overrideByKey"> | undefined) => Descendant[] & any[];
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { Document } from '@contentful/rich-text-types';
|
|
2
|
-
import { PlateEditor } from '@udecode/plate-core';
|
|
3
2
|
export declare type OnValueChangedProps = {
|
|
4
|
-
|
|
3
|
+
editorId: string;
|
|
5
4
|
handler?: (value: Document) => unknown;
|
|
5
|
+
skip?: boolean;
|
|
6
|
+
onSkip?: VoidFunction;
|
|
6
7
|
};
|
|
7
|
-
export declare const useOnValueChanged: ({
|
|
8
|
+
export declare const useOnValueChanged: ({ editorId, handler, skip, onSkip }: OnValueChangedProps) => (value: unknown) => void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentful/field-editor-rich-text",
|
|
3
|
-
"version": "2.0.0-next.
|
|
3
|
+
"version": "2.0.0-next.24",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"tag": "next"
|
|
6
6
|
},
|
|
@@ -35,23 +35,23 @@
|
|
|
35
35
|
"@contentful/field-editor-shared": "^1.0.3",
|
|
36
36
|
"@contentful/rich-text-plain-text-renderer": "^15.11.1",
|
|
37
37
|
"@contentful/rich-text-types": "^15.11.1",
|
|
38
|
-
"@udecode/plate-basic-marks": "^
|
|
39
|
-
"@udecode/plate-break": "^
|
|
40
|
-
"@udecode/plate-core": "^
|
|
41
|
-
"@udecode/plate-list": "^
|
|
42
|
-
"@udecode/plate-paragraph": "^
|
|
43
|
-
"@udecode/plate-reset-node": "^
|
|
44
|
-
"@udecode/plate-select": "^
|
|
45
|
-
"@udecode/plate-serializer-docx": "^
|
|
46
|
-
"@udecode/plate-table": "^
|
|
47
|
-
"@udecode/plate-trailing-block": "^
|
|
38
|
+
"@udecode/plate-basic-marks": "^10.4.0",
|
|
39
|
+
"@udecode/plate-break": "^10.4.0",
|
|
40
|
+
"@udecode/plate-core": "^10.4.0",
|
|
41
|
+
"@udecode/plate-list": "^10.4.0",
|
|
42
|
+
"@udecode/plate-paragraph": "^10.4.0",
|
|
43
|
+
"@udecode/plate-reset-node": "^10.4.0",
|
|
44
|
+
"@udecode/plate-select": "^10.4.0",
|
|
45
|
+
"@udecode/plate-serializer-docx": "^10.4.0",
|
|
46
|
+
"@udecode/plate-table": "^10.4.0",
|
|
47
|
+
"@udecode/plate-trailing-block": "^10.4.0",
|
|
48
48
|
"fast-deep-equal": "^3.1.3",
|
|
49
49
|
"is-hotkey": "^0.2.0",
|
|
50
50
|
"is-plain-obj": "^3.0.0",
|
|
51
|
-
"slate": "^0.72.
|
|
51
|
+
"slate": "^0.72.8",
|
|
52
52
|
"slate-history": "^0.66.0",
|
|
53
53
|
"slate-hyperscript": "^0.67.0",
|
|
54
|
-
"slate-react": "^0.72.
|
|
54
|
+
"slate-react": "^0.72.9"
|
|
55
55
|
},
|
|
56
56
|
"peerDependencies": {
|
|
57
57
|
"react": ">=16.14.0",
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { RichTextPlugin } from './types';
|
|
2
|
-
export declare type NormalizedSlateValueProps = {
|
|
3
|
-
id: string;
|
|
4
|
-
incomingDoc: any;
|
|
5
|
-
plugins: RichTextPlugin[];
|
|
6
|
-
};
|
|
7
|
-
export declare const useNormalizedSlateValue: ({ id, incomingDoc, plugins, }: NormalizedSlateValueProps) => import("slate").Descendant[] & any[];
|