@atlaskit/editor-core 178.0.2 → 178.1.1
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 +40 -0
- package/dist/cjs/create-editor/create-plugins-list.js +3 -1
- package/dist/cjs/plugins/alignment/ui/ToolbarAlignment/index.js +26 -13
- package/dist/cjs/plugins/annotation/index.js +4 -2
- package/dist/cjs/plugins/annotation/ui/InlineCommentView.js +6 -2
- package/dist/cjs/plugins/base/pm-plugins/react-nodeview.js +8 -1
- package/dist/cjs/plugins/block-type/commands/delete-block-content.js +53 -0
- package/dist/cjs/plugins/block-type/commands/index.js +9 -1
- package/dist/cjs/plugins/block-type/pm-plugins/keymap.js +2 -2
- package/dist/cjs/plugins/block-type/ui/ToolbarBlockType/index.js +8 -4
- package/dist/cjs/plugins/card/nodeviews/blockCard.js +1 -1
- package/dist/cjs/plugins/card/nodeviews/embedCard.js +1 -3
- package/dist/cjs/plugins/card/pm-plugins/doc.js +21 -4
- package/dist/cjs/plugins/card/toolbar.js +4 -2
- package/dist/cjs/plugins/card/ui/EditLinkToolbar.js +4 -1
- package/dist/cjs/plugins/card/ui/LinkToolbarAppearance.js +16 -9
- package/dist/cjs/plugins/collab-edit/actions.js +1 -1
- package/dist/cjs/plugins/collab-edit/index.js +1 -1
- package/dist/cjs/plugins/collab-edit/provider/channel.js +1 -1
- package/dist/cjs/plugins/expand/pm-plugins/keymap.js +5 -0
- package/dist/cjs/plugins/floating-toolbar/ui/Select.js +2 -1
- package/dist/cjs/plugins/floating-toolbar/ui/Toolbar.js +18 -9
- package/dist/cjs/plugins/hyperlink/HyperlinkToolbarAppearance.js +1 -0
- package/dist/cjs/plugins/hyperlink/index.js +2 -1
- package/dist/cjs/plugins/hyperlink/ui/EditorLinkPicker/index.js +15 -2
- package/dist/cjs/plugins/hyperlink/ui/HyperlinkAddToolbar/HyperlinkAddToolbar.js +27 -22
- package/dist/cjs/plugins/hyperlink/ui/HyperlinkAddToolbar/index.js +6 -2
- package/dist/cjs/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-element-browser.js +2 -1
- package/dist/cjs/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-menu.js +2 -1
- package/dist/cjs/plugins/insert-block/ui/ToolbarInsertBlock/index.js +2 -1
- package/dist/cjs/plugins/media/commands/helpers.js +24 -2
- package/dist/cjs/plugins/media/nodeviews/mediaGroup.js +14 -16
- package/dist/cjs/plugins/media/nodeviews/mediaNodeUpdater.js +232 -183
- package/dist/cjs/plugins/media/nodeviews/mediaNodeView/index.js +1 -3
- package/dist/cjs/plugins/media/nodeviews/mediaSingle.js +1 -1
- package/dist/cjs/plugins/media/pm-plugins/keymap.js +46 -0
- package/dist/cjs/plugins/rank.js +3 -2
- package/dist/cjs/plugins/selection/pm-plugins/events/create-selection-between.js +86 -0
- package/dist/cjs/plugins/selection/pm-plugins/events/keydown.js +84 -0
- package/dist/cjs/plugins/selection/pm-plugins/selection-main.js +6 -56
- package/dist/cjs/plugins/text-color/ui/ToolbarTextColor/index.js +1 -1
- package/dist/cjs/plugins/text-formatting/ui/Toolbar/dropdown-menu.js +7 -2
- package/dist/cjs/plugins/toolbar-lists-indentation/ui/ToolbarDropdown.js +4 -2
- package/dist/cjs/ui/Addon/ClickAreaBlock/index.js +22 -61
- package/dist/cjs/ui/Addon/ClickAreaInline/index.js +22 -56
- package/dist/cjs/ui/Addon/click-area-helper.js +28 -6
- package/dist/cjs/ui/Alignment/AlignmentButton/index.js +4 -2
- package/dist/cjs/ui/ElementBrowser/InsertMenu.js +2 -1
- package/dist/cjs/ui/ToolbarArrowKeyNavigationProvider/index.js +22 -9
- package/dist/cjs/utils/document.js +11 -2
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/create-editor/create-plugins-list.js +3 -1
- package/dist/es2019/plugins/alignment/ui/ToolbarAlignment/index.js +28 -13
- package/dist/es2019/plugins/annotation/index.js +4 -2
- package/dist/es2019/plugins/annotation/ui/InlineCommentView.js +6 -2
- package/dist/es2019/plugins/base/pm-plugins/react-nodeview.js +8 -1
- package/dist/es2019/plugins/block-type/commands/delete-block-content.js +49 -0
- package/dist/es2019/plugins/block-type/commands/index.js +2 -1
- package/dist/es2019/plugins/block-type/pm-plugins/keymap.js +3 -3
- package/dist/es2019/plugins/block-type/ui/ToolbarBlockType/index.js +8 -4
- package/dist/es2019/plugins/card/nodeviews/blockCard.js +1 -1
- package/dist/es2019/plugins/card/nodeviews/embedCard.js +1 -2
- package/dist/es2019/plugins/card/pm-plugins/doc.js +19 -3
- package/dist/es2019/plugins/card/toolbar.js +4 -2
- package/dist/es2019/plugins/card/ui/EditLinkToolbar.js +5 -2
- package/dist/es2019/plugins/card/ui/LinkToolbarAppearance.js +15 -9
- package/dist/es2019/plugins/collab-edit/actions.js +1 -1
- package/dist/es2019/plugins/collab-edit/index.js +1 -1
- package/dist/es2019/plugins/collab-edit/provider/channel.js +1 -1
- package/dist/es2019/plugins/expand/pm-plugins/keymap.js +5 -0
- package/dist/es2019/plugins/floating-toolbar/ui/Select.js +2 -1
- package/dist/es2019/plugins/floating-toolbar/ui/Toolbar.js +18 -9
- package/dist/es2019/plugins/hyperlink/HyperlinkToolbarAppearance.js +1 -0
- package/dist/es2019/plugins/hyperlink/index.js +2 -1
- package/dist/es2019/plugins/hyperlink/ui/EditorLinkPicker/index.js +11 -2
- package/dist/es2019/plugins/hyperlink/ui/HyperlinkAddToolbar/HyperlinkAddToolbar.js +1 -5
- package/dist/es2019/plugins/hyperlink/ui/HyperlinkAddToolbar/index.js +6 -2
- package/dist/es2019/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-element-browser.js +2 -1
- package/dist/es2019/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-menu.js +2 -1
- package/dist/es2019/plugins/insert-block/ui/ToolbarInsertBlock/index.js +2 -1
- package/dist/es2019/plugins/media/commands/helpers.js +18 -1
- package/dist/es2019/plugins/media/nodeviews/mediaGroup.js +14 -16
- package/dist/es2019/plugins/media/nodeviews/mediaNodeUpdater.js +37 -13
- package/dist/es2019/plugins/media/nodeviews/mediaNodeView/index.js +1 -2
- package/dist/es2019/plugins/media/nodeviews/mediaSingle.js +1 -1
- package/dist/es2019/plugins/media/pm-plugins/keymap.js +45 -0
- package/dist/es2019/plugins/rank.js +3 -2
- package/dist/es2019/plugins/selection/pm-plugins/events/create-selection-between.js +79 -0
- package/dist/es2019/plugins/selection/pm-plugins/events/keydown.js +77 -0
- package/dist/es2019/plugins/selection/pm-plugins/selection-main.js +5 -55
- package/dist/es2019/plugins/text-color/ui/ToolbarTextColor/index.js +1 -1
- package/dist/es2019/plugins/text-formatting/ui/Toolbar/dropdown-menu.js +6 -2
- package/dist/es2019/plugins/toolbar-lists-indentation/ui/ToolbarDropdown.js +3 -2
- package/dist/es2019/ui/Addon/ClickAreaBlock/index.js +20 -31
- package/dist/es2019/ui/Addon/ClickAreaInline/index.js +20 -27
- package/dist/es2019/ui/Addon/click-area-helper.js +28 -6
- package/dist/es2019/ui/Alignment/AlignmentButton/index.js +4 -2
- package/dist/es2019/ui/ElementBrowser/InsertMenu.js +2 -1
- package/dist/es2019/ui/ToolbarArrowKeyNavigationProvider/index.js +22 -9
- package/dist/es2019/utils/document.js +9 -2
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/create-editor/create-plugins-list.js +3 -1
- package/dist/esm/plugins/alignment/ui/ToolbarAlignment/index.js +26 -13
- package/dist/esm/plugins/annotation/index.js +4 -2
- package/dist/esm/plugins/annotation/ui/InlineCommentView.js +6 -2
- package/dist/esm/plugins/base/pm-plugins/react-nodeview.js +8 -1
- package/dist/esm/plugins/block-type/commands/delete-block-content.js +46 -0
- package/dist/esm/plugins/block-type/commands/index.js +2 -1
- package/dist/esm/plugins/block-type/pm-plugins/keymap.js +3 -3
- package/dist/esm/plugins/block-type/ui/ToolbarBlockType/index.js +8 -4
- package/dist/esm/plugins/card/nodeviews/blockCard.js +1 -1
- package/dist/esm/plugins/card/nodeviews/embedCard.js +1 -2
- package/dist/esm/plugins/card/pm-plugins/doc.js +20 -3
- package/dist/esm/plugins/card/toolbar.js +4 -2
- package/dist/esm/plugins/card/ui/EditLinkToolbar.js +5 -2
- package/dist/esm/plugins/card/ui/LinkToolbarAppearance.js +16 -9
- package/dist/esm/plugins/collab-edit/actions.js +1 -1
- package/dist/esm/plugins/collab-edit/index.js +1 -1
- package/dist/esm/plugins/collab-edit/provider/channel.js +1 -1
- package/dist/esm/plugins/expand/pm-plugins/keymap.js +5 -0
- package/dist/esm/plugins/floating-toolbar/ui/Select.js +2 -1
- package/dist/esm/plugins/floating-toolbar/ui/Toolbar.js +18 -9
- package/dist/esm/plugins/hyperlink/HyperlinkToolbarAppearance.js +1 -0
- package/dist/esm/plugins/hyperlink/index.js +2 -1
- package/dist/esm/plugins/hyperlink/ui/EditorLinkPicker/index.js +15 -3
- package/dist/esm/plugins/hyperlink/ui/HyperlinkAddToolbar/HyperlinkAddToolbar.js +27 -22
- package/dist/esm/plugins/hyperlink/ui/HyperlinkAddToolbar/index.js +6 -2
- package/dist/esm/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-element-browser.js +2 -1
- package/dist/esm/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-menu.js +2 -1
- package/dist/esm/plugins/insert-block/ui/ToolbarInsertBlock/index.js +2 -1
- package/dist/esm/plugins/media/commands/helpers.js +20 -1
- package/dist/esm/plugins/media/nodeviews/mediaGroup.js +14 -16
- package/dist/esm/plugins/media/nodeviews/mediaNodeUpdater.js +235 -184
- package/dist/esm/plugins/media/nodeviews/mediaNodeView/index.js +1 -2
- package/dist/esm/plugins/media/nodeviews/mediaSingle.js +1 -1
- package/dist/esm/plugins/media/pm-plugins/keymap.js +45 -0
- package/dist/esm/plugins/rank.js +3 -2
- package/dist/esm/plugins/selection/pm-plugins/events/create-selection-between.js +76 -0
- package/dist/esm/plugins/selection/pm-plugins/events/keydown.js +74 -0
- package/dist/esm/plugins/selection/pm-plugins/selection-main.js +4 -57
- package/dist/esm/plugins/text-color/ui/ToolbarTextColor/index.js +1 -1
- package/dist/esm/plugins/text-formatting/ui/Toolbar/dropdown-menu.js +7 -2
- package/dist/esm/plugins/toolbar-lists-indentation/ui/ToolbarDropdown.js +4 -2
- package/dist/esm/ui/Addon/ClickAreaBlock/index.js +17 -58
- package/dist/esm/ui/Addon/ClickAreaInline/index.js +17 -53
- package/dist/esm/ui/Addon/click-area-helper.js +28 -6
- package/dist/esm/ui/Alignment/AlignmentButton/index.js +4 -2
- package/dist/esm/ui/ElementBrowser/InsertMenu.js +2 -1
- package/dist/esm/ui/ToolbarArrowKeyNavigationProvider/index.js +22 -9
- package/dist/esm/utils/document.js +11 -2
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/plugins/alignment/ui/ToolbarAlignment/index.d.ts +1 -1
- package/dist/types/plugins/block-type/commands/delete-block-content.d.ts +10 -0
- package/dist/types/plugins/block-type/commands/index.d.ts +1 -0
- package/dist/types/plugins/card/pm-plugins/doc.d.ts +1 -1
- package/dist/types/plugins/card/ui/LinkToolbarAppearance.d.ts +1 -0
- package/dist/types/plugins/floating-toolbar/ui/Select.d.ts +1 -0
- package/dist/types/plugins/hyperlink/ui/EditorLinkPicker/index.d.ts +6 -1
- package/dist/types/plugins/hyperlink/ui/HyperlinkAddToolbar/index.d.ts +1 -1
- package/dist/types/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-element-browser.d.ts +1 -0
- package/dist/types/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-menu.d.ts +1 -0
- package/dist/types/plugins/media/commands/helpers.d.ts +1 -0
- package/dist/types/plugins/media/nodeviews/__mocks__/mediaNodeUpdater.d.ts +1 -0
- package/dist/types/plugins/media/nodeviews/mediaNodeUpdater.d.ts +3 -1
- package/dist/types/plugins/media/types.d.ts +2 -0
- package/dist/types/plugins/selection/pm-plugins/events/create-selection-between.d.ts +4 -0
- package/dist/types/plugins/selection/pm-plugins/events/keydown.d.ts +2 -0
- package/dist/types/ui/Addon/ClickAreaBlock/index.d.ts +2 -5
- package/dist/types/ui/Addon/ClickAreaInline/index.d.ts +2 -5
- package/dist/types/ui/Addon/click-area-helper.d.ts +1 -1
- package/dist/types/ui/Alignment/AlignmentButton/index.d.ts +1 -1
- package/dist/types/ui/ElementBrowser/InsertMenu.d.ts +1 -1
- package/dist/types/ui/ElementBrowser/types.d.ts +1 -0
- package/docs/0-intro.tsx +9 -0
- package/package.json +14 -16
- package/report.api.md +4 -1
|
@@ -87,14 +87,18 @@ var ToolbarBlockType = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
87
87
|
});
|
|
88
88
|
|
|
89
89
|
_defineProperty(_assertThisInitialized(_this), "handleSelectBlockType", function (_ref) {
|
|
90
|
-
var item = _ref.item
|
|
90
|
+
var item = _ref.item,
|
|
91
|
+
_ref$shouldCloseMenu = _ref.shouldCloseMenu,
|
|
92
|
+
shouldCloseMenu = _ref$shouldCloseMenu === void 0 ? true : _ref$shouldCloseMenu;
|
|
91
93
|
var blockType = item.value;
|
|
92
94
|
|
|
93
95
|
_this.props.setBlockType(blockType.name);
|
|
94
96
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
97
|
+
if (shouldCloseMenu) {
|
|
98
|
+
_this.setState({
|
|
99
|
+
active: false
|
|
100
|
+
});
|
|
101
|
+
}
|
|
98
102
|
});
|
|
99
103
|
|
|
100
104
|
return _this;
|
|
@@ -137,7 +137,7 @@ export var BlockCard = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
137
137
|
value: function createDomRef() {
|
|
138
138
|
var domRef = document.createElement('div');
|
|
139
139
|
|
|
140
|
-
if (
|
|
140
|
+
if (this.reactComponentProps.platform !== 'mobile') {
|
|
141
141
|
// workaround Chrome bug in https://product-fabric.atlassian.net/browse/ED-5379
|
|
142
142
|
// see also: https://github.com/ProseMirror/prosemirror/issues/884
|
|
143
143
|
domRef.contentEditable = 'true';
|
|
@@ -22,7 +22,6 @@ import PropTypes from 'prop-types';
|
|
|
22
22
|
import rafSchedule from 'raf-schd';
|
|
23
23
|
import { Card } from './genericCard';
|
|
24
24
|
import { UnsupportedBlock, MediaSingle as RichMediaWrapper, findOverflowScrollParent } from '@atlaskit/editor-common/ui';
|
|
25
|
-
import { browser } from '@atlaskit/editor-common/utils';
|
|
26
25
|
import { DEFAULT_EMBED_CARD_HEIGHT, DEFAULT_EMBED_CARD_WIDTH } from '@atlaskit/editor-shared-styles';
|
|
27
26
|
import { SelectionBasedNodeView } from '../../../nodeviews/';
|
|
28
27
|
import { registerCard } from '../pm-plugins/actions';
|
|
@@ -359,7 +358,7 @@ export var EmbedCard = /*#__PURE__*/function (_SelectionBasedNodeVi) {
|
|
|
359
358
|
value: function createDomRef() {
|
|
360
359
|
var domRef = document.createElement('div');
|
|
361
360
|
|
|
362
|
-
if (
|
|
361
|
+
if (this.reactComponentProps.platform !== 'mobile') {
|
|
363
362
|
// workaround Chrome bug in https://product-fabric.atlassian.net/browse/ED-5379
|
|
364
363
|
// see also: https://github.com/ProseMirror/prosemirror/issues/884
|
|
365
364
|
domRef.contentEditable = 'true';
|
|
@@ -5,8 +5,8 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
5
5
|
|
|
6
6
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
7
7
|
|
|
8
|
+
import { NodeSelection, TextSelection } from 'prosemirror-state';
|
|
8
9
|
import { closeHistory } from 'prosemirror-history';
|
|
9
|
-
import { NodeSelection } from 'prosemirror-state';
|
|
10
10
|
import { isSafeUrl } from '@atlaskit/adf-schema';
|
|
11
11
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, addAnalytics, EVENT_TYPE, INPUT_METHOD } from '../../../plugins/analytics';
|
|
12
12
|
import { SMART_LINK_TYPE } from '../../../plugins/analytics/types/node-events';
|
|
@@ -322,6 +322,8 @@ export var changeSelectedCardToText = function changeSelectedCardToText(text) {
|
|
|
322
322
|
};
|
|
323
323
|
export var setSelectedCardAppearance = function setSelectedCardAppearance(appearance) {
|
|
324
324
|
return function (state, dispatch) {
|
|
325
|
+
var _previousNode$type;
|
|
326
|
+
|
|
325
327
|
var selectedNode = state.selection instanceof NodeSelection && state.selection.node;
|
|
326
328
|
|
|
327
329
|
if (!selectedNode) {
|
|
@@ -344,9 +346,24 @@ export var setSelectedCardAppearance = function setSelectedCardAppearance(appear
|
|
|
344
346
|
var attrs = isEmbed ? _objectSpread(_objectSpread({}, selectedNode.attrs), {}, {
|
|
345
347
|
layout: 'center'
|
|
346
348
|
}) : selectedNode.attrs;
|
|
347
|
-
var
|
|
349
|
+
var _state$selection = state.selection,
|
|
350
|
+
from = _state$selection.from,
|
|
351
|
+
to = _state$selection.to;
|
|
348
352
|
var nodeType = getLinkNodeType(appearance, state.schema.nodes);
|
|
349
|
-
var tr = state.tr.setNodeMarkup(from, nodeType, attrs, selectedNode.marks);
|
|
353
|
+
var tr = state.tr.setNodeMarkup(from, nodeType, attrs, selectedNode.marks); // When the selected card is the last element in the doc we add a new paragraph after it for consistent replacement
|
|
354
|
+
|
|
355
|
+
if (tr.doc.nodeSize - 2 === to) {
|
|
356
|
+
tr.insertText(' ', to);
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
tr.setSelection(TextSelection.create(tr.doc, to + 1));
|
|
360
|
+
var previousNodePos = from - 1 > 0 ? from - 1 : 0;
|
|
361
|
+
var previousNode = tr.doc.nodeAt(previousNodePos);
|
|
362
|
+
|
|
363
|
+
if ((previousNode === null || previousNode === void 0 ? void 0 : (_previousNode$type = previousNode.type) === null || _previousNode$type === void 0 ? void 0 : _previousNode$type.name) === 'paragraph') {
|
|
364
|
+
tr.delete(previousNodePos, from);
|
|
365
|
+
}
|
|
366
|
+
|
|
350
367
|
addAnalytics(state, tr, {
|
|
351
368
|
action: ACTION.CHANGED_TYPE,
|
|
352
369
|
actionSubject: ACTION_SUBJECT.SMART_LINK,
|
|
@@ -256,9 +256,10 @@ var generateToolbarItems = function generateToolbarItems(state, intl, providerFa
|
|
|
256
256
|
}
|
|
257
257
|
|
|
258
258
|
var allowBlockCards = cardOptions.allowBlockCards,
|
|
259
|
-
allowEmbeds = cardOptions.allowEmbeds;
|
|
259
|
+
allowEmbeds = cardOptions.allowEmbeds; // This code will be executed only for appearances such as "inline", "block" & "embed"
|
|
260
|
+
// For url appearance, please see HyperlinkToolbarAppearanceProps
|
|
260
261
|
|
|
261
|
-
if (
|
|
262
|
+
if (currentAppearance) {
|
|
262
263
|
toolbarItems.unshift({
|
|
263
264
|
type: 'custom',
|
|
264
265
|
fallback: [],
|
|
@@ -271,6 +272,7 @@ var generateToolbarItems = function generateToolbarItems(state, intl, providerFa
|
|
|
271
272
|
editorView: editorView,
|
|
272
273
|
editorState: state,
|
|
273
274
|
allowEmbeds: allowEmbeds,
|
|
275
|
+
allowBlockCards: allowBlockCards,
|
|
274
276
|
platform: platform
|
|
275
277
|
});
|
|
276
278
|
}
|
|
@@ -11,7 +11,7 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
|
|
|
11
11
|
import React from 'react';
|
|
12
12
|
import HyperlinkToolbar from '../../hyperlink/ui/HyperlinkAddToolbar';
|
|
13
13
|
import { showLinkToolbar, hideLinkToolbar as _hideLinkToolbar } from '../pm-plugins/actions';
|
|
14
|
-
import { addAnalytics } from '../../analytics';
|
|
14
|
+
import { addAnalytics, INPUT_METHOD } from '../../analytics';
|
|
15
15
|
import { LINKPICKER_HEIGHT_IN_PX, RECENT_SEARCH_HEIGHT_IN_PX, RECENT_SEARCH_WIDTH_IN_PX } from '../../../ui/LinkSearch/ToolbarComponents';
|
|
16
16
|
import { changeSelectedCardToLink, updateCard } from '../pm-plugins/doc';
|
|
17
17
|
import { findCardInfo, displayInfoForCard } from '../utils';
|
|
@@ -63,7 +63,10 @@ export var EditLinkToolbar = /*#__PURE__*/function (_React$Component) {
|
|
|
63
63
|
linkPickerOptions: linkPickerOptions,
|
|
64
64
|
providerFactory: providerFactory,
|
|
65
65
|
displayUrl: url,
|
|
66
|
-
displayText: text
|
|
66
|
+
displayText: text // Assumes that the smart card link picker can only ever be invoked by clicking "edit"
|
|
67
|
+
// via the floating toolbar
|
|
68
|
+
,
|
|
69
|
+
invokeMethod: INPUT_METHOD.FLOATING_TB,
|
|
67
70
|
onSubmit: function onSubmit(href, title, displayText) {
|
|
68
71
|
_this.hideLinkToolbar();
|
|
69
72
|
|
|
@@ -42,6 +42,8 @@ export var LinkToolbarAppearance = /*#__PURE__*/function (_React$Component) {
|
|
|
42
42
|
currentAppearance = _this$props.currentAppearance,
|
|
43
43
|
editorState = _this$props.editorState,
|
|
44
44
|
allowEmbeds = _this$props.allowEmbeds,
|
|
45
|
+
_this$props$allowBloc = _this$props.allowBlockCards,
|
|
46
|
+
allowBlockCards = _this$props$allowBloc === void 0 ? true : _this$props$allowBloc,
|
|
45
47
|
platform = _this$props.platform;
|
|
46
48
|
var preview = allowEmbeds && cardContext && url && cardContext.extractors.getPreview(url, platform);
|
|
47
49
|
|
|
@@ -55,7 +57,7 @@ export var LinkToolbarAppearance = /*#__PURE__*/function (_React$Component) {
|
|
|
55
57
|
}
|
|
56
58
|
}
|
|
57
59
|
|
|
58
|
-
var isBlockCardLinkSupportedInParent = isSupportedInParent(editorState, Fragment.from(editorState.schema.nodes.blockCard.createChecked({})), currentAppearance);
|
|
60
|
+
var isBlockCardLinkSupportedInParent = allowBlockCards ? isSupportedInParent(editorState, Fragment.from(editorState.schema.nodes.blockCard.createChecked({})), currentAppearance) : false;
|
|
59
61
|
var isEmbedCardLinkSupportedInParent = allowEmbeds ? isSupportedInParent(editorState, Fragment.from(editorState.schema.nodes.embedCard.createChecked({})), currentAppearance) : false;
|
|
60
62
|
var embedOption = allowEmbeds && preview && {
|
|
61
63
|
appearance: 'embed',
|
|
@@ -67,6 +69,15 @@ export var LinkToolbarAppearance = /*#__PURE__*/function (_React$Component) {
|
|
|
67
69
|
disabled: !isEmbedCardLinkSupportedInParent,
|
|
68
70
|
tooltip: isEmbedCardLinkSupportedInParent ? undefined : getUnavailableMessage(editorState, intl)
|
|
69
71
|
};
|
|
72
|
+
var blockCardOption = allowBlockCards && {
|
|
73
|
+
appearance: 'block',
|
|
74
|
+
title: intl.formatMessage(messages.block),
|
|
75
|
+
onClick: setSelectedCardAppearance('block'),
|
|
76
|
+
selected: currentAppearance === 'block',
|
|
77
|
+
testId: 'block-appearance',
|
|
78
|
+
disabled: !isBlockCardLinkSupportedInParent,
|
|
79
|
+
tooltip: isBlockCardLinkSupportedInParent ? undefined : getUnavailableMessage(editorState, intl)
|
|
80
|
+
};
|
|
70
81
|
var options = [{
|
|
71
82
|
title: intl.formatMessage(messages.url),
|
|
72
83
|
onClick: function onClick() {
|
|
@@ -80,14 +91,6 @@ export var LinkToolbarAppearance = /*#__PURE__*/function (_React$Component) {
|
|
|
80
91
|
onClick: setSelectedCardAppearance('inline'),
|
|
81
92
|
selected: currentAppearance === 'inline',
|
|
82
93
|
testId: 'inline-appearance'
|
|
83
|
-
}, {
|
|
84
|
-
appearance: 'block',
|
|
85
|
-
title: intl.formatMessage(messages.block),
|
|
86
|
-
onClick: setSelectedCardAppearance('block'),
|
|
87
|
-
selected: currentAppearance === 'block',
|
|
88
|
-
testId: 'block-appearance',
|
|
89
|
-
disabled: !isBlockCardLinkSupportedInParent,
|
|
90
|
-
tooltip: isBlockCardLinkSupportedInParent ? undefined : getUnavailableMessage(editorState, intl)
|
|
91
94
|
}];
|
|
92
95
|
|
|
93
96
|
var dispatchCommand = function dispatchCommand(fn) {
|
|
@@ -98,6 +101,10 @@ export var LinkToolbarAppearance = /*#__PURE__*/function (_React$Component) {
|
|
|
98
101
|
}
|
|
99
102
|
};
|
|
100
103
|
|
|
104
|
+
if (blockCardOption) {
|
|
105
|
+
options.push(blockCardOption);
|
|
106
|
+
}
|
|
107
|
+
|
|
101
108
|
if (embedOption) {
|
|
102
109
|
options.push(embedOption);
|
|
103
110
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
|
-
import { receiveTransaction } from 'prosemirror-collab';
|
|
2
|
+
import { receiveTransaction } from '@atlaskit/prosemirror-collab';
|
|
3
3
|
import { Step } from 'prosemirror-transform';
|
|
4
4
|
import { AllSelection, NodeSelection } from 'prosemirror-state';
|
|
5
5
|
import { replaceDocument } from './utils';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
2
2
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
3
3
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
4
|
-
import { collab } from 'prosemirror-collab';
|
|
4
|
+
import { collab } from '@atlaskit/prosemirror-collab';
|
|
5
5
|
import { createPlugin, pluginKey } from './plugin';
|
|
6
6
|
import { sendTransaction } from './events/send-transaction';
|
|
7
7
|
import { addSynchronyErrorAnalytics } from './analytics';
|
|
@@ -6,7 +6,7 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
|
6
6
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
7
7
|
import { utils } from '@atlaskit/util-service-support';
|
|
8
8
|
import { EventEmitter2 } from 'eventemitter2';
|
|
9
|
-
import { getVersion, sendableSteps } from 'prosemirror-collab';
|
|
9
|
+
import { getVersion, sendableSteps } from '@atlaskit/prosemirror-collab';
|
|
10
10
|
import { logger } from './logger';
|
|
11
11
|
export var Channel = /*#__PURE__*/function () {
|
|
12
12
|
function Channel(config, pubSubClient) {
|
|
@@ -149,6 +149,11 @@ export function expandKeymap() {
|
|
|
149
149
|
|
|
150
150
|
if (editorView.endOfTextblock('down')) {
|
|
151
151
|
var _$from2 = state.selection.$from;
|
|
152
|
+
|
|
153
|
+
if (_$from2.depth === 0) {
|
|
154
|
+
return false;
|
|
155
|
+
}
|
|
156
|
+
|
|
152
157
|
var $after = state.doc.resolve(_$from2.after());
|
|
153
158
|
|
|
154
159
|
if ($after.nodeAfter && ($after.nodeAfter.type === expand || $after.nodeAfter.type === nestedExpand)) {
|
|
@@ -151,6 +151,7 @@ var ToolbarItems = /*#__PURE__*/React.memo(function (_ref) {
|
|
|
151
151
|
|
|
152
152
|
case 'select':
|
|
153
153
|
if (item.selectType === 'list') {
|
|
154
|
+
var ariaLabel = item.title || item.placeholder;
|
|
154
155
|
return jsx(Select, {
|
|
155
156
|
key: idx,
|
|
156
157
|
dispatchCommand: dispatchCommand,
|
|
@@ -164,8 +165,10 @@ var ToolbarItems = /*#__PURE__*/React.memo(function (_ref) {
|
|
|
164
165
|
onChange: function onChange(selected) {
|
|
165
166
|
return dispatchCommand(item.onChange(selected));
|
|
166
167
|
},
|
|
168
|
+
ariaLabel: ariaLabel,
|
|
167
169
|
filterOption: item.filterOption,
|
|
168
|
-
setDisableParentScroll: scrollable ? setDisableScroll : undefined
|
|
170
|
+
setDisableParentScroll: scrollable ? setDisableScroll : undefined,
|
|
171
|
+
classNamePrefix: 'floating-toolbar-select'
|
|
169
172
|
});
|
|
170
173
|
}
|
|
171
174
|
|
|
@@ -347,15 +350,21 @@ var Toolbar = /*#__PURE__*/function (_Component) {
|
|
|
347
350
|
});
|
|
348
351
|
|
|
349
352
|
_defineProperty(_assertThisInitialized(_this), "handleEscape", function (event) {
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
353
|
+
var _this$props$editorVie;
|
|
354
|
+
|
|
355
|
+
// If any menu is open inside the floating toolbar 'Esc' key should not
|
|
356
|
+
// focus the editorview.
|
|
357
|
+
// Event can't be stopped as they are not childnodes of floating toolbar
|
|
358
|
+
var isDropdownOpen = !!document.querySelector('[data-role="droplistContent"]');
|
|
359
|
+
var isSelectMenuOpen = !!document.querySelector('.floating-toolbar-select__menu');
|
|
360
|
+
|
|
361
|
+
if (isDropdownOpen || isSelectMenuOpen) {
|
|
362
|
+
return;
|
|
358
363
|
}
|
|
364
|
+
|
|
365
|
+
(_this$props$editorVie = _this.props.editorView) === null || _this$props$editorVie === void 0 ? void 0 : _this$props$editorVie.focus();
|
|
366
|
+
event.preventDefault();
|
|
367
|
+
event.stopPropagation();
|
|
359
368
|
});
|
|
360
369
|
|
|
361
370
|
_this.scrollContainerRef = /*#__PURE__*/React.createRef();
|
|
@@ -189,6 +189,7 @@ export var HyperlinkToolbarAppearance = /*#__PURE__*/function (_Component) {
|
|
|
189
189
|
editorView: editorView,
|
|
190
190
|
editorState: editorState,
|
|
191
191
|
allowEmbeds: cardOptions === null || cardOptions === void 0 ? void 0 : cardOptions.allowEmbeds,
|
|
192
|
+
allowBlockCards: cardOptions === null || cardOptions === void 0 ? void 0 : cardOptions.allowBlockCards,
|
|
192
193
|
platform: platform
|
|
193
194
|
});
|
|
194
195
|
}
|
|
@@ -66,7 +66,8 @@ var hyperlinkPlugin = function hyperlinkPlugin(options) {
|
|
|
66
66
|
action: function action(insert, state) {
|
|
67
67
|
var tr = insert(undefined);
|
|
68
68
|
tr.setMeta(stateKey, {
|
|
69
|
-
type: LinkAction.SHOW_INSERT_TOOLBAR
|
|
69
|
+
type: LinkAction.SHOW_INSERT_TOOLBAR,
|
|
70
|
+
inputMethod: INPUT_METHOD.QUICK_INSERT
|
|
70
71
|
});
|
|
71
72
|
return addAnalytics(state, tr, {
|
|
72
73
|
action: ACTION.INVOKED,
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
-
var _excluded = ["view", "onCancel"];
|
|
4
|
-
import React, { useCallback } from 'react';
|
|
3
|
+
var _excluded = ["view", "onCancel", "invokeMethod"];
|
|
4
|
+
import React, { useCallback, useMemo } from 'react';
|
|
5
5
|
import { LinkPicker } from '@atlaskit/link-picker';
|
|
6
6
|
import { hideLinkToolbar as cardHideLinkToolbar } from '../../../card/pm-plugins/actions';
|
|
7
7
|
import { hideLinkToolbar } from '../../commands';
|
|
8
8
|
import { useEscapeClickaway } from './useEscapeClickaway';
|
|
9
|
+
import { AnalyticsContext } from '@atlaskit/analytics-next';
|
|
9
10
|
/**
|
|
10
11
|
* Returns a type that matches T but where keys (K) are now optional
|
|
11
12
|
*/
|
|
@@ -13,6 +14,8 @@ import { useEscapeClickaway } from './useEscapeClickaway';
|
|
|
13
14
|
export var EditorLinkPicker = function EditorLinkPicker(_ref) {
|
|
14
15
|
var view = _ref.view,
|
|
15
16
|
onCancel = _ref.onCancel,
|
|
17
|
+
_ref$invokeMethod = _ref.invokeMethod,
|
|
18
|
+
invokeMethod = _ref$invokeMethod === void 0 ? '_unknown' : _ref$invokeMethod,
|
|
16
19
|
restProps = _objectWithoutProperties(_ref, _excluded);
|
|
17
20
|
|
|
18
21
|
var onEscape = useCallback(function () {
|
|
@@ -25,9 +28,18 @@ export var EditorLinkPicker = function EditorLinkPicker(_ref) {
|
|
|
25
28
|
onCancel === null || onCancel === void 0 ? void 0 : onCancel();
|
|
26
29
|
}, [view, onCancel]);
|
|
27
30
|
var ref = useEscapeClickaway(onEscape, onClickAway);
|
|
31
|
+
var analyticsData = useMemo(function () {
|
|
32
|
+
return {
|
|
33
|
+
attributes: {
|
|
34
|
+
invokeMethod: invokeMethod
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
}, [invokeMethod]);
|
|
28
38
|
return /*#__PURE__*/React.createElement("div", {
|
|
29
39
|
ref: ref
|
|
40
|
+
}, /*#__PURE__*/React.createElement(AnalyticsContext, {
|
|
41
|
+
data: analyticsData
|
|
30
42
|
}, /*#__PURE__*/React.createElement(LinkPicker, _extends({}, restProps, {
|
|
31
43
|
onCancel: onEscape
|
|
32
|
-
})));
|
|
44
|
+
}))));
|
|
33
45
|
};
|
|
@@ -371,20 +371,11 @@ export var HyperlinkLinkAddToolbar = /*#__PURE__*/function (_PureComponent) {
|
|
|
371
371
|
switch (_context3.prev = _context3.next) {
|
|
372
372
|
case 0:
|
|
373
373
|
activityProvider = _this.state.activityProvider;
|
|
374
|
-
|
|
375
|
-
if (activityProvider) {
|
|
376
|
-
_context3.next = 3;
|
|
377
|
-
break;
|
|
378
|
-
}
|
|
379
|
-
|
|
380
|
-
return _context3.abrupt("return");
|
|
381
|
-
|
|
382
|
-
case 3:
|
|
383
374
|
_context3.t0 = field;
|
|
384
|
-
_context3.next = _context3.t0 === 'displayUrl' ?
|
|
375
|
+
_context3.next = _context3.t0 === 'displayUrl' ? 4 : _context3.t0 === 'displayText' ? 24 : 26;
|
|
385
376
|
break;
|
|
386
377
|
|
|
387
|
-
case
|
|
378
|
+
case 4:
|
|
388
379
|
_context3.t1 = _this;
|
|
389
380
|
_this$setState = {};
|
|
390
381
|
|
|
@@ -392,32 +383,46 @@ export var HyperlinkLinkAddToolbar = /*#__PURE__*/function (_PureComponent) {
|
|
|
392
383
|
|
|
393
384
|
_context3.t2 = _defineProperty;
|
|
394
385
|
_context3.t3 = _this$setState;
|
|
395
|
-
|
|
396
|
-
|
|
386
|
+
|
|
387
|
+
if (!activityProvider) {
|
|
388
|
+
_context3.next = 17;
|
|
389
|
+
break;
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
_context3.t5 = limit;
|
|
393
|
+
_context3.next = 13;
|
|
397
394
|
return activityProvider.getRecentItems();
|
|
398
395
|
|
|
399
|
-
case
|
|
400
|
-
_context3.
|
|
401
|
-
_context3.
|
|
402
|
-
|
|
403
|
-
|
|
396
|
+
case 13:
|
|
397
|
+
_context3.t6 = _context3.sent;
|
|
398
|
+
_context3.t4 = (0, _context3.t5)(_context3.t6);
|
|
399
|
+
_context3.next = 18;
|
|
400
|
+
break;
|
|
404
401
|
|
|
405
|
-
|
|
402
|
+
case 17:
|
|
403
|
+
_context3.t4 = [];
|
|
404
|
+
|
|
405
|
+
case 18:
|
|
406
|
+
_context3.t7 = _context3.t4;
|
|
407
|
+
(0, _context3.t2)(_context3.t3, "items", _context3.t7);
|
|
408
|
+
_context3.t8 = _this$setState;
|
|
409
|
+
|
|
410
|
+
_context3.t1.setState.call(_context3.t1, _context3.t8);
|
|
406
411
|
|
|
407
412
|
if (_this.urlInputContainer) {
|
|
408
413
|
_this.urlInputContainer.focus();
|
|
409
414
|
}
|
|
410
415
|
|
|
411
|
-
return _context3.abrupt("break",
|
|
416
|
+
return _context3.abrupt("break", 26);
|
|
412
417
|
|
|
413
|
-
case
|
|
418
|
+
case 24:
|
|
414
419
|
_this.setState(_defineProperty({}, field, ''));
|
|
415
420
|
|
|
416
421
|
if (_this.displayTextInputContainer) {
|
|
417
422
|
_this.displayTextInputContainer.focus();
|
|
418
423
|
}
|
|
419
424
|
|
|
420
|
-
case
|
|
425
|
+
case 26:
|
|
421
426
|
case "end":
|
|
422
427
|
return _context3.stop();
|
|
423
428
|
}
|
|
@@ -54,7 +54,8 @@ var HyperlinkAddToolbar = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
54
54
|
displayUrl = _this$props.displayUrl,
|
|
55
55
|
providerFactory = _this$props.providerFactory,
|
|
56
56
|
view = _this$props.view,
|
|
57
|
-
onCancel = _this$props.onCancel
|
|
57
|
+
onCancel = _this$props.onCancel,
|
|
58
|
+
invokeMethod = _this$props.invokeMethod;
|
|
58
59
|
return /*#__PURE__*/React.createElement(WithProviders, {
|
|
59
60
|
providers: ['activityProvider', 'searchProvider'],
|
|
60
61
|
providerFactory: providerFactory,
|
|
@@ -74,7 +75,10 @@ var HyperlinkAddToolbar = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
74
75
|
|
|
75
76
|
if (lpLinkPicker) {
|
|
76
77
|
return /*#__PURE__*/React.createElement(EditorLinkPicker, _extends({
|
|
77
|
-
view: view
|
|
78
|
+
view: view,
|
|
79
|
+
invokeMethod: // Provide `invokeMethod` prop as preferred value (card plugin passes as prop) otherwise assume this
|
|
80
|
+
// is being used from inside the hyperlink plugin and use inputMethod from plugin state
|
|
81
|
+
invokeMethod !== null && invokeMethod !== void 0 ? invokeMethod : hyperlinkPluginState === null || hyperlinkPluginState === void 0 ? void 0 : hyperlinkPluginState.inputMethod
|
|
78
82
|
}, linkPickerOptions, {
|
|
79
83
|
url: displayUrl,
|
|
80
84
|
displayText: displayText,
|
|
@@ -15,7 +15,8 @@ export var BlockInsertElementBrowser = function BlockInsertElementBrowser(props)
|
|
|
15
15
|
editorView: props.editorView,
|
|
16
16
|
dropdownItems: props.items,
|
|
17
17
|
onInsert: props.onInsert,
|
|
18
|
-
toggleVisiblity: props.togglePlusMenuVisibility
|
|
18
|
+
toggleVisiblity: props.togglePlusMenuVisibility,
|
|
19
|
+
showElementBrowserLink: props.showElementBrowserLink
|
|
19
20
|
})), /*#__PURE__*/React.createElement(DropDownButton, {
|
|
20
21
|
"aria-expanded": props.open,
|
|
21
22
|
"aria-haspopup": true,
|
|
@@ -36,7 +36,8 @@ export var BlockInsertMenu = function BlockInsertMenu(props) {
|
|
|
36
36
|
popupsMountPoint: props.popupsMountPoint,
|
|
37
37
|
popupsScrollableElement: props.popupsScrollableElement,
|
|
38
38
|
spacing: props.spacing,
|
|
39
|
-
togglePlusMenuVisibility: props.togglePlusMenuVisibility
|
|
39
|
+
togglePlusMenuVisibility: props.togglePlusMenuVisibility,
|
|
40
|
+
showElementBrowserLink: props.showElementBrowserLink
|
|
40
41
|
});
|
|
41
42
|
}
|
|
42
43
|
|
|
@@ -569,7 +569,8 @@ export var ToolbarInsertBlock = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
569
569
|
onInsert: this.insertInsertMenuItem,
|
|
570
570
|
onOpenChange: this.onOpenChange,
|
|
571
571
|
togglePlusMenuVisibility: this.togglePlusMenuVisibility,
|
|
572
|
-
replacePlusMenuWithElementBrowser: (_this$props$replacePl = this.props.replacePlusMenuWithElementBrowser) !== null && _this$props$replacePl !== void 0 ? _this$props$replacePl : false
|
|
572
|
+
replacePlusMenuWithElementBrowser: (_this$props$replacePl = this.props.replacePlusMenuWithElementBrowser) !== null && _this$props$replacePl !== void 0 ? _this$props$replacePl : false,
|
|
573
|
+
showElementBrowserLink: this.props.showElementBrowserLink || false
|
|
573
574
|
})), this.props.showSeparator && jsx("span", {
|
|
574
575
|
css: separatorStyles
|
|
575
576
|
}));
|
|
@@ -76,7 +76,7 @@ export var updateAllMediaNodesAttrs = function updateAllMediaNodesAttrs(id, attr
|
|
|
76
76
|
var getPos = _ref.getPos;
|
|
77
77
|
var pos = getPos();
|
|
78
78
|
|
|
79
|
-
if (typeof pos === 'number' && !isMediaNode(pos, state)) {
|
|
79
|
+
if (isNaN(pos) || typeof pos === 'number' && !isMediaNode(pos, state)) {
|
|
80
80
|
return acc;
|
|
81
81
|
}
|
|
82
82
|
|
|
@@ -101,6 +101,25 @@ export var updateAllMediaNodesAttrs = function updateAllMediaNodesAttrs(id, attr
|
|
|
101
101
|
return true;
|
|
102
102
|
};
|
|
103
103
|
};
|
|
104
|
+
export var updateCurrentMediaNodeAttrs = function updateCurrentMediaNodeAttrs(attrs, mediaNode) {
|
|
105
|
+
return function (state, dispatch) {
|
|
106
|
+
var pos = mediaNode.getPos();
|
|
107
|
+
|
|
108
|
+
if (isNaN(pos) || typeof pos === 'number' && !isMediaNode(pos, state)) {
|
|
109
|
+
return false;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
var tr = state.tr;
|
|
113
|
+
tr.step(new SetAttrsStep(pos, attrs));
|
|
114
|
+
tr.setMeta('addToHistory', false);
|
|
115
|
+
|
|
116
|
+
if (dispatch) {
|
|
117
|
+
dispatch(tr);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
return true;
|
|
121
|
+
};
|
|
122
|
+
};
|
|
104
123
|
export var updateMediaNodeAttrs = function updateMediaNodeAttrs(id, attrs, isMediaSingle) {
|
|
105
124
|
return function (state, dispatch) {
|
|
106
125
|
var mediaPluginState = mediaPluginKey.getState(state);
|
|
@@ -64,24 +64,22 @@ var MediaGroup = /*#__PURE__*/function (_React$Component) {
|
|
|
64
64
|
viewMediaClientConfig: undefined
|
|
65
65
|
});
|
|
66
66
|
|
|
67
|
-
_defineProperty(_assertThisInitialized(_this), "updateNodeAttrs", function (props) {
|
|
67
|
+
_defineProperty(_assertThisInitialized(_this), "updateNodeAttrs", function (props, node, getPos) {
|
|
68
68
|
var view = props.view,
|
|
69
69
|
mediaProvider = props.mediaProvider,
|
|
70
70
|
contextIdentifierProvider = props.contextIdentifierProvider;
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
node: node,
|
|
78
|
-
isMediaSingle: false
|
|
79
|
-
});
|
|
80
|
-
mediaNodeUpdater.updateFileAttrs(false);
|
|
71
|
+
var mediaNodeUpdater = new MediaNodeUpdater({
|
|
72
|
+
view: view,
|
|
73
|
+
mediaProvider: mediaProvider,
|
|
74
|
+
contextIdentifierProvider: contextIdentifierProvider,
|
|
75
|
+
node: node,
|
|
76
|
+
isMediaSingle: false
|
|
81
77
|
});
|
|
78
|
+
mediaNodeUpdater.updateNodeAttrs(getPos);
|
|
82
79
|
});
|
|
83
80
|
|
|
84
81
|
_defineProperty(_assertThisInitialized(_this), "setMediaItems", function (props) {
|
|
82
|
+
var updatedAttrs = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
85
83
|
var node = props.node;
|
|
86
84
|
var oldMediaNodes = _this.mediaNodes;
|
|
87
85
|
_this.mediaNodes = [];
|
|
@@ -93,6 +91,10 @@ var MediaGroup = /*#__PURE__*/function (_React$Component) {
|
|
|
93
91
|
_this.mediaPluginState.setMediaGroupNode(item, getPos);
|
|
94
92
|
|
|
95
93
|
_this.mediaNodes.push(item);
|
|
94
|
+
|
|
95
|
+
if (updatedAttrs) {
|
|
96
|
+
_this.updateNodeAttrs(props, item, getPos);
|
|
97
|
+
}
|
|
96
98
|
});
|
|
97
99
|
|
|
98
100
|
_this.mediaPluginState.handleMediaGroupUpdate(oldMediaNodes, _this.mediaNodes);
|
|
@@ -265,11 +267,7 @@ var MediaGroup = /*#__PURE__*/function (_React$Component) {
|
|
|
265
267
|
key: "UNSAFE_componentWillReceiveProps",
|
|
266
268
|
value: function UNSAFE_componentWillReceiveProps(props) {
|
|
267
269
|
this.updateMediaClientConfig();
|
|
268
|
-
this.setMediaItems(props);
|
|
269
|
-
|
|
270
|
-
if (props.isCopyPasteEnabled !== false) {
|
|
271
|
-
this.updateNodeAttrs(props);
|
|
272
|
-
}
|
|
270
|
+
this.setMediaItems(props, props.isCopyPasteEnabled || props.isCopyPasteEnabled === undefined);
|
|
273
271
|
}
|
|
274
272
|
}, {
|
|
275
273
|
key: "shouldComponentUpdate",
|