@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
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @atlaskit/editor-core
|
|
2
2
|
|
|
3
|
+
## 188.1.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#40850](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/40850) [`e7cead0f099`](https://bitbucket.org/atlassian/atlassian-frontend/commits/e7cead0f099) - Move shared messages to editor-common
|
|
8
|
+
- [#40910](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/40910) [`820e75ceeda`](https://bitbucket.org/atlassian/atlassian-frontend/commits/820e75ceeda) - Decoupling the media plugin from the paste plugin.
|
|
9
|
+
|
|
10
|
+
### Patch Changes
|
|
11
|
+
|
|
12
|
+
- [#41021](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/41021) [`79abfef6196`](https://bitbucket.org/atlassian/atlassian-frontend/commits/79abfef6196) - ED-20299 remove unnecessary entry points in editor-plugin-copy-button and refactor
|
|
13
|
+
- [#41020](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/41020) [`ab49509530f`](https://bitbucket.org/atlassian/atlassian-frontend/commits/ab49509530f) - Add editor-plugin-help-dialog
|
|
14
|
+
- Updated dependencies
|
|
15
|
+
|
|
3
16
|
## 188.0.12
|
|
4
17
|
|
|
5
18
|
### Patch Changes
|
|
@@ -4,34 +4,16 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.buildToolbar =
|
|
7
|
+
exports.buildToolbar = void 0;
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
var _reactIntlNext = require("react-intl-next");
|
|
10
9
|
var _comment = _interopRequireDefault(require("@atlaskit/icon/glyph/comment"));
|
|
11
10
|
var _keymaps = require("../../keymaps");
|
|
12
11
|
var _commands = require("./commands");
|
|
13
12
|
var _types = require("./types");
|
|
14
13
|
var _utils = require("./utils");
|
|
14
|
+
var _messages = require("@atlaskit/editor-common/messages");
|
|
15
15
|
// AFP-2532 TODO: Fix automatic suppressions below
|
|
16
16
|
// eslint-disable-next-line @atlassian/tangerine/import/entry-points
|
|
17
|
-
|
|
18
|
-
var annotationMessages = exports.annotationMessages = (0, _reactIntlNext.defineMessages)({
|
|
19
|
-
createComment: {
|
|
20
|
-
id: 'fabric.editor.createComment',
|
|
21
|
-
defaultMessage: 'Comment',
|
|
22
|
-
description: 'Create/add an inline comment based on the users selection'
|
|
23
|
-
},
|
|
24
|
-
createCommentInvalid: {
|
|
25
|
-
id: 'fabric.editor.createCommentInvalid',
|
|
26
|
-
defaultMessage: 'You can only comment on text and headings',
|
|
27
|
-
description: 'Error message to communicate to the user they can only do the current action in certain contexts'
|
|
28
|
-
},
|
|
29
|
-
toolbar: {
|
|
30
|
-
id: 'fabric.editor.annotationToolbar',
|
|
31
|
-
defaultMessage: 'Annotation toolbar',
|
|
32
|
-
description: 'A label for a toolbar (UI element) that creates annotations/comments in the document'
|
|
33
|
-
}
|
|
34
|
-
});
|
|
35
17
|
/**
|
|
36
18
|
* Returns the coordintes at the bottom the selection.
|
|
37
19
|
*/
|
|
@@ -192,8 +174,8 @@ var buildToolbar = exports.buildToolbar = function buildToolbar(state, intl) {
|
|
|
192
174
|
if (selectionValid === _types.AnnotationSelectionType.INVALID) {
|
|
193
175
|
return undefined;
|
|
194
176
|
}
|
|
195
|
-
var createCommentMessage = intl.formatMessage(annotationMessages.createComment);
|
|
196
|
-
var commentDisabledMessage = intl.formatMessage(annotationMessages.createCommentInvalid);
|
|
177
|
+
var createCommentMessage = intl.formatMessage(_messages.annotationMessages.createComment);
|
|
178
|
+
var commentDisabledMessage = intl.formatMessage(_messages.annotationMessages.createCommentInvalid);
|
|
197
179
|
var createComment = {
|
|
198
180
|
type: 'button',
|
|
199
181
|
showTitle: true,
|
|
@@ -217,7 +199,7 @@ var buildToolbar = exports.buildToolbar = function buildToolbar(state, intl) {
|
|
|
217
199
|
}
|
|
218
200
|
return acc;
|
|
219
201
|
}, []);
|
|
220
|
-
var toolbarTitle = intl.formatMessage(annotationMessages.toolbar);
|
|
202
|
+
var toolbarTitle = intl.formatMessage(_messages.annotationMessages.toolbar);
|
|
221
203
|
var calcToolbarPosition = isToolbarAbove ? calculateToolbarPositionAboveSelection : calculateToolbarPositionTrackHead;
|
|
222
204
|
var onPositionCalculated = calcToolbarPosition(toolbarTitle);
|
|
223
205
|
return {
|
|
@@ -15,7 +15,7 @@ var _ideUx = _interopRequireDefault(require("./pm-plugins/ide-ux"));
|
|
|
15
15
|
var _codeBlockCopySelectionPlugin = require("./pm-plugins/codeBlockCopySelectionPlugin");
|
|
16
16
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
17
17
|
var _quickInsert = require("@atlaskit/editor-common/quick-insert");
|
|
18
|
-
var _messages = require("@atlaskit/editor-
|
|
18
|
+
var _messages = require("@atlaskit/editor-common/messages");
|
|
19
19
|
var _refreshBrowserSelection = _interopRequireDefault(require("./refresh-browser-selection"));
|
|
20
20
|
var _actions = require("./actions");
|
|
21
21
|
var _inputRule = require("./pm-plugins/input-rule");
|
|
@@ -87,8 +87,8 @@ var codeBlockPlugin = function codeBlockPlugin(_ref) {
|
|
|
87
87
|
var formatMessage = _ref5.formatMessage;
|
|
88
88
|
return [{
|
|
89
89
|
id: 'codeblock',
|
|
90
|
-
title: formatMessage(_messages.
|
|
91
|
-
description: formatMessage(_messages.
|
|
90
|
+
title: formatMessage(_messages.blockTypeMessages.codeblock),
|
|
91
|
+
description: formatMessage(_messages.blockTypeMessages.codeblockDescription),
|
|
92
92
|
keywords: ['code block'],
|
|
93
93
|
priority: 700,
|
|
94
94
|
keyshortcut: '```',
|
|
@@ -12,12 +12,12 @@ 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
|
|
15
|
+
var _copyButton = require("@atlaskit/editor-common/copy-button");
|
|
16
16
|
var copySelectionPluginKey = exports.copySelectionPluginKey = new _state.PluginKey('codeBlockCopySelectionPlugin');
|
|
17
17
|
function getSelectionDecorationStartAndEnd(_ref) {
|
|
18
18
|
var state = _ref.state,
|
|
19
19
|
transaction = _ref.transaction;
|
|
20
|
-
var codeBlockNode = (0,
|
|
20
|
+
var codeBlockNode = (0, _copyButton.getSelectedNodeOrNodeParentByNodeType)({
|
|
21
21
|
nodeType: state.schema.nodes.codeBlock,
|
|
22
22
|
selection: transaction.selection
|
|
23
23
|
});
|
|
@@ -14,7 +14,7 @@ var _keymaps = require("@atlaskit/editor-common/keymaps");
|
|
|
14
14
|
var _HelpDialogLoader = require("./ui/HelpDialogLoader");
|
|
15
15
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
16
16
|
var _questionCircle = _interopRequireDefault(require("@atlaskit/icon/glyph/question-circle"));
|
|
17
|
-
var _messages = require("
|
|
17
|
+
var _messages = require("@atlaskit/editor-common/messages");
|
|
18
18
|
var _commands = require("./commands");
|
|
19
19
|
var _pluginKey = require("./plugin-key");
|
|
20
20
|
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; }
|
|
@@ -70,8 +70,8 @@ var helpDialog = function helpDialog(_ref) {
|
|
|
70
70
|
var formatMessage = _ref3.formatMessage;
|
|
71
71
|
return [{
|
|
72
72
|
id: 'helpdialog',
|
|
73
|
-
title: formatMessage(_messages.
|
|
74
|
-
description: formatMessage(_messages.
|
|
73
|
+
title: formatMessage(_messages.toolbarInsertBlockMessages.help),
|
|
74
|
+
description: formatMessage(_messages.toolbarInsertBlockMessages.helpDescription),
|
|
75
75
|
keywords: ['?'],
|
|
76
76
|
priority: 4000,
|
|
77
77
|
keyshortcut: (0, _keymaps.tooltip)(_keymaps.openHelp),
|
|
@@ -18,12 +18,7 @@ var _styles = require("./styles");
|
|
|
18
18
|
var _keymaps = require("@atlaskit/editor-common/keymaps");
|
|
19
19
|
var _ToolbarButton = _interopRequireDefault(require("../../../ui/ToolbarButton"));
|
|
20
20
|
var _messages = require("@atlaskit/editor-common/messages");
|
|
21
|
-
var _messages2 = require("../../insert-block/ui/ToolbarInsertBlock/messages");
|
|
22
|
-
var _messages3 = require("@atlaskit/editor-plugin-block-type/messages");
|
|
23
|
-
var _messages4 = require("../../undo-redo/messages");
|
|
24
|
-
var _messages5 = require("../../../ui/Alignment/messages");
|
|
25
21
|
var _commands = require("../commands");
|
|
26
|
-
var _toolbar = require("../../annotation/toolbar");
|
|
27
22
|
var _hooks = require("@atlaskit/editor-common/hooks");
|
|
28
23
|
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); }
|
|
29
24
|
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; }
|
|
@@ -147,7 +142,7 @@ var formatting = exports.formatting = function formatting(_ref2) {
|
|
|
147
142
|
return _keymaps.toggleSuperscript;
|
|
148
143
|
}
|
|
149
144
|
}, {
|
|
150
|
-
name: formatMessage(
|
|
145
|
+
name: formatMessage(_messages.blockTypeMessages.heading1),
|
|
151
146
|
type: 'heading',
|
|
152
147
|
keymap: function keymap() {
|
|
153
148
|
return _keymaps.toggleHeading1;
|
|
@@ -160,7 +155,7 @@ var formatting = exports.formatting = function formatting(_ref2) {
|
|
|
160
155
|
}, "Space"));
|
|
161
156
|
}
|
|
162
157
|
}, {
|
|
163
|
-
name: formatMessage(
|
|
158
|
+
name: formatMessage(_messages.blockTypeMessages.heading2),
|
|
164
159
|
type: 'heading',
|
|
165
160
|
keymap: function keymap() {
|
|
166
161
|
return _keymaps.toggleHeading2;
|
|
@@ -173,7 +168,7 @@ var formatting = exports.formatting = function formatting(_ref2) {
|
|
|
173
168
|
}, "Space"));
|
|
174
169
|
}
|
|
175
170
|
}, {
|
|
176
|
-
name: formatMessage(
|
|
171
|
+
name: formatMessage(_messages.blockTypeMessages.heading3),
|
|
177
172
|
type: 'heading',
|
|
178
173
|
keymap: function keymap() {
|
|
179
174
|
return _keymaps.toggleHeading3;
|
|
@@ -186,7 +181,7 @@ var formatting = exports.formatting = function formatting(_ref2) {
|
|
|
186
181
|
}, "Space"));
|
|
187
182
|
}
|
|
188
183
|
}, {
|
|
189
|
-
name: formatMessage(
|
|
184
|
+
name: formatMessage(_messages.blockTypeMessages.heading4),
|
|
190
185
|
type: 'heading',
|
|
191
186
|
keymap: function keymap() {
|
|
192
187
|
return _keymaps.toggleHeading4;
|
|
@@ -199,7 +194,7 @@ var formatting = exports.formatting = function formatting(_ref2) {
|
|
|
199
194
|
}, "Space"));
|
|
200
195
|
}
|
|
201
196
|
}, {
|
|
202
|
-
name: formatMessage(
|
|
197
|
+
name: formatMessage(_messages.blockTypeMessages.heading5),
|
|
203
198
|
type: 'heading',
|
|
204
199
|
keymap: function keymap() {
|
|
205
200
|
return _keymaps.toggleHeading5;
|
|
@@ -212,7 +207,7 @@ var formatting = exports.formatting = function formatting(_ref2) {
|
|
|
212
207
|
}, "Space"));
|
|
213
208
|
}
|
|
214
209
|
}, {
|
|
215
|
-
name: formatMessage(
|
|
210
|
+
name: formatMessage(_messages.blockTypeMessages.heading6),
|
|
216
211
|
type: 'heading',
|
|
217
212
|
keymap: function keymap() {
|
|
218
213
|
return _keymaps.toggleHeading6;
|
|
@@ -225,7 +220,7 @@ var formatting = exports.formatting = function formatting(_ref2) {
|
|
|
225
220
|
}, "Space"));
|
|
226
221
|
}
|
|
227
222
|
}, {
|
|
228
|
-
name: formatMessage(
|
|
223
|
+
name: formatMessage(_messages.blockTypeMessages.normal),
|
|
229
224
|
type: 'paragraph',
|
|
230
225
|
keymap: function keymap() {
|
|
231
226
|
return _keymaps.setNormalText;
|
|
@@ -257,7 +252,7 @@ var formatting = exports.formatting = function formatting(_ref2) {
|
|
|
257
252
|
}, "Space"));
|
|
258
253
|
}
|
|
259
254
|
}, {
|
|
260
|
-
name: formatMessage(
|
|
255
|
+
name: formatMessage(_messages.blockTypeMessages.blockquote),
|
|
261
256
|
type: 'blockquote',
|
|
262
257
|
keymap: function keymap() {
|
|
263
258
|
return _keymaps.toggleBlockQuote;
|
|
@@ -270,7 +265,7 @@ var formatting = exports.formatting = function formatting(_ref2) {
|
|
|
270
265
|
}, "Space"));
|
|
271
266
|
}
|
|
272
267
|
}, {
|
|
273
|
-
name: formatMessage(
|
|
268
|
+
name: formatMessage(_messages.blockTypeMessages.codeblock),
|
|
274
269
|
type: 'codeBlock',
|
|
275
270
|
autoFormatting: function autoFormatting() {
|
|
276
271
|
return (0, _react2.jsx)("span", null, (0, _react2.jsx)("span", {
|
|
@@ -278,7 +273,7 @@ var formatting = exports.formatting = function formatting(_ref2) {
|
|
|
278
273
|
}, "```"));
|
|
279
274
|
}
|
|
280
275
|
}, {
|
|
281
|
-
name: formatMessage(
|
|
276
|
+
name: formatMessage(_messages.toolbarInsertBlockMessages.horizontalRule),
|
|
282
277
|
type: 'rule',
|
|
283
278
|
keymap: function keymap() {
|
|
284
279
|
return _keymaps.insertRule;
|
|
@@ -289,7 +284,7 @@ var formatting = exports.formatting = function formatting(_ref2) {
|
|
|
289
284
|
}, "---"));
|
|
290
285
|
}
|
|
291
286
|
}, {
|
|
292
|
-
name: formatMessage(
|
|
287
|
+
name: formatMessage(_messages.toolbarInsertBlockMessages.link),
|
|
293
288
|
type: 'link',
|
|
294
289
|
keymap: function keymap() {
|
|
295
290
|
return _keymaps.addLink;
|
|
@@ -297,7 +292,7 @@ var formatting = exports.formatting = function formatting(_ref2) {
|
|
|
297
292
|
autoFormatting: function autoFormatting() {
|
|
298
293
|
return (0, _react2.jsx)("span", null, (0, _react2.jsx)("span", {
|
|
299
294
|
css: _styles.codeLg
|
|
300
|
-
}, "[", (0, _react2.jsx)(_reactIntlNext.FormattedMessage,
|
|
295
|
+
}, "[", (0, _react2.jsx)(_reactIntlNext.FormattedMessage, _messages.toolbarInsertBlockMessages.link), "](http://a.com)"));
|
|
301
296
|
}
|
|
302
297
|
}, {
|
|
303
298
|
name: formatMessage(_messages.toolbarMessages.code),
|
|
@@ -311,7 +306,7 @@ var formatting = exports.formatting = function formatting(_ref2) {
|
|
|
311
306
|
}, "`", (0, _react2.jsx)(_reactIntlNext.FormattedMessage, _messages.toolbarMessages.code), "`"));
|
|
312
307
|
}
|
|
313
308
|
}, {
|
|
314
|
-
name: formatMessage(
|
|
309
|
+
name: formatMessage(_messages.toolbarInsertBlockMessages.action),
|
|
315
310
|
type: 'taskItem',
|
|
316
311
|
autoFormatting: function autoFormatting() {
|
|
317
312
|
return (0, _react2.jsx)("span", null, (0, _react2.jsx)("span", {
|
|
@@ -321,7 +316,7 @@ var formatting = exports.formatting = function formatting(_ref2) {
|
|
|
321
316
|
}, "Space"));
|
|
322
317
|
}
|
|
323
318
|
}, {
|
|
324
|
-
name: formatMessage(
|
|
319
|
+
name: formatMessage(_messages.toolbarInsertBlockMessages.decision),
|
|
325
320
|
type: 'decisionItem',
|
|
326
321
|
autoFormatting: function autoFormatting() {
|
|
327
322
|
return (0, _react2.jsx)("span", null, (0, _react2.jsx)("span", {
|
|
@@ -331,7 +326,7 @@ var formatting = exports.formatting = function formatting(_ref2) {
|
|
|
331
326
|
}, "Space"));
|
|
332
327
|
}
|
|
333
328
|
}, {
|
|
334
|
-
name: formatMessage(
|
|
329
|
+
name: formatMessage(_messages.toolbarInsertBlockMessages.emoji),
|
|
335
330
|
type: 'emoji',
|
|
336
331
|
autoFormatting: function autoFormatting() {
|
|
337
332
|
return (0, _react2.jsx)("span", null, (0, _react2.jsx)("span", {
|
|
@@ -339,7 +334,7 @@ var formatting = exports.formatting = function formatting(_ref2) {
|
|
|
339
334
|
}, ":"));
|
|
340
335
|
}
|
|
341
336
|
}, {
|
|
342
|
-
name: formatMessage(
|
|
337
|
+
name: formatMessage(_messages.toolbarInsertBlockMessages.mention),
|
|
343
338
|
type: 'mention',
|
|
344
339
|
autoFormatting: function autoFormatting() {
|
|
345
340
|
return (0, _react2.jsx)("span", null, (0, _react2.jsx)("span", {
|
|
@@ -347,13 +342,13 @@ var formatting = exports.formatting = function formatting(_ref2) {
|
|
|
347
342
|
}, "@"));
|
|
348
343
|
}
|
|
349
344
|
}, {
|
|
350
|
-
name: formatMessage(
|
|
345
|
+
name: formatMessage(_messages.alignmentMessages.alignLeft),
|
|
351
346
|
type: 'alignment',
|
|
352
347
|
keymap: function keymap() {
|
|
353
348
|
return _keymaps.alignLeft;
|
|
354
349
|
}
|
|
355
350
|
}, {
|
|
356
|
-
name: formatMessage(
|
|
351
|
+
name: formatMessage(_messages.alignmentMessages.alignRight),
|
|
357
352
|
type: 'alignment'
|
|
358
353
|
}];
|
|
359
354
|
};
|
|
@@ -367,13 +362,13 @@ var otherFormatting = function otherFormatting(_ref3) {
|
|
|
367
362
|
return _keymaps.clearFormatting;
|
|
368
363
|
}
|
|
369
364
|
}, {
|
|
370
|
-
name: formatMessage(
|
|
365
|
+
name: formatMessage(_messages.undoRedoMessages.undo),
|
|
371
366
|
type: 'undo',
|
|
372
367
|
keymap: function keymap() {
|
|
373
368
|
return _keymaps.undo;
|
|
374
369
|
}
|
|
375
370
|
}, {
|
|
376
|
-
name: formatMessage(
|
|
371
|
+
name: formatMessage(_messages.undoRedoMessages.redo),
|
|
377
372
|
type: 'redo',
|
|
378
373
|
keymap: function keymap() {
|
|
379
374
|
return _keymaps.redo;
|
|
@@ -385,7 +380,7 @@ var otherFormatting = function otherFormatting(_ref3) {
|
|
|
385
380
|
return _keymaps.pastePlainText;
|
|
386
381
|
}
|
|
387
382
|
}, {
|
|
388
|
-
name: formatMessage(
|
|
383
|
+
name: formatMessage(_messages.annotationMessages.createComment),
|
|
389
384
|
type: 'annotation',
|
|
390
385
|
keymap: function keymap() {
|
|
391
386
|
return _keymaps.addInlineComment;
|
|
@@ -11,7 +11,7 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
11
11
|
var _memoize = _interopRequireDefault(require("lodash/memoize"));
|
|
12
12
|
var _memoizeOne = _interopRequireDefault(require("memoize-one"));
|
|
13
13
|
var _messages = require("./messages");
|
|
14
|
-
var _messages2 = require("@atlaskit/editor-
|
|
14
|
+
var _messages2 = require("@atlaskit/editor-common/messages");
|
|
15
15
|
var _keymaps = require("../../../../keymaps");
|
|
16
16
|
var _sortItems = require("./sort-items");
|
|
17
17
|
var _item = require("./item");
|
|
@@ -137,7 +137,7 @@ var createInsertBlockItems = function createInsertBlockItems(config) {
|
|
|
137
137
|
if (codeblockData) {
|
|
138
138
|
items.push((0, _item.codeblock)({
|
|
139
139
|
content: formatMessage(codeblockData.title),
|
|
140
|
-
tooltipDescription: formatMessage(_messages2.
|
|
140
|
+
tooltipDescription: formatMessage(_messages2.blockTypeMessages.codeblockDescription),
|
|
141
141
|
disabled: false,
|
|
142
142
|
shortcut: '```'
|
|
143
143
|
}));
|
|
@@ -145,14 +145,14 @@ var createInsertBlockItems = function createInsertBlockItems(config) {
|
|
|
145
145
|
if (panelData) {
|
|
146
146
|
items.push((0, _item.panel)({
|
|
147
147
|
content: formatMessage(panelData.title),
|
|
148
|
-
tooltipDescription: formatMessage(_messages2.
|
|
148
|
+
tooltipDescription: formatMessage(_messages2.blockTypeMessages.infoPanelDescription),
|
|
149
149
|
disabled: false
|
|
150
150
|
}));
|
|
151
151
|
}
|
|
152
152
|
if (blockquoteData) {
|
|
153
153
|
items.push((0, _item.blockquote)({
|
|
154
154
|
content: formatMessage(blockquoteData.title),
|
|
155
|
-
tooltipDescription: formatMessage(_messages2.
|
|
155
|
+
tooltipDescription: formatMessage(_messages2.blockTypeMessages.blockquoteDescription),
|
|
156
156
|
disabled: false,
|
|
157
157
|
shortcut: '>'
|
|
158
158
|
}));
|
|
@@ -67,6 +67,12 @@ var mediaPlugin = function mediaPlugin(_ref2) {
|
|
|
67
67
|
}
|
|
68
68
|
return _pluginKey.stateKey.getState(editorState) || null;
|
|
69
69
|
},
|
|
70
|
+
actions: {
|
|
71
|
+
insertMediaAsMediaSingle: function insertMediaAsMediaSingle(view, node, inputMethod) {
|
|
72
|
+
var _api$analytics;
|
|
73
|
+
return (0, _mediaSingle2.insertMediaAsMediaSingle)(view, node, inputMethod, api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions);
|
|
74
|
+
}
|
|
75
|
+
},
|
|
70
76
|
nodes: function nodes() {
|
|
71
77
|
var _ref3 = options || {},
|
|
72
78
|
_ref3$allowMediaGroup = _ref3.allowMediaGroup,
|
|
@@ -147,8 +153,8 @@ var mediaPlugin = function mediaPlugin(_ref2) {
|
|
|
147
153
|
}, {
|
|
148
154
|
name: 'mediaKeymap',
|
|
149
155
|
plugin: function plugin() {
|
|
150
|
-
var _api$
|
|
151
|
-
return (0, _keymap3.default)(options, api === null || api === void 0 || (_api$
|
|
156
|
+
var _api$analytics2;
|
|
157
|
+
return (0, _keymap3.default)(options, api === null || api === void 0 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions);
|
|
152
158
|
}
|
|
153
159
|
}];
|
|
154
160
|
if (options && options.allowMediaSingle) {
|
|
@@ -168,9 +174,9 @@ var mediaPlugin = function mediaPlugin(_ref2) {
|
|
|
168
174
|
pmPlugins.push({
|
|
169
175
|
name: 'mediaAltTextKeymap',
|
|
170
176
|
plugin: function plugin(_ref6) {
|
|
171
|
-
var _api$
|
|
177
|
+
var _api$analytics3;
|
|
172
178
|
var schema = _ref6.schema;
|
|
173
|
-
return (0, _keymap.default)(schema, api === null || api === void 0 || (_api$
|
|
179
|
+
return (0, _keymap.default)(schema, api === null || api === void 0 || (_api$analytics3 = api.analytics) === null || _api$analytics3 === void 0 ? void 0 : _api$analytics3.actions);
|
|
174
180
|
}
|
|
175
181
|
});
|
|
176
182
|
}
|
|
@@ -253,11 +259,11 @@ var mediaPlugin = function mediaPlugin(_ref2) {
|
|
|
253
259
|
return /*#__PURE__*/_react.default.createElement(_quickInsert.IconImages, null);
|
|
254
260
|
},
|
|
255
261
|
action: function action(insert, state) {
|
|
256
|
-
var _api$
|
|
262
|
+
var _api$analytics4;
|
|
257
263
|
var pluginState = _main.stateKey.getState(state);
|
|
258
264
|
pluginState === null || pluginState === void 0 || pluginState.showMediaPicker();
|
|
259
265
|
var tr = insert('');
|
|
260
|
-
api === null || api === void 0 || (_api$
|
|
266
|
+
api === null || api === void 0 || (_api$analytics4 = api.analytics) === null || _api$analytics4 === void 0 || _api$analytics4.actions.attachAnalyticsEvent({
|
|
261
267
|
action: _analytics.ACTION.OPENED,
|
|
262
268
|
actionSubject: _analytics.ACTION_SUBJECT.PICKER,
|
|
263
269
|
actionSubjectId: _analytics.ACTION_SUBJECT_ID.PICKER_CLOUD,
|
|
@@ -3,13 +3,12 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.splitMediaGroup = exports.removeMediaNode = exports.posOfPrecedingMediaGroup = exports.posOfParentMediaGroup = exports.posOfMediaGroupNearby = exports.isSelectionNonMediaBlockNode = exports.isSelectionMediaSingleNode = exports.isMediaBlobUrlFromAttrs = exports.isInsidePotentialEmptyParagraph = exports.getMediaNodeFromSelection = exports.copyOptionalAttrsFromMediaState = void 0;
|
|
7
|
+
var _selection = require("@atlaskit/editor-common/selection");
|
|
8
|
+
var _utils = require("@atlaskit/editor-common/utils");
|
|
7
9
|
var _commands = require("@atlaskit/editor-prosemirror/commands");
|
|
8
10
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
9
|
-
var
|
|
10
|
-
var _utils2 = require("@atlaskit/editor-common/utils");
|
|
11
|
-
var _isImage = require("./is-image");
|
|
12
|
-
var _selection = require("@atlaskit/editor-common/selection");
|
|
11
|
+
var _utils2 = require("@atlaskit/editor-prosemirror/utils");
|
|
13
12
|
var _mediaClient = require("@atlaskit/media-client");
|
|
14
13
|
var isTemporary = function isTemporary(id) {
|
|
15
14
|
return id.indexOf('temporary:') === 0;
|
|
@@ -132,7 +131,7 @@ var removeMediaNode = exports.removeMediaNode = function removeMediaNode(view, n
|
|
|
132
131
|
// Prosemirror didn't gave us the behaviour of moving left if the media node is not the last one.
|
|
133
132
|
// So we handle it ourselves.
|
|
134
133
|
if (selection.from === currentMediaNodePos && !isLastMediaNode && !(0, _selection.atTheBeginningOfDoc)(state) && nodeBefore && nodeBefore.type.name === 'media') {
|
|
135
|
-
var _nodeBefore = (0,
|
|
134
|
+
var _nodeBefore = (0, _utils2.findPositionOfNodeBefore)(tr.selection);
|
|
136
135
|
if (_nodeBefore) {
|
|
137
136
|
tr.setSelection(_state.NodeSelection.create(tr.doc, _nodeBefore));
|
|
138
137
|
}
|
|
@@ -149,9 +148,9 @@ var splitMediaGroup = exports.splitMediaGroup = function splitMediaGroup(view) {
|
|
|
149
148
|
(0, _commands.deleteSelection)(view.state, view.dispatch);
|
|
150
149
|
if (selection.$to.nodeAfter) {
|
|
151
150
|
(0, _commands.splitBlock)(view.state, view.dispatch);
|
|
152
|
-
(0,
|
|
151
|
+
(0, _utils.createParagraphNear)(false)(view.state, view.dispatch);
|
|
153
152
|
} else {
|
|
154
|
-
(0,
|
|
153
|
+
(0, _utils.createNewParagraphBelow)(view.state, view.dispatch);
|
|
155
154
|
}
|
|
156
155
|
return true;
|
|
157
156
|
};
|
|
@@ -168,107 +167,6 @@ var copyOptionalAttrsFromMediaState = exports.copyOptionalAttrsFromMediaState =
|
|
|
168
167
|
}
|
|
169
168
|
});
|
|
170
169
|
};
|
|
171
|
-
var transformSliceToCorrectMediaWrapper = exports.transformSliceToCorrectMediaWrapper = function transformSliceToCorrectMediaWrapper(slice, schema) {
|
|
172
|
-
var _schema$nodes = schema.nodes,
|
|
173
|
-
mediaGroup = _schema$nodes.mediaGroup,
|
|
174
|
-
mediaSingle = _schema$nodes.mediaSingle,
|
|
175
|
-
media = _schema$nodes.media;
|
|
176
|
-
return (0, _utils2.mapSlice)(slice, function (node, parent) {
|
|
177
|
-
if (!parent && node.type === media) {
|
|
178
|
-
if (mediaSingle && ((0, _isImage.isImage)(node.attrs.__fileMimeType) || node.attrs.type === 'external')) {
|
|
179
|
-
return mediaSingle.createChecked({}, node);
|
|
180
|
-
} else {
|
|
181
|
-
return mediaGroup.createChecked({}, [node]);
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
return node;
|
|
185
|
-
});
|
|
186
|
-
};
|
|
187
|
-
|
|
188
|
-
/**
|
|
189
|
-
* Check base styles to see if an element will be invisible when rendered in a document.
|
|
190
|
-
* @param element
|
|
191
|
-
*/
|
|
192
|
-
var isElementInvisible = function isElementInvisible(element) {
|
|
193
|
-
return element.style.opacity === '0' || element.style.display === 'none' || element.style.visibility === 'hidden';
|
|
194
|
-
};
|
|
195
|
-
var VALID_TAGS_CONTAINER = ['DIV', 'TD'];
|
|
196
|
-
function canContainImage(element) {
|
|
197
|
-
if (!element) {
|
|
198
|
-
return false;
|
|
199
|
-
}
|
|
200
|
-
return VALID_TAGS_CONTAINER.indexOf(element.tagName) !== -1;
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
/**
|
|
204
|
-
* Given a html string, we attempt to hoist any nested `<img>` tags,
|
|
205
|
-
* not directly wrapped by a `<div>` as ProseMirror no-op's
|
|
206
|
-
* on those scenarios.
|
|
207
|
-
* @param html
|
|
208
|
-
*/
|
|
209
|
-
var unwrapNestedMediaElements = exports.unwrapNestedMediaElements = function unwrapNestedMediaElements(html) {
|
|
210
|
-
var parser = new DOMParser();
|
|
211
|
-
var doc = parser.parseFromString(html, 'text/html');
|
|
212
|
-
var wrapper = doc.body;
|
|
213
|
-
|
|
214
|
-
// Remove Google Doc's wrapper <b> el
|
|
215
|
-
var docsWrapper = wrapper.querySelector('b[id^="docs-internal-guid-"]');
|
|
216
|
-
if (docsWrapper) {
|
|
217
|
-
(0, _utils2.unwrap)(wrapper, docsWrapper);
|
|
218
|
-
}
|
|
219
|
-
var imageTags = wrapper.querySelectorAll('img');
|
|
220
|
-
if (!imageTags.length) {
|
|
221
|
-
return html;
|
|
222
|
-
}
|
|
223
|
-
imageTags.forEach(function (imageTag) {
|
|
224
|
-
// Capture the immediate parent, we may remove the media from here later.
|
|
225
|
-
var mediaParent = imageTag.parentElement;
|
|
226
|
-
if (!mediaParent) {
|
|
227
|
-
return;
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
// If either the parent or the image itself contains styles that would make
|
|
231
|
-
// them invisible on copy, dont paste them.
|
|
232
|
-
if (isElementInvisible(mediaParent) || isElementInvisible(imageTag)) {
|
|
233
|
-
mediaParent.removeChild(imageTag);
|
|
234
|
-
return;
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
// If its wrapped by a valid container we assume its safe to bypass.
|
|
238
|
-
// ProseMirror should handle these cases properly.
|
|
239
|
-
if (canContainImage(mediaParent) || mediaParent instanceof HTMLSpanElement && mediaParent.closest('[class*="emoji-common"]')) {
|
|
240
|
-
return;
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
// Find the top most element that the parent has a valid container for the image.
|
|
244
|
-
// Stop just before found the wrapper
|
|
245
|
-
var insertBeforeElement = (0, _utils2.walkUpTreeUntil)(mediaParent, function (element) {
|
|
246
|
-
// If is at the top just use this element as reference
|
|
247
|
-
if (element.parentElement === wrapper) {
|
|
248
|
-
return true;
|
|
249
|
-
}
|
|
250
|
-
return canContainImage(element.parentElement);
|
|
251
|
-
});
|
|
252
|
-
|
|
253
|
-
// Here we try to insert the media right after its top most valid parent element
|
|
254
|
-
// Unless its the last element in our structure then we will insert above it.
|
|
255
|
-
if (insertBeforeElement && insertBeforeElement.parentElement) {
|
|
256
|
-
// Insert as close as possible to the most closest valid element index in the tree.
|
|
257
|
-
insertBeforeElement.parentElement.insertBefore(imageTag, insertBeforeElement.nextElementSibling || insertBeforeElement);
|
|
258
|
-
|
|
259
|
-
// Attempt to clean up lines left behind by the image
|
|
260
|
-
mediaParent.innerText = mediaParent.innerText.trim();
|
|
261
|
-
// Walk up and delete empty elements left over after removing the image tag
|
|
262
|
-
(0, _utils2.removeNestedEmptyEls)(mediaParent);
|
|
263
|
-
}
|
|
264
|
-
});
|
|
265
|
-
|
|
266
|
-
// If last child is a hardbreak we don't want it
|
|
267
|
-
if (wrapper.lastElementChild && wrapper.lastElementChild.tagName === 'BR') {
|
|
268
|
-
wrapper.removeChild(wrapper.lastElementChild);
|
|
269
|
-
}
|
|
270
|
-
return wrapper.innerHTML;
|
|
271
|
-
};
|
|
272
170
|
var getMediaNodeFromSelection = exports.getMediaNodeFromSelection = function getMediaNodeFromSelection(state) {
|
|
273
171
|
if (!isSelectionMediaSingleNode(state)) {
|
|
274
172
|
return null;
|