@contentful/field-editor-rich-text 4.17.1 → 4.17.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.
|
@@ -82,12 +82,13 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
82
82
|
return newObj;
|
|
83
83
|
}
|
|
84
84
|
const ConnectedRichTextEditor = (props)=>{
|
|
85
|
-
const { sdk, onAction, restrictedMarks } = props;
|
|
85
|
+
const { sdk, onAction, restrictedMarks, withCharValidation } = props;
|
|
86
86
|
const id = (0, _ContentfulEditorProvider.getContentfulEditorId)(sdk);
|
|
87
|
-
const plugins = _react.useMemo(()=>(0, _plugins.getPlugins)(sdk, onAction ?? _noop.default, restrictedMarks), [
|
|
87
|
+
const plugins = _react.useMemo(()=>(0, _plugins.getPlugins)(sdk, onAction ?? _noop.default, restrictedMarks, withCharValidation), [
|
|
88
88
|
sdk,
|
|
89
89
|
onAction,
|
|
90
|
-
restrictedMarks
|
|
90
|
+
restrictedMarks,
|
|
91
|
+
withCharValidation
|
|
91
92
|
]);
|
|
92
93
|
const initialValue = _react.useMemo(()=>{
|
|
93
94
|
return (0, _misc.normalizeInitialValue)({
|
|
@@ -41,7 +41,7 @@ const _Text = require("./Text");
|
|
|
41
41
|
const _Tracking = require("./Tracking");
|
|
42
42
|
const _TrailingParagraph = require("./TrailingParagraph");
|
|
43
43
|
const _Voids = require("./Voids");
|
|
44
|
-
const getPlugins = (sdk, onAction, restrictedMarks)=>[
|
|
44
|
+
const getPlugins = (sdk, onAction, restrictedMarks, withCharValidation)=>[
|
|
45
45
|
(0, _DeserializeDocx.createDeserializeDocxPlugin)(),
|
|
46
46
|
(0, _Tracking.createTrackingPlugin)(onAction),
|
|
47
47
|
(0, _DragAndDrop.createDragAndDropPlugin)(),
|
|
@@ -66,7 +66,9 @@ const getPlugins = (sdk, onAction, restrictedMarks)=>[
|
|
|
66
66
|
(0, _Voids.createVoidsPlugin)(),
|
|
67
67
|
(0, _SelectOnBackspace.createSelectOnBackspacePlugin)(),
|
|
68
68
|
(0, _PasteHTML.createPasteHTMLPlugin)(),
|
|
69
|
-
|
|
69
|
+
...withCharValidation ? [
|
|
70
|
+
(0, _CharCounter.createCharCounterPlugin)()
|
|
71
|
+
] : [],
|
|
70
72
|
(0, _Break.createSoftBreakPlugin)(),
|
|
71
73
|
(0, _Break.createExitBreakPlugin)(),
|
|
72
74
|
(0, _Break.createResetNodePlugin)(),
|
|
@@ -18,12 +18,13 @@ import { SyncEditorChanges } from './SyncEditorChanges';
|
|
|
18
18
|
import Toolbar from './Toolbar';
|
|
19
19
|
import StickyToolbarWrapper from './Toolbar/components/StickyToolbarWrapper';
|
|
20
20
|
export const ConnectedRichTextEditor = (props)=>{
|
|
21
|
-
const { sdk, onAction, restrictedMarks } = props;
|
|
21
|
+
const { sdk, onAction, restrictedMarks, withCharValidation } = props;
|
|
22
22
|
const id = getContentfulEditorId(sdk);
|
|
23
|
-
const plugins = React.useMemo(()=>getPlugins(sdk, onAction ?? noop, restrictedMarks), [
|
|
23
|
+
const plugins = React.useMemo(()=>getPlugins(sdk, onAction ?? noop, restrictedMarks, withCharValidation), [
|
|
24
24
|
sdk,
|
|
25
25
|
onAction,
|
|
26
|
-
restrictedMarks
|
|
26
|
+
restrictedMarks,
|
|
27
|
+
withCharValidation
|
|
27
28
|
]);
|
|
28
29
|
const initialValue = React.useMemo(()=>{
|
|
29
30
|
return normalizeInitialValue({
|
|
@@ -23,7 +23,7 @@ import { createTextPlugin } from './Text';
|
|
|
23
23
|
import { createTrackingPlugin } from './Tracking';
|
|
24
24
|
import { createTrailingParagraphPlugin } from './TrailingParagraph';
|
|
25
25
|
import { createVoidsPlugin } from './Voids';
|
|
26
|
-
export const getPlugins = (sdk, onAction, restrictedMarks)=>[
|
|
26
|
+
export const getPlugins = (sdk, onAction, restrictedMarks, withCharValidation)=>[
|
|
27
27
|
createDeserializeDocxPlugin(),
|
|
28
28
|
createTrackingPlugin(onAction),
|
|
29
29
|
createDragAndDropPlugin(),
|
|
@@ -48,7 +48,9 @@ export const getPlugins = (sdk, onAction, restrictedMarks)=>[
|
|
|
48
48
|
createVoidsPlugin(),
|
|
49
49
|
createSelectOnBackspacePlugin(),
|
|
50
50
|
createPasteHTMLPlugin(),
|
|
51
|
-
|
|
51
|
+
...withCharValidation ? [
|
|
52
|
+
createCharCounterPlugin()
|
|
53
|
+
] : [],
|
|
52
54
|
createSoftBreakPlugin(),
|
|
53
55
|
createExitBreakPlugin(),
|
|
54
56
|
createResetNodePlugin(),
|
|
@@ -2,5 +2,5 @@ import { FieldAppSDK } from '@contentful/app-sdk';
|
|
|
2
2
|
import { PlateProps } from '@udecode/plate-common';
|
|
3
3
|
import { PlatePlugin } from '../internal/types';
|
|
4
4
|
import { RichTextTrackingActionHandler } from './Tracking';
|
|
5
|
-
export declare const getPlugins: (sdk: FieldAppSDK, onAction: RichTextTrackingActionHandler, restrictedMarks?: string[]) => PlatePlugin[];
|
|
5
|
+
export declare const getPlugins: (sdk: FieldAppSDK, onAction: RichTextTrackingActionHandler, restrictedMarks?: string[], withCharValidation?: boolean) => PlatePlugin[];
|
|
6
6
|
export declare const disableCorePlugins: PlateProps['disableCorePlugins'];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentful/field-editor-rich-text",
|
|
3
|
-
"version": "4.17.
|
|
3
|
+
"version": "4.17.2",
|
|
4
4
|
"source": "./src/index.tsx",
|
|
5
5
|
"main": "dist/cjs/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -77,10 +77,7 @@
|
|
|
77
77
|
"peerDependencies": {
|
|
78
78
|
"@lingui/core": "^5.3.0",
|
|
79
79
|
"react": ">=16.14.0",
|
|
80
|
-
"react-dom": ">=16.14.0"
|
|
81
|
-
"slate": "0.118.1",
|
|
82
|
-
"slate-dom": "0.118.1",
|
|
83
|
-
"slate-react": "0.118.2"
|
|
80
|
+
"react-dom": ">=16.14.0"
|
|
84
81
|
},
|
|
85
82
|
"devDependencies": {
|
|
86
83
|
"@contentful/field-editor-test-utils": "^1.7.0",
|
|
@@ -94,5 +91,5 @@
|
|
|
94
91
|
"publishConfig": {
|
|
95
92
|
"registry": "https://npm.pkg.github.com/"
|
|
96
93
|
},
|
|
97
|
-
"gitHead": "
|
|
94
|
+
"gitHead": "88ddcf4e2db76e35e80981d3e8d31cacc734401e"
|
|
98
95
|
}
|