@contentful/field-editor-rich-text 2.0.0-next.21 → 2.0.0-next.22
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 +492 -250
- 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 +494 -252
- package/dist/field-editor-rich-text.esm.js.map +1 -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/test-utils/jsx.d.ts +1 -1
- package/dist/useOnValueChanged.d.ts +4 -3
- package/package.json +13 -13
- package/dist/useNormalizedSlateValue.d.ts +0 -7
|
@@ -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[];
|
package/dist/test-utils/jsx.d.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Add items as needed. Don't forget to adjust hyperscript.d.ts
|
|
5
5
|
*/
|
|
6
|
-
export declare const jsx: <S extends "
|
|
6
|
+
export declare const jsx: <S extends "editor" | "text" | "selection" | "element" | "focus" | "anchor" | "cursor" | "fragment">(tagName: S, attributes?: Object | undefined, ...children: any[]) => ReturnType<({
|
|
7
7
|
anchor: typeof import("slate-hyperscript/dist/creators").createAnchor;
|
|
8
8
|
cursor: typeof import("slate-hyperscript/dist/creators").createCursor;
|
|
9
9
|
editor: (tagName: string, attributes: {
|
|
@@ -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.22",
|
|
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[];
|