@atlaskit/editor-core 187.43.11 → 187.43.13

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 (84) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/cjs/labs/next/presets/default.js +2 -1
  3. package/dist/cjs/labs/next/presets/universal.js +1 -1
  4. package/dist/cjs/plugins/clipboard/pm-plugins/main.js +13 -54
  5. package/dist/cjs/plugins/code-block/pm-plugins/codeBlockCopySelectionPlugin.js +1 -1
  6. package/dist/cjs/plugins/floating-toolbar/index.js +1 -2
  7. package/dist/cjs/plugins/index.js +0 -7
  8. package/dist/cjs/plugins/media/nodeviews/mediaSingle.js +1 -1
  9. package/dist/cjs/plugins/media/pm-plugins/main.js +6 -0
  10. package/dist/cjs/plugins/media/toolbar/index.js +3 -5
  11. package/dist/cjs/plugins/selection/utils.js +29 -80
  12. package/dist/cjs/utils/clipboard.js +19 -127
  13. package/dist/cjs/version-wrapper.js +1 -1
  14. package/dist/es2019/labs/next/presets/default.js +2 -1
  15. package/dist/es2019/labs/next/presets/universal.js +2 -2
  16. package/dist/es2019/plugins/clipboard/pm-plugins/main.js +3 -53
  17. package/dist/es2019/plugins/code-block/pm-plugins/codeBlockCopySelectionPlugin.js +1 -1
  18. package/dist/es2019/plugins/floating-toolbar/index.js +1 -2
  19. package/dist/es2019/plugins/index.js +0 -1
  20. package/dist/es2019/plugins/media/nodeviews/mediaSingle.js +1 -1
  21. package/dist/es2019/plugins/media/pm-plugins/main.js +6 -0
  22. package/dist/es2019/plugins/media/toolbar/index.js +3 -7
  23. package/dist/es2019/plugins/selection/utils.js +3 -74
  24. package/dist/es2019/utils/clipboard.js +1 -53
  25. package/dist/es2019/version-wrapper.js +1 -1
  26. package/dist/esm/labs/next/presets/default.js +2 -1
  27. package/dist/esm/labs/next/presets/universal.js +2 -2
  28. package/dist/esm/plugins/clipboard/pm-plugins/main.js +3 -49
  29. package/dist/esm/plugins/code-block/pm-plugins/codeBlockCopySelectionPlugin.js +1 -1
  30. package/dist/esm/plugins/floating-toolbar/index.js +1 -2
  31. package/dist/esm/plugins/index.js +0 -1
  32. package/dist/esm/plugins/media/nodeviews/mediaSingle.js +1 -1
  33. package/dist/esm/plugins/media/pm-plugins/main.js +6 -0
  34. package/dist/esm/plugins/media/toolbar/index.js +3 -5
  35. package/dist/esm/plugins/selection/utils.js +3 -72
  36. package/dist/esm/utils/clipboard.js +1 -119
  37. package/dist/esm/version-wrapper.js +1 -1
  38. package/dist/types/labs/next/presets/default.d.ts +68 -4
  39. package/dist/types/plugins/clipboard/pm-plugins/main.d.ts +2 -3
  40. package/dist/types/plugins/index.d.ts +0 -1
  41. package/dist/types/plugins/media/pm-plugins/main.d.ts +1 -0
  42. package/dist/types/plugins/media/pm-plugins/types.d.ts +1 -0
  43. package/dist/types/plugins/selection/utils.d.ts +2 -5
  44. package/dist/types/utils/clipboard.d.ts +1 -3
  45. package/dist/types-ts4.5/labs/next/presets/default.d.ts +86 -0
  46. package/dist/types-ts4.5/plugins/clipboard/pm-plugins/main.d.ts +2 -3
  47. package/dist/types-ts4.5/plugins/index.d.ts +0 -1
  48. package/dist/types-ts4.5/plugins/media/pm-plugins/main.d.ts +1 -0
  49. package/dist/types-ts4.5/plugins/media/pm-plugins/types.d.ts +1 -0
  50. package/dist/types-ts4.5/plugins/selection/utils.d.ts +2 -5
  51. package/dist/types-ts4.5/utils/clipboard.d.ts +1 -3
  52. package/package.json +7 -7
  53. package/report.api.md +2 -0
  54. package/tmp/api-report-tmp.d.ts +2 -0
  55. package/dist/cjs/plugins/copy-button/commands.js +0 -171
  56. package/dist/cjs/plugins/copy-button/index.js +0 -23
  57. package/dist/cjs/plugins/copy-button/pm-plugins/main.js +0 -104
  58. package/dist/cjs/plugins/copy-button/pm-plugins/plugin-key.js +0 -9
  59. package/dist/cjs/plugins/copy-button/toolbar.js +0 -99
  60. package/dist/cjs/plugins/copy-button/utils.js +0 -22
  61. package/dist/es2019/plugins/copy-button/commands.js +0 -157
  62. package/dist/es2019/plugins/copy-button/index.js +0 -11
  63. package/dist/es2019/plugins/copy-button/pm-plugins/main.js +0 -97
  64. package/dist/es2019/plugins/copy-button/pm-plugins/plugin-key.js +0 -2
  65. package/dist/es2019/plugins/copy-button/toolbar.js +0 -82
  66. package/dist/es2019/plugins/copy-button/utils.js +0 -15
  67. package/dist/esm/plugins/copy-button/commands.js +0 -159
  68. package/dist/esm/plugins/copy-button/index.js +0 -15
  69. package/dist/esm/plugins/copy-button/pm-plugins/main.js +0 -96
  70. package/dist/esm/plugins/copy-button/pm-plugins/plugin-key.js +0 -2
  71. package/dist/esm/plugins/copy-button/toolbar.js +0 -89
  72. package/dist/esm/plugins/copy-button/utils.js +0 -14
  73. package/dist/types/plugins/copy-button/commands.d.ts +0 -9
  74. package/dist/types/plugins/copy-button/index.d.ts +0 -3
  75. package/dist/types/plugins/copy-button/pm-plugins/main.d.ts +0 -4
  76. package/dist/types/plugins/copy-button/pm-plugins/plugin-key.d.ts +0 -2
  77. package/dist/types/plugins/copy-button/toolbar.d.ts +0 -13
  78. package/dist/types/plugins/copy-button/utils.d.ts +0 -8
  79. package/dist/types-ts4.5/plugins/copy-button/commands.d.ts +0 -9
  80. package/dist/types-ts4.5/plugins/copy-button/index.d.ts +0 -3
  81. package/dist/types-ts4.5/plugins/copy-button/pm-plugins/main.d.ts +0 -4
  82. package/dist/types-ts4.5/plugins/copy-button/pm-plugins/plugin-key.d.ts +0 -2
  83. package/dist/types-ts4.5/plugins/copy-button/toolbar.d.ts +0 -13
  84. package/dist/types-ts4.5/plugins/copy-button/utils.d.ts +0 -8
package/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # @atlaskit/editor-core
2
2
 
3
+ ## 187.43.13
4
+
5
+ ### Patch Changes
6
+
7
+ - [`9f2365fabcc`](https://bitbucket.org/atlassian/atlassian-frontend/commits/9f2365fabcc) - ED-19617 - Initial creation of editor-plugin-copy-button package
8
+ - Updated dependencies
9
+
10
+ ## 187.43.12
11
+
12
+ ### Patch Changes
13
+
14
+ - [`621b904a076`](https://bitbucket.org/atlassian/atlassian-frontend/commits/621b904a076) - ED-19729 fix behaviour of image floating toolbar layout
15
+
3
16
  ## 187.43.11
4
17
 
5
18
  ### Patch Changes
@@ -20,6 +20,7 @@ var _typeAhead = _interopRequireDefault(require("../../../plugins/type-ahead"));
20
20
  var _submitEditor = _interopRequireDefault(require("../../../plugins/submit-editor"));
21
21
  var _fakeTextCursor = _interopRequireDefault(require("../../../plugins/fake-text-cursor"));
22
22
  var _editorPluginFeatureFlags = require("@atlaskit/editor-plugin-feature-flags");
23
+ var _editorPluginCopyButton = require("@atlaskit/editor-plugin-copy-button");
23
24
  var _floatingToolbar = _interopRequireDefault(require("../../../plugins/floating-toolbar"));
24
25
  var _clipboard = _interopRequireDefault(require("../../../plugins/clipboard"));
25
26
  var _plugins = require("../../../plugins");
@@ -76,7 +77,7 @@ function createDefaultPreset(options) {
76
77
  return builder;
77
78
  }).add([_editorPluginHyperlink.hyperlinkPlugin, options.hyperlinkOptions]).add([_editorPluginTextFormatting.textFormattingPlugin, options.textFormatting]).add(_editorPluginWidth.widthPlugin).add([_editorPluginQuickInsert.quickInsertPlugin, options.quickInsert]).add([_typeAhead.default, options.typeAhead || {
78
79
  createAnalyticsEvent: options.createAnalyticsEvent
79
- }]).add([_editorPluginPlaceholder.placeholderPlugin, options.placeholder]).add(_editorPluginUnsupportedContent.unsupportedContentPlugin).add(_editorPluginEditorDisabled.editorDisabledPlugin).add([_submitEditor.default, options.submitEditor]).add(_fakeTextCursor.default).add(_floatingToolbar.default).add([_selection.default, options.selection]).add([_codeBlock.default, options.codeBlock || {
80
+ }]).add([_editorPluginPlaceholder.placeholderPlugin, options.placeholder]).add(_editorPluginUnsupportedContent.unsupportedContentPlugin).add(_editorPluginEditorDisabled.editorDisabledPlugin).add([_submitEditor.default, options.submitEditor]).add(_fakeTextCursor.default).add(_editorPluginCopyButton.copyButtonPlugin).add(_floatingToolbar.default).add([_selection.default, options.selection]).add([_codeBlock.default, options.codeBlock || {
80
81
  appearance: 'full-page'
81
82
  }]);
82
83
  return preset;
@@ -395,6 +395,6 @@ function createUniversalPreset(appearance, props, featureFlags, prevAppearance,
395
395
  return builder;
396
396
  }).add([_plugins.codeBidiWarningPlugin, {
397
397
  appearance: appearance
398
- }]).add(_plugins.copyButtonPlugin);
398
+ }]);
399
399
  return finalPreset;
400
400
  }
@@ -4,16 +4,21 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports.sendClipboardAnalytics = exports.getAnalyticsPayload = exports.createPlugin = exports.createClipboardSerializer = void 0;
8
- var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
7
+ exports.createPlugin = exports.createClipboardSerializer = void 0;
8
+ Object.defineProperty(exports, "getAnalyticsPayload", {
9
+ enumerable: true,
10
+ get: function get() {
11
+ return _clipboard.getAnalyticsPayload;
12
+ }
13
+ });
14
+ exports.sendClipboardAnalytics = void 0;
9
15
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
10
16
  var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
11
- var _state = require("@atlaskit/editor-prosemirror/state");
12
17
  var _pluginKey = require("../plugin-key");
13
- var _utils = require("../../selection/utils");
14
18
  var _enums = require("../../analytics/types/enums");
15
19
  var _model = require("@atlaskit/editor-prosemirror/model");
16
- var _utils2 = require("@atlaskit/editor-prosemirror/utils");
20
+ var _utils = require("@atlaskit/editor-prosemirror/utils");
21
+ var _clipboard = require("@atlaskit/editor-common/clipboard");
17
22
  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; }
18
23
  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; }
19
24
  var createPlugin = function createPlugin(_ref) {
@@ -88,7 +93,7 @@ var createClipboardSerializer = function createClipboardSerializer(schema, getEd
88
93
  // For recursive logic see the bind call above and the prosemirror-model (https://github.com/ProseMirror/prosemirror-model/blob/master/src/to_dom.js#L44
89
94
  // and https://github.com/ProseMirror/prosemirror-model/blob/master/src/to_dom.js#L87)
90
95
  options.tableWrapperExists = true;
91
- var parentTable = (0, _utils2.findParentNodeOfType)(schema.nodes.table)(selection);
96
+ var parentTable = (0, _utils.findParentNodeOfType)(schema.nodes.table)(selection);
92
97
  var attributes = parentTable === null || parentTable === void 0 ? void 0 : parentTable.node.attrs;
93
98
  var newTable = schema.nodes.table;
94
99
  // Explicitly remove local id since we are creating a new table and it should have a unique local id which will be generated.
@@ -111,7 +116,7 @@ var createClipboardSerializer = function createClipboardSerializer(schema, getEd
111
116
  };
112
117
  exports.createClipboardSerializer = createClipboardSerializer;
113
118
  var sendClipboardAnalytics = function sendClipboardAnalytics(view, dispatchAnalyticsEvent, action) {
114
- var clipboardAnalyticsPayload = getAnalyticsPayload(view.state, action);
119
+ var clipboardAnalyticsPayload = (0, _clipboard.getAnalyticsPayload)(view.state, action);
115
120
  if (clipboardAnalyticsPayload) {
116
121
  dispatchAnalyticsEvent(clipboardAnalyticsPayload);
117
122
  }
@@ -119,50 +124,4 @@ var sendClipboardAnalytics = function sendClipboardAnalytics(view, dispatchAnaly
119
124
  // from running just because we are sending an analytics event
120
125
  return false;
121
126
  };
122
- exports.sendClipboardAnalytics = sendClipboardAnalytics;
123
- var getAnalyticsPayload = function getAnalyticsPayload(state, action) {
124
- var selection = state.selection,
125
- doc = state.doc;
126
- var selectionAnalyticsPayload = (0, _utils.getNodeSelectionAnalyticsPayload)(selection) || (0, _utils.getRangeSelectionAnalyticsPayload)(selection, doc) || (0, _utils.getAllSelectionAnalyticsPayload)(selection) || (0, _utils.getCellSelectionAnalyticsPayload)(state);
127
- if (selectionAnalyticsPayload) {
128
- var selectionActionSubjectId = selectionAnalyticsPayload.actionSubjectId;
129
- var content = [];
130
- switch (selectionActionSubjectId) {
131
- case _enums.ACTION_SUBJECT_ID.NODE:
132
- content.push(selectionAnalyticsPayload.attributes.node);
133
- break;
134
- case _enums.ACTION_SUBJECT_ID.RANGE:
135
- content.push.apply(content, (0, _toConsumableArray2.default)(selectionAnalyticsPayload.attributes.nodes));
136
- break;
137
- case _enums.ACTION_SUBJECT_ID.ALL:
138
- content.push('all');
139
- break;
140
- case _enums.ACTION_SUBJECT_ID.CELL:
141
- {
142
- var _ref2 = selectionAnalyticsPayload.attributes,
143
- selectedCells = _ref2.selectedCells;
144
- content.push.apply(content, (0, _toConsumableArray2.default)(Array(selectedCells).fill('tableCell')));
145
- break;
146
- }
147
- }
148
- return {
149
- eventType: _enums.EVENT_TYPE.TRACK,
150
- action: action,
151
- actionSubject: _enums.ACTION_SUBJECT.DOCUMENT,
152
- attributes: {
153
- content: content
154
- }
155
- };
156
- }
157
- if (selection instanceof _state.TextSelection && selection.$cursor) {
158
- return {
159
- eventType: _enums.EVENT_TYPE.TRACK,
160
- action: action,
161
- actionSubject: _enums.ACTION_SUBJECT.DOCUMENT,
162
- attributes: {
163
- content: ['caret']
164
- }
165
- };
166
- }
167
- };
168
- exports.getAnalyticsPayload = getAnalyticsPayload;
127
+ exports.sendClipboardAnalytics = sendClipboardAnalytics;
@@ -12,7 +12,7 @@ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/sli
12
12
  var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
13
13
  var _state = require("@atlaskit/editor-prosemirror/state");
14
14
  var _view = require("@atlaskit/editor-prosemirror/view");
15
- var _utils = require("../../copy-button/utils");
15
+ var _utils = require("@atlaskit/editor-plugin-copy-button/utils");
16
16
  var copySelectionPluginKey = new _state.PluginKey('codeBlockCopySelectionPlugin');
17
17
  exports.copySelectionPluginKey = copySelectionPluginKey;
18
18
  function getSelectionDecorationStartAndEnd(_ref) {
@@ -23,7 +23,6 @@ var _ConfirmationModal = require("./ui/ConfirmationModal");
23
23
  var _ToolbarLoader = require("./ui/ToolbarLoader");
24
24
  var _utils2 = require("./utils");
25
25
  var _ErrorBoundary = require("../../ui/ErrorBoundary");
26
- var _toolbar = require("../copy-button/toolbar");
27
26
  var _forceFocus = _interopRequireWildcard(require("./pm-plugins/force-focus"));
28
27
  var _hooks = require("@atlaskit/editor-common/hooks");
29
28
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
@@ -230,7 +229,7 @@ function ContentComponent(_ref5) {
230
229
  return null;
231
230
  }
232
231
  var customPositionCalculation;
233
- var toolbarItems = (0, _toolbar.processCopyButtonItems)(editorView.state)(Array.isArray(items) ? items : items(node), pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.decorations.actions.hoverDecoration);
232
+ var toolbarItems = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.copyButton.actions.processCopyButtonItems(editorView.state)(Array.isArray(items) ? items : items(node), pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.decorations.actions.hoverDecoration);
234
233
  if (onPositionCalculated) {
235
234
  customPositionCalculation = function customPositionCalculation(nextPos) {
236
235
  return onPositionCalculated(editorView, nextPos);
@@ -95,12 +95,6 @@ Object.defineProperty(exports, "collabEditPlugin", {
95
95
  return _collabEdit.default;
96
96
  }
97
97
  });
98
- Object.defineProperty(exports, "copyButtonPlugin", {
99
- enumerable: true,
100
- get: function get() {
101
- return _copyButton.default;
102
- }
103
- });
104
98
  Object.defineProperty(exports, "customAutoformatPlugin", {
105
99
  enumerable: true,
106
100
  get: function get() {
@@ -373,7 +367,6 @@ var _avatarGroup = _interopRequireDefault(require("./avatar-group"));
373
367
  var _viewUpdateSubscription = _interopRequireDefault(require("./view-update-subscription"));
374
368
  var _beforePrimaryToolbar = _interopRequireDefault(require("./before-primaryToolbar"));
375
369
  var _codeBidiWarning = _interopRequireDefault(require("./code-bidi-warning"));
376
- var _copyButton = _interopRequireDefault(require("./copy-button"));
377
370
  var _border = _interopRequireDefault(require("./border"));
378
371
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
379
372
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
@@ -366,7 +366,7 @@ var MediaSingleNode = /*#__PURE__*/function (_Component) {
366
366
  origWidth: width,
367
367
  layout: layout,
368
368
  // This will only be used when calculating legacy media single width
369
- // thus we use the legecy value (exclude table as container node)
369
+ // thus we use the legacy value (exclude table as container node)
370
370
  contentWidth: contentWidthForLegacyExperience,
371
371
  containerWidth: containerWidth,
372
372
  gutterOffset: _mediaSingle.MEDIA_SINGLE_GUTTER_SIZE
@@ -41,6 +41,7 @@ var _CaptionPlaceholder = require("../ui/CaptionPlaceholder");
41
41
  var _reactIntlNext = require("react-intl-next");
42
42
  var _mediaTaskManager = require("./mediaTaskManager");
43
43
  var _cellSelection = require("@atlaskit/editor-tables/cell-selection");
44
+ var _mediaSingle2 = require("@atlaskit/editor-common/media-single");
44
45
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
45
46
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
46
47
  function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
@@ -515,6 +516,11 @@ var MediaPluginStateImplementation = /*#__PURE__*/function () {
515
516
  var selectedContainer = this.selectedMediaContainerNode();
516
517
  if (selectedContainer && this.isMediaSchemaNode(selectedContainer)) {
517
518
  newElement = this.getDomElement(this.view.domAtPos.bind(this.view));
519
+ if (selectedContainer.type === this.view.state.schema.nodes.mediaSingle) {
520
+ this.currentMaxWidth = (0, _mediaSingle2.getMaxWidthForNestedNodeNext)(this.view, this.view.state.selection.$anchor.pos) || undefined;
521
+ } else {
522
+ this.currentMaxWidth = undefined;
523
+ }
518
524
  }
519
525
  if (this.element !== newElement) {
520
526
  this.element = newElement;
@@ -246,11 +246,9 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
246
246
  var _widthPlugin$sharedSt;
247
247
  var contentWidth = widthPlugin === null || widthPlugin === void 0 ? void 0 : (_widthPlugin$sharedSt = widthPlugin.sharedState.currentState()) === null || _widthPlugin$sharedSt === void 0 ? void 0 : _widthPlugin$sharedSt.lineLength;
248
248
  var selectedNode = (0, _utils2.getSelectedMediaSingle)(state);
249
- if (selectedNode && contentWidth) {
250
- var width = selectedNode.node.attrs.width;
251
- if (width >= contentWidth) {
252
- isChangingLayoutDisabled = true;
253
- }
249
+ var selectedNodeMaxWidth = pluginState.currentMaxWidth || contentWidth;
250
+ if (selectedNode && selectedNodeMaxWidth && selectedNode.node.attrs.width >= selectedNodeMaxWidth) {
251
+ isChangingLayoutDisabled = true;
254
252
  }
255
253
  }
256
254
  var layoutButtons = (0, _card.buildLayoutButtons)(state, intl, state.schema.nodes.mediaSingle, widthPlugin, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a3 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a3 === void 0 ? void 0 : _pluginInjectionApi$a3.actions, allowResizing, allowResizingInTables, true, true, isChangingLayoutDisabled);
@@ -5,24 +5,41 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.createSelectionClickHandler = createSelectionClickHandler;
7
7
  exports.findSelectableContainerParent = exports.findSelectableContainerBefore = exports.findSelectableContainerAfter = exports.findLastChildNodeToSelect = exports.findFirstChildNodeToSelect = void 0;
8
- exports.getAllSelectionAnalyticsPayload = getAllSelectionAnalyticsPayload;
9
- exports.getCellSelectionAnalyticsPayload = getCellSelectionAnalyticsPayload;
8
+ Object.defineProperty(exports, "getAllSelectionAnalyticsPayload", {
9
+ enumerable: true,
10
+ get: function get() {
11
+ return _selection.getAllSelectionAnalyticsPayload;
12
+ }
13
+ });
14
+ Object.defineProperty(exports, "getCellSelectionAnalyticsPayload", {
15
+ enumerable: true,
16
+ get: function get() {
17
+ return _selection.getCellSelectionAnalyticsPayload;
18
+ }
19
+ });
10
20
  exports.getDecorations = void 0;
11
- exports.getNodeSelectionAnalyticsPayload = getNodeSelectionAnalyticsPayload;
21
+ Object.defineProperty(exports, "getNodeSelectionAnalyticsPayload", {
22
+ enumerable: true,
23
+ get: function get() {
24
+ return _selection.getNodeSelectionAnalyticsPayload;
25
+ }
26
+ });
12
27
  exports.getNodesToDecorateFromSelection = void 0;
13
- exports.getRangeSelectionAnalyticsPayload = getRangeSelectionAnalyticsPayload;
28
+ Object.defineProperty(exports, "getRangeSelectionAnalyticsPayload", {
29
+ enumerable: true,
30
+ get: function get() {
31
+ return _selection.getRangeSelectionAnalyticsPayload;
32
+ }
33
+ });
14
34
  exports.isSelectionAtStartOfParentNode = exports.isSelectionAtEndOfParentNode = exports.isSelectableContainerNode = exports.isSelectableChildNode = void 0;
15
35
  exports.shouldRecalcDecorations = shouldRecalcDecorations;
16
36
  var _state = require("@atlaskit/editor-prosemirror/state");
17
37
  var _view = require("@atlaskit/editor-prosemirror/view");
18
- var _cellSelection = require("@atlaskit/editor-tables/cell-selection");
19
- var _utils = require("@atlaskit/editor-tables/utils");
20
- var _utils2 = require("@atlaskit/editor-prosemirror/utils");
38
+ var _utils = require("@atlaskit/editor-prosemirror/utils");
21
39
  var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
22
40
  var _selection = require("@atlaskit/editor-common/selection");
23
41
  var _commands = require("../../utils/commands");
24
- var _utils3 = require("@atlaskit/editor-common/utils");
25
- var _analytics = require("../analytics");
42
+ var _utils2 = require("@atlaskit/editor-common/utils");
26
43
  var _isIgnored = require("../selection/gap-cursor/utils/is-ignored");
27
44
  var _types = require("./types");
28
45
  function createSelectionClickHandler(nodes, isValidTarget, options) {
@@ -62,46 +79,6 @@ var getDecorations = function getDecorations(tr) {
62
79
  return _view.DecorationSet.empty;
63
80
  };
64
81
  exports.getDecorations = getDecorations;
65
- function getNodeSelectionAnalyticsPayload(selection) {
66
- if (selection instanceof _state.NodeSelection) {
67
- return {
68
- action: _analytics.ACTION.SELECTED,
69
- actionSubject: _analytics.ACTION_SUBJECT.DOCUMENT,
70
- actionSubjectId: _analytics.ACTION_SUBJECT_ID.NODE,
71
- eventType: _analytics.EVENT_TYPE.TRACK,
72
- attributes: {
73
- node: selection.node.type.name
74
- }
75
- };
76
- }
77
- }
78
- function getAllSelectionAnalyticsPayload(selection) {
79
- if (selection instanceof _state.AllSelection) {
80
- return {
81
- action: _analytics.ACTION.SELECTED,
82
- actionSubject: _analytics.ACTION_SUBJECT.DOCUMENT,
83
- actionSubjectId: _analytics.ACTION_SUBJECT_ID.ALL,
84
- eventType: _analytics.EVENT_TYPE.TRACK
85
- };
86
- }
87
- }
88
- function getCellSelectionAnalyticsPayload(state) {
89
- if (state.selection instanceof _cellSelection.CellSelection) {
90
- var rect = (0, _utils.selectedRect)(state);
91
- var selectedCells = rect.map.cellsInRect(rect).length;
92
- var totalCells = rect.map.map.length;
93
- return {
94
- action: _analytics.ACTION.SELECTED,
95
- actionSubject: _analytics.ACTION_SUBJECT.DOCUMENT,
96
- actionSubjectId: _analytics.ACTION_SUBJECT_ID.CELL,
97
- eventType: _analytics.EVENT_TYPE.TRACK,
98
- attributes: {
99
- selectedCells: selectedCells,
100
- totalCells: totalCells
101
- }
102
- };
103
- }
104
- }
105
82
  var topLevelBlockNodesThatHaveSelectionStyles = ['table', 'panel', 'expand', 'layoutSection', 'decisionList', 'decisionItem', 'codeBlock'];
106
83
 
107
84
  /**
@@ -156,34 +133,6 @@ var getNodesToDecorateFromSelection = function getNodesToDecorateFromSelection(s
156
133
  return nodes;
157
134
  };
158
135
  exports.getNodesToDecorateFromSelection = getNodesToDecorateFromSelection;
159
- function getRangeSelectionAnalyticsPayload(selection, doc) {
160
- if (selection instanceof _state.TextSelection && selection.from !== selection.to) {
161
- var from = selection.from,
162
- to = selection.to,
163
- anchor = selection.anchor,
164
- head = selection.head;
165
- var nodes = [];
166
- doc.nodesBetween(from, to, function (node, pos) {
167
- // We want to send top-level nodes only, ie. the nodes that would have the selection styling
168
- // We allow text nodes that are not fully covered as they are a special case
169
- if (node.isText || pos >= from && pos + node.nodeSize <= to) {
170
- nodes.push(node.type.name);
171
- return false;
172
- }
173
- });
174
- return {
175
- action: _analytics.ACTION.SELECTED,
176
- actionSubject: _analytics.ACTION_SUBJECT.DOCUMENT,
177
- actionSubjectId: _analytics.ACTION_SUBJECT_ID.RANGE,
178
- eventType: _analytics.EVENT_TYPE.TRACK,
179
- attributes: {
180
- from: anchor,
181
- to: head,
182
- nodes: nodes
183
- }
184
- };
185
- }
186
- }
187
136
  function shouldRecalcDecorations(_ref2) {
188
137
  var oldEditorState = _ref2.oldEditorState,
189
138
  newEditorState = _ref2.newEditorState;
@@ -223,7 +172,7 @@ var isSelectableContainerNode = function isSelectableContainerNode(node) {
223
172
  };
224
173
  exports.isSelectableContainerNode = isSelectableContainerNode;
225
174
  var isSelectableChildNode = function isSelectableChildNode(node) {
226
- return !!(node && (node.isText || (0, _utils3.isEmptyParagraph)(node) || _state.NodeSelection.isSelectable(node)));
175
+ return !!(node && (node.isText || (0, _utils2.isEmptyParagraph)(node) || _state.NodeSelection.isSelectable(node)));
227
176
  };
228
177
 
229
178
  /**
@@ -234,7 +183,7 @@ var isSelectableChildNode = function isSelectableChildNode(node) {
234
183
  exports.isSelectableChildNode = isSelectableChildNode;
235
184
  var findSelectableContainerParent = function findSelectableContainerParent(selection) {
236
185
  var foundNodeThatSupportsGapCursor = false;
237
- var selectableNode = (0, _utils2.findParentNode)(function (node) {
186
+ var selectableNode = (0, _utils.findParentNode)(function (node) {
238
187
  var isSelectable = isSelectableContainerNode(node);
239
188
  if (!isSelectable && !(0, _isIgnored.isIgnored)(node)) {
240
189
  foundNodeThatSupportsGapCursor = true;
@@ -321,7 +270,7 @@ var findSelectableContainerAfter = function findSelectableContainerAfter($pos, d
321
270
  */
322
271
  exports.findSelectableContainerAfter = findSelectableContainerAfter;
323
272
  var findFirstChildNodeToSelect = function findFirstChildNodeToSelect(parent) {
324
- return (0, _utils2.flatten)(parent).find(function (child) {
273
+ return (0, _utils.flatten)(parent).find(function (child) {
325
274
  return isSelectableChildNode(child.node) || !(0, _isIgnored.isIgnored)(child.node);
326
275
  });
327
276
  };
@@ -1,132 +1,24 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- var _typeof3 = require("@babel/runtime/helpers/typeof");
5
3
  Object.defineProperty(exports, "__esModule", {
6
4
  value: true
7
5
  });
8
- exports.copyToClipboard = exports.copyHTMLToClipboardPolyfill = exports.copyHTMLToClipboard = void 0;
9
- var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
10
- var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
11
- var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
12
- var clipboard = _interopRequireWildcard(require("clipboard-polyfill"));
13
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
14
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof3(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
15
- var isClipboardApiSupported = function isClipboardApiSupported() {
16
- return !!navigator.clipboard && typeof navigator.clipboard.writeText === 'function';
17
- };
18
- var isIEClipboardApiSupported = function isIEClipboardApiSupported() {
19
- return window.clipboardData && typeof window.clipboardData.setData === 'function';
20
- };
21
- var copyToClipboard = /*#__PURE__*/function () {
22
- var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(textToCopy) {
23
- return _regenerator.default.wrap(function _callee$(_context) {
24
- while (1) switch (_context.prev = _context.next) {
25
- case 0:
26
- if (!isClipboardApiSupported()) {
27
- _context.next = 11;
28
- break;
29
- }
30
- _context.prev = 1;
31
- _context.next = 4;
32
- return navigator.clipboard.writeText(textToCopy);
33
- case 4:
34
- _context.next = 9;
35
- break;
36
- case 6:
37
- _context.prev = 6;
38
- _context.t0 = _context["catch"](1);
39
- throw new Error('Clipboard api is not supported');
40
- case 9:
41
- _context.next = 23;
42
- break;
43
- case 11:
44
- if (!isIEClipboardApiSupported()) {
45
- _context.next = 22;
46
- break;
47
- }
48
- _context.prev = 12;
49
- _context.next = 15;
50
- return window.clipboardData.setData('text', textToCopy);
51
- case 15:
52
- _context.next = 20;
53
- break;
54
- case 17:
55
- _context.prev = 17;
56
- _context.t1 = _context["catch"](12);
57
- throw new Error('IE clipboard api is not supported');
58
- case 20:
59
- _context.next = 23;
60
- break;
61
- case 22:
62
- throw new Error('Clipboard api is not supported');
63
- case 23:
64
- case "end":
65
- return _context.stop();
66
- }
67
- }, _callee, null, [[1, 6], [12, 17]]);
68
- }));
69
- return function copyToClipboard(_x) {
70
- return _ref.apply(this, arguments);
71
- };
72
- }();
73
- exports.copyToClipboard = copyToClipboard;
74
- var copyHTMLToClipboard = /*#__PURE__*/function () {
75
- var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(elementToCopy, plainTextToCopy) {
76
- var data;
77
- return _regenerator.default.wrap(function _callee2$(_context2) {
78
- while (1) switch (_context2.prev = _context2.next) {
79
- case 0:
80
- if (!(isClipboardApiSupported() && typeof ClipboardItem !== 'undefined')) {
81
- _context2.next = 12;
82
- break;
83
- }
84
- _context2.prev = 1;
85
- data = new ClipboardItem({
86
- 'text/plain': new Blob([plainTextToCopy || elementToCopy.innerText], {
87
- type: 'text/plain'
88
- }),
89
- 'text/html': new Blob([elementToCopy.innerHTML], {
90
- type: 'text/html'
91
- })
92
- }); // @ts-ignore
93
- _context2.next = 5;
94
- return navigator.clipboard.write([data]);
95
- case 5:
96
- _context2.next = 10;
97
- break;
98
- case 7:
99
- _context2.prev = 7;
100
- _context2.t0 = _context2["catch"](1);
101
- throw new Error('Clipboard api is not supported');
102
- case 10:
103
- _context2.next = 13;
104
- break;
105
- case 12:
106
- if ((typeof document === "undefined" ? "undefined" : (0, _typeof2.default)(document)) !== undefined) {
107
- // ED-17083 extension copy seems have issue with ClipboardItem API
108
- // Hence of use of this polyfill
109
- copyHTMLToClipboardPolyfill(elementToCopy, plainTextToCopy);
110
- }
111
- case 13:
112
- case "end":
113
- return _context2.stop();
114
- }
115
- }, _callee2, null, [[1, 7]]);
116
- }));
117
- return function copyHTMLToClipboard(_x2, _x3) {
118
- return _ref2.apply(this, arguments);
119
- };
120
- }();
121
-
122
- // At the time of development, Firefox doesn't support ClipboardItem API
123
- // Hence of use of this polyfill
124
- exports.copyHTMLToClipboard = copyHTMLToClipboard;
125
- var copyHTMLToClipboardPolyfill = function copyHTMLToClipboardPolyfill(elementToCopy, plainTextToCopy) {
126
- var Clipboard = clipboard;
127
- var dt = new Clipboard.DT();
128
- dt.setData('text/plain', plainTextToCopy || elementToCopy.innerText);
129
- dt.setData('text/html', elementToCopy.innerHTML);
130
- Clipboard.write(dt);
131
- };
132
- exports.copyHTMLToClipboardPolyfill = copyHTMLToClipboardPolyfill;
6
+ Object.defineProperty(exports, "copyHTMLToClipboard", {
7
+ enumerable: true,
8
+ get: function get() {
9
+ return _clipboard.copyHTMLToClipboard;
10
+ }
11
+ });
12
+ Object.defineProperty(exports, "copyHTMLToClipboardPolyfill", {
13
+ enumerable: true,
14
+ get: function get() {
15
+ return _clipboard.copyHTMLToClipboardPolyfill;
16
+ }
17
+ });
18
+ Object.defineProperty(exports, "copyToClipboard", {
19
+ enumerable: true,
20
+ get: function get() {
21
+ return _clipboard.copyToClipboard;
22
+ }
23
+ });
24
+ var _clipboard = require("@atlaskit/editor-common/clipboard");
@@ -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 = "187.43.11";
9
+ var version = "187.43.13";
10
10
  exports.version = version;
11
11
  var nextMajorVersion = function nextMajorVersion() {
12
12
  return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
@@ -14,6 +14,7 @@ import typeAheadPlugin from '../../../plugins/type-ahead';
14
14
  import submitEditorPlugin from '../../../plugins/submit-editor';
15
15
  import fakeTextCursorPlugin from '../../../plugins/fake-text-cursor';
16
16
  import { featureFlagsPlugin } from '@atlaskit/editor-plugin-feature-flags';
17
+ import { copyButtonPlugin } from '@atlaskit/editor-plugin-copy-button';
17
18
  import floatingToolbarPlugin from '../../../plugins/floating-toolbar';
18
19
  import clipboardPlugin from '../../../plugins/clipboard';
19
20
  import { analyticsPlugin as deprecatedAnalyticsPlugin } from '../../../plugins';
@@ -72,7 +73,7 @@ export function createDefaultPreset(options) {
72
73
  return builder;
73
74
  }).add([hyperlinkPlugin, options.hyperlinkOptions]).add([textFormattingPlugin, options.textFormatting]).add(widthPlugin).add([quickInsertPlugin, options.quickInsert]).add([typeAheadPlugin, options.typeAhead || {
74
75
  createAnalyticsEvent: options.createAnalyticsEvent
75
- }]).add([placeholderPlugin, options.placeholder]).add(unsupportedContentPlugin).add(editorDisabledPlugin).add([submitEditorPlugin, options.submitEditor]).add(fakeTextCursorPlugin).add(floatingToolbarPlugin).add([selectionPlugin, options.selection]).add([codeBlockPlugin, options.codeBlock || {
76
+ }]).add([placeholderPlugin, options.placeholder]).add(unsupportedContentPlugin).add(editorDisabledPlugin).add([submitEditorPlugin, options.submitEditor]).add(fakeTextCursorPlugin).add(copyButtonPlugin).add(floatingToolbarPlugin).add([selectionPlugin, options.selection]).add([codeBlockPlugin, options.codeBlock || {
76
77
  appearance: 'full-page'
77
78
  }]);
78
79
  return preset;
@@ -1,5 +1,5 @@
1
1
  import { createEditorSelectionAPI } from '../../../selection-api/api';
2
- import { breakoutPlugin, collabEditPlugin, dataConsumerMarkPlugin, datePlugin, extensionPlugin, fragmentMarkPlugin, helpDialogPlugin, insertBlockPlugin, jiraIssuePlugin, layoutPlugin, toolbarListsIndentationPlugin, macroPlugin, maxContentSizePlugin, mediaPlugin, mentionsPlugin, panelPlugin, placeholderTextPlugin, saveOnEnterPlugin, tasksAndDecisionsPlugin, textColorPlugin, statusPlugin, alignmentPlugin, indentationPlugin, customAutoformatPlugin, feedbackDialogPlugin, historyPlugin, expandPlugin, isExpandInsertionEnabled, scrollIntoViewPlugin, mobileDimensionsPlugin, findReplacePlugin, mobileSelectionPlugin, annotationPlugin, captionPlugin, avatarGroupPlugin, viewUpdateSubscriptionPlugin, beforePrimaryToolbarPlugin, codeBidiWarningPlugin, copyButtonPlugin, borderPlugin } from '../../../plugins';
2
+ import { breakoutPlugin, collabEditPlugin, dataConsumerMarkPlugin, datePlugin, extensionPlugin, fragmentMarkPlugin, helpDialogPlugin, insertBlockPlugin, jiraIssuePlugin, layoutPlugin, toolbarListsIndentationPlugin, macroPlugin, maxContentSizePlugin, mediaPlugin, mentionsPlugin, panelPlugin, placeholderTextPlugin, saveOnEnterPlugin, tasksAndDecisionsPlugin, textColorPlugin, statusPlugin, alignmentPlugin, indentationPlugin, customAutoformatPlugin, feedbackDialogPlugin, historyPlugin, expandPlugin, isExpandInsertionEnabled, scrollIntoViewPlugin, mobileDimensionsPlugin, findReplacePlugin, mobileSelectionPlugin, annotationPlugin, captionPlugin, avatarGroupPlugin, viewUpdateSubscriptionPlugin, beforePrimaryToolbarPlugin, codeBidiWarningPlugin, borderPlugin } from '../../../plugins';
3
3
  import { rulePlugin } from '@atlaskit/editor-plugin-rule';
4
4
  import { emojiPlugin } from '@atlaskit/editor-plugin-emoji';
5
5
  import { listPlugin } from '@atlaskit/editor-plugin-list';
@@ -392,6 +392,6 @@ export default function createUniversalPreset(appearance, props, featureFlags, p
392
392
  return builder;
393
393
  }).add([codeBidiWarningPlugin, {
394
394
  appearance
395
- }]).add(copyButtonPlugin);
395
+ }]);
396
396
  return finalPreset;
397
397
  }