@atlaskit/editor-core 197.2.2 → 197.2.4
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 +17 -0
- package/dist/cjs/actions/index.js +2 -1
- package/dist/cjs/composable-editor/core-editor.js +2 -2
- package/dist/cjs/create-editor/ErrorBoundary.js +2 -2
- package/dist/cjs/create-editor/ReactEditorView.js +17 -13
- package/dist/cjs/create-editor/create-schema.js +2 -2
- package/dist/cjs/ui/Appearance/FullPage/FullPage.js +2 -2
- package/dist/cjs/ui/ContentStyles/index.js +2 -2
- package/dist/cjs/ui/ToolbarFeedback/index.js +2 -2
- package/dist/cjs/ui/WithHelpTrigger/index.js +2 -2
- package/dist/cjs/utils/findChangedNodesFromTransaction.js +28 -0
- package/dist/cjs/utils/outdatedBrowsers.js +30 -0
- package/dist/cjs/utils/sanitizeNodes.js +63 -0
- package/dist/cjs/utils/validateNodes.js +19 -0
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/es2019/actions/index.js +2 -1
- package/dist/es2019/composable-editor/core-editor.js +1 -1
- package/dist/es2019/create-editor/ErrorBoundary.js +1 -1
- package/dist/es2019/create-editor/ReactEditorView.js +5 -1
- package/dist/es2019/create-editor/create-schema.js +1 -1
- package/dist/es2019/ui/Appearance/FullPage/FullPage.js +1 -1
- package/dist/es2019/ui/ContentStyles/index.js +1 -1
- package/dist/es2019/ui/ToolbarFeedback/index.js +1 -1
- package/dist/es2019/ui/WithHelpTrigger/index.js +1 -1
- package/dist/es2019/utils/findChangedNodesFromTransaction.js +20 -0
- package/dist/es2019/utils/outdatedBrowsers.js +24 -0
- package/dist/es2019/utils/sanitizeNodes.js +49 -0
- package/dist/es2019/utils/validateNodes.js +11 -0
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/esm/actions/index.js +2 -1
- package/dist/esm/composable-editor/core-editor.js +1 -1
- package/dist/esm/create-editor/ErrorBoundary.js +1 -1
- package/dist/esm/create-editor/ReactEditorView.js +5 -1
- package/dist/esm/create-editor/create-schema.js +1 -1
- package/dist/esm/ui/Appearance/FullPage/FullPage.js +1 -1
- package/dist/esm/ui/ContentStyles/index.js +1 -1
- package/dist/esm/ui/ToolbarFeedback/index.js +1 -1
- package/dist/esm/ui/WithHelpTrigger/index.js +1 -1
- package/dist/esm/utils/findChangedNodesFromTransaction.js +22 -0
- package/dist/esm/utils/outdatedBrowsers.js +24 -0
- package/dist/esm/utils/sanitizeNodes.js +56 -0
- package/dist/esm/utils/validateNodes.js +13 -0
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/types/utils/findChangedNodesFromTransaction.d.ts +8 -0
- package/dist/types/utils/outdatedBrowsers.d.ts +1 -0
- package/dist/types/utils/sanitizeNodes.d.ts +8 -0
- package/dist/types/utils/validateNodes.d.ts +4 -0
- package/dist/types-ts4.5/utils/findChangedNodesFromTransaction.d.ts +8 -0
- package/dist/types-ts4.5/utils/outdatedBrowsers.d.ts +1 -0
- package/dist/types-ts4.5/utils/sanitizeNodes.d.ts +8 -0
- package/dist/types-ts4.5/utils/validateNodes.d.ts +4 -0
- package/package.json +3 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# @atlaskit/editor-core
|
|
2
2
|
|
|
3
|
+
## 197.2.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#136410](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/136410)
|
|
8
|
+
[`52083ca79b5dc`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/52083ca79b5dc) -
|
|
9
|
+
[ux] ED-24603 Disable dragging nested nodes within table behind FF
|
|
10
|
+
|
|
11
|
+
## 197.2.3
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- [#136348](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/136348)
|
|
16
|
+
[`fb4fb56f1da7c`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/fb4fb56f1da7c) -
|
|
17
|
+
Use optimised entry-points on editor-common for browser.
|
|
18
|
+
- Updated dependencies
|
|
19
|
+
|
|
3
20
|
## 197.2.2
|
|
4
21
|
|
|
5
22
|
### Patch Changes
|
|
@@ -11,6 +11,7 @@ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/cl
|
|
|
11
11
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
12
12
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
13
13
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
14
|
+
var _analytics = require("@atlaskit/editor-common/utils/analytics");
|
|
14
15
|
var _model = require("@atlaskit/editor-prosemirror/model");
|
|
15
16
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
16
17
|
var _utils2 = require("@atlaskit/editor-prosemirror/utils");
|
|
@@ -39,7 +40,7 @@ var EditorActions = exports.default = /*#__PURE__*/function () {
|
|
|
39
40
|
(0, _defineProperty2.default)(this, "dispatchAnalyticsEvent", function (payload) {
|
|
40
41
|
if (_this.eventDispatcher) {
|
|
41
42
|
var dispatch = (0, _eventDispatcher.createDispatch)(_this.eventDispatcher);
|
|
42
|
-
dispatch(
|
|
43
|
+
dispatch(_analytics.analyticsEventKey, {
|
|
43
44
|
payload: payload
|
|
44
45
|
});
|
|
45
46
|
}
|
|
@@ -17,7 +17,7 @@ var _analytics = require("@atlaskit/editor-common/analytics");
|
|
|
17
17
|
var _hooks = require("@atlaskit/editor-common/hooks");
|
|
18
18
|
var _performanceMeasures = require("@atlaskit/editor-common/performance-measures");
|
|
19
19
|
var _ufo = require("@atlaskit/editor-common/ufo");
|
|
20
|
-
var
|
|
20
|
+
var _analytics2 = require("@atlaskit/editor-common/utils/analytics");
|
|
21
21
|
var _actions = _interopRequireDefault(require("../actions"));
|
|
22
22
|
var _featureFlagsFromProps = require("../create-editor/feature-flags-from-props");
|
|
23
23
|
var _EditorContext = require("../ui/EditorContext");
|
|
@@ -133,7 +133,7 @@ function CoreEditor(props) {
|
|
|
133
133
|
packageName: _versionWrapper.name,
|
|
134
134
|
packageVersion: _versionWrapper.version,
|
|
135
135
|
componentName: 'editorCore',
|
|
136
|
-
appearance: (0,
|
|
136
|
+
appearance: (0, _analytics2.getAnalyticsAppearance)(props.appearance),
|
|
137
137
|
editorSessionId: editorSessionId.current
|
|
138
138
|
};
|
|
139
139
|
}, [props.appearance]);
|
|
@@ -21,7 +21,7 @@ var _coreUtils = require("@atlaskit/editor-common/core-utils");
|
|
|
21
21
|
var _intlErrorBoundary = require("@atlaskit/editor-common/intl-error-boundary");
|
|
22
22
|
var _monitoring = require("@atlaskit/editor-common/monitoring");
|
|
23
23
|
var _ufo = require("@atlaskit/editor-common/ufo");
|
|
24
|
-
var
|
|
24
|
+
var _outdatedBrowsers = require("../utils/outdatedBrowsers");
|
|
25
25
|
var _WithEditorView = require("./WithEditorView");
|
|
26
26
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
27
27
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
@@ -62,7 +62,7 @@ var ErrorBoundaryWithEditorView = exports.ErrorBoundaryWithEditorView = /*#__PUR
|
|
|
62
62
|
docStructure: _this.featureFlags.errorBoundaryDocStructure && _this.props.editorView ? (0, _coreUtils.getDocStructure)(_this.props.editorView.state.doc, {
|
|
63
63
|
compact: true
|
|
64
64
|
}) : undefined,
|
|
65
|
-
outdatedBrowser: (0,
|
|
65
|
+
outdatedBrowser: (0, _outdatedBrowsers.isOutdatedBrowser)(browserInfo)
|
|
66
66
|
};
|
|
67
67
|
_this.fireAnalyticsEvent({
|
|
68
68
|
action: _analytics.ACTION.EDITOR_CRASHED,
|
|
@@ -17,23 +17,27 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
17
17
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
18
18
|
var _reactIntlNext = require("react-intl-next");
|
|
19
19
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
20
|
+
var _browser = require("@atlaskit/editor-common/browser");
|
|
20
21
|
var _coreUtils = require("@atlaskit/editor-common/core-utils");
|
|
21
22
|
var _normalizeFeatureFlags = require("@atlaskit/editor-common/normalize-feature-flags");
|
|
22
23
|
var _performanceMeasures = require("@atlaskit/editor-common/performance-measures");
|
|
23
24
|
var _preset = require("@atlaskit/editor-common/preset");
|
|
24
25
|
var _ufo = require("@atlaskit/editor-common/ufo");
|
|
25
26
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
27
|
+
var _analytics2 = require("@atlaskit/editor-common/utils/analytics");
|
|
26
28
|
var _state2 = require("@atlaskit/editor-prosemirror/state");
|
|
27
29
|
var _view = require("@atlaskit/editor-prosemirror/view");
|
|
28
30
|
var _eventDispatcher = require("../event-dispatcher");
|
|
29
31
|
var _context = require("../presets/context");
|
|
30
32
|
var _document = require("../utils/document");
|
|
33
|
+
var _findChangedNodesFromTransaction = require("../utils/findChangedNodesFromTransaction");
|
|
31
34
|
var _isFullPage = require("../utils/is-full-page");
|
|
32
35
|
var _RenderTracking = require("../utils/performance/components/RenderTracking");
|
|
33
36
|
var _measureEnum = _interopRequireDefault(require("../utils/performance/measure-enum"));
|
|
34
37
|
var _pluginPerformanceObserver = require("../utils/performance/plugin-performance-observer");
|
|
35
38
|
var _saferTransactions = require("../utils/performance/safer-transactions");
|
|
36
39
|
var _trackTransactions = require("../utils/performance/track-transactions");
|
|
40
|
+
var _validateNodes = require("../utils/validateNodes");
|
|
37
41
|
var _consts = require("./consts");
|
|
38
42
|
var _createEditor = require("./create-editor");
|
|
39
43
|
var _createPluginsList = _interopRequireDefault(require("./create-plugins-list"));
|
|
@@ -283,8 +287,8 @@ var ReactEditorView = exports.ReactEditorView = /*#__PURE__*/function (_React$Co
|
|
|
283
287
|
var _this$experienceStore;
|
|
284
288
|
(_this$experienceStore = _this.experienceStore) === null || _this$experienceStore === void 0 || _this$experienceStore.start(_ufo.EditorExperience.interaction);
|
|
285
289
|
}
|
|
286
|
-
var nodes = (0,
|
|
287
|
-
var changedNodesValid = (0,
|
|
290
|
+
var nodes = (0, _findChangedNodesFromTransaction.findChangedNodesFromTransaction)(unsafeTransaction);
|
|
291
|
+
var changedNodesValid = (0, _validateNodes.validateNodes)(nodes);
|
|
288
292
|
var transaction = new Proxy(unsafeTransaction, (0, _saferTransactions.freezeUnsafeTransactionProperties)({
|
|
289
293
|
dispatchAnalyticsEvent: _this.dispatchAnalyticsEvent,
|
|
290
294
|
pluginKey: 'unknown-reacteditorview'
|
|
@@ -358,7 +362,7 @@ var ReactEditorView = exports.ReactEditorView = /*#__PURE__*/function (_React$Co
|
|
|
358
362
|
} else {
|
|
359
363
|
var _this$experienceStore8;
|
|
360
364
|
var invalidNodes = nodes.filter(function (node) {
|
|
361
|
-
return !(0,
|
|
365
|
+
return !(0, _validateNodes.validNode)(node);
|
|
362
366
|
}).map(function (node) {
|
|
363
367
|
return (0, _coreUtils.getDocStructure)(node, {
|
|
364
368
|
compact: true
|
|
@@ -409,7 +413,7 @@ var ReactEditorView = exports.ReactEditorView = /*#__PURE__*/function (_React$Co
|
|
|
409
413
|
distortedDuration = _ref3.distortedDuration;
|
|
410
414
|
var proseMirrorRenderedTracking = (_this$props$editorPro4 = _this.props.editorProps) === null || _this$props$editorPro4 === void 0 || (_this$props$editorPro4 = _this$props$editorPro4.performanceTracking) === null || _this$props$editorPro4 === void 0 ? void 0 : _this$props$editorPro4.proseMirrorRenderedTracking;
|
|
411
415
|
var forceSeverityTracking = typeof proseMirrorRenderedTracking === 'undefined' && (0, _utils.shouldForceTracking)();
|
|
412
|
-
_this.proseMirrorRenderedSeverity = !!forceSeverityTracking || proseMirrorRenderedTracking !== null && proseMirrorRenderedTracking !== void 0 && proseMirrorRenderedTracking.trackSeverity ? (0,
|
|
416
|
+
_this.proseMirrorRenderedSeverity = !!forceSeverityTracking || proseMirrorRenderedTracking !== null && proseMirrorRenderedTracking !== void 0 && proseMirrorRenderedTracking.trackSeverity ? (0, _analytics2.getAnalyticsEventSeverity)(duration, (_proseMirrorRenderedT = proseMirrorRenderedTracking === null || proseMirrorRenderedTracking === void 0 ? void 0 : proseMirrorRenderedTracking.severityNormalThreshold) !== null && _proseMirrorRenderedT !== void 0 ? _proseMirrorRenderedT : _consts.PROSEMIRROR_RENDERED_NORMAL_SEVERITY_THRESHOLD, (_proseMirrorRenderedT2 = proseMirrorRenderedTracking === null || proseMirrorRenderedTracking === void 0 ? void 0 : proseMirrorRenderedTracking.severityDegradedThreshold) !== null && _proseMirrorRenderedT2 !== void 0 ? _proseMirrorRenderedT2 : _consts.PROSEMIRROR_RENDERED_DEGRADED_SEVERITY_THRESHOLD) : undefined;
|
|
413
417
|
if (_this.view) {
|
|
414
418
|
var _this$pluginInjection2, _this$experienceStore10;
|
|
415
419
|
var nodes = (0, _document.getNodesCount)(_this.view.state.doc);
|
|
@@ -504,14 +508,14 @@ var ReactEditorView = exports.ReactEditorView = /*#__PURE__*/function (_React$Co
|
|
|
504
508
|
});
|
|
505
509
|
|
|
506
510
|
// Allows us to dispatch analytics within the plugin view.destory methods
|
|
507
|
-
var analyticsConnected = _this.eventDispatcher.has(
|
|
511
|
+
var analyticsConnected = _this.eventDispatcher.has(_analytics2.analyticsEventKey, _this.handleAnalyticsEvent);
|
|
508
512
|
if (!analyticsConnected) {
|
|
509
|
-
_this.eventDispatcher.on(
|
|
513
|
+
_this.eventDispatcher.on(_analytics2.analyticsEventKey, _this.handleAnalyticsEvent);
|
|
510
514
|
}
|
|
511
515
|
_this.view.destroy(); // Destroys the dom node & all node views
|
|
512
516
|
|
|
513
517
|
if (!analyticsConnected) {
|
|
514
|
-
_this.eventDispatcher.off(
|
|
518
|
+
_this.eventDispatcher.off(_analytics2.analyticsEventKey, _this.handleAnalyticsEvent);
|
|
515
519
|
}
|
|
516
520
|
_this.view = undefined;
|
|
517
521
|
}
|
|
@@ -519,7 +523,7 @@ var ReactEditorView = exports.ReactEditorView = /*#__PURE__*/function (_React$Co
|
|
|
519
523
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "dispatchAnalyticsEvent", function (payload) {
|
|
520
524
|
if (_this.eventDispatcher) {
|
|
521
525
|
var dispatch = (0, _eventDispatcher.createDispatch)(_this.eventDispatcher);
|
|
522
|
-
dispatch(
|
|
526
|
+
dispatch(_analytics2.analyticsEventKey, {
|
|
523
527
|
payload: payload
|
|
524
528
|
});
|
|
525
529
|
}
|
|
@@ -575,7 +579,7 @@ var ReactEditorView = exports.ReactEditorView = /*#__PURE__*/function (_React$Co
|
|
|
575
579
|
|
|
576
580
|
// This needs to be before initialising editorState because
|
|
577
581
|
// we dispatch analytics events in plugin initialisation
|
|
578
|
-
_this.eventDispatcher.on(
|
|
582
|
+
_this.eventDispatcher.on(_analytics2.analyticsEventKey, _this.handleAnalyticsEvent);
|
|
579
583
|
_this.eventDispatcher.on('resetEditorState', _this.resetEditorState);
|
|
580
584
|
_this.editorState = _this.createEditorState({
|
|
581
585
|
props: props,
|
|
@@ -809,13 +813,13 @@ var ReactEditorView = exports.ReactEditorView = /*#__PURE__*/function (_React$Co
|
|
|
809
813
|
getAtlaskitAnalyticsEventHandlers: _propTypes.default.func
|
|
810
814
|
});
|
|
811
815
|
function getUAPrefix() {
|
|
812
|
-
if (
|
|
816
|
+
if (_browser.browser.chrome) {
|
|
813
817
|
return 'ua-chrome';
|
|
814
|
-
} else if (
|
|
818
|
+
} else if (_browser.browser.ie) {
|
|
815
819
|
return 'ua-ie';
|
|
816
|
-
} else if (
|
|
820
|
+
} else if (_browser.browser.gecko) {
|
|
817
821
|
return 'ua-firefox';
|
|
818
|
-
} else if (
|
|
822
|
+
} else if (_browser.browser.safari) {
|
|
819
823
|
return 'ua-safari';
|
|
820
824
|
}
|
|
821
825
|
return '';
|
|
@@ -4,8 +4,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.createSchema = createSchema;
|
|
7
|
-
var _schema = require("@atlaskit/adf-schema/schema");
|
|
8
7
|
var _model = require("@atlaskit/editor-prosemirror/model");
|
|
8
|
+
var _sanitizeNodes = require("../utils/sanitizeNodes");
|
|
9
9
|
var _createEditor = require("./create-editor");
|
|
10
10
|
var _sortByOrder = require("./sort-by-order");
|
|
11
11
|
function createSchema(editorConfig) {
|
|
@@ -13,7 +13,7 @@ function createSchema(editorConfig) {
|
|
|
13
13
|
acc[mark.name] = mark.mark;
|
|
14
14
|
return acc;
|
|
15
15
|
}, {}));
|
|
16
|
-
var nodes = (0,
|
|
16
|
+
var nodes = (0, _sanitizeNodes.sanitizeNodes)(editorConfig.nodes.sort((0, _sortByOrder.sortByOrder)('nodes')).reduce(function (acc, node) {
|
|
17
17
|
acc[node.name] = node.node;
|
|
18
18
|
return acc;
|
|
19
19
|
}, {}), marks);
|
|
@@ -9,9 +9,9 @@ exports.FullPageEditor = void 0;
|
|
|
9
9
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
10
10
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
11
|
var _react2 = require("@emotion/react");
|
|
12
|
+
var _browser = require("@atlaskit/editor-common/browser");
|
|
12
13
|
var _hooks = require("@atlaskit/editor-common/hooks");
|
|
13
14
|
var _ui = require("@atlaskit/editor-common/ui");
|
|
14
|
-
var _utils = require("@atlaskit/editor-common/utils");
|
|
15
15
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
16
16
|
var _FullPageContentArea = require("./FullPageContentArea");
|
|
17
17
|
var _FullPageToolbar = require("./FullPageToolbar");
|
|
@@ -45,7 +45,7 @@ var useShowKeyline = function useShowKeyline(contentAreaRef) {
|
|
|
45
45
|
// to differences in IntersectionObserver behaviour between browsers.
|
|
46
46
|
// By lowering the threshold a little it gives Safari more
|
|
47
47
|
// time to catch these events.
|
|
48
|
-
threshold:
|
|
48
|
+
threshold: _browser.browser.safari ? 0.98 : 1
|
|
49
49
|
});
|
|
50
50
|
intersection.observe(contentAreaRef.current.contentArea);
|
|
51
51
|
return function () {
|
|
@@ -9,13 +9,13 @@ exports.placeholderStyles = exports.linkStyles = exports.default = exports.creat
|
|
|
9
9
|
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
10
10
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
11
|
var _react2 = require("@emotion/react");
|
|
12
|
+
var _browser = require("@atlaskit/editor-common/browser");
|
|
12
13
|
var _collab = require("@atlaskit/editor-common/collab");
|
|
13
14
|
var _emoji = require("@atlaskit/editor-common/emoji");
|
|
14
15
|
var _hooks = require("@atlaskit/editor-common/hooks");
|
|
15
16
|
var _mention = require("@atlaskit/editor-common/mention");
|
|
16
17
|
var _selection = require("@atlaskit/editor-common/selection");
|
|
17
18
|
var _styles = require("@atlaskit/editor-common/styles");
|
|
18
|
-
var _utils = require("@atlaskit/editor-common/utils");
|
|
19
19
|
var _styles2 = require("@atlaskit/editor-plugins/block-type/styles");
|
|
20
20
|
var _styles3 = require("@atlaskit/editor-plugins/find-replace/styles");
|
|
21
21
|
var _styles4 = require("@atlaskit/editor-plugins/paste-options-toolbar/styles");
|
|
@@ -54,7 +54,7 @@ var ruleStyles = function ruleStyles() {
|
|
|
54
54
|
return (0, _react2.css)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n\t.ProseMirror {\n\t\t", ";\n\n\t\thr {\n\t\t\tcursor: pointer;\n\t\t\tpadding: ", " 0;\n\t\t\tmargin: ", " 0;\n\t\t\tbackground-clip: content-box;\n\n\t\t\t&.", " {\n\t\t\t\toutline: none;\n\t\t\t\tbackground-color: ", ";\n\t\t\t}\n\t\t}\n\t}\n"])), (0, _styles.ruleSharedStyles)(), "var(--ds-space-050, 4px)", "var(--ds-space-300, 24px)", _editorSharedStyles.akEditorSelectedNodeClassName, "var(--ds-border-selected, ".concat(_editorSharedStyles.akEditorSelectedBorderColor, ")"));
|
|
55
55
|
};
|
|
56
56
|
var mentionsStyles = (0, _react2.css)(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n\t.", " {\n\t\t&.", " [data-mention-id] > span {\n\t\t\t", "\n\n\t\t\t/* need to specify dark text colour because personal mentions\n (in dark blue) have white text by default */\n color: ", ";\n\t\t}\n\t}\n\n\t.danger {\n\t\t.", ".", "\n\t\t\t> span\n\t\t\t> span\n\t\t\t> span {\n\t\t\tbox-shadow: 0 0 0 ", "px ", ";\n\t\t\tbackground-color: ", ";\n\t\t}\n\t\t.", " > span > span > span {\n\t\t\tbackground-color: ", ";\n\t\t\tcolor: ", ";\n\t\t}\n\t}\n"])), _mention.MentionSharedCssClassName.MENTION_CONTAINER, _editorSharedStyles.akEditorSelectedNodeClassName, (0, _editorSharedStyles.getSelectionStyles)([_editorSharedStyles.SelectionStyle.BoxShadow, _editorSharedStyles.SelectionStyle.Background]), "var(--ds-text-subtle, ".concat(_colors.N500, ")"), _mention.MentionSharedCssClassName.MENTION_CONTAINER, _editorSharedStyles.akEditorSelectedNodeClassName, _editorSharedStyles.akEditorSelectedBorderSize, _editorSharedStyles.akEditorDeleteBorder, "var(--ds-background-danger, ".concat(_editorSharedStyles.akEditorDeleteBackgroundWithOpacity, ")"), _mention.MentionSharedCssClassName.MENTION_CONTAINER, "var(--ds-background-neutral, ".concat(_colors.N30A, ")"), "var(--ds-text-subtle, ".concat(_colors.N500, ")"));
|
|
57
|
-
var listsStyles = (0, _react2.css)(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2.default)(["\n\t.ProseMirror {\n\t\tli {\n\t\t\tposition: relative;\n\n\t\t\t> p:not(:first-child) {\n\t\t\t\tmargin: ", " 0 0 0;\n\t\t\t}\n\n\t\t\t// In SSR the above rule will apply to all p tags because first-child would be a style tag.\n\t\t\t// The following rule resets the first p tag back to its original margin\n\t\t\t// defined in packages/editor/editor-common/src/styles/shared/paragraph.ts\n\t\t\t> style:first-child + p {\n\t\t\t\tmargin-top: ", ";\n\t\t\t}\n\t\t}\n\n\t\t&:not([data-node-type='decisionList']) > li,\n // This prevents https://product-fabric.atlassian.net/browse/ED-20924\n &:not(.", ") > li {\n\t\t\t", "\n\t\t}\n\t}\n"])), "var(--ds-space-050, 4px)", _editorSharedStyles.blockNodesVerticalMargin, _styles.SmartCardSharedCssClassName.BLOCK_CARD_CONTAINER,
|
|
57
|
+
var listsStyles = (0, _react2.css)(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2.default)(["\n\t.ProseMirror {\n\t\tli {\n\t\t\tposition: relative;\n\n\t\t\t> p:not(:first-child) {\n\t\t\t\tmargin: ", " 0 0 0;\n\t\t\t}\n\n\t\t\t// In SSR the above rule will apply to all p tags because first-child would be a style tag.\n\t\t\t// The following rule resets the first p tag back to its original margin\n\t\t\t// defined in packages/editor/editor-common/src/styles/shared/paragraph.ts\n\t\t\t> style:first-child + p {\n\t\t\t\tmargin-top: ", ";\n\t\t\t}\n\t\t}\n\n\t\t&:not([data-node-type='decisionList']) > li,\n // This prevents https://product-fabric.atlassian.net/browse/ED-20924\n &:not(.", ") > li {\n\t\t\t", "\n\t\t}\n\t}\n"])), "var(--ds-space-050, 4px)", _editorSharedStyles.blockNodesVerticalMargin, _styles.SmartCardSharedCssClassName.BLOCK_CARD_CONTAINER, _browser.browser.safari ? _styles.codeBlockInListSafariFix : '');
|
|
58
58
|
var emojiStyles = (0, _react2.css)(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2.default)(["\n\t.", " {\n\t\tdisplay: inline-block;\n\n\t\t.", " {\n\t\t\tcursor: pointer;\n\n\t\t\t&.", " > span {\n\t\t\t\t/** needed for selection style to cover custom emoji image properly */\n\t\t\t\tdisplay: flex;\n\t\t\t}\n\t\t}\n\n\t\t&.", " {\n\t\t\t.", ", .", " {\n\t\t\t\tborder-radius: 2px;\n\t\t\t\t", "\n\t\t\t}\n\t\t}\n\t}\n"])), _emoji.EmojiSharedCssClassName.EMOJI_CONTAINER, _emoji.EmojiSharedCssClassName.EMOJI_NODE, _emoji.EmojiSharedCssClassName.EMOJI_IMAGE, _editorSharedStyles.akEditorSelectedNodeClassName, _emoji.EmojiSharedCssClassName.EMOJI_SPRITE, _emoji.EmojiSharedCssClassName.EMOJI_IMAGE, (0, _editorSharedStyles.getSelectionStyles)([_editorSharedStyles.SelectionStyle.Blanket, _editorSharedStyles.SelectionStyle.BoxShadow]));
|
|
59
59
|
|
|
60
60
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles -- Ignored via go/DSP-18766
|
|
@@ -24,7 +24,7 @@ var _analytics = require("@atlaskit/editor-common/analytics");
|
|
|
24
24
|
var _ui = require("@atlaskit/editor-common/ui");
|
|
25
25
|
var _uiMenu = require("@atlaskit/editor-common/ui-menu");
|
|
26
26
|
var _uiReact = require("@atlaskit/editor-common/ui-react");
|
|
27
|
-
var
|
|
27
|
+
var _analytics2 = require("@atlaskit/editor-common/utils/analytics");
|
|
28
28
|
var _spinner = _interopRequireDefault(require("@atlaskit/spinner"));
|
|
29
29
|
var _eventDispatcher = require("../../event-dispatcher");
|
|
30
30
|
var _context2 = require("../../presets/context");
|
|
@@ -134,7 +134,7 @@ var ToolbarFeedbackInternal = /*#__PURE__*/function (_PureComponent) {
|
|
|
134
134
|
})));
|
|
135
135
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "openFeedbackPopup", function () {
|
|
136
136
|
var dispatch = (0, _eventDispatcher.createDispatch)(_this.context.editorActions.eventDispatcher);
|
|
137
|
-
dispatch(
|
|
137
|
+
dispatch(_analytics2.analyticsEventKey, {
|
|
138
138
|
payload: {
|
|
139
139
|
action: _analytics.ACTION.CLICKED,
|
|
140
140
|
actionSubject: _analytics.ACTION_SUBJECT.BUTTON,
|
|
@@ -15,7 +15,7 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
|
|
|
15
15
|
var _react = _interopRequireDefault(require("react"));
|
|
16
16
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
17
17
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
18
|
-
var
|
|
18
|
+
var _analytics2 = require("@atlaskit/editor-common/utils/analytics");
|
|
19
19
|
var _helpDialog = require("@atlaskit/editor-plugins/help-dialog");
|
|
20
20
|
var _eventDispatcher = require("../../event-dispatcher");
|
|
21
21
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
|
|
@@ -36,7 +36,7 @@ var WithHelpTrigger = exports.default = /*#__PURE__*/function (_React$Component)
|
|
|
36
36
|
|
|
37
37
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
38
38
|
var dispatch = (0, _eventDispatcher.createDispatch)(editorActions.eventDispatcher);
|
|
39
|
-
dispatch(
|
|
39
|
+
dispatch(_analytics2.analyticsEventKey, {
|
|
40
40
|
payload: {
|
|
41
41
|
action: _analytics.ACTION.CLICKED,
|
|
42
42
|
actionSubject: _analytics.ACTION_SUBJECT.BUTTON,
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.findChangedNodesFromTransaction = void 0;
|
|
7
|
+
/**
|
|
8
|
+
* Finds all top level nodes affected by the transaction
|
|
9
|
+
* Uses from/to positions in transaction's steps to work out which nodes will
|
|
10
|
+
* be changed by the transaction
|
|
11
|
+
*/
|
|
12
|
+
var findChangedNodesFromTransaction = exports.findChangedNodesFromTransaction = function findChangedNodesFromTransaction(tr) {
|
|
13
|
+
var nodes = [];
|
|
14
|
+
var steps = tr.steps || [];
|
|
15
|
+
steps.forEach(function (step) {
|
|
16
|
+
step.getMap().forEach(function (oldStart, oldEnd, newStart, newEnd) {
|
|
17
|
+
tr.doc.nodesBetween(newStart, Math.min(newEnd, tr.doc.content.size), function (node) {
|
|
18
|
+
if (!nodes.find(function (n) {
|
|
19
|
+
return n === node;
|
|
20
|
+
})) {
|
|
21
|
+
nodes.push(node);
|
|
22
|
+
}
|
|
23
|
+
return false;
|
|
24
|
+
});
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
return nodes;
|
|
28
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.isOutdatedBrowser = void 0;
|
|
7
|
+
var isOutdatedBrowser = exports.isOutdatedBrowser = function isOutdatedBrowser(userAgent) {
|
|
8
|
+
// Take browsers in both Desktop and Mobile (includes Chrome, Firefox, Edge and Safari) within last 2 years
|
|
9
|
+
var chrome = /Chrome\//.test(userAgent) && !/OPR\//.test(userAgent);
|
|
10
|
+
var chromeVersion = chrome ? parseInt((userAgent.match(/Chrome\/(\d+)/) || [])[1], 10) : 0;
|
|
11
|
+
if (chromeVersion >= 84) {
|
|
12
|
+
return false;
|
|
13
|
+
}
|
|
14
|
+
var gecko = /gecko\/\d/i.test(userAgent);
|
|
15
|
+
var geckoVersion = gecko ? parseInt((userAgent.match(/Firefox\/(\d+)/) || [])[1], 10) : 0;
|
|
16
|
+
if (geckoVersion >= 84) {
|
|
17
|
+
return false;
|
|
18
|
+
}
|
|
19
|
+
var edge = /Edge\/(\d+)/.exec(userAgent);
|
|
20
|
+
var edgeVersion = edge ? +edge[1] : 0;
|
|
21
|
+
if (edgeVersion >= 84) {
|
|
22
|
+
return false;
|
|
23
|
+
}
|
|
24
|
+
var safari = !chrome && !gecko && /Version\/([0-9\._]+).*Safari/.test(userAgent);
|
|
25
|
+
var safariVersion = safari ? parseInt((userAgent.match(/Version\/([0-9\._]+).*Safari/) || [])[1], 10) : 0;
|
|
26
|
+
if (safariVersion >= 12) {
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
29
|
+
return true;
|
|
30
|
+
};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.sanitizeNodes = sanitizeNodes;
|
|
8
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
10
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
11
|
+
function sanitizeNodes(nodes, supportedMarks) {
|
|
12
|
+
var nodeNames = Object.keys(nodes);
|
|
13
|
+
nodeNames.forEach(function (nodeKey) {
|
|
14
|
+
var nodeSpec = _objectSpread({}, nodes[nodeKey]);
|
|
15
|
+
if (nodeSpec.marks && nodeSpec.marks !== '_') {
|
|
16
|
+
nodeSpec.marks = nodeSpec.marks.split(' ').filter(function (mark) {
|
|
17
|
+
return !!supportedMarks[mark];
|
|
18
|
+
}).join(' ');
|
|
19
|
+
}
|
|
20
|
+
if (nodeSpec.content) {
|
|
21
|
+
nodeSpec.content = sanitizeNodeSpecContent(nodes, nodeSpec.content);
|
|
22
|
+
}
|
|
23
|
+
nodes[nodeKey] = nodeSpec;
|
|
24
|
+
});
|
|
25
|
+
return nodes;
|
|
26
|
+
}
|
|
27
|
+
function sanitizeNodeSpecContent(nodes, rawContent) {
|
|
28
|
+
var content = rawContent.replace(/\W/g, ' ');
|
|
29
|
+
var contentKeys = content.split(' ');
|
|
30
|
+
var unsupportedContentKeys = contentKeys.filter(function (contentKey) {
|
|
31
|
+
return !isContentSupported(nodes, contentKey);
|
|
32
|
+
});
|
|
33
|
+
return unsupportedContentKeys.reduce(function (newContent, nodeName) {
|
|
34
|
+
return sanitizedContent(newContent, nodeName);
|
|
35
|
+
}, rawContent);
|
|
36
|
+
}
|
|
37
|
+
function sanitizedContent(content, invalidContent) {
|
|
38
|
+
if (!invalidContent.length) {
|
|
39
|
+
return content || '';
|
|
40
|
+
}
|
|
41
|
+
if (!content || !content.match(/\w/)) {
|
|
42
|
+
return '';
|
|
43
|
+
}
|
|
44
|
+
var pattern = "(".concat(invalidContent, "((\\s)*\\|)+)|((\\|(\\s)*)+").concat(invalidContent, ")|(").concat(invalidContent, "$)|(").concat(invalidContent, "(\\+|\\*))");
|
|
45
|
+
return content.replace(new RegExp(pattern, 'g'), '').replace(' ', ' ').trim();
|
|
46
|
+
}
|
|
47
|
+
function isContentSupported(nodes, contentKey) {
|
|
48
|
+
var nodeKeys = Object.keys(nodes);
|
|
49
|
+
|
|
50
|
+
// content is with valid node
|
|
51
|
+
if (nodeKeys.indexOf(contentKey) > -1) {
|
|
52
|
+
return true;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// content is with valid group
|
|
56
|
+
for (var supportedKey in nodes) {
|
|
57
|
+
var nodeSpec = nodes[supportedKey];
|
|
58
|
+
if (nodeSpec && nodeSpec.group === contentKey) {
|
|
59
|
+
return true;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
return false;
|
|
63
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.validateNodes = exports.validNode = void 0;
|
|
7
|
+
var validNode = exports.validNode = function validNode(node) {
|
|
8
|
+
try {
|
|
9
|
+
node.check(); // this will throw an error if the node is invalid
|
|
10
|
+
} catch (error) {
|
|
11
|
+
return false;
|
|
12
|
+
}
|
|
13
|
+
return true;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
/** Validates prosemirror nodes, and returns true only if all nodes are valid */
|
|
17
|
+
var validateNodes = exports.validateNodes = function validateNodes(nodes) {
|
|
18
|
+
return nodes.every(validNode);
|
|
19
|
+
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
-
import {
|
|
2
|
+
import { findNodePosByLocalIds, isEmptyDocument, processRawValue, toJSON } from '@atlaskit/editor-common/utils';
|
|
3
|
+
import { analyticsEventKey } from '@atlaskit/editor-common/utils/analytics';
|
|
3
4
|
import { Node } from '@atlaskit/editor-prosemirror/model';
|
|
4
5
|
import { NodeSelection, TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
5
6
|
import { findParentNode, safeInsert } from '@atlaskit/editor-prosemirror/utils';
|
|
@@ -15,7 +15,7 @@ import { ACTION, fireAnalyticsEvent } from '@atlaskit/editor-common/analytics';
|
|
|
15
15
|
import { useConstructor } from '@atlaskit/editor-common/hooks';
|
|
16
16
|
import { startMeasure, stopMeasure } from '@atlaskit/editor-common/performance-measures';
|
|
17
17
|
import { EditorExperience, ExperienceStore } from '@atlaskit/editor-common/ufo';
|
|
18
|
-
import { getAnalyticsAppearance } from '@atlaskit/editor-common/utils';
|
|
18
|
+
import { getAnalyticsAppearance } from '@atlaskit/editor-common/utils/analytics';
|
|
19
19
|
import EditorActions from '../actions';
|
|
20
20
|
import { createFeatureFlagsFromProps } from '../create-editor/feature-flags-from-props';
|
|
21
21
|
import { useEditorContext } from '../ui/EditorContext';
|
|
@@ -6,7 +6,7 @@ import { getDocStructure } from '@atlaskit/editor-common/core-utils';
|
|
|
6
6
|
import { IntlErrorBoundary } from '@atlaskit/editor-common/intl-error-boundary';
|
|
7
7
|
import { logException } from '@atlaskit/editor-common/monitoring';
|
|
8
8
|
import { ExperienceStore } from '@atlaskit/editor-common/ufo';
|
|
9
|
-
import { isOutdatedBrowser } from '
|
|
9
|
+
import { isOutdatedBrowser } from '../utils/outdatedBrowsers';
|
|
10
10
|
import { WithEditorView } from './WithEditorView';
|
|
11
11
|
export class ErrorBoundaryWithEditorView extends React.Component {
|
|
12
12
|
constructor(props) {
|
|
@@ -3,23 +3,27 @@ import React from 'react';
|
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
4
|
import { injectIntl } from 'react-intl-next';
|
|
5
5
|
import { ACTION, ACTION_SUBJECT, EVENT_TYPE, fireAnalyticsEvent, FULL_WIDTH_MODE, getAnalyticsEventsFromTransaction, PLATFORMS } from '@atlaskit/editor-common/analytics';
|
|
6
|
+
import { browser } from '@atlaskit/editor-common/browser';
|
|
6
7
|
import { getDocStructure } from '@atlaskit/editor-common/core-utils';
|
|
7
8
|
import { getEnabledFeatureFlagKeys } from '@atlaskit/editor-common/normalize-feature-flags';
|
|
8
9
|
import { startMeasure, stopMeasure } from '@atlaskit/editor-common/performance-measures';
|
|
9
10
|
import { EditorPluginInjectionAPI } from '@atlaskit/editor-common/preset';
|
|
10
11
|
import { EditorExperience, ExperienceStore, RELIABILITY_INTERVAL } from '@atlaskit/editor-common/ufo';
|
|
11
|
-
import {
|
|
12
|
+
import { countNodes, getResponseEndTime, measureRender, processRawValue, shouldForceTracking } from '@atlaskit/editor-common/utils';
|
|
13
|
+
import { analyticsEventKey, getAnalyticsEventSeverity } from '@atlaskit/editor-common/utils/analytics';
|
|
12
14
|
import { EditorState, Selection, TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
13
15
|
import { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
14
16
|
import { createDispatch, EventDispatcher } from '../event-dispatcher';
|
|
15
17
|
import { EditorAPIContext } from '../presets/context';
|
|
16
18
|
import { getNodesCount } from '../utils/document';
|
|
19
|
+
import { findChangedNodesFromTransaction } from '../utils/findChangedNodesFromTransaction';
|
|
17
20
|
import { isFullPage } from '../utils/is-full-page';
|
|
18
21
|
import { RenderTracking } from '../utils/performance/components/RenderTracking';
|
|
19
22
|
import measurements from '../utils/performance/measure-enum';
|
|
20
23
|
import { PluginPerformanceObserver } from '../utils/performance/plugin-performance-observer';
|
|
21
24
|
import { freezeUnsafeTransactionProperties } from '../utils/performance/safer-transactions';
|
|
22
25
|
import { EVENT_NAME_DISPATCH_TRANSACTION, EVENT_NAME_ON_CHANGE, EVENT_NAME_STATE_APPLY, EVENT_NAME_UPDATE_STATE, EVENT_NAME_VIEW_STATE_UPDATED, TransactionTracker } from '../utils/performance/track-transactions';
|
|
26
|
+
import { validateNodes, validNode } from '../utils/validateNodes';
|
|
23
27
|
import { DEFAULT_SAMPLING_RATE_VALID_TRANSACTIONS, PROSEMIRROR_RENDERED_DEGRADED_SEVERITY_THRESHOLD, PROSEMIRROR_RENDERED_NORMAL_SEVERITY_THRESHOLD } from './consts';
|
|
24
28
|
import { createErrorReporter, createPMPlugins, processPluginsList } from './create-editor';
|
|
25
29
|
import createPluginsList from './create-plugins-list';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { sanitizeNodes } from '@atlaskit/adf-schema/schema';
|
|
2
1
|
import { Schema } from '@atlaskit/editor-prosemirror/model';
|
|
2
|
+
import { sanitizeNodes } from '../utils/sanitizeNodes';
|
|
3
3
|
import { fixExcludes } from './create-editor';
|
|
4
4
|
import { sortByOrder } from './sort-by-order';
|
|
5
5
|
export function createSchema(editorConfig) {
|
|
@@ -6,9 +6,9 @@ import React, { useEffect, useMemo, useRef, useState } from 'react';
|
|
|
6
6
|
|
|
7
7
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
8
8
|
import { jsx } from '@emotion/react';
|
|
9
|
+
import { browser } from '@atlaskit/editor-common/browser';
|
|
9
10
|
import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
10
11
|
import { ContextPanelWidthProvider } from '@atlaskit/editor-common/ui';
|
|
11
|
-
import { browser } from '@atlaskit/editor-common/utils';
|
|
12
12
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
13
13
|
import { FullPageContentArea } from './FullPageContentArea';
|
|
14
14
|
import { FullPageToolbar } from './FullPageToolbar';
|
|
@@ -11,13 +11,13 @@ import React, { useMemo } from 'react';
|
|
|
11
11
|
|
|
12
12
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
13
13
|
import { css, jsx, useTheme } from '@emotion/react';
|
|
14
|
+
import { browser } from '@atlaskit/editor-common/browser';
|
|
14
15
|
import { telepointerStyle } from '@atlaskit/editor-common/collab';
|
|
15
16
|
import { EmojiSharedCssClassName } from '@atlaskit/editor-common/emoji';
|
|
16
17
|
import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
17
18
|
import { MentionSharedCssClassName } from '@atlaskit/editor-common/mention';
|
|
18
19
|
import { gapCursorStyles } from '@atlaskit/editor-common/selection';
|
|
19
20
|
import { annotationSharedStyles, backgroundColorStyles, blockMarksSharedStyles, codeBlockInListSafariFix, codeMarkSharedStyles, dateSharedStyle, embedCardStyles, gridStyles, indentationSharedStyles, linkSharedStyle, listsSharedStyles, MediaSharedClassNames, paragraphSharedStyles, resizerStyles, ruleSharedStyles, shadowSharedStyle, SmartCardSharedCssClassName, smartCardSharedStyles, smartCardStyles, tasksAndDecisionsStyles, textColorStyles, unsupportedStyles, whitespaceSharedStyles } from '@atlaskit/editor-common/styles';
|
|
20
|
-
import { browser } from '@atlaskit/editor-common/utils';
|
|
21
21
|
import { blocktypeStyles } from '@atlaskit/editor-plugins/block-type/styles';
|
|
22
22
|
import { findReplaceStyles } from '@atlaskit/editor-plugins/find-replace/styles';
|
|
23
23
|
import { textHighlightStyle } from '@atlaskit/editor-plugins/paste-options-toolbar/styles';
|
|
@@ -15,7 +15,7 @@ import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '@atlaskit
|
|
|
15
15
|
import { Popup } from '@atlaskit/editor-common/ui';
|
|
16
16
|
import { ToolbarButton } from '@atlaskit/editor-common/ui-menu';
|
|
17
17
|
import { withReactEditorViewOuterListeners as withOuterListeners } from '@atlaskit/editor-common/ui-react';
|
|
18
|
-
import { analyticsEventKey } from '@atlaskit/editor-common/utils';
|
|
18
|
+
import { analyticsEventKey } from '@atlaskit/editor-common/utils/analytics';
|
|
19
19
|
import Spinner from '@atlaskit/spinner';
|
|
20
20
|
import { createDispatch } from '../../event-dispatcher';
|
|
21
21
|
import { usePresetContext } from '../../presets/context';
|
|
@@ -2,7 +2,7 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
4
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
5
|
-
import { analyticsEventKey } from '@atlaskit/editor-common/utils';
|
|
5
|
+
import { analyticsEventKey } from '@atlaskit/editor-common/utils/analytics';
|
|
6
6
|
import { deprecatedOpenHelpCommand } from '@atlaskit/editor-plugins/help-dialog';
|
|
7
7
|
import { createDispatch } from '../../event-dispatcher';
|
|
8
8
|
export default class WithHelpTrigger extends React.Component {
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Finds all top level nodes affected by the transaction
|
|
3
|
+
* Uses from/to positions in transaction's steps to work out which nodes will
|
|
4
|
+
* be changed by the transaction
|
|
5
|
+
*/
|
|
6
|
+
export const findChangedNodesFromTransaction = tr => {
|
|
7
|
+
const nodes = [];
|
|
8
|
+
const steps = tr.steps || [];
|
|
9
|
+
steps.forEach(step => {
|
|
10
|
+
step.getMap().forEach((oldStart, oldEnd, newStart, newEnd) => {
|
|
11
|
+
tr.doc.nodesBetween(newStart, Math.min(newEnd, tr.doc.content.size), node => {
|
|
12
|
+
if (!nodes.find(n => n === node)) {
|
|
13
|
+
nodes.push(node);
|
|
14
|
+
}
|
|
15
|
+
return false;
|
|
16
|
+
});
|
|
17
|
+
});
|
|
18
|
+
});
|
|
19
|
+
return nodes;
|
|
20
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export const isOutdatedBrowser = userAgent => {
|
|
2
|
+
// Take browsers in both Desktop and Mobile (includes Chrome, Firefox, Edge and Safari) within last 2 years
|
|
3
|
+
const chrome = /Chrome\//.test(userAgent) && !/OPR\//.test(userAgent);
|
|
4
|
+
const chromeVersion = chrome ? parseInt((userAgent.match(/Chrome\/(\d+)/) || [])[1], 10) : 0;
|
|
5
|
+
if (chromeVersion >= 84) {
|
|
6
|
+
return false;
|
|
7
|
+
}
|
|
8
|
+
const gecko = /gecko\/\d/i.test(userAgent);
|
|
9
|
+
const geckoVersion = gecko ? parseInt((userAgent.match(/Firefox\/(\d+)/) || [])[1], 10) : 0;
|
|
10
|
+
if (geckoVersion >= 84) {
|
|
11
|
+
return false;
|
|
12
|
+
}
|
|
13
|
+
const edge = /Edge\/(\d+)/.exec(userAgent);
|
|
14
|
+
const edgeVersion = edge ? +edge[1] : 0;
|
|
15
|
+
if (edgeVersion >= 84) {
|
|
16
|
+
return false;
|
|
17
|
+
}
|
|
18
|
+
const safari = !chrome && !gecko && /Version\/([0-9\._]+).*Safari/.test(userAgent);
|
|
19
|
+
const safariVersion = safari ? parseInt((userAgent.match(/Version\/([0-9\._]+).*Safari/) || [])[1], 10) : 0;
|
|
20
|
+
if (safariVersion >= 12) {
|
|
21
|
+
return false;
|
|
22
|
+
}
|
|
23
|
+
return true;
|
|
24
|
+
};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
export function sanitizeNodes(nodes, supportedMarks) {
|
|
2
|
+
const nodeNames = Object.keys(nodes);
|
|
3
|
+
nodeNames.forEach(nodeKey => {
|
|
4
|
+
const nodeSpec = {
|
|
5
|
+
...nodes[nodeKey]
|
|
6
|
+
};
|
|
7
|
+
if (nodeSpec.marks && nodeSpec.marks !== '_') {
|
|
8
|
+
nodeSpec.marks = nodeSpec.marks.split(' ').filter(mark => !!supportedMarks[mark]).join(' ');
|
|
9
|
+
}
|
|
10
|
+
if (nodeSpec.content) {
|
|
11
|
+
nodeSpec.content = sanitizeNodeSpecContent(nodes, nodeSpec.content);
|
|
12
|
+
}
|
|
13
|
+
nodes[nodeKey] = nodeSpec;
|
|
14
|
+
});
|
|
15
|
+
return nodes;
|
|
16
|
+
}
|
|
17
|
+
function sanitizeNodeSpecContent(nodes, rawContent) {
|
|
18
|
+
const content = rawContent.replace(/\W/g, ' ');
|
|
19
|
+
const contentKeys = content.split(' ');
|
|
20
|
+
const unsupportedContentKeys = contentKeys.filter(contentKey => !isContentSupported(nodes, contentKey));
|
|
21
|
+
return unsupportedContentKeys.reduce((newContent, nodeName) => sanitizedContent(newContent, nodeName), rawContent);
|
|
22
|
+
}
|
|
23
|
+
function sanitizedContent(content, invalidContent) {
|
|
24
|
+
if (!invalidContent.length) {
|
|
25
|
+
return content || '';
|
|
26
|
+
}
|
|
27
|
+
if (!content || !content.match(/\w/)) {
|
|
28
|
+
return '';
|
|
29
|
+
}
|
|
30
|
+
const pattern = `(${invalidContent}((\\s)*\\|)+)|((\\|(\\s)*)+${invalidContent})|(${invalidContent}$)|(${invalidContent}(\\+|\\*))`;
|
|
31
|
+
return content.replace(new RegExp(pattern, 'g'), '').replace(' ', ' ').trim();
|
|
32
|
+
}
|
|
33
|
+
function isContentSupported(nodes, contentKey) {
|
|
34
|
+
const nodeKeys = Object.keys(nodes);
|
|
35
|
+
|
|
36
|
+
// content is with valid node
|
|
37
|
+
if (nodeKeys.indexOf(contentKey) > -1) {
|
|
38
|
+
return true;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// content is with valid group
|
|
42
|
+
for (const supportedKey in nodes) {
|
|
43
|
+
const nodeSpec = nodes[supportedKey];
|
|
44
|
+
if (nodeSpec && nodeSpec.group === contentKey) {
|
|
45
|
+
return true;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
return false;
|
|
49
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export const validNode = node => {
|
|
2
|
+
try {
|
|
3
|
+
node.check(); // this will throw an error if the node is invalid
|
|
4
|
+
} catch (error) {
|
|
5
|
+
return false;
|
|
6
|
+
}
|
|
7
|
+
return true;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
/** Validates prosemirror nodes, and returns true only if all nodes are valid */
|
|
11
|
+
export const validateNodes = nodes => nodes.every(validNode);
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export const name = "@atlaskit/editor-core";
|
|
2
|
-
export const version = "197.2.
|
|
2
|
+
export const version = "197.2.4";
|
|
@@ -3,7 +3,8 @@ import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
|
3
3
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
4
4
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
5
5
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
6
|
-
import {
|
|
6
|
+
import { findNodePosByLocalIds, isEmptyDocument, processRawValue, toJSON } from '@atlaskit/editor-common/utils';
|
|
7
|
+
import { analyticsEventKey } from '@atlaskit/editor-common/utils/analytics';
|
|
7
8
|
import { Node } from '@atlaskit/editor-prosemirror/model';
|
|
8
9
|
import { NodeSelection, TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
9
10
|
import { findParentNode, safeInsert } from '@atlaskit/editor-prosemirror/utils';
|
|
@@ -15,7 +15,7 @@ import { ACTION, fireAnalyticsEvent } from '@atlaskit/editor-common/analytics';
|
|
|
15
15
|
import { useConstructor } from '@atlaskit/editor-common/hooks';
|
|
16
16
|
import { startMeasure, stopMeasure } from '@atlaskit/editor-common/performance-measures';
|
|
17
17
|
import { EditorExperience, ExperienceStore } from '@atlaskit/editor-common/ufo';
|
|
18
|
-
import { getAnalyticsAppearance } from '@atlaskit/editor-common/utils';
|
|
18
|
+
import { getAnalyticsAppearance } from '@atlaskit/editor-common/utils/analytics';
|
|
19
19
|
import EditorActions from '../actions';
|
|
20
20
|
import { createFeatureFlagsFromProps } from '../create-editor/feature-flags-from-props';
|
|
21
21
|
import { useEditorContext } from '../ui/EditorContext';
|
|
@@ -18,7 +18,7 @@ import { getDocStructure } from '@atlaskit/editor-common/core-utils';
|
|
|
18
18
|
import { IntlErrorBoundary } from '@atlaskit/editor-common/intl-error-boundary';
|
|
19
19
|
import { logException } from '@atlaskit/editor-common/monitoring';
|
|
20
20
|
import { ExperienceStore } from '@atlaskit/editor-common/ufo';
|
|
21
|
-
import { isOutdatedBrowser } from '
|
|
21
|
+
import { isOutdatedBrowser } from '../utils/outdatedBrowsers';
|
|
22
22
|
import { WithEditorView } from './WithEditorView';
|
|
23
23
|
export var ErrorBoundaryWithEditorView = /*#__PURE__*/function (_React$Component) {
|
|
24
24
|
_inherits(ErrorBoundaryWithEditorView, _React$Component);
|
|
@@ -14,23 +14,27 @@ import React from 'react';
|
|
|
14
14
|
import PropTypes from 'prop-types';
|
|
15
15
|
import { injectIntl } from 'react-intl-next';
|
|
16
16
|
import { ACTION, ACTION_SUBJECT, EVENT_TYPE, fireAnalyticsEvent, FULL_WIDTH_MODE, getAnalyticsEventsFromTransaction, PLATFORMS } from '@atlaskit/editor-common/analytics';
|
|
17
|
+
import { browser } from '@atlaskit/editor-common/browser';
|
|
17
18
|
import { getDocStructure } from '@atlaskit/editor-common/core-utils';
|
|
18
19
|
import { getEnabledFeatureFlagKeys } from '@atlaskit/editor-common/normalize-feature-flags';
|
|
19
20
|
import { startMeasure, stopMeasure } from '@atlaskit/editor-common/performance-measures';
|
|
20
21
|
import { EditorPluginInjectionAPI } from '@atlaskit/editor-common/preset';
|
|
21
22
|
import { EditorExperience, ExperienceStore, RELIABILITY_INTERVAL } from '@atlaskit/editor-common/ufo';
|
|
22
|
-
import {
|
|
23
|
+
import { countNodes as _countNodes, getResponseEndTime, measureRender, processRawValue, shouldForceTracking } from '@atlaskit/editor-common/utils';
|
|
24
|
+
import { analyticsEventKey, getAnalyticsEventSeverity } from '@atlaskit/editor-common/utils/analytics';
|
|
23
25
|
import { EditorState, Selection, TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
24
26
|
import { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
25
27
|
import { createDispatch, EventDispatcher } from '../event-dispatcher';
|
|
26
28
|
import { EditorAPIContext } from '../presets/context';
|
|
27
29
|
import { getNodesCount } from '../utils/document';
|
|
30
|
+
import { findChangedNodesFromTransaction } from '../utils/findChangedNodesFromTransaction';
|
|
28
31
|
import { isFullPage } from '../utils/is-full-page';
|
|
29
32
|
import { RenderTracking } from '../utils/performance/components/RenderTracking';
|
|
30
33
|
import measurements from '../utils/performance/measure-enum';
|
|
31
34
|
import { PluginPerformanceObserver } from '../utils/performance/plugin-performance-observer';
|
|
32
35
|
import { freezeUnsafeTransactionProperties } from '../utils/performance/safer-transactions';
|
|
33
36
|
import { EVENT_NAME_DISPATCH_TRANSACTION, EVENT_NAME_ON_CHANGE, EVENT_NAME_STATE_APPLY, EVENT_NAME_UPDATE_STATE, EVENT_NAME_VIEW_STATE_UPDATED, TransactionTracker } from '../utils/performance/track-transactions';
|
|
37
|
+
import { validateNodes, validNode } from '../utils/validateNodes';
|
|
34
38
|
import { DEFAULT_SAMPLING_RATE_VALID_TRANSACTIONS, PROSEMIRROR_RENDERED_DEGRADED_SEVERITY_THRESHOLD, PROSEMIRROR_RENDERED_NORMAL_SEVERITY_THRESHOLD } from './consts';
|
|
35
39
|
import { createErrorReporter, createPMPlugins, processPluginsList } from './create-editor';
|
|
36
40
|
import createPluginsList from './create-plugins-list';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { sanitizeNodes } from '@atlaskit/adf-schema/schema';
|
|
2
1
|
import { Schema } from '@atlaskit/editor-prosemirror/model';
|
|
2
|
+
import { sanitizeNodes } from '../utils/sanitizeNodes';
|
|
3
3
|
import { fixExcludes } from './create-editor';
|
|
4
4
|
import { sortByOrder } from './sort-by-order';
|
|
5
5
|
export function createSchema(editorConfig) {
|
|
@@ -7,9 +7,9 @@ import React, { useEffect, useMemo, useRef, useState } from 'react';
|
|
|
7
7
|
|
|
8
8
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
9
9
|
import { jsx } from '@emotion/react';
|
|
10
|
+
import { browser } from '@atlaskit/editor-common/browser';
|
|
10
11
|
import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
11
12
|
import { ContextPanelWidthProvider } from '@atlaskit/editor-common/ui';
|
|
12
|
-
import { browser } from '@atlaskit/editor-common/utils';
|
|
13
13
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
14
14
|
import { FullPageContentArea } from './FullPageContentArea';
|
|
15
15
|
import { FullPageToolbar } from './FullPageToolbar';
|
|
@@ -13,13 +13,13 @@ import React, { useMemo } from 'react';
|
|
|
13
13
|
|
|
14
14
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
15
15
|
import { css, jsx, useTheme } from '@emotion/react';
|
|
16
|
+
import { browser } from '@atlaskit/editor-common/browser';
|
|
16
17
|
import { telepointerStyle } from '@atlaskit/editor-common/collab';
|
|
17
18
|
import { EmojiSharedCssClassName } from '@atlaskit/editor-common/emoji';
|
|
18
19
|
import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
19
20
|
import { MentionSharedCssClassName } from '@atlaskit/editor-common/mention';
|
|
20
21
|
import { gapCursorStyles } from '@atlaskit/editor-common/selection';
|
|
21
22
|
import { annotationSharedStyles, backgroundColorStyles, blockMarksSharedStyles, codeBlockInListSafariFix, codeMarkSharedStyles, dateSharedStyle, embedCardStyles, gridStyles, indentationSharedStyles, linkSharedStyle, listsSharedStyles, MediaSharedClassNames, paragraphSharedStyles, resizerStyles, ruleSharedStyles, shadowSharedStyle, SmartCardSharedCssClassName, smartCardSharedStyles, smartCardStyles, tasksAndDecisionsStyles, textColorStyles, unsupportedStyles, whitespaceSharedStyles } from '@atlaskit/editor-common/styles';
|
|
22
|
-
import { browser } from '@atlaskit/editor-common/utils';
|
|
23
23
|
import { blocktypeStyles } from '@atlaskit/editor-plugins/block-type/styles';
|
|
24
24
|
import { findReplaceStyles } from '@atlaskit/editor-plugins/find-replace/styles';
|
|
25
25
|
import { textHighlightStyle } from '@atlaskit/editor-plugins/paste-options-toolbar/styles';
|
|
@@ -27,7 +27,7 @@ import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '@atlaskit
|
|
|
27
27
|
import { Popup } from '@atlaskit/editor-common/ui';
|
|
28
28
|
import { ToolbarButton } from '@atlaskit/editor-common/ui-menu';
|
|
29
29
|
import { withReactEditorViewOuterListeners as withOuterListeners } from '@atlaskit/editor-common/ui-react';
|
|
30
|
-
import { analyticsEventKey } from '@atlaskit/editor-common/utils';
|
|
30
|
+
import { analyticsEventKey } from '@atlaskit/editor-common/utils/analytics';
|
|
31
31
|
import Spinner from '@atlaskit/spinner';
|
|
32
32
|
import { createDispatch } from '../../event-dispatcher';
|
|
33
33
|
import { usePresetContext } from '../../presets/context';
|
|
@@ -10,7 +10,7 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
|
|
|
10
10
|
import React from 'react';
|
|
11
11
|
import PropTypes from 'prop-types';
|
|
12
12
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
13
|
-
import { analyticsEventKey } from '@atlaskit/editor-common/utils';
|
|
13
|
+
import { analyticsEventKey } from '@atlaskit/editor-common/utils/analytics';
|
|
14
14
|
import { deprecatedOpenHelpCommand } from '@atlaskit/editor-plugins/help-dialog';
|
|
15
15
|
import { createDispatch } from '../../event-dispatcher';
|
|
16
16
|
var WithHelpTrigger = /*#__PURE__*/function (_React$Component) {
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Finds all top level nodes affected by the transaction
|
|
3
|
+
* Uses from/to positions in transaction's steps to work out which nodes will
|
|
4
|
+
* be changed by the transaction
|
|
5
|
+
*/
|
|
6
|
+
export var findChangedNodesFromTransaction = function findChangedNodesFromTransaction(tr) {
|
|
7
|
+
var nodes = [];
|
|
8
|
+
var steps = tr.steps || [];
|
|
9
|
+
steps.forEach(function (step) {
|
|
10
|
+
step.getMap().forEach(function (oldStart, oldEnd, newStart, newEnd) {
|
|
11
|
+
tr.doc.nodesBetween(newStart, Math.min(newEnd, tr.doc.content.size), function (node) {
|
|
12
|
+
if (!nodes.find(function (n) {
|
|
13
|
+
return n === node;
|
|
14
|
+
})) {
|
|
15
|
+
nodes.push(node);
|
|
16
|
+
}
|
|
17
|
+
return false;
|
|
18
|
+
});
|
|
19
|
+
});
|
|
20
|
+
});
|
|
21
|
+
return nodes;
|
|
22
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export var isOutdatedBrowser = function isOutdatedBrowser(userAgent) {
|
|
2
|
+
// Take browsers in both Desktop and Mobile (includes Chrome, Firefox, Edge and Safari) within last 2 years
|
|
3
|
+
var chrome = /Chrome\//.test(userAgent) && !/OPR\//.test(userAgent);
|
|
4
|
+
var chromeVersion = chrome ? parseInt((userAgent.match(/Chrome\/(\d+)/) || [])[1], 10) : 0;
|
|
5
|
+
if (chromeVersion >= 84) {
|
|
6
|
+
return false;
|
|
7
|
+
}
|
|
8
|
+
var gecko = /gecko\/\d/i.test(userAgent);
|
|
9
|
+
var geckoVersion = gecko ? parseInt((userAgent.match(/Firefox\/(\d+)/) || [])[1], 10) : 0;
|
|
10
|
+
if (geckoVersion >= 84) {
|
|
11
|
+
return false;
|
|
12
|
+
}
|
|
13
|
+
var edge = /Edge\/(\d+)/.exec(userAgent);
|
|
14
|
+
var edgeVersion = edge ? +edge[1] : 0;
|
|
15
|
+
if (edgeVersion >= 84) {
|
|
16
|
+
return false;
|
|
17
|
+
}
|
|
18
|
+
var safari = !chrome && !gecko && /Version\/([0-9\._]+).*Safari/.test(userAgent);
|
|
19
|
+
var safariVersion = safari ? parseInt((userAgent.match(/Version\/([0-9\._]+).*Safari/) || [])[1], 10) : 0;
|
|
20
|
+
if (safariVersion >= 12) {
|
|
21
|
+
return false;
|
|
22
|
+
}
|
|
23
|
+
return true;
|
|
24
|
+
};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
|
+
export function sanitizeNodes(nodes, supportedMarks) {
|
|
5
|
+
var nodeNames = Object.keys(nodes);
|
|
6
|
+
nodeNames.forEach(function (nodeKey) {
|
|
7
|
+
var nodeSpec = _objectSpread({}, nodes[nodeKey]);
|
|
8
|
+
if (nodeSpec.marks && nodeSpec.marks !== '_') {
|
|
9
|
+
nodeSpec.marks = nodeSpec.marks.split(' ').filter(function (mark) {
|
|
10
|
+
return !!supportedMarks[mark];
|
|
11
|
+
}).join(' ');
|
|
12
|
+
}
|
|
13
|
+
if (nodeSpec.content) {
|
|
14
|
+
nodeSpec.content = sanitizeNodeSpecContent(nodes, nodeSpec.content);
|
|
15
|
+
}
|
|
16
|
+
nodes[nodeKey] = nodeSpec;
|
|
17
|
+
});
|
|
18
|
+
return nodes;
|
|
19
|
+
}
|
|
20
|
+
function sanitizeNodeSpecContent(nodes, rawContent) {
|
|
21
|
+
var content = rawContent.replace(/\W/g, ' ');
|
|
22
|
+
var contentKeys = content.split(' ');
|
|
23
|
+
var unsupportedContentKeys = contentKeys.filter(function (contentKey) {
|
|
24
|
+
return !isContentSupported(nodes, contentKey);
|
|
25
|
+
});
|
|
26
|
+
return unsupportedContentKeys.reduce(function (newContent, nodeName) {
|
|
27
|
+
return sanitizedContent(newContent, nodeName);
|
|
28
|
+
}, rawContent);
|
|
29
|
+
}
|
|
30
|
+
function sanitizedContent(content, invalidContent) {
|
|
31
|
+
if (!invalidContent.length) {
|
|
32
|
+
return content || '';
|
|
33
|
+
}
|
|
34
|
+
if (!content || !content.match(/\w/)) {
|
|
35
|
+
return '';
|
|
36
|
+
}
|
|
37
|
+
var pattern = "(".concat(invalidContent, "((\\s)*\\|)+)|((\\|(\\s)*)+").concat(invalidContent, ")|(").concat(invalidContent, "$)|(").concat(invalidContent, "(\\+|\\*))");
|
|
38
|
+
return content.replace(new RegExp(pattern, 'g'), '').replace(' ', ' ').trim();
|
|
39
|
+
}
|
|
40
|
+
function isContentSupported(nodes, contentKey) {
|
|
41
|
+
var nodeKeys = Object.keys(nodes);
|
|
42
|
+
|
|
43
|
+
// content is with valid node
|
|
44
|
+
if (nodeKeys.indexOf(contentKey) > -1) {
|
|
45
|
+
return true;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// content is with valid group
|
|
49
|
+
for (var supportedKey in nodes) {
|
|
50
|
+
var nodeSpec = nodes[supportedKey];
|
|
51
|
+
if (nodeSpec && nodeSpec.group === contentKey) {
|
|
52
|
+
return true;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
return false;
|
|
56
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export var validNode = function validNode(node) {
|
|
2
|
+
try {
|
|
3
|
+
node.check(); // this will throw an error if the node is invalid
|
|
4
|
+
} catch (error) {
|
|
5
|
+
return false;
|
|
6
|
+
}
|
|
7
|
+
return true;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
/** Validates prosemirror nodes, and returns true only if all nodes are valid */
|
|
11
|
+
export var validateNodes = function validateNodes(nodes) {
|
|
12
|
+
return nodes.every(validNode);
|
|
13
|
+
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export var name = "@atlaskit/editor-core";
|
|
2
|
-
export var version = "197.2.
|
|
2
|
+
export var version = "197.2.4";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
2
|
+
import type { Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
3
|
+
/**
|
|
4
|
+
* Finds all top level nodes affected by the transaction
|
|
5
|
+
* Uses from/to positions in transaction's steps to work out which nodes will
|
|
6
|
+
* be changed by the transaction
|
|
7
|
+
*/
|
|
8
|
+
export declare const findChangedNodesFromTransaction: (tr: Transaction) => PMNode[];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const isOutdatedBrowser: (userAgent: string) => boolean;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { type Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
2
|
+
export declare const validNode: (node: PMNode) => boolean;
|
|
3
|
+
/** Validates prosemirror nodes, and returns true only if all nodes are valid */
|
|
4
|
+
export declare const validateNodes: (nodes: PMNode[]) => boolean;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
2
|
+
import type { Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
3
|
+
/**
|
|
4
|
+
* Finds all top level nodes affected by the transaction
|
|
5
|
+
* Uses from/to positions in transaction's steps to work out which nodes will
|
|
6
|
+
* be changed by the transaction
|
|
7
|
+
*/
|
|
8
|
+
export declare const findChangedNodesFromTransaction: (tr: Transaction) => PMNode[];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const isOutdatedBrowser: (userAgent: string) => boolean;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { type Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
2
|
+
export declare const validNode: (node: PMNode) => boolean;
|
|
3
|
+
/** Validates prosemirror nodes, and returns true only if all nodes are valid */
|
|
4
|
+
export declare const validateNodes: (nodes: PMNode[]) => boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-core",
|
|
3
|
-
"version": "197.2.
|
|
3
|
+
"version": "197.2.4",
|
|
4
4
|
"description": "A package contains Atlassian editor core functionality",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -39,11 +39,11 @@
|
|
|
39
39
|
"dependencies": {
|
|
40
40
|
"@atlaskit/activity-provider": "^2.4.0",
|
|
41
41
|
"@atlaskit/adf-schema": "^40.9.0",
|
|
42
|
-
"@atlaskit/analytics-namespaced-context": "^6.
|
|
42
|
+
"@atlaskit/analytics-namespaced-context": "^6.12.0",
|
|
43
43
|
"@atlaskit/analytics-next": "^10.1.0",
|
|
44
44
|
"@atlaskit/analytics-next-stable-react-context": "1.0.1",
|
|
45
45
|
"@atlaskit/button": "^20.1.0",
|
|
46
|
-
"@atlaskit/editor-common": "^88.
|
|
46
|
+
"@atlaskit/editor-common": "^88.8.0",
|
|
47
47
|
"@atlaskit/editor-plugins": "^4.3.0",
|
|
48
48
|
"@atlaskit/editor-prosemirror": "5.0.1",
|
|
49
49
|
"@atlaskit/editor-shared-styles": "^2.13.0",
|
|
@@ -227,10 +227,6 @@
|
|
|
227
227
|
"platform.editor.core.increase-full-page-guttering": {
|
|
228
228
|
"type": "boolean"
|
|
229
229
|
},
|
|
230
|
-
"platform_editor_tables_padding_increase": {
|
|
231
|
-
"type": "boolean",
|
|
232
|
-
"referenceOnly": "true"
|
|
233
|
-
},
|
|
234
230
|
"platform_editor_get_card_provider_from_config": {
|
|
235
231
|
"type": "boolean",
|
|
236
232
|
"referenceOnly": true
|