@atlaskit/editor-core 202.3.0 → 202.3.1
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 +10 -0
- package/dist/cjs/create-editor/ReactEditorView.js +12 -6
- package/dist/cjs/create-editor/ReactEditorViewNext.js +12 -6
- package/dist/cjs/create-editor/create-editor.js +6 -1
- package/dist/cjs/create-editor/editorStateNotificationPlugin.js +21 -0
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/es2019/create-editor/ReactEditorView.js +12 -6
- package/dist/es2019/create-editor/ReactEditorViewNext.js +12 -6
- package/dist/es2019/create-editor/create-editor.js +6 -1
- package/dist/es2019/create-editor/editorStateNotificationPlugin.js +13 -0
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/esm/create-editor/ReactEditorView.js +12 -6
- package/dist/esm/create-editor/ReactEditorViewNext.js +12 -6
- package/dist/esm/create-editor/create-editor.js +6 -1
- package/dist/esm/create-editor/editorStateNotificationPlugin.js +15 -0
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/types/create-editor/create-editor.d.ts +1 -1
- package/dist/types/create-editor/editorStateNotificationPlugin.d.ts +6 -0
- package/dist/types/types/pm-plugin-list.d.ts +5 -0
- package/dist/types-ts4.5/create-editor/create-editor.d.ts +1 -1
- package/dist/types-ts4.5/create-editor/editorStateNotificationPlugin.d.ts +6 -0
- package/dist/types-ts4.5/types/pm-plugin-list.d.ts +5 -0
- package/package.json +5 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# @atlaskit/editor-core
|
|
2
2
|
|
|
3
|
+
## 202.3.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#167666](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/167666)
|
|
8
|
+
[`1e925c655550f`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/1e925c655550f) -
|
|
9
|
+
Some editor states were occassionally missed by the editor API due to an edge case - this change
|
|
10
|
+
ensures all prosemirror states are observed fixing some minor bugs (ie. context panel not closing
|
|
11
|
+
when changing selection).
|
|
12
|
+
|
|
3
13
|
## 202.3.0
|
|
4
14
|
|
|
5
15
|
### Minor Changes
|
|
@@ -210,7 +210,8 @@ var ReactEditorView = exports.ReactEditorView = /*#__PURE__*/function (_React$Co
|
|
|
210
210
|
featureFlags: _this.featureFlags,
|
|
211
211
|
getIntl: function getIntl() {
|
|
212
212
|
return _this.props.intl;
|
|
213
|
-
}
|
|
213
|
+
},
|
|
214
|
+
onEditorStateUpdated: (0, _platformFeatureFlags.fg)('platform_editor_catch_missing_injection_states') ? _this.pluginInjectionAPI.onEditorViewUpdated : undefined
|
|
214
215
|
});
|
|
215
216
|
_this.contentTransformer = contentTransformerProvider ? contentTransformerProvider(schema) : undefined;
|
|
216
217
|
var doc;
|
|
@@ -286,10 +287,14 @@ var ReactEditorView = exports.ReactEditorView = /*#__PURE__*/function (_React$Co
|
|
|
286
287
|
return;
|
|
287
288
|
}
|
|
288
289
|
_this.view.updateState(editorState);
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
290
|
+
if (!(0, _platformFeatureFlags.fg)('platform_editor_catch_missing_injection_states')) {
|
|
291
|
+
_this.pluginInjectionAPI.onEditorViewUpdated({
|
|
292
|
+
newEditorState: editorState,
|
|
293
|
+
oldEditorState: oldEditorState
|
|
294
|
+
});
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
// ED-25839: Investigate if we also want to migrate this API to use `onEditorStateUpdated` in `createPMPlugins`
|
|
293
298
|
_this.onEditorViewStateUpdated({
|
|
294
299
|
originalTransaction: transaction,
|
|
295
300
|
transactions: transactions,
|
|
@@ -591,7 +596,8 @@ var ReactEditorView = exports.ReactEditorView = /*#__PURE__*/function (_React$Co
|
|
|
591
596
|
featureFlags: (0, _featureFlagsFromProps.createFeatureFlagsFromProps)(props.editorProps.featureFlags),
|
|
592
597
|
getIntl: function getIntl() {
|
|
593
598
|
return _this2.props.intl;
|
|
594
|
-
}
|
|
599
|
+
},
|
|
600
|
+
onEditorStateUpdated: (0, _platformFeatureFlags.fg)('platform_editor_catch_missing_injection_states') ? this.pluginInjectionAPI.onEditorViewUpdated : undefined
|
|
595
601
|
});
|
|
596
602
|
var newState = state.reconfigure({
|
|
597
603
|
plugins: plugins
|
|
@@ -153,7 +153,8 @@ function ReactEditorView(props) {
|
|
|
153
153
|
featureFlags: featureFlags,
|
|
154
154
|
getIntl: function getIntl() {
|
|
155
155
|
return props.intl;
|
|
156
|
-
}
|
|
156
|
+
},
|
|
157
|
+
onEditorStateUpdated: (0, _platformFeatureFlags.fg)('platform_editor_catch_missing_injection_states') ? pluginInjectionAPI.current.onEditorViewUpdated : undefined
|
|
157
158
|
});
|
|
158
159
|
contentTransformer.current = contentTransformerProvider ? contentTransformerProvider(schema) : undefined;
|
|
159
160
|
var api = pluginInjectionAPI.current.api();
|
|
@@ -320,7 +321,8 @@ function ReactEditorView(props) {
|
|
|
320
321
|
featureFlags: featureFlags,
|
|
321
322
|
getIntl: function getIntl() {
|
|
322
323
|
return props.intl;
|
|
323
|
-
}
|
|
324
|
+
},
|
|
325
|
+
onEditorStateUpdated: (0, _platformFeatureFlags.fg)('platform_editor_catch_missing_injection_states') ? pluginInjectionAPI.current.onEditorViewUpdated : undefined
|
|
324
326
|
});
|
|
325
327
|
var newState = state.reconfigure({
|
|
326
328
|
plugins: plugins
|
|
@@ -339,10 +341,14 @@ function ReactEditorView(props) {
|
|
|
339
341
|
transactions = _ref2.transactions,
|
|
340
342
|
oldEditorState = _ref2.oldEditorState,
|
|
341
343
|
newEditorState = _ref2.newEditorState;
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
344
|
+
if (!(0, _platformFeatureFlags.fg)('platform_editor_catch_missing_injection_states')) {
|
|
345
|
+
pluginInjectionAPI.current.onEditorViewUpdated({
|
|
346
|
+
newEditorState: newEditorState,
|
|
347
|
+
oldEditorState: oldEditorState
|
|
348
|
+
});
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
// ED-25839: Investigate if we also want to migrate this API to use `onEditorStateUpdated` in `createPMPlugins`
|
|
346
352
|
(_config$current = config.current) === null || _config$current === void 0 || _config$current.onEditorViewStateUpdatedCallbacks.forEach(function (entry) {
|
|
347
353
|
entry.callback({
|
|
348
354
|
originalTransaction: originalTransaction,
|
|
@@ -11,6 +11,7 @@ exports.processPluginsList = processPluginsList;
|
|
|
11
11
|
exports.sortByRank = sortByRank;
|
|
12
12
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
13
13
|
var _errorReporter = require("@atlaskit/editor-common/error-reporter");
|
|
14
|
+
var _editorStateNotificationPlugin = require("./editorStateNotificationPlugin");
|
|
14
15
|
var _sortByOrder = require("./sort-by-order");
|
|
15
16
|
function sortByRank(a, b) {
|
|
16
17
|
return a.rank - b.rank;
|
|
@@ -94,7 +95,7 @@ function processPluginsList(plugins) {
|
|
|
94
95
|
}
|
|
95
96
|
function createPMPlugins(config) {
|
|
96
97
|
var editorConfig = config.editorConfig;
|
|
97
|
-
|
|
98
|
+
var pmPlugins = editorConfig.pmPlugins.sort((0, _sortByOrder.sortByOrder)('plugins')).map(function (_ref) {
|
|
98
99
|
var plugin = _ref.plugin;
|
|
99
100
|
return plugin({
|
|
100
101
|
schema: config.schema,
|
|
@@ -111,6 +112,10 @@ function createPMPlugins(config) {
|
|
|
111
112
|
}).filter(function (plugin) {
|
|
112
113
|
return typeof plugin !== 'undefined';
|
|
113
114
|
});
|
|
115
|
+
if (config.onEditorStateUpdated !== undefined) {
|
|
116
|
+
return [(0, _editorStateNotificationPlugin.createEditorStateNotificationPlugin)(config.onEditorStateUpdated)].concat((0, _toConsumableArray2.default)(pmPlugins));
|
|
117
|
+
}
|
|
118
|
+
return pmPlugins;
|
|
114
119
|
}
|
|
115
120
|
function createErrorReporter(errorReporterHandler) {
|
|
116
121
|
var errorReporter = new _errorReporter.ErrorReporter();
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.createEditorStateNotificationPlugin = void 0;
|
|
7
|
+
var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
|
|
8
|
+
var createEditorStateNotificationPlugin = exports.createEditorStateNotificationPlugin = function createEditorStateNotificationPlugin(onEditorStateUpdated) {
|
|
9
|
+
return new _safePlugin.SafePlugin({
|
|
10
|
+
view: function view() {
|
|
11
|
+
return {
|
|
12
|
+
update: function update(view, oldEditorState) {
|
|
13
|
+
onEditorStateUpdated({
|
|
14
|
+
oldEditorState: oldEditorState,
|
|
15
|
+
newEditorState: view.state
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
};
|
|
@@ -201,7 +201,8 @@ export class ReactEditorView extends React.Component {
|
|
|
201
201
|
nodeViewPortalProviderAPI: this.props.nodeViewPortalProviderAPI,
|
|
202
202
|
dispatchAnalyticsEvent: this.dispatchAnalyticsEvent,
|
|
203
203
|
featureFlags: this.featureFlags,
|
|
204
|
-
getIntl: () => this.props.intl
|
|
204
|
+
getIntl: () => this.props.intl,
|
|
205
|
+
onEditorStateUpdated: fg('platform_editor_catch_missing_injection_states') ? this.pluginInjectionAPI.onEditorViewUpdated : undefined
|
|
205
206
|
});
|
|
206
207
|
this.contentTransformer = contentTransformerProvider ? contentTransformerProvider(schema) : undefined;
|
|
207
208
|
let doc;
|
|
@@ -279,10 +280,14 @@ export class ReactEditorView extends React.Component {
|
|
|
279
280
|
return;
|
|
280
281
|
}
|
|
281
282
|
this.view.updateState(editorState);
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
283
|
+
if (!fg('platform_editor_catch_missing_injection_states')) {
|
|
284
|
+
this.pluginInjectionAPI.onEditorViewUpdated({
|
|
285
|
+
newEditorState: editorState,
|
|
286
|
+
oldEditorState
|
|
287
|
+
});
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
// ED-25839: Investigate if we also want to migrate this API to use `onEditorStateUpdated` in `createPMPlugins`
|
|
286
291
|
this.onEditorViewStateUpdated({
|
|
287
292
|
originalTransaction: transaction,
|
|
288
293
|
transactions,
|
|
@@ -545,7 +550,8 @@ export class ReactEditorView extends React.Component {
|
|
|
545
550
|
nodeViewPortalProviderAPI: props.nodeViewPortalProviderAPI,
|
|
546
551
|
dispatchAnalyticsEvent: this.dispatchAnalyticsEvent,
|
|
547
552
|
featureFlags: createFeatureFlagsFromProps(props.editorProps.featureFlags),
|
|
548
|
-
getIntl: () => this.props.intl
|
|
553
|
+
getIntl: () => this.props.intl,
|
|
554
|
+
onEditorStateUpdated: fg('platform_editor_catch_missing_injection_states') ? this.pluginInjectionAPI.onEditorViewUpdated : undefined
|
|
549
555
|
});
|
|
550
556
|
const newState = state.reconfigure({
|
|
551
557
|
plugins: plugins
|
|
@@ -129,7 +129,8 @@ function ReactEditorView(props) {
|
|
|
129
129
|
nodeViewPortalProviderAPI: props.nodeViewPortalProviderAPI,
|
|
130
130
|
dispatchAnalyticsEvent: dispatchAnalyticsEvent,
|
|
131
131
|
featureFlags,
|
|
132
|
-
getIntl: () => props.intl
|
|
132
|
+
getIntl: () => props.intl,
|
|
133
|
+
onEditorStateUpdated: fg('platform_editor_catch_missing_injection_states') ? pluginInjectionAPI.current.onEditorViewUpdated : undefined
|
|
133
134
|
});
|
|
134
135
|
contentTransformer.current = contentTransformerProvider ? contentTransformerProvider(schema) : undefined;
|
|
135
136
|
const api = pluginInjectionAPI.current.api();
|
|
@@ -293,7 +294,8 @@ function ReactEditorView(props) {
|
|
|
293
294
|
nodeViewPortalProviderAPI: props.nodeViewPortalProviderAPI,
|
|
294
295
|
dispatchAnalyticsEvent: dispatchAnalyticsEvent,
|
|
295
296
|
featureFlags,
|
|
296
|
-
getIntl: () => props.intl
|
|
297
|
+
getIntl: () => props.intl,
|
|
298
|
+
onEditorStateUpdated: fg('platform_editor_catch_missing_injection_states') ? pluginInjectionAPI.current.onEditorViewUpdated : undefined
|
|
297
299
|
});
|
|
298
300
|
const newState = state.reconfigure({
|
|
299
301
|
plugins: plugins
|
|
@@ -314,10 +316,14 @@ function ReactEditorView(props) {
|
|
|
314
316
|
newEditorState
|
|
315
317
|
}) => {
|
|
316
318
|
var _config$current;
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
319
|
+
if (!fg('platform_editor_catch_missing_injection_states')) {
|
|
320
|
+
pluginInjectionAPI.current.onEditorViewUpdated({
|
|
321
|
+
newEditorState,
|
|
322
|
+
oldEditorState
|
|
323
|
+
});
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
// ED-25839: Investigate if we also want to migrate this API to use `onEditorStateUpdated` in `createPMPlugins`
|
|
321
327
|
(_config$current = config.current) === null || _config$current === void 0 ? void 0 : _config$current.onEditorViewStateUpdatedCallbacks.forEach(entry => {
|
|
322
328
|
entry.callback({
|
|
323
329
|
originalTransaction,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ErrorReporter } from '@atlaskit/editor-common/error-reporter';
|
|
2
|
+
import { createEditorStateNotificationPlugin } from './editorStateNotificationPlugin';
|
|
2
3
|
import { sortByOrder } from './sort-by-order';
|
|
3
4
|
export function sortByRank(a, b) {
|
|
4
5
|
return a.rank - b.rank;
|
|
@@ -77,7 +78,7 @@ export function createPMPlugins(config) {
|
|
|
77
78
|
const {
|
|
78
79
|
editorConfig
|
|
79
80
|
} = config;
|
|
80
|
-
|
|
81
|
+
const pmPlugins = editorConfig.pmPlugins.sort(sortByOrder('plugins')).map(({
|
|
81
82
|
plugin
|
|
82
83
|
}) => plugin({
|
|
83
84
|
schema: config.schema,
|
|
@@ -91,6 +92,10 @@ export function createPMPlugins(config) {
|
|
|
91
92
|
featureFlags: config.featureFlags || {},
|
|
92
93
|
getIntl: config.getIntl
|
|
93
94
|
})).filter(plugin => typeof plugin !== 'undefined');
|
|
95
|
+
if (config.onEditorStateUpdated !== undefined) {
|
|
96
|
+
return [createEditorStateNotificationPlugin(config.onEditorStateUpdated), ...pmPlugins];
|
|
97
|
+
}
|
|
98
|
+
return pmPlugins;
|
|
94
99
|
}
|
|
95
100
|
export function createErrorReporter(errorReporterHandler) {
|
|
96
101
|
const errorReporter = new ErrorReporter();
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
|
+
export const createEditorStateNotificationPlugin = onEditorStateUpdated => new SafePlugin({
|
|
3
|
+
view: () => {
|
|
4
|
+
return {
|
|
5
|
+
update: (view, oldEditorState) => {
|
|
6
|
+
onEditorStateUpdated({
|
|
7
|
+
oldEditorState,
|
|
8
|
+
newEditorState: view.state
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
});
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export const name = "@atlaskit/editor-core";
|
|
2
|
-
export const version = "202.3.
|
|
2
|
+
export const version = "202.3.1";
|
|
@@ -203,7 +203,8 @@ export var ReactEditorView = /*#__PURE__*/function (_React$Component) {
|
|
|
203
203
|
featureFlags: _this.featureFlags,
|
|
204
204
|
getIntl: function getIntl() {
|
|
205
205
|
return _this.props.intl;
|
|
206
|
-
}
|
|
206
|
+
},
|
|
207
|
+
onEditorStateUpdated: fg('platform_editor_catch_missing_injection_states') ? _this.pluginInjectionAPI.onEditorViewUpdated : undefined
|
|
207
208
|
});
|
|
208
209
|
_this.contentTransformer = contentTransformerProvider ? contentTransformerProvider(schema) : undefined;
|
|
209
210
|
var doc;
|
|
@@ -279,10 +280,14 @@ export var ReactEditorView = /*#__PURE__*/function (_React$Component) {
|
|
|
279
280
|
return;
|
|
280
281
|
}
|
|
281
282
|
_this.view.updateState(editorState);
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
283
|
+
if (!fg('platform_editor_catch_missing_injection_states')) {
|
|
284
|
+
_this.pluginInjectionAPI.onEditorViewUpdated({
|
|
285
|
+
newEditorState: editorState,
|
|
286
|
+
oldEditorState: oldEditorState
|
|
287
|
+
});
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
// ED-25839: Investigate if we also want to migrate this API to use `onEditorStateUpdated` in `createPMPlugins`
|
|
286
291
|
_this.onEditorViewStateUpdated({
|
|
287
292
|
originalTransaction: transaction,
|
|
288
293
|
transactions: transactions,
|
|
@@ -584,7 +589,8 @@ export var ReactEditorView = /*#__PURE__*/function (_React$Component) {
|
|
|
584
589
|
featureFlags: createFeatureFlagsFromProps(props.editorProps.featureFlags),
|
|
585
590
|
getIntl: function getIntl() {
|
|
586
591
|
return _this2.props.intl;
|
|
587
|
-
}
|
|
592
|
+
},
|
|
593
|
+
onEditorStateUpdated: fg('platform_editor_catch_missing_injection_states') ? this.pluginInjectionAPI.onEditorViewUpdated : undefined
|
|
588
594
|
});
|
|
589
595
|
var newState = state.reconfigure({
|
|
590
596
|
plugins: plugins
|
|
@@ -143,7 +143,8 @@ function ReactEditorView(props) {
|
|
|
143
143
|
featureFlags: featureFlags,
|
|
144
144
|
getIntl: function getIntl() {
|
|
145
145
|
return props.intl;
|
|
146
|
-
}
|
|
146
|
+
},
|
|
147
|
+
onEditorStateUpdated: fg('platform_editor_catch_missing_injection_states') ? pluginInjectionAPI.current.onEditorViewUpdated : undefined
|
|
147
148
|
});
|
|
148
149
|
contentTransformer.current = contentTransformerProvider ? contentTransformerProvider(schema) : undefined;
|
|
149
150
|
var api = pluginInjectionAPI.current.api();
|
|
@@ -310,7 +311,8 @@ function ReactEditorView(props) {
|
|
|
310
311
|
featureFlags: featureFlags,
|
|
311
312
|
getIntl: function getIntl() {
|
|
312
313
|
return props.intl;
|
|
313
|
-
}
|
|
314
|
+
},
|
|
315
|
+
onEditorStateUpdated: fg('platform_editor_catch_missing_injection_states') ? pluginInjectionAPI.current.onEditorViewUpdated : undefined
|
|
314
316
|
});
|
|
315
317
|
var newState = state.reconfigure({
|
|
316
318
|
plugins: plugins
|
|
@@ -329,10 +331,14 @@ function ReactEditorView(props) {
|
|
|
329
331
|
transactions = _ref2.transactions,
|
|
330
332
|
oldEditorState = _ref2.oldEditorState,
|
|
331
333
|
newEditorState = _ref2.newEditorState;
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
334
|
+
if (!fg('platform_editor_catch_missing_injection_states')) {
|
|
335
|
+
pluginInjectionAPI.current.onEditorViewUpdated({
|
|
336
|
+
newEditorState: newEditorState,
|
|
337
|
+
oldEditorState: oldEditorState
|
|
338
|
+
});
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
// ED-25839: Investigate if we also want to migrate this API to use `onEditorStateUpdated` in `createPMPlugins`
|
|
336
342
|
(_config$current = config.current) === null || _config$current === void 0 || _config$current.onEditorViewStateUpdatedCallbacks.forEach(function (entry) {
|
|
337
343
|
entry.callback({
|
|
338
344
|
originalTransaction: originalTransaction,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
2
2
|
import { ErrorReporter } from '@atlaskit/editor-common/error-reporter';
|
|
3
|
+
import { createEditorStateNotificationPlugin } from './editorStateNotificationPlugin';
|
|
3
4
|
import { sortByOrder } from './sort-by-order';
|
|
4
5
|
export function sortByRank(a, b) {
|
|
5
6
|
return a.rank - b.rank;
|
|
@@ -83,7 +84,7 @@ export function processPluginsList(plugins) {
|
|
|
83
84
|
}
|
|
84
85
|
export function createPMPlugins(config) {
|
|
85
86
|
var editorConfig = config.editorConfig;
|
|
86
|
-
|
|
87
|
+
var pmPlugins = editorConfig.pmPlugins.sort(sortByOrder('plugins')).map(function (_ref) {
|
|
87
88
|
var plugin = _ref.plugin;
|
|
88
89
|
return plugin({
|
|
89
90
|
schema: config.schema,
|
|
@@ -100,6 +101,10 @@ export function createPMPlugins(config) {
|
|
|
100
101
|
}).filter(function (plugin) {
|
|
101
102
|
return typeof plugin !== 'undefined';
|
|
102
103
|
});
|
|
104
|
+
if (config.onEditorStateUpdated !== undefined) {
|
|
105
|
+
return [createEditorStateNotificationPlugin(config.onEditorStateUpdated)].concat(_toConsumableArray(pmPlugins));
|
|
106
|
+
}
|
|
107
|
+
return pmPlugins;
|
|
103
108
|
}
|
|
104
109
|
export function createErrorReporter(errorReporterHandler) {
|
|
105
110
|
var errorReporter = new ErrorReporter();
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
|
+
export var createEditorStateNotificationPlugin = function createEditorStateNotificationPlugin(onEditorStateUpdated) {
|
|
3
|
+
return new SafePlugin({
|
|
4
|
+
view: function view() {
|
|
5
|
+
return {
|
|
6
|
+
update: function update(view, oldEditorState) {
|
|
7
|
+
onEditorStateUpdated({
|
|
8
|
+
oldEditorState: oldEditorState,
|
|
9
|
+
newEditorState: view.state
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export var name = "@atlaskit/editor-core";
|
|
2
|
-
export var version = "202.3.
|
|
2
|
+
export var version = "202.3.1";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ErrorReporter } from '@atlaskit/editor-common/error-reporter';
|
|
2
2
|
import type { ErrorReportingHandler } from '@atlaskit/editor-common/error-reporter';
|
|
3
|
-
import type
|
|
3
|
+
import { type SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
4
4
|
import type { MarkSpec } from '@atlaskit/editor-prosemirror/model';
|
|
5
5
|
import type { EditorConfig, EditorPlugin, PMPluginCreateConfig } from '../types';
|
|
6
6
|
export declare function sortByRank(a: {
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
|
+
import type { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
3
|
+
export declare const createEditorStateNotificationPlugin: (onEditorStateUpdated: (props: {
|
|
4
|
+
oldEditorState: EditorState;
|
|
5
|
+
newEditorState: EditorState;
|
|
6
|
+
}) => void) => SafePlugin<any>;
|
|
@@ -1,5 +1,10 @@
|
|
|
1
|
+
import type { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
1
2
|
import type { EditorConfig } from './editor-config';
|
|
2
3
|
import type { PMPluginFactoryParams } from './pm-plugin';
|
|
3
4
|
export type PMPluginCreateConfig = PMPluginFactoryParams & {
|
|
4
5
|
editorConfig: EditorConfig;
|
|
6
|
+
onEditorStateUpdated: ((props: {
|
|
7
|
+
newEditorState: EditorState;
|
|
8
|
+
oldEditorState: EditorState;
|
|
9
|
+
}) => void) | undefined;
|
|
5
10
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ErrorReporter } from '@atlaskit/editor-common/error-reporter';
|
|
2
2
|
import type { ErrorReportingHandler } from '@atlaskit/editor-common/error-reporter';
|
|
3
|
-
import type
|
|
3
|
+
import { type SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
4
4
|
import type { MarkSpec } from '@atlaskit/editor-prosemirror/model';
|
|
5
5
|
import type { EditorConfig, EditorPlugin, PMPluginCreateConfig } from '../types';
|
|
6
6
|
export declare function sortByRank(a: {
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
|
+
import type { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
3
|
+
export declare const createEditorStateNotificationPlugin: (onEditorStateUpdated: (props: {
|
|
4
|
+
oldEditorState: EditorState;
|
|
5
|
+
newEditorState: EditorState;
|
|
6
|
+
}) => void) => SafePlugin<any>;
|
|
@@ -1,5 +1,10 @@
|
|
|
1
|
+
import type { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
1
2
|
import type { EditorConfig } from './editor-config';
|
|
2
3
|
import type { PMPluginFactoryParams } from './pm-plugin';
|
|
3
4
|
export type PMPluginCreateConfig = PMPluginFactoryParams & {
|
|
4
5
|
editorConfig: EditorConfig;
|
|
6
|
+
onEditorStateUpdated: ((props: {
|
|
7
|
+
newEditorState: EditorState;
|
|
8
|
+
oldEditorState: EditorState;
|
|
9
|
+
}) => void) | undefined;
|
|
5
10
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-core",
|
|
3
|
-
"version": "202.3.
|
|
3
|
+
"version": "202.3.1",
|
|
4
4
|
"description": "A package contains Atlassian editor core functionality",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -97,7 +97,7 @@
|
|
|
97
97
|
"@atlaskit/primitives": "^13.2.0",
|
|
98
98
|
"@atlaskit/renderer": "^112.6.0",
|
|
99
99
|
"@atlaskit/smart-card": "^30.3.0",
|
|
100
|
-
"@atlaskit/synchrony-test-helpers": "^
|
|
100
|
+
"@atlaskit/synchrony-test-helpers": "^3.0.0",
|
|
101
101
|
"@atlaskit/toggle": "^13.4.0",
|
|
102
102
|
"@atlaskit/util-data-test": "^17.13.0",
|
|
103
103
|
"@atlaskit/visual-regression": "*",
|
|
@@ -290,6 +290,9 @@
|
|
|
290
290
|
"type": "boolean",
|
|
291
291
|
"referenceOnly": true
|
|
292
292
|
},
|
|
293
|
+
"platform_editor_catch_missing_injection_states": {
|
|
294
|
+
"type": "boolean"
|
|
295
|
+
},
|
|
293
296
|
"platform_editor_react_editor_view_react_18": {
|
|
294
297
|
"type": "boolean"
|
|
295
298
|
},
|