@atlaskit/editor-core 188.0.12 → 188.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +13 -0
- package/dist/cjs/plugins/annotation/toolbar.js +5 -23
- package/dist/cjs/plugins/code-block/index.js +3 -3
- package/dist/cjs/plugins/code-block/pm-plugins/codeBlockCopySelectionPlugin.js +2 -2
- package/dist/cjs/plugins/help-dialog/index.js +3 -3
- package/dist/cjs/plugins/help-dialog/ui/index.js +21 -26
- package/dist/cjs/plugins/insert-block/ui/ToolbarInsertBlock/create-items.js +4 -4
- package/dist/cjs/plugins/media/index.js +12 -6
- package/dist/cjs/plugins/media/utils/media-common.js +7 -109
- package/dist/cjs/plugins/media/utils/media-single.js +7 -68
- package/dist/cjs/plugins/panel/index.js +13 -13
- package/dist/cjs/plugins/paste/handlers.js +4 -4
- package/dist/cjs/plugins/paste/plugins/media.js +181 -0
- package/dist/cjs/plugins/paste/pm-plugins/analytics.js +2 -2
- package/dist/cjs/plugins/paste/pm-plugins/main.js +6 -7
- package/dist/cjs/plugins/undo-redo/ui/ToolbarUndoRedo/index.js +3 -3
- package/dist/cjs/ui/Alignment/index.js +1 -1
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/es2019/plugins/annotation/toolbar.js +2 -18
- package/dist/es2019/plugins/code-block/index.js +3 -3
- package/dist/es2019/plugins/code-block/pm-plugins/codeBlockCopySelectionPlugin.js +1 -1
- package/dist/es2019/plugins/help-dialog/index.js +1 -1
- package/dist/es2019/plugins/help-dialog/ui/index.js +8 -13
- package/dist/es2019/plugins/insert-block/ui/ToolbarInsertBlock/create-items.js +1 -1
- package/dist/es2019/plugins/media/index.js +13 -6
- package/dist/es2019/plugins/media/utils/media-common.js +2 -107
- package/dist/es2019/plugins/media/utils/media-single.js +6 -72
- package/dist/es2019/plugins/panel/index.js +13 -13
- package/dist/es2019/plugins/paste/handlers.js +4 -4
- package/dist/es2019/plugins/paste/plugins/media.js +176 -0
- package/dist/es2019/plugins/paste/pm-plugins/analytics.js +2 -2
- package/dist/es2019/plugins/paste/pm-plugins/main.js +3 -4
- package/dist/es2019/plugins/undo-redo/ui/ToolbarUndoRedo/index.js +3 -3
- package/dist/es2019/ui/Alignment/index.js +1 -1
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/esm/plugins/annotation/toolbar.js +2 -18
- package/dist/esm/plugins/code-block/index.js +3 -3
- package/dist/esm/plugins/code-block/pm-plugins/codeBlockCopySelectionPlugin.js +1 -1
- package/dist/esm/plugins/help-dialog/index.js +1 -1
- package/dist/esm/plugins/help-dialog/ui/index.js +8 -13
- package/dist/esm/plugins/insert-block/ui/ToolbarInsertBlock/create-items.js +1 -1
- package/dist/esm/plugins/media/index.js +13 -6
- package/dist/esm/plugins/media/utils/media-common.js +2 -106
- package/dist/esm/plugins/media/utils/media-single.js +6 -66
- package/dist/esm/plugins/panel/index.js +13 -13
- package/dist/esm/plugins/paste/handlers.js +4 -4
- package/dist/esm/plugins/paste/plugins/media.js +172 -0
- package/dist/esm/plugins/paste/pm-plugins/analytics.js +2 -2
- package/dist/esm/plugins/paste/pm-plugins/main.js +3 -4
- package/dist/esm/plugins/undo-redo/ui/ToolbarUndoRedo/index.js +3 -3
- package/dist/esm/ui/Alignment/index.js +1 -1
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/types/labs/next/presets/default.d.ts +6 -0
- package/dist/types/plugins/annotation/toolbar.d.ts +0 -17
- package/dist/types/plugins/help-dialog/index.d.ts +2 -15
- package/dist/types/plugins/media/next-plugin-type.d.ts +4 -0
- package/dist/types/plugins/media/utils/media-common.d.ts +2 -10
- package/dist/types/plugins/media/utils/media-single.d.ts +2 -4
- package/dist/types/plugins/paste/handlers.d.ts +2 -2
- package/dist/types/plugins/paste/index.d.ts +5 -2
- package/dist/types/plugins/paste/plugins/media.d.ts +12 -0
- package/dist/types/plugins/paste/pm-plugins/analytics.d.ts +2 -2
- package/dist/types/plugins/paste/pm-plugins/main.d.ts +2 -2
- package/dist/types/ui/Alignment/index.d.ts +2 -2
- package/dist/types/ui/Appearance/FullPage/StyledComponents.d.ts +1 -1
- package/dist/types/ui/ContentStyles/index.d.ts +2 -2
- package/dist/types-ts4.5/labs/next/presets/default.d.ts +6 -0
- package/dist/types-ts4.5/plugins/annotation/toolbar.d.ts +0 -17
- package/dist/types-ts4.5/plugins/help-dialog/index.d.ts +2 -15
- package/dist/types-ts4.5/plugins/media/next-plugin-type.d.ts +4 -0
- package/dist/types-ts4.5/plugins/media/utils/media-common.d.ts +2 -10
- package/dist/types-ts4.5/plugins/media/utils/media-single.d.ts +2 -4
- package/dist/types-ts4.5/plugins/paste/handlers.d.ts +2 -2
- package/dist/types-ts4.5/plugins/paste/index.d.ts +5 -2
- package/dist/types-ts4.5/plugins/paste/plugins/media.d.ts +12 -0
- package/dist/types-ts4.5/plugins/paste/pm-plugins/analytics.d.ts +2 -2
- package/dist/types-ts4.5/plugins/paste/pm-plugins/main.d.ts +2 -2
- package/dist/types-ts4.5/ui/Alignment/index.d.ts +2 -2
- package/dist/types-ts4.5/ui/Appearance/FullPage/StyledComponents.d.ts +1 -1
- package/dist/types-ts4.5/ui/ContentStyles/index.d.ts +2 -2
- package/package.json +6 -5
- package/dist/cjs/plugins/undo-redo/messages.js +0 -19
- package/dist/cjs/ui/Alignment/messages.js +0 -24
- package/dist/es2019/plugins/undo-redo/messages.js +0 -13
- package/dist/es2019/ui/Alignment/messages.js +0 -18
- package/dist/esm/plugins/undo-redo/messages.js +0 -13
- package/dist/esm/ui/Alignment/messages.js +0 -18
- package/dist/types/plugins/undo-redo/messages.d.ts +0 -12
- package/dist/types/ui/Alignment/messages.d.ts +0 -17
- package/dist/types-ts4.5/plugins/undo-redo/messages.d.ts +0 -12
- package/dist/types-ts4.5/ui/Alignment/messages.d.ts +0 -17
|
@@ -7,19 +7,17 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.insertMediaSingleNode = exports.insertMediaAsMediaSingle = exports.createMediaSingleNode = void 0;
|
|
8
8
|
exports.isCaptionNode = isCaptionNode;
|
|
9
9
|
exports.isVideo = exports.isMediaSingle = void 0;
|
|
10
|
-
exports.transformSliceForMedia = transformSliceForMedia;
|
|
11
10
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
12
|
-
var _model = require("@atlaskit/editor-prosemirror/model");
|
|
13
|
-
var _utils = require("@atlaskit/editor-prosemirror/utils");
|
|
14
|
-
var _utils2 = require("@atlaskit/editor-common/utils");
|
|
15
11
|
var _mediaSingle = require("@atlaskit/editor-common/media-single");
|
|
16
|
-
var
|
|
12
|
+
var _utils = require("@atlaskit/editor-common/utils");
|
|
13
|
+
var _model = require("@atlaskit/editor-prosemirror/model");
|
|
14
|
+
var _utils2 = require("@atlaskit/editor-prosemirror/utils");
|
|
17
15
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
18
16
|
var _insert = require("@atlaskit/editor-common/insert");
|
|
19
|
-
var
|
|
17
|
+
var _mediaCommon = require("../utils/media-common");
|
|
20
18
|
var _selection = require("@atlaskit/editor-common/selection");
|
|
21
|
-
var _mediaCommon2 = require("@atlaskit/media-common");
|
|
22
19
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
20
|
+
var _isImage = require("./is-image");
|
|
23
21
|
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; }
|
|
24
22
|
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; }
|
|
25
23
|
var getInsertMediaAnalytics = function getInsertMediaAnalytics(inputMethod, fileExtension) {
|
|
@@ -36,7 +34,7 @@ var getInsertMediaAnalytics = function getInsertMediaAnalytics(inputMethod, file
|
|
|
36
34
|
};
|
|
37
35
|
};
|
|
38
36
|
function shouldAddParagraph(state) {
|
|
39
|
-
return (0, _selection.atTheBeginningOfBlock)(state) && !(0,
|
|
37
|
+
return (0, _selection.atTheBeginningOfBlock)(state) && !(0, _utils.checkNodeDown)(state.selection, state.doc, _utils.isEmptyParagraph);
|
|
40
38
|
}
|
|
41
39
|
function insertNodesWithOptionalParagraph(nodes) {
|
|
42
40
|
var analyticsAttributes = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
@@ -124,7 +122,7 @@ var insertMediaSingleNode = exports.insertMediaSingleNode = function insertMedia
|
|
|
124
122
|
}
|
|
125
123
|
if (!tr) {
|
|
126
124
|
var content = shouldAddParagraph(view.state) ? _model.Fragment.fromArray([node, state.schema.nodes.paragraph.create()]) : node;
|
|
127
|
-
tr = (0,
|
|
125
|
+
tr = (0, _utils2.safeInsert)(content, undefined, true)(state.tr);
|
|
128
126
|
}
|
|
129
127
|
if (inputMethod) {
|
|
130
128
|
editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 || editorAnalyticsAPI.attachAnalyticsEvent(getInsertMediaAnalytics(inputMethod, fileExtension))(tr);
|
|
@@ -170,65 +168,6 @@ var createMediaSingleNode = exports.createMediaSingleNode = function createMedia
|
|
|
170
168
|
return mediaSingle.createChecked(extendedMediaSingleAttrs, mediaNode);
|
|
171
169
|
};
|
|
172
170
|
};
|
|
173
|
-
function transformSliceForMedia(slice, schema) {
|
|
174
|
-
var _schema$nodes2 = schema.nodes,
|
|
175
|
-
mediaSingle = _schema$nodes2.mediaSingle,
|
|
176
|
-
layoutSection = _schema$nodes2.layoutSection,
|
|
177
|
-
table = _schema$nodes2.table,
|
|
178
|
-
bulletList = _schema$nodes2.bulletList,
|
|
179
|
-
orderedList = _schema$nodes2.orderedList,
|
|
180
|
-
media = _schema$nodes2.media,
|
|
181
|
-
mediaInline = _schema$nodes2.mediaInline,
|
|
182
|
-
expand = _schema$nodes2.expand,
|
|
183
|
-
nestedExpand = _schema$nodes2.nestedExpand;
|
|
184
|
-
return function (selection) {
|
|
185
|
-
var newSlice = slice;
|
|
186
|
-
if ((0, _utils.hasParentNodeOfType)([layoutSection, table, bulletList, orderedList, expand, nestedExpand])(selection)) {
|
|
187
|
-
newSlice = (0, _utils2.mapSlice)(newSlice, function (node) {
|
|
188
|
-
var extendedOrLegacyAttrs = (0, _platformFeatureFlags.getBooleanFF)('platform.editor.media.extended-resize-experience') ? {
|
|
189
|
-
layout: node.attrs.layout,
|
|
190
|
-
widthType: node.attrs.widthType,
|
|
191
|
-
width: node.attrs.width
|
|
192
|
-
} : {
|
|
193
|
-
layout: node.attrs.layout
|
|
194
|
-
};
|
|
195
|
-
var attrs = {};
|
|
196
|
-
if ((0, _utils.hasParentNodeOfType)([layoutSection, table])(selection)) {
|
|
197
|
-
// Supports layouts
|
|
198
|
-
attrs = _objectSpread({}, extendedOrLegacyAttrs);
|
|
199
|
-
} else if ((0, _utils.hasParentNodeOfType)([bulletList, orderedList, expand, nestedExpand])(selection)) {
|
|
200
|
-
// does not support other layouts
|
|
201
|
-
attrs = _objectSpread(_objectSpread({}, extendedOrLegacyAttrs), {}, {
|
|
202
|
-
layout: 'center'
|
|
203
|
-
});
|
|
204
|
-
}
|
|
205
|
-
return node.type.name === 'mediaSingle' ? mediaSingle.createChecked(attrs, node.content, node.marks) : node;
|
|
206
|
-
});
|
|
207
|
-
}
|
|
208
|
-
var __mediaTraceId = (0, _mediaCommon2.getRandomHex)(8);
|
|
209
|
-
newSlice = (0, _utils2.mapSlice)(newSlice, function (node) {
|
|
210
|
-
// This logic is duplicated in editor-plugin-ai where external images can be inserted
|
|
211
|
-
// from external sources through the use of AI. The editor-plugin-ai package is avoiding
|
|
212
|
-
// sharing dependencies with editor-core to support products using it with various versions
|
|
213
|
-
// of editor packages.
|
|
214
|
-
// The duplication is in the following file:
|
|
215
|
-
// packages/editor/editor-plugin-ai/src/prebuilt/content-transformers/markdown-to-pm/markdown-transformer.ts
|
|
216
|
-
if (node.type.name === 'media') {
|
|
217
|
-
return media.createChecked(_objectSpread(_objectSpread({}, node.attrs), {}, {
|
|
218
|
-
__external: node.attrs.type === 'external',
|
|
219
|
-
__mediaTraceId: node.attrs.type === 'external' ? null : __mediaTraceId
|
|
220
|
-
}), node.content, node.marks);
|
|
221
|
-
}
|
|
222
|
-
if (node.type.name === 'mediaInline') {
|
|
223
|
-
return mediaInline.createChecked(_objectSpread(_objectSpread({}, node.attrs), {}, {
|
|
224
|
-
__mediaTraceId: __mediaTraceId
|
|
225
|
-
}), node.content, node.marks);
|
|
226
|
-
}
|
|
227
|
-
return node;
|
|
228
|
-
});
|
|
229
|
-
return newSlice;
|
|
230
|
-
};
|
|
231
|
-
}
|
|
232
171
|
function isCaptionNode(editorView) {
|
|
233
172
|
var $from = editorView.state.selection.$from;
|
|
234
173
|
var immediateWrapperParentNode = editorView.state.doc.nodeAt($from.before(Math.max($from.depth, 1)));
|
|
@@ -13,7 +13,7 @@ var _keymaps = _interopRequireDefault(require("./pm-plugins/keymaps"));
|
|
|
13
13
|
var _analytics = require("../analytics");
|
|
14
14
|
var _quickInsert = require("@atlaskit/editor-common/quick-insert");
|
|
15
15
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
16
|
-
var _messages = require("@atlaskit/editor-
|
|
16
|
+
var _messages = require("@atlaskit/editor-common/messages");
|
|
17
17
|
var _colors = require("@atlaskit/theme/colors");
|
|
18
18
|
var _actions = require("./actions");
|
|
19
19
|
var panelPlugin = function panelPlugin(_ref) {
|
|
@@ -55,9 +55,9 @@ var panelPlugin = function panelPlugin(_ref) {
|
|
|
55
55
|
var formatMessage = _ref3.formatMessage;
|
|
56
56
|
var quickInsertOptions = [{
|
|
57
57
|
id: 'infopanel',
|
|
58
|
-
title: formatMessage(_messages.
|
|
58
|
+
title: formatMessage(_messages.blockTypeMessages.infoPanel),
|
|
59
59
|
keywords: ['panel'],
|
|
60
|
-
description: formatMessage(_messages.
|
|
60
|
+
description: formatMessage(_messages.blockTypeMessages.infoPanelDescription),
|
|
61
61
|
priority: 800,
|
|
62
62
|
icon: function icon() {
|
|
63
63
|
return /*#__PURE__*/_react.default.createElement(_quickInsert.IconPanel, null);
|
|
@@ -72,8 +72,8 @@ var panelPlugin = function panelPlugin(_ref) {
|
|
|
72
72
|
}
|
|
73
73
|
}, {
|
|
74
74
|
id: 'notepanel',
|
|
75
|
-
title: formatMessage(_messages.
|
|
76
|
-
description: formatMessage(_messages.
|
|
75
|
+
title: formatMessage(_messages.blockTypeMessages.notePanel),
|
|
76
|
+
description: formatMessage(_messages.blockTypeMessages.notePanelDescription),
|
|
77
77
|
priority: 1000,
|
|
78
78
|
icon: function icon() {
|
|
79
79
|
return /*#__PURE__*/_react.default.createElement(_quickInsert.IconPanelNote, null);
|
|
@@ -88,8 +88,8 @@ var panelPlugin = function panelPlugin(_ref) {
|
|
|
88
88
|
}
|
|
89
89
|
}, {
|
|
90
90
|
id: 'successpanel',
|
|
91
|
-
title: formatMessage(_messages.
|
|
92
|
-
description: formatMessage(_messages.
|
|
91
|
+
title: formatMessage(_messages.blockTypeMessages.successPanel),
|
|
92
|
+
description: formatMessage(_messages.blockTypeMessages.successPanelDescription),
|
|
93
93
|
keywords: ['tip'],
|
|
94
94
|
priority: 1000,
|
|
95
95
|
icon: function icon() {
|
|
@@ -105,8 +105,8 @@ var panelPlugin = function panelPlugin(_ref) {
|
|
|
105
105
|
}
|
|
106
106
|
}, {
|
|
107
107
|
id: 'warningpanel',
|
|
108
|
-
title: formatMessage(_messages.
|
|
109
|
-
description: formatMessage(_messages.
|
|
108
|
+
title: formatMessage(_messages.blockTypeMessages.warningPanel),
|
|
109
|
+
description: formatMessage(_messages.blockTypeMessages.warningPanelDescription),
|
|
110
110
|
priority: 1000,
|
|
111
111
|
icon: function icon() {
|
|
112
112
|
return /*#__PURE__*/_react.default.createElement(_quickInsert.IconPanelWarning, null);
|
|
@@ -121,8 +121,8 @@ var panelPlugin = function panelPlugin(_ref) {
|
|
|
121
121
|
}
|
|
122
122
|
}, {
|
|
123
123
|
id: 'errorpanel',
|
|
124
|
-
title: formatMessage(_messages.
|
|
125
|
-
description: formatMessage(_messages.
|
|
124
|
+
title: formatMessage(_messages.blockTypeMessages.errorPanel),
|
|
125
|
+
description: formatMessage(_messages.blockTypeMessages.errorPanelDescription),
|
|
126
126
|
priority: 1000,
|
|
127
127
|
icon: function icon() {
|
|
128
128
|
return /*#__PURE__*/_react.default.createElement(_quickInsert.IconPanelError, null);
|
|
@@ -139,8 +139,8 @@ var panelPlugin = function panelPlugin(_ref) {
|
|
|
139
139
|
if (options.allowCustomPanel && options.allowCustomPanelEdit) {
|
|
140
140
|
quickInsertOptions.push({
|
|
141
141
|
id: 'custompanel',
|
|
142
|
-
title: formatMessage(_messages.
|
|
143
|
-
description: formatMessage(_messages.
|
|
142
|
+
title: formatMessage(_messages.blockTypeMessages.customPanel),
|
|
143
|
+
description: formatMessage(_messages.blockTypeMessages.customPanelDescription),
|
|
144
144
|
priority: 1000,
|
|
145
145
|
icon: function icon() {
|
|
146
146
|
return /*#__PURE__*/_react.default.createElement(_quickInsert.IconCustomPanel, null);
|
|
@@ -33,10 +33,9 @@ var _v = _interopRequireDefault(require("uuid/v4"));
|
|
|
33
33
|
var _utils2 = require("@atlaskit/editor-tables/utils");
|
|
34
34
|
var _utils3 = require("../../utils");
|
|
35
35
|
var _slice = require("../../utils/slice");
|
|
36
|
-
var _analytics = require("
|
|
36
|
+
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
37
37
|
var _selection = require("@atlaskit/editor-common/selection");
|
|
38
38
|
var _macro = require("../macro");
|
|
39
|
-
var _mediaSingle = require("../media/utils/media-single");
|
|
40
39
|
var _util = require("./util");
|
|
41
40
|
var _utils4 = require("@atlaskit/editor-common/utils");
|
|
42
41
|
var _edgeCases = require("./edge-cases");
|
|
@@ -567,12 +566,13 @@ function isOnlyMediaSingle(state, slice) {
|
|
|
567
566
|
var mediaSingle = state.schema.nodes.mediaSingle;
|
|
568
567
|
return mediaSingle && slice.content.childCount === 1 && slice.content.firstChild.type === mediaSingle;
|
|
569
568
|
}
|
|
570
|
-
function handleMediaSingle(inputMethod,
|
|
569
|
+
function handleMediaSingle(inputMethod, insertMediaAsMediaSingle) {
|
|
571
570
|
return function (slice) {
|
|
572
571
|
return function (state, dispatch, view) {
|
|
573
572
|
if (view) {
|
|
574
573
|
if (isOnlyMedia(state, slice)) {
|
|
575
|
-
|
|
574
|
+
var _insertMediaAsMediaSi;
|
|
575
|
+
return (_insertMediaAsMediaSi = insertMediaAsMediaSingle === null || insertMediaAsMediaSingle === void 0 ? void 0 : insertMediaAsMediaSingle(view, slice.content.firstChild, inputMethod)) !== null && _insertMediaAsMediaSi !== void 0 ? _insertMediaAsMediaSi : false;
|
|
576
576
|
}
|
|
577
577
|
if ((0, _utils3.insideTable)(state) && isOnlyMediaSingle(state, slice)) {
|
|
578
578
|
var tr = state.tr.replaceSelection(slice);
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.isImage = void 0;
|
|
8
|
+
exports.transformSliceForMedia = transformSliceForMedia;
|
|
9
|
+
exports.unwrapNestedMediaElements = exports.transformSliceToCorrectMediaWrapper = void 0;
|
|
10
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
|
+
var _utils = require("@atlaskit/editor-prosemirror/utils");
|
|
12
|
+
var _utils2 = require("@atlaskit/editor-common/utils");
|
|
13
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
14
|
+
var _mediaCommon = require("@atlaskit/media-common");
|
|
15
|
+
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; }
|
|
16
|
+
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; }
|
|
17
|
+
function transformSliceForMedia(slice, schema) {
|
|
18
|
+
var _schema$nodes = schema.nodes,
|
|
19
|
+
mediaSingle = _schema$nodes.mediaSingle,
|
|
20
|
+
layoutSection = _schema$nodes.layoutSection,
|
|
21
|
+
table = _schema$nodes.table,
|
|
22
|
+
bulletList = _schema$nodes.bulletList,
|
|
23
|
+
orderedList = _schema$nodes.orderedList,
|
|
24
|
+
media = _schema$nodes.media,
|
|
25
|
+
mediaInline = _schema$nodes.mediaInline,
|
|
26
|
+
expand = _schema$nodes.expand,
|
|
27
|
+
nestedExpand = _schema$nodes.nestedExpand;
|
|
28
|
+
return function (selection) {
|
|
29
|
+
var newSlice = slice;
|
|
30
|
+
if ((0, _utils.hasParentNodeOfType)([layoutSection, table, bulletList, orderedList, expand, nestedExpand])(selection)) {
|
|
31
|
+
newSlice = (0, _utils2.mapSlice)(newSlice, function (node) {
|
|
32
|
+
var extendedOrLegacyAttrs = (0, _platformFeatureFlags.getBooleanFF)('platform.editor.media.extended-resize-experience') ? {
|
|
33
|
+
layout: node.attrs.layout,
|
|
34
|
+
widthType: node.attrs.widthType,
|
|
35
|
+
width: node.attrs.width
|
|
36
|
+
} : {
|
|
37
|
+
layout: node.attrs.layout
|
|
38
|
+
};
|
|
39
|
+
var attrs = {};
|
|
40
|
+
if ((0, _utils.hasParentNodeOfType)([layoutSection, table])(selection)) {
|
|
41
|
+
// Supports layouts
|
|
42
|
+
attrs = _objectSpread({}, extendedOrLegacyAttrs);
|
|
43
|
+
} else if ((0, _utils.hasParentNodeOfType)([bulletList, orderedList, expand, nestedExpand])(selection)) {
|
|
44
|
+
// does not support other layouts
|
|
45
|
+
attrs = _objectSpread(_objectSpread({}, extendedOrLegacyAttrs), {}, {
|
|
46
|
+
layout: 'center'
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
return node.type.name === 'mediaSingle' ? mediaSingle.createChecked(attrs, node.content, node.marks) : node;
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
var __mediaTraceId = (0, _mediaCommon.getRandomHex)(8);
|
|
53
|
+
newSlice = (0, _utils2.mapSlice)(newSlice, function (node) {
|
|
54
|
+
// This logic is duplicated in editor-plugin-ai where external images can be inserted
|
|
55
|
+
// from external sources through the use of AI. The editor-plugin-ai package is avoiding
|
|
56
|
+
// sharing dependencies with editor-core to support products using it with various versions
|
|
57
|
+
// of editor packages.
|
|
58
|
+
// The duplication is in the following file:
|
|
59
|
+
// packages/editor/editor-plugin-ai/src/prebuilt/content-transformers/markdown-to-pm/markdown-transformer.ts
|
|
60
|
+
if (node.type.name === 'media') {
|
|
61
|
+
return media.createChecked(_objectSpread(_objectSpread({}, node.attrs), {}, {
|
|
62
|
+
__external: node.attrs.type === 'external',
|
|
63
|
+
__mediaTraceId: node.attrs.type === 'external' ? null : __mediaTraceId
|
|
64
|
+
}), node.content, node.marks);
|
|
65
|
+
}
|
|
66
|
+
if (node.type.name === 'mediaInline') {
|
|
67
|
+
return mediaInline.createChecked(_objectSpread(_objectSpread({}, node.attrs), {}, {
|
|
68
|
+
__mediaTraceId: __mediaTraceId
|
|
69
|
+
}), node.content, node.marks);
|
|
70
|
+
}
|
|
71
|
+
return node;
|
|
72
|
+
});
|
|
73
|
+
return newSlice;
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
// TODO move this to editor-common
|
|
78
|
+
var isImage = exports.isImage = function isImage(fileType) {
|
|
79
|
+
return !!fileType && (fileType.indexOf('image/') > -1 || fileType.indexOf('video/') > -1);
|
|
80
|
+
};
|
|
81
|
+
var transformSliceToCorrectMediaWrapper = exports.transformSliceToCorrectMediaWrapper = function transformSliceToCorrectMediaWrapper(slice, schema) {
|
|
82
|
+
var _schema$nodes2 = schema.nodes,
|
|
83
|
+
mediaGroup = _schema$nodes2.mediaGroup,
|
|
84
|
+
mediaSingle = _schema$nodes2.mediaSingle,
|
|
85
|
+
media = _schema$nodes2.media;
|
|
86
|
+
return (0, _utils2.mapSlice)(slice, function (node, parent) {
|
|
87
|
+
if (!parent && node.type === media) {
|
|
88
|
+
if (mediaSingle && (isImage(node.attrs.__fileMimeType) || node.attrs.type === 'external')) {
|
|
89
|
+
return mediaSingle.createChecked({}, node);
|
|
90
|
+
} else {
|
|
91
|
+
return mediaGroup.createChecked({}, [node]);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
return node;
|
|
95
|
+
});
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Check base styles to see if an element will be invisible when rendered in a document.
|
|
100
|
+
* @param element
|
|
101
|
+
*/
|
|
102
|
+
var isElementInvisible = function isElementInvisible(element) {
|
|
103
|
+
return element.style.opacity === '0' || element.style.display === 'none' || element.style.visibility === 'hidden';
|
|
104
|
+
};
|
|
105
|
+
var VALID_TAGS_CONTAINER = ['DIV', 'TD'];
|
|
106
|
+
function canContainImage(element) {
|
|
107
|
+
if (!element) {
|
|
108
|
+
return false;
|
|
109
|
+
}
|
|
110
|
+
return VALID_TAGS_CONTAINER.indexOf(element.tagName) !== -1;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Given a html string, we attempt to hoist any nested `<img>` tags,
|
|
115
|
+
* not directly wrapped by a `<div>` as ProseMirror no-op's
|
|
116
|
+
* on those scenarios.
|
|
117
|
+
* @param html
|
|
118
|
+
*/
|
|
119
|
+
var unwrapNestedMediaElements = exports.unwrapNestedMediaElements = function unwrapNestedMediaElements(html) {
|
|
120
|
+
var parser = new DOMParser();
|
|
121
|
+
var doc = parser.parseFromString(html, 'text/html');
|
|
122
|
+
var wrapper = doc.body;
|
|
123
|
+
|
|
124
|
+
// Remove Google Doc's wrapper <b> el
|
|
125
|
+
var docsWrapper = wrapper.querySelector('b[id^="docs-internal-guid-"]');
|
|
126
|
+
if (docsWrapper) {
|
|
127
|
+
(0, _utils2.unwrap)(wrapper, docsWrapper);
|
|
128
|
+
}
|
|
129
|
+
var imageTags = wrapper.querySelectorAll('img');
|
|
130
|
+
if (!imageTags.length) {
|
|
131
|
+
return html;
|
|
132
|
+
}
|
|
133
|
+
imageTags.forEach(function (imageTag) {
|
|
134
|
+
// Capture the immediate parent, we may remove the media from here later.
|
|
135
|
+
var mediaParent = imageTag.parentElement;
|
|
136
|
+
if (!mediaParent) {
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
// If either the parent or the image itself contains styles that would make
|
|
141
|
+
// them invisible on copy, dont paste them.
|
|
142
|
+
if (isElementInvisible(mediaParent) || isElementInvisible(imageTag)) {
|
|
143
|
+
mediaParent.removeChild(imageTag);
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
// If its wrapped by a valid container we assume its safe to bypass.
|
|
148
|
+
// ProseMirror should handle these cases properly.
|
|
149
|
+
if (canContainImage(mediaParent) || mediaParent instanceof HTMLSpanElement && mediaParent.closest('[class*="emoji-common"]')) {
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
// Find the top most element that the parent has a valid container for the image.
|
|
154
|
+
// Stop just before found the wrapper
|
|
155
|
+
var insertBeforeElement = (0, _utils2.walkUpTreeUntil)(mediaParent, function (element) {
|
|
156
|
+
// If is at the top just use this element as reference
|
|
157
|
+
if (element.parentElement === wrapper) {
|
|
158
|
+
return true;
|
|
159
|
+
}
|
|
160
|
+
return canContainImage(element.parentElement);
|
|
161
|
+
});
|
|
162
|
+
|
|
163
|
+
// Here we try to insert the media right after its top most valid parent element
|
|
164
|
+
// Unless its the last element in our structure then we will insert above it.
|
|
165
|
+
if (insertBeforeElement && insertBeforeElement.parentElement) {
|
|
166
|
+
// Insert as close as possible to the most closest valid element index in the tree.
|
|
167
|
+
insertBeforeElement.parentElement.insertBefore(imageTag, insertBeforeElement.nextElementSibling || insertBeforeElement);
|
|
168
|
+
|
|
169
|
+
// Attempt to clean up lines left behind by the image
|
|
170
|
+
mediaParent.innerText = mediaParent.innerText.trim();
|
|
171
|
+
// Walk up and delete empty elements left over after removing the image tag
|
|
172
|
+
(0, _utils2.removeNestedEmptyEls)(mediaParent);
|
|
173
|
+
}
|
|
174
|
+
});
|
|
175
|
+
|
|
176
|
+
// If last child is a hardbreak we don't want it
|
|
177
|
+
if (wrapper.lastElementChild && wrapper.lastElementChild.tagName === 'BR') {
|
|
178
|
+
wrapper.removeChild(wrapper.lastElementChild);
|
|
179
|
+
}
|
|
180
|
+
return wrapper.innerHTML;
|
|
181
|
+
};
|
|
@@ -253,10 +253,10 @@ var handleCodeBlockWithAnalytics = exports.handleCodeBlockWithAnalytics = functi
|
|
|
253
253
|
type: _analytics.PasteTypes.plain
|
|
254
254
|
}))((0, _handlers.handleCodeBlock)(text));
|
|
255
255
|
};
|
|
256
|
-
var handleMediaSingleWithAnalytics = exports.handleMediaSingleWithAnalytics = function handleMediaSingleWithAnalytics(view, event, slice, type,
|
|
256
|
+
var handleMediaSingleWithAnalytics = exports.handleMediaSingleWithAnalytics = function handleMediaSingleWithAnalytics(view, event, slice, type, insertMediaAsMediaSingle) {
|
|
257
257
|
return injectAnalyticsPayloadBeforeCommand(createPasteAnalyticsPayloadBySelection(event, slice, {
|
|
258
258
|
type: type
|
|
259
|
-
}))((0, _handlers.handleMediaSingle)(_analytics.INPUT_METHOD.CLIPBOARD,
|
|
259
|
+
}))((0, _handlers.handleMediaSingle)(_analytics.INPUT_METHOD.CLIPBOARD, insertMediaAsMediaSingle)(slice));
|
|
260
260
|
};
|
|
261
261
|
var handlePastePreservingMarksWithAnalytics = exports.handlePastePreservingMarksWithAnalytics = function handlePastePreservingMarksWithAnalytics(view, event, slice, type, pluginInjectionApi) {
|
|
262
262
|
var _pluginInjectionApi$c2;
|
|
@@ -21,7 +21,7 @@ var _card = require("@atlaskit/editor-common/card");
|
|
|
21
21
|
var _slice = require("../../../utils/slice");
|
|
22
22
|
var _extensions = require("@atlaskit/editor-common/extensions");
|
|
23
23
|
var _paste = require("@atlaskit/editor-common/paste");
|
|
24
|
-
var
|
|
24
|
+
var _media = require("../plugins/media");
|
|
25
25
|
var _util = require("../util");
|
|
26
26
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
27
27
|
var _utils2 = require("../../expand/utils");
|
|
@@ -30,7 +30,6 @@ var _utils3 = require("../../code-block/utils");
|
|
|
30
30
|
var _analytics = require("./analytics");
|
|
31
31
|
var _analytics2 = require("../../analytics");
|
|
32
32
|
var _utils4 = require("../../../utils");
|
|
33
|
-
var _mediaCommon = require("../../media/utils/media-common");
|
|
34
33
|
var _commands = require("../commands");
|
|
35
34
|
var _utils5 = require("../../tasks-and-decisions/utils");
|
|
36
35
|
var _utils6 = require("../../annotation/utils");
|
|
@@ -112,7 +111,7 @@ function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFlags, pl
|
|
|
112
111
|
}
|
|
113
112
|
},
|
|
114
113
|
handlePaste: function handlePaste(view, rawEvent, slice) {
|
|
115
|
-
var _text, _analyticsPlugin$perf, _schema$nodes, _schema$nodes2, _schema$nodes3, _pluginInjectionApi$
|
|
114
|
+
var _text, _analyticsPlugin$perf, _schema$nodes, _schema$nodes2, _schema$nodes3, _pluginInjectionApi$m;
|
|
116
115
|
var event = rawEvent;
|
|
117
116
|
if (!event.clipboardData) {
|
|
118
117
|
return false;
|
|
@@ -224,7 +223,7 @@ function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFlags, pl
|
|
|
224
223
|
}
|
|
225
224
|
|
|
226
225
|
// transform slices based on destination
|
|
227
|
-
slice = (0,
|
|
226
|
+
slice = (0, _media.transformSliceForMedia)(slice, schema)(state.selection);
|
|
228
227
|
var markdownSlice;
|
|
229
228
|
if (isPlainText) {
|
|
230
229
|
var _markdownSlice;
|
|
@@ -276,7 +275,7 @@ function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFlags, pl
|
|
|
276
275
|
if ((0, _analytics.handleCodeBlockWithAnalytics)(view, event, slice, text)(state, dispatch)) {
|
|
277
276
|
return true;
|
|
278
277
|
}
|
|
279
|
-
if ((0, _analytics.handleMediaSingleWithAnalytics)(view, event, slice, isPastedFile ? _analytics2.PasteTypes.binary : _analytics2.PasteTypes.richText, pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$
|
|
278
|
+
if ((0, _analytics.handleMediaSingleWithAnalytics)(view, event, slice, isPastedFile ? _analytics2.PasteTypes.binary : _analytics2.PasteTypes.richText, pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$m = pluginInjectionApi.media) === null || _pluginInjectionApi$m === void 0 ? void 0 : _pluginInjectionApi$m.actions.insertMediaAsMediaSingle)(state, dispatch, view)) {
|
|
280
279
|
return true;
|
|
281
280
|
}
|
|
282
281
|
if ((0, _analytics.handleSelectedTableWithAnalytics)(view, event, slice)(state, dispatch)) {
|
|
@@ -395,7 +394,7 @@ function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFlags, pl
|
|
|
395
394
|
slice = (0, _utils3.transformSliceToJoinAdjacentCodeBlocks)(slice);
|
|
396
395
|
}
|
|
397
396
|
slice = (0, _utils3.transformSingleLineCodeBlockToCodeMark)(slice, schema);
|
|
398
|
-
slice = (0,
|
|
397
|
+
slice = (0, _media.transformSliceToCorrectMediaWrapper)(slice, schema);
|
|
399
398
|
slice = (0, _utils5.transformSliceToDecisionList)(slice, schema);
|
|
400
399
|
|
|
401
400
|
// splitting linebreaks into paragraphs must happen before upgrading text to lists
|
|
@@ -424,7 +423,7 @@ function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFlags, pl
|
|
|
424
423
|
}
|
|
425
424
|
}
|
|
426
425
|
if (!(0, _util.isPastedFromWord)(html) && !(0, _util.isPastedFromExcel)(html) && html.indexOf('<img ') >= 0) {
|
|
427
|
-
html = (0,
|
|
426
|
+
html = (0, _media.unwrapNestedMediaElements)(html);
|
|
428
427
|
}
|
|
429
428
|
|
|
430
429
|
// https://product-fabric.atlassian.net/browse/ED-11714
|
|
@@ -19,7 +19,7 @@ var _redo = _interopRequireDefault(require("@atlaskit/icon/glyph/redo"));
|
|
|
19
19
|
var _keymaps = require("../../../../keymaps");
|
|
20
20
|
var _styles = require("@atlaskit/editor-common/styles");
|
|
21
21
|
var _ToolbarButton = _interopRequireWildcard(require("../../../../ui/ToolbarButton"));
|
|
22
|
-
var _messages = require("
|
|
22
|
+
var _messages = require("@atlaskit/editor-common/messages");
|
|
23
23
|
var _api = require("../../../type-ahead/api");
|
|
24
24
|
var _commands = require("../../commands");
|
|
25
25
|
var _keymaps2 = require("@atlaskit/editor-common/keymaps");
|
|
@@ -73,8 +73,8 @@ var ToolbarUndoRedo = exports.ToolbarUndoRedo = /*#__PURE__*/function (_PureComp
|
|
|
73
73
|
var handleRedo = function handleRedo() {
|
|
74
74
|
forceFocus(editorView)(_commands.redoFromToolbar);
|
|
75
75
|
};
|
|
76
|
-
var labelUndo = formatMessage(_messages.
|
|
77
|
-
var labelRedo = formatMessage(_messages.
|
|
76
|
+
var labelUndo = formatMessage(_messages.undoRedoMessages.undo);
|
|
77
|
+
var labelRedo = formatMessage(_messages.undoRedoMessages.redo);
|
|
78
78
|
var canUndo = historyState.canUndo,
|
|
79
79
|
canRedo = historyState.canRedo;
|
|
80
80
|
return (0, _react2.jsx)("span", {
|
|
@@ -15,7 +15,7 @@ var _react2 = require("react");
|
|
|
15
15
|
var _reactIntlNext = require("react-intl-next");
|
|
16
16
|
var _iconMap = require("../../plugins/alignment/ui/ToolbarAlignment/icon-map");
|
|
17
17
|
var _AlignmentButton = _interopRequireDefault(require("./AlignmentButton"));
|
|
18
|
-
var _messages = require("
|
|
18
|
+
var _messages = require("@atlaskit/editor-common/messages");
|
|
19
19
|
var _styles = require("./styles");
|
|
20
20
|
var _keymaps = require("../../keymaps");
|
|
21
21
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.version = exports.nextMajorVersion = exports.name = void 0;
|
|
7
7
|
var name = exports.name = "@atlaskit/editor-core";
|
|
8
|
-
var version = exports.version = "188.0
|
|
8
|
+
var version = exports.version = "188.1.0";
|
|
9
9
|
var nextMajorVersion = exports.nextMajorVersion = function nextMajorVersion() {
|
|
10
10
|
return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
|
|
11
11
|
};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { defineMessages } from 'react-intl-next';
|
|
3
2
|
import CommentIcon from '@atlaskit/icon/glyph/comment';
|
|
4
3
|
// AFP-2532 TODO: Fix automatic suppressions below
|
|
5
4
|
// eslint-disable-next-line @atlassian/tangerine/import/entry-points
|
|
@@ -7,23 +6,8 @@ import { addInlineComment, ToolTipContent } from '../../keymaps';
|
|
|
7
6
|
import { setInlineCommentDraftState } from './commands';
|
|
8
7
|
import { AnnotationTestIds, AnnotationSelectionType } from './types';
|
|
9
8
|
import { isSelectionValid } from './utils';
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
id: 'fabric.editor.createComment',
|
|
13
|
-
defaultMessage: 'Comment',
|
|
14
|
-
description: 'Create/add an inline comment based on the users selection'
|
|
15
|
-
},
|
|
16
|
-
createCommentInvalid: {
|
|
17
|
-
id: 'fabric.editor.createCommentInvalid',
|
|
18
|
-
defaultMessage: 'You can only comment on text and headings',
|
|
19
|
-
description: 'Error message to communicate to the user they can only do the current action in certain contexts'
|
|
20
|
-
},
|
|
21
|
-
toolbar: {
|
|
22
|
-
id: 'fabric.editor.annotationToolbar',
|
|
23
|
-
defaultMessage: 'Annotation toolbar',
|
|
24
|
-
description: 'A label for a toolbar (UI element) that creates annotations/comments in the document'
|
|
25
|
-
}
|
|
26
|
-
});
|
|
9
|
+
import { annotationMessages } from '@atlaskit/editor-common/messages';
|
|
10
|
+
|
|
27
11
|
/**
|
|
28
12
|
* Returns the coordintes at the bottom the selection.
|
|
29
13
|
*/
|
|
@@ -7,7 +7,7 @@ import ideUX from './pm-plugins/ide-ux';
|
|
|
7
7
|
import { codeBlockCopySelectionPlugin } from './pm-plugins/codeBlockCopySelectionPlugin';
|
|
8
8
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, INPUT_METHOD, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
|
|
9
9
|
import { IconCode } from '@atlaskit/editor-common/quick-insert';
|
|
10
|
-
import {
|
|
10
|
+
import { blockTypeMessages } from '@atlaskit/editor-common/messages';
|
|
11
11
|
import refreshBrowserSelectionOnChange from './refresh-browser-selection';
|
|
12
12
|
import { createInsertCodeBlockTransaction, insertCodeBlockWithAnalytics } from './actions';
|
|
13
13
|
import { createCodeBlockInputRule } from './pm-plugins/input-rule';
|
|
@@ -75,8 +75,8 @@ const codeBlockPlugin = ({
|
|
|
75
75
|
formatMessage
|
|
76
76
|
}) => [{
|
|
77
77
|
id: 'codeblock',
|
|
78
|
-
title: formatMessage(
|
|
79
|
-
description: formatMessage(
|
|
78
|
+
title: formatMessage(blockTypeMessages.codeblock),
|
|
79
|
+
description: formatMessage(blockTypeMessages.codeblockDescription),
|
|
80
80
|
keywords: ['code block'],
|
|
81
81
|
priority: 700,
|
|
82
82
|
keyshortcut: '```',
|
|
@@ -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 '@atlaskit/editor-
|
|
4
|
+
import { getSelectedNodeOrNodeParentByNodeType } from '@atlaskit/editor-common/copy-button';
|
|
5
5
|
export const copySelectionPluginKey = new PluginKey('codeBlockCopySelectionPlugin');
|
|
6
6
|
function getSelectionDecorationStartAndEnd({
|
|
7
7
|
state,
|
|
@@ -5,7 +5,7 @@ import { bindKeymapWithCommand, openHelp, tooltip } from '@atlaskit/editor-commo
|
|
|
5
5
|
import { HelpDialogLoader } from './ui/HelpDialogLoader';
|
|
6
6
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
7
7
|
import QuestionCircleIcon from '@atlaskit/icon/glyph/question-circle';
|
|
8
|
-
import { messages } from '
|
|
8
|
+
import { toolbarInsertBlockMessages as messages } from '@atlaskit/editor-common/messages';
|
|
9
9
|
import { openHelpCommand } from './commands';
|
|
10
10
|
import { pluginKey } from './plugin-key';
|
|
11
11
|
export function createPlugin(dispatch, imageEnabled) {
|