@atlaskit/editor-core 215.22.0 → 215.23.0
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 +12 -0
- package/dist/cjs/create-editor/ReactEditorView.js +26 -10
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/es2019/create-editor/ReactEditorView.js +28 -10
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/esm/create-editor/ReactEditorView.js +26 -10
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/types/create-editor/create-plugins-list.d.ts +1 -1
- package/dist/types-ts4.5/create-editor/create-plugins-list.d.ts +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @atlaskit/editor-core
|
|
2
2
|
|
|
3
|
+
## 215.23.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`e4f9d3c00a126`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/e4f9d3c00a126) -
|
|
8
|
+
[EDITOR-3919](https://hello.jira.atlassian.cloud/browse/EDITOR-3919) - use the real `getPos`
|
|
9
|
+
function as `nodeViweFactory` prop in `EditorSSRRenderer`
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- Updated dependencies
|
|
14
|
+
|
|
3
15
|
## 215.22.0
|
|
4
16
|
|
|
5
17
|
### Minor Changes
|
|
@@ -164,7 +164,7 @@ function ReactEditorView(props) {
|
|
|
164
164
|
return viewRef.current.state;
|
|
165
165
|
}
|
|
166
166
|
} else {
|
|
167
|
-
config.current = (0, _createEditor.processPluginsList)((0, _createPluginsList.default)(options.props.preset, props.editorProps, pluginInjectionAPI.current));
|
|
167
|
+
config.current = (0, _createEditor.processPluginsList)((0, _createPluginsList.default)(options.props.preset, 'allowBlockType' in props.editorProps ? props.editorProps : {}, pluginInjectionAPI.current));
|
|
168
168
|
schema = (0, _createSchema.createSchema)(config.current);
|
|
169
169
|
if (!(0, _expVal.expVal)('platform_editor_no_state_plugin_injection_api', 'isEnabled', false)) {
|
|
170
170
|
setEditorAPI(pluginInjectionAPI.current.api());
|
|
@@ -355,7 +355,7 @@ function ReactEditorView(props) {
|
|
|
355
355
|
// so we blur here to stop ProseMirror from trying to apply selection to detached nodes or
|
|
356
356
|
// nodes that haven't been re-rendered to the document yet.
|
|
357
357
|
blur();
|
|
358
|
-
var editorPlugins = (0, _createPluginsList.default)(props.preset, props.editorProps, pluginInjectionAPI.current);
|
|
358
|
+
var editorPlugins = (0, _createPluginsList.default)(props.preset, 'allowBlockType' in props.editorProps ? props.editorProps : {}, pluginInjectionAPI.current);
|
|
359
359
|
config.current = (0, _createEditor.processPluginsList)(editorPlugins);
|
|
360
360
|
var state = viewRef.current.state;
|
|
361
361
|
var plugins = (0, _createEditor.createPMPlugins)({
|
|
@@ -770,7 +770,7 @@ function ReactEditorView(props) {
|
|
|
770
770
|
}, [disabled, shouldFocus, previousDisabledState, __livePage]);
|
|
771
771
|
(0, _useFireFullWidthEvent.useFireFullWidthEvent)(nextAppearance, dispatchAnalyticsEvent);
|
|
772
772
|
|
|
773
|
-
// This function uses as prop as `<
|
|
773
|
+
// This function uses as prop as `<EditorSSRRenderer>` so, that should be memoized,
|
|
774
774
|
// to avoid extra rerenders.
|
|
775
775
|
var buildDoc = (0, _react.useCallback)(function (schema) {
|
|
776
776
|
return parseDoc(schema, undefined, {
|
|
@@ -785,27 +785,43 @@ function ReactEditorView(props) {
|
|
|
785
785
|
doc: defaultValue
|
|
786
786
|
});
|
|
787
787
|
}, [defaultValue, parseDoc, props.editorProps.sanitizePrivateContent, props.providerFactory]);
|
|
788
|
+
var _props$editorProps3 = props.editorProps,
|
|
789
|
+
assistiveLabel = _props$editorProps3.assistiveLabel,
|
|
790
|
+
assistiveDescribedBy = _props$editorProps3.assistiveDescribedBy;
|
|
791
|
+
// We need to check `allowBlockType` in props, because it is now exist in EditorNextProps type.
|
|
792
|
+
var _ref5 = 'allowBlockType' in props.editorProps ? props.editorProps : {
|
|
793
|
+
allowBlockType: undefined
|
|
794
|
+
},
|
|
795
|
+
allowBlockType = _ref5.allowBlockType;
|
|
788
796
|
var ssrEditor = (0, _react.useMemo)(function () {
|
|
789
797
|
if (!(0, _coreUtils.isSSR)() || !(0, _expValEquals.expValEquals)('platform_editor_ssr_renderer', 'isEnabled', true)) {
|
|
790
798
|
return null;
|
|
791
799
|
}
|
|
800
|
+
var plugins = (0, _createPluginsList.default)(props.preset,
|
|
801
|
+
// Don't pass props.editorProps directly, because editoProps in the dependency will lead to
|
|
802
|
+
// multiple repaints, because props.editorPros is not stable object.
|
|
803
|
+
{
|
|
804
|
+
allowBlockType: allowBlockType
|
|
805
|
+
}, pluginInjectionAPI.current);
|
|
806
|
+
var schema = (0, _createSchema.createSchema)((0, _createEditor.processPluginsList)(plugins));
|
|
807
|
+
var doc = buildDoc(schema);
|
|
792
808
|
return /*#__PURE__*/_react.default.createElement(_editorSsrRenderer.EditorSSRRenderer, {
|
|
793
809
|
intl: props.intl,
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
810
|
+
doc: doc,
|
|
811
|
+
schema: schema,
|
|
812
|
+
plugins: plugins,
|
|
813
|
+
portalProviderAPI: props.portalProviderAPI
|
|
798
814
|
// IMPORTANT: Keep next props in sync with div that renders a real ProseMirror editor.
|
|
799
815
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
800
816
|
,
|
|
801
817
|
className: "ProseMirror ".concat((0, _getUAPrefix.getUAPrefix)()),
|
|
802
818
|
key: "ProseMirror",
|
|
803
|
-
"aria-label":
|
|
819
|
+
"aria-label": assistiveLabel || props.intl.formatMessage(_messages.editorMessages.editorAssistiveLabel),
|
|
804
820
|
id: EDIT_AREA_ID,
|
|
805
|
-
"aria-describedby":
|
|
821
|
+
"aria-describedby": assistiveDescribedBy,
|
|
806
822
|
"data-editor-id": editorId.current
|
|
807
823
|
});
|
|
808
|
-
}, [props.
|
|
824
|
+
}, [props.preset, allowBlockType, assistiveLabel, assistiveDescribedBy, props.intl, props.portalProviderAPI, buildDoc]);
|
|
809
825
|
var editor = (0, _react.useMemo)(function () {
|
|
810
826
|
// SSR editor will be available only in SSR environment,
|
|
811
827
|
// in a browser `ssrEditor` will be `null`, and we will render a normal one ProseMirror.
|
|
@@ -137,7 +137,7 @@ export function ReactEditorView(props) {
|
|
|
137
137
|
return viewRef.current.state;
|
|
138
138
|
}
|
|
139
139
|
} else {
|
|
140
|
-
config.current = processPluginsList(createPluginsList(options.props.preset, props.editorProps, pluginInjectionAPI.current));
|
|
140
|
+
config.current = processPluginsList(createPluginsList(options.props.preset, 'allowBlockType' in props.editorProps ? props.editorProps : {}, pluginInjectionAPI.current));
|
|
141
141
|
schema = createSchema(config.current);
|
|
142
142
|
if (!expVal('platform_editor_no_state_plugin_injection_api', 'isEnabled', false)) {
|
|
143
143
|
setEditorAPI(pluginInjectionAPI.current.api());
|
|
@@ -329,7 +329,7 @@ export function ReactEditorView(props) {
|
|
|
329
329
|
// so we blur here to stop ProseMirror from trying to apply selection to detached nodes or
|
|
330
330
|
// nodes that haven't been re-rendered to the document yet.
|
|
331
331
|
blur();
|
|
332
|
-
const editorPlugins = createPluginsList(props.preset, props.editorProps, pluginInjectionAPI.current);
|
|
332
|
+
const editorPlugins = createPluginsList(props.preset, 'allowBlockType' in props.editorProps ? props.editorProps : {}, pluginInjectionAPI.current);
|
|
333
333
|
config.current = processPluginsList(editorPlugins);
|
|
334
334
|
const state = viewRef.current.state;
|
|
335
335
|
const plugins = createPMPlugins({
|
|
@@ -717,7 +717,7 @@ export function ReactEditorView(props) {
|
|
|
717
717
|
}, [disabled, shouldFocus, previousDisabledState, __livePage]);
|
|
718
718
|
useFireFullWidthEvent(nextAppearance, dispatchAnalyticsEvent);
|
|
719
719
|
|
|
720
|
-
// This function uses as prop as `<
|
|
720
|
+
// This function uses as prop as `<EditorSSRRenderer>` so, that should be memoized,
|
|
721
721
|
// to avoid extra rerenders.
|
|
722
722
|
const buildDoc = useCallback(schema => {
|
|
723
723
|
return parseDoc(schema, undefined, {
|
|
@@ -732,27 +732,45 @@ export function ReactEditorView(props) {
|
|
|
732
732
|
doc: defaultValue
|
|
733
733
|
});
|
|
734
734
|
}, [defaultValue, parseDoc, props.editorProps.sanitizePrivateContent, props.providerFactory]);
|
|
735
|
+
const {
|
|
736
|
+
assistiveLabel,
|
|
737
|
+
assistiveDescribedBy
|
|
738
|
+
} = props.editorProps;
|
|
739
|
+
// We need to check `allowBlockType` in props, because it is now exist in EditorNextProps type.
|
|
740
|
+
const {
|
|
741
|
+
allowBlockType
|
|
742
|
+
} = 'allowBlockType' in props.editorProps ? props.editorProps : {
|
|
743
|
+
allowBlockType: undefined
|
|
744
|
+
};
|
|
735
745
|
const ssrEditor = useMemo(() => {
|
|
736
746
|
if (!isSSR() || !expValEquals('platform_editor_ssr_renderer', 'isEnabled', true)) {
|
|
737
747
|
return null;
|
|
738
748
|
}
|
|
749
|
+
const plugins = createPluginsList(props.preset,
|
|
750
|
+
// Don't pass props.editorProps directly, because editoProps in the dependency will lead to
|
|
751
|
+
// multiple repaints, because props.editorPros is not stable object.
|
|
752
|
+
{
|
|
753
|
+
allowBlockType
|
|
754
|
+
}, pluginInjectionAPI.current);
|
|
755
|
+
const schema = createSchema(processPluginsList(plugins));
|
|
756
|
+
const doc = buildDoc(schema);
|
|
739
757
|
return /*#__PURE__*/React.createElement(EditorSSRRenderer, {
|
|
740
758
|
intl: props.intl,
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
759
|
+
doc: doc,
|
|
760
|
+
schema: schema,
|
|
761
|
+
plugins: plugins,
|
|
762
|
+
portalProviderAPI: props.portalProviderAPI
|
|
745
763
|
// IMPORTANT: Keep next props in sync with div that renders a real ProseMirror editor.
|
|
746
764
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
747
765
|
,
|
|
748
766
|
className: `ProseMirror ${getUAPrefix()}`,
|
|
749
767
|
key: "ProseMirror",
|
|
750
|
-
"aria-label":
|
|
768
|
+
"aria-label": assistiveLabel || props.intl.formatMessage(editorMessages.editorAssistiveLabel),
|
|
751
769
|
id: EDIT_AREA_ID,
|
|
752
|
-
"aria-describedby":
|
|
770
|
+
"aria-describedby": assistiveDescribedBy,
|
|
753
771
|
"data-editor-id": editorId.current
|
|
754
772
|
});
|
|
755
|
-
}, [props.
|
|
773
|
+
}, [props.preset, allowBlockType, assistiveLabel, assistiveDescribedBy, props.intl, props.portalProviderAPI, buildDoc]);
|
|
756
774
|
const editor = useMemo(() => {
|
|
757
775
|
// SSR editor will be available only in SSR environment,
|
|
758
776
|
// in a browser `ssrEditor` will be `null`, and we will render a normal one ProseMirror.
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export const name = "@atlaskit/editor-core";
|
|
2
|
-
export const version = "
|
|
2
|
+
export const version = "215.22.0";
|
|
@@ -155,7 +155,7 @@ export function ReactEditorView(props) {
|
|
|
155
155
|
return viewRef.current.state;
|
|
156
156
|
}
|
|
157
157
|
} else {
|
|
158
|
-
config.current = processPluginsList(createPluginsList(options.props.preset, props.editorProps, pluginInjectionAPI.current));
|
|
158
|
+
config.current = processPluginsList(createPluginsList(options.props.preset, 'allowBlockType' in props.editorProps ? props.editorProps : {}, pluginInjectionAPI.current));
|
|
159
159
|
schema = createSchema(config.current);
|
|
160
160
|
if (!expVal('platform_editor_no_state_plugin_injection_api', 'isEnabled', false)) {
|
|
161
161
|
setEditorAPI(pluginInjectionAPI.current.api());
|
|
@@ -346,7 +346,7 @@ export function ReactEditorView(props) {
|
|
|
346
346
|
// so we blur here to stop ProseMirror from trying to apply selection to detached nodes or
|
|
347
347
|
// nodes that haven't been re-rendered to the document yet.
|
|
348
348
|
blur();
|
|
349
|
-
var editorPlugins = createPluginsList(props.preset, props.editorProps, pluginInjectionAPI.current);
|
|
349
|
+
var editorPlugins = createPluginsList(props.preset, 'allowBlockType' in props.editorProps ? props.editorProps : {}, pluginInjectionAPI.current);
|
|
350
350
|
config.current = processPluginsList(editorPlugins);
|
|
351
351
|
var state = viewRef.current.state;
|
|
352
352
|
var plugins = createPMPlugins({
|
|
@@ -761,7 +761,7 @@ export function ReactEditorView(props) {
|
|
|
761
761
|
}, [disabled, shouldFocus, previousDisabledState, __livePage]);
|
|
762
762
|
useFireFullWidthEvent(nextAppearance, dispatchAnalyticsEvent);
|
|
763
763
|
|
|
764
|
-
// This function uses as prop as `<
|
|
764
|
+
// This function uses as prop as `<EditorSSRRenderer>` so, that should be memoized,
|
|
765
765
|
// to avoid extra rerenders.
|
|
766
766
|
var buildDoc = useCallback(function (schema) {
|
|
767
767
|
return parseDoc(schema, undefined, {
|
|
@@ -776,27 +776,43 @@ export function ReactEditorView(props) {
|
|
|
776
776
|
doc: defaultValue
|
|
777
777
|
});
|
|
778
778
|
}, [defaultValue, parseDoc, props.editorProps.sanitizePrivateContent, props.providerFactory]);
|
|
779
|
+
var _props$editorProps3 = props.editorProps,
|
|
780
|
+
assistiveLabel = _props$editorProps3.assistiveLabel,
|
|
781
|
+
assistiveDescribedBy = _props$editorProps3.assistiveDescribedBy;
|
|
782
|
+
// We need to check `allowBlockType` in props, because it is now exist in EditorNextProps type.
|
|
783
|
+
var _ref5 = 'allowBlockType' in props.editorProps ? props.editorProps : {
|
|
784
|
+
allowBlockType: undefined
|
|
785
|
+
},
|
|
786
|
+
allowBlockType = _ref5.allowBlockType;
|
|
779
787
|
var ssrEditor = useMemo(function () {
|
|
780
788
|
if (!isSSR() || !expValEquals('platform_editor_ssr_renderer', 'isEnabled', true)) {
|
|
781
789
|
return null;
|
|
782
790
|
}
|
|
791
|
+
var plugins = createPluginsList(props.preset,
|
|
792
|
+
// Don't pass props.editorProps directly, because editoProps in the dependency will lead to
|
|
793
|
+
// multiple repaints, because props.editorPros is not stable object.
|
|
794
|
+
{
|
|
795
|
+
allowBlockType: allowBlockType
|
|
796
|
+
}, pluginInjectionAPI.current);
|
|
797
|
+
var schema = createSchema(processPluginsList(plugins));
|
|
798
|
+
var doc = buildDoc(schema);
|
|
783
799
|
return /*#__PURE__*/React.createElement(EditorSSRRenderer, {
|
|
784
800
|
intl: props.intl,
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
801
|
+
doc: doc,
|
|
802
|
+
schema: schema,
|
|
803
|
+
plugins: plugins,
|
|
804
|
+
portalProviderAPI: props.portalProviderAPI
|
|
789
805
|
// IMPORTANT: Keep next props in sync with div that renders a real ProseMirror editor.
|
|
790
806
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
791
807
|
,
|
|
792
808
|
className: "ProseMirror ".concat(getUAPrefix()),
|
|
793
809
|
key: "ProseMirror",
|
|
794
|
-
"aria-label":
|
|
810
|
+
"aria-label": assistiveLabel || props.intl.formatMessage(editorMessages.editorAssistiveLabel),
|
|
795
811
|
id: EDIT_AREA_ID,
|
|
796
|
-
"aria-describedby":
|
|
812
|
+
"aria-describedby": assistiveDescribedBy,
|
|
797
813
|
"data-editor-id": editorId.current
|
|
798
814
|
});
|
|
799
|
-
}, [props.
|
|
815
|
+
}, [props.preset, allowBlockType, assistiveLabel, assistiveDescribedBy, props.intl, props.portalProviderAPI, buildDoc]);
|
|
800
816
|
var editor = useMemo(function () {
|
|
801
817
|
// SSR editor will be available only in SSR environment,
|
|
802
818
|
// in a browser `ssrEditor` will be `null`, and we will render a normal one ProseMirror.
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export var name = "@atlaskit/editor-core";
|
|
2
|
-
export var version = "
|
|
2
|
+
export var version = "215.22.0";
|
|
@@ -13,4 +13,4 @@ export declare function getDefaultPresetOptionsFromEditorProps(props: EditorProp
|
|
|
13
13
|
* Note: The order that presets are added determines
|
|
14
14
|
* their placement in the editor toolbar.
|
|
15
15
|
*/
|
|
16
|
-
export default function createPluginsList(preset: EditorPresetBuilder<any, any>, props: EditorProps, pluginInjectionAPI?: EditorPluginInjectionAPI): EditorPlugin[];
|
|
16
|
+
export default function createPluginsList(preset: EditorPresetBuilder<any, any>, props: Pick<EditorProps, 'allowBlockType'>, pluginInjectionAPI?: EditorPluginInjectionAPI): EditorPlugin[];
|
|
@@ -13,4 +13,4 @@ export declare function getDefaultPresetOptionsFromEditorProps(props: EditorProp
|
|
|
13
13
|
* Note: The order that presets are added determines
|
|
14
14
|
* their placement in the editor toolbar.
|
|
15
15
|
*/
|
|
16
|
-
export default function createPluginsList(preset: EditorPresetBuilder<any, any>, props: EditorProps, pluginInjectionAPI?: EditorPluginInjectionAPI): EditorPlugin[];
|
|
16
|
+
export default function createPluginsList(preset: EditorPresetBuilder<any, any>, props: Pick<EditorProps, 'allowBlockType'>, pluginInjectionAPI?: EditorPluginInjectionAPI): EditorPlugin[];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-core",
|
|
3
|
-
"version": "215.
|
|
3
|
+
"version": "215.23.0",
|
|
4
4
|
"description": "A package contains Atlassian editor core functionality",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"@atlaskit/editor-plugins": "^11.1.0",
|
|
54
54
|
"@atlaskit/editor-prosemirror": "^7.2.0",
|
|
55
55
|
"@atlaskit/editor-shared-styles": "^3.10.0",
|
|
56
|
-
"@atlaskit/editor-ssr-renderer": "^1.
|
|
56
|
+
"@atlaskit/editor-ssr-renderer": "^1.4.0",
|
|
57
57
|
"@atlaskit/editor-toolbar": "^0.18.0",
|
|
58
58
|
"@atlaskit/editor-toolbar-model": "^0.2.0",
|
|
59
59
|
"@atlaskit/emoji": "^69.9.0",
|