@atlaskit/editor-core 153.0.1 → 153.1.3

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.
Files changed (31) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/dist/cjs/plugins/analytics/types/enums.js +2 -0
  3. package/dist/cjs/plugins/table/index.js +23 -6
  4. package/dist/cjs/plugins/table/pm-plugins/safari-delayed-dom-selection-syncing-workaround.js +75 -0
  5. package/dist/cjs/plugins/text-color/utils/disabled.js +12 -1
  6. package/dist/cjs/ui/ContentStyles/index.js +31 -31
  7. package/dist/cjs/utils/document.js +30 -2
  8. package/dist/cjs/version-wrapper.js +1 -1
  9. package/dist/cjs/version.json +1 -1
  10. package/dist/es2019/plugins/analytics/types/enums.js +2 -0
  11. package/dist/es2019/plugins/table/index.js +17 -2
  12. package/dist/es2019/plugins/table/pm-plugins/safari-delayed-dom-selection-syncing-workaround.js +63 -0
  13. package/dist/es2019/plugins/text-color/utils/disabled.js +23 -1
  14. package/dist/es2019/ui/ContentStyles/index.js +2 -1
  15. package/dist/es2019/utils/document.js +30 -3
  16. package/dist/es2019/version-wrapper.js +1 -1
  17. package/dist/es2019/version.json +1 -1
  18. package/dist/esm/plugins/analytics/types/enums.js +2 -0
  19. package/dist/esm/plugins/table/index.js +17 -2
  20. package/dist/esm/plugins/table/pm-plugins/safari-delayed-dom-selection-syncing-workaround.js +63 -0
  21. package/dist/esm/plugins/text-color/utils/disabled.js +13 -1
  22. package/dist/esm/ui/ContentStyles/index.js +3 -3
  23. package/dist/esm/utils/document.js +30 -3
  24. package/dist/esm/version-wrapper.js +1 -1
  25. package/dist/esm/version.json +1 -1
  26. package/dist/types/plugins/analytics/types/enums.d.ts +3 -1
  27. package/dist/types/plugins/analytics/types/general-events.d.ts +7 -1
  28. package/dist/types/plugins/table/pm-plugins/safari-delayed-dom-selection-syncing-workaround.d.ts +3 -0
  29. package/dist/types/ui/ToolbarButton/index.d.ts +1 -1
  30. package/dist/types/ui/ToolbarButton/styles.d.ts +1 -1
  31. package/package.json +16 -16
package/CHANGELOG.md CHANGED
@@ -1,5 +1,34 @@
1
1
  # @atlaskit/editor-core
2
2
 
3
+ ## 153.1.3
4
+
5
+ ### Patch Changes
6
+
7
+ - [`fa87054a61a`](https://bitbucket.org/atlassian/atlassian-frontend/commits/fa87054a61a) - workaround issue where prosemirrors new drag selection delay logic breaks safaris table selections.
8
+
9
+ ## 153.1.2
10
+
11
+ ### Patch Changes
12
+
13
+ - [`c55c736ecea`](https://bitbucket.org/atlassian/atlassian-frontend/commits/c55c736ecea) - Patch VULN AFP-3486 AFP-3487 AFP-3488 AFP-3489
14
+
15
+ ## 153.1.1
16
+
17
+ ### Patch Changes
18
+
19
+ - [`bfc3a31f7d0`](https://bitbucket.org/atlassian/atlassian-frontend/commits/bfc3a31f7d0) - ED-14130 fix copy paste block cards
20
+
21
+ ## 153.1.0
22
+
23
+ ### Minor Changes
24
+
25
+ - [`b9cd2373064`](https://bitbucket.org/atlassian/atlassian-frontend/commits/b9cd2373064) - [ED-14106] Reset custom color when the node is inside a link
26
+
27
+ ### Patch Changes
28
+
29
+ - [`d6c140182ce`](https://bitbucket.org/atlassian/atlassian-frontend/commits/d6c140182ce) - [ED-14095] Send a new analytics events when the document loaded is not a valid ProseMirror Model
30
+ - Updated dependencies
31
+
3
32
  ## 153.0.1
4
33
 
5
34
  ### Patch Changes
@@ -104,6 +104,8 @@ exports.ACTION = ACTION;
104
104
  ACTION["ON_CHANGE_CALLBACK"] = "onChangeCalled";
105
105
  ACTION["REMOVE_ICON"] = "removedIcon";
106
106
  ACTION["UFO_SESSION_COMPLETE"] = "ufoSessionComplete";
107
+ ACTION["INVALID_PROSEMIRROR_DOCUMENT"] = "invalidProsemirrorDocument";
108
+ ACTION["DOCUMENT_PROCESSING_ERROR"] = "documentProcessingError";
107
109
  })(ACTION || (exports.ACTION = ACTION = {}));
108
110
 
109
111
  var INPUT_METHOD;
@@ -9,9 +9,11 @@ exports.default = void 0;
9
9
 
10
10
  var _react = _interopRequireDefault(require("react"));
11
11
 
12
+ var _utils = require("@atlaskit/editor-common/utils");
13
+
12
14
  var _pmPlugins = require("@atlaskit/editor-tables/pm-plugins");
13
15
 
14
- var _utils = require("@atlaskit/editor-tables/utils");
16
+ var _utils2 = require("@atlaskit/editor-tables/utils");
15
17
 
16
18
  var _adfSchema = require("@atlaskit/adf-schema");
17
19
 
@@ -29,6 +31,8 @@ var _createPluginConfig = require("./create-plugin-config");
29
31
 
30
32
  var _tableLocalId = require("./pm-plugins/table-local-id");
31
33
 
34
+ var _safariDelayedDomSelectionSyncingWorkaround = require("./pm-plugins/safari-delayed-dom-selection-syncing-workaround");
35
+
32
36
  var _plugin = require("./pm-plugins/decorations/plugin");
33
37
 
34
38
  var _keymap = require("./pm-plugins/keymap");
@@ -55,7 +59,7 @@ var _FloatingInsertButton = _interopRequireDefault(require("./ui/FloatingInsertB
55
59
 
56
60
  var _LayoutButton = _interopRequireDefault(require("./ui/LayoutButton"));
57
61
 
58
- var _utils2 = require("./utils");
62
+ var _utils3 = require("./utils");
59
63
 
60
64
  var _featureFlagsContext = require("../feature-flags-context");
61
65
 
@@ -80,7 +84,7 @@ var tablesPlugin = function tablesPlugin(options) {
80
84
  }];
81
85
  },
82
86
  pmPlugins: function pmPlugins() {
83
- return [{
87
+ var plugins = [{
84
88
  name: 'table',
85
89
  plugin: function plugin(_ref) {
86
90
  var dispatchAnalyticsEvent = _ref.dispatchAnalyticsEvent,
@@ -150,7 +154,20 @@ var tablesPlugin = function tablesPlugin(options) {
150
154
  var dispatch = _ref6.dispatch;
151
155
  return (0, _tableLocalId.createPlugin)(dispatch);
152
156
  }
153
- }];
157
+ }]; // workaround for prosemirrors delayed dom selection syncing during pointer drag
158
+ // causing issues with table selections in Safari
159
+ // https://github.com/ProseMirror/prosemirror-view/commit/885258b80551ac87b81601d3ed25f552aeb22293
160
+
161
+ if (_utils.browser.safari) {
162
+ plugins.push({
163
+ name: 'tableSafariDelayedDomSelectionSyncingWorkaround',
164
+ plugin: function plugin() {
165
+ return (0, _safariDelayedDomSelectionSyncingWorkaround.createPlugin)();
166
+ }
167
+ });
168
+ }
169
+
170
+ return plugins;
154
171
  },
155
172
  contentComponent: function contentComponent(_ref7) {
156
173
  var editorView = _ref7.editorView,
@@ -234,7 +251,7 @@ var tablesPlugin = function tablesPlugin(options) {
234
251
  scrollableElement: popupsScrollableElement,
235
252
  stickyHeaders: stickyHeader,
236
253
  isNumberColumnEnabled: tableNode && tableNode.attrs.isNumberColumnEnabled
237
- }), (0, _utils2.isLayoutSupported)(state) && options && options.breakoutEnabled && /*#__PURE__*/_react.default.createElement(_LayoutButton.default, {
254
+ }), (0, _utils3.isLayoutSupported)(state) && options && options.breakoutEnabled && /*#__PURE__*/_react.default.createElement(_LayoutButton.default, {
238
255
  editorView: editorView,
239
256
  mountPoint: popupsMountPoint,
240
257
  boundariesElement: popupsBoundariesElement,
@@ -261,7 +278,7 @@ var tablesPlugin = function tablesPlugin(options) {
261
278
  return /*#__PURE__*/_react.default.createElement(_assets.IconTable, null);
262
279
  },
263
280
  action: function action(insert, state) {
264
- var tr = insert((0, _utils.createTable)({
281
+ var tr = insert((0, _utils2.createTable)({
265
282
  schema: state.schema
266
283
  }));
267
284
  return (0, _analytics.addAnalytics)(state, tr, {
@@ -0,0 +1,75 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.tableSafariDelayedDomSelectionSyncingWorkaroundKey = exports.createPlugin = void 0;
7
+
8
+ var _prosemirrorState = require("prosemirror-state");
9
+
10
+ var tableSafariDelayedDomSelectionSyncingWorkaroundKey = new _prosemirrorState.PluginKey('tableSafariDelayedDomSelectionSyncingWorkaround');
11
+ exports.tableSafariDelayedDomSelectionSyncingWorkaroundKey = tableSafariDelayedDomSelectionSyncingWorkaroundKey;
12
+
13
+ var createPlugin = function createPlugin() {
14
+ // From a review of the prosemirror-view source code,
15
+ // the only places where a view relies on the presence
16
+ // of view.mouseDown are;
17
+ // - when checking it's presence in selectionToDOM
18
+ // to delay drag selections
19
+ // - to ensure it is cleaned up when the mouseup
20
+ // event is not fired in a previous mousedown event
21
+ // Because we are manually wiping the view.mouseDown,
22
+ // we manage this custom cleanup ourselves
23
+ var prevMouseDownDone = null;
24
+ return new _prosemirrorState.Plugin({
25
+ key: tableSafariDelayedDomSelectionSyncingWorkaroundKey,
26
+ props: {
27
+ handleDOMEvents: {
28
+ mousedown: function mousedown(view) {
29
+ // Workaround issue in safari where table selections
30
+ // do not work correctly since prosemirror delayed
31
+ // DOM selection syncing during pointer drag.
32
+ //
33
+ // https://github.com/ProseMirror/prosemirror-view/commit/885258b80551ac87b81601d3ed25f552aeb22293
34
+ // This fix removes the selectionToDOM from the view
35
+ // prior to selectionToDOM being called.
36
+ // selectionToDOM checks if there is an "active"
37
+ // mouseDown, and if so, it delays running logic
38
+ // which causes the table selections issue.
39
+ // The handleDOMEvents are called before ProseMirror
40
+ // events fired on the editable DOM element.
41
+ // This means the view.mouseView will not yet be
42
+ // created when the mousedown event starts.
43
+ // https://prosemirror.net/docs/ref/#view.EditorProps.handleDOMEvents
44
+ //
45
+ // Because selectionToDOM is only added to the script
46
+ // tasks queue following the mousedown event, we can
47
+ // prepend a task which will clear the mouseDown from
48
+ // the view. We do this using a setTimout with no
49
+ // interval.
50
+ if (prevMouseDownDone) {
51
+ // avoid memory leaks when the mouseup event is not fired
52
+ // in a previous mousedown event
53
+ prevMouseDownDone();
54
+ }
55
+
56
+ setTimeout(function () {
57
+ // the ts-ignores here are required due to the
58
+ // view.mouseDown being an internal which is
59
+ // not part of the views type signature
60
+ // @ts-ignore
61
+ if (view.mouseDown) {
62
+ // @ts-ignore
63
+ prevMouseDownDone = view.mouseDown.done.bind(view.mouseDown); // @ts-ignore
64
+
65
+ view.mouseDown = null;
66
+ }
67
+ });
68
+ return false;
69
+ }
70
+ }
71
+ }
72
+ });
73
+ };
74
+
75
+ exports.createPlugin = createPlugin;
@@ -7,6 +7,17 @@ exports.getDisabledState = void 0;
7
7
 
8
8
  var _mark = require("../../../utils/mark");
9
9
 
10
+ var hasLinkMark = function hasLinkMark($pos) {
11
+ var linkMarkType = $pos.doc.type.schema.marks.link,
12
+ pos = $pos.pos;
13
+
14
+ if (!linkMarkType) {
15
+ return false;
16
+ }
17
+
18
+ return $pos.doc.rangeHasMark(pos, Math.min(pos + 1, $pos.doc.content.size), linkMarkType);
19
+ };
20
+
10
21
  var getDisabledState = function getDisabledState(state) {
11
22
  var textColor = state.schema.marks.textColor;
12
23
 
@@ -16,7 +27,7 @@ var getDisabledState = function getDisabledState(state) {
16
27
  ranges = _ref.ranges,
17
28
  $cursor = _ref.$cursor;
18
29
 
19
- if (empty && !$cursor || (0, _mark.isMarkAllowedInRange)(state.doc, ranges, textColor) === false) {
30
+ if (empty && !$cursor || $cursor && hasLinkMark($cursor) || (0, _mark.isMarkAllowedInRange)(state.doc, ranges, textColor) === false) {
20
31
  return true;
21
32
  }
22
33
 
@@ -15,63 +15,63 @@ var _react = _interopRequireDefault(require("react"));
15
15
 
16
16
  var _styledComponents = _interopRequireDefault(require("styled-components"));
17
17
 
18
- var _editorCommon = require("@atlaskit/editor-common");
18
+ var _styles = require("@atlaskit/editor-common/styles");
19
19
 
20
20
  var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
21
21
 
22
- var _styles = require("../../plugins/unsupported-content/styles");
22
+ var _styles2 = require("../../plugins/unsupported-content/styles");
23
23
 
24
- var _styles2 = require("../../plugins/collab-edit/styles");
24
+ var _styles3 = require("../../plugins/collab-edit/styles");
25
25
 
26
- var _styles3 = require("../../plugins/selection/gap-cursor/styles");
26
+ var _styles4 = require("../../plugins/selection/gap-cursor/styles");
27
27
 
28
28
  var _commonStyles = require("../../plugins/table/ui/common-styles.css");
29
29
 
30
- var _styles4 = require("../../plugins/placeholder/styles");
30
+ var _styles5 = require("../../plugins/placeholder/styles");
31
31
 
32
- var _styles5 = require("../../plugins/block-type/styles");
32
+ var _styles6 = require("../../plugins/block-type/styles");
33
33
 
34
- var _styles6 = require("../../plugins/code-block/styles");
34
+ var _styles7 = require("../../plugins/code-block/styles");
35
35
 
36
- var _styles7 = require("../../plugins/list/styles");
36
+ var _styles8 = require("../../plugins/list/styles");
37
37
 
38
- var _styles8 = require("../../plugins/rule/styles");
38
+ var _styles9 = require("../../plugins/rule/styles");
39
39
 
40
- var _styles9 = require("../../plugins/media/styles");
40
+ var _styles10 = require("../../plugins/media/styles");
41
41
 
42
- var _styles10 = require("../../plugins/layout/styles");
42
+ var _styles11 = require("../../plugins/layout/styles");
43
43
 
44
- var _styles11 = require("../../plugins/panel/styles");
44
+ var _styles12 = require("../../plugins/panel/styles");
45
45
 
46
- var _styles12 = require("../../plugins/fake-text-cursor/styles");
46
+ var _styles13 = require("../../plugins/fake-text-cursor/styles");
47
47
 
48
- var _styles13 = require("../../plugins/mentions/styles");
48
+ var _styles14 = require("../../plugins/mentions/styles");
49
49
 
50
- var _styles14 = require("../../plugins/emoji/styles");
50
+ var _styles15 = require("../../plugins/emoji/styles");
51
51
 
52
- var _styles15 = require("../../plugins/text-formatting/styles");
52
+ var _styles16 = require("../../plugins/text-formatting/styles");
53
53
 
54
- var _styles16 = require("../../plugins/placeholder-text/styles");
54
+ var _styles17 = require("../../plugins/placeholder-text/styles");
55
55
 
56
- var _styles17 = require("../../plugins/grid/styles");
56
+ var _styles18 = require("../../plugins/grid/styles");
57
57
 
58
- var _styles18 = require("../../plugins/hyperlink/styles");
58
+ var _styles19 = require("../../plugins/hyperlink/styles");
59
59
 
60
- var _styles19 = require("../../plugins/extension/ui/styles");
60
+ var _styles20 = require("../../plugins/extension/ui/styles");
61
61
 
62
- var _styles20 = require("../../plugins/expand/ui/styles");
62
+ var _styles21 = require("../../plugins/expand/ui/styles");
63
63
 
64
64
  var _style = require("../../plugins/media/pm-plugins/alt-text/style");
65
65
 
66
- var _styles21 = require("../../plugins/find-replace/styles");
66
+ var _styles22 = require("../../plugins/find-replace/styles");
67
67
 
68
- var _styles22 = require("../../plugins/tasks-and-decisions/styles");
68
+ var _styles23 = require("../../plugins/tasks-and-decisions/styles");
69
69
 
70
- var _styles23 = require("../../plugins/status/styles");
70
+ var _styles24 = require("../../plugins/status/styles");
71
71
 
72
- var _styles24 = require("../../plugins/card/styles");
72
+ var _styles25 = require("../../plugins/card/styles");
73
73
 
74
- var _styles25 = require("../../plugins/date/styles");
74
+ var _styles26 = require("../../plugins/date/styles");
75
75
 
76
76
  var _styled = require("../../plugins/card/ui/styled");
77
77
 
@@ -79,13 +79,13 @@ var _featureFlagsContext = require("../../plugins/feature-flags-context");
79
79
 
80
80
  var _templateObject;
81
81
 
82
- var ContentStyles = _styledComponents.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n .ProseMirror {\n outline: none;\n font-size: ", "px;\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n }\n\n .ProseMirror[contenteditable='false'] .taskItemView-content-wrap {\n pointer-events: none;\n opacity: 0.7;\n }\n\n .ProseMirror-hideselection *::selection {\n background: transparent;\n }\n\n .ProseMirror-hideselection *::-moz-selection {\n background: transparent;\n }\n\n .ProseMirror-selectednode {\n outline: none;\n }\n\n .ProseMirror-selectednode:empty {\n outline: 2px solid #8cf;\n }\n\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", ";\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n\n .panelView-content-wrap {\n box-sizing: border-box;\n }\n\n .mediaGroupView-content-wrap ul {\n padding: 0;\n }\n\n /** Needed to override any cleared floats, e.g. image wrapping */\n\n div.fabric-editor-block-mark[class^='fabric-editor-align'] {\n clear: none !important;\n }\n\n .fabric-editor-align-end {\n text-align: right;\n }\n\n .fabric-editor-align-start {\n text-align: left;\n }\n\n .fabric-editor-align-center {\n text-align: center;\n }\n\n .pm-table-header-content-wrap,\n .pm-table-cell-content-wrap div.fabric-editor-block-mark {\n p {\n margin-top: 0;\n }\n }\n\n .hyperlink-floating-toolbar,\n .", " {\n padding: 0;\n }\n\n /* Link icon in the Atlaskit package\n is bigger than the others\n */\n .hyperlink-open-link {\n svg {\n max-width: 18px;\n }\n &[href] {\n padding: 0 4px;\n }\n }\n"])), _editorSharedStyles.editorFontSize, _editorCommon.whitespaceSharedStyles, _editorCommon.paragraphSharedStyles, _editorCommon.listsSharedStyles, _editorCommon.indentationSharedStyles, _editorCommon.shadowSharedStyle, _editorCommon.inlineNodeSharedStyle, _styles5.blocktypeStyles, _styles15.textFormattingStyles, _styles16.placeholderTextStyles, _styles4.placeholderStyles, function (_ref) {
82
+ var ContentStyles = _styledComponents.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n .ProseMirror {\n outline: none;\n font-size: ", "px;\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n }\n\n .ProseMirror[contenteditable='false'] .taskItemView-content-wrap {\n pointer-events: none;\n opacity: 0.7;\n }\n\n .ProseMirror-hideselection *::selection {\n background: transparent;\n }\n\n .ProseMirror-hideselection *::-moz-selection {\n background: transparent;\n }\n\n .ProseMirror-selectednode {\n outline: none;\n }\n\n .ProseMirror-selectednode:empty {\n outline: 2px solid #8cf;\n }\n\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", ";\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n\n .panelView-content-wrap {\n box-sizing: border-box;\n }\n\n .mediaGroupView-content-wrap ul {\n padding: 0;\n }\n\n /** Needed to override any cleared floats, e.g. image wrapping */\n\n div.fabric-editor-block-mark[class^='fabric-editor-align'] {\n clear: none !important;\n }\n\n .fabric-editor-align-end {\n text-align: right;\n }\n\n .fabric-editor-align-start {\n text-align: left;\n }\n\n .fabric-editor-align-center {\n text-align: center;\n }\n\n .pm-table-header-content-wrap,\n .pm-table-cell-content-wrap div.fabric-editor-block-mark {\n p {\n margin-top: 0;\n }\n }\n\n .hyperlink-floating-toolbar,\n .", " {\n padding: 0;\n }\n\n /* Link icon in the Atlaskit package\n is bigger than the others\n */\n .hyperlink-open-link {\n svg {\n max-width: 18px;\n }\n &[href] {\n padding: 0 4px;\n }\n }\n"])), _editorSharedStyles.editorFontSize, _styles.whitespaceSharedStyles, _styles.paragraphSharedStyles, _styles.listsSharedStyles, _styles.indentationSharedStyles, _styles.shadowSharedStyle, _styles.inlineNodeSharedStyle, _styles6.blocktypeStyles, _styles16.textFormattingStyles, _styles17.placeholderTextStyles, _styles5.placeholderStyles, function (_ref) {
83
83
  var featureFlags = _ref.featureFlags;
84
- return featureFlags !== null && featureFlags !== void 0 && featureFlags.codeBlockSyntaxHighlighting ? _styles6.highlightingCodeBlockStyles : _styles6.codeBlockStyles;
85
- }, _styles7.listsStyles, _styles8.ruleStyles, _styles9.mediaStyles, _styles10.layoutStyles, _styles2.telepointerStyle, _styles3.gapCursorStyles, _commonStyles.tableStyles, _styles11.panelStyles, _styles12.fakeCursorStyles, _styles13.mentionsStyles, function (_ref2) {
84
+ return featureFlags !== null && featureFlags !== void 0 && featureFlags.codeBlockSyntaxHighlighting ? _styles7.highlightingCodeBlockStyles : _styles7.codeBlockStyles;
85
+ }, _styles.textColorStyles, _styles8.listsStyles, _styles9.ruleStyles, _styles10.mediaStyles, _styles11.layoutStyles, _styles3.telepointerStyle, _styles4.gapCursorStyles, _commonStyles.tableStyles, _styles12.panelStyles, _styles13.fakeCursorStyles, _styles14.mentionsStyles, function (_ref2) {
86
86
  var featureFlags = _ref2.featureFlags;
87
- return featureFlags !== null && featureFlags !== void 0 && featureFlags.nextEmojiNodeView ? _styles14.emojiStylesNext : _styles14.emojiStyles;
88
- }, _editorCommon.tasksAndDecisionsStyles, _styles17.gridStyles, _styles18.linkStyles, _editorCommon.blockMarksSharedStyles, _editorCommon.dateSharedStyle, _styles19.extensionStyles, _styles20.expandStyles, _styles21.findReplaceStyles, _styles22.taskDecisionStyles, _styles23.statusStyles, _editorCommon.annotationSharedStyles, _styles24.smartCardStyles, _editorCommon.smartCardSharedStyles, _styles25.dateStyles, _styled.embedCardStyles, _styles.unsupportedStyles, _style.ClassNames.FLOATING_TOOLBAR_COMPONENT);
87
+ return featureFlags !== null && featureFlags !== void 0 && featureFlags.nextEmojiNodeView ? _styles15.emojiStylesNext : _styles15.emojiStyles;
88
+ }, _styles.tasksAndDecisionsStyles, _styles18.gridStyles, _styles19.linkStyles, _styles.blockMarksSharedStyles, _styles.dateSharedStyle, _styles20.extensionStyles, _styles21.expandStyles, _styles22.findReplaceStyles, _styles23.taskDecisionStyles, _styles24.statusStyles, _styles.annotationSharedStyles, _styles25.smartCardStyles, _styles.smartCardSharedStyles, _styles26.dateStyles, _styled.embedCardStyles, _styles2.unsupportedStyles, _style.ClassNames.FLOATING_TOOLBAR_COMPONENT);
89
89
 
90
90
  var _default = /*#__PURE__*/_react.default.forwardRef(function (props, ref) {
91
91
  var featureFlags = (0, _featureFlagsContext.useFeatureFlags)();
@@ -32,6 +32,8 @@ var _editorCommon = require("@atlaskit/editor-common");
32
32
 
33
33
  var _nodeWidth = require("./node-width");
34
34
 
35
+ var _enums = require("../plugins/analytics/types/enums");
36
+
35
37
  /**
36
38
  * Checks if node is an empty paragraph.
37
39
  */
@@ -208,7 +210,22 @@ function processRawValue(schema, value, providerFactory, sanitizePrivateContent,
208
210
  var parsedDoc = _prosemirrorModel.Node.fromJSON(schema, newEntity); // throws an error if the document is invalid
209
211
 
210
212
 
211
- parsedDoc.check();
213
+ try {
214
+ parsedDoc.check();
215
+ } catch (err) {
216
+ if (dispatchAnalyticsEvent) {
217
+ dispatchAnalyticsEvent({
218
+ action: _enums.ACTION.INVALID_PROSEMIRROR_DOCUMENT,
219
+ actionSubject: _enums.ACTION_SUBJECT.EDITOR,
220
+ eventType: _enums.EVENT_TYPE.OPERATIONAL,
221
+ attributes: {
222
+ error: err === null || err === void 0 ? void 0 : err.toString()
223
+ }
224
+ });
225
+ }
226
+
227
+ return;
228
+ }
212
229
 
213
230
  if (dispatchAnalyticsEvent) {
214
231
  (0, _editorCommon.findAndTrackUnsupportedContentNodes)(parsedDoc, schema, dispatchAnalyticsEvent);
@@ -216,7 +233,18 @@ function processRawValue(schema, value, providerFactory, sanitizePrivateContent,
216
233
 
217
234
  return parsedDoc;
218
235
  } catch (e) {
219
- // eslint-disable-next-line no-console
236
+ if (dispatchAnalyticsEvent) {
237
+ dispatchAnalyticsEvent({
238
+ action: _enums.ACTION.DOCUMENT_PROCESSING_ERROR,
239
+ actionSubject: _enums.ACTION_SUBJECT.EDITOR,
240
+ eventType: _enums.EVENT_TYPE.OPERATIONAL,
241
+ attributes: {
242
+ error: e === null || e === void 0 ? void 0 : e.toString()
243
+ }
244
+ });
245
+ } // eslint-disable-next-line no-console
246
+
247
+
220
248
  console.error("Error processing document:\n".concat(e.message, "\n\n"), JSON.stringify(node));
221
249
  return;
222
250
  }
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.version = exports.nextMajorVersion = exports.name = void 0;
7
7
  var name = "@atlaskit/editor-core";
8
8
  exports.name = name;
9
- var version = "153.0.1";
9
+ var version = "153.1.3";
10
10
  exports.version = version;
11
11
 
12
12
  var nextMajorVersion = function nextMajorVersion() {
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-core",
3
- "version": "153.0.1",
3
+ "version": "153.1.3",
4
4
  "sideEffects": false
5
5
  }
@@ -96,6 +96,8 @@ export let ACTION;
96
96
  ACTION["ON_CHANGE_CALLBACK"] = "onChangeCalled";
97
97
  ACTION["REMOVE_ICON"] = "removedIcon";
98
98
  ACTION["UFO_SESSION_COMPLETE"] = "ufoSessionComplete";
99
+ ACTION["INVALID_PROSEMIRROR_DOCUMENT"] = "invalidProsemirrorDocument";
100
+ ACTION["DOCUMENT_PROCESSING_ERROR"] = "documentProcessingError";
99
101
  })(ACTION || (ACTION = {}));
100
102
 
101
103
  export let INPUT_METHOD;
@@ -1,4 +1,5 @@
1
1
  import React from 'react';
2
+ import { browser } from '@atlaskit/editor-common/utils';
2
3
  import { tableEditing } from '@atlaskit/editor-tables/pm-plugins';
3
4
  import { createTable } from '@atlaskit/editor-tables/utils';
4
5
  import { table, tableCell, tableHeader, tableRow } from '@atlaskit/adf-schema';
@@ -9,6 +10,7 @@ import { messages } from '../insert-block/ui/ToolbarInsertBlock/messages';
9
10
  import { IconTable } from '../quick-insert/assets';
10
11
  import { pluginConfig } from './create-plugin-config';
11
12
  import { createPlugin as createTableLocalIdPlugin } from './pm-plugins/table-local-id';
13
+ import { createPlugin as createTableSafariDelayedDomSelectionSyncingWorkaroundPlugin } from './pm-plugins/safari-delayed-dom-selection-syncing-workaround';
12
14
  import { createPlugin as createDecorationsPlugin } from './pm-plugins/decorations/plugin';
13
15
  import { keymapPlugin } from './pm-plugins/keymap';
14
16
  import { tableSelectionKeymapPlugin } from './pm-plugins/table-selection-keymap';
@@ -46,7 +48,7 @@ const tablesPlugin = options => ({
46
48
  },
47
49
 
48
50
  pmPlugins() {
49
- return [{
51
+ const plugins = [{
50
52
  name: 'table',
51
53
  plugin: ({
52
54
  dispatchAnalyticsEvent,
@@ -106,7 +108,20 @@ const tablesPlugin = options => ({
106
108
  plugin: ({
107
109
  dispatch
108
110
  }) => createTableLocalIdPlugin(dispatch)
109
- }];
111
+ }]; // workaround for prosemirrors delayed dom selection syncing during pointer drag
112
+ // causing issues with table selections in Safari
113
+ // https://github.com/ProseMirror/prosemirror-view/commit/885258b80551ac87b81601d3ed25f552aeb22293
114
+
115
+ if (browser.safari) {
116
+ plugins.push({
117
+ name: 'tableSafariDelayedDomSelectionSyncingWorkaround',
118
+ plugin: () => {
119
+ return createTableSafariDelayedDomSelectionSyncingWorkaroundPlugin();
120
+ }
121
+ });
122
+ }
123
+
124
+ return plugins;
110
125
  },
111
126
 
112
127
  contentComponent({
@@ -0,0 +1,63 @@
1
+ import { PluginKey, Plugin } from 'prosemirror-state';
2
+ export const tableSafariDelayedDomSelectionSyncingWorkaroundKey = new PluginKey('tableSafariDelayedDomSelectionSyncingWorkaround');
3
+ export const createPlugin = () => {
4
+ // From a review of the prosemirror-view source code,
5
+ // the only places where a view relies on the presence
6
+ // of view.mouseDown are;
7
+ // - when checking it's presence in selectionToDOM
8
+ // to delay drag selections
9
+ // - to ensure it is cleaned up when the mouseup
10
+ // event is not fired in a previous mousedown event
11
+ // Because we are manually wiping the view.mouseDown,
12
+ // we manage this custom cleanup ourselves
13
+ let prevMouseDownDone = null;
14
+ return new Plugin({
15
+ key: tableSafariDelayedDomSelectionSyncingWorkaroundKey,
16
+ props: {
17
+ handleDOMEvents: {
18
+ mousedown: view => {
19
+ // Workaround issue in safari where table selections
20
+ // do not work correctly since prosemirror delayed
21
+ // DOM selection syncing during pointer drag.
22
+ //
23
+ // https://github.com/ProseMirror/prosemirror-view/commit/885258b80551ac87b81601d3ed25f552aeb22293
24
+ // This fix removes the selectionToDOM from the view
25
+ // prior to selectionToDOM being called.
26
+ // selectionToDOM checks if there is an "active"
27
+ // mouseDown, and if so, it delays running logic
28
+ // which causes the table selections issue.
29
+ // The handleDOMEvents are called before ProseMirror
30
+ // events fired on the editable DOM element.
31
+ // This means the view.mouseView will not yet be
32
+ // created when the mousedown event starts.
33
+ // https://prosemirror.net/docs/ref/#view.EditorProps.handleDOMEvents
34
+ //
35
+ // Because selectionToDOM is only added to the script
36
+ // tasks queue following the mousedown event, we can
37
+ // prepend a task which will clear the mouseDown from
38
+ // the view. We do this using a setTimout with no
39
+ // interval.
40
+ if (prevMouseDownDone) {
41
+ // avoid memory leaks when the mouseup event is not fired
42
+ // in a previous mousedown event
43
+ prevMouseDownDone();
44
+ }
45
+
46
+ setTimeout(() => {
47
+ // the ts-ignores here are required due to the
48
+ // view.mouseDown being an internal which is
49
+ // not part of the views type signature
50
+ // @ts-ignore
51
+ if (view.mouseDown) {
52
+ // @ts-ignore
53
+ prevMouseDownDone = view.mouseDown.done.bind(view.mouseDown); // @ts-ignore
54
+
55
+ view.mouseDown = null;
56
+ }
57
+ });
58
+ return false;
59
+ }
60
+ }
61
+ }
62
+ });
63
+ };
@@ -1,4 +1,26 @@
1
1
  import { isMarkAllowedInRange, isMarkExcluded } from '../../../utils/mark';
2
+
3
+ const hasLinkMark = $pos => {
4
+ const {
5
+ doc: {
6
+ type: {
7
+ schema: {
8
+ marks: {
9
+ link: linkMarkType
10
+ }
11
+ }
12
+ }
13
+ },
14
+ pos
15
+ } = $pos;
16
+
17
+ if (!linkMarkType) {
18
+ return false;
19
+ }
20
+
21
+ return $pos.doc.rangeHasMark(pos, Math.min(pos + 1, $pos.doc.content.size), linkMarkType);
22
+ };
23
+
2
24
  export const getDisabledState = state => {
3
25
  const {
4
26
  textColor
@@ -11,7 +33,7 @@ export const getDisabledState = state => {
11
33
  $cursor
12
34
  } = state.selection;
13
35
 
14
- if (empty && !$cursor || isMarkAllowedInRange(state.doc, ranges, textColor) === false) {
36
+ if (empty && !$cursor || $cursor && hasLinkMark($cursor) || isMarkAllowedInRange(state.doc, ranges, textColor) === false) {
15
37
  return true;
16
38
  }
17
39
 
@@ -1,7 +1,7 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import React from 'react';
3
3
  import styled from 'styled-components';
4
- import { whitespaceSharedStyles, paragraphSharedStyles, listsSharedStyles, indentationSharedStyles, blockMarksSharedStyles, shadowSharedStyle, inlineNodeSharedStyle, dateSharedStyle, tasksAndDecisionsStyles, annotationSharedStyles, smartCardSharedStyles } from '@atlaskit/editor-common';
4
+ import { whitespaceSharedStyles, paragraphSharedStyles, listsSharedStyles, indentationSharedStyles, blockMarksSharedStyles, shadowSharedStyle, inlineNodeSharedStyle, dateSharedStyle, tasksAndDecisionsStyles, annotationSharedStyles, smartCardSharedStyles, textColorStyles } from '@atlaskit/editor-common/styles';
5
5
  import { editorFontSize } from '@atlaskit/editor-shared-styles';
6
6
  import { unsupportedStyles } from '../../plugins/unsupported-content/styles';
7
7
  import { telepointerStyle } from '../../plugins/collab-edit/styles';
@@ -72,6 +72,7 @@ const ContentStyles = styled.div`
72
72
  ${({
73
73
  featureFlags
74
74
  }) => featureFlags !== null && featureFlags !== void 0 && featureFlags.codeBlockSyntaxHighlighting ? highlightingCodeBlockStyles : codeBlockStyles}
75
+ ${textColorStyles}
75
76
  ${listsStyles}
76
77
  ${ruleStyles}
77
78
  ${mediaStyles}
@@ -2,10 +2,11 @@ import { Node } from 'prosemirror-model';
2
2
  import { sanitizeNodeForPrivacy } from '../utils/filter/privacy-filter';
3
3
  import { validateADFEntity, findAndTrackUnsupportedContentNodes } from '@atlaskit/editor-common';
4
4
  import { getBreakoutMode } from './node-width';
5
-
5
+ import { ACTION, ACTION_SUBJECT, EVENT_TYPE } from '../plugins/analytics/types/enums';
6
6
  /**
7
7
  * Checks if node is an empty paragraph.
8
8
  */
9
+
9
10
  export function isEmptyParagraph(node) {
10
11
  return !!node && node.type.name === 'paragraph' && !node.childCount;
11
12
  }
@@ -174,7 +175,22 @@ export function processRawValue(schema, value, providerFactory, sanitizePrivateC
174
175
  let newEntity = maySanitizePrivateContent(entity, providerFactory, sanitizePrivateContent);
175
176
  const parsedDoc = Node.fromJSON(schema, newEntity); // throws an error if the document is invalid
176
177
 
177
- parsedDoc.check();
178
+ try {
179
+ parsedDoc.check();
180
+ } catch (err) {
181
+ if (dispatchAnalyticsEvent) {
182
+ dispatchAnalyticsEvent({
183
+ action: ACTION.INVALID_PROSEMIRROR_DOCUMENT,
184
+ actionSubject: ACTION_SUBJECT.EDITOR,
185
+ eventType: EVENT_TYPE.OPERATIONAL,
186
+ attributes: {
187
+ error: err === null || err === void 0 ? void 0 : err.toString()
188
+ }
189
+ });
190
+ }
191
+
192
+ return;
193
+ }
178
194
 
179
195
  if (dispatchAnalyticsEvent) {
180
196
  findAndTrackUnsupportedContentNodes(parsedDoc, schema, dispatchAnalyticsEvent);
@@ -182,7 +198,18 @@ export function processRawValue(schema, value, providerFactory, sanitizePrivateC
182
198
 
183
199
  return parsedDoc;
184
200
  } catch (e) {
185
- // eslint-disable-next-line no-console
201
+ if (dispatchAnalyticsEvent) {
202
+ dispatchAnalyticsEvent({
203
+ action: ACTION.DOCUMENT_PROCESSING_ERROR,
204
+ actionSubject: ACTION_SUBJECT.EDITOR,
205
+ eventType: EVENT_TYPE.OPERATIONAL,
206
+ attributes: {
207
+ error: e === null || e === void 0 ? void 0 : e.toString()
208
+ }
209
+ });
210
+ } // eslint-disable-next-line no-console
211
+
212
+
186
213
  console.error(`Error processing document:\n${e.message}\n\n`, JSON.stringify(node));
187
214
  return;
188
215
  }
@@ -1,5 +1,5 @@
1
1
  export const name = "@atlaskit/editor-core";
2
- export const version = "153.0.1";
2
+ export const version = "153.1.3";
3
3
  export const nextMajorVersion = () => {
4
4
  return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
5
5
  };