@atlaskit/editor-core 187.31.7 → 187.32.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 +33 -0
- package/dist/cjs/create-editor/ReactEditorViewInternal.js +1 -1
- package/dist/cjs/plugins/analytics/plugin.js +14 -12
- package/dist/cjs/plugins/annotation/index.js +15 -13
- package/dist/cjs/plugins/avatar-group/index.js +16 -14
- package/dist/cjs/plugins/base/plugin.js +12 -10
- package/dist/cjs/plugins/before-primaryToolbar/index.js +3 -2
- package/dist/cjs/plugins/block-type/index.js +32 -30
- package/dist/cjs/plugins/breakout/index.js +10 -8
- package/dist/cjs/plugins/caption/index.js +7 -6
- package/dist/cjs/plugins/caption/pm-plugins/main.js +2 -2
- package/dist/cjs/plugins/code-bidi-warning/index.js +2 -4
- package/dist/cjs/plugins/code-block/index.js +14 -11
- package/dist/cjs/plugins/code-block/pm-plugins/ide-ux.js +2 -2
- package/dist/cjs/plugins/collab-edit/index.js +16 -14
- package/dist/cjs/plugins/collab-edit/plugin.js +5 -5
- package/dist/cjs/plugins/date/index.js +18 -17
- package/dist/cjs/plugins/emoji/index.js +35 -33
- package/dist/cjs/plugins/expand/index.js +14 -13
- package/dist/cjs/plugins/extension/index.js +16 -15
- package/dist/cjs/plugins/extension/pm-plugins/main.js +4 -4
- package/dist/cjs/plugins/feedback-dialog/index.js +5 -4
- package/dist/cjs/plugins/find-replace/index.js +17 -15
- package/dist/cjs/plugins/floating-toolbar/index.js +31 -30
- package/dist/cjs/plugins/floating-toolbar/ui/Toolbar.js +3 -3
- package/dist/cjs/plugins/help-dialog/index.js +18 -17
- package/dist/cjs/plugins/insert-block/index.js +52 -51
- package/dist/cjs/plugins/insert-block/ui/ToolbarInsertBlock/index.js +11 -11
- package/dist/cjs/plugins/layout/index.js +15 -14
- package/dist/cjs/plugins/max-content-size/index.js +4 -3
- package/dist/cjs/plugins/media/index.js +49 -47
- package/dist/cjs/plugins/media/nodeviews/mediaSingle.js +2 -2
- package/dist/cjs/plugins/media/pm-plugins/main.js +7 -7
- package/dist/cjs/plugins/media/toolbar/index.js +29 -24
- package/dist/cjs/plugins/media/toolbar/linking.js +4 -4
- package/dist/cjs/plugins/media/toolbar/utils.js +22 -2
- package/dist/cjs/plugins/media/ui/ResizableMediaSingle/ResizableMediaSingleNext.js +4 -4
- package/dist/cjs/plugins/media/ui/ResizableMediaSingle/index.js +2 -2
- package/dist/cjs/plugins/mentions/index.js +17 -15
- package/dist/cjs/plugins/panel/index.js +13 -12
- package/dist/cjs/plugins/paste/index.js +13 -10
- package/dist/cjs/plugins/paste/pm-plugins/analytics.js +8 -8
- package/dist/cjs/plugins/paste/pm-plugins/main.js +10 -10
- package/dist/cjs/plugins/placeholder/index.js +9 -7
- package/dist/cjs/plugins/placeholder-text/index.js +23 -16
- package/dist/cjs/plugins/quick-insert/index.js +13 -12
- package/dist/cjs/plugins/rule/index.js +8 -7
- package/dist/cjs/plugins/save-on-enter/index.js +4 -3
- package/dist/cjs/plugins/selection/index.js +5 -4
- package/dist/cjs/plugins/status/index.js +20 -14
- package/dist/cjs/plugins/submit-editor/index.js +4 -3
- package/dist/cjs/plugins/tasks-and-decisions/index.js +6 -5
- package/dist/cjs/plugins/text-color/index.js +17 -15
- package/dist/cjs/plugins/toolbar-lists-indentation/index.js +31 -26
- package/dist/cjs/plugins/toolbar-lists-indentation/pm-plugins/indentation-buttons.js +1 -1
- package/dist/cjs/plugins/toolbar-lists-indentation/ui/onItemActivated.js +4 -4
- package/dist/cjs/plugins/type-ahead/index.js +21 -20
- package/dist/cjs/ui/ElementBrowser/InsertMenu.js +11 -11
- package/dist/cjs/ui/ToolbarFeedback/index.js +1 -1
- package/dist/cjs/use-preset.js +2 -2
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/es2019/create-editor/ReactEditorViewInternal.js +1 -1
- package/dist/es2019/plugins/analytics/plugin.js +11 -8
- package/dist/es2019/plugins/annotation/index.js +4 -1
- package/dist/es2019/plugins/avatar-group/index.js +8 -5
- package/dist/es2019/plugins/base/plugin.js +6 -3
- package/dist/es2019/plugins/before-primaryToolbar/index.js +4 -2
- package/dist/es2019/plugins/block-type/index.js +14 -11
- package/dist/es2019/plugins/breakout/index.js +6 -3
- package/dist/es2019/plugins/caption/index.js +3 -1
- package/dist/es2019/plugins/caption/pm-plugins/main.js +2 -2
- package/dist/es2019/plugins/code-bidi-warning/index.js +2 -4
- package/dist/es2019/plugins/code-block/index.js +15 -9
- package/dist/es2019/plugins/code-block/pm-plugins/ide-ux.js +2 -2
- package/dist/es2019/plugins/collab-edit/index.js +9 -6
- package/dist/es2019/plugins/collab-edit/plugin.js +5 -5
- package/dist/es2019/plugins/date/index.js +6 -3
- package/dist/es2019/plugins/emoji/index.js +16 -13
- package/dist/es2019/plugins/expand/index.js +7 -4
- package/dist/es2019/plugins/extension/index.js +11 -8
- package/dist/es2019/plugins/extension/pm-plugins/main.js +4 -4
- package/dist/es2019/plugins/feedback-dialog/index.js +4 -2
- package/dist/es2019/plugins/find-replace/index.js +8 -5
- package/dist/es2019/plugins/floating-toolbar/index.js +6 -4
- package/dist/es2019/plugins/floating-toolbar/ui/Toolbar.js +3 -3
- package/dist/es2019/plugins/help-dialog/index.js +9 -6
- package/dist/es2019/plugins/insert-block/index.js +12 -9
- package/dist/es2019/plugins/insert-block/ui/ToolbarInsertBlock/index.js +11 -11
- package/dist/es2019/plugins/layout/index.js +8 -5
- package/dist/es2019/plugins/max-content-size/index.js +3 -1
- package/dist/es2019/plugins/media/index.js +14 -10
- package/dist/es2019/plugins/media/nodeviews/mediaSingle.js +2 -2
- package/dist/es2019/plugins/media/pm-plugins/main.js +7 -7
- package/dist/es2019/plugins/media/toolbar/index.js +29 -25
- package/dist/es2019/plugins/media/toolbar/linking.js +4 -4
- package/dist/es2019/plugins/media/toolbar/utils.js +18 -0
- package/dist/es2019/plugins/media/ui/ResizableMediaSingle/ResizableMediaSingleNext.js +4 -4
- package/dist/es2019/plugins/media/ui/ResizableMediaSingle/index.js +2 -2
- package/dist/es2019/plugins/mentions/index.js +9 -6
- package/dist/es2019/plugins/panel/index.js +5 -2
- package/dist/es2019/plugins/paste/index.js +9 -5
- package/dist/es2019/plugins/paste/pm-plugins/analytics.js +8 -8
- package/dist/es2019/plugins/paste/pm-plugins/main.js +10 -10
- package/dist/es2019/plugins/placeholder/index.js +10 -7
- package/dist/es2019/plugins/placeholder-text/index.js +12 -4
- package/dist/es2019/plugins/quick-insert/index.js +3 -1
- package/dist/es2019/plugins/rule/index.js +5 -3
- package/dist/es2019/plugins/save-on-enter/index.js +3 -1
- package/dist/es2019/plugins/selection/index.js +3 -1
- package/dist/es2019/plugins/status/index.js +11 -3
- package/dist/es2019/plugins/submit-editor/index.js +3 -1
- package/dist/es2019/plugins/tasks-and-decisions/index.js +6 -4
- package/dist/es2019/plugins/text-color/index.js +6 -3
- package/dist/es2019/plugins/toolbar-lists-indentation/index.js +9 -5
- package/dist/es2019/plugins/toolbar-lists-indentation/pm-plugins/indentation-buttons.js +1 -1
- package/dist/es2019/plugins/toolbar-lists-indentation/ui/onItemActivated.js +4 -4
- package/dist/es2019/plugins/type-ahead/index.js +3 -1
- package/dist/es2019/ui/ElementBrowser/InsertMenu.js +11 -11
- package/dist/es2019/ui/ToolbarFeedback/index.js +1 -1
- package/dist/es2019/use-preset.js +2 -2
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/esm/create-editor/ReactEditorViewInternal.js +1 -1
- package/dist/esm/plugins/analytics/plugin.js +14 -12
- package/dist/esm/plugins/annotation/index.js +15 -13
- package/dist/esm/plugins/avatar-group/index.js +16 -14
- package/dist/esm/plugins/base/plugin.js +12 -10
- package/dist/esm/plugins/before-primaryToolbar/index.js +3 -2
- package/dist/esm/plugins/block-type/index.js +32 -30
- package/dist/esm/plugins/breakout/index.js +10 -8
- package/dist/esm/plugins/caption/index.js +7 -6
- package/dist/esm/plugins/caption/pm-plugins/main.js +2 -2
- package/dist/esm/plugins/code-bidi-warning/index.js +2 -4
- package/dist/esm/plugins/code-block/index.js +14 -11
- package/dist/esm/plugins/code-block/pm-plugins/ide-ux.js +2 -2
- package/dist/esm/plugins/collab-edit/index.js +16 -14
- package/dist/esm/plugins/collab-edit/plugin.js +5 -5
- package/dist/esm/plugins/date/index.js +18 -17
- package/dist/esm/plugins/emoji/index.js +35 -33
- package/dist/esm/plugins/expand/index.js +14 -13
- package/dist/esm/plugins/extension/index.js +16 -15
- package/dist/esm/plugins/extension/pm-plugins/main.js +4 -4
- package/dist/esm/plugins/feedback-dialog/index.js +5 -4
- package/dist/esm/plugins/find-replace/index.js +17 -15
- package/dist/esm/plugins/floating-toolbar/index.js +31 -30
- package/dist/esm/plugins/floating-toolbar/ui/Toolbar.js +3 -3
- package/dist/esm/plugins/help-dialog/index.js +18 -17
- package/dist/esm/plugins/insert-block/index.js +52 -51
- package/dist/esm/plugins/insert-block/ui/ToolbarInsertBlock/index.js +11 -11
- package/dist/esm/plugins/layout/index.js +15 -14
- package/dist/esm/plugins/max-content-size/index.js +4 -3
- package/dist/esm/plugins/media/index.js +49 -47
- package/dist/esm/plugins/media/nodeviews/mediaSingle.js +2 -2
- package/dist/esm/plugins/media/pm-plugins/main.js +7 -7
- package/dist/esm/plugins/media/toolbar/index.js +30 -25
- package/dist/esm/plugins/media/toolbar/linking.js +4 -4
- package/dist/esm/plugins/media/toolbar/utils.js +19 -0
- package/dist/esm/plugins/media/ui/ResizableMediaSingle/ResizableMediaSingleNext.js +4 -4
- package/dist/esm/plugins/media/ui/ResizableMediaSingle/index.js +2 -2
- package/dist/esm/plugins/mentions/index.js +17 -15
- package/dist/esm/plugins/panel/index.js +13 -12
- package/dist/esm/plugins/paste/index.js +13 -10
- package/dist/esm/plugins/paste/pm-plugins/analytics.js +8 -8
- package/dist/esm/plugins/paste/pm-plugins/main.js +10 -10
- package/dist/esm/plugins/placeholder/index.js +9 -7
- package/dist/esm/plugins/placeholder-text/index.js +23 -16
- package/dist/esm/plugins/quick-insert/index.js +13 -12
- package/dist/esm/plugins/rule/index.js +8 -7
- package/dist/esm/plugins/save-on-enter/index.js +4 -3
- package/dist/esm/plugins/selection/index.js +5 -4
- package/dist/esm/plugins/status/index.js +20 -14
- package/dist/esm/plugins/submit-editor/index.js +4 -3
- package/dist/esm/plugins/tasks-and-decisions/index.js +6 -5
- package/dist/esm/plugins/text-color/index.js +17 -15
- package/dist/esm/plugins/toolbar-lists-indentation/index.js +31 -26
- package/dist/esm/plugins/toolbar-lists-indentation/pm-plugins/indentation-buttons.js +1 -1
- package/dist/esm/plugins/toolbar-lists-indentation/ui/onItemActivated.js +4 -4
- package/dist/esm/plugins/type-ahead/index.js +21 -20
- package/dist/esm/ui/ElementBrowser/InsertMenu.js +11 -11
- package/dist/esm/ui/ToolbarFeedback/index.js +1 -1
- package/dist/esm/use-preset.js +2 -2
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/types/labs/next/presets/default.d.ts +62 -618
- package/dist/types/plugins/avatar-group/index.d.ts +1 -1
- package/dist/types/plugins/before-primaryToolbar/index.d.ts +1 -1
- package/dist/types/plugins/caption/index.d.ts +1 -1
- package/dist/types/plugins/media/toolbar/utils.d.ts +2 -1
- package/dist/types/plugins/media/types.d.ts +1 -0
- package/dist/types/plugins/selection/index.d.ts +2 -2
- package/dist/types/plugins/text-color/index.d.ts +3 -2
- package/dist/types/use-preset.d.ts +2 -2
- package/dist/types-ts4.5/labs/next/presets/default.d.ts +96 -716
- package/dist/types-ts4.5/plugins/avatar-group/index.d.ts +1 -1
- package/dist/types-ts4.5/plugins/before-primaryToolbar/index.d.ts +1 -1
- package/dist/types-ts4.5/plugins/caption/index.d.ts +1 -1
- package/dist/types-ts4.5/plugins/media/toolbar/utils.d.ts +2 -1
- package/dist/types-ts4.5/plugins/media/types.d.ts +1 -0
- package/dist/types-ts4.5/plugins/selection/index.d.ts +2 -2
- package/dist/types-ts4.5/plugins/text-color/index.d.ts +3 -2
- package/dist/types-ts4.5/use-preset.d.ts +2 -2
- package/package.json +3 -3
|
@@ -164,19 +164,19 @@ export var ToolbarInsertBlock = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
164
164
|
}
|
|
165
165
|
});
|
|
166
166
|
_defineProperty(_assertThisInitialized(_this), "toggleLinkPanel", function (inputMethod) {
|
|
167
|
-
var _pluginInjectionApi$
|
|
167
|
+
var _pluginInjectionApi$c, _pluginInjectionApi$h;
|
|
168
168
|
var pluginInjectionApi = _this.props.pluginInjectionApi;
|
|
169
|
-
return (_pluginInjectionApi$
|
|
169
|
+
return (_pluginInjectionApi$c = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.core.actions.execute(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$h = pluginInjectionApi.hyperlink) === null || _pluginInjectionApi$h === void 0 ? void 0 : _pluginInjectionApi$h.commands.showLinkToolbar(inputMethod))) !== null && _pluginInjectionApi$c !== void 0 ? _pluginInjectionApi$c : false;
|
|
170
170
|
});
|
|
171
171
|
_defineProperty(_assertThisInitialized(_this), "insertMention", function (inputMethod) {
|
|
172
|
-
var _pluginInjectionApi$
|
|
172
|
+
var _pluginInjectionApi$m;
|
|
173
173
|
var _this$props = _this.props,
|
|
174
174
|
editorView = _this$props.editorView,
|
|
175
175
|
pluginInjectionApi = _this$props.pluginInjectionApi;
|
|
176
176
|
if (!editorView) {
|
|
177
177
|
return true;
|
|
178
178
|
}
|
|
179
|
-
var pluginState = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$
|
|
179
|
+
var pluginState = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$m = pluginInjectionApi.mention) === null || _pluginInjectionApi$m === void 0 ? void 0 : _pluginInjectionApi$m.sharedState.currentState();
|
|
180
180
|
if (pluginState && pluginState.canInsertMention === false) {
|
|
181
181
|
return false;
|
|
182
182
|
}
|
|
@@ -184,13 +184,13 @@ export var ToolbarInsertBlock = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
184
184
|
return true;
|
|
185
185
|
});
|
|
186
186
|
_defineProperty(_assertThisInitialized(_this), "insertTable", function (inputMethod) {
|
|
187
|
-
var _pluginInjectionApi$
|
|
187
|
+
var _pluginInjectionApi$t, _pluginInjectionApi$t2, _pluginInjectionApi$t3, _pluginInjectionApi$t4;
|
|
188
188
|
var _this$props2 = _this.props,
|
|
189
189
|
pluginInjectionApi = _this$props2.pluginInjectionApi,
|
|
190
190
|
editorView = _this$props2.editorView;
|
|
191
191
|
var state = editorView.state,
|
|
192
192
|
dispatch = editorView.dispatch;
|
|
193
|
-
return (_pluginInjectionApi$
|
|
193
|
+
return (_pluginInjectionApi$t = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$t2 = pluginInjectionApi.table) === null || _pluginInjectionApi$t2 === void 0 ? void 0 : (_pluginInjectionApi$t3 = (_pluginInjectionApi$t4 = _pluginInjectionApi$t2.actions).insertTable) === null || _pluginInjectionApi$t3 === void 0 ? void 0 : _pluginInjectionApi$t3.call(_pluginInjectionApi$t4, {
|
|
194
194
|
action: ACTION.INSERTED,
|
|
195
195
|
actionSubject: ACTION_SUBJECT.DOCUMENT,
|
|
196
196
|
actionSubjectId: ACTION_SUBJECT_ID.TABLE,
|
|
@@ -198,7 +198,7 @@ export var ToolbarInsertBlock = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
198
198
|
inputMethod: inputMethod
|
|
199
199
|
},
|
|
200
200
|
eventType: EVENT_TYPE.TRACK
|
|
201
|
-
})(state, dispatch)) !== null && _pluginInjectionApi$
|
|
201
|
+
})(state, dispatch)) !== null && _pluginInjectionApi$t !== void 0 ? _pluginInjectionApi$t : false;
|
|
202
202
|
});
|
|
203
203
|
_defineProperty(_assertThisInitialized(_this), "createDate", function (inputMethod) {
|
|
204
204
|
var editorView = _this.props.editorView;
|
|
@@ -275,17 +275,17 @@ export var ToolbarInsertBlock = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
275
275
|
};
|
|
276
276
|
});
|
|
277
277
|
_defineProperty(_assertThisInitialized(_this), "handleSelectedEmoji", function (emojiId) {
|
|
278
|
-
var _pluginInjectionApi$
|
|
278
|
+
var _pluginInjectionApi$e;
|
|
279
279
|
var pluginInjectionApi = _this.props.pluginInjectionApi;
|
|
280
280
|
_this.props.editorView.focus();
|
|
281
|
-
pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.
|
|
281
|
+
pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.core.actions.execute((_pluginInjectionApi$e = pluginInjectionApi.emoji) === null || _pluginInjectionApi$e === void 0 ? void 0 : _pluginInjectionApi$e.commands.insertEmoji(emojiId, INPUT_METHOD.PICKER));
|
|
282
282
|
_this.toggleEmojiPicker();
|
|
283
283
|
return true;
|
|
284
284
|
});
|
|
285
285
|
_defineProperty(_assertThisInitialized(_this), "openElementBrowser", function () {
|
|
286
|
-
var _pluginInjectionApi$
|
|
286
|
+
var _pluginInjectionApi$q;
|
|
287
287
|
var pluginInjectionApi = _this.props.pluginInjectionApi;
|
|
288
|
-
pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.
|
|
288
|
+
pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.core.actions.execute(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$q = pluginInjectionApi.quickInsert) === null || _pluginInjectionApi$q === void 0 ? void 0 : _pluginInjectionApi$q.commands.openElementBrowserModal);
|
|
289
289
|
});
|
|
290
290
|
_defineProperty(_assertThisInitialized(_this), "onItemActivated", function (_ref2) {
|
|
291
291
|
var item = _ref2.item,
|
|
@@ -8,9 +8,10 @@ import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } f
|
|
|
8
8
|
import { messages } from '../insert-block/ui/ToolbarInsertBlock/messages';
|
|
9
9
|
import { pluginKey } from './pm-plugins/plugin-key';
|
|
10
10
|
export { pluginKey };
|
|
11
|
-
var layoutPlugin = function layoutPlugin() {
|
|
12
|
-
var
|
|
13
|
-
|
|
11
|
+
var layoutPlugin = function layoutPlugin(_ref) {
|
|
12
|
+
var _ref$config = _ref.config,
|
|
13
|
+
options = _ref$config === void 0 ? {} : _ref$config,
|
|
14
|
+
api = _ref.api;
|
|
14
15
|
return {
|
|
15
16
|
name: 'layout',
|
|
16
17
|
nodes: function nodes() {
|
|
@@ -32,19 +33,19 @@ var layoutPlugin = function layoutPlugin() {
|
|
|
32
33
|
},
|
|
33
34
|
pluginsOptions: {
|
|
34
35
|
floatingToolbar: function floatingToolbar(state, intl) {
|
|
35
|
-
var
|
|
36
|
-
pos =
|
|
37
|
-
allowBreakout =
|
|
38
|
-
addSidebarLayouts =
|
|
39
|
-
allowSingleColumnLayout =
|
|
36
|
+
var _ref2 = pluginKey.getState(state),
|
|
37
|
+
pos = _ref2.pos,
|
|
38
|
+
allowBreakout = _ref2.allowBreakout,
|
|
39
|
+
addSidebarLayouts = _ref2.addSidebarLayouts,
|
|
40
|
+
allowSingleColumnLayout = _ref2.allowSingleColumnLayout;
|
|
40
41
|
if (pos !== null) {
|
|
41
|
-
var _api$
|
|
42
|
-
return buildToolbar(state, intl, pos, allowBreakout, addSidebarLayouts, allowSingleColumnLayout, api === null || api === void 0 ? void 0 : (_api$
|
|
42
|
+
var _api$decorations$acti;
|
|
43
|
+
return buildToolbar(state, intl, pos, allowBreakout, addSidebarLayouts, allowSingleColumnLayout, api === null || api === void 0 ? void 0 : (_api$decorations$acti = api.decorations.actions) === null || _api$decorations$acti === void 0 ? void 0 : _api$decorations$acti.hoverDecoration);
|
|
43
44
|
}
|
|
44
45
|
return undefined;
|
|
45
46
|
},
|
|
46
|
-
quickInsert: function quickInsert(
|
|
47
|
-
var formatMessage =
|
|
47
|
+
quickInsert: function quickInsert(_ref3) {
|
|
48
|
+
var formatMessage = _ref3.formatMessage;
|
|
48
49
|
return [{
|
|
49
50
|
id: 'layout',
|
|
50
51
|
title: formatMessage(messages.columns),
|
|
@@ -55,9 +56,9 @@ var layoutPlugin = function layoutPlugin() {
|
|
|
55
56
|
return /*#__PURE__*/React.createElement(IconLayout, null);
|
|
56
57
|
},
|
|
57
58
|
action: function action(insert, state) {
|
|
58
|
-
var _api$
|
|
59
|
+
var _api$analytics, _api$analytics$action;
|
|
59
60
|
var tr = insert(createDefaultLayoutSection(state));
|
|
60
|
-
api === null || api === void 0 ? void 0 : (_api$
|
|
61
|
+
api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : (_api$analytics$action = _api$analytics.actions) === null || _api$analytics$action === void 0 ? void 0 : _api$analytics$action.attachAnalyticsEvent({
|
|
61
62
|
action: ACTION.INSERTED,
|
|
62
63
|
actionSubject: ACTION_SUBJECT.DOCUMENT,
|
|
63
64
|
actionSubjectId: ACTION_SUBJECT_ID.LAYOUT,
|
|
@@ -19,14 +19,15 @@ export function createPlugin(dispatch, maxContentSize) {
|
|
|
19
19
|
}
|
|
20
20
|
});
|
|
21
21
|
}
|
|
22
|
-
var maxContentSizePlugin = function maxContentSizePlugin(
|
|
22
|
+
var maxContentSizePlugin = function maxContentSizePlugin(_ref) {
|
|
23
|
+
var maxContentSize = _ref.config;
|
|
23
24
|
return {
|
|
24
25
|
name: 'maxContentSize',
|
|
25
26
|
pmPlugins: function pmPlugins() {
|
|
26
27
|
return [{
|
|
27
28
|
name: 'maxContentSize',
|
|
28
|
-
plugin: function plugin(
|
|
29
|
-
var dispatch =
|
|
29
|
+
plugin: function plugin(_ref2) {
|
|
30
|
+
var dispatch = _ref2.dispatch;
|
|
30
31
|
return createPlugin(dispatch, maxContentSize);
|
|
31
32
|
}
|
|
32
33
|
}];
|
|
@@ -24,11 +24,12 @@ import { ReactMediaInlineNode } from './nodeviews/mediaInline';
|
|
|
24
24
|
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
25
25
|
import { stateKey } from './pm-plugins/plugin-key';
|
|
26
26
|
export { insertMediaSingleNode } from './utils/media-single';
|
|
27
|
-
var mediaPlugin = function mediaPlugin() {
|
|
28
|
-
var _api$
|
|
29
|
-
var
|
|
30
|
-
|
|
31
|
-
|
|
27
|
+
var mediaPlugin = function mediaPlugin(_ref) {
|
|
28
|
+
var _api$featureFlags;
|
|
29
|
+
var _ref$config = _ref.config,
|
|
30
|
+
options = _ref$config === void 0 ? {} : _ref$config,
|
|
31
|
+
api = _ref.api;
|
|
32
|
+
var featureFlags = (api === null || api === void 0 ? void 0 : (_api$featureFlags = api.featureFlags) === null || _api$featureFlags === void 0 ? void 0 : _api$featureFlags.sharedState.currentState()) || {};
|
|
32
33
|
return {
|
|
33
34
|
name: 'media',
|
|
34
35
|
getSharedState: function getSharedState(editorState) {
|
|
@@ -38,12 +39,12 @@ var mediaPlugin = function mediaPlugin() {
|
|
|
38
39
|
return stateKey.getState(editorState) || null;
|
|
39
40
|
},
|
|
40
41
|
nodes: function nodes() {
|
|
41
|
-
var
|
|
42
|
-
|
|
43
|
-
allowMediaGroup =
|
|
44
|
-
|
|
45
|
-
allowMediaSingle =
|
|
46
|
-
mediaFeatureFlags =
|
|
42
|
+
var _ref2 = options || {},
|
|
43
|
+
_ref2$allowMediaGroup = _ref2.allowMediaGroup,
|
|
44
|
+
allowMediaGroup = _ref2$allowMediaGroup === void 0 ? true : _ref2$allowMediaGroup,
|
|
45
|
+
_ref2$allowMediaSingl = _ref2.allowMediaSingle,
|
|
46
|
+
allowMediaSingle = _ref2$allowMediaSingl === void 0 ? false : _ref2$allowMediaSingl,
|
|
47
|
+
mediaFeatureFlags = _ref2.featureFlags;
|
|
47
48
|
var captions = getMediaFeatureFlag('captions', mediaFeatureFlags);
|
|
48
49
|
var allowMediaInline = getMediaFeatureFlag('mediaInline', mediaFeatureFlags);
|
|
49
50
|
var mediaSingleOption = getBooleanFF('platform.editor.media.extended-resize-experience') ? {
|
|
@@ -82,16 +83,16 @@ var mediaPlugin = function mediaPlugin() {
|
|
|
82
83
|
pmPlugins: function pmPlugins() {
|
|
83
84
|
var pmPlugins = [{
|
|
84
85
|
name: 'media',
|
|
85
|
-
plugin: function plugin(
|
|
86
|
-
var schema =
|
|
87
|
-
dispatch =
|
|
88
|
-
getIntl =
|
|
89
|
-
eventDispatcher =
|
|
90
|
-
providerFactory =
|
|
91
|
-
errorReporter =
|
|
92
|
-
portalProviderAPI =
|
|
93
|
-
reactContext =
|
|
94
|
-
dispatchAnalyticsEvent =
|
|
86
|
+
plugin: function plugin(_ref3) {
|
|
87
|
+
var schema = _ref3.schema,
|
|
88
|
+
dispatch = _ref3.dispatch,
|
|
89
|
+
getIntl = _ref3.getIntl,
|
|
90
|
+
eventDispatcher = _ref3.eventDispatcher,
|
|
91
|
+
providerFactory = _ref3.providerFactory,
|
|
92
|
+
errorReporter = _ref3.errorReporter,
|
|
93
|
+
portalProviderAPI = _ref3.portalProviderAPI,
|
|
94
|
+
reactContext = _ref3.reactContext,
|
|
95
|
+
dispatchAnalyticsEvent = _ref3.dispatchAnalyticsEvent;
|
|
95
96
|
return createPlugin(schema, {
|
|
96
97
|
providerFactory: providerFactory,
|
|
97
98
|
nodeViews: {
|
|
@@ -111,15 +112,15 @@ var mediaPlugin = function mediaPlugin() {
|
|
|
111
112
|
}, {
|
|
112
113
|
name: 'mediaKeymap',
|
|
113
114
|
plugin: function plugin() {
|
|
114
|
-
var _api$
|
|
115
|
-
return keymapPlugin(options, api === null || api === void 0 ? void 0 : (_api$
|
|
115
|
+
var _api$analytics;
|
|
116
|
+
return keymapPlugin(options, api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions);
|
|
116
117
|
}
|
|
117
118
|
}];
|
|
118
119
|
if (options && options.allowMediaSingle) {
|
|
119
120
|
pmPlugins.push({
|
|
120
121
|
name: 'mediaSingleKeymap',
|
|
121
|
-
plugin: function plugin(
|
|
122
|
-
var schema =
|
|
122
|
+
plugin: function plugin(_ref4) {
|
|
123
|
+
var schema = _ref4.schema;
|
|
123
124
|
return keymapMediaSinglePlugin(schema);
|
|
124
125
|
}
|
|
125
126
|
});
|
|
@@ -131,25 +132,25 @@ var mediaPlugin = function mediaPlugin() {
|
|
|
131
132
|
});
|
|
132
133
|
pmPlugins.push({
|
|
133
134
|
name: 'mediaAltTextKeymap',
|
|
134
|
-
plugin: function plugin(
|
|
135
|
-
var _api$
|
|
136
|
-
var schema =
|
|
137
|
-
return keymapMediaAltTextPlugin(schema, api === null || api === void 0 ? void 0 : (_api$
|
|
135
|
+
plugin: function plugin(_ref5) {
|
|
136
|
+
var _api$analytics2;
|
|
137
|
+
var schema = _ref5.schema;
|
|
138
|
+
return keymapMediaAltTextPlugin(schema, api === null || api === void 0 ? void 0 : (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions);
|
|
138
139
|
}
|
|
139
140
|
});
|
|
140
141
|
}
|
|
141
142
|
if (options && options.allowLinking) {
|
|
142
143
|
pmPlugins.push({
|
|
143
144
|
name: 'mediaLinking',
|
|
144
|
-
plugin: function plugin(
|
|
145
|
-
var dispatch =
|
|
145
|
+
plugin: function plugin(_ref6) {
|
|
146
|
+
var dispatch = _ref6.dispatch;
|
|
146
147
|
return linkingPlugin(dispatch);
|
|
147
148
|
}
|
|
148
149
|
});
|
|
149
150
|
pmPlugins.push({
|
|
150
151
|
name: 'mediaLinkingKeymap',
|
|
151
|
-
plugin: function plugin(
|
|
152
|
-
var schema =
|
|
152
|
+
plugin: function plugin(_ref7) {
|
|
153
|
+
var schema = _ref7.schema;
|
|
153
154
|
return keymapLinkingPlugin(schema);
|
|
154
155
|
}
|
|
155
156
|
});
|
|
@@ -185,16 +186,16 @@ var mediaPlugin = function mediaPlugin() {
|
|
|
185
186
|
});
|
|
186
187
|
return pmPlugins;
|
|
187
188
|
},
|
|
188
|
-
contentComponent: function contentComponent(
|
|
189
|
-
var editorView =
|
|
190
|
-
appearance =
|
|
189
|
+
contentComponent: function contentComponent(_ref8) {
|
|
190
|
+
var editorView = _ref8.editorView,
|
|
191
|
+
appearance = _ref8.appearance;
|
|
191
192
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(WithPluginState, {
|
|
192
193
|
editorView: editorView,
|
|
193
194
|
plugins: {
|
|
194
195
|
mediaState: pluginKey
|
|
195
196
|
},
|
|
196
|
-
render: function render(
|
|
197
|
-
var mediaState =
|
|
197
|
+
render: function render(_ref9) {
|
|
198
|
+
var mediaState = _ref9.mediaState;
|
|
198
199
|
return /*#__PURE__*/React.createElement(MediaPickerComponents, {
|
|
199
200
|
editorDomElement: editorView.dom,
|
|
200
201
|
mediaState: mediaState,
|
|
@@ -204,10 +205,10 @@ var mediaPlugin = function mediaPlugin() {
|
|
|
204
205
|
}
|
|
205
206
|
}));
|
|
206
207
|
},
|
|
207
|
-
secondaryToolbarComponent: function secondaryToolbarComponent(
|
|
208
|
-
var editorView =
|
|
209
|
-
eventDispatcher =
|
|
210
|
-
disabled =
|
|
208
|
+
secondaryToolbarComponent: function secondaryToolbarComponent(_ref10) {
|
|
209
|
+
var editorView = _ref10.editorView,
|
|
210
|
+
eventDispatcher = _ref10.eventDispatcher,
|
|
211
|
+
disabled = _ref10.disabled;
|
|
211
212
|
return /*#__PURE__*/React.createElement(ToolbarMedia, {
|
|
212
213
|
editorView: editorView,
|
|
213
214
|
eventDispatcher: eventDispatcher,
|
|
@@ -217,8 +218,8 @@ var mediaPlugin = function mediaPlugin() {
|
|
|
217
218
|
});
|
|
218
219
|
},
|
|
219
220
|
pluginsOptions: {
|
|
220
|
-
quickInsert: function quickInsert(
|
|
221
|
-
var formatMessage =
|
|
221
|
+
quickInsert: function quickInsert(_ref11) {
|
|
222
|
+
var formatMessage = _ref11.formatMessage;
|
|
222
223
|
return [{
|
|
223
224
|
id: 'media',
|
|
224
225
|
title: formatMessage(messages.mediaFiles),
|
|
@@ -229,11 +230,11 @@ var mediaPlugin = function mediaPlugin() {
|
|
|
229
230
|
return /*#__PURE__*/React.createElement(IconImages, null);
|
|
230
231
|
},
|
|
231
232
|
action: function action(insert, state) {
|
|
232
|
-
var _api$
|
|
233
|
+
var _api$analytics3;
|
|
233
234
|
var pluginState = pluginKey.getState(state);
|
|
234
235
|
pluginState === null || pluginState === void 0 ? void 0 : pluginState.showMediaPicker();
|
|
235
236
|
var tr = insert('');
|
|
236
|
-
api === null || api === void 0 ? void 0 : (_api$
|
|
237
|
+
api === null || api === void 0 ? void 0 : (_api$analytics3 = api.analytics) === null || _api$analytics3 === void 0 ? void 0 : _api$analytics3.actions.attachAnalyticsEvent({
|
|
237
238
|
action: ACTION.OPENED,
|
|
238
239
|
actionSubject: ACTION_SUBJECT.PICKER,
|
|
239
240
|
actionSubjectId: ACTION_SUBJECT_ID.PICKER_CLOUD,
|
|
@@ -255,7 +256,8 @@ var mediaPlugin = function mediaPlugin() {
|
|
|
255
256
|
allowLinking: options && options.allowLinking,
|
|
256
257
|
allowAdvancedToolBarOptions: options && options.allowAdvancedToolBarOptions,
|
|
257
258
|
allowAltTextOnImages: options && options.allowAltTextOnImages,
|
|
258
|
-
altTextValidator: options && options.altTextValidator
|
|
259
|
+
altTextValidator: options && options.altTextValidator,
|
|
260
|
+
fullWidthEnabled: options && options.fullWidthEnabled
|
|
259
261
|
}, api);
|
|
260
262
|
}
|
|
261
263
|
}
|
|
@@ -230,7 +230,7 @@ var MediaSingleNode = /*#__PURE__*/function (_Component) {
|
|
|
230
230
|
(_this$captionPlaceHol = _this.captionPlaceHolderRef.current) === null || _this$captionPlaceHol === void 0 ? void 0 : _this$captionPlaceHol.click();
|
|
231
231
|
});
|
|
232
232
|
_defineProperty(_assertThisInitialized(_this), "clickPlaceholder", function () {
|
|
233
|
-
var _pluginInjectionApi$
|
|
233
|
+
var _pluginInjectionApi$a;
|
|
234
234
|
var _this$props = _this.props,
|
|
235
235
|
view = _this$props.view,
|
|
236
236
|
getPos = _this$props.getPos,
|
|
@@ -239,7 +239,7 @@ var MediaSingleNode = /*#__PURE__*/function (_Component) {
|
|
|
239
239
|
if (typeof getPos === 'boolean') {
|
|
240
240
|
return;
|
|
241
241
|
}
|
|
242
|
-
insertAndSelectCaptionFromMediaSinglePos(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$
|
|
242
|
+
insertAndSelectCaptionFromMediaSinglePos(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions)(getPos(), node)(view.state, view.dispatch);
|
|
243
243
|
});
|
|
244
244
|
return _this;
|
|
245
245
|
}
|
|
@@ -226,16 +226,16 @@ export var MediaPluginStateImplementation = /*#__PURE__*/function () {
|
|
|
226
226
|
});
|
|
227
227
|
}
|
|
228
228
|
if (isMediaSingle(state.schema, mediaStateWithContext.fileMimeType)) {
|
|
229
|
-
var _this$pluginInjection, _pluginInjectionApi$
|
|
229
|
+
var _this$pluginInjection, _pluginInjectionApi$a;
|
|
230
230
|
// read width state right before inserting to get up-to-date and define values
|
|
231
|
-
var widthPluginState = (_this$pluginInjection = _this.pluginInjectionApi) === null || _this$pluginInjection === void 0 ? void 0 : _this$pluginInjection.
|
|
232
|
-
insertMediaSingleNode(_this.view, mediaStateWithContext, _this.getInputMethod(pickerType), collection, _this.mediaOptions && _this.mediaOptions.alignLeftOnInsert, _this.newInsertionBehaviour, widthPluginState, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$
|
|
231
|
+
var widthPluginState = (_this$pluginInjection = _this.pluginInjectionApi) === null || _this$pluginInjection === void 0 ? void 0 : _this$pluginInjection.width.sharedState.currentState();
|
|
232
|
+
insertMediaSingleNode(_this.view, mediaStateWithContext, _this.getInputMethod(pickerType), collection, _this.mediaOptions && _this.mediaOptions.alignLeftOnInsert, _this.newInsertionBehaviour, widthPluginState, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions);
|
|
233
233
|
} else if (getMediaFeatureFlag('mediaInline', (_this$mediaOptions2 = _this.mediaOptions) === null || _this$mediaOptions2 === void 0 ? void 0 : _this$mediaOptions2.featureFlags) && !isInEmptyLine(state) && (!isInsidePotentialEmptyParagraph(state) || isInListItem(state)) && canInsertMediaInline(state)) {
|
|
234
|
-
var _pluginInjectionApi$
|
|
235
|
-
insertMediaInlineNode(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$
|
|
234
|
+
var _pluginInjectionApi$a2;
|
|
235
|
+
insertMediaInlineNode(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a2 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a2 === void 0 ? void 0 : _pluginInjectionApi$a2.actions)(_this.view, mediaStateWithContext, collection, _this.getInputMethod(pickerType));
|
|
236
236
|
} else {
|
|
237
|
-
var _pluginInjectionApi$
|
|
238
|
-
insertMediaGroupNode(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$
|
|
237
|
+
var _pluginInjectionApi$a3;
|
|
238
|
+
insertMediaGroupNode(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a3 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a3 === void 0 ? void 0 : _pluginInjectionApi$a3.actions)(_this.view, [mediaStateWithContext], collection, _this.getInputMethod(pickerType));
|
|
239
239
|
}
|
|
240
240
|
|
|
241
241
|
// do events when media state changes
|
|
@@ -22,7 +22,7 @@ import { messages } from '@atlaskit/media-ui';
|
|
|
22
22
|
import { cardMessages } from '@atlaskit/editor-common/messages';
|
|
23
23
|
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
24
24
|
import { FilePreviewItem } from './filePreviewItem';
|
|
25
|
-
import { downloadMedia, getSelectedMediaSingle, removeMediaGroupNode, getPixelWidthOfElement } from './utils';
|
|
25
|
+
import { downloadMedia, getSelectedMediaSingle, removeMediaGroupNode, getPixelWidthOfElement, calcNewLayout } from './utils';
|
|
26
26
|
import { isVideo } from '../utils/media-single';
|
|
27
27
|
import { changeInlineToMediaCard, changeMediaCardToInline, removeInlineCard, setBorderMark, toggleBorderMark } from './commands';
|
|
28
28
|
import { MediaInlineNodeSelector, MediaSingleNodeSelector } from '../nodeviews/styles';
|
|
@@ -200,7 +200,7 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
|
|
|
200
200
|
allowResizingInTables = options.allowResizingInTables,
|
|
201
201
|
allowAltTextOnImages = options.allowAltTextOnImages;
|
|
202
202
|
var toolbarButtons = [];
|
|
203
|
-
var _ref = (_pluginInjectionApi$d = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.
|
|
203
|
+
var _ref = (_pluginInjectionApi$d = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.decorations.actions) !== null && _pluginInjectionApi$d !== void 0 ? _pluginInjectionApi$d : {},
|
|
204
204
|
hoverDecoration = _ref.hoverDecoration;
|
|
205
205
|
if (shouldShowImageBorder(state)) {
|
|
206
206
|
toolbarButtons.push({
|
|
@@ -215,12 +215,12 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
|
|
|
215
215
|
var borderMark = currentMediaNodeBorderMark(state);
|
|
216
216
|
return /*#__PURE__*/React.createElement(ImageBorderItem, {
|
|
217
217
|
toggleBorder: function toggleBorder() {
|
|
218
|
-
var _pluginInjectionApi$
|
|
219
|
-
toggleBorderMark(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$
|
|
218
|
+
var _pluginInjectionApi$a;
|
|
219
|
+
toggleBorderMark(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions)(state, dispatch);
|
|
220
220
|
},
|
|
221
221
|
setBorder: function setBorder(attrs) {
|
|
222
|
-
var _pluginInjectionApi$
|
|
223
|
-
setBorderMark(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$
|
|
222
|
+
var _pluginInjectionApi$a2;
|
|
223
|
+
setBorderMark(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a2 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a2 === void 0 ? void 0 : _pluginInjectionApi$a2.actions)(attrs)(state, dispatch);
|
|
224
224
|
},
|
|
225
225
|
showSomewhatSemanticTooltips: getEditorFeatureFlags === null || getEditorFeatureFlags === void 0 ? void 0 : getEditorFeatureFlags().useSomewhatSemanticTextColorNames,
|
|
226
226
|
borderMark: borderMark,
|
|
@@ -233,8 +233,8 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
|
|
|
233
233
|
});
|
|
234
234
|
}
|
|
235
235
|
if (allowAdvancedToolBarOptions) {
|
|
236
|
-
var _pluginInjectionApi$
|
|
237
|
-
var widthPlugin = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.
|
|
236
|
+
var _pluginInjectionApi$a3;
|
|
237
|
+
var widthPlugin = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.width;
|
|
238
238
|
var isChangingLayoutDisabled = false;
|
|
239
239
|
if (getBooleanFF('platform.editor.media.extended-resize-experience')) {
|
|
240
240
|
var _widthPlugin$sharedSt;
|
|
@@ -247,7 +247,7 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
|
|
|
247
247
|
}
|
|
248
248
|
}
|
|
249
249
|
}
|
|
250
|
-
var layoutButtons = buildLayoutButtons(state, intl, state.schema.nodes.mediaSingle, widthPlugin, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$
|
|
250
|
+
var layoutButtons = buildLayoutButtons(state, intl, state.schema.nodes.mediaSingle, widthPlugin, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a3 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a3 === void 0 ? void 0 : _pluginInjectionApi$a3.actions, allowResizing, allowResizingInTables, true, true, isChangingLayoutDisabled);
|
|
251
251
|
toolbarButtons = [].concat(_toConsumableArray(toolbarButtons), _toConsumableArray(layoutButtons));
|
|
252
252
|
if (layoutButtons.length) {
|
|
253
253
|
toolbarButtons.push({
|
|
@@ -273,7 +273,10 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
|
|
|
273
273
|
if (!selectedMediaNode) {
|
|
274
274
|
return null;
|
|
275
275
|
}
|
|
276
|
-
var
|
|
276
|
+
var _selectedMediaSingleN = selectedMediaSingleNode.node.attrs,
|
|
277
|
+
mediaSingleWidth = _selectedMediaSingleN.width,
|
|
278
|
+
widthType = _selectedMediaSingleN.widthType,
|
|
279
|
+
layout = _selectedMediaSingleN.layout;
|
|
277
280
|
var _selectedMediaNode$at = selectedMediaNode.attrs,
|
|
278
281
|
mediaWidth = _selectedMediaNode$at.width,
|
|
279
282
|
mediaHeight = _selectedMediaNode$at.height;
|
|
@@ -282,9 +285,10 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
|
|
|
282
285
|
var isVideoFile = isVideo(selectedMediaNode.attrs.__fileMimeType);
|
|
283
286
|
var minWidth = calcMinWidth(isVideoFile, maxWidthForNestedNode || contentWidth);
|
|
284
287
|
var isLegacy = widthType !== 'pixel';
|
|
285
|
-
var
|
|
288
|
+
var pixelWidthFromElement = getPixelWidthOfElement(editorView, selectedMediaSingleNode.pos + 1,
|
|
286
289
|
// get pos of media node
|
|
287
290
|
mediaWidth || DEFAULT_IMAGE_WIDTH);
|
|
291
|
+
var pixelWidth = isLegacy ? pixelWidthFromElement : mediaSingleWidth;
|
|
288
292
|
return /*#__PURE__*/React.createElement(PixelEntry, {
|
|
289
293
|
intl: intl,
|
|
290
294
|
width: pluginState.isResizing ? pluginState.resizingWidth : pixelWidth,
|
|
@@ -311,7 +315,8 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
|
|
|
311
315
|
var width = _ref2.width;
|
|
312
316
|
var tr = state.tr.setNodeMarkup(selectedMediaSingleNode.pos, undefined, _objectSpread(_objectSpread({}, selectedMediaSingleNode.node.attrs), {}, {
|
|
313
317
|
width: width,
|
|
314
|
-
widthType: 'pixel'
|
|
318
|
+
widthType: 'pixel',
|
|
319
|
+
layout: calcNewLayout(width, layout, contentWidth, options.fullWidthEnabled)
|
|
315
320
|
}));
|
|
316
321
|
tr.setMeta('scrollIntoView', false);
|
|
317
322
|
tr.setSelection(NodeSelection.create(tr.doc, selectedMediaSingleNode.pos));
|
|
@@ -319,7 +324,7 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
|
|
|
319
324
|
},
|
|
320
325
|
onMigrate: function onMigrate() {
|
|
321
326
|
var tr = state.tr.setNodeMarkup(selectedMediaSingleNode.pos, undefined, _objectSpread(_objectSpread({}, selectedMediaSingleNode.node.attrs), {}, {
|
|
322
|
-
width:
|
|
327
|
+
width: pixelWidthFromElement,
|
|
323
328
|
widthType: 'pixel'
|
|
324
329
|
}));
|
|
325
330
|
tr.setMeta('scrollIntoView', false);
|
|
@@ -370,10 +375,10 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
|
|
|
370
375
|
};
|
|
371
376
|
var openLink = function openLink() {
|
|
372
377
|
if (editorView) {
|
|
373
|
-
var _pluginInjectionApi$
|
|
378
|
+
var _pluginInjectionApi$a4;
|
|
374
379
|
var tr = editorView.state.tr,
|
|
375
380
|
dispatch = editorView.dispatch;
|
|
376
|
-
pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$
|
|
381
|
+
pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a4 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a4 === void 0 ? void 0 : _pluginInjectionApi$a4.actions.attachAnalyticsEvent({
|
|
377
382
|
eventType: EVENT_TYPE.TRACK,
|
|
378
383
|
action: ACTION.VISITED,
|
|
379
384
|
actionSubject: ACTION_SUBJECT.MEDIA,
|
|
@@ -399,8 +404,8 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
|
|
|
399
404
|
}
|
|
400
405
|
}
|
|
401
406
|
if (allowAltTextOnImages) {
|
|
402
|
-
var _pluginInjectionApi$
|
|
403
|
-
toolbarButtons.push(altTextButton(intl, state, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$
|
|
407
|
+
var _pluginInjectionApi$a5;
|
|
408
|
+
toolbarButtons.push(altTextButton(intl, state, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a5 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a5 === void 0 ? void 0 : _pluginInjectionApi$a5.actions), {
|
|
404
409
|
type: 'separator'
|
|
405
410
|
});
|
|
406
411
|
}
|
|
@@ -431,7 +436,7 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
|
|
|
431
436
|
return items;
|
|
432
437
|
};
|
|
433
438
|
export var floatingToolbar = function floatingToolbar(state, intl) {
|
|
434
|
-
var _pluginInjectionApi$
|
|
439
|
+
var _pluginInjectionApi$d2;
|
|
435
440
|
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
436
441
|
var pluginInjectionApi = arguments.length > 3 ? arguments[3] : undefined;
|
|
437
442
|
var _state$schema$nodes = state.schema.nodes,
|
|
@@ -447,7 +452,7 @@ export var floatingToolbar = function floatingToolbar(state, intl) {
|
|
|
447
452
|
getEditorFeatureFlags = options.getEditorFeatureFlags;
|
|
448
453
|
var mediaPluginState = stateKey.getState(state);
|
|
449
454
|
var mediaLinkingState = getMediaLinkingState(state);
|
|
450
|
-
var _ref3 = (_pluginInjectionApi$
|
|
455
|
+
var _ref3 = (_pluginInjectionApi$d2 = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.decorations.actions) !== null && _pluginInjectionApi$d2 !== void 0 ? _pluginInjectionApi$d2 : {},
|
|
451
456
|
hoverDecoration = _ref3.hoverDecoration;
|
|
452
457
|
if (!mediaPluginState) {
|
|
453
458
|
return;
|
|
@@ -469,10 +474,10 @@ export var floatingToolbar = function floatingToolbar(state, intl) {
|
|
|
469
474
|
if (allowAltTextOnImages) {
|
|
470
475
|
var mediaAltTextPluginState = getMediaAltTextPluginState(state);
|
|
471
476
|
if (mediaAltTextPluginState.isAltTextEditorOpen) {
|
|
472
|
-
var _pluginInjectionApi$
|
|
477
|
+
var _pluginInjectionApi$f;
|
|
473
478
|
return getAltTextToolbar(baseToolbar, {
|
|
474
479
|
altTextValidator: altTextValidator,
|
|
475
|
-
forceFocusSelector: pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$
|
|
480
|
+
forceFocusSelector: pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$f = pluginInjectionApi.floatingToolbar.actions) === null || _pluginInjectionApi$f === void 0 ? void 0 : _pluginInjectionApi$f.forceFocusSelector
|
|
476
481
|
});
|
|
477
482
|
}
|
|
478
483
|
}
|
|
@@ -483,22 +488,22 @@ export var floatingToolbar = function floatingToolbar(state, intl) {
|
|
|
483
488
|
selectedNodeType = state.selection.node.type;
|
|
484
489
|
}
|
|
485
490
|
if (allowMediaInline && (parentMediaGroupNode === null || parentMediaGroupNode === void 0 ? void 0 : parentMediaGroupNode.node.type) === mediaGroup) {
|
|
486
|
-
var _pluginInjectionApi$
|
|
491
|
+
var _pluginInjectionApi$a6;
|
|
487
492
|
var mediaOffset = state.selection.$from.parentOffset + 1;
|
|
488
493
|
baseToolbar.getDomRef = function () {
|
|
489
494
|
var _mediaPluginState$ele;
|
|
490
495
|
var selector = mediaFilmstripItemDOMSelector(mediaOffset);
|
|
491
496
|
return (_mediaPluginState$ele = mediaPluginState.element) === null || _mediaPluginState$ele === void 0 ? void 0 : _mediaPluginState$ele.querySelector(selector);
|
|
492
497
|
};
|
|
493
|
-
items = generateMediaCardFloatingToolbar(state, intl, mediaPluginState, hoverDecoration, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$
|
|
498
|
+
items = generateMediaCardFloatingToolbar(state, intl, mediaPluginState, hoverDecoration, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a6 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a6 === void 0 ? void 0 : _pluginInjectionApi$a6.actions);
|
|
494
499
|
} else if (allowMediaInline && selectedNodeType && selectedNodeType === mediaInline) {
|
|
495
|
-
var _pluginInjectionApi$
|
|
500
|
+
var _pluginInjectionApi$a7;
|
|
496
501
|
baseToolbar.getDomRef = function () {
|
|
497
502
|
var _mediaPluginState$ele2;
|
|
498
503
|
var element = (_mediaPluginState$ele2 = mediaPluginState.element) === null || _mediaPluginState$ele2 === void 0 ? void 0 : _mediaPluginState$ele2.querySelector(".".concat(MediaInlineNodeSelector));
|
|
499
504
|
return element || mediaPluginState.element;
|
|
500
505
|
};
|
|
501
|
-
items = generateMediaInlineFloatingToolbar(state, intl, mediaPluginState, hoverDecoration, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$
|
|
506
|
+
items = generateMediaInlineFloatingToolbar(state, intl, mediaPluginState, hoverDecoration, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a7 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a7 === void 0 ? void 0 : _pluginInjectionApi$a7.actions);
|
|
502
507
|
} else {
|
|
503
508
|
baseToolbar.getDomRef = function () {
|
|
504
509
|
var _mediaPluginState$ele3;
|
|
@@ -50,8 +50,8 @@ export var getLinkingToolbar = function getLinkingToolbar(toolbarBaseConfig, med
|
|
|
50
50
|
intl: intl,
|
|
51
51
|
editing: editing,
|
|
52
52
|
onUnlink: function onUnlink() {
|
|
53
|
-
var _pluginInjectionApi$
|
|
54
|
-
return unlink(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$
|
|
53
|
+
var _pluginInjectionApi$a;
|
|
54
|
+
return unlink(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions)(view.state, view.dispatch, view);
|
|
55
55
|
},
|
|
56
56
|
onBack: function onBack(href, meta) {
|
|
57
57
|
if (href.trim() && meta.inputMethod) {
|
|
@@ -60,14 +60,14 @@ export var getLinkingToolbar = function getLinkingToolbar(toolbarBaseConfig, med
|
|
|
60
60
|
hideLinkingToolbar(view.state, view.dispatch, view);
|
|
61
61
|
},
|
|
62
62
|
onCancel: function onCancel() {
|
|
63
|
-
var _pluginInjectionApi$
|
|
63
|
+
var _pluginInjectionApi$f;
|
|
64
64
|
hideLinkingToolbar(view.state, view.dispatch, view, true);
|
|
65
65
|
/** Focus should move to the 'Add link' button when the toolbar closes
|
|
66
66
|
* and not close the floating toolbar.
|
|
67
67
|
*/
|
|
68
68
|
var tr = view.state.tr,
|
|
69
69
|
dispatch = view.dispatch;
|
|
70
|
-
pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$
|
|
70
|
+
pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$f = pluginInjectionApi.floatingToolbar.actions) === null || _pluginInjectionApi$f === void 0 ? void 0 : _pluginInjectionApi$f.forceFocusSelector(FORCE_FOCUS_SELECTOR)(tr);
|
|
71
71
|
dispatch(tr);
|
|
72
72
|
},
|
|
73
73
|
onSubmit: function onSubmit(href, meta) {
|
|
@@ -2,6 +2,8 @@ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
|
2
2
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
3
3
|
import { getMediaClient } from '@atlaskit/media-client';
|
|
4
4
|
import { findParentNodeOfType, removeParentNodeOfType, removeSelectedNode, findSelectedNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
5
|
+
import { akEditorFullWidthLayoutWidth } from '@atlaskit/editor-shared-styles';
|
|
6
|
+
import { wrappedLayouts } from '@atlaskit/editor-common/media-single';
|
|
5
7
|
export var getSelectedMediaContainerNodeAttrs = function getSelectedMediaContainerNodeAttrs(mediaPluginState) {
|
|
6
8
|
var selectedNode = mediaPluginState.selectedMediaContainerNode();
|
|
7
9
|
if (selectedNode && selectedNode.attrs) {
|
|
@@ -69,4 +71,21 @@ export var getPixelWidthOfElement = function getPixelWidthOfElement(editorView,
|
|
|
69
71
|
return domNode.offsetWidth;
|
|
70
72
|
}
|
|
71
73
|
return mediaWidth;
|
|
74
|
+
};
|
|
75
|
+
export var calcNewLayout = function calcNewLayout(width, layout, contentWidth) {
|
|
76
|
+
var fullWidthMode = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
77
|
+
var isWrappedLayout = wrappedLayouts.indexOf(layout) > -1;
|
|
78
|
+
if (width >= akEditorFullWidthLayoutWidth) {
|
|
79
|
+
// If width is greater than or equal to full editor width
|
|
80
|
+
return 'full-width';
|
|
81
|
+
}
|
|
82
|
+
if (fullWidthMode) {
|
|
83
|
+
// If under editor full width mode
|
|
84
|
+
return isWrappedLayout ? layout : 'center';
|
|
85
|
+
}
|
|
86
|
+
if (width > contentWidth) {
|
|
87
|
+
// If width is greater than content length and not nested
|
|
88
|
+
return 'wide';
|
|
89
|
+
}
|
|
90
|
+
return isWrappedLayout && width !== contentWidth ? layout : 'center';
|
|
72
91
|
};
|