@atlaskit/editor-core 188.10.2 → 188.10.5
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 +3 -4
- package/dist/cjs/create-editor/create-editor.js +3 -6
- package/dist/cjs/create-editor/feature-flags-from-props.js +7 -9
- package/dist/cjs/plugins/paste/handlers.js +1 -5
- package/dist/cjs/utils/performance/instrumented-plugin.js +4 -10
- package/dist/cjs/utils/performance/safer-transactions.js +2 -5
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/es2019/create-editor/ReactEditorView.js +3 -4
- package/dist/es2019/create-editor/create-editor.js +3 -6
- package/dist/es2019/create-editor/feature-flags-from-props.js +7 -9
- package/dist/es2019/plugins/paste/handlers.js +1 -5
- package/dist/es2019/utils/performance/instrumented-plugin.js +4 -8
- package/dist/es2019/utils/performance/safer-transactions.js +2 -5
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/esm/create-editor/ReactEditorView.js +3 -4
- package/dist/esm/create-editor/create-editor.js +3 -6
- package/dist/esm/create-editor/feature-flags-from-props.js +7 -9
- package/dist/esm/plugins/paste/handlers.js +1 -5
- package/dist/esm/utils/performance/instrumented-plugin.js +4 -10
- package/dist/esm/utils/performance/safer-transactions.js +2 -5
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/types/utils/performance/instrumented-plugin.d.ts +0 -3
- package/dist/types/utils/performance/safer-transactions.d.ts +1 -2
- package/dist/types-ts4.5/utils/performance/instrumented-plugin.d.ts +0 -3
- package/dist/types-ts4.5/utils/performance/safer-transactions.d.ts +1 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @atlaskit/editor-core
|
|
2
2
|
|
|
3
|
+
## 188.10.5
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#41549](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/41549) [`2b9597a3f14`](https://bitbucket.org/atlassian/atlassian-frontend/commits/2b9597a3f14) - ESS-3896-remove-safer-dispatch-transaction-FF
|
|
8
|
+
|
|
9
|
+
## 188.10.4
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [#40640](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/40640) [`42b4beab30c`](https://bitbucket.org/atlassian/atlassian-frontend/commits/42b4beab30c) - ux [ED-18034] Inconsistent copy/paste behaviour of inline nodes in nested code blocks
|
|
14
|
+
|
|
3
15
|
## 188.10.2
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
|
@@ -275,11 +275,10 @@ var ReactEditorView = exports.ReactEditorView = /*#__PURE__*/function (_React$Co
|
|
|
275
275
|
}
|
|
276
276
|
var nodes = (0, _nodes.findChangedNodesFromTransaction)(unsafeTransaction);
|
|
277
277
|
var changedNodesValid = (0, _nodes.validateNodes)(nodes);
|
|
278
|
-
var transaction =
|
|
278
|
+
var transaction = new Proxy(unsafeTransaction, (0, _saferTransactions.freezeUnsafeTransactionProperties)({
|
|
279
279
|
dispatchAnalyticsEvent: _this.dispatchAnalyticsEvent,
|
|
280
|
-
pluginKey: 'unknown-reacteditorview'
|
|
281
|
-
|
|
282
|
-
})) : unsafeTransaction;
|
|
280
|
+
pluginKey: 'unknown-reacteditorview'
|
|
281
|
+
}));
|
|
283
282
|
if (changedNodesValid) {
|
|
284
283
|
var oldEditorState = _this.view.state;
|
|
285
284
|
|
|
@@ -101,15 +101,14 @@ function createPMPlugins(config) {
|
|
|
101
101
|
_config$performanceTr = config.performanceTracking,
|
|
102
102
|
performanceTracking = _config$performanceTr === void 0 ? {} : _config$performanceTr,
|
|
103
103
|
transactionTracker = config.transactionTracker,
|
|
104
|
-
featureFlags = config.featureFlags,
|
|
105
104
|
dispatchAnalyticsEvent = config.dispatchAnalyticsEvent;
|
|
106
105
|
var _performanceTracking$ = performanceTracking.uiTracking,
|
|
107
106
|
uiTracking = _performanceTracking$ === void 0 ? TRACKING_DEFAULT : _performanceTracking$,
|
|
108
107
|
_performanceTracking$2 = performanceTracking.transactionTracking,
|
|
109
108
|
transactionTracking = _performanceTracking$2 === void 0 ? TRACKING_DEFAULT : _performanceTracking$2;
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
var useInstrumentedPlugin = uiTracking.enabled || transactionTracking.enabled ||
|
|
109
|
+
|
|
110
|
+
// TO-DO need to question editor team about this condition true here
|
|
111
|
+
var useInstrumentedPlugin = uiTracking.enabled || transactionTracking.enabled || true;
|
|
113
112
|
if (process.env.NODE_ENV === 'development' && transactionTracking.enabled && !transactionTracker) {
|
|
114
113
|
// eslint-disable-next-line no-console
|
|
115
114
|
console.warn('createPMPlugins(): tracking is turned on but transactionTracker not defined! Transaction tracking has been disabled');
|
|
@@ -118,8 +117,6 @@ function createPMPlugins(config) {
|
|
|
118
117
|
return _instrumentedPlugin.InstrumentedPlugin.fromPlugin(plugin, {
|
|
119
118
|
uiTracking: uiTracking,
|
|
120
119
|
transactionTracking: transactionTracking,
|
|
121
|
-
saferDispatchedTransactions: saferDispatchedTransactions,
|
|
122
|
-
saferDispatchedTransactionsAnalyticsOnly: saferDispatchedTransactionsAnalyticsOnly,
|
|
123
120
|
dispatchAnalyticsEvent: dispatchAnalyticsEvent
|
|
124
121
|
}, transactionTracker);
|
|
125
122
|
} : function (plugin) {
|
|
@@ -32,7 +32,7 @@ function getSpellCheck(featureFlags) {
|
|
|
32
32
|
* which is used by both current and archv3 editors.
|
|
33
33
|
*/
|
|
34
34
|
function createFeatureFlagsFromProps(props) {
|
|
35
|
-
var _props$allowLayouts, _props$performanceTra, _props$allowExtension, _props$featureFlags, _props$featureFlags2, _props$featureFlags3, _props$featureFlags4, _props$featureFlags5, _props$featureFlags6, _props$featureFlags7, _props$featureFlags8, _props$featureFlags9, _props$featureFlags10, _props$featureFlags11, _props$featureFlags12, _props$featureFlags13, _props$featureFlags14, _props$
|
|
35
|
+
var _props$allowLayouts, _props$performanceTra, _props$allowExtension, _props$featureFlags, _props$featureFlags2, _props$featureFlags3, _props$featureFlags4, _props$featureFlags5, _props$featureFlags6, _props$featureFlags7, _props$featureFlags8, _props$featureFlags9, _props$featureFlags10, _props$featureFlags11, _props$featureFlags12, _props$featureFlags13, _props$featureFlags14, _props$collabEdit, _props$collabEdit2, _props$featureFlags15, _props$featureFlags16, _props$featureFlags17, _props$featureFlags18, _props$featureFlags19, _props$featureFlags20, _props$featureFlags21, _props$featureFlags22, _props$featureFlags23;
|
|
36
36
|
var normalizedFeatureFlags = (0, _normalizeFeatureFlags.normalizeFeatureFlags)(props.featureFlags);
|
|
37
37
|
return _objectSpread(_objectSpread({}, normalizedFeatureFlags), {}, {
|
|
38
38
|
newInsertionBehaviour: props.allowNewInsertionBehaviour,
|
|
@@ -52,18 +52,16 @@ function createFeatureFlagsFromProps(props) {
|
|
|
52
52
|
collabAvatarScroll: Boolean(typeof ((_props$featureFlags9 = props.featureFlags) === null || _props$featureFlags9 === void 0 ? void 0 : _props$featureFlags9.collabAvatarScroll) === 'boolean' ? !!((_props$featureFlags10 = props.featureFlags) !== null && _props$featureFlags10 !== void 0 && _props$featureFlags10.collabAvatarScroll) : false),
|
|
53
53
|
ufo: Boolean(typeof ((_props$featureFlags11 = props.featureFlags) === null || _props$featureFlags11 === void 0 ? void 0 : _props$featureFlags11.ufo) === 'boolean' ? !!((_props$featureFlags12 = props.featureFlags) !== null && _props$featureFlags12 !== void 0 && _props$featureFlags12.ufo) : false),
|
|
54
54
|
twoLineEditorToolbar: Boolean(typeof ((_props$featureFlags13 = props.featureFlags) === null || _props$featureFlags13 === void 0 ? void 0 : _props$featureFlags13.twoLineEditorToolbar) === 'boolean' ? !!((_props$featureFlags14 = props.featureFlags) !== null && _props$featureFlags14 !== void 0 && _props$featureFlags14.twoLineEditorToolbar) : false),
|
|
55
|
-
saferDispatchedTransactions: Boolean(typeof normalizedFeatureFlags.saferDispatchedTransactions === 'boolean' && !!normalizedFeatureFlags.saferDispatchedTransactions || (typeof ((_props$featureFlags15 = props.featureFlags) === null || _props$featureFlags15 === void 0 ? void 0 : _props$featureFlags15.saferDispatchedTransactions) === 'boolean' ? !!((_props$featureFlags16 = props.featureFlags) !== null && _props$featureFlags16 !== void 0 && _props$featureFlags16.saferDispatchedTransactions) : false)),
|
|
56
|
-
saferDispatchedTransactionsAnalyticsOnly: Boolean(typeof normalizedFeatureFlags.saferDispatchedTransactionsAnalyticsOnly === 'boolean' && !!normalizedFeatureFlags.saferDispatchedTransactionsAnalyticsOnly || (typeof ((_props$featureFlags17 = props.featureFlags) === null || _props$featureFlags17 === void 0 ? void 0 : _props$featureFlags17.saferDispatchedTransactionsAnalyticsOnly) === 'boolean' ? !!((_props$featureFlags18 = props.featureFlags) !== null && _props$featureFlags18 !== void 0 && _props$featureFlags18.saferDispatchedTransactionsAnalyticsOnly) : false)),
|
|
57
55
|
useNativeCollabPlugin: Boolean(typeof ((_props$collabEdit = props.collabEdit) === null || _props$collabEdit === void 0 ? void 0 : _props$collabEdit.useNativePlugin) === 'boolean' ? !!((_props$collabEdit2 = props.collabEdit) !== null && _props$collabEdit2 !== void 0 && _props$collabEdit2.useNativePlugin) : false),
|
|
58
|
-
chromeCursorHandlerFixedVersion: typeof ((_props$
|
|
59
|
-
showHoverPreview: Boolean(typeof ((_props$
|
|
60
|
-
indentationButtonsInTheToolbar: typeof props.showIndentationButtons === 'boolean' ? props.showIndentationButtons : Boolean(typeof normalizedFeatureFlags.indentationButtonsInTheToolbar === 'boolean' && !!normalizedFeatureFlags.indentationButtonsInTheToolbar || (typeof ((_props$
|
|
61
|
-
floatingToolbarLinkSettingsButton: typeof ((_props$
|
|
56
|
+
chromeCursorHandlerFixedVersion: typeof ((_props$featureFlags15 = props.featureFlags) === null || _props$featureFlags15 === void 0 ? void 0 : _props$featureFlags15.chromeCursorHandlerFixedVersion) === 'string' ? Number(props.featureFlags.chromeCursorHandlerFixedVersion) || undefined : undefined,
|
|
57
|
+
showHoverPreview: Boolean(typeof ((_props$featureFlags16 = props.featureFlags) === null || _props$featureFlags16 === void 0 ? void 0 : _props$featureFlags16.showHoverPreview) === 'boolean' ? !!((_props$featureFlags17 = props.featureFlags) !== null && _props$featureFlags17 !== void 0 && _props$featureFlags17.showHoverPreview) : false),
|
|
58
|
+
indentationButtonsInTheToolbar: typeof props.showIndentationButtons === 'boolean' ? props.showIndentationButtons : Boolean(typeof normalizedFeatureFlags.indentationButtonsInTheToolbar === 'boolean' && !!normalizedFeatureFlags.indentationButtonsInTheToolbar || (typeof ((_props$featureFlags18 = props.featureFlags) === null || _props$featureFlags18 === void 0 ? void 0 : _props$featureFlags18.indentationButtonsInTheToolbar) === 'boolean' ? !!((_props$featureFlags19 = props.featureFlags) !== null && _props$featureFlags19 !== void 0 && _props$featureFlags19.indentationButtonsInTheToolbar) : false)),
|
|
59
|
+
floatingToolbarLinkSettingsButton: typeof ((_props$featureFlags20 = props.featureFlags) === null || _props$featureFlags20 === void 0 ? void 0 : _props$featureFlags20['floating-toolbar-link-settings-button']) === 'string' ? props.featureFlags['floating-toolbar-link-settings-button'] || undefined : undefined,
|
|
62
60
|
disableSpellcheckByBrowser: getSpellCheck(props.featureFlags),
|
|
63
61
|
// Including fallback to props.featureFlags so that mobile feature flags
|
|
64
62
|
// are included (they are not kebab cased)
|
|
65
|
-
restartNumberedLists: normalizedFeatureFlags.restartNumberedLists === true || ((_props$
|
|
63
|
+
restartNumberedLists: normalizedFeatureFlags.restartNumberedLists === true || ((_props$featureFlags21 = props.featureFlags) === null || _props$featureFlags21 === void 0 ? void 0 : _props$featureFlags21.restartNumberedLists) === true,
|
|
66
64
|
lpLinkPickerFocusTrap: Boolean(normalizedFeatureFlags.lpLinkPickerFocusTrap),
|
|
67
|
-
preventPopupOverflow: Boolean(typeof ((_props$
|
|
65
|
+
preventPopupOverflow: Boolean(typeof ((_props$featureFlags22 = props.featureFlags) === null || _props$featureFlags22 === void 0 ? void 0 : _props$featureFlags22['prevent-popup-overflow']) === 'boolean' ? !!((_props$featureFlags23 = props.featureFlags) !== null && _props$featureFlags23 !== void 0 && _props$featureFlags23['prevent-popup-overflow']) : false)
|
|
68
66
|
});
|
|
69
67
|
}
|
|
@@ -855,18 +855,14 @@ function handleRichText(slice, queueCardsFromChangedTr) {
|
|
|
855
855
|
}
|
|
856
856
|
} else {
|
|
857
857
|
// need to scan the slice if there's a block node or list items inside it
|
|
858
|
-
var doesBlockNodeExist = false;
|
|
859
858
|
var sliceHasList = false;
|
|
860
859
|
slice.content.nodesBetween(0, slice.content.size, function (node, start) {
|
|
861
860
|
if (node.type === state.schema.nodes.listItem) {
|
|
862
861
|
sliceHasList = true;
|
|
863
|
-
}
|
|
864
|
-
if (start >= slice.openStart && start <= slice.content.size - slice.openEnd && node.isBlock) {
|
|
865
|
-
doesBlockNodeExist = true;
|
|
866
862
|
return false;
|
|
867
863
|
}
|
|
868
864
|
});
|
|
869
|
-
if ((0, _utils3.insideTableCell)(state) && (
|
|
865
|
+
if ((0, _utils3.insideTableCell)(state) && (0, _utils3.isInListItem)(state) && (0, _utils.canInsert)(selection.$from, slice.content) && (0, _utils.canInsert)(selection.$to, slice.content) || sliceHasList) {
|
|
870
866
|
tr.replaceSelection(slice);
|
|
871
867
|
} else {
|
|
872
868
|
// need safeInsert rather than replaceSelection, so that nodes aren't split in half
|
|
@@ -32,21 +32,15 @@ var InstrumentedPlugin = exports.InstrumentedPlugin = /*#__PURE__*/function (_Sa
|
|
|
32
32
|
uiTracking = _options$uiTracking === void 0 ? {
|
|
33
33
|
enabled: false
|
|
34
34
|
} : _options$uiTracking,
|
|
35
|
-
_options$saferDispatc = options.saferDispatchedTransactions,
|
|
36
|
-
saferDispatchedTransactions = _options$saferDispatc === void 0 ? false : _options$saferDispatc,
|
|
37
|
-
_options$saferDispatc2 = options.saferDispatchedTransactionsAnalyticsOnly,
|
|
38
|
-
saferDispatchedTransactionsAnalyticsOnly = _options$saferDispatc2 === void 0 ? false : _options$saferDispatc2,
|
|
39
35
|
dispatchAnalyticsEvent = options.dispatchAnalyticsEvent;
|
|
40
|
-
|
|
41
|
-
if (shouldOverrideApply && spec.state) {
|
|
36
|
+
if (spec.state) {
|
|
42
37
|
var originalApply = spec.state.apply.bind(spec.state);
|
|
43
38
|
spec.state.apply = function (aTr, value, oldState, newState) {
|
|
44
39
|
var self = (0, _assertThisInitialized2.default)(_this);
|
|
45
|
-
var tr =
|
|
40
|
+
var tr = new Proxy(aTr, (0, _saferTransactions.freezeUnsafeTransactionProperties)({
|
|
46
41
|
dispatchAnalyticsEvent: dispatchAnalyticsEvent,
|
|
47
|
-
pluginKey: self.key
|
|
48
|
-
|
|
49
|
-
})) : aTr;
|
|
42
|
+
pluginKey: self.key
|
|
43
|
+
}));
|
|
50
44
|
var shouldTrackTransactions = transactionTracker === null || transactionTracker === void 0 ? void 0 : transactionTracker.shouldTrackTransaction(transactionTracking);
|
|
51
45
|
if (!shouldTrackTransactions || !transactionTracker) {
|
|
52
46
|
return originalApply(tr, value, oldState, newState);
|
|
@@ -16,8 +16,7 @@ var isReadOnlyProperty = function isReadOnlyProperty(prop) {
|
|
|
16
16
|
};
|
|
17
17
|
var freezeUnsafeTransactionProperties = exports.freezeUnsafeTransactionProperties = function freezeUnsafeTransactionProperties(_ref) {
|
|
18
18
|
var dispatchAnalyticsEvent = _ref.dispatchAnalyticsEvent,
|
|
19
|
-
pluginKey = _ref.pluginKey
|
|
20
|
-
analyticsOnly = _ref.analyticsOnly;
|
|
19
|
+
pluginKey = _ref.pluginKey;
|
|
21
20
|
var isUnsafe = function isUnsafe() {
|
|
22
21
|
if (dispatchAnalyticsEvent) {
|
|
23
22
|
dispatchAnalyticsEvent({
|
|
@@ -32,9 +31,7 @@ var freezeUnsafeTransactionProperties = exports.freezeUnsafeTransactionPropertie
|
|
|
32
31
|
}
|
|
33
32
|
});
|
|
34
33
|
}
|
|
35
|
-
|
|
36
|
-
throw new Error(UNSAFE_PROPERTY_SET_ERROR);
|
|
37
|
-
}
|
|
34
|
+
throw new Error(UNSAFE_PROPERTY_SET_ERROR);
|
|
38
35
|
};
|
|
39
36
|
return {
|
|
40
37
|
get: function get(target, prop, receiver) {
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.version = exports.nextMajorVersion = exports.name = void 0;
|
|
7
7
|
var name = exports.name = "@atlaskit/editor-core";
|
|
8
|
-
var version = exports.version = "188.10.
|
|
8
|
+
var version = exports.version = "188.10.5";
|
|
9
9
|
var nextMajorVersion = exports.nextMajorVersion = function nextMajorVersion() {
|
|
10
10
|
return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
|
|
11
11
|
};
|
|
@@ -276,11 +276,10 @@ export class ReactEditorView extends React.Component {
|
|
|
276
276
|
}
|
|
277
277
|
const nodes = findChangedNodesFromTransaction(unsafeTransaction);
|
|
278
278
|
const changedNodesValid = validateNodes(nodes);
|
|
279
|
-
const transaction =
|
|
279
|
+
const transaction = new Proxy(unsafeTransaction, freezeUnsafeTransactionProperties({
|
|
280
280
|
dispatchAnalyticsEvent: this.dispatchAnalyticsEvent,
|
|
281
|
-
pluginKey: 'unknown-reacteditorview'
|
|
282
|
-
|
|
283
|
-
})) : unsafeTransaction;
|
|
281
|
+
pluginKey: 'unknown-reacteditorview'
|
|
282
|
+
}));
|
|
284
283
|
if (changedNodesValid) {
|
|
285
284
|
const oldEditorState = this.view.state;
|
|
286
285
|
|
|
@@ -82,16 +82,15 @@ export function createPMPlugins(config) {
|
|
|
82
82
|
editorConfig,
|
|
83
83
|
performanceTracking = {},
|
|
84
84
|
transactionTracker,
|
|
85
|
-
featureFlags,
|
|
86
85
|
dispatchAnalyticsEvent
|
|
87
86
|
} = config;
|
|
88
87
|
const {
|
|
89
88
|
uiTracking = TRACKING_DEFAULT,
|
|
90
89
|
transactionTracking = TRACKING_DEFAULT
|
|
91
90
|
} = performanceTracking;
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
const useInstrumentedPlugin = uiTracking.enabled || transactionTracking.enabled ||
|
|
91
|
+
|
|
92
|
+
// TO-DO need to question editor team about this condition true here
|
|
93
|
+
const useInstrumentedPlugin = uiTracking.enabled || transactionTracking.enabled || true;
|
|
95
94
|
if (process.env.NODE_ENV === 'development' && transactionTracking.enabled && !transactionTracker) {
|
|
96
95
|
// eslint-disable-next-line no-console
|
|
97
96
|
console.warn('createPMPlugins(): tracking is turned on but transactionTracker not defined! Transaction tracking has been disabled');
|
|
@@ -99,8 +98,6 @@ export function createPMPlugins(config) {
|
|
|
99
98
|
const instrumentPlugin = useInstrumentedPlugin ? plugin => InstrumentedPlugin.fromPlugin(plugin, {
|
|
100
99
|
uiTracking,
|
|
101
100
|
transactionTracking,
|
|
102
|
-
saferDispatchedTransactions,
|
|
103
|
-
saferDispatchedTransactionsAnalyticsOnly,
|
|
104
101
|
dispatchAnalyticsEvent
|
|
105
102
|
}, transactionTracker) : plugin => plugin;
|
|
106
103
|
return editorConfig.pmPlugins.sort(sortByOrder('plugins')).map(({
|
|
@@ -21,7 +21,7 @@ function getSpellCheck(featureFlags) {
|
|
|
21
21
|
* which is used by both current and archv3 editors.
|
|
22
22
|
*/
|
|
23
23
|
export function createFeatureFlagsFromProps(props) {
|
|
24
|
-
var _props$allowLayouts, _props$performanceTra, _props$performanceTra2, _props$allowExtension, _props$featureFlags, _props$featureFlags2, _props$featureFlags3, _props$featureFlags4, _props$featureFlags5, _props$featureFlags6, _props$featureFlags7, _props$featureFlags8, _props$featureFlags9, _props$featureFlags10, _props$featureFlags11, _props$featureFlags12, _props$featureFlags13, _props$featureFlags14, _props$
|
|
24
|
+
var _props$allowLayouts, _props$performanceTra, _props$performanceTra2, _props$allowExtension, _props$featureFlags, _props$featureFlags2, _props$featureFlags3, _props$featureFlags4, _props$featureFlags5, _props$featureFlags6, _props$featureFlags7, _props$featureFlags8, _props$featureFlags9, _props$featureFlags10, _props$featureFlags11, _props$featureFlags12, _props$featureFlags13, _props$featureFlags14, _props$collabEdit, _props$collabEdit2, _props$featureFlags15, _props$featureFlags16, _props$featureFlags17, _props$featureFlags18, _props$featureFlags19, _props$featureFlags20, _props$featureFlags21, _props$featureFlags22, _props$featureFlags23;
|
|
25
25
|
const normalizedFeatureFlags = normalizeFeatureFlags(props.featureFlags);
|
|
26
26
|
return {
|
|
27
27
|
...normalizedFeatureFlags,
|
|
@@ -42,18 +42,16 @@ export function createFeatureFlagsFromProps(props) {
|
|
|
42
42
|
collabAvatarScroll: Boolean(typeof ((_props$featureFlags9 = props.featureFlags) === null || _props$featureFlags9 === void 0 ? void 0 : _props$featureFlags9.collabAvatarScroll) === 'boolean' ? !!((_props$featureFlags10 = props.featureFlags) !== null && _props$featureFlags10 !== void 0 && _props$featureFlags10.collabAvatarScroll) : false),
|
|
43
43
|
ufo: Boolean(typeof ((_props$featureFlags11 = props.featureFlags) === null || _props$featureFlags11 === void 0 ? void 0 : _props$featureFlags11.ufo) === 'boolean' ? !!((_props$featureFlags12 = props.featureFlags) !== null && _props$featureFlags12 !== void 0 && _props$featureFlags12.ufo) : false),
|
|
44
44
|
twoLineEditorToolbar: Boolean(typeof ((_props$featureFlags13 = props.featureFlags) === null || _props$featureFlags13 === void 0 ? void 0 : _props$featureFlags13.twoLineEditorToolbar) === 'boolean' ? !!((_props$featureFlags14 = props.featureFlags) !== null && _props$featureFlags14 !== void 0 && _props$featureFlags14.twoLineEditorToolbar) : false),
|
|
45
|
-
saferDispatchedTransactions: Boolean(typeof normalizedFeatureFlags.saferDispatchedTransactions === 'boolean' && !!normalizedFeatureFlags.saferDispatchedTransactions || (typeof ((_props$featureFlags15 = props.featureFlags) === null || _props$featureFlags15 === void 0 ? void 0 : _props$featureFlags15.saferDispatchedTransactions) === 'boolean' ? !!((_props$featureFlags16 = props.featureFlags) !== null && _props$featureFlags16 !== void 0 && _props$featureFlags16.saferDispatchedTransactions) : false)),
|
|
46
|
-
saferDispatchedTransactionsAnalyticsOnly: Boolean(typeof normalizedFeatureFlags.saferDispatchedTransactionsAnalyticsOnly === 'boolean' && !!normalizedFeatureFlags.saferDispatchedTransactionsAnalyticsOnly || (typeof ((_props$featureFlags17 = props.featureFlags) === null || _props$featureFlags17 === void 0 ? void 0 : _props$featureFlags17.saferDispatchedTransactionsAnalyticsOnly) === 'boolean' ? !!((_props$featureFlags18 = props.featureFlags) !== null && _props$featureFlags18 !== void 0 && _props$featureFlags18.saferDispatchedTransactionsAnalyticsOnly) : false)),
|
|
47
45
|
useNativeCollabPlugin: Boolean(typeof ((_props$collabEdit = props.collabEdit) === null || _props$collabEdit === void 0 ? void 0 : _props$collabEdit.useNativePlugin) === 'boolean' ? !!((_props$collabEdit2 = props.collabEdit) !== null && _props$collabEdit2 !== void 0 && _props$collabEdit2.useNativePlugin) : false),
|
|
48
|
-
chromeCursorHandlerFixedVersion: typeof ((_props$
|
|
49
|
-
showHoverPreview: Boolean(typeof ((_props$
|
|
50
|
-
indentationButtonsInTheToolbar: typeof props.showIndentationButtons === 'boolean' ? props.showIndentationButtons : Boolean(typeof normalizedFeatureFlags.indentationButtonsInTheToolbar === 'boolean' && !!normalizedFeatureFlags.indentationButtonsInTheToolbar || (typeof ((_props$
|
|
51
|
-
floatingToolbarLinkSettingsButton: typeof ((_props$
|
|
46
|
+
chromeCursorHandlerFixedVersion: typeof ((_props$featureFlags15 = props.featureFlags) === null || _props$featureFlags15 === void 0 ? void 0 : _props$featureFlags15.chromeCursorHandlerFixedVersion) === 'string' ? Number(props.featureFlags.chromeCursorHandlerFixedVersion) || undefined : undefined,
|
|
47
|
+
showHoverPreview: Boolean(typeof ((_props$featureFlags16 = props.featureFlags) === null || _props$featureFlags16 === void 0 ? void 0 : _props$featureFlags16.showHoverPreview) === 'boolean' ? !!((_props$featureFlags17 = props.featureFlags) !== null && _props$featureFlags17 !== void 0 && _props$featureFlags17.showHoverPreview) : false),
|
|
48
|
+
indentationButtonsInTheToolbar: typeof props.showIndentationButtons === 'boolean' ? props.showIndentationButtons : Boolean(typeof normalizedFeatureFlags.indentationButtonsInTheToolbar === 'boolean' && !!normalizedFeatureFlags.indentationButtonsInTheToolbar || (typeof ((_props$featureFlags18 = props.featureFlags) === null || _props$featureFlags18 === void 0 ? void 0 : _props$featureFlags18.indentationButtonsInTheToolbar) === 'boolean' ? !!((_props$featureFlags19 = props.featureFlags) !== null && _props$featureFlags19 !== void 0 && _props$featureFlags19.indentationButtonsInTheToolbar) : false)),
|
|
49
|
+
floatingToolbarLinkSettingsButton: typeof ((_props$featureFlags20 = props.featureFlags) === null || _props$featureFlags20 === void 0 ? void 0 : _props$featureFlags20['floating-toolbar-link-settings-button']) === 'string' ? props.featureFlags['floating-toolbar-link-settings-button'] || undefined : undefined,
|
|
52
50
|
disableSpellcheckByBrowser: getSpellCheck(props.featureFlags),
|
|
53
51
|
// Including fallback to props.featureFlags so that mobile feature flags
|
|
54
52
|
// are included (they are not kebab cased)
|
|
55
|
-
restartNumberedLists: normalizedFeatureFlags.restartNumberedLists === true || ((_props$
|
|
53
|
+
restartNumberedLists: normalizedFeatureFlags.restartNumberedLists === true || ((_props$featureFlags21 = props.featureFlags) === null || _props$featureFlags21 === void 0 ? void 0 : _props$featureFlags21.restartNumberedLists) === true,
|
|
56
54
|
lpLinkPickerFocusTrap: Boolean(normalizedFeatureFlags.lpLinkPickerFocusTrap),
|
|
57
|
-
preventPopupOverflow: Boolean(typeof ((_props$
|
|
55
|
+
preventPopupOverflow: Boolean(typeof ((_props$featureFlags22 = props.featureFlags) === null || _props$featureFlags22 === void 0 ? void 0 : _props$featureFlags22['prevent-popup-overflow']) === 'boolean' ? !!((_props$featureFlags23 = props.featureFlags) !== null && _props$featureFlags23 !== void 0 && _props$featureFlags23['prevent-popup-overflow']) : false)
|
|
58
56
|
};
|
|
59
57
|
}
|
|
@@ -839,18 +839,14 @@ export function handleRichText(slice, queueCardsFromChangedTr) {
|
|
|
839
839
|
}
|
|
840
840
|
} else {
|
|
841
841
|
// need to scan the slice if there's a block node or list items inside it
|
|
842
|
-
let doesBlockNodeExist = false;
|
|
843
842
|
let sliceHasList = false;
|
|
844
843
|
slice.content.nodesBetween(0, slice.content.size, (node, start) => {
|
|
845
844
|
if (node.type === state.schema.nodes.listItem) {
|
|
846
845
|
sliceHasList = true;
|
|
847
|
-
}
|
|
848
|
-
if (start >= slice.openStart && start <= slice.content.size - slice.openEnd && node.isBlock) {
|
|
849
|
-
doesBlockNodeExist = true;
|
|
850
846
|
return false;
|
|
851
847
|
}
|
|
852
848
|
});
|
|
853
|
-
if (insideTableCell(state) &&
|
|
849
|
+
if (insideTableCell(state) && isInListItem(state) && canInsert(selection.$from, slice.content) && canInsert(selection.$to, slice.content) || sliceHasList) {
|
|
854
850
|
tr.replaceSelection(slice);
|
|
855
851
|
} else {
|
|
856
852
|
// need safeInsert rather than replaceSelection, so that nodes aren't split in half
|
|
@@ -10,20 +10,16 @@ export class InstrumentedPlugin extends SafePlugin {
|
|
|
10
10
|
uiTracking = {
|
|
11
11
|
enabled: false
|
|
12
12
|
},
|
|
13
|
-
saferDispatchedTransactions = false,
|
|
14
|
-
saferDispatchedTransactionsAnalyticsOnly = false,
|
|
15
13
|
dispatchAnalyticsEvent
|
|
16
14
|
} = options;
|
|
17
|
-
|
|
18
|
-
if (shouldOverrideApply && spec.state) {
|
|
15
|
+
if (spec.state) {
|
|
19
16
|
const originalApply = spec.state.apply.bind(spec.state);
|
|
20
17
|
spec.state.apply = (aTr, value, oldState, newState) => {
|
|
21
18
|
const self = this;
|
|
22
|
-
const tr =
|
|
19
|
+
const tr = new Proxy(aTr, freezeUnsafeTransactionProperties({
|
|
23
20
|
dispatchAnalyticsEvent,
|
|
24
|
-
pluginKey: self.key
|
|
25
|
-
|
|
26
|
-
})) : aTr;
|
|
21
|
+
pluginKey: self.key
|
|
22
|
+
}));
|
|
27
23
|
const shouldTrackTransactions = transactionTracker === null || transactionTracker === void 0 ? void 0 : transactionTracker.shouldTrackTransaction(transactionTracking);
|
|
28
24
|
if (!shouldTrackTransactions || !transactionTracker) {
|
|
29
25
|
return originalApply(tr, value, oldState, newState);
|
|
@@ -6,8 +6,7 @@ const isUnsafeMethod = prop => ['setSelection'].includes(prop.toString());
|
|
|
6
6
|
const isReadOnlyProperty = prop => ['doc', 'docs', 'steps', 'selection'].includes(prop.toString());
|
|
7
7
|
export const freezeUnsafeTransactionProperties = ({
|
|
8
8
|
dispatchAnalyticsEvent,
|
|
9
|
-
pluginKey
|
|
10
|
-
analyticsOnly
|
|
9
|
+
pluginKey
|
|
11
10
|
}) => {
|
|
12
11
|
const isUnsafe = () => {
|
|
13
12
|
if (dispatchAnalyticsEvent) {
|
|
@@ -23,9 +22,7 @@ export const freezeUnsafeTransactionProperties = ({
|
|
|
23
22
|
}
|
|
24
23
|
});
|
|
25
24
|
}
|
|
26
|
-
|
|
27
|
-
throw new Error(UNSAFE_PROPERTY_SET_ERROR);
|
|
28
|
-
}
|
|
25
|
+
throw new Error(UNSAFE_PROPERTY_SET_ERROR);
|
|
29
26
|
};
|
|
30
27
|
return {
|
|
31
28
|
get: function (target, prop, receiver) {
|
|
@@ -269,11 +269,10 @@ export var ReactEditorView = /*#__PURE__*/function (_React$Component) {
|
|
|
269
269
|
}
|
|
270
270
|
var nodes = findChangedNodesFromTransaction(unsafeTransaction);
|
|
271
271
|
var changedNodesValid = validateNodes(nodes);
|
|
272
|
-
var transaction =
|
|
272
|
+
var transaction = new Proxy(unsafeTransaction, freezeUnsafeTransactionProperties({
|
|
273
273
|
dispatchAnalyticsEvent: _this.dispatchAnalyticsEvent,
|
|
274
|
-
pluginKey: 'unknown-reacteditorview'
|
|
275
|
-
|
|
276
|
-
})) : unsafeTransaction;
|
|
274
|
+
pluginKey: 'unknown-reacteditorview'
|
|
275
|
+
}));
|
|
277
276
|
if (changedNodesValid) {
|
|
278
277
|
var oldEditorState = _this.view.state;
|
|
279
278
|
|
|
@@ -90,15 +90,14 @@ export function createPMPlugins(config) {
|
|
|
90
90
|
_config$performanceTr = config.performanceTracking,
|
|
91
91
|
performanceTracking = _config$performanceTr === void 0 ? {} : _config$performanceTr,
|
|
92
92
|
transactionTracker = config.transactionTracker,
|
|
93
|
-
featureFlags = config.featureFlags,
|
|
94
93
|
dispatchAnalyticsEvent = config.dispatchAnalyticsEvent;
|
|
95
94
|
var _performanceTracking$ = performanceTracking.uiTracking,
|
|
96
95
|
uiTracking = _performanceTracking$ === void 0 ? TRACKING_DEFAULT : _performanceTracking$,
|
|
97
96
|
_performanceTracking$2 = performanceTracking.transactionTracking,
|
|
98
97
|
transactionTracking = _performanceTracking$2 === void 0 ? TRACKING_DEFAULT : _performanceTracking$2;
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
var useInstrumentedPlugin = uiTracking.enabled || transactionTracking.enabled ||
|
|
98
|
+
|
|
99
|
+
// TO-DO need to question editor team about this condition true here
|
|
100
|
+
var useInstrumentedPlugin = uiTracking.enabled || transactionTracking.enabled || true;
|
|
102
101
|
if (process.env.NODE_ENV === 'development' && transactionTracking.enabled && !transactionTracker) {
|
|
103
102
|
// eslint-disable-next-line no-console
|
|
104
103
|
console.warn('createPMPlugins(): tracking is turned on but transactionTracker not defined! Transaction tracking has been disabled');
|
|
@@ -107,8 +106,6 @@ export function createPMPlugins(config) {
|
|
|
107
106
|
return InstrumentedPlugin.fromPlugin(plugin, {
|
|
108
107
|
uiTracking: uiTracking,
|
|
109
108
|
transactionTracking: transactionTracking,
|
|
110
|
-
saferDispatchedTransactions: saferDispatchedTransactions,
|
|
111
|
-
saferDispatchedTransactionsAnalyticsOnly: saferDispatchedTransactionsAnalyticsOnly,
|
|
112
109
|
dispatchAnalyticsEvent: dispatchAnalyticsEvent
|
|
113
110
|
}, transactionTracker);
|
|
114
111
|
} : function (plugin) {
|
|
@@ -25,7 +25,7 @@ function getSpellCheck(featureFlags) {
|
|
|
25
25
|
* which is used by both current and archv3 editors.
|
|
26
26
|
*/
|
|
27
27
|
export function createFeatureFlagsFromProps(props) {
|
|
28
|
-
var _props$allowLayouts, _props$performanceTra, _props$allowExtension, _props$featureFlags, _props$featureFlags2, _props$featureFlags3, _props$featureFlags4, _props$featureFlags5, _props$featureFlags6, _props$featureFlags7, _props$featureFlags8, _props$featureFlags9, _props$featureFlags10, _props$featureFlags11, _props$featureFlags12, _props$featureFlags13, _props$featureFlags14, _props$
|
|
28
|
+
var _props$allowLayouts, _props$performanceTra, _props$allowExtension, _props$featureFlags, _props$featureFlags2, _props$featureFlags3, _props$featureFlags4, _props$featureFlags5, _props$featureFlags6, _props$featureFlags7, _props$featureFlags8, _props$featureFlags9, _props$featureFlags10, _props$featureFlags11, _props$featureFlags12, _props$featureFlags13, _props$featureFlags14, _props$collabEdit, _props$collabEdit2, _props$featureFlags15, _props$featureFlags16, _props$featureFlags17, _props$featureFlags18, _props$featureFlags19, _props$featureFlags20, _props$featureFlags21, _props$featureFlags22, _props$featureFlags23;
|
|
29
29
|
var normalizedFeatureFlags = normalizeFeatureFlags(props.featureFlags);
|
|
30
30
|
return _objectSpread(_objectSpread({}, normalizedFeatureFlags), {}, {
|
|
31
31
|
newInsertionBehaviour: props.allowNewInsertionBehaviour,
|
|
@@ -45,18 +45,16 @@ export function createFeatureFlagsFromProps(props) {
|
|
|
45
45
|
collabAvatarScroll: Boolean(typeof ((_props$featureFlags9 = props.featureFlags) === null || _props$featureFlags9 === void 0 ? void 0 : _props$featureFlags9.collabAvatarScroll) === 'boolean' ? !!((_props$featureFlags10 = props.featureFlags) !== null && _props$featureFlags10 !== void 0 && _props$featureFlags10.collabAvatarScroll) : false),
|
|
46
46
|
ufo: Boolean(typeof ((_props$featureFlags11 = props.featureFlags) === null || _props$featureFlags11 === void 0 ? void 0 : _props$featureFlags11.ufo) === 'boolean' ? !!((_props$featureFlags12 = props.featureFlags) !== null && _props$featureFlags12 !== void 0 && _props$featureFlags12.ufo) : false),
|
|
47
47
|
twoLineEditorToolbar: Boolean(typeof ((_props$featureFlags13 = props.featureFlags) === null || _props$featureFlags13 === void 0 ? void 0 : _props$featureFlags13.twoLineEditorToolbar) === 'boolean' ? !!((_props$featureFlags14 = props.featureFlags) !== null && _props$featureFlags14 !== void 0 && _props$featureFlags14.twoLineEditorToolbar) : false),
|
|
48
|
-
saferDispatchedTransactions: Boolean(typeof normalizedFeatureFlags.saferDispatchedTransactions === 'boolean' && !!normalizedFeatureFlags.saferDispatchedTransactions || (typeof ((_props$featureFlags15 = props.featureFlags) === null || _props$featureFlags15 === void 0 ? void 0 : _props$featureFlags15.saferDispatchedTransactions) === 'boolean' ? !!((_props$featureFlags16 = props.featureFlags) !== null && _props$featureFlags16 !== void 0 && _props$featureFlags16.saferDispatchedTransactions) : false)),
|
|
49
|
-
saferDispatchedTransactionsAnalyticsOnly: Boolean(typeof normalizedFeatureFlags.saferDispatchedTransactionsAnalyticsOnly === 'boolean' && !!normalizedFeatureFlags.saferDispatchedTransactionsAnalyticsOnly || (typeof ((_props$featureFlags17 = props.featureFlags) === null || _props$featureFlags17 === void 0 ? void 0 : _props$featureFlags17.saferDispatchedTransactionsAnalyticsOnly) === 'boolean' ? !!((_props$featureFlags18 = props.featureFlags) !== null && _props$featureFlags18 !== void 0 && _props$featureFlags18.saferDispatchedTransactionsAnalyticsOnly) : false)),
|
|
50
48
|
useNativeCollabPlugin: Boolean(typeof ((_props$collabEdit = props.collabEdit) === null || _props$collabEdit === void 0 ? void 0 : _props$collabEdit.useNativePlugin) === 'boolean' ? !!((_props$collabEdit2 = props.collabEdit) !== null && _props$collabEdit2 !== void 0 && _props$collabEdit2.useNativePlugin) : false),
|
|
51
|
-
chromeCursorHandlerFixedVersion: typeof ((_props$
|
|
52
|
-
showHoverPreview: Boolean(typeof ((_props$
|
|
53
|
-
indentationButtonsInTheToolbar: typeof props.showIndentationButtons === 'boolean' ? props.showIndentationButtons : Boolean(typeof normalizedFeatureFlags.indentationButtonsInTheToolbar === 'boolean' && !!normalizedFeatureFlags.indentationButtonsInTheToolbar || (typeof ((_props$
|
|
54
|
-
floatingToolbarLinkSettingsButton: typeof ((_props$
|
|
49
|
+
chromeCursorHandlerFixedVersion: typeof ((_props$featureFlags15 = props.featureFlags) === null || _props$featureFlags15 === void 0 ? void 0 : _props$featureFlags15.chromeCursorHandlerFixedVersion) === 'string' ? Number(props.featureFlags.chromeCursorHandlerFixedVersion) || undefined : undefined,
|
|
50
|
+
showHoverPreview: Boolean(typeof ((_props$featureFlags16 = props.featureFlags) === null || _props$featureFlags16 === void 0 ? void 0 : _props$featureFlags16.showHoverPreview) === 'boolean' ? !!((_props$featureFlags17 = props.featureFlags) !== null && _props$featureFlags17 !== void 0 && _props$featureFlags17.showHoverPreview) : false),
|
|
51
|
+
indentationButtonsInTheToolbar: typeof props.showIndentationButtons === 'boolean' ? props.showIndentationButtons : Boolean(typeof normalizedFeatureFlags.indentationButtonsInTheToolbar === 'boolean' && !!normalizedFeatureFlags.indentationButtonsInTheToolbar || (typeof ((_props$featureFlags18 = props.featureFlags) === null || _props$featureFlags18 === void 0 ? void 0 : _props$featureFlags18.indentationButtonsInTheToolbar) === 'boolean' ? !!((_props$featureFlags19 = props.featureFlags) !== null && _props$featureFlags19 !== void 0 && _props$featureFlags19.indentationButtonsInTheToolbar) : false)),
|
|
52
|
+
floatingToolbarLinkSettingsButton: typeof ((_props$featureFlags20 = props.featureFlags) === null || _props$featureFlags20 === void 0 ? void 0 : _props$featureFlags20['floating-toolbar-link-settings-button']) === 'string' ? props.featureFlags['floating-toolbar-link-settings-button'] || undefined : undefined,
|
|
55
53
|
disableSpellcheckByBrowser: getSpellCheck(props.featureFlags),
|
|
56
54
|
// Including fallback to props.featureFlags so that mobile feature flags
|
|
57
55
|
// are included (they are not kebab cased)
|
|
58
|
-
restartNumberedLists: normalizedFeatureFlags.restartNumberedLists === true || ((_props$
|
|
56
|
+
restartNumberedLists: normalizedFeatureFlags.restartNumberedLists === true || ((_props$featureFlags21 = props.featureFlags) === null || _props$featureFlags21 === void 0 ? void 0 : _props$featureFlags21.restartNumberedLists) === true,
|
|
59
57
|
lpLinkPickerFocusTrap: Boolean(normalizedFeatureFlags.lpLinkPickerFocusTrap),
|
|
60
|
-
preventPopupOverflow: Boolean(typeof ((_props$
|
|
58
|
+
preventPopupOverflow: Boolean(typeof ((_props$featureFlags22 = props.featureFlags) === null || _props$featureFlags22 === void 0 ? void 0 : _props$featureFlags22['prevent-popup-overflow']) === 'boolean' ? !!((_props$featureFlags23 = props.featureFlags) !== null && _props$featureFlags23 !== void 0 && _props$featureFlags23['prevent-popup-overflow']) : false)
|
|
61
59
|
});
|
|
62
60
|
}
|
|
@@ -831,18 +831,14 @@ export function handleRichText(slice, queueCardsFromChangedTr) {
|
|
|
831
831
|
}
|
|
832
832
|
} else {
|
|
833
833
|
// need to scan the slice if there's a block node or list items inside it
|
|
834
|
-
var doesBlockNodeExist = false;
|
|
835
834
|
var sliceHasList = false;
|
|
836
835
|
slice.content.nodesBetween(0, slice.content.size, function (node, start) {
|
|
837
836
|
if (node.type === state.schema.nodes.listItem) {
|
|
838
837
|
sliceHasList = true;
|
|
839
|
-
}
|
|
840
|
-
if (start >= slice.openStart && start <= slice.content.size - slice.openEnd && node.isBlock) {
|
|
841
|
-
doesBlockNodeExist = true;
|
|
842
838
|
return false;
|
|
843
839
|
}
|
|
844
840
|
});
|
|
845
|
-
if (insideTableCell(state) &&
|
|
841
|
+
if (insideTableCell(state) && isInListItem(state) && canInsert(selection.$from, slice.content) && canInsert(selection.$to, slice.content) || sliceHasList) {
|
|
846
842
|
tr.replaceSelection(slice);
|
|
847
843
|
} else {
|
|
848
844
|
// need safeInsert rather than replaceSelection, so that nodes aren't split in half
|
|
@@ -25,21 +25,15 @@ export var InstrumentedPlugin = /*#__PURE__*/function (_SafePlugin) {
|
|
|
25
25
|
uiTracking = _options$uiTracking === void 0 ? {
|
|
26
26
|
enabled: false
|
|
27
27
|
} : _options$uiTracking,
|
|
28
|
-
_options$saferDispatc = options.saferDispatchedTransactions,
|
|
29
|
-
saferDispatchedTransactions = _options$saferDispatc === void 0 ? false : _options$saferDispatc,
|
|
30
|
-
_options$saferDispatc2 = options.saferDispatchedTransactionsAnalyticsOnly,
|
|
31
|
-
saferDispatchedTransactionsAnalyticsOnly = _options$saferDispatc2 === void 0 ? false : _options$saferDispatc2,
|
|
32
28
|
dispatchAnalyticsEvent = options.dispatchAnalyticsEvent;
|
|
33
|
-
|
|
34
|
-
if (shouldOverrideApply && spec.state) {
|
|
29
|
+
if (spec.state) {
|
|
35
30
|
var originalApply = spec.state.apply.bind(spec.state);
|
|
36
31
|
spec.state.apply = function (aTr, value, oldState, newState) {
|
|
37
32
|
var self = _assertThisInitialized(_this);
|
|
38
|
-
var tr =
|
|
33
|
+
var tr = new Proxy(aTr, freezeUnsafeTransactionProperties({
|
|
39
34
|
dispatchAnalyticsEvent: dispatchAnalyticsEvent,
|
|
40
|
-
pluginKey: self.key
|
|
41
|
-
|
|
42
|
-
})) : aTr;
|
|
35
|
+
pluginKey: self.key
|
|
36
|
+
}));
|
|
43
37
|
var shouldTrackTransactions = transactionTracker === null || transactionTracker === void 0 ? void 0 : transactionTracker.shouldTrackTransaction(transactionTracking);
|
|
44
38
|
if (!shouldTrackTransactions || !transactionTracker) {
|
|
45
39
|
return originalApply(tr, value, oldState, newState);
|
|
@@ -10,8 +10,7 @@ var isReadOnlyProperty = function isReadOnlyProperty(prop) {
|
|
|
10
10
|
};
|
|
11
11
|
export var freezeUnsafeTransactionProperties = function freezeUnsafeTransactionProperties(_ref) {
|
|
12
12
|
var dispatchAnalyticsEvent = _ref.dispatchAnalyticsEvent,
|
|
13
|
-
pluginKey = _ref.pluginKey
|
|
14
|
-
analyticsOnly = _ref.analyticsOnly;
|
|
13
|
+
pluginKey = _ref.pluginKey;
|
|
15
14
|
var isUnsafe = function isUnsafe() {
|
|
16
15
|
if (dispatchAnalyticsEvent) {
|
|
17
16
|
dispatchAnalyticsEvent({
|
|
@@ -26,9 +25,7 @@ export var freezeUnsafeTransactionProperties = function freezeUnsafeTransactionP
|
|
|
26
25
|
}
|
|
27
26
|
});
|
|
28
27
|
}
|
|
29
|
-
|
|
30
|
-
throw new Error(UNSAFE_PROPERTY_SET_ERROR);
|
|
31
|
-
}
|
|
28
|
+
throw new Error(UNSAFE_PROPERTY_SET_ERROR);
|
|
32
29
|
};
|
|
33
30
|
return {
|
|
34
31
|
get: function get(target, prop, receiver) {
|
|
@@ -2,11 +2,8 @@ import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
|
2
2
|
import type { SafePluginSpec } from '@atlaskit/editor-prosemirror/state';
|
|
3
3
|
import type { EditorProps } from '../../types/editor-props';
|
|
4
4
|
import type { TransactionTracker } from './track-transactions';
|
|
5
|
-
import type { FeatureFlags } from '../../types/feature-flags';
|
|
6
5
|
import type { DispatchAnalyticsEvent } from '@atlaskit/editor-common/analytics';
|
|
7
6
|
type InstrumentedPluginOptions = EditorProps['performanceTracking'] & {
|
|
8
|
-
saferDispatchedTransactions?: FeatureFlags['saferDispatchedTransactions'];
|
|
9
|
-
saferDispatchedTransactionsAnalyticsOnly?: FeatureFlags['saferDispatchedTransactionsAnalyticsOnly'];
|
|
10
7
|
dispatchAnalyticsEvent?: DispatchAnalyticsEvent;
|
|
11
8
|
};
|
|
12
9
|
export declare class InstrumentedPlugin<PluginState> extends SafePlugin<PluginState> {
|
|
@@ -3,7 +3,6 @@ export declare const UNSAFE_PROPERTY_SET_ERROR = "Setting an unsafe property on
|
|
|
3
3
|
interface FreezeUnsafeTransactionOptions {
|
|
4
4
|
dispatchAnalyticsEvent?: DispatchAnalyticsEvent;
|
|
5
5
|
pluginKey?: string;
|
|
6
|
-
analyticsOnly?: boolean;
|
|
7
6
|
}
|
|
8
|
-
export declare const freezeUnsafeTransactionProperties: <TrType extends object>({ dispatchAnalyticsEvent, pluginKey,
|
|
7
|
+
export declare const freezeUnsafeTransactionProperties: <TrType extends object>({ dispatchAnalyticsEvent, pluginKey, }: FreezeUnsafeTransactionOptions) => ProxyHandler<TrType>;
|
|
9
8
|
export {};
|
|
@@ -2,11 +2,8 @@ import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
|
2
2
|
import type { SafePluginSpec } from '@atlaskit/editor-prosemirror/state';
|
|
3
3
|
import type { EditorProps } from '../../types/editor-props';
|
|
4
4
|
import type { TransactionTracker } from './track-transactions';
|
|
5
|
-
import type { FeatureFlags } from '../../types/feature-flags';
|
|
6
5
|
import type { DispatchAnalyticsEvent } from '@atlaskit/editor-common/analytics';
|
|
7
6
|
type InstrumentedPluginOptions = EditorProps['performanceTracking'] & {
|
|
8
|
-
saferDispatchedTransactions?: FeatureFlags['saferDispatchedTransactions'];
|
|
9
|
-
saferDispatchedTransactionsAnalyticsOnly?: FeatureFlags['saferDispatchedTransactionsAnalyticsOnly'];
|
|
10
7
|
dispatchAnalyticsEvent?: DispatchAnalyticsEvent;
|
|
11
8
|
};
|
|
12
9
|
export declare class InstrumentedPlugin<PluginState> extends SafePlugin<PluginState> {
|
|
@@ -3,7 +3,6 @@ export declare const UNSAFE_PROPERTY_SET_ERROR = "Setting an unsafe property on
|
|
|
3
3
|
interface FreezeUnsafeTransactionOptions {
|
|
4
4
|
dispatchAnalyticsEvent?: DispatchAnalyticsEvent;
|
|
5
5
|
pluginKey?: string;
|
|
6
|
-
analyticsOnly?: boolean;
|
|
7
6
|
}
|
|
8
|
-
export declare const freezeUnsafeTransactionProperties: <TrType extends object>({ dispatchAnalyticsEvent, pluginKey,
|
|
7
|
+
export declare const freezeUnsafeTransactionProperties: <TrType extends object>({ dispatchAnalyticsEvent, pluginKey, }: FreezeUnsafeTransactionOptions) => ProxyHandler<TrType>;
|
|
9
8
|
export {};
|