@atlaskit/editor-core 187.43.12 → 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.
- package/CHANGELOG.md +7 -0
- package/dist/cjs/labs/next/presets/default.js +2 -1
- package/dist/cjs/labs/next/presets/universal.js +1 -1
- package/dist/cjs/plugins/clipboard/pm-plugins/main.js +13 -54
- package/dist/cjs/plugins/code-block/pm-plugins/codeBlockCopySelectionPlugin.js +1 -1
- package/dist/cjs/plugins/floating-toolbar/index.js +1 -2
- package/dist/cjs/plugins/index.js +0 -7
- package/dist/cjs/plugins/selection/utils.js +29 -80
- package/dist/cjs/utils/clipboard.js +19 -127
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/es2019/labs/next/presets/default.js +2 -1
- package/dist/es2019/labs/next/presets/universal.js +2 -2
- package/dist/es2019/plugins/clipboard/pm-plugins/main.js +3 -53
- package/dist/es2019/plugins/code-block/pm-plugins/codeBlockCopySelectionPlugin.js +1 -1
- package/dist/es2019/plugins/floating-toolbar/index.js +1 -2
- package/dist/es2019/plugins/index.js +0 -1
- package/dist/es2019/plugins/selection/utils.js +3 -74
- package/dist/es2019/utils/clipboard.js +1 -53
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/esm/labs/next/presets/default.js +2 -1
- package/dist/esm/labs/next/presets/universal.js +2 -2
- package/dist/esm/plugins/clipboard/pm-plugins/main.js +3 -49
- package/dist/esm/plugins/code-block/pm-plugins/codeBlockCopySelectionPlugin.js +1 -1
- package/dist/esm/plugins/floating-toolbar/index.js +1 -2
- package/dist/esm/plugins/index.js +0 -1
- package/dist/esm/plugins/selection/utils.js +3 -72
- package/dist/esm/utils/clipboard.js +1 -119
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/types/labs/next/presets/default.d.ts +68 -4
- package/dist/types/plugins/clipboard/pm-plugins/main.d.ts +2 -3
- package/dist/types/plugins/index.d.ts +0 -1
- package/dist/types/plugins/selection/utils.d.ts +2 -5
- package/dist/types/utils/clipboard.d.ts +1 -3
- package/dist/types-ts4.5/labs/next/presets/default.d.ts +86 -0
- package/dist/types-ts4.5/plugins/clipboard/pm-plugins/main.d.ts +2 -3
- package/dist/types-ts4.5/plugins/index.d.ts +0 -1
- package/dist/types-ts4.5/plugins/selection/utils.d.ts +2 -5
- package/dist/types-ts4.5/utils/clipboard.d.ts +1 -3
- package/package.json +7 -7
- package/dist/cjs/plugins/copy-button/commands.js +0 -171
- package/dist/cjs/plugins/copy-button/index.js +0 -23
- package/dist/cjs/plugins/copy-button/pm-plugins/main.js +0 -104
- package/dist/cjs/plugins/copy-button/pm-plugins/plugin-key.js +0 -9
- package/dist/cjs/plugins/copy-button/toolbar.js +0 -99
- package/dist/cjs/plugins/copy-button/utils.js +0 -22
- package/dist/es2019/plugins/copy-button/commands.js +0 -157
- package/dist/es2019/plugins/copy-button/index.js +0 -11
- package/dist/es2019/plugins/copy-button/pm-plugins/main.js +0 -97
- package/dist/es2019/plugins/copy-button/pm-plugins/plugin-key.js +0 -2
- package/dist/es2019/plugins/copy-button/toolbar.js +0 -82
- package/dist/es2019/plugins/copy-button/utils.js +0 -15
- package/dist/esm/plugins/copy-button/commands.js +0 -159
- package/dist/esm/plugins/copy-button/index.js +0 -15
- package/dist/esm/plugins/copy-button/pm-plugins/main.js +0 -96
- package/dist/esm/plugins/copy-button/pm-plugins/plugin-key.js +0 -2
- package/dist/esm/plugins/copy-button/toolbar.js +0 -89
- package/dist/esm/plugins/copy-button/utils.js +0 -14
- package/dist/types/plugins/copy-button/commands.d.ts +0 -9
- package/dist/types/plugins/copy-button/index.d.ts +0 -3
- package/dist/types/plugins/copy-button/pm-plugins/main.d.ts +0 -4
- package/dist/types/plugins/copy-button/pm-plugins/plugin-key.d.ts +0 -2
- package/dist/types/plugins/copy-button/toolbar.d.ts +0 -13
- package/dist/types/plugins/copy-button/utils.d.ts +0 -8
- package/dist/types-ts4.5/plugins/copy-button/commands.d.ts +0 -9
- package/dist/types-ts4.5/plugins/copy-button/index.d.ts +0 -3
- package/dist/types-ts4.5/plugins/copy-button/pm-plugins/main.d.ts +0 -4
- package/dist/types-ts4.5/plugins/copy-button/pm-plugins/plugin-key.d.ts +0 -2
- package/dist/types-ts4.5/plugins/copy-button/toolbar.d.ts +0 -13
- package/dist/types-ts4.5/plugins/copy-button/utils.d.ts +0 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
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
|
+
|
|
3
10
|
## 187.43.12
|
|
4
11
|
|
|
5
12
|
### 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;
|
|
@@ -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.
|
|
8
|
-
|
|
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
|
|
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,
|
|
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("
|
|
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 =
|
|
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; }
|
|
@@ -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
|
|
9
|
-
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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,
|
|
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,
|
|
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,
|
|
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
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
return
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
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.
|
|
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,
|
|
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
|
-
}])
|
|
395
|
+
}]);
|
|
396
396
|
return finalPreset;
|
|
397
397
|
}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
|
-
import { TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
3
2
|
import { clipboardPluginKey } from '../plugin-key';
|
|
4
|
-
import {
|
|
5
|
-
import { EVENT_TYPE, ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID } from '../../analytics/types/enums';
|
|
3
|
+
import { ACTION } from '../../analytics/types/enums';
|
|
6
4
|
import { DOMSerializer } from '@atlaskit/editor-prosemirror/model';
|
|
7
5
|
import { findParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
8
6
|
import { Fragment } from '@atlaskit/editor-prosemirror/model';
|
|
7
|
+
import { getAnalyticsPayload } from '@atlaskit/editor-common/clipboard';
|
|
9
8
|
export const createPlugin = ({
|
|
10
9
|
dispatchAnalyticsEvent,
|
|
11
10
|
schema
|
|
@@ -101,53 +100,4 @@ export const sendClipboardAnalytics = (view, dispatchAnalyticsEvent, action) =>
|
|
|
101
100
|
// from running just because we are sending an analytics event
|
|
102
101
|
return false;
|
|
103
102
|
};
|
|
104
|
-
export
|
|
105
|
-
const {
|
|
106
|
-
selection,
|
|
107
|
-
doc
|
|
108
|
-
} = state;
|
|
109
|
-
const selectionAnalyticsPayload = getNodeSelectionAnalyticsPayload(selection) || getRangeSelectionAnalyticsPayload(selection, doc) || getAllSelectionAnalyticsPayload(selection) || getCellSelectionAnalyticsPayload(state);
|
|
110
|
-
if (selectionAnalyticsPayload) {
|
|
111
|
-
const {
|
|
112
|
-
actionSubjectId: selectionActionSubjectId
|
|
113
|
-
} = selectionAnalyticsPayload;
|
|
114
|
-
let content = [];
|
|
115
|
-
switch (selectionActionSubjectId) {
|
|
116
|
-
case ACTION_SUBJECT_ID.NODE:
|
|
117
|
-
content.push(selectionAnalyticsPayload.attributes.node);
|
|
118
|
-
break;
|
|
119
|
-
case ACTION_SUBJECT_ID.RANGE:
|
|
120
|
-
content.push(...selectionAnalyticsPayload.attributes.nodes);
|
|
121
|
-
break;
|
|
122
|
-
case ACTION_SUBJECT_ID.ALL:
|
|
123
|
-
content.push('all');
|
|
124
|
-
break;
|
|
125
|
-
case ACTION_SUBJECT_ID.CELL:
|
|
126
|
-
{
|
|
127
|
-
const {
|
|
128
|
-
selectedCells
|
|
129
|
-
} = selectionAnalyticsPayload.attributes;
|
|
130
|
-
content.push(...Array(selectedCells).fill('tableCell'));
|
|
131
|
-
break;
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
return {
|
|
135
|
-
eventType: EVENT_TYPE.TRACK,
|
|
136
|
-
action,
|
|
137
|
-
actionSubject: ACTION_SUBJECT.DOCUMENT,
|
|
138
|
-
attributes: {
|
|
139
|
-
content
|
|
140
|
-
}
|
|
141
|
-
};
|
|
142
|
-
}
|
|
143
|
-
if (selection instanceof TextSelection && selection.$cursor) {
|
|
144
|
-
return {
|
|
145
|
-
eventType: EVENT_TYPE.TRACK,
|
|
146
|
-
action,
|
|
147
|
-
actionSubject: ACTION_SUBJECT.DOCUMENT,
|
|
148
|
-
attributes: {
|
|
149
|
-
content: ['caret']
|
|
150
|
-
}
|
|
151
|
-
};
|
|
152
|
-
}
|
|
153
|
-
};
|
|
103
|
+
export { getAnalyticsPayload };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
2
|
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
3
3
|
import { Decoration, DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
4
|
-
import { getSelectedNodeOrNodeParentByNodeType } from '
|
|
4
|
+
import { getSelectedNodeOrNodeParentByNodeType } from '@atlaskit/editor-plugin-copy-button/utils';
|
|
5
5
|
export const copySelectionPluginKey = new PluginKey('codeBlockCopySelectionPlugin');
|
|
6
6
|
function getSelectionDecorationStartAndEnd({
|
|
7
7
|
state,
|
|
@@ -16,7 +16,6 @@ import { ConfirmationModal } from './ui/ConfirmationModal';
|
|
|
16
16
|
import { ToolbarLoader } from './ui/ToolbarLoader';
|
|
17
17
|
import { findNode } from './utils';
|
|
18
18
|
import { ErrorBoundary } from '../../ui/ErrorBoundary';
|
|
19
|
-
import { processCopyButtonItems } from '../copy-button/toolbar';
|
|
20
19
|
import forceFocusPlugin, { forceFocusSelector } from './pm-plugins/force-focus';
|
|
21
20
|
export const getRelevantConfig = (selection, configs) => {
|
|
22
21
|
// node selections always take precedence, see if
|
|
@@ -219,7 +218,7 @@ function ContentComponent({
|
|
|
219
218
|
return null;
|
|
220
219
|
}
|
|
221
220
|
let customPositionCalculation;
|
|
222
|
-
const toolbarItems = processCopyButtonItems(editorView.state)(Array.isArray(items) ? items : items(node), pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.decorations.actions.hoverDecoration);
|
|
221
|
+
const 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);
|
|
223
222
|
if (onPositionCalculated) {
|
|
224
223
|
customPositionCalculation = nextPos => {
|
|
225
224
|
return onPositionCalculated(editorView, nextPos);
|
|
@@ -48,5 +48,4 @@ export { default as avatarGroupPlugin } from './avatar-group';
|
|
|
48
48
|
export { default as viewUpdateSubscriptionPlugin } from './view-update-subscription';
|
|
49
49
|
export { default as beforePrimaryToolbarPlugin } from './before-primaryToolbar';
|
|
50
50
|
export { default as codeBidiWarningPlugin } from './code-bidi-warning';
|
|
51
|
-
export { default as copyButtonPlugin } from './copy-button';
|
|
52
51
|
export { default as borderPlugin } from './border';
|