@contentful/field-editor-rich-text 2.0.0-next.2 → 2.0.0-next.6
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/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 +3972 -3632
- 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 +4445 -4105
- package/dist/field-editor-rich-text.esm.js.map +1 -1
- package/dist/helpers/editor.d.ts +6 -12
- package/dist/helpers/extractNodes.d.ts +7 -0
- package/dist/helpers/sanitizeSlateDoc.d.ts +1 -14
- 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 +3 -4
- 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 +11 -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/actions/addColumn.d.ts +2 -1
- package/dist/plugins/Table/actions/addRow.d.ts +1 -1
- package/dist/plugins/Table/actions/setHeader.d.ts +1 -1
- 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 -1
- 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 -2
- 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 +4 -178
- 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 +9 -2
- package/dist/test-utils/index.d.ts +2 -0
- package/dist/test-utils/jsx.d.ts +2 -2
- 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/package.json +27 -17
- package/dist/helpers/deserializer.d.ts +0 -3
- package/dist/helpers/normalizers.d.ts +0 -15
- 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/plugins/Table/normalizers.d.ts +0 -2
|
@@ -1,7 +1,14 @@
|
|
|
1
1
|
import { FieldExtensionSDK } from '@contentful/app-sdk';
|
|
2
|
+
import { PlateEditor } from '@udecode/plate-core';
|
|
2
3
|
import { TrackingProvider } from '../TrackingProvider';
|
|
4
|
+
import { RichTextPlugin } from '../types';
|
|
5
|
+
export declare const normalize: (editor: PlateEditor) => void;
|
|
3
6
|
export declare const createTestEditor: (options: {
|
|
4
|
-
input
|
|
7
|
+
input?: any;
|
|
5
8
|
sdk?: FieldExtensionSDK;
|
|
6
9
|
tracking?: TrackingProvider;
|
|
7
|
-
|
|
10
|
+
plugins?: RichTextPlugin[];
|
|
11
|
+
}) => {
|
|
12
|
+
editor: PlateEditor<{}>;
|
|
13
|
+
normalize: () => void;
|
|
14
|
+
};
|
package/dist/test-utils/jsx.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Mapping for JSX => Slate Node types
|
|
3
3
|
*
|
|
4
|
-
* Add items as needed.
|
|
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" | "selection" | "text" | "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: {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function validateRichTextDocument(document: any): never[];
|
package/dist/types.d.ts
CHANGED
|
@@ -1,10 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import { RenderElementProps
|
|
4
|
-
|
|
1
|
+
import { MARKS } from '@contentful/rich-text-types';
|
|
2
|
+
import { PlatePlugin } from '@udecode/plate-core';
|
|
3
|
+
import { RenderElementProps } from 'slate-react';
|
|
4
|
+
import type { SoftBreakRule, ExitBreakRule } from './plugins/Break';
|
|
5
|
+
import type { NormalizerRule } from './plugins/Normalizer';
|
|
6
|
+
export declare type CustomText = {
|
|
5
7
|
text: string;
|
|
8
|
+
[MARKS.BOLD]?: boolean;
|
|
9
|
+
[MARKS.CODE]?: boolean;
|
|
10
|
+
[MARKS.ITALIC]?: boolean;
|
|
11
|
+
[MARKS.UNDERLINE]?: boolean;
|
|
6
12
|
};
|
|
7
|
-
export declare type TextOrCustomElement = CustomElement |
|
|
13
|
+
export declare type TextOrCustomElement = CustomElement | CustomText;
|
|
8
14
|
export declare type CustomElement<T = unknown> = {
|
|
9
15
|
type: string;
|
|
10
16
|
children: TextOrCustomElement[];
|
|
@@ -14,12 +20,23 @@ export declare type CustomElement<T = unknown> = {
|
|
|
14
20
|
export declare type CustomRenderElementProps<T = any, O = any> = Omit<RenderElementProps, 'element'> & {
|
|
15
21
|
element: CustomElement<T>;
|
|
16
22
|
} & O;
|
|
17
|
-
export interface CustomPluginOptions extends Omit<PlatePluginOptions, 'component'> {
|
|
18
|
-
component?: React.FunctionComponent<CustomRenderElementProps> | React.FunctionComponent<RenderLeafProps>;
|
|
19
|
-
}
|
|
20
|
-
export declare type CustomSlatePluginOptions = Record<string, CustomPluginOptions>;
|
|
21
23
|
declare module 'slate' {
|
|
22
24
|
interface CustomTypes {
|
|
23
25
|
Element: CustomElement;
|
|
26
|
+
Text: CustomText;
|
|
24
27
|
}
|
|
25
28
|
}
|
|
29
|
+
export interface RichTextPlugin extends PlatePlugin {
|
|
30
|
+
/**
|
|
31
|
+
* @see createSoftBreakPlugin
|
|
32
|
+
*/
|
|
33
|
+
softBreak?: SoftBreakRule[];
|
|
34
|
+
/**
|
|
35
|
+
* @see createExitBreakPlugin
|
|
36
|
+
*/
|
|
37
|
+
exitBreak?: ExitBreakRule[];
|
|
38
|
+
/**
|
|
39
|
+
* @see createNormalizerPlugin
|
|
40
|
+
*/
|
|
41
|
+
normalizer?: NormalizerRule[];
|
|
42
|
+
}
|
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.6",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"tag": "next"
|
|
6
6
|
},
|
|
@@ -27,27 +27,34 @@
|
|
|
27
27
|
"prepublishOnly": "yarn build"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@contentful/contentful-slatejs-adapter": "^15.
|
|
31
|
-
"@contentful/f36-components": "beta",
|
|
32
|
-
"@contentful/f36-icons": "beta",
|
|
33
|
-
"@contentful/f36-tokens": "beta",
|
|
34
|
-
"@contentful/field-editor-reference": "^4.0.
|
|
35
|
-
"@contentful/field-editor-shared": "^1.0.
|
|
36
|
-
"@contentful/rich-text-plain-text-renderer": "^15.
|
|
37
|
-
"@contentful/rich-text-types": "^15.
|
|
38
|
-
"@udecode/plate": "^
|
|
39
|
-
"@udecode/plate-
|
|
30
|
+
"@contentful/contentful-slatejs-adapter": "^15.11.0",
|
|
31
|
+
"@contentful/f36-components": "^4.0.1-beta.2705",
|
|
32
|
+
"@contentful/f36-icons": "^4.0.1-beta.2705",
|
|
33
|
+
"@contentful/f36-tokens": "^4.0.1-beta.2705",
|
|
34
|
+
"@contentful/field-editor-reference": "^4.0.7",
|
|
35
|
+
"@contentful/field-editor-shared": "^1.0.3",
|
|
36
|
+
"@contentful/rich-text-plain-text-renderer": "^15.11.1",
|
|
37
|
+
"@contentful/rich-text-types": "^15.11.1",
|
|
38
|
+
"@udecode/plate-basic-marks": "^9.2.1",
|
|
39
|
+
"@udecode/plate-break": "^9.2.1",
|
|
40
|
+
"@udecode/plate-core": "^9.2.1",
|
|
41
|
+
"@udecode/plate-list": "^9.2.1",
|
|
42
|
+
"@udecode/plate-paragraph": "^9.2.1",
|
|
43
|
+
"@udecode/plate-select": "^9.2.1",
|
|
44
|
+
"@udecode/plate-serializer-docx": "^9.2.1",
|
|
45
|
+
"@udecode/plate-table": "^9.2.1",
|
|
46
|
+
"@udecode/plate-trailing-block": "^9.2.1",
|
|
40
47
|
"fast-deep-equal": "^3.1.3",
|
|
41
|
-
"
|
|
42
|
-
"
|
|
48
|
+
"is-hotkey": "^0.2.0",
|
|
49
|
+
"is-plain-obj": "^3.0.0",
|
|
50
|
+
"slate": "^0.72.3",
|
|
43
51
|
"slate-history": "^0.66.0",
|
|
44
52
|
"slate-hyperscript": "^0.67.0",
|
|
45
|
-
"slate-react": "^0.
|
|
53
|
+
"slate-react": "^0.72.6"
|
|
46
54
|
},
|
|
47
55
|
"peerDependencies": {
|
|
48
56
|
"react": ">=16.14.0",
|
|
49
|
-
"react-dom": ">=16.14.0"
|
|
50
|
-
"slate": "^0.66.1"
|
|
57
|
+
"react-dom": ">=16.14.0"
|
|
51
58
|
},
|
|
52
59
|
"devDependencies": {
|
|
53
60
|
"@babel/core": "^7.9.6",
|
|
@@ -59,6 +66,9 @@
|
|
|
59
66
|
"@babel/preset-env": "7.12.11",
|
|
60
67
|
"@babel/preset-react": "7.13.13",
|
|
61
68
|
"@contentful/field-editor-test-utils": "^1.0.0",
|
|
62
|
-
"@contentful/rich-text-react-renderer": "^15.
|
|
69
|
+
"@contentful/rich-text-react-renderer": "^15.11.0",
|
|
70
|
+
"@types/is-hotkey": "^0.1.6",
|
|
71
|
+
"@udecode/plate-test-utils": "^3.2.0",
|
|
72
|
+
"react": ">=16.14.0"
|
|
63
73
|
}
|
|
64
74
|
}
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { Deserialize, GetNodeDeserializerRule } from '@udecode/plate';
|
|
2
|
-
export declare function deserializeLeaf(type: string, rules: GetNodeDeserializerRule[]): Deserialize;
|
|
3
|
-
export declare function deserializeElement(type: string, rules: GetNodeDeserializerRule[]): Deserialize;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { NodeEntry } from 'slate';
|
|
2
|
-
import { PlateEditor } from '@udecode/plate-core';
|
|
3
|
-
import { CustomElement } from '../types';
|
|
4
|
-
export declare type Normalizer = (editor: PlateEditor, entry: NodeEntry<CustomElement>) => true | undefined;
|
|
5
|
-
/**
|
|
6
|
-
* Injects a custom element normalization handler.
|
|
7
|
-
*
|
|
8
|
-
* Handlers must explicity return "true" to indicate a pass.
|
|
9
|
-
* A pass is when a handler didn't encounter any normalization
|
|
10
|
-
* paths (i.e. all nodes were valid)
|
|
11
|
-
*
|
|
12
|
-
* Important read:
|
|
13
|
-
* https://docs.slatejs.org/concepts/11-normalizing#multi-pass-normalizing
|
|
14
|
-
*/
|
|
15
|
-
export declare const withNormalizer: (editor: PlateEditor, handler: Normalizer) => void;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function truncate(str: any, length: any): any;
|
|
@@ -1,37 +0,0 @@
|
|
|
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";
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* A copy of Plate's list plugin with a few adjustments
|
|
3
|
-
* to fix pasting text inside lists.
|
|
4
|
-
*/
|
|
5
|
-
import { PlateEditor, TDescendant } from '@udecode/plate';
|
|
6
|
-
export declare const getListInsertFragment: (editor: PlateEditor) => (fragment: TDescendant[]) => void;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { PlateEditor } from '@udecode/plate';
|
|
2
|
-
export declare type SanitizerTuple = [Document, PlateEditor];
|
|
3
|
-
declare type Predicate = (node: ChildNode) => boolean;
|
|
4
|
-
export declare const isHTMLElement: (node: ChildNode) => node is HTMLElement;
|
|
5
|
-
export declare const removeChildNodes: (node: ChildNode, predicate?: Predicate) => void;
|
|
6
|
-
export declare const removeChildNodesUsingPredicate: (predicate: Predicate) => (nodeList: NodeList) => Node[];
|
|
7
|
-
export {};
|