@atlaskit/editor-core 188.0.12 → 188.2.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 +23 -0
- package/dist/cjs/labs/next/presets/universal.js +2 -1
- 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/index.js +0 -7
- 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/ui/WithHelpTrigger/index.js +3 -7
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/es2019/labs/next/presets/universal.js +2 -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/index.js +0 -1
- 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/ui/WithHelpTrigger/index.js +2 -7
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/esm/labs/next/presets/universal.js +2 -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/index.js +0 -1
- 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/ui/WithHelpTrigger/index.js +2 -7
- 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/index.d.ts +0 -1
- 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/ui/WithHelpTrigger/index.d.ts +0 -4
- 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/index.d.ts +0 -1
- 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/dist/types-ts4.5/ui/WithHelpTrigger/index.d.ts +0 -4
- package/package.json +8 -7
- package/report.api.md +1 -1
- package/tmp/api-report-tmp.d.ts +1 -1
- package/dist/cjs/plugins/help-dialog/commands.js +0 -19
- package/dist/cjs/plugins/help-dialog/index.js +0 -138
- package/dist/cjs/plugins/help-dialog/plugin-key.js +0 -8
- package/dist/cjs/plugins/help-dialog/ui/HelpDialogLoader.js +0 -24
- package/dist/cjs/plugins/help-dialog/ui/index.js +0 -568
- package/dist/cjs/plugins/help-dialog/ui/styles.js +0 -50
- package/dist/cjs/plugins/undo-redo/messages.js +0 -19
- package/dist/cjs/ui/Alignment/messages.js +0 -24
- package/dist/es2019/plugins/help-dialog/commands.js +0 -13
- package/dist/es2019/plugins/help-dialog/index.js +0 -125
- package/dist/es2019/plugins/help-dialog/plugin-key.js +0 -2
- package/dist/es2019/plugins/help-dialog/ui/HelpDialogLoader.js +0 -6
- package/dist/es2019/plugins/help-dialog/ui/index.js +0 -446
- package/dist/es2019/plugins/help-dialog/ui/styles.js +0 -110
- package/dist/es2019/plugins/undo-redo/messages.js +0 -13
- package/dist/es2019/ui/Alignment/messages.js +0 -18
- package/dist/esm/plugins/help-dialog/commands.js +0 -13
- package/dist/esm/plugins/help-dialog/index.js +0 -130
- package/dist/esm/plugins/help-dialog/plugin-key.js +0 -2
- package/dist/esm/plugins/help-dialog/ui/HelpDialogLoader.js +0 -12
- package/dist/esm/plugins/help-dialog/ui/index.js +0 -557
- package/dist/esm/plugins/help-dialog/ui/styles.js +0 -40
- package/dist/esm/plugins/undo-redo/messages.js +0 -13
- package/dist/esm/ui/Alignment/messages.js +0 -18
- package/dist/types/plugins/help-dialog/commands.d.ts +0 -3
- package/dist/types/plugins/help-dialog/index.d.ts +0 -18
- package/dist/types/plugins/help-dialog/plugin-key.d.ts +0 -2
- package/dist/types/plugins/help-dialog/ui/HelpDialogLoader.d.ts +0 -4
- package/dist/types/plugins/help-dialog/ui/index.d.ts +0 -27
- package/dist/types/plugins/help-dialog/ui/styles.d.ts +0 -33
- 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/help-dialog/commands.d.ts +0 -3
- package/dist/types-ts4.5/plugins/help-dialog/index.d.ts +0 -18
- package/dist/types-ts4.5/plugins/help-dialog/plugin-key.d.ts +0 -2
- package/dist/types-ts4.5/plugins/help-dialog/ui/HelpDialogLoader.d.ts +0 -4
- package/dist/types-ts4.5/plugins/help-dialog/ui/index.d.ts +0 -27
- package/dist/types-ts4.5/plugins/help-dialog/ui/styles.d.ts +0 -33
- 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
|
@@ -1,11 +1,8 @@
|
|
|
1
|
+
import { atTheBeginningOfBlock, atTheBeginningOfDoc, atTheEndOfBlock, endPositionOfParent, GapCursorSelection, startPositionOfParent } from '@atlaskit/editor-common/selection';
|
|
2
|
+
import { createNewParagraphBelow, createParagraphNear } from '@atlaskit/editor-common/utils';
|
|
1
3
|
import { deleteSelection, splitBlock } from '@atlaskit/editor-prosemirror/commands';
|
|
2
4
|
import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
|
|
3
5
|
import { findPositionOfNodeBefore } from '@atlaskit/editor-prosemirror/utils';
|
|
4
|
-
import { createParagraphNear, createNewParagraphBelow } from '@atlaskit/editor-common/utils';
|
|
5
|
-
import { mapSlice } from '@atlaskit/editor-common/utils';
|
|
6
|
-
import { walkUpTreeUntil, removeNestedEmptyEls, unwrap } from '@atlaskit/editor-common/utils';
|
|
7
|
-
import { isImage } from './is-image';
|
|
8
|
-
import { GapCursorSelection, atTheBeginningOfBlock, atTheBeginningOfDoc, atTheEndOfBlock, endPositionOfParent, startPositionOfParent } from '@atlaskit/editor-common/selection';
|
|
9
6
|
import { isMediaBlobUrl } from '@atlaskit/media-client';
|
|
10
7
|
var isTemporary = function isTemporary(id) {
|
|
11
8
|
return id.indexOf('temporary:') === 0;
|
|
@@ -164,107 +161,6 @@ export var copyOptionalAttrsFromMediaState = function copyOptionalAttrsFromMedia
|
|
|
164
161
|
}
|
|
165
162
|
});
|
|
166
163
|
};
|
|
167
|
-
export var transformSliceToCorrectMediaWrapper = function transformSliceToCorrectMediaWrapper(slice, schema) {
|
|
168
|
-
var _schema$nodes = schema.nodes,
|
|
169
|
-
mediaGroup = _schema$nodes.mediaGroup,
|
|
170
|
-
mediaSingle = _schema$nodes.mediaSingle,
|
|
171
|
-
media = _schema$nodes.media;
|
|
172
|
-
return mapSlice(slice, function (node, parent) {
|
|
173
|
-
if (!parent && node.type === media) {
|
|
174
|
-
if (mediaSingle && (isImage(node.attrs.__fileMimeType) || node.attrs.type === 'external')) {
|
|
175
|
-
return mediaSingle.createChecked({}, node);
|
|
176
|
-
} else {
|
|
177
|
-
return mediaGroup.createChecked({}, [node]);
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
return node;
|
|
181
|
-
});
|
|
182
|
-
};
|
|
183
|
-
|
|
184
|
-
/**
|
|
185
|
-
* Check base styles to see if an element will be invisible when rendered in a document.
|
|
186
|
-
* @param element
|
|
187
|
-
*/
|
|
188
|
-
var isElementInvisible = function isElementInvisible(element) {
|
|
189
|
-
return element.style.opacity === '0' || element.style.display === 'none' || element.style.visibility === 'hidden';
|
|
190
|
-
};
|
|
191
|
-
var VALID_TAGS_CONTAINER = ['DIV', 'TD'];
|
|
192
|
-
function canContainImage(element) {
|
|
193
|
-
if (!element) {
|
|
194
|
-
return false;
|
|
195
|
-
}
|
|
196
|
-
return VALID_TAGS_CONTAINER.indexOf(element.tagName) !== -1;
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
/**
|
|
200
|
-
* Given a html string, we attempt to hoist any nested `<img>` tags,
|
|
201
|
-
* not directly wrapped by a `<div>` as ProseMirror no-op's
|
|
202
|
-
* on those scenarios.
|
|
203
|
-
* @param html
|
|
204
|
-
*/
|
|
205
|
-
export var unwrapNestedMediaElements = function unwrapNestedMediaElements(html) {
|
|
206
|
-
var parser = new DOMParser();
|
|
207
|
-
var doc = parser.parseFromString(html, 'text/html');
|
|
208
|
-
var wrapper = doc.body;
|
|
209
|
-
|
|
210
|
-
// Remove Google Doc's wrapper <b> el
|
|
211
|
-
var docsWrapper = wrapper.querySelector('b[id^="docs-internal-guid-"]');
|
|
212
|
-
if (docsWrapper) {
|
|
213
|
-
unwrap(wrapper, docsWrapper);
|
|
214
|
-
}
|
|
215
|
-
var imageTags = wrapper.querySelectorAll('img');
|
|
216
|
-
if (!imageTags.length) {
|
|
217
|
-
return html;
|
|
218
|
-
}
|
|
219
|
-
imageTags.forEach(function (imageTag) {
|
|
220
|
-
// Capture the immediate parent, we may remove the media from here later.
|
|
221
|
-
var mediaParent = imageTag.parentElement;
|
|
222
|
-
if (!mediaParent) {
|
|
223
|
-
return;
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
// If either the parent or the image itself contains styles that would make
|
|
227
|
-
// them invisible on copy, dont paste them.
|
|
228
|
-
if (isElementInvisible(mediaParent) || isElementInvisible(imageTag)) {
|
|
229
|
-
mediaParent.removeChild(imageTag);
|
|
230
|
-
return;
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
// If its wrapped by a valid container we assume its safe to bypass.
|
|
234
|
-
// ProseMirror should handle these cases properly.
|
|
235
|
-
if (canContainImage(mediaParent) || mediaParent instanceof HTMLSpanElement && mediaParent.closest('[class*="emoji-common"]')) {
|
|
236
|
-
return;
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
// Find the top most element that the parent has a valid container for the image.
|
|
240
|
-
// Stop just before found the wrapper
|
|
241
|
-
var insertBeforeElement = walkUpTreeUntil(mediaParent, function (element) {
|
|
242
|
-
// If is at the top just use this element as reference
|
|
243
|
-
if (element.parentElement === wrapper) {
|
|
244
|
-
return true;
|
|
245
|
-
}
|
|
246
|
-
return canContainImage(element.parentElement);
|
|
247
|
-
});
|
|
248
|
-
|
|
249
|
-
// Here we try to insert the media right after its top most valid parent element
|
|
250
|
-
// Unless its the last element in our structure then we will insert above it.
|
|
251
|
-
if (insertBeforeElement && insertBeforeElement.parentElement) {
|
|
252
|
-
// Insert as close as possible to the most closest valid element index in the tree.
|
|
253
|
-
insertBeforeElement.parentElement.insertBefore(imageTag, insertBeforeElement.nextElementSibling || insertBeforeElement);
|
|
254
|
-
|
|
255
|
-
// Attempt to clean up lines left behind by the image
|
|
256
|
-
mediaParent.innerText = mediaParent.innerText.trim();
|
|
257
|
-
// Walk up and delete empty elements left over after removing the image tag
|
|
258
|
-
removeNestedEmptyEls(mediaParent);
|
|
259
|
-
}
|
|
260
|
-
});
|
|
261
|
-
|
|
262
|
-
// If last child is a hardbreak we don't want it
|
|
263
|
-
if (wrapper.lastElementChild && wrapper.lastElementChild.tagName === 'BR') {
|
|
264
|
-
wrapper.removeChild(wrapper.lastElementChild);
|
|
265
|
-
}
|
|
266
|
-
return wrapper.innerHTML;
|
|
267
|
-
};
|
|
268
164
|
export var getMediaNodeFromSelection = function getMediaNodeFromSelection(state) {
|
|
269
165
|
if (!isSelectionMediaSingleNode(state)) {
|
|
270
166
|
return null;
|
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
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; }
|
|
3
3
|
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) { _defineProperty(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; }
|
|
4
|
+
import { getMaxWidthForNestedNodeNext, getMediaSingleInitialWidth, MEDIA_SINGLE_DEFAULT_MIN_PIXEL_WIDTH, MEDIA_SINGLE_VIDEO_MIN_PIXEL_WIDTH } from '@atlaskit/editor-common/media-single';
|
|
5
|
+
import { checkNodeDown, isEmptyParagraph } from '@atlaskit/editor-common/utils';
|
|
4
6
|
import { Fragment, Slice } from '@atlaskit/editor-prosemirror/model';
|
|
5
|
-
import { safeInsert as pmSafeInsert
|
|
6
|
-
import {
|
|
7
|
-
import { getMediaSingleInitialWidth, MEDIA_SINGLE_DEFAULT_MIN_PIXEL_WIDTH, MEDIA_SINGLE_VIDEO_MIN_PIXEL_WIDTH, getMaxWidthForNestedNodeNext } from '@atlaskit/editor-common/media-single';
|
|
8
|
-
import { copyOptionalAttrsFromMediaState } from '../utils/media-common';
|
|
9
|
-
import { ACTION, ACTION_SUBJECT, EVENT_TYPE, ACTION_SUBJECT_ID } from '@atlaskit/editor-common/analytics';
|
|
7
|
+
import { safeInsert as pmSafeInsert } from '@atlaskit/editor-prosemirror/utils';
|
|
8
|
+
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
|
|
10
9
|
import { safeInsert, shouldSplitSelectedNodeOnNodeInsertion } from '@atlaskit/editor-common/insert';
|
|
11
|
-
import {
|
|
10
|
+
import { copyOptionalAttrsFromMediaState } from '../utils/media-common';
|
|
12
11
|
import { atTheBeginningOfBlock } from '@atlaskit/editor-common/selection';
|
|
13
|
-
import { getRandomHex } from '@atlaskit/media-common';
|
|
14
12
|
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
13
|
+
import { isImage } from './is-image';
|
|
15
14
|
var getInsertMediaAnalytics = function getInsertMediaAnalytics(inputMethod, fileExtension) {
|
|
16
15
|
return {
|
|
17
16
|
action: ACTION.INSERTED,
|
|
@@ -160,65 +159,6 @@ export var createMediaSingleNode = function createMediaSingleNode(schema, collec
|
|
|
160
159
|
return mediaSingle.createChecked(extendedMediaSingleAttrs, mediaNode);
|
|
161
160
|
};
|
|
162
161
|
};
|
|
163
|
-
export function transformSliceForMedia(slice, schema) {
|
|
164
|
-
var _schema$nodes2 = schema.nodes,
|
|
165
|
-
mediaSingle = _schema$nodes2.mediaSingle,
|
|
166
|
-
layoutSection = _schema$nodes2.layoutSection,
|
|
167
|
-
table = _schema$nodes2.table,
|
|
168
|
-
bulletList = _schema$nodes2.bulletList,
|
|
169
|
-
orderedList = _schema$nodes2.orderedList,
|
|
170
|
-
media = _schema$nodes2.media,
|
|
171
|
-
mediaInline = _schema$nodes2.mediaInline,
|
|
172
|
-
expand = _schema$nodes2.expand,
|
|
173
|
-
nestedExpand = _schema$nodes2.nestedExpand;
|
|
174
|
-
return function (selection) {
|
|
175
|
-
var newSlice = slice;
|
|
176
|
-
if (hasParentNodeOfType([layoutSection, table, bulletList, orderedList, expand, nestedExpand])(selection)) {
|
|
177
|
-
newSlice = mapSlice(newSlice, function (node) {
|
|
178
|
-
var extendedOrLegacyAttrs = getBooleanFF('platform.editor.media.extended-resize-experience') ? {
|
|
179
|
-
layout: node.attrs.layout,
|
|
180
|
-
widthType: node.attrs.widthType,
|
|
181
|
-
width: node.attrs.width
|
|
182
|
-
} : {
|
|
183
|
-
layout: node.attrs.layout
|
|
184
|
-
};
|
|
185
|
-
var attrs = {};
|
|
186
|
-
if (hasParentNodeOfType([layoutSection, table])(selection)) {
|
|
187
|
-
// Supports layouts
|
|
188
|
-
attrs = _objectSpread({}, extendedOrLegacyAttrs);
|
|
189
|
-
} else if (hasParentNodeOfType([bulletList, orderedList, expand, nestedExpand])(selection)) {
|
|
190
|
-
// does not support other layouts
|
|
191
|
-
attrs = _objectSpread(_objectSpread({}, extendedOrLegacyAttrs), {}, {
|
|
192
|
-
layout: 'center'
|
|
193
|
-
});
|
|
194
|
-
}
|
|
195
|
-
return node.type.name === 'mediaSingle' ? mediaSingle.createChecked(attrs, node.content, node.marks) : node;
|
|
196
|
-
});
|
|
197
|
-
}
|
|
198
|
-
var __mediaTraceId = getRandomHex(8);
|
|
199
|
-
newSlice = mapSlice(newSlice, function (node) {
|
|
200
|
-
// This logic is duplicated in editor-plugin-ai where external images can be inserted
|
|
201
|
-
// from external sources through the use of AI. The editor-plugin-ai package is avoiding
|
|
202
|
-
// sharing dependencies with editor-core to support products using it with various versions
|
|
203
|
-
// of editor packages.
|
|
204
|
-
// The duplication is in the following file:
|
|
205
|
-
// packages/editor/editor-plugin-ai/src/prebuilt/content-transformers/markdown-to-pm/markdown-transformer.ts
|
|
206
|
-
if (node.type.name === 'media') {
|
|
207
|
-
return media.createChecked(_objectSpread(_objectSpread({}, node.attrs), {}, {
|
|
208
|
-
__external: node.attrs.type === 'external',
|
|
209
|
-
__mediaTraceId: node.attrs.type === 'external' ? null : __mediaTraceId
|
|
210
|
-
}), node.content, node.marks);
|
|
211
|
-
}
|
|
212
|
-
if (node.type.name === 'mediaInline') {
|
|
213
|
-
return mediaInline.createChecked(_objectSpread(_objectSpread({}, node.attrs), {}, {
|
|
214
|
-
__mediaTraceId: __mediaTraceId
|
|
215
|
-
}), node.content, node.marks);
|
|
216
|
-
}
|
|
217
|
-
return node;
|
|
218
|
-
});
|
|
219
|
-
return newSlice;
|
|
220
|
-
};
|
|
221
|
-
}
|
|
222
162
|
export function isCaptionNode(editorView) {
|
|
223
163
|
var $from = editorView.state.selection.$from;
|
|
224
164
|
var immediateWrapperParentNode = editorView.state.doc.nodeAt($from.before(Math.max($from.depth, 1)));
|
|
@@ -6,7 +6,7 @@ import keymap from './pm-plugins/keymaps';
|
|
|
6
6
|
import { addAnalytics, ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, INPUT_METHOD, EVENT_TYPE } from '../analytics';
|
|
7
7
|
import { IconPanel, IconPanelNote, IconPanelSuccess, IconPanelWarning, IconPanelError } from '@atlaskit/editor-common/quick-insert';
|
|
8
8
|
import { createWrapSelectionTransaction } from '@atlaskit/editor-common/utils';
|
|
9
|
-
import {
|
|
9
|
+
import { blockTypeMessages } from '@atlaskit/editor-common/messages';
|
|
10
10
|
import { IconCustomPanel } from '@atlaskit/editor-common/quick-insert';
|
|
11
11
|
import { T50 } from '@atlaskit/theme/colors';
|
|
12
12
|
import { insertPanelWithAnalytics } from './actions';
|
|
@@ -49,9 +49,9 @@ var panelPlugin = function panelPlugin(_ref) {
|
|
|
49
49
|
var formatMessage = _ref3.formatMessage;
|
|
50
50
|
var quickInsertOptions = [{
|
|
51
51
|
id: 'infopanel',
|
|
52
|
-
title: formatMessage(
|
|
52
|
+
title: formatMessage(blockTypeMessages.infoPanel),
|
|
53
53
|
keywords: ['panel'],
|
|
54
|
-
description: formatMessage(
|
|
54
|
+
description: formatMessage(blockTypeMessages.infoPanelDescription),
|
|
55
55
|
priority: 800,
|
|
56
56
|
icon: function icon() {
|
|
57
57
|
return /*#__PURE__*/React.createElement(IconPanel, null);
|
|
@@ -66,8 +66,8 @@ var panelPlugin = function panelPlugin(_ref) {
|
|
|
66
66
|
}
|
|
67
67
|
}, {
|
|
68
68
|
id: 'notepanel',
|
|
69
|
-
title: formatMessage(
|
|
70
|
-
description: formatMessage(
|
|
69
|
+
title: formatMessage(blockTypeMessages.notePanel),
|
|
70
|
+
description: formatMessage(blockTypeMessages.notePanelDescription),
|
|
71
71
|
priority: 1000,
|
|
72
72
|
icon: function icon() {
|
|
73
73
|
return /*#__PURE__*/React.createElement(IconPanelNote, null);
|
|
@@ -82,8 +82,8 @@ var panelPlugin = function panelPlugin(_ref) {
|
|
|
82
82
|
}
|
|
83
83
|
}, {
|
|
84
84
|
id: 'successpanel',
|
|
85
|
-
title: formatMessage(
|
|
86
|
-
description: formatMessage(
|
|
85
|
+
title: formatMessage(blockTypeMessages.successPanel),
|
|
86
|
+
description: formatMessage(blockTypeMessages.successPanelDescription),
|
|
87
87
|
keywords: ['tip'],
|
|
88
88
|
priority: 1000,
|
|
89
89
|
icon: function icon() {
|
|
@@ -99,8 +99,8 @@ var panelPlugin = function panelPlugin(_ref) {
|
|
|
99
99
|
}
|
|
100
100
|
}, {
|
|
101
101
|
id: 'warningpanel',
|
|
102
|
-
title: formatMessage(
|
|
103
|
-
description: formatMessage(
|
|
102
|
+
title: formatMessage(blockTypeMessages.warningPanel),
|
|
103
|
+
description: formatMessage(blockTypeMessages.warningPanelDescription),
|
|
104
104
|
priority: 1000,
|
|
105
105
|
icon: function icon() {
|
|
106
106
|
return /*#__PURE__*/React.createElement(IconPanelWarning, null);
|
|
@@ -115,8 +115,8 @@ var panelPlugin = function panelPlugin(_ref) {
|
|
|
115
115
|
}
|
|
116
116
|
}, {
|
|
117
117
|
id: 'errorpanel',
|
|
118
|
-
title: formatMessage(
|
|
119
|
-
description: formatMessage(
|
|
118
|
+
title: formatMessage(blockTypeMessages.errorPanel),
|
|
119
|
+
description: formatMessage(blockTypeMessages.errorPanelDescription),
|
|
120
120
|
priority: 1000,
|
|
121
121
|
icon: function icon() {
|
|
122
122
|
return /*#__PURE__*/React.createElement(IconPanelError, null);
|
|
@@ -133,8 +133,8 @@ var panelPlugin = function panelPlugin(_ref) {
|
|
|
133
133
|
if (options.allowCustomPanel && options.allowCustomPanelEdit) {
|
|
134
134
|
quickInsertOptions.push({
|
|
135
135
|
id: 'custompanel',
|
|
136
|
-
title: formatMessage(
|
|
137
|
-
description: formatMessage(
|
|
136
|
+
title: formatMessage(blockTypeMessages.customPanel),
|
|
137
|
+
description: formatMessage(blockTypeMessages.customPanelDescription),
|
|
138
138
|
priority: 1000,
|
|
139
139
|
icon: function icon() {
|
|
140
140
|
return /*#__PURE__*/React.createElement(IconCustomPanel, null);
|
|
@@ -14,10 +14,9 @@ import uuid from 'uuid/v4';
|
|
|
14
14
|
import { replaceSelectedTable } from '@atlaskit/editor-tables/utils';
|
|
15
15
|
import { compose, insideTable, isParagraph, isText, isLinkMark, insideTableCell, isInListItem } from '../../utils';
|
|
16
16
|
import { mapSlice } from '../../utils/slice';
|
|
17
|
-
import { INPUT_METHOD } from '
|
|
17
|
+
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
18
18
|
import { GapCursorSelection, Side } from '@atlaskit/editor-common/selection';
|
|
19
19
|
import { runMacroAutoConvert } from '../macro';
|
|
20
|
-
import { insertMediaAsMediaSingle } from '../media/utils/media-single';
|
|
21
20
|
import { addReplaceSelectedTableAnalytics, applyTextMarksToSlice, hasOnlyNodesOfType } from './util';
|
|
22
21
|
import { linkifyContent, isListItemNode, isListNode, canLinkBeCreatedInRange } from '@atlaskit/editor-common/utils';
|
|
23
22
|
import { insertSliceForLists } from './edge-cases';
|
|
@@ -543,12 +542,13 @@ function isOnlyMediaSingle(state, slice) {
|
|
|
543
542
|
var mediaSingle = state.schema.nodes.mediaSingle;
|
|
544
543
|
return mediaSingle && slice.content.childCount === 1 && slice.content.firstChild.type === mediaSingle;
|
|
545
544
|
}
|
|
546
|
-
export function handleMediaSingle(inputMethod,
|
|
545
|
+
export function handleMediaSingle(inputMethod, insertMediaAsMediaSingle) {
|
|
547
546
|
return function (slice) {
|
|
548
547
|
return function (state, dispatch, view) {
|
|
549
548
|
if (view) {
|
|
550
549
|
if (isOnlyMedia(state, slice)) {
|
|
551
|
-
|
|
550
|
+
var _insertMediaAsMediaSi;
|
|
551
|
+
return (_insertMediaAsMediaSi = insertMediaAsMediaSingle === null || insertMediaAsMediaSingle === void 0 ? void 0 : insertMediaAsMediaSingle(view, slice.content.firstChild, inputMethod)) !== null && _insertMediaAsMediaSi !== void 0 ? _insertMediaAsMediaSi : false;
|
|
552
552
|
}
|
|
553
553
|
if (insideTable(state) && isOnlyMediaSingle(state, slice)) {
|
|
554
554
|
var tr = state.tr.replaceSelection(slice);
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
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; }
|
|
3
|
+
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) { _defineProperty(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; }
|
|
4
|
+
import { hasParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
5
|
+
import { mapSlice, unwrap, removeNestedEmptyEls, walkUpTreeUntil } from '@atlaskit/editor-common/utils';
|
|
6
|
+
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
7
|
+
import { getRandomHex } from '@atlaskit/media-common';
|
|
8
|
+
export function transformSliceForMedia(slice, schema) {
|
|
9
|
+
var _schema$nodes = schema.nodes,
|
|
10
|
+
mediaSingle = _schema$nodes.mediaSingle,
|
|
11
|
+
layoutSection = _schema$nodes.layoutSection,
|
|
12
|
+
table = _schema$nodes.table,
|
|
13
|
+
bulletList = _schema$nodes.bulletList,
|
|
14
|
+
orderedList = _schema$nodes.orderedList,
|
|
15
|
+
media = _schema$nodes.media,
|
|
16
|
+
mediaInline = _schema$nodes.mediaInline,
|
|
17
|
+
expand = _schema$nodes.expand,
|
|
18
|
+
nestedExpand = _schema$nodes.nestedExpand;
|
|
19
|
+
return function (selection) {
|
|
20
|
+
var newSlice = slice;
|
|
21
|
+
if (hasParentNodeOfType([layoutSection, table, bulletList, orderedList, expand, nestedExpand])(selection)) {
|
|
22
|
+
newSlice = mapSlice(newSlice, function (node) {
|
|
23
|
+
var extendedOrLegacyAttrs = getBooleanFF('platform.editor.media.extended-resize-experience') ? {
|
|
24
|
+
layout: node.attrs.layout,
|
|
25
|
+
widthType: node.attrs.widthType,
|
|
26
|
+
width: node.attrs.width
|
|
27
|
+
} : {
|
|
28
|
+
layout: node.attrs.layout
|
|
29
|
+
};
|
|
30
|
+
var attrs = {};
|
|
31
|
+
if (hasParentNodeOfType([layoutSection, table])(selection)) {
|
|
32
|
+
// Supports layouts
|
|
33
|
+
attrs = _objectSpread({}, extendedOrLegacyAttrs);
|
|
34
|
+
} else if (hasParentNodeOfType([bulletList, orderedList, expand, nestedExpand])(selection)) {
|
|
35
|
+
// does not support other layouts
|
|
36
|
+
attrs = _objectSpread(_objectSpread({}, extendedOrLegacyAttrs), {}, {
|
|
37
|
+
layout: 'center'
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
return node.type.name === 'mediaSingle' ? mediaSingle.createChecked(attrs, node.content, node.marks) : node;
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
var __mediaTraceId = getRandomHex(8);
|
|
44
|
+
newSlice = mapSlice(newSlice, function (node) {
|
|
45
|
+
// This logic is duplicated in editor-plugin-ai where external images can be inserted
|
|
46
|
+
// from external sources through the use of AI. The editor-plugin-ai package is avoiding
|
|
47
|
+
// sharing dependencies with editor-core to support products using it with various versions
|
|
48
|
+
// of editor packages.
|
|
49
|
+
// The duplication is in the following file:
|
|
50
|
+
// packages/editor/editor-plugin-ai/src/prebuilt/content-transformers/markdown-to-pm/markdown-transformer.ts
|
|
51
|
+
if (node.type.name === 'media') {
|
|
52
|
+
return media.createChecked(_objectSpread(_objectSpread({}, node.attrs), {}, {
|
|
53
|
+
__external: node.attrs.type === 'external',
|
|
54
|
+
__mediaTraceId: node.attrs.type === 'external' ? null : __mediaTraceId
|
|
55
|
+
}), node.content, node.marks);
|
|
56
|
+
}
|
|
57
|
+
if (node.type.name === 'mediaInline') {
|
|
58
|
+
return mediaInline.createChecked(_objectSpread(_objectSpread({}, node.attrs), {}, {
|
|
59
|
+
__mediaTraceId: __mediaTraceId
|
|
60
|
+
}), node.content, node.marks);
|
|
61
|
+
}
|
|
62
|
+
return node;
|
|
63
|
+
});
|
|
64
|
+
return newSlice;
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// TODO move this to editor-common
|
|
69
|
+
export var isImage = function isImage(fileType) {
|
|
70
|
+
return !!fileType && (fileType.indexOf('image/') > -1 || fileType.indexOf('video/') > -1);
|
|
71
|
+
};
|
|
72
|
+
export var transformSliceToCorrectMediaWrapper = function transformSliceToCorrectMediaWrapper(slice, schema) {
|
|
73
|
+
var _schema$nodes2 = schema.nodes,
|
|
74
|
+
mediaGroup = _schema$nodes2.mediaGroup,
|
|
75
|
+
mediaSingle = _schema$nodes2.mediaSingle,
|
|
76
|
+
media = _schema$nodes2.media;
|
|
77
|
+
return mapSlice(slice, function (node, parent) {
|
|
78
|
+
if (!parent && node.type === media) {
|
|
79
|
+
if (mediaSingle && (isImage(node.attrs.__fileMimeType) || node.attrs.type === 'external')) {
|
|
80
|
+
return mediaSingle.createChecked({}, node);
|
|
81
|
+
} else {
|
|
82
|
+
return mediaGroup.createChecked({}, [node]);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
return node;
|
|
86
|
+
});
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Check base styles to see if an element will be invisible when rendered in a document.
|
|
91
|
+
* @param element
|
|
92
|
+
*/
|
|
93
|
+
var isElementInvisible = function isElementInvisible(element) {
|
|
94
|
+
return element.style.opacity === '0' || element.style.display === 'none' || element.style.visibility === 'hidden';
|
|
95
|
+
};
|
|
96
|
+
var VALID_TAGS_CONTAINER = ['DIV', 'TD'];
|
|
97
|
+
function canContainImage(element) {
|
|
98
|
+
if (!element) {
|
|
99
|
+
return false;
|
|
100
|
+
}
|
|
101
|
+
return VALID_TAGS_CONTAINER.indexOf(element.tagName) !== -1;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Given a html string, we attempt to hoist any nested `<img>` tags,
|
|
106
|
+
* not directly wrapped by a `<div>` as ProseMirror no-op's
|
|
107
|
+
* on those scenarios.
|
|
108
|
+
* @param html
|
|
109
|
+
*/
|
|
110
|
+
export var unwrapNestedMediaElements = function unwrapNestedMediaElements(html) {
|
|
111
|
+
var parser = new DOMParser();
|
|
112
|
+
var doc = parser.parseFromString(html, 'text/html');
|
|
113
|
+
var wrapper = doc.body;
|
|
114
|
+
|
|
115
|
+
// Remove Google Doc's wrapper <b> el
|
|
116
|
+
var docsWrapper = wrapper.querySelector('b[id^="docs-internal-guid-"]');
|
|
117
|
+
if (docsWrapper) {
|
|
118
|
+
unwrap(wrapper, docsWrapper);
|
|
119
|
+
}
|
|
120
|
+
var imageTags = wrapper.querySelectorAll('img');
|
|
121
|
+
if (!imageTags.length) {
|
|
122
|
+
return html;
|
|
123
|
+
}
|
|
124
|
+
imageTags.forEach(function (imageTag) {
|
|
125
|
+
// Capture the immediate parent, we may remove the media from here later.
|
|
126
|
+
var mediaParent = imageTag.parentElement;
|
|
127
|
+
if (!mediaParent) {
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
// If either the parent or the image itself contains styles that would make
|
|
132
|
+
// them invisible on copy, dont paste them.
|
|
133
|
+
if (isElementInvisible(mediaParent) || isElementInvisible(imageTag)) {
|
|
134
|
+
mediaParent.removeChild(imageTag);
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
// If its wrapped by a valid container we assume its safe to bypass.
|
|
139
|
+
// ProseMirror should handle these cases properly.
|
|
140
|
+
if (canContainImage(mediaParent) || mediaParent instanceof HTMLSpanElement && mediaParent.closest('[class*="emoji-common"]')) {
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
// Find the top most element that the parent has a valid container for the image.
|
|
145
|
+
// Stop just before found the wrapper
|
|
146
|
+
var insertBeforeElement = walkUpTreeUntil(mediaParent, function (element) {
|
|
147
|
+
// If is at the top just use this element as reference
|
|
148
|
+
if (element.parentElement === wrapper) {
|
|
149
|
+
return true;
|
|
150
|
+
}
|
|
151
|
+
return canContainImage(element.parentElement);
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
// Here we try to insert the media right after its top most valid parent element
|
|
155
|
+
// Unless its the last element in our structure then we will insert above it.
|
|
156
|
+
if (insertBeforeElement && insertBeforeElement.parentElement) {
|
|
157
|
+
// Insert as close as possible to the most closest valid element index in the tree.
|
|
158
|
+
insertBeforeElement.parentElement.insertBefore(imageTag, insertBeforeElement.nextElementSibling || insertBeforeElement);
|
|
159
|
+
|
|
160
|
+
// Attempt to clean up lines left behind by the image
|
|
161
|
+
mediaParent.innerText = mediaParent.innerText.trim();
|
|
162
|
+
// Walk up and delete empty elements left over after removing the image tag
|
|
163
|
+
removeNestedEmptyEls(mediaParent);
|
|
164
|
+
}
|
|
165
|
+
});
|
|
166
|
+
|
|
167
|
+
// If last child is a hardbreak we don't want it
|
|
168
|
+
if (wrapper.lastElementChild && wrapper.lastElementChild.tagName === 'BR') {
|
|
169
|
+
wrapper.removeChild(wrapper.lastElementChild);
|
|
170
|
+
}
|
|
171
|
+
return wrapper.innerHTML;
|
|
172
|
+
};
|
|
@@ -239,10 +239,10 @@ export var handleCodeBlockWithAnalytics = function handleCodeBlockWithAnalytics(
|
|
|
239
239
|
type: PasteTypes.plain
|
|
240
240
|
}))(handleCodeBlock(text));
|
|
241
241
|
};
|
|
242
|
-
export var handleMediaSingleWithAnalytics = function handleMediaSingleWithAnalytics(view, event, slice, type,
|
|
242
|
+
export var handleMediaSingleWithAnalytics = function handleMediaSingleWithAnalytics(view, event, slice, type, insertMediaAsMediaSingle) {
|
|
243
243
|
return injectAnalyticsPayloadBeforeCommand(createPasteAnalyticsPayloadBySelection(event, slice, {
|
|
244
244
|
type: type
|
|
245
|
-
}))(handleMediaSingle(INPUT_METHOD.CLIPBOARD,
|
|
245
|
+
}))(handleMediaSingle(INPUT_METHOD.CLIPBOARD, insertMediaAsMediaSingle)(slice));
|
|
246
246
|
};
|
|
247
247
|
export var handlePastePreservingMarksWithAnalytics = function handlePastePreservingMarksWithAnalytics(view, event, slice, type, pluginInjectionApi) {
|
|
248
248
|
var _pluginInjectionApi$c2;
|
|
@@ -8,7 +8,7 @@ import { addLinkMetadata } from '@atlaskit/editor-common/card';
|
|
|
8
8
|
import { mapChildren } from '../../../utils/slice';
|
|
9
9
|
import { getExtensionAutoConvertersFromProvider } from '@atlaskit/editor-common/extensions';
|
|
10
10
|
import { isPastedFile as isPastedFileFromEvent } from '@atlaskit/editor-common/paste';
|
|
11
|
-
import { transformSliceForMedia } from '
|
|
11
|
+
import { transformSliceForMedia, transformSliceToCorrectMediaWrapper, unwrapNestedMediaElements } from '../plugins/media';
|
|
12
12
|
import { escapeLinks, htmlContainsSingleFile, isPastedFromWord, isPastedFromExcel, htmlHasInvalidLinkTags, removeDuplicateInvalidLinks, transformUnsupportedBlockCardToInline } from '../util';
|
|
13
13
|
import { linkifyContent } from '@atlaskit/editor-common/utils';
|
|
14
14
|
import { transformSliceNestedExpandToExpand } from '../../expand/utils';
|
|
@@ -18,7 +18,6 @@ import { createPasteMeasurePayload, getContentNodeTypes, handlePasteAsPlainTextW
|
|
|
18
18
|
import { ACTION, analyticsPluginKey, INPUT_METHOD, PasteTypes } from '../../analytics';
|
|
19
19
|
import { isInsideBlockQuote, insideTable, measurements } from '../../../utils';
|
|
20
20
|
import { measureRender } from '@atlaskit/editor-common/utils';
|
|
21
|
-
import { transformSliceToCorrectMediaWrapper, unwrapNestedMediaElements } from '../../media/utils/media-common';
|
|
22
21
|
import { upgradeTextToLists, splitParagraphs } from '../commands';
|
|
23
22
|
import { md } from '@atlaskit/editor-common/paste';
|
|
24
23
|
import { transformSliceToDecisionList } from '../../tasks-and-decisions/utils';
|
|
@@ -102,7 +101,7 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
|
|
|
102
101
|
}
|
|
103
102
|
},
|
|
104
103
|
handlePaste: function handlePaste(view, rawEvent, slice) {
|
|
105
|
-
var _text, _analyticsPlugin$perf, _schema$nodes, _schema$nodes2, _schema$nodes3, _pluginInjectionApi$
|
|
104
|
+
var _text, _analyticsPlugin$perf, _schema$nodes, _schema$nodes2, _schema$nodes3, _pluginInjectionApi$m;
|
|
106
105
|
var event = rawEvent;
|
|
107
106
|
if (!event.clipboardData) {
|
|
108
107
|
return false;
|
|
@@ -266,7 +265,7 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
|
|
|
266
265
|
if (handleCodeBlockWithAnalytics(view, event, slice, text)(state, dispatch)) {
|
|
267
266
|
return true;
|
|
268
267
|
}
|
|
269
|
-
if (handleMediaSingleWithAnalytics(view, event, slice, isPastedFile ? PasteTypes.binary : PasteTypes.richText, pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$
|
|
268
|
+
if (handleMediaSingleWithAnalytics(view, event, slice, isPastedFile ? PasteTypes.binary : 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)) {
|
|
270
269
|
return true;
|
|
271
270
|
}
|
|
272
271
|
if (handleSelectedTableWithAnalytics(view, event, slice)(state, dispatch)) {
|
|
@@ -14,7 +14,7 @@ import RedoIcon from '@atlaskit/icon/glyph/redo';
|
|
|
14
14
|
import { undo as undoKeymap, redo as redoKeymap, ToolTipContent, tooltip } from '../../../../keymaps';
|
|
15
15
|
import { separatorStyles, buttonGroupStyle } from '@atlaskit/editor-common/styles';
|
|
16
16
|
import ToolbarButton, { TOOLBAR_BUTTON } from '../../../../ui/ToolbarButton';
|
|
17
|
-
import {
|
|
17
|
+
import { undoRedoMessages } from '@atlaskit/editor-common/messages';
|
|
18
18
|
import { createTypeAheadTools } from '../../../type-ahead/api';
|
|
19
19
|
import { undoFromToolbar, redoFromToolbar } from '../../commands';
|
|
20
20
|
import { getAriaKeyshortcuts } from '@atlaskit/editor-common/keymaps';
|
|
@@ -64,8 +64,8 @@ export var ToolbarUndoRedo = /*#__PURE__*/function (_PureComponent) {
|
|
|
64
64
|
var handleRedo = function handleRedo() {
|
|
65
65
|
forceFocus(editorView)(redoFromToolbar);
|
|
66
66
|
};
|
|
67
|
-
var labelUndo = formatMessage(
|
|
68
|
-
var labelRedo = formatMessage(
|
|
67
|
+
var labelUndo = formatMessage(undoRedoMessages.undo);
|
|
68
|
+
var labelRedo = formatMessage(undoRedoMessages.redo);
|
|
69
69
|
var canUndo = historyState.canUndo,
|
|
70
70
|
canRedo = historyState.canRedo;
|
|
71
71
|
return jsx("span", {
|
|
@@ -11,7 +11,7 @@ import { PureComponent } from 'react';
|
|
|
11
11
|
import { injectIntl } from 'react-intl-next';
|
|
12
12
|
import { IconMap } from '../../plugins/alignment/ui/ToolbarAlignment/icon-map';
|
|
13
13
|
import AlignmentButton from './AlignmentButton';
|
|
14
|
-
import { alignmentMessages } from '
|
|
14
|
+
import { alignmentMessages } from '@atlaskit/editor-common/messages';
|
|
15
15
|
import { alignmentWrapper } from './styles';
|
|
16
16
|
import { alignLeft } from '../../keymaps';
|
|
17
17
|
var alignmentOptions = [{
|
|
@@ -12,12 +12,7 @@ import PropTypes from 'prop-types';
|
|
|
12
12
|
import { ACTION, ACTION_SUBJECT, INPUT_METHOD, EVENT_TYPE, ACTION_SUBJECT_ID } from '../../plugins/analytics';
|
|
13
13
|
import { createDispatch } from '../../event-dispatcher';
|
|
14
14
|
import { analyticsEventKey } from '../../plugins/analytics/consts';
|
|
15
|
-
|
|
16
|
-
import { openHelpCommand } from '../../plugins/help-dialog/commands';
|
|
17
|
-
/**
|
|
18
|
-
* @deprecated
|
|
19
|
-
* Use WithHelpTrigger from @atlaskit/editor-plugin-help-dialog which uses pluginInjectionApi
|
|
20
|
-
*/
|
|
15
|
+
import { deprecatedOpenHelpCommand } from '@atlaskit/editor-plugin-help-dialog';
|
|
21
16
|
var WithHelpTrigger = /*#__PURE__*/function (_React$Component) {
|
|
22
17
|
_inherits(WithHelpTrigger, _React$Component);
|
|
23
18
|
var _super = _createSuper(WithHelpTrigger);
|
|
@@ -44,7 +39,7 @@ var WithHelpTrigger = /*#__PURE__*/function (_React$Component) {
|
|
|
44
39
|
});
|
|
45
40
|
var editorView = editorActions._privateGetEditorView();
|
|
46
41
|
if (editorView) {
|
|
47
|
-
|
|
42
|
+
deprecatedOpenHelpCommand(editorView.state.tr, editorView.dispatch);
|
|
48
43
|
}
|
|
49
44
|
});
|
|
50
45
|
return _this;
|
|
@@ -259,6 +259,9 @@ export declare function createDefaultPreset(options: EditorPresetProps & Default
|
|
|
259
259
|
};
|
|
260
260
|
}, undefined>];
|
|
261
261
|
sharedState: import("../../../plugins/media/pm-plugins/types").MediaPluginState | null;
|
|
262
|
+
actions: {
|
|
263
|
+
insertMediaAsMediaSingle: import("../../../plugins/media/utils/media-single").InsertMediaAsMediaSingle;
|
|
264
|
+
};
|
|
262
265
|
}, import("@atlaskit/editor-plugin-media/types").MediaOptions | undefined>>];
|
|
263
266
|
}, ((editorView: import("prosemirror-view").EditorView) => void) | undefined>, import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"editorDisabled", {
|
|
264
267
|
sharedState: import("@atlaskit/editor-plugin-editor-disabled").EditorDisabledPluginState;
|
|
@@ -586,6 +589,9 @@ export declare function useDefaultPreset(props: EditorPresetProps & DefaultPrese
|
|
|
586
589
|
};
|
|
587
590
|
}, undefined>];
|
|
588
591
|
sharedState: import("../../../plugins/media/pm-plugins/types").MediaPluginState | null;
|
|
592
|
+
actions: {
|
|
593
|
+
insertMediaAsMediaSingle: import("../../../plugins/media/utils/media-single").InsertMediaAsMediaSingle;
|
|
594
|
+
};
|
|
589
595
|
}, import("@atlaskit/editor-plugin-media/types").MediaOptions | undefined>>];
|
|
590
596
|
}, ((editorView: import("prosemirror-view").EditorView) => void) | undefined>, import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"editorDisabled", {
|
|
591
597
|
sharedState: import("@atlaskit/editor-plugin-editor-disabled").EditorDisabledPluginState;
|
|
@@ -1,21 +1,4 @@
|
|
|
1
1
|
import type { IntlShape } from 'react-intl-next';
|
|
2
2
|
import type { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
3
3
|
import type { FloatingToolbarConfig } from '@atlaskit/editor-common/types';
|
|
4
|
-
export declare const annotationMessages: {
|
|
5
|
-
createComment: {
|
|
6
|
-
id: string;
|
|
7
|
-
defaultMessage: string;
|
|
8
|
-
description: string;
|
|
9
|
-
};
|
|
10
|
-
createCommentInvalid: {
|
|
11
|
-
id: string;
|
|
12
|
-
defaultMessage: string;
|
|
13
|
-
description: string;
|
|
14
|
-
};
|
|
15
|
-
toolbar: {
|
|
16
|
-
id: string;
|
|
17
|
-
defaultMessage: string;
|
|
18
|
-
description: string;
|
|
19
|
-
};
|
|
20
|
-
};
|
|
21
4
|
export declare const buildToolbar: (state: EditorState, intl: IntlShape, isToolbarAbove?: boolean) => FloatingToolbarConfig | undefined;
|
|
@@ -5,7 +5,6 @@ export { default as collabEditPlugin } from './collab-edit';
|
|
|
5
5
|
export { default as datePlugin } from './date';
|
|
6
6
|
export { default as extensionPlugin } from './extension';
|
|
7
7
|
export { default as fakeTextCursorPlugin } from './fake-text-cursor';
|
|
8
|
-
export { default as helpDialogPlugin } from './help-dialog';
|
|
9
8
|
export { default as insertBlockPlugin } from './insert-block';
|
|
10
9
|
export { default as jiraIssuePlugin } from './jira-issue';
|
|
11
10
|
export { default as layoutPlugin } from './layout';
|