@atlaskit/editor-core 198.4.6 → 198.5.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 +20 -0
- package/dist/cjs/create-editor/ReactEditorView.js +0 -4
- package/dist/cjs/create-editor/create-editor.js +4 -26
- package/dist/cjs/create-editor/safe-apply-plugin.js +51 -0
- package/dist/cjs/ui/ContentStyles/layout.js +2 -1
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/es2019/create-editor/ReactEditorView.js +0 -4
- package/dist/es2019/create-editor/create-editor.js +3 -22
- package/dist/es2019/create-editor/safe-apply-plugin.js +29 -0
- package/dist/es2019/ui/ContentStyles/layout.js +3 -0
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/esm/create-editor/ReactEditorView.js +0 -4
- package/dist/esm/create-editor/create-editor.js +4 -26
- package/dist/esm/create-editor/safe-apply-plugin.js +44 -0
- package/dist/esm/ui/ContentStyles/layout.js +2 -1
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/types/create-editor/safe-apply-plugin.d.ts +15 -0
- package/dist/types/types/pm-plugin-list.d.ts +0 -4
- package/dist/types-ts4.5/create-editor/safe-apply-plugin.d.ts +15 -0
- package/dist/types-ts4.5/types/pm-plugin-list.d.ts +0 -4
- package/package.json +11 -8
- package/dist/cjs/utils/performance/instrumented-plugin.js +0 -98
- package/dist/es2019/utils/performance/instrumented-plugin.js +0 -75
- package/dist/esm/utils/performance/instrumented-plugin.js +0 -91
- package/dist/types/utils/performance/instrumented-plugin.d.ts +0 -13
- package/dist/types-ts4.5/utils/performance/instrumented-plugin.d.ts +0 -13
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# @atlaskit/editor-core
|
|
2
2
|
|
|
3
|
+
## 198.5.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#151121](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/151121)
|
|
8
|
+
[`2909af0f0c958`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/2909af0f0c958) -
|
|
9
|
+
This changeset exists because a PR touches these packages in a way that doesn't require a release
|
|
10
|
+
|
|
11
|
+
## 198.4.7
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- [#150241](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/150241)
|
|
16
|
+
[`11814f141483a`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/11814f141483a) -
|
|
17
|
+
ED-24117: remediates extension component for react 18
|
|
18
|
+
- [#150201](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/150201)
|
|
19
|
+
[`b105a16989e99`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/b105a16989e99) -
|
|
20
|
+
Cleanup unused instrumentation in core editor
|
|
21
|
+
- Updated dependencies
|
|
22
|
+
|
|
3
23
|
## 198.4.6
|
|
4
24
|
|
|
5
25
|
### Patch Changes
|
|
@@ -208,8 +208,6 @@ var ReactEditorView = exports.ReactEditorView = /*#__PURE__*/function (_React$Co
|
|
|
208
208
|
providerFactory: options.props.providerFactory,
|
|
209
209
|
portalProviderAPI: _this.props.portalProviderAPI,
|
|
210
210
|
dispatchAnalyticsEvent: _this.dispatchAnalyticsEvent,
|
|
211
|
-
performanceTracking: _this.props.editorProps.performanceTracking,
|
|
212
|
-
transactionTracker: _this.transactionTracker,
|
|
213
211
|
featureFlags: _this.featureFlags,
|
|
214
212
|
getIntl: function getIntl() {
|
|
215
213
|
return _this.props.intl;
|
|
@@ -692,8 +690,6 @@ var ReactEditorView = exports.ReactEditorView = /*#__PURE__*/function (_React$Co
|
|
|
692
690
|
providerFactory: props.providerFactory,
|
|
693
691
|
portalProviderAPI: props.portalProviderAPI,
|
|
694
692
|
dispatchAnalyticsEvent: this.dispatchAnalyticsEvent,
|
|
695
|
-
performanceTracking: props.editorProps.performanceTracking,
|
|
696
|
-
transactionTracker: this.transactionTracker,
|
|
697
693
|
featureFlags: (0, _featureFlagsFromProps.createFeatureFlagsFromProps)(props.editorProps),
|
|
698
694
|
getIntl: function getIntl() {
|
|
699
695
|
return _this2.props.intl;
|
|
@@ -11,8 +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
|
|
15
|
-
var _instrumentedPlugin = require("../utils/performance/instrumented-plugin");
|
|
14
|
+
var _safeApplyPlugin = require("./safe-apply-plugin");
|
|
16
15
|
var _sortByOrder = require("./sort-by-order");
|
|
17
16
|
function sortByRank(a, b) {
|
|
18
17
|
return a.rank - b.rank;
|
|
@@ -94,34 +93,13 @@ function processPluginsList(plugins) {
|
|
|
94
93
|
onEditorViewStateUpdatedCallbacks: []
|
|
95
94
|
});
|
|
96
95
|
}
|
|
97
|
-
var TRACKING_DEFAULT = {
|
|
98
|
-
enabled: false
|
|
99
|
-
};
|
|
100
96
|
function createPMPlugins(config) {
|
|
101
97
|
var editorConfig = config.editorConfig,
|
|
102
|
-
_config$performanceTr = config.performanceTracking,
|
|
103
|
-
performanceTracking = _config$performanceTr === void 0 ? {} : _config$performanceTr,
|
|
104
|
-
transactionTracker = config.transactionTracker,
|
|
105
98
|
dispatchAnalyticsEvent = config.dispatchAnalyticsEvent;
|
|
106
|
-
var
|
|
107
|
-
|
|
108
|
-
_performanceTracking$2 = performanceTracking.transactionTracking,
|
|
109
|
-
transactionTracking = _performanceTracking$2 === void 0 ? TRACKING_DEFAULT : _performanceTracking$2;
|
|
110
|
-
|
|
111
|
-
// TO-DO need to question editor team about this condition true here
|
|
112
|
-
var useInstrumentedPlugin = uiTracking.enabled || transactionTracking.enabled || true;
|
|
113
|
-
if (process.env.NODE_ENV === 'development' && transactionTracking.enabled && !transactionTracker) {
|
|
114
|
-
// eslint-disable-next-line no-console
|
|
115
|
-
console.warn('createPMPlugins(): tracking is turned on but transactionTracker not defined! Transaction tracking has been disabled');
|
|
116
|
-
}
|
|
117
|
-
var instrumentPlugin = !(0, _platformFeatureFlags.fg)('platform_editor_disable_instrumented_plugin') && useInstrumentedPlugin ? function (plugin) {
|
|
118
|
-
return _instrumentedPlugin.InstrumentedPlugin.fromPlugin(plugin, {
|
|
119
|
-
uiTracking: uiTracking,
|
|
120
|
-
transactionTracking: transactionTracking,
|
|
99
|
+
var instrumentPlugin = function instrumentPlugin(plugin) {
|
|
100
|
+
return _safeApplyPlugin.SafeApplyPlugin.fromPlugin(plugin, {
|
|
121
101
|
dispatchAnalyticsEvent: dispatchAnalyticsEvent
|
|
122
|
-
}
|
|
123
|
-
} : function (plugin) {
|
|
124
|
-
return plugin;
|
|
102
|
+
});
|
|
125
103
|
};
|
|
126
104
|
return editorConfig.pmPlugins.sort((0, _sortByOrder.sortByOrder)('plugins')).map(function (_ref) {
|
|
127
105
|
var plugin = _ref.plugin;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.SafeApplyPlugin = void 0;
|
|
8
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
9
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
10
|
+
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
11
|
+
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
12
|
+
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
13
|
+
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
14
|
+
var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
|
|
15
|
+
var _saferTransactions = require("../utils/performance/safer-transactions");
|
|
16
|
+
function _createSuper(t) { var r = _isNativeReflectConstruct(); return function () { var e, o = (0, _getPrototypeOf2.default)(t); if (r) { var s = (0, _getPrototypeOf2.default)(this).constructor; e = Reflect.construct(o, arguments, s); } else e = o.apply(this, arguments); return (0, _possibleConstructorReturn2.default)(this, e); }; }
|
|
17
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
18
|
+
/**
|
|
19
|
+
* This is for safety in case someone is trying to mutate
|
|
20
|
+
* the transaction in the apply which should never be done.
|
|
21
|
+
*/
|
|
22
|
+
var SafeApplyPlugin = exports.SafeApplyPlugin = /*#__PURE__*/function (_SafePlugin) {
|
|
23
|
+
(0, _inherits2.default)(SafeApplyPlugin, _SafePlugin);
|
|
24
|
+
var _super = _createSuper(SafeApplyPlugin);
|
|
25
|
+
function SafeApplyPlugin(spec) {
|
|
26
|
+
var _this;
|
|
27
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
28
|
+
(0, _classCallCheck2.default)(this, SafeApplyPlugin);
|
|
29
|
+
var dispatchAnalyticsEvent = options.dispatchAnalyticsEvent;
|
|
30
|
+
if (spec.state) {
|
|
31
|
+
var originalApply = spec.state.apply.bind(spec.state);
|
|
32
|
+
spec.state.apply = function (aTr, value, oldState, newState) {
|
|
33
|
+
var self = (0, _assertThisInitialized2.default)(_this);
|
|
34
|
+
var pluginKey = self === null || self === void 0 ? void 0 : self.key;
|
|
35
|
+
var tr = new Proxy(aTr, (0, _saferTransactions.freezeUnsafeTransactionProperties)({
|
|
36
|
+
dispatchAnalyticsEvent: dispatchAnalyticsEvent,
|
|
37
|
+
pluginKey: typeof pluginKey === 'string' ? pluginKey : undefined
|
|
38
|
+
}));
|
|
39
|
+
return originalApply(tr, value, oldState, newState);
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
return _this = _super.call(this, spec);
|
|
43
|
+
}
|
|
44
|
+
(0, _createClass2.default)(SafeApplyPlugin, null, [{
|
|
45
|
+
key: "fromPlugin",
|
|
46
|
+
value: function fromPlugin(plugin, options) {
|
|
47
|
+
return new SafeApplyPlugin(plugin.spec, options);
|
|
48
|
+
}
|
|
49
|
+
}]);
|
|
50
|
+
return SafeApplyPlugin;
|
|
51
|
+
}(_safePlugin.SafePlugin);
|
|
@@ -23,6 +23,7 @@ var _styles = require("@atlaskit/editor-common/styles");
|
|
|
23
23
|
var _types = require("@atlaskit/editor-plugins/table/types");
|
|
24
24
|
var _consts = require("@atlaskit/editor-plugins/table/ui/consts");
|
|
25
25
|
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
26
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
26
27
|
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
27
28
|
var _templateObject, _templateObject2, _templateObject3; // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
28
29
|
var firstNodeWithNotMarginTop = function firstNodeWithNotMarginTop() {
|
|
@@ -33,5 +34,5 @@ var firstNodeWithNotMarginTop = function firstNodeWithNotMarginTop() {
|
|
|
33
34
|
|
|
34
35
|
// eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression -- Needs manual remediation
|
|
35
36
|
var layoutStyles = exports.layoutStyles = function layoutStyles(viewMode) {
|
|
36
|
-
return (0, _react.css)(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n\t.ProseMirror {\n\t\t", " [data-layout-section] {\n\t\t\t// TODO: Migrate away from gridSize\n\t\t\t// Recommendation: Replace directly with 7px\n\t\t\tmargin: ", " -", "px 0;\n\t\t\ttransition: border-color 0.3s ", ";\n\t\t\tcursor: ", ";\n\n\t\t\t/* Inner cursor located 26px from left */\n\t\t\t[data-layout-column] {\n\t\t\t\tflex: 1;\n\t\t\t\tmin-width: 0;\n\t\t\t\tborder: ", "px solid\n\t\t\t\t\t", ";\n\t\t\t\tborder-radius: 4px;\n\t\t\t\tpadding: ", "px\n\t\t\t\t\t", "px;\n\t\t\t\tbox-sizing: border-box;\n\n\t\t\t\t> div {\n\t\t\t\t\t", "\n\n\t\t\t\t\t> .embedCardView-content-wrap:first-of-type .rich-media-item {\n\t\t\t\t\t\tmargin-top: 0;\n\t\t\t\t\t}\n\n\t\t\t\t\t> .mediaSingleView-content-wrap:first-of-type .rich-media-item {\n\t\t\t\t\t\tmargin-top: 0;\n\t\t\t\t\t}\n\n\t\t\t\t\t> .ProseMirror-gapcursor.-right:first-child\n\t\t\t\t\t\t+ .mediaSingleView-content-wrap\n\t\t\t\t\t\t.rich-media-item,\n\t\t\t\t\t> style:first-child\n\t\t\t\t\t\t+ .ProseMirror-gapcursor.-right\n\t\t\t\t\t\t+ .mediaSingleView-content-wrap\n\t\t\t\t\t\t.rich-media-item,\n\t\t\t\t\t> .ProseMirror-gapcursor.-right:first-of-type\n\t\t\t\t\t\t+ .embedCardView-content-wrap\n\t\t\t\t\t\t.rich-media-item {\n\t\t\t\t\t\tmargin-top: 0;\n\t\t\t\t\t}\n\n\t\t\t\t\t> .ProseMirror-gapcursor:first-child\n\t\t\t\t\t\t+ span\n\t\t\t\t\t\t+ .mediaSingleView-content-wrap\n\t\t\t\t\t\t.rich-media-item,\n\t\t\t\t\t> style:first-child\n\t\t\t\t\t\t+ .ProseMirror-gapcursor\n\t\t\t\t\t\t+ span\n\t\t\t\t\t\t+ .mediaSingleView-content-wrap\n\t\t\t\t\t\t.rich-media-item {\n\t\t\t\t\t\tmargin-top: 0;\n\t\t\t\t\t}\n\n\t\t\t\t\t/* Prevent first DecisionWrapper's margin-top: 8px from shifting decisions down\n and shrinking layout's node selectable area (leniency margin) */\n\t\t\t\t\t> [data-node-type='decisionList'] {\n\t\t\t\t\t\tli:first-of-type [data-decision-wrapper] {\n\t\t\t\t\t\t\tmargin-top: 0;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t/* Make the 'content' fill the entire height of the layout column to allow click\n handler of layout section nodeview to target only data-layout-column */\n\t\t\t\t[data-layout-content] {\n\t\t\t\t\theight: 100%;\n\t\t\t\t\tcursor: text;\n\t\t\t\t\t.mediaGroupView-content-wrap {\n\t\t\t\t\t\tclear: both;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t[data-layout-column] + [data-layout-column] {\n\t\t\t\tmargin-left: ", "px;\n\t\t\t}\n\n\t\t\t@media screen and (max-width: ", "px) {\n\t\t\t\t[data-layout-column] + [data-layout-column] {\n\t\t\t\t\tmargin-left: 0;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// TODO: Remove the border styles below once design tokens have been enabled and fallbacks are no longer triggered.\n\t\t\t// This is because the default state already uses the same token and, as such, the hover style won't change anything.\n\t\t\t// https://product-fabric.atlassian.net/browse/DSP-4441\n\t\t\t/* Shows the border when cursor is inside a layout */\n\t\t\t&.selected [data-layout-column],\n\t\t\t&:hover [data-layout-column] {\n\t\t\t\tborder: ", "px solid\n\t\t\t\t\t", ";\n\t\t\t}\n\n\t\t\t&.selected.danger > [data-layout-column] {\n\t\t\t\tbackground-color: ", ";\n\t\t\t\tborder-color: ", ";\n\t\t\t}\n\n\t\t\t&.", ":not(.danger) {\n\t\t\t\t[data-layout-column] {\n\t\t\t\t\t", "\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t.fabric-editor--full-width-mode .ProseMirror {\n\t\t[data-layout-section] {\n\t\t\t.", " {\n\t\t\t\tmargin: 0 ", "px;\n\t\t\t}\n\t\t}\n\t}\n\n\t", "\n"])), _styles.columnLayoutSharedStyle, "var(--ds-space-100, 8px)", _editorSharedStyles.akLayoutGutterOffset, _editorSharedStyles.akEditorSwoopCubicBezier, viewMode === 'view' ? 'default' : 'pointer', viewMode === 'view' ? 0 : _editorSharedStyles.akEditorSelectedBorderSize, "var(--ds-border, #091E4224)", _styles.LAYOUT_COLUMN_PADDING, _styles.LAYOUT_COLUMN_PADDING + ((0, _experiments.editorExperiment)('nested-dnd', true) ? 8 : 0), firstNodeWithNotMarginTop(), _styles.LAYOUT_SECTION_MARGIN, _editorSharedStyles.gridMediumMaxWidth, viewMode === 'view' ? 0 : _editorSharedStyles.akEditorSelectedBorderSize, "var(--ds-border, #091E4224)", "var(--ds-background-danger, ".concat(_editorSharedStyles.akEditorDeleteBackground, ")"), "var(--ds-border-danger, ".concat(_editorSharedStyles.akEditorDeleteBorder, ")"), _editorSharedStyles.akEditorSelectedNodeClassName, (0, _editorSharedStyles.getSelectionStyles)([_editorSharedStyles.SelectionStyle.Border, _editorSharedStyles.SelectionStyle.Blanket]), _types.TableCssClassName.TABLE_CONTAINER, _consts.tableMarginFullWidthMode, (0, _experiments.editorExperiment)('nested-dnd', true) && ".ak-editor-content-area.appearance-full-page .ProseMirror [data-layout-section] {\n\t\t\t\tmargin: ".concat("var(--ds-space-100, 8px)", " -", _editorSharedStyles.akLayoutGutterOffset + 8, "px 0;\n\t\t\t\t}"));
|
|
37
|
+
return (0, _react.css)(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n\t.ProseMirror {\n\t\t", " [data-layout-section] {\n\t\t\t// TODO: Migrate away from gridSize\n\t\t\t// Recommendation: Replace directly with 7px\n\t\t\tmargin: ", " -", "px 0;\n\t\t\ttransition: border-color 0.3s ", ";\n\t\t\tcursor: ", ";\n\n\t\t\t/* Inner cursor located 26px from left */\n\t\t\t[data-layout-column] {\n\t\t\t\tflex: 1;\n\t\t\t\t", "\n\n\t\t\t\tmin-width: 0;\n\t\t\t\tborder: ", "px solid\n\t\t\t\t\t", ";\n\t\t\t\tborder-radius: 4px;\n\t\t\t\tpadding: ", "px\n\t\t\t\t\t", "px;\n\t\t\t\tbox-sizing: border-box;\n\n\t\t\t\t> div {\n\t\t\t\t\t", "\n\n\t\t\t\t\t> .embedCardView-content-wrap:first-of-type .rich-media-item {\n\t\t\t\t\t\tmargin-top: 0;\n\t\t\t\t\t}\n\n\t\t\t\t\t> .mediaSingleView-content-wrap:first-of-type .rich-media-item {\n\t\t\t\t\t\tmargin-top: 0;\n\t\t\t\t\t}\n\n\t\t\t\t\t> .ProseMirror-gapcursor.-right:first-child\n\t\t\t\t\t\t+ .mediaSingleView-content-wrap\n\t\t\t\t\t\t.rich-media-item,\n\t\t\t\t\t> style:first-child\n\t\t\t\t\t\t+ .ProseMirror-gapcursor.-right\n\t\t\t\t\t\t+ .mediaSingleView-content-wrap\n\t\t\t\t\t\t.rich-media-item,\n\t\t\t\t\t> .ProseMirror-gapcursor.-right:first-of-type\n\t\t\t\t\t\t+ .embedCardView-content-wrap\n\t\t\t\t\t\t.rich-media-item {\n\t\t\t\t\t\tmargin-top: 0;\n\t\t\t\t\t}\n\n\t\t\t\t\t> .ProseMirror-gapcursor:first-child\n\t\t\t\t\t\t+ span\n\t\t\t\t\t\t+ .mediaSingleView-content-wrap\n\t\t\t\t\t\t.rich-media-item,\n\t\t\t\t\t> style:first-child\n\t\t\t\t\t\t+ .ProseMirror-gapcursor\n\t\t\t\t\t\t+ span\n\t\t\t\t\t\t+ .mediaSingleView-content-wrap\n\t\t\t\t\t\t.rich-media-item {\n\t\t\t\t\t\tmargin-top: 0;\n\t\t\t\t\t}\n\n\t\t\t\t\t/* Prevent first DecisionWrapper's margin-top: 8px from shifting decisions down\n and shrinking layout's node selectable area (leniency margin) */\n\t\t\t\t\t> [data-node-type='decisionList'] {\n\t\t\t\t\t\tli:first-of-type [data-decision-wrapper] {\n\t\t\t\t\t\t\tmargin-top: 0;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t/* Make the 'content' fill the entire height of the layout column to allow click\n handler of layout section nodeview to target only data-layout-column */\n\t\t\t\t[data-layout-content] {\n\t\t\t\t\theight: 100%;\n\t\t\t\t\tcursor: text;\n\t\t\t\t\t.mediaGroupView-content-wrap {\n\t\t\t\t\t\tclear: both;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t[data-layout-column] + [data-layout-column] {\n\t\t\t\tmargin-left: ", "px;\n\t\t\t}\n\n\t\t\t@media screen and (max-width: ", "px) {\n\t\t\t\t[data-layout-column] + [data-layout-column] {\n\t\t\t\t\tmargin-left: 0;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// TODO: Remove the border styles below once design tokens have been enabled and fallbacks are no longer triggered.\n\t\t\t// This is because the default state already uses the same token and, as such, the hover style won't change anything.\n\t\t\t// https://product-fabric.atlassian.net/browse/DSP-4441\n\t\t\t/* Shows the border when cursor is inside a layout */\n\t\t\t&.selected [data-layout-column],\n\t\t\t&:hover [data-layout-column] {\n\t\t\t\tborder: ", "px solid\n\t\t\t\t\t", ";\n\t\t\t}\n\n\t\t\t&.selected.danger > [data-layout-column] {\n\t\t\t\tbackground-color: ", ";\n\t\t\t\tborder-color: ", ";\n\t\t\t}\n\n\t\t\t&.", ":not(.danger) {\n\t\t\t\t[data-layout-column] {\n\t\t\t\t\t", "\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t.fabric-editor--full-width-mode .ProseMirror {\n\t\t[data-layout-section] {\n\t\t\t.", " {\n\t\t\t\tmargin: 0 ", "px;\n\t\t\t}\n\t\t}\n\t}\n\n\t", "\n"])), _styles.columnLayoutSharedStyle, "var(--ds-space-100, 8px)", _editorSharedStyles.akLayoutGutterOffset, _editorSharedStyles.akEditorSwoopCubicBezier, viewMode === 'view' ? 'default' : 'pointer', (0, _platformFeatureFlags.fg)('platform_editor_drag_and_drop_target_v2') ? 'position: relative;' : '', viewMode === 'view' ? 0 : _editorSharedStyles.akEditorSelectedBorderSize, "var(--ds-border, #091E4224)", _styles.LAYOUT_COLUMN_PADDING, _styles.LAYOUT_COLUMN_PADDING + ((0, _experiments.editorExperiment)('nested-dnd', true) ? 8 : 0), firstNodeWithNotMarginTop(), _styles.LAYOUT_SECTION_MARGIN, _editorSharedStyles.gridMediumMaxWidth, viewMode === 'view' ? 0 : _editorSharedStyles.akEditorSelectedBorderSize, "var(--ds-border, #091E4224)", "var(--ds-background-danger, ".concat(_editorSharedStyles.akEditorDeleteBackground, ")"), "var(--ds-border-danger, ".concat(_editorSharedStyles.akEditorDeleteBorder, ")"), _editorSharedStyles.akEditorSelectedNodeClassName, (0, _editorSharedStyles.getSelectionStyles)([_editorSharedStyles.SelectionStyle.Border, _editorSharedStyles.SelectionStyle.Blanket]), _types.TableCssClassName.TABLE_CONTAINER, _consts.tableMarginFullWidthMode, (0, _experiments.editorExperiment)('nested-dnd', true) && ".ak-editor-content-area.appearance-full-page .ProseMirror [data-layout-section] {\n\t\t\t\tmargin: ".concat("var(--ds-space-100, 8px)", " -", _editorSharedStyles.akLayoutGutterOffset + 8, "px 0;\n\t\t\t\t}"));
|
|
37
38
|
};
|
|
@@ -208,8 +208,6 @@ export class ReactEditorView extends React.Component {
|
|
|
208
208
|
providerFactory: options.props.providerFactory,
|
|
209
209
|
portalProviderAPI: this.props.portalProviderAPI,
|
|
210
210
|
dispatchAnalyticsEvent: this.dispatchAnalyticsEvent,
|
|
211
|
-
performanceTracking: this.props.editorProps.performanceTracking,
|
|
212
|
-
transactionTracker: this.transactionTracker,
|
|
213
211
|
featureFlags: this.featureFlags,
|
|
214
212
|
getIntl: () => this.props.intl
|
|
215
213
|
});
|
|
@@ -646,8 +644,6 @@ export class ReactEditorView extends React.Component {
|
|
|
646
644
|
providerFactory: props.providerFactory,
|
|
647
645
|
portalProviderAPI: props.portalProviderAPI,
|
|
648
646
|
dispatchAnalyticsEvent: this.dispatchAnalyticsEvent,
|
|
649
|
-
performanceTracking: props.editorProps.performanceTracking,
|
|
650
|
-
transactionTracker: this.transactionTracker,
|
|
651
647
|
featureFlags: createFeatureFlagsFromProps(props.editorProps),
|
|
652
648
|
getIntl: () => this.props.intl
|
|
653
649
|
});
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { ErrorReporter } from '@atlaskit/editor-common/error-reporter';
|
|
2
|
-
import {
|
|
3
|
-
import { InstrumentedPlugin } from '../utils/performance/instrumented-plugin';
|
|
2
|
+
import { SafeApplyPlugin } from './safe-apply-plugin';
|
|
4
3
|
import { sortByOrder } from './sort-by-order';
|
|
5
4
|
export function sortByRank(a, b) {
|
|
6
5
|
return a.rank - b.rank;
|
|
@@ -75,32 +74,14 @@ export function processPluginsList(plugins) {
|
|
|
75
74
|
onEditorViewStateUpdatedCallbacks: []
|
|
76
75
|
});
|
|
77
76
|
}
|
|
78
|
-
const TRACKING_DEFAULT = {
|
|
79
|
-
enabled: false
|
|
80
|
-
};
|
|
81
77
|
export function createPMPlugins(config) {
|
|
82
78
|
const {
|
|
83
79
|
editorConfig,
|
|
84
|
-
performanceTracking = {},
|
|
85
|
-
transactionTracker,
|
|
86
80
|
dispatchAnalyticsEvent
|
|
87
81
|
} = config;
|
|
88
|
-
const {
|
|
89
|
-
uiTracking = TRACKING_DEFAULT,
|
|
90
|
-
transactionTracking = TRACKING_DEFAULT
|
|
91
|
-
} = performanceTracking;
|
|
92
|
-
|
|
93
|
-
// TO-DO need to question editor team about this condition true here
|
|
94
|
-
const useInstrumentedPlugin = uiTracking.enabled || transactionTracking.enabled || true;
|
|
95
|
-
if (process.env.NODE_ENV === 'development' && transactionTracking.enabled && !transactionTracker) {
|
|
96
|
-
// eslint-disable-next-line no-console
|
|
97
|
-
console.warn('createPMPlugins(): tracking is turned on but transactionTracker not defined! Transaction tracking has been disabled');
|
|
98
|
-
}
|
|
99
|
-
const instrumentPlugin = !fg('platform_editor_disable_instrumented_plugin') && useInstrumentedPlugin ? plugin => InstrumentedPlugin.fromPlugin(plugin, {
|
|
100
|
-
uiTracking,
|
|
101
|
-
transactionTracking,
|
|
82
|
+
const instrumentPlugin = plugin => SafeApplyPlugin.fromPlugin(plugin, {
|
|
102
83
|
dispatchAnalyticsEvent
|
|
103
|
-
}
|
|
84
|
+
});
|
|
104
85
|
return editorConfig.pmPlugins.sort(sortByOrder('plugins')).map(({
|
|
105
86
|
plugin
|
|
106
87
|
}) => plugin({
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
|
+
import { freezeUnsafeTransactionProperties } from '../utils/performance/safer-transactions';
|
|
3
|
+
/**
|
|
4
|
+
* This is for safety in case someone is trying to mutate
|
|
5
|
+
* the transaction in the apply which should never be done.
|
|
6
|
+
*/
|
|
7
|
+
export class SafeApplyPlugin extends SafePlugin {
|
|
8
|
+
constructor(spec, options = {}) {
|
|
9
|
+
const {
|
|
10
|
+
dispatchAnalyticsEvent
|
|
11
|
+
} = options;
|
|
12
|
+
if (spec.state) {
|
|
13
|
+
const originalApply = spec.state.apply.bind(spec.state);
|
|
14
|
+
spec.state.apply = (aTr, value, oldState, newState) => {
|
|
15
|
+
const self = this;
|
|
16
|
+
const pluginKey = self === null || self === void 0 ? void 0 : self.key;
|
|
17
|
+
const tr = new Proxy(aTr, freezeUnsafeTransactionProperties({
|
|
18
|
+
dispatchAnalyticsEvent,
|
|
19
|
+
pluginKey: typeof pluginKey === 'string' ? pluginKey : undefined
|
|
20
|
+
}));
|
|
21
|
+
return originalApply(tr, value, oldState, newState);
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
super(spec);
|
|
25
|
+
}
|
|
26
|
+
static fromPlugin(plugin, options) {
|
|
27
|
+
return new SafeApplyPlugin(plugin.spec, options);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -4,6 +4,7 @@ import { columnLayoutSharedStyle, LAYOUT_COLUMN_PADDING, LAYOUT_SECTION_MARGIN }
|
|
|
4
4
|
import { TableCssClassName } from '@atlaskit/editor-plugins/table/types';
|
|
5
5
|
import { tableMarginFullWidthMode } from '@atlaskit/editor-plugins/table/ui/consts';
|
|
6
6
|
import { akEditorDeleteBackground, akEditorDeleteBorder, akEditorSelectedBorderSize, akEditorSelectedNodeClassName, akEditorSwoopCubicBezier, akLayoutGutterOffset, getSelectionStyles, gridMediumMaxWidth, SelectionStyle } from '@atlaskit/editor-shared-styles';
|
|
7
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
7
8
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
8
9
|
export { LAYOUT_COLUMN_PADDING, LAYOUT_SECTION_MARGIN };
|
|
9
10
|
const firstNodeWithNotMarginTop = () => editorExperiment('nested-dnd', true) ?
|
|
@@ -43,6 +44,8 @@ export const layoutStyles = viewMode => css`
|
|
|
43
44
|
/* Inner cursor located 26px from left */
|
|
44
45
|
[data-layout-column] {
|
|
45
46
|
flex: 1;
|
|
47
|
+
${fg('platform_editor_drag_and_drop_target_v2') ? 'position: relative;' : ''}
|
|
48
|
+
|
|
46
49
|
min-width: 0;
|
|
47
50
|
border: ${viewMode === 'view' ? 0 : akEditorSelectedBorderSize}px solid
|
|
48
51
|
${"var(--ds-border, #091E4224)"};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export const name = "@atlaskit/editor-core";
|
|
2
|
-
export const version = "198.
|
|
2
|
+
export const version = "198.5.0";
|
|
@@ -201,8 +201,6 @@ export var ReactEditorView = /*#__PURE__*/function (_React$Component) {
|
|
|
201
201
|
providerFactory: options.props.providerFactory,
|
|
202
202
|
portalProviderAPI: _this.props.portalProviderAPI,
|
|
203
203
|
dispatchAnalyticsEvent: _this.dispatchAnalyticsEvent,
|
|
204
|
-
performanceTracking: _this.props.editorProps.performanceTracking,
|
|
205
|
-
transactionTracker: _this.transactionTracker,
|
|
206
204
|
featureFlags: _this.featureFlags,
|
|
207
205
|
getIntl: function getIntl() {
|
|
208
206
|
return _this.props.intl;
|
|
@@ -685,8 +683,6 @@ export var ReactEditorView = /*#__PURE__*/function (_React$Component) {
|
|
|
685
683
|
providerFactory: props.providerFactory,
|
|
686
684
|
portalProviderAPI: props.portalProviderAPI,
|
|
687
685
|
dispatchAnalyticsEvent: this.dispatchAnalyticsEvent,
|
|
688
|
-
performanceTracking: props.editorProps.performanceTracking,
|
|
689
|
-
transactionTracker: this.transactionTracker,
|
|
690
686
|
featureFlags: createFeatureFlagsFromProps(props.editorProps),
|
|
691
687
|
getIntl: function getIntl() {
|
|
692
688
|
return _this2.props.intl;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
2
2
|
import { ErrorReporter } from '@atlaskit/editor-common/error-reporter';
|
|
3
|
-
import {
|
|
4
|
-
import { InstrumentedPlugin } from '../utils/performance/instrumented-plugin';
|
|
3
|
+
import { SafeApplyPlugin } from './safe-apply-plugin';
|
|
5
4
|
import { sortByOrder } from './sort-by-order';
|
|
6
5
|
export function sortByRank(a, b) {
|
|
7
6
|
return a.rank - b.rank;
|
|
@@ -83,34 +82,13 @@ export function processPluginsList(plugins) {
|
|
|
83
82
|
onEditorViewStateUpdatedCallbacks: []
|
|
84
83
|
});
|
|
85
84
|
}
|
|
86
|
-
var TRACKING_DEFAULT = {
|
|
87
|
-
enabled: false
|
|
88
|
-
};
|
|
89
85
|
export function createPMPlugins(config) {
|
|
90
86
|
var editorConfig = config.editorConfig,
|
|
91
|
-
_config$performanceTr = config.performanceTracking,
|
|
92
|
-
performanceTracking = _config$performanceTr === void 0 ? {} : _config$performanceTr,
|
|
93
|
-
transactionTracker = config.transactionTracker,
|
|
94
87
|
dispatchAnalyticsEvent = config.dispatchAnalyticsEvent;
|
|
95
|
-
var
|
|
96
|
-
|
|
97
|
-
_performanceTracking$2 = performanceTracking.transactionTracking,
|
|
98
|
-
transactionTracking = _performanceTracking$2 === void 0 ? TRACKING_DEFAULT : _performanceTracking$2;
|
|
99
|
-
|
|
100
|
-
// TO-DO need to question editor team about this condition true here
|
|
101
|
-
var useInstrumentedPlugin = uiTracking.enabled || transactionTracking.enabled || true;
|
|
102
|
-
if (process.env.NODE_ENV === 'development' && transactionTracking.enabled && !transactionTracker) {
|
|
103
|
-
// eslint-disable-next-line no-console
|
|
104
|
-
console.warn('createPMPlugins(): tracking is turned on but transactionTracker not defined! Transaction tracking has been disabled');
|
|
105
|
-
}
|
|
106
|
-
var instrumentPlugin = !fg('platform_editor_disable_instrumented_plugin') && useInstrumentedPlugin ? function (plugin) {
|
|
107
|
-
return InstrumentedPlugin.fromPlugin(plugin, {
|
|
108
|
-
uiTracking: uiTracking,
|
|
109
|
-
transactionTracking: transactionTracking,
|
|
88
|
+
var instrumentPlugin = function instrumentPlugin(plugin) {
|
|
89
|
+
return SafeApplyPlugin.fromPlugin(plugin, {
|
|
110
90
|
dispatchAnalyticsEvent: dispatchAnalyticsEvent
|
|
111
|
-
}
|
|
112
|
-
} : function (plugin) {
|
|
113
|
-
return plugin;
|
|
91
|
+
});
|
|
114
92
|
};
|
|
115
93
|
return editorConfig.pmPlugins.sort(sortByOrder('plugins')).map(function (_ref) {
|
|
116
94
|
var plugin = _ref.plugin;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
2
|
+
import _createClass from "@babel/runtime/helpers/createClass";
|
|
3
|
+
import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
|
|
4
|
+
import _inherits from "@babel/runtime/helpers/inherits";
|
|
5
|
+
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
6
|
+
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
7
|
+
function _createSuper(t) { var r = _isNativeReflectConstruct(); return function () { var e, o = _getPrototypeOf(t); if (r) { var s = _getPrototypeOf(this).constructor; e = Reflect.construct(o, arguments, s); } else e = o.apply(this, arguments); return _possibleConstructorReturn(this, e); }; }
|
|
8
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
9
|
+
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
10
|
+
import { freezeUnsafeTransactionProperties } from '../utils/performance/safer-transactions';
|
|
11
|
+
/**
|
|
12
|
+
* This is for safety in case someone is trying to mutate
|
|
13
|
+
* the transaction in the apply which should never be done.
|
|
14
|
+
*/
|
|
15
|
+
export var SafeApplyPlugin = /*#__PURE__*/function (_SafePlugin) {
|
|
16
|
+
_inherits(SafeApplyPlugin, _SafePlugin);
|
|
17
|
+
var _super = _createSuper(SafeApplyPlugin);
|
|
18
|
+
function SafeApplyPlugin(spec) {
|
|
19
|
+
var _this;
|
|
20
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
21
|
+
_classCallCheck(this, SafeApplyPlugin);
|
|
22
|
+
var dispatchAnalyticsEvent = options.dispatchAnalyticsEvent;
|
|
23
|
+
if (spec.state) {
|
|
24
|
+
var originalApply = spec.state.apply.bind(spec.state);
|
|
25
|
+
spec.state.apply = function (aTr, value, oldState, newState) {
|
|
26
|
+
var self = _assertThisInitialized(_this);
|
|
27
|
+
var pluginKey = self === null || self === void 0 ? void 0 : self.key;
|
|
28
|
+
var tr = new Proxy(aTr, freezeUnsafeTransactionProperties({
|
|
29
|
+
dispatchAnalyticsEvent: dispatchAnalyticsEvent,
|
|
30
|
+
pluginKey: typeof pluginKey === 'string' ? pluginKey : undefined
|
|
31
|
+
}));
|
|
32
|
+
return originalApply(tr, value, oldState, newState);
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
return _this = _super.call(this, spec);
|
|
36
|
+
}
|
|
37
|
+
_createClass(SafeApplyPlugin, null, [{
|
|
38
|
+
key: "fromPlugin",
|
|
39
|
+
value: function fromPlugin(plugin, options) {
|
|
40
|
+
return new SafeApplyPlugin(plugin.spec, options);
|
|
41
|
+
}
|
|
42
|
+
}]);
|
|
43
|
+
return SafeApplyPlugin;
|
|
44
|
+
}(SafePlugin);
|
|
@@ -6,6 +6,7 @@ import { columnLayoutSharedStyle, LAYOUT_COLUMN_PADDING, LAYOUT_SECTION_MARGIN }
|
|
|
6
6
|
import { TableCssClassName } from '@atlaskit/editor-plugins/table/types';
|
|
7
7
|
import { tableMarginFullWidthMode } from '@atlaskit/editor-plugins/table/ui/consts';
|
|
8
8
|
import { akEditorDeleteBackground, akEditorDeleteBorder, akEditorSelectedBorderSize, akEditorSelectedNodeClassName, akEditorSwoopCubicBezier, akLayoutGutterOffset, getSelectionStyles, gridMediumMaxWidth, SelectionStyle } from '@atlaskit/editor-shared-styles';
|
|
9
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
9
10
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
10
11
|
export { LAYOUT_COLUMN_PADDING, LAYOUT_SECTION_MARGIN };
|
|
11
12
|
var firstNodeWithNotMarginTop = function firstNodeWithNotMarginTop() {
|
|
@@ -16,5 +17,5 @@ var firstNodeWithNotMarginTop = function firstNodeWithNotMarginTop() {
|
|
|
16
17
|
|
|
17
18
|
// eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression -- Needs manual remediation
|
|
18
19
|
export var layoutStyles = function layoutStyles(viewMode) {
|
|
19
|
-
return css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n\t.ProseMirror {\n\t\t", " [data-layout-section] {\n\t\t\t// TODO: Migrate away from gridSize\n\t\t\t// Recommendation: Replace directly with 7px\n\t\t\tmargin: ", " -", "px 0;\n\t\t\ttransition: border-color 0.3s ", ";\n\t\t\tcursor: ", ";\n\n\t\t\t/* Inner cursor located 26px from left */\n\t\t\t[data-layout-column] {\n\t\t\t\tflex: 1;\n\t\t\t\tmin-width: 0;\n\t\t\t\tborder: ", "px solid\n\t\t\t\t\t", ";\n\t\t\t\tborder-radius: 4px;\n\t\t\t\tpadding: ", "px\n\t\t\t\t\t", "px;\n\t\t\t\tbox-sizing: border-box;\n\n\t\t\t\t> div {\n\t\t\t\t\t", "\n\n\t\t\t\t\t> .embedCardView-content-wrap:first-of-type .rich-media-item {\n\t\t\t\t\t\tmargin-top: 0;\n\t\t\t\t\t}\n\n\t\t\t\t\t> .mediaSingleView-content-wrap:first-of-type .rich-media-item {\n\t\t\t\t\t\tmargin-top: 0;\n\t\t\t\t\t}\n\n\t\t\t\t\t> .ProseMirror-gapcursor.-right:first-child\n\t\t\t\t\t\t+ .mediaSingleView-content-wrap\n\t\t\t\t\t\t.rich-media-item,\n\t\t\t\t\t> style:first-child\n\t\t\t\t\t\t+ .ProseMirror-gapcursor.-right\n\t\t\t\t\t\t+ .mediaSingleView-content-wrap\n\t\t\t\t\t\t.rich-media-item,\n\t\t\t\t\t> .ProseMirror-gapcursor.-right:first-of-type\n\t\t\t\t\t\t+ .embedCardView-content-wrap\n\t\t\t\t\t\t.rich-media-item {\n\t\t\t\t\t\tmargin-top: 0;\n\t\t\t\t\t}\n\n\t\t\t\t\t> .ProseMirror-gapcursor:first-child\n\t\t\t\t\t\t+ span\n\t\t\t\t\t\t+ .mediaSingleView-content-wrap\n\t\t\t\t\t\t.rich-media-item,\n\t\t\t\t\t> style:first-child\n\t\t\t\t\t\t+ .ProseMirror-gapcursor\n\t\t\t\t\t\t+ span\n\t\t\t\t\t\t+ .mediaSingleView-content-wrap\n\t\t\t\t\t\t.rich-media-item {\n\t\t\t\t\t\tmargin-top: 0;\n\t\t\t\t\t}\n\n\t\t\t\t\t/* Prevent first DecisionWrapper's margin-top: 8px from shifting decisions down\n and shrinking layout's node selectable area (leniency margin) */\n\t\t\t\t\t> [data-node-type='decisionList'] {\n\t\t\t\t\t\tli:first-of-type [data-decision-wrapper] {\n\t\t\t\t\t\t\tmargin-top: 0;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t/* Make the 'content' fill the entire height of the layout column to allow click\n handler of layout section nodeview to target only data-layout-column */\n\t\t\t\t[data-layout-content] {\n\t\t\t\t\theight: 100%;\n\t\t\t\t\tcursor: text;\n\t\t\t\t\t.mediaGroupView-content-wrap {\n\t\t\t\t\t\tclear: both;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t[data-layout-column] + [data-layout-column] {\n\t\t\t\tmargin-left: ", "px;\n\t\t\t}\n\n\t\t\t@media screen and (max-width: ", "px) {\n\t\t\t\t[data-layout-column] + [data-layout-column] {\n\t\t\t\t\tmargin-left: 0;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// TODO: Remove the border styles below once design tokens have been enabled and fallbacks are no longer triggered.\n\t\t\t// This is because the default state already uses the same token and, as such, the hover style won't change anything.\n\t\t\t// https://product-fabric.atlassian.net/browse/DSP-4441\n\t\t\t/* Shows the border when cursor is inside a layout */\n\t\t\t&.selected [data-layout-column],\n\t\t\t&:hover [data-layout-column] {\n\t\t\t\tborder: ", "px solid\n\t\t\t\t\t", ";\n\t\t\t}\n\n\t\t\t&.selected.danger > [data-layout-column] {\n\t\t\t\tbackground-color: ", ";\n\t\t\t\tborder-color: ", ";\n\t\t\t}\n\n\t\t\t&.", ":not(.danger) {\n\t\t\t\t[data-layout-column] {\n\t\t\t\t\t", "\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t.fabric-editor--full-width-mode .ProseMirror {\n\t\t[data-layout-section] {\n\t\t\t.", " {\n\t\t\t\tmargin: 0 ", "px;\n\t\t\t}\n\t\t}\n\t}\n\n\t", "\n"])), columnLayoutSharedStyle, "var(--ds-space-100, 8px)", akLayoutGutterOffset, akEditorSwoopCubicBezier, viewMode === 'view' ? 'default' : 'pointer', viewMode === 'view' ? 0 : akEditorSelectedBorderSize, "var(--ds-border, #091E4224)", LAYOUT_COLUMN_PADDING, LAYOUT_COLUMN_PADDING + (editorExperiment('nested-dnd', true) ? 8 : 0), firstNodeWithNotMarginTop(), LAYOUT_SECTION_MARGIN, gridMediumMaxWidth, viewMode === 'view' ? 0 : akEditorSelectedBorderSize, "var(--ds-border, #091E4224)", "var(--ds-background-danger, ".concat(akEditorDeleteBackground, ")"), "var(--ds-border-danger, ".concat(akEditorDeleteBorder, ")"), akEditorSelectedNodeClassName, getSelectionStyles([SelectionStyle.Border, SelectionStyle.Blanket]), TableCssClassName.TABLE_CONTAINER, tableMarginFullWidthMode, editorExperiment('nested-dnd', true) && ".ak-editor-content-area.appearance-full-page .ProseMirror [data-layout-section] {\n\t\t\t\tmargin: ".concat("var(--ds-space-100, 8px)", " -", akLayoutGutterOffset + 8, "px 0;\n\t\t\t\t}"));
|
|
20
|
+
return css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n\t.ProseMirror {\n\t\t", " [data-layout-section] {\n\t\t\t// TODO: Migrate away from gridSize\n\t\t\t// Recommendation: Replace directly with 7px\n\t\t\tmargin: ", " -", "px 0;\n\t\t\ttransition: border-color 0.3s ", ";\n\t\t\tcursor: ", ";\n\n\t\t\t/* Inner cursor located 26px from left */\n\t\t\t[data-layout-column] {\n\t\t\t\tflex: 1;\n\t\t\t\t", "\n\n\t\t\t\tmin-width: 0;\n\t\t\t\tborder: ", "px solid\n\t\t\t\t\t", ";\n\t\t\t\tborder-radius: 4px;\n\t\t\t\tpadding: ", "px\n\t\t\t\t\t", "px;\n\t\t\t\tbox-sizing: border-box;\n\n\t\t\t\t> div {\n\t\t\t\t\t", "\n\n\t\t\t\t\t> .embedCardView-content-wrap:first-of-type .rich-media-item {\n\t\t\t\t\t\tmargin-top: 0;\n\t\t\t\t\t}\n\n\t\t\t\t\t> .mediaSingleView-content-wrap:first-of-type .rich-media-item {\n\t\t\t\t\t\tmargin-top: 0;\n\t\t\t\t\t}\n\n\t\t\t\t\t> .ProseMirror-gapcursor.-right:first-child\n\t\t\t\t\t\t+ .mediaSingleView-content-wrap\n\t\t\t\t\t\t.rich-media-item,\n\t\t\t\t\t> style:first-child\n\t\t\t\t\t\t+ .ProseMirror-gapcursor.-right\n\t\t\t\t\t\t+ .mediaSingleView-content-wrap\n\t\t\t\t\t\t.rich-media-item,\n\t\t\t\t\t> .ProseMirror-gapcursor.-right:first-of-type\n\t\t\t\t\t\t+ .embedCardView-content-wrap\n\t\t\t\t\t\t.rich-media-item {\n\t\t\t\t\t\tmargin-top: 0;\n\t\t\t\t\t}\n\n\t\t\t\t\t> .ProseMirror-gapcursor:first-child\n\t\t\t\t\t\t+ span\n\t\t\t\t\t\t+ .mediaSingleView-content-wrap\n\t\t\t\t\t\t.rich-media-item,\n\t\t\t\t\t> style:first-child\n\t\t\t\t\t\t+ .ProseMirror-gapcursor\n\t\t\t\t\t\t+ span\n\t\t\t\t\t\t+ .mediaSingleView-content-wrap\n\t\t\t\t\t\t.rich-media-item {\n\t\t\t\t\t\tmargin-top: 0;\n\t\t\t\t\t}\n\n\t\t\t\t\t/* Prevent first DecisionWrapper's margin-top: 8px from shifting decisions down\n and shrinking layout's node selectable area (leniency margin) */\n\t\t\t\t\t> [data-node-type='decisionList'] {\n\t\t\t\t\t\tli:first-of-type [data-decision-wrapper] {\n\t\t\t\t\t\t\tmargin-top: 0;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t/* Make the 'content' fill the entire height of the layout column to allow click\n handler of layout section nodeview to target only data-layout-column */\n\t\t\t\t[data-layout-content] {\n\t\t\t\t\theight: 100%;\n\t\t\t\t\tcursor: text;\n\t\t\t\t\t.mediaGroupView-content-wrap {\n\t\t\t\t\t\tclear: both;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t[data-layout-column] + [data-layout-column] {\n\t\t\t\tmargin-left: ", "px;\n\t\t\t}\n\n\t\t\t@media screen and (max-width: ", "px) {\n\t\t\t\t[data-layout-column] + [data-layout-column] {\n\t\t\t\t\tmargin-left: 0;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// TODO: Remove the border styles below once design tokens have been enabled and fallbacks are no longer triggered.\n\t\t\t// This is because the default state already uses the same token and, as such, the hover style won't change anything.\n\t\t\t// https://product-fabric.atlassian.net/browse/DSP-4441\n\t\t\t/* Shows the border when cursor is inside a layout */\n\t\t\t&.selected [data-layout-column],\n\t\t\t&:hover [data-layout-column] {\n\t\t\t\tborder: ", "px solid\n\t\t\t\t\t", ";\n\t\t\t}\n\n\t\t\t&.selected.danger > [data-layout-column] {\n\t\t\t\tbackground-color: ", ";\n\t\t\t\tborder-color: ", ";\n\t\t\t}\n\n\t\t\t&.", ":not(.danger) {\n\t\t\t\t[data-layout-column] {\n\t\t\t\t\t", "\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t.fabric-editor--full-width-mode .ProseMirror {\n\t\t[data-layout-section] {\n\t\t\t.", " {\n\t\t\t\tmargin: 0 ", "px;\n\t\t\t}\n\t\t}\n\t}\n\n\t", "\n"])), columnLayoutSharedStyle, "var(--ds-space-100, 8px)", akLayoutGutterOffset, akEditorSwoopCubicBezier, viewMode === 'view' ? 'default' : 'pointer', fg('platform_editor_drag_and_drop_target_v2') ? 'position: relative;' : '', viewMode === 'view' ? 0 : akEditorSelectedBorderSize, "var(--ds-border, #091E4224)", LAYOUT_COLUMN_PADDING, LAYOUT_COLUMN_PADDING + (editorExperiment('nested-dnd', true) ? 8 : 0), firstNodeWithNotMarginTop(), LAYOUT_SECTION_MARGIN, gridMediumMaxWidth, viewMode === 'view' ? 0 : akEditorSelectedBorderSize, "var(--ds-border, #091E4224)", "var(--ds-background-danger, ".concat(akEditorDeleteBackground, ")"), "var(--ds-border-danger, ".concat(akEditorDeleteBorder, ")"), akEditorSelectedNodeClassName, getSelectionStyles([SelectionStyle.Border, SelectionStyle.Blanket]), TableCssClassName.TABLE_CONTAINER, tableMarginFullWidthMode, editorExperiment('nested-dnd', true) && ".ak-editor-content-area.appearance-full-page .ProseMirror [data-layout-section] {\n\t\t\t\tmargin: ".concat("var(--ds-space-100, 8px)", " -", akLayoutGutterOffset + 8, "px 0;\n\t\t\t\t}"));
|
|
20
21
|
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export var name = "@atlaskit/editor-core";
|
|
2
|
-
export var version = "198.
|
|
2
|
+
export var version = "198.5.0";
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { DispatchAnalyticsEvent } from '@atlaskit/editor-common/analytics';
|
|
2
|
+
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
3
|
+
import type { SafePluginSpec } from '@atlaskit/editor-prosemirror/state';
|
|
4
|
+
type SafeApplyPluginOptions = {
|
|
5
|
+
dispatchAnalyticsEvent?: DispatchAnalyticsEvent;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* This is for safety in case someone is trying to mutate
|
|
9
|
+
* the transaction in the apply which should never be done.
|
|
10
|
+
*/
|
|
11
|
+
export declare class SafeApplyPlugin<PluginState> extends SafePlugin<PluginState> {
|
|
12
|
+
constructor(spec: SafePluginSpec, options?: SafeApplyPluginOptions);
|
|
13
|
+
static fromPlugin<T>(plugin: SafePlugin<T>, options: SafeApplyPluginOptions): SafeApplyPlugin<T>;
|
|
14
|
+
}
|
|
15
|
+
export {};
|
|
@@ -1,9 +1,5 @@
|
|
|
1
|
-
import type { TransactionTracker } from '../utils/performance/track-transactions';
|
|
2
1
|
import type { EditorConfig } from './editor-config';
|
|
3
|
-
import type { PerformanceTracking } from './performance-tracking';
|
|
4
2
|
import type { PMPluginFactoryParams } from './pm-plugin';
|
|
5
3
|
export type PMPluginCreateConfig = PMPluginFactoryParams & {
|
|
6
4
|
editorConfig: EditorConfig;
|
|
7
|
-
performanceTracking?: PerformanceTracking;
|
|
8
|
-
transactionTracker?: TransactionTracker;
|
|
9
5
|
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { DispatchAnalyticsEvent } from '@atlaskit/editor-common/analytics';
|
|
2
|
+
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
3
|
+
import type { SafePluginSpec } from '@atlaskit/editor-prosemirror/state';
|
|
4
|
+
type SafeApplyPluginOptions = {
|
|
5
|
+
dispatchAnalyticsEvent?: DispatchAnalyticsEvent;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* This is for safety in case someone is trying to mutate
|
|
9
|
+
* the transaction in the apply which should never be done.
|
|
10
|
+
*/
|
|
11
|
+
export declare class SafeApplyPlugin<PluginState> extends SafePlugin<PluginState> {
|
|
12
|
+
constructor(spec: SafePluginSpec, options?: SafeApplyPluginOptions);
|
|
13
|
+
static fromPlugin<T>(plugin: SafePlugin<T>, options: SafeApplyPluginOptions): SafeApplyPlugin<T>;
|
|
14
|
+
}
|
|
15
|
+
export {};
|
|
@@ -1,9 +1,5 @@
|
|
|
1
|
-
import type { TransactionTracker } from '../utils/performance/track-transactions';
|
|
2
1
|
import type { EditorConfig } from './editor-config';
|
|
3
|
-
import type { PerformanceTracking } from './performance-tracking';
|
|
4
2
|
import type { PMPluginFactoryParams } from './pm-plugin';
|
|
5
3
|
export type PMPluginCreateConfig = PMPluginFactoryParams & {
|
|
6
4
|
editorConfig: EditorConfig;
|
|
7
|
-
performanceTracking?: PerformanceTracking;
|
|
8
|
-
transactionTracker?: TransactionTracker;
|
|
9
5
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-core",
|
|
3
|
-
"version": "198.
|
|
3
|
+
"version": "198.5.0",
|
|
4
4
|
"description": "A package contains Atlassian editor core functionality",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"@atlaskit/analytics-next": "^10.1.0",
|
|
44
44
|
"@atlaskit/analytics-next-stable-react-context": "1.0.1",
|
|
45
45
|
"@atlaskit/button": "^20.2.0",
|
|
46
|
-
"@atlaskit/editor-common": "^93.
|
|
46
|
+
"@atlaskit/editor-common": "^93.2.0",
|
|
47
47
|
"@atlaskit/editor-json-transformer": "^8.18.0",
|
|
48
48
|
"@atlaskit/editor-plugin-quick-insert": "1.4.5",
|
|
49
49
|
"@atlaskit/editor-plugins": "^5.5.0",
|
|
@@ -85,7 +85,7 @@
|
|
|
85
85
|
"@atlaskit/analytics-listeners": "^8.11.0",
|
|
86
86
|
"@atlaskit/collab-provider": "9.42.5",
|
|
87
87
|
"@atlaskit/editor-plugin-annotation": "1.19.11",
|
|
88
|
-
"@atlaskit/editor-plugin-card": "^4.
|
|
88
|
+
"@atlaskit/editor-plugin-card": "^4.2.0",
|
|
89
89
|
"@atlaskit/editor-plugin-list": "^3.8.0",
|
|
90
90
|
"@atlaskit/editor-plugin-paste": "^1.13.0",
|
|
91
91
|
"@atlaskit/link-provider": "^1.16.0",
|
|
@@ -96,7 +96,7 @@
|
|
|
96
96
|
"@atlaskit/modal-dialog": "^12.17.0",
|
|
97
97
|
"@atlaskit/primitives": "^12.2.0",
|
|
98
98
|
"@atlaskit/renderer": "^111.1.0",
|
|
99
|
-
"@atlaskit/smart-card": "^
|
|
99
|
+
"@atlaskit/smart-card": "^30.0.0",
|
|
100
100
|
"@atlaskit/synchrony-test-helpers": "^2.5.0",
|
|
101
101
|
"@atlaskit/toggle": "^13.4.0",
|
|
102
102
|
"@atlaskit/util-data-test": "^17.9.0",
|
|
@@ -164,10 +164,6 @@
|
|
|
164
164
|
"type": "boolean",
|
|
165
165
|
"referenceOnly": "true"
|
|
166
166
|
},
|
|
167
|
-
"platform.linking-platform.datasource-word_wrap": {
|
|
168
|
-
"type": "boolean",
|
|
169
|
-
"referenceOnly": "true"
|
|
170
|
-
},
|
|
171
167
|
"platform.editor.inline_extension.extended_lcqdn": {
|
|
172
168
|
"type": "boolean",
|
|
173
169
|
"referenceOnly": "true"
|
|
@@ -268,6 +264,9 @@
|
|
|
268
264
|
"type": "boolean",
|
|
269
265
|
"referenceOnly": true
|
|
270
266
|
},
|
|
267
|
+
"platform_editor_react18_extension_component": {
|
|
268
|
+
"type": "boolean"
|
|
269
|
+
},
|
|
271
270
|
"platform_editor_context_panel_support_multiple": {
|
|
272
271
|
"type": "boolean",
|
|
273
272
|
"referenceOnly": true
|
|
@@ -278,6 +277,10 @@
|
|
|
278
277
|
"platform_editor_heading_margin_fix": {
|
|
279
278
|
"type": "boolean",
|
|
280
279
|
"referenceOnly": true
|
|
280
|
+
},
|
|
281
|
+
"platform_editor_drag_and_drop_target_v2": {
|
|
282
|
+
"type": "boolean",
|
|
283
|
+
"referenceOnly": true
|
|
281
284
|
}
|
|
282
285
|
},
|
|
283
286
|
"stricter": {
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.InstrumentedPlugin = void 0;
|
|
8
|
-
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
9
|
-
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
10
|
-
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
11
|
-
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
12
|
-
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
13
|
-
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
14
|
-
var _performanceMeasures = require("@atlaskit/editor-common/performance-measures");
|
|
15
|
-
var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
|
|
16
|
-
var _saferTransactions = require("./safer-transactions");
|
|
17
|
-
function _createSuper(t) { var r = _isNativeReflectConstruct(); return function () { var e, o = (0, _getPrototypeOf2.default)(t); if (r) { var s = (0, _getPrototypeOf2.default)(this).constructor; e = Reflect.construct(o, arguments, s); } else e = o.apply(this, arguments); return (0, _possibleConstructorReturn2.default)(this, e); }; }
|
|
18
|
-
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
19
|
-
var InstrumentedPlugin = exports.InstrumentedPlugin = /*#__PURE__*/function (_SafePlugin) {
|
|
20
|
-
(0, _inherits2.default)(InstrumentedPlugin, _SafePlugin);
|
|
21
|
-
var _super = _createSuper(InstrumentedPlugin);
|
|
22
|
-
function InstrumentedPlugin(spec) {
|
|
23
|
-
var _this;
|
|
24
|
-
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
25
|
-
var transactionTracker = arguments.length > 2 ? arguments[2] : undefined;
|
|
26
|
-
(0, _classCallCheck2.default)(this, InstrumentedPlugin);
|
|
27
|
-
var _options$transactionT = options.transactionTracking,
|
|
28
|
-
transactionTracking = _options$transactionT === void 0 ? {
|
|
29
|
-
enabled: false
|
|
30
|
-
} : _options$transactionT,
|
|
31
|
-
_options$uiTracking = options.uiTracking,
|
|
32
|
-
uiTracking = _options$uiTracking === void 0 ? {
|
|
33
|
-
enabled: false
|
|
34
|
-
} : _options$uiTracking,
|
|
35
|
-
dispatchAnalyticsEvent = options.dispatchAnalyticsEvent;
|
|
36
|
-
if (spec.state) {
|
|
37
|
-
var originalApply = spec.state.apply.bind(spec.state);
|
|
38
|
-
spec.state.apply = function (aTr, value, oldState, newState) {
|
|
39
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
40
|
-
var self = (0, _assertThisInitialized2.default)(_this);
|
|
41
|
-
var tr = new Proxy(aTr, (0, _saferTransactions.freezeUnsafeTransactionProperties)({
|
|
42
|
-
dispatchAnalyticsEvent: dispatchAnalyticsEvent,
|
|
43
|
-
pluginKey: self.key
|
|
44
|
-
}));
|
|
45
|
-
var shouldTrackTransactions = transactionTracker === null || transactionTracker === void 0 ? void 0 : transactionTracker.shouldTrackTransaction(transactionTracking);
|
|
46
|
-
if (!shouldTrackTransactions || !transactionTracker) {
|
|
47
|
-
return originalApply(tr, value, oldState, newState);
|
|
48
|
-
}
|
|
49
|
-
var _transactionTracker$g = transactionTracker.getMeasureHelpers(transactionTracking),
|
|
50
|
-
startMeasure = _transactionTracker$g.startMeasure,
|
|
51
|
-
stopMeasure = _transactionTracker$g.stopMeasure;
|
|
52
|
-
var measure = "\uD83E\uDD89".concat(self.key, "::apply");
|
|
53
|
-
startMeasure(measure);
|
|
54
|
-
var result = originalApply(tr, value, oldState, newState);
|
|
55
|
-
stopMeasure(measure);
|
|
56
|
-
return result;
|
|
57
|
-
};
|
|
58
|
-
}
|
|
59
|
-
var _uiTracking$samplingR = uiTracking.samplingRate,
|
|
60
|
-
uiTrackingSamplingRate = _uiTracking$samplingR === void 0 ? 100 : _uiTracking$samplingR;
|
|
61
|
-
if (uiTracking.enabled && spec.view) {
|
|
62
|
-
var originalView = spec.view.bind(spec);
|
|
63
|
-
spec.view = function (editorView) {
|
|
64
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
65
|
-
var self = (0, _assertThisInitialized2.default)(_this);
|
|
66
|
-
var measure = "\uD83E\uDD89".concat(self.key, "::view::update");
|
|
67
|
-
var view = originalView(editorView);
|
|
68
|
-
var uiTrackingSamplingCounter = 0;
|
|
69
|
-
if (view.update) {
|
|
70
|
-
var originalUpdate = view.update;
|
|
71
|
-
view.update = function (view, state) {
|
|
72
|
-
var shouldTrack = uiTrackingSamplingRate && uiTrackingSamplingCounter === 0;
|
|
73
|
-
if (shouldTrack) {
|
|
74
|
-
(0, _performanceMeasures.startMeasure)(measure);
|
|
75
|
-
}
|
|
76
|
-
originalUpdate(view, state);
|
|
77
|
-
if (shouldTrack) {
|
|
78
|
-
(0, _performanceMeasures.stopMeasure)(measure, function () {});
|
|
79
|
-
}
|
|
80
|
-
uiTrackingSamplingCounter++;
|
|
81
|
-
if (uiTrackingSamplingRate && uiTrackingSamplingCounter >= uiTrackingSamplingRate) {
|
|
82
|
-
uiTrackingSamplingCounter = 0;
|
|
83
|
-
}
|
|
84
|
-
};
|
|
85
|
-
}
|
|
86
|
-
return view;
|
|
87
|
-
};
|
|
88
|
-
}
|
|
89
|
-
return _this = _super.call(this, spec);
|
|
90
|
-
}
|
|
91
|
-
(0, _createClass2.default)(InstrumentedPlugin, null, [{
|
|
92
|
-
key: "fromPlugin",
|
|
93
|
-
value: function fromPlugin(plugin, options, transactionTracker) {
|
|
94
|
-
return new InstrumentedPlugin(plugin.spec, options, transactionTracker);
|
|
95
|
-
}
|
|
96
|
-
}]);
|
|
97
|
-
return InstrumentedPlugin;
|
|
98
|
-
}(_safePlugin.SafePlugin);
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import { startMeasure, stopMeasure } from '@atlaskit/editor-common/performance-measures';
|
|
2
|
-
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
3
|
-
import { freezeUnsafeTransactionProperties } from './safer-transactions';
|
|
4
|
-
export class InstrumentedPlugin extends SafePlugin {
|
|
5
|
-
constructor(spec, options = {}, transactionTracker) {
|
|
6
|
-
const {
|
|
7
|
-
transactionTracking = {
|
|
8
|
-
enabled: false
|
|
9
|
-
},
|
|
10
|
-
uiTracking = {
|
|
11
|
-
enabled: false
|
|
12
|
-
},
|
|
13
|
-
dispatchAnalyticsEvent
|
|
14
|
-
} = options;
|
|
15
|
-
if (spec.state) {
|
|
16
|
-
const originalApply = spec.state.apply.bind(spec.state);
|
|
17
|
-
spec.state.apply = (aTr, value, oldState, newState) => {
|
|
18
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
19
|
-
const self = this;
|
|
20
|
-
const tr = new Proxy(aTr, freezeUnsafeTransactionProperties({
|
|
21
|
-
dispatchAnalyticsEvent,
|
|
22
|
-
pluginKey: self.key
|
|
23
|
-
}));
|
|
24
|
-
const shouldTrackTransactions = transactionTracker === null || transactionTracker === void 0 ? void 0 : transactionTracker.shouldTrackTransaction(transactionTracking);
|
|
25
|
-
if (!shouldTrackTransactions || !transactionTracker) {
|
|
26
|
-
return originalApply(tr, value, oldState, newState);
|
|
27
|
-
}
|
|
28
|
-
const {
|
|
29
|
-
startMeasure,
|
|
30
|
-
stopMeasure
|
|
31
|
-
} = transactionTracker.getMeasureHelpers(transactionTracking);
|
|
32
|
-
const measure = `🦉${self.key}::apply`;
|
|
33
|
-
startMeasure(measure);
|
|
34
|
-
const result = originalApply(tr, value, oldState, newState);
|
|
35
|
-
stopMeasure(measure);
|
|
36
|
-
return result;
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
const {
|
|
40
|
-
samplingRate: uiTrackingSamplingRate = 100
|
|
41
|
-
} = uiTracking;
|
|
42
|
-
if (uiTracking.enabled && spec.view) {
|
|
43
|
-
const originalView = spec.view.bind(spec);
|
|
44
|
-
spec.view = editorView => {
|
|
45
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
46
|
-
const self = this;
|
|
47
|
-
const measure = `🦉${self.key}::view::update`;
|
|
48
|
-
const view = originalView(editorView);
|
|
49
|
-
let uiTrackingSamplingCounter = 0;
|
|
50
|
-
if (view.update) {
|
|
51
|
-
const originalUpdate = view.update;
|
|
52
|
-
view.update = (view, state) => {
|
|
53
|
-
const shouldTrack = uiTrackingSamplingRate && uiTrackingSamplingCounter === 0;
|
|
54
|
-
if (shouldTrack) {
|
|
55
|
-
startMeasure(measure);
|
|
56
|
-
}
|
|
57
|
-
originalUpdate(view, state);
|
|
58
|
-
if (shouldTrack) {
|
|
59
|
-
stopMeasure(measure, () => {});
|
|
60
|
-
}
|
|
61
|
-
uiTrackingSamplingCounter++;
|
|
62
|
-
if (uiTrackingSamplingRate && uiTrackingSamplingCounter >= uiTrackingSamplingRate) {
|
|
63
|
-
uiTrackingSamplingCounter = 0;
|
|
64
|
-
}
|
|
65
|
-
};
|
|
66
|
-
}
|
|
67
|
-
return view;
|
|
68
|
-
};
|
|
69
|
-
}
|
|
70
|
-
super(spec);
|
|
71
|
-
}
|
|
72
|
-
static fromPlugin(plugin, options, transactionTracker) {
|
|
73
|
-
return new InstrumentedPlugin(plugin.spec, options, transactionTracker);
|
|
74
|
-
}
|
|
75
|
-
}
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
2
|
-
import _createClass from "@babel/runtime/helpers/createClass";
|
|
3
|
-
import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
|
|
4
|
-
import _inherits from "@babel/runtime/helpers/inherits";
|
|
5
|
-
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
6
|
-
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
7
|
-
function _createSuper(t) { var r = _isNativeReflectConstruct(); return function () { var e, o = _getPrototypeOf(t); if (r) { var s = _getPrototypeOf(this).constructor; e = Reflect.construct(o, arguments, s); } else e = o.apply(this, arguments); return _possibleConstructorReturn(this, e); }; }
|
|
8
|
-
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
9
|
-
import { startMeasure, stopMeasure } from '@atlaskit/editor-common/performance-measures';
|
|
10
|
-
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
11
|
-
import { freezeUnsafeTransactionProperties } from './safer-transactions';
|
|
12
|
-
export var InstrumentedPlugin = /*#__PURE__*/function (_SafePlugin) {
|
|
13
|
-
_inherits(InstrumentedPlugin, _SafePlugin);
|
|
14
|
-
var _super = _createSuper(InstrumentedPlugin);
|
|
15
|
-
function InstrumentedPlugin(spec) {
|
|
16
|
-
var _this;
|
|
17
|
-
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
18
|
-
var transactionTracker = arguments.length > 2 ? arguments[2] : undefined;
|
|
19
|
-
_classCallCheck(this, InstrumentedPlugin);
|
|
20
|
-
var _options$transactionT = options.transactionTracking,
|
|
21
|
-
transactionTracking = _options$transactionT === void 0 ? {
|
|
22
|
-
enabled: false
|
|
23
|
-
} : _options$transactionT,
|
|
24
|
-
_options$uiTracking = options.uiTracking,
|
|
25
|
-
uiTracking = _options$uiTracking === void 0 ? {
|
|
26
|
-
enabled: false
|
|
27
|
-
} : _options$uiTracking,
|
|
28
|
-
dispatchAnalyticsEvent = options.dispatchAnalyticsEvent;
|
|
29
|
-
if (spec.state) {
|
|
30
|
-
var originalApply = spec.state.apply.bind(spec.state);
|
|
31
|
-
spec.state.apply = function (aTr, value, oldState, newState) {
|
|
32
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
33
|
-
var self = _assertThisInitialized(_this);
|
|
34
|
-
var tr = new Proxy(aTr, freezeUnsafeTransactionProperties({
|
|
35
|
-
dispatchAnalyticsEvent: dispatchAnalyticsEvent,
|
|
36
|
-
pluginKey: self.key
|
|
37
|
-
}));
|
|
38
|
-
var shouldTrackTransactions = transactionTracker === null || transactionTracker === void 0 ? void 0 : transactionTracker.shouldTrackTransaction(transactionTracking);
|
|
39
|
-
if (!shouldTrackTransactions || !transactionTracker) {
|
|
40
|
-
return originalApply(tr, value, oldState, newState);
|
|
41
|
-
}
|
|
42
|
-
var _transactionTracker$g = transactionTracker.getMeasureHelpers(transactionTracking),
|
|
43
|
-
startMeasure = _transactionTracker$g.startMeasure,
|
|
44
|
-
stopMeasure = _transactionTracker$g.stopMeasure;
|
|
45
|
-
var measure = "\uD83E\uDD89".concat(self.key, "::apply");
|
|
46
|
-
startMeasure(measure);
|
|
47
|
-
var result = originalApply(tr, value, oldState, newState);
|
|
48
|
-
stopMeasure(measure);
|
|
49
|
-
return result;
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
var _uiTracking$samplingR = uiTracking.samplingRate,
|
|
53
|
-
uiTrackingSamplingRate = _uiTracking$samplingR === void 0 ? 100 : _uiTracking$samplingR;
|
|
54
|
-
if (uiTracking.enabled && spec.view) {
|
|
55
|
-
var originalView = spec.view.bind(spec);
|
|
56
|
-
spec.view = function (editorView) {
|
|
57
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
58
|
-
var self = _assertThisInitialized(_this);
|
|
59
|
-
var measure = "\uD83E\uDD89".concat(self.key, "::view::update");
|
|
60
|
-
var view = originalView(editorView);
|
|
61
|
-
var uiTrackingSamplingCounter = 0;
|
|
62
|
-
if (view.update) {
|
|
63
|
-
var originalUpdate = view.update;
|
|
64
|
-
view.update = function (view, state) {
|
|
65
|
-
var shouldTrack = uiTrackingSamplingRate && uiTrackingSamplingCounter === 0;
|
|
66
|
-
if (shouldTrack) {
|
|
67
|
-
startMeasure(measure);
|
|
68
|
-
}
|
|
69
|
-
originalUpdate(view, state);
|
|
70
|
-
if (shouldTrack) {
|
|
71
|
-
stopMeasure(measure, function () {});
|
|
72
|
-
}
|
|
73
|
-
uiTrackingSamplingCounter++;
|
|
74
|
-
if (uiTrackingSamplingRate && uiTrackingSamplingCounter >= uiTrackingSamplingRate) {
|
|
75
|
-
uiTrackingSamplingCounter = 0;
|
|
76
|
-
}
|
|
77
|
-
};
|
|
78
|
-
}
|
|
79
|
-
return view;
|
|
80
|
-
};
|
|
81
|
-
}
|
|
82
|
-
return _this = _super.call(this, spec);
|
|
83
|
-
}
|
|
84
|
-
_createClass(InstrumentedPlugin, null, [{
|
|
85
|
-
key: "fromPlugin",
|
|
86
|
-
value: function fromPlugin(plugin, options, transactionTracker) {
|
|
87
|
-
return new InstrumentedPlugin(plugin.spec, options, transactionTracker);
|
|
88
|
-
}
|
|
89
|
-
}]);
|
|
90
|
-
return InstrumentedPlugin;
|
|
91
|
-
}(SafePlugin);
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { DispatchAnalyticsEvent } from '@atlaskit/editor-common/analytics';
|
|
2
|
-
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
3
|
-
import type { SafePluginSpec } from '@atlaskit/editor-prosemirror/state';
|
|
4
|
-
import type { EditorProps } from '../../types/editor-props';
|
|
5
|
-
import type { TransactionTracker } from './track-transactions';
|
|
6
|
-
type InstrumentedPluginOptions = EditorProps['performanceTracking'] & {
|
|
7
|
-
dispatchAnalyticsEvent?: DispatchAnalyticsEvent;
|
|
8
|
-
};
|
|
9
|
-
export declare class InstrumentedPlugin<PluginState> extends SafePlugin<PluginState> {
|
|
10
|
-
constructor(spec: SafePluginSpec, options?: InstrumentedPluginOptions, transactionTracker?: TransactionTracker);
|
|
11
|
-
static fromPlugin<T>(plugin: SafePlugin<T>, options: InstrumentedPluginOptions, transactionTracker?: TransactionTracker): InstrumentedPlugin<T>;
|
|
12
|
-
}
|
|
13
|
-
export {};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { DispatchAnalyticsEvent } from '@atlaskit/editor-common/analytics';
|
|
2
|
-
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
3
|
-
import type { SafePluginSpec } from '@atlaskit/editor-prosemirror/state';
|
|
4
|
-
import type { EditorProps } from '../../types/editor-props';
|
|
5
|
-
import type { TransactionTracker } from './track-transactions';
|
|
6
|
-
type InstrumentedPluginOptions = EditorProps['performanceTracking'] & {
|
|
7
|
-
dispatchAnalyticsEvent?: DispatchAnalyticsEvent;
|
|
8
|
-
};
|
|
9
|
-
export declare class InstrumentedPlugin<PluginState> extends SafePlugin<PluginState> {
|
|
10
|
-
constructor(spec: SafePluginSpec, options?: InstrumentedPluginOptions, transactionTracker?: TransactionTracker);
|
|
11
|
-
static fromPlugin<T>(plugin: SafePlugin<T>, options: InstrumentedPluginOptions, transactionTracker?: TransactionTracker): InstrumentedPlugin<T>;
|
|
12
|
-
}
|
|
13
|
-
export {};
|