@atlaskit/editor-core 187.31.6 → 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 +42 -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/extension/ui/Extension/Extension/index.js +11 -2
- 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/extension/ui/Extension/Extension/index.js +13 -2
- 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/extension/ui/Extension/Extension/index.js +11 -2
- 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 +4 -4
|
@@ -37,11 +37,12 @@ var _mediaInline = require("./nodeviews/mediaInline");
|
|
|
37
37
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
38
38
|
var _pluginKey = require("./pm-plugins/plugin-key");
|
|
39
39
|
var _mediaSingle2 = require("./utils/media-single");
|
|
40
|
-
var mediaPlugin = function mediaPlugin() {
|
|
41
|
-
var _api$
|
|
42
|
-
var
|
|
43
|
-
|
|
44
|
-
|
|
40
|
+
var mediaPlugin = function mediaPlugin(_ref) {
|
|
41
|
+
var _api$featureFlags;
|
|
42
|
+
var _ref$config = _ref.config,
|
|
43
|
+
options = _ref$config === void 0 ? {} : _ref$config,
|
|
44
|
+
api = _ref.api;
|
|
45
|
+
var featureFlags = (api === null || api === void 0 ? void 0 : (_api$featureFlags = api.featureFlags) === null || _api$featureFlags === void 0 ? void 0 : _api$featureFlags.sharedState.currentState()) || {};
|
|
45
46
|
return {
|
|
46
47
|
name: 'media',
|
|
47
48
|
getSharedState: function getSharedState(editorState) {
|
|
@@ -51,12 +52,12 @@ var mediaPlugin = function mediaPlugin() {
|
|
|
51
52
|
return _pluginKey.stateKey.getState(editorState) || null;
|
|
52
53
|
},
|
|
53
54
|
nodes: function nodes() {
|
|
54
|
-
var
|
|
55
|
-
|
|
56
|
-
allowMediaGroup =
|
|
57
|
-
|
|
58
|
-
allowMediaSingle =
|
|
59
|
-
mediaFeatureFlags =
|
|
55
|
+
var _ref2 = options || {},
|
|
56
|
+
_ref2$allowMediaGroup = _ref2.allowMediaGroup,
|
|
57
|
+
allowMediaGroup = _ref2$allowMediaGroup === void 0 ? true : _ref2$allowMediaGroup,
|
|
58
|
+
_ref2$allowMediaSingl = _ref2.allowMediaSingle,
|
|
59
|
+
allowMediaSingle = _ref2$allowMediaSingl === void 0 ? false : _ref2$allowMediaSingl,
|
|
60
|
+
mediaFeatureFlags = _ref2.featureFlags;
|
|
60
61
|
var captions = (0, _mediaCommon.getMediaFeatureFlag)('captions', mediaFeatureFlags);
|
|
61
62
|
var allowMediaInline = (0, _mediaCommon.getMediaFeatureFlag)('mediaInline', mediaFeatureFlags);
|
|
62
63
|
var mediaSingleOption = (0, _platformFeatureFlags.getBooleanFF)('platform.editor.media.extended-resize-experience') ? {
|
|
@@ -95,16 +96,16 @@ var mediaPlugin = function mediaPlugin() {
|
|
|
95
96
|
pmPlugins: function pmPlugins() {
|
|
96
97
|
var pmPlugins = [{
|
|
97
98
|
name: 'media',
|
|
98
|
-
plugin: function plugin(
|
|
99
|
-
var schema =
|
|
100
|
-
dispatch =
|
|
101
|
-
getIntl =
|
|
102
|
-
eventDispatcher =
|
|
103
|
-
providerFactory =
|
|
104
|
-
errorReporter =
|
|
105
|
-
portalProviderAPI =
|
|
106
|
-
reactContext =
|
|
107
|
-
dispatchAnalyticsEvent =
|
|
99
|
+
plugin: function plugin(_ref3) {
|
|
100
|
+
var schema = _ref3.schema,
|
|
101
|
+
dispatch = _ref3.dispatch,
|
|
102
|
+
getIntl = _ref3.getIntl,
|
|
103
|
+
eventDispatcher = _ref3.eventDispatcher,
|
|
104
|
+
providerFactory = _ref3.providerFactory,
|
|
105
|
+
errorReporter = _ref3.errorReporter,
|
|
106
|
+
portalProviderAPI = _ref3.portalProviderAPI,
|
|
107
|
+
reactContext = _ref3.reactContext,
|
|
108
|
+
dispatchAnalyticsEvent = _ref3.dispatchAnalyticsEvent;
|
|
108
109
|
return (0, _main.createPlugin)(schema, {
|
|
109
110
|
providerFactory: providerFactory,
|
|
110
111
|
nodeViews: {
|
|
@@ -124,15 +125,15 @@ var mediaPlugin = function mediaPlugin() {
|
|
|
124
125
|
}, {
|
|
125
126
|
name: 'mediaKeymap',
|
|
126
127
|
plugin: function plugin() {
|
|
127
|
-
var _api$
|
|
128
|
-
return (0, _keymap3.default)(options, api === null || api === void 0 ? void 0 : (_api$
|
|
128
|
+
var _api$analytics;
|
|
129
|
+
return (0, _keymap3.default)(options, api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions);
|
|
129
130
|
}
|
|
130
131
|
}];
|
|
131
132
|
if (options && options.allowMediaSingle) {
|
|
132
133
|
pmPlugins.push({
|
|
133
134
|
name: 'mediaSingleKeymap',
|
|
134
|
-
plugin: function plugin(
|
|
135
|
-
var schema =
|
|
135
|
+
plugin: function plugin(_ref4) {
|
|
136
|
+
var schema = _ref4.schema;
|
|
136
137
|
return (0, _keymapMediaSingle.default)(schema);
|
|
137
138
|
}
|
|
138
139
|
});
|
|
@@ -144,25 +145,25 @@ var mediaPlugin = function mediaPlugin() {
|
|
|
144
145
|
});
|
|
145
146
|
pmPlugins.push({
|
|
146
147
|
name: 'mediaAltTextKeymap',
|
|
147
|
-
plugin: function plugin(
|
|
148
|
-
var _api$
|
|
149
|
-
var schema =
|
|
150
|
-
return (0, _keymap.default)(schema, api === null || api === void 0 ? void 0 : (_api$
|
|
148
|
+
plugin: function plugin(_ref5) {
|
|
149
|
+
var _api$analytics2;
|
|
150
|
+
var schema = _ref5.schema;
|
|
151
|
+
return (0, _keymap.default)(schema, api === null || api === void 0 ? void 0 : (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions);
|
|
151
152
|
}
|
|
152
153
|
});
|
|
153
154
|
}
|
|
154
155
|
if (options && options.allowLinking) {
|
|
155
156
|
pmPlugins.push({
|
|
156
157
|
name: 'mediaLinking',
|
|
157
|
-
plugin: function plugin(
|
|
158
|
-
var dispatch =
|
|
158
|
+
plugin: function plugin(_ref6) {
|
|
159
|
+
var dispatch = _ref6.dispatch;
|
|
159
160
|
return (0, _linking.default)(dispatch);
|
|
160
161
|
}
|
|
161
162
|
});
|
|
162
163
|
pmPlugins.push({
|
|
163
164
|
name: 'mediaLinkingKeymap',
|
|
164
|
-
plugin: function plugin(
|
|
165
|
-
var schema =
|
|
165
|
+
plugin: function plugin(_ref7) {
|
|
166
|
+
var schema = _ref7.schema;
|
|
166
167
|
return (0, _keymap2.default)(schema);
|
|
167
168
|
}
|
|
168
169
|
});
|
|
@@ -198,16 +199,16 @@ var mediaPlugin = function mediaPlugin() {
|
|
|
198
199
|
});
|
|
199
200
|
return pmPlugins;
|
|
200
201
|
},
|
|
201
|
-
contentComponent: function contentComponent(
|
|
202
|
-
var editorView =
|
|
203
|
-
appearance =
|
|
202
|
+
contentComponent: function contentComponent(_ref8) {
|
|
203
|
+
var editorView = _ref8.editorView,
|
|
204
|
+
appearance = _ref8.appearance;
|
|
204
205
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_WithPluginState.default, {
|
|
205
206
|
editorView: editorView,
|
|
206
207
|
plugins: {
|
|
207
208
|
mediaState: _main.stateKey
|
|
208
209
|
},
|
|
209
|
-
render: function render(
|
|
210
|
-
var mediaState =
|
|
210
|
+
render: function render(_ref9) {
|
|
211
|
+
var mediaState = _ref9.mediaState;
|
|
211
212
|
return /*#__PURE__*/_react.default.createElement(_MediaPicker.MediaPickerComponents, {
|
|
212
213
|
editorDomElement: editorView.dom,
|
|
213
214
|
mediaState: mediaState,
|
|
@@ -217,10 +218,10 @@ var mediaPlugin = function mediaPlugin() {
|
|
|
217
218
|
}
|
|
218
219
|
}));
|
|
219
220
|
},
|
|
220
|
-
secondaryToolbarComponent: function secondaryToolbarComponent(
|
|
221
|
-
var editorView =
|
|
222
|
-
eventDispatcher =
|
|
223
|
-
disabled =
|
|
221
|
+
secondaryToolbarComponent: function secondaryToolbarComponent(_ref10) {
|
|
222
|
+
var editorView = _ref10.editorView,
|
|
223
|
+
eventDispatcher = _ref10.eventDispatcher,
|
|
224
|
+
disabled = _ref10.disabled;
|
|
224
225
|
return /*#__PURE__*/_react.default.createElement(_ToolbarMedia.default, {
|
|
225
226
|
editorView: editorView,
|
|
226
227
|
eventDispatcher: eventDispatcher,
|
|
@@ -230,8 +231,8 @@ var mediaPlugin = function mediaPlugin() {
|
|
|
230
231
|
});
|
|
231
232
|
},
|
|
232
233
|
pluginsOptions: {
|
|
233
|
-
quickInsert: function quickInsert(
|
|
234
|
-
var formatMessage =
|
|
234
|
+
quickInsert: function quickInsert(_ref11) {
|
|
235
|
+
var formatMessage = _ref11.formatMessage;
|
|
235
236
|
return [{
|
|
236
237
|
id: 'media',
|
|
237
238
|
title: formatMessage(_messages.messages.mediaFiles),
|
|
@@ -242,11 +243,11 @@ var mediaPlugin = function mediaPlugin() {
|
|
|
242
243
|
return /*#__PURE__*/_react.default.createElement(_quickInsert.IconImages, null);
|
|
243
244
|
},
|
|
244
245
|
action: function action(insert, state) {
|
|
245
|
-
var _api$
|
|
246
|
+
var _api$analytics3;
|
|
246
247
|
var pluginState = _main.stateKey.getState(state);
|
|
247
248
|
pluginState === null || pluginState === void 0 ? void 0 : pluginState.showMediaPicker();
|
|
248
249
|
var tr = insert('');
|
|
249
|
-
api === null || api === void 0 ? void 0 : (_api$
|
|
250
|
+
api === null || api === void 0 ? void 0 : (_api$analytics3 = api.analytics) === null || _api$analytics3 === void 0 ? void 0 : _api$analytics3.actions.attachAnalyticsEvent({
|
|
250
251
|
action: _analytics.ACTION.OPENED,
|
|
251
252
|
actionSubject: _analytics.ACTION_SUBJECT.PICKER,
|
|
252
253
|
actionSubjectId: _analytics.ACTION_SUBJECT_ID.PICKER_CLOUD,
|
|
@@ -268,7 +269,8 @@ var mediaPlugin = function mediaPlugin() {
|
|
|
268
269
|
allowLinking: options && options.allowLinking,
|
|
269
270
|
allowAdvancedToolBarOptions: options && options.allowAdvancedToolBarOptions,
|
|
270
271
|
allowAltTextOnImages: options && options.allowAltTextOnImages,
|
|
271
|
-
altTextValidator: options && options.altTextValidator
|
|
272
|
+
altTextValidator: options && options.altTextValidator,
|
|
273
|
+
fullWidthEnabled: options && options.fullWidthEnabled
|
|
272
274
|
}, api);
|
|
273
275
|
}
|
|
274
276
|
}
|
|
@@ -239,7 +239,7 @@ var MediaSingleNode = /*#__PURE__*/function (_Component) {
|
|
|
239
239
|
(_this$captionPlaceHol = _this.captionPlaceHolderRef.current) === null || _this$captionPlaceHol === void 0 ? void 0 : _this$captionPlaceHol.click();
|
|
240
240
|
});
|
|
241
241
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "clickPlaceholder", function () {
|
|
242
|
-
var _pluginInjectionApi$
|
|
242
|
+
var _pluginInjectionApi$a;
|
|
243
243
|
var _this$props = _this.props,
|
|
244
244
|
view = _this$props.view,
|
|
245
245
|
getPos = _this$props.getPos,
|
|
@@ -248,7 +248,7 @@ var MediaSingleNode = /*#__PURE__*/function (_Component) {
|
|
|
248
248
|
if (typeof getPos === 'boolean') {
|
|
249
249
|
return;
|
|
250
250
|
}
|
|
251
|
-
(0, _captions.insertAndSelectCaptionFromMediaSinglePos)(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$
|
|
251
|
+
(0, _captions.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);
|
|
252
252
|
});
|
|
253
253
|
return _this;
|
|
254
254
|
}
|
|
@@ -243,16 +243,16 @@ var MediaPluginStateImplementation = /*#__PURE__*/function () {
|
|
|
243
243
|
});
|
|
244
244
|
}
|
|
245
245
|
if ((0, _mediaSingle.isMediaSingle)(state.schema, mediaStateWithContext.fileMimeType)) {
|
|
246
|
-
var _this$pluginInjection, _pluginInjectionApi$
|
|
246
|
+
var _this$pluginInjection, _pluginInjectionApi$a;
|
|
247
247
|
// read width state right before inserting to get up-to-date and define values
|
|
248
|
-
var widthPluginState = (_this$pluginInjection = _this.pluginInjectionApi) === null || _this$pluginInjection === void 0 ? void 0 : _this$pluginInjection.
|
|
249
|
-
(0, _mediaSingle.insertMediaSingleNode)(_this.view, mediaStateWithContext, _this.getInputMethod(pickerType), collection, _this.mediaOptions && _this.mediaOptions.alignLeftOnInsert, _this.newInsertionBehaviour, widthPluginState, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$
|
|
248
|
+
var widthPluginState = (_this$pluginInjection = _this.pluginInjectionApi) === null || _this$pluginInjection === void 0 ? void 0 : _this$pluginInjection.width.sharedState.currentState();
|
|
249
|
+
(0, _mediaSingle.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);
|
|
250
250
|
} else if ((0, _mediaCommon2.getMediaFeatureFlag)('mediaInline', (_this$mediaOptions2 = _this.mediaOptions) === null || _this$mediaOptions2 === void 0 ? void 0 : _this$mediaOptions2.featureFlags) && !(0, _document.isInEmptyLine)(state) && (!(0, _mediaCommon.isInsidePotentialEmptyParagraph)(state) || (0, _utils3.isInListItem)(state)) && (0, _mediaFiles.canInsertMediaInline)(state)) {
|
|
251
|
-
var _pluginInjectionApi$
|
|
252
|
-
(0, _mediaFiles.insertMediaInlineNode)(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$
|
|
251
|
+
var _pluginInjectionApi$a2;
|
|
252
|
+
(0, _mediaFiles.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));
|
|
253
253
|
} else {
|
|
254
|
-
var _pluginInjectionApi$
|
|
255
|
-
(0, _mediaFiles.insertMediaGroupNode)(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$
|
|
254
|
+
var _pluginInjectionApi$a3;
|
|
255
|
+
(0, _mediaFiles.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));
|
|
256
256
|
}
|
|
257
257
|
|
|
258
258
|
// do events when media state changes
|
|
@@ -207,7 +207,7 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
|
|
|
207
207
|
allowResizingInTables = options.allowResizingInTables,
|
|
208
208
|
allowAltTextOnImages = options.allowAltTextOnImages;
|
|
209
209
|
var toolbarButtons = [];
|
|
210
|
-
var _ref = (_pluginInjectionApi$d = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.
|
|
210
|
+
var _ref = (_pluginInjectionApi$d = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.decorations.actions) !== null && _pluginInjectionApi$d !== void 0 ? _pluginInjectionApi$d : {},
|
|
211
211
|
hoverDecoration = _ref.hoverDecoration;
|
|
212
212
|
if ((0, _imageBorder.shouldShowImageBorder)(state)) {
|
|
213
213
|
toolbarButtons.push({
|
|
@@ -222,12 +222,12 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
|
|
|
222
222
|
var borderMark = (0, _currentMediaNode.currentMediaNodeBorderMark)(state);
|
|
223
223
|
return /*#__PURE__*/_react.default.createElement(_ImageBorder.default, {
|
|
224
224
|
toggleBorder: function toggleBorder() {
|
|
225
|
-
var _pluginInjectionApi$
|
|
226
|
-
(0, _commands.toggleBorderMark)(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$
|
|
225
|
+
var _pluginInjectionApi$a;
|
|
226
|
+
(0, _commands.toggleBorderMark)(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions)(state, dispatch);
|
|
227
227
|
},
|
|
228
228
|
setBorder: function setBorder(attrs) {
|
|
229
|
-
var _pluginInjectionApi$
|
|
230
|
-
(0, _commands.setBorderMark)(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$
|
|
229
|
+
var _pluginInjectionApi$a2;
|
|
230
|
+
(0, _commands.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);
|
|
231
231
|
},
|
|
232
232
|
showSomewhatSemanticTooltips: getEditorFeatureFlags === null || getEditorFeatureFlags === void 0 ? void 0 : getEditorFeatureFlags().useSomewhatSemanticTextColorNames,
|
|
233
233
|
borderMark: borderMark,
|
|
@@ -240,8 +240,8 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
|
|
|
240
240
|
});
|
|
241
241
|
}
|
|
242
242
|
if (allowAdvancedToolBarOptions) {
|
|
243
|
-
var _pluginInjectionApi$
|
|
244
|
-
var widthPlugin = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.
|
|
243
|
+
var _pluginInjectionApi$a3;
|
|
244
|
+
var widthPlugin = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.width;
|
|
245
245
|
var isChangingLayoutDisabled = false;
|
|
246
246
|
if ((0, _platformFeatureFlags.getBooleanFF)('platform.editor.media.extended-resize-experience')) {
|
|
247
247
|
var _widthPlugin$sharedSt;
|
|
@@ -254,7 +254,7 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
|
|
|
254
254
|
}
|
|
255
255
|
}
|
|
256
256
|
}
|
|
257
|
-
var layoutButtons = (0, _card.buildLayoutButtons)(state, intl, state.schema.nodes.mediaSingle, widthPlugin, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$
|
|
257
|
+
var layoutButtons = (0, _card.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);
|
|
258
258
|
toolbarButtons = [].concat((0, _toConsumableArray2.default)(toolbarButtons), (0, _toConsumableArray2.default)(layoutButtons));
|
|
259
259
|
if (layoutButtons.length) {
|
|
260
260
|
toolbarButtons.push({
|
|
@@ -280,7 +280,10 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
|
|
|
280
280
|
if (!selectedMediaNode) {
|
|
281
281
|
return null;
|
|
282
282
|
}
|
|
283
|
-
var
|
|
283
|
+
var _selectedMediaSingleN = selectedMediaSingleNode.node.attrs,
|
|
284
|
+
mediaSingleWidth = _selectedMediaSingleN.width,
|
|
285
|
+
widthType = _selectedMediaSingleN.widthType,
|
|
286
|
+
layout = _selectedMediaSingleN.layout;
|
|
284
287
|
var _selectedMediaNode$at = selectedMediaNode.attrs,
|
|
285
288
|
mediaWidth = _selectedMediaNode$at.width,
|
|
286
289
|
mediaHeight = _selectedMediaNode$at.height;
|
|
@@ -289,9 +292,10 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
|
|
|
289
292
|
var isVideoFile = (0, _mediaSingle.isVideo)(selectedMediaNode.attrs.__fileMimeType);
|
|
290
293
|
var minWidth = (0, _mediaSingle2.calcMinWidth)(isVideoFile, maxWidthForNestedNode || contentWidth);
|
|
291
294
|
var isLegacy = widthType !== 'pixel';
|
|
292
|
-
var
|
|
295
|
+
var pixelWidthFromElement = (0, _utils2.getPixelWidthOfElement)(editorView, selectedMediaSingleNode.pos + 1,
|
|
293
296
|
// get pos of media node
|
|
294
297
|
mediaWidth || _mediaSingle2.DEFAULT_IMAGE_WIDTH);
|
|
298
|
+
var pixelWidth = isLegacy ? pixelWidthFromElement : mediaSingleWidth;
|
|
295
299
|
return /*#__PURE__*/_react.default.createElement(_PixelEntry.PixelEntry, {
|
|
296
300
|
intl: intl,
|
|
297
301
|
width: pluginState.isResizing ? pluginState.resizingWidth : pixelWidth,
|
|
@@ -318,7 +322,8 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
|
|
|
318
322
|
var width = _ref2.width;
|
|
319
323
|
var tr = state.tr.setNodeMarkup(selectedMediaSingleNode.pos, undefined, _objectSpread(_objectSpread({}, selectedMediaSingleNode.node.attrs), {}, {
|
|
320
324
|
width: width,
|
|
321
|
-
widthType: 'pixel'
|
|
325
|
+
widthType: 'pixel',
|
|
326
|
+
layout: (0, _utils2.calcNewLayout)(width, layout, contentWidth, options.fullWidthEnabled)
|
|
322
327
|
}));
|
|
323
328
|
tr.setMeta('scrollIntoView', false);
|
|
324
329
|
tr.setSelection(_state2.NodeSelection.create(tr.doc, selectedMediaSingleNode.pos));
|
|
@@ -326,7 +331,7 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
|
|
|
326
331
|
},
|
|
327
332
|
onMigrate: function onMigrate() {
|
|
328
333
|
var tr = state.tr.setNodeMarkup(selectedMediaSingleNode.pos, undefined, _objectSpread(_objectSpread({}, selectedMediaSingleNode.node.attrs), {}, {
|
|
329
|
-
width:
|
|
334
|
+
width: pixelWidthFromElement,
|
|
330
335
|
widthType: 'pixel'
|
|
331
336
|
}));
|
|
332
337
|
tr.setMeta('scrollIntoView', false);
|
|
@@ -377,10 +382,10 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
|
|
|
377
382
|
};
|
|
378
383
|
var openLink = function openLink() {
|
|
379
384
|
if (editorView) {
|
|
380
|
-
var _pluginInjectionApi$
|
|
385
|
+
var _pluginInjectionApi$a4;
|
|
381
386
|
var tr = editorView.state.tr,
|
|
382
387
|
dispatch = editorView.dispatch;
|
|
383
|
-
pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$
|
|
388
|
+
pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a4 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a4 === void 0 ? void 0 : _pluginInjectionApi$a4.actions.attachAnalyticsEvent({
|
|
384
389
|
eventType: _analytics.EVENT_TYPE.TRACK,
|
|
385
390
|
action: _analytics.ACTION.VISITED,
|
|
386
391
|
actionSubject: _analytics.ACTION_SUBJECT.MEDIA,
|
|
@@ -406,8 +411,8 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
|
|
|
406
411
|
}
|
|
407
412
|
}
|
|
408
413
|
if (allowAltTextOnImages) {
|
|
409
|
-
var _pluginInjectionApi$
|
|
410
|
-
toolbarButtons.push((0, _altText2.altTextButton)(intl, state, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$
|
|
414
|
+
var _pluginInjectionApi$a5;
|
|
415
|
+
toolbarButtons.push((0, _altText2.altTextButton)(intl, state, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a5 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a5 === void 0 ? void 0 : _pluginInjectionApi$a5.actions), {
|
|
411
416
|
type: 'separator'
|
|
412
417
|
});
|
|
413
418
|
}
|
|
@@ -438,7 +443,7 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
|
|
|
438
443
|
return items;
|
|
439
444
|
};
|
|
440
445
|
var floatingToolbar = function floatingToolbar(state, intl) {
|
|
441
|
-
var _pluginInjectionApi$
|
|
446
|
+
var _pluginInjectionApi$d2;
|
|
442
447
|
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
443
448
|
var pluginInjectionApi = arguments.length > 3 ? arguments[3] : undefined;
|
|
444
449
|
var _state$schema$nodes = state.schema.nodes,
|
|
@@ -454,7 +459,7 @@ var floatingToolbar = function floatingToolbar(state, intl) {
|
|
|
454
459
|
getEditorFeatureFlags = options.getEditorFeatureFlags;
|
|
455
460
|
var mediaPluginState = _pluginKey.stateKey.getState(state);
|
|
456
461
|
var mediaLinkingState = (0, _linking2.getMediaLinkingState)(state);
|
|
457
|
-
var _ref3 = (_pluginInjectionApi$
|
|
462
|
+
var _ref3 = (_pluginInjectionApi$d2 = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.decorations.actions) !== null && _pluginInjectionApi$d2 !== void 0 ? _pluginInjectionApi$d2 : {},
|
|
458
463
|
hoverDecoration = _ref3.hoverDecoration;
|
|
459
464
|
if (!mediaPluginState) {
|
|
460
465
|
return;
|
|
@@ -476,10 +481,10 @@ var floatingToolbar = function floatingToolbar(state, intl) {
|
|
|
476
481
|
if (allowAltTextOnImages) {
|
|
477
482
|
var mediaAltTextPluginState = (0, _altText.getPluginState)(state);
|
|
478
483
|
if (mediaAltTextPluginState.isAltTextEditorOpen) {
|
|
479
|
-
var _pluginInjectionApi$
|
|
484
|
+
var _pluginInjectionApi$f;
|
|
480
485
|
return (0, _altText2.getAltTextToolbar)(baseToolbar, {
|
|
481
486
|
altTextValidator: altTextValidator,
|
|
482
|
-
forceFocusSelector: pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$
|
|
487
|
+
forceFocusSelector: pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$f = pluginInjectionApi.floatingToolbar.actions) === null || _pluginInjectionApi$f === void 0 ? void 0 : _pluginInjectionApi$f.forceFocusSelector
|
|
483
488
|
});
|
|
484
489
|
}
|
|
485
490
|
}
|
|
@@ -490,22 +495,22 @@ var floatingToolbar = function floatingToolbar(state, intl) {
|
|
|
490
495
|
selectedNodeType = state.selection.node.type;
|
|
491
496
|
}
|
|
492
497
|
if (allowMediaInline && (parentMediaGroupNode === null || parentMediaGroupNode === void 0 ? void 0 : parentMediaGroupNode.node.type) === mediaGroup) {
|
|
493
|
-
var _pluginInjectionApi$
|
|
498
|
+
var _pluginInjectionApi$a6;
|
|
494
499
|
var mediaOffset = state.selection.$from.parentOffset + 1;
|
|
495
500
|
baseToolbar.getDomRef = function () {
|
|
496
501
|
var _mediaPluginState$ele;
|
|
497
502
|
var selector = (0, _mediaFilmstrip.mediaFilmstripItemDOMSelector)(mediaOffset);
|
|
498
503
|
return (_mediaPluginState$ele = mediaPluginState.element) === null || _mediaPluginState$ele === void 0 ? void 0 : _mediaPluginState$ele.querySelector(selector);
|
|
499
504
|
};
|
|
500
|
-
items = generateMediaCardFloatingToolbar(state, intl, mediaPluginState, hoverDecoration, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$
|
|
505
|
+
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);
|
|
501
506
|
} else if (allowMediaInline && selectedNodeType && selectedNodeType === mediaInline) {
|
|
502
|
-
var _pluginInjectionApi$
|
|
507
|
+
var _pluginInjectionApi$a7;
|
|
503
508
|
baseToolbar.getDomRef = function () {
|
|
504
509
|
var _mediaPluginState$ele2;
|
|
505
510
|
var element = (_mediaPluginState$ele2 = mediaPluginState.element) === null || _mediaPluginState$ele2 === void 0 ? void 0 : _mediaPluginState$ele2.querySelector(".".concat(_styles.MediaInlineNodeSelector));
|
|
506
511
|
return element || mediaPluginState.element;
|
|
507
512
|
};
|
|
508
|
-
items = generateMediaInlineFloatingToolbar(state, intl, mediaPluginState, hoverDecoration, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$
|
|
513
|
+
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);
|
|
509
514
|
} else {
|
|
510
515
|
baseToolbar.getDomRef = function () {
|
|
511
516
|
var _mediaPluginState$ele3;
|
|
@@ -58,8 +58,8 @@ var getLinkingToolbar = function getLinkingToolbar(toolbarBaseConfig, mediaLinki
|
|
|
58
58
|
intl: intl,
|
|
59
59
|
editing: editing,
|
|
60
60
|
onUnlink: function onUnlink() {
|
|
61
|
-
var _pluginInjectionApi$
|
|
62
|
-
return (0, _linking.unlink)(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$
|
|
61
|
+
var _pluginInjectionApi$a;
|
|
62
|
+
return (0, _linking.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);
|
|
63
63
|
},
|
|
64
64
|
onBack: function onBack(href, meta) {
|
|
65
65
|
if (href.trim() && meta.inputMethod) {
|
|
@@ -68,14 +68,14 @@ var getLinkingToolbar = function getLinkingToolbar(toolbarBaseConfig, mediaLinki
|
|
|
68
68
|
(0, _linking.hideLinkingToolbar)(view.state, view.dispatch, view);
|
|
69
69
|
},
|
|
70
70
|
onCancel: function onCancel() {
|
|
71
|
-
var _pluginInjectionApi$
|
|
71
|
+
var _pluginInjectionApi$f;
|
|
72
72
|
(0, _linking.hideLinkingToolbar)(view.state, view.dispatch, view, true);
|
|
73
73
|
/** Focus should move to the 'Add link' button when the toolbar closes
|
|
74
74
|
* and not close the floating toolbar.
|
|
75
75
|
*/
|
|
76
76
|
var tr = view.state.tr,
|
|
77
77
|
dispatch = view.dispatch;
|
|
78
|
-
pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$
|
|
78
|
+
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);
|
|
79
79
|
dispatch(tr);
|
|
80
80
|
},
|
|
81
81
|
onSubmit: function onSubmit(href, meta) {
|
|
@@ -4,11 +4,13 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.removeMediaGroupNode = exports.getSelectedMediaSingle = exports.getSelectedMediaContainerNodeAttrs = exports.getPixelWidthOfElement = exports.downloadMedia = void 0;
|
|
7
|
+
exports.removeMediaGroupNode = exports.getSelectedMediaSingle = exports.getSelectedMediaContainerNodeAttrs = exports.getPixelWidthOfElement = exports.downloadMedia = exports.calcNewLayout = void 0;
|
|
8
8
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
9
9
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
10
10
|
var _mediaClient = require("@atlaskit/media-client");
|
|
11
11
|
var _utils = require("@atlaskit/editor-prosemirror/utils");
|
|
12
|
+
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
13
|
+
var _mediaSingle = require("@atlaskit/editor-common/media-single");
|
|
12
14
|
var getSelectedMediaContainerNodeAttrs = function getSelectedMediaContainerNodeAttrs(mediaPluginState) {
|
|
13
15
|
var selectedNode = mediaPluginState.selectedMediaContainerNode();
|
|
14
16
|
if (selectedNode && selectedNode.attrs) {
|
|
@@ -81,4 +83,22 @@ var getPixelWidthOfElement = function getPixelWidthOfElement(editorView, pos, me
|
|
|
81
83
|
}
|
|
82
84
|
return mediaWidth;
|
|
83
85
|
};
|
|
84
|
-
exports.getPixelWidthOfElement = getPixelWidthOfElement;
|
|
86
|
+
exports.getPixelWidthOfElement = getPixelWidthOfElement;
|
|
87
|
+
var calcNewLayout = function calcNewLayout(width, layout, contentWidth) {
|
|
88
|
+
var fullWidthMode = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
89
|
+
var isWrappedLayout = _mediaSingle.wrappedLayouts.indexOf(layout) > -1;
|
|
90
|
+
if (width >= _editorSharedStyles.akEditorFullWidthLayoutWidth) {
|
|
91
|
+
// If width is greater than or equal to full editor width
|
|
92
|
+
return 'full-width';
|
|
93
|
+
}
|
|
94
|
+
if (fullWidthMode) {
|
|
95
|
+
// If under editor full width mode
|
|
96
|
+
return isWrappedLayout ? layout : 'center';
|
|
97
|
+
}
|
|
98
|
+
if (width > contentWidth) {
|
|
99
|
+
// If width is greater than content length and not nested
|
|
100
|
+
return 'wide';
|
|
101
|
+
}
|
|
102
|
+
return isWrappedLayout && width !== contentWidth ? layout : 'center';
|
|
103
|
+
};
|
|
104
|
+
exports.calcNewLayout = calcNewLayout;
|
|
@@ -132,8 +132,8 @@ var ResizableMediaSingleNext = /*#__PURE__*/function (_React$Component) {
|
|
|
132
132
|
return _this.wrapper = wrapper;
|
|
133
133
|
});
|
|
134
134
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "displayGuideline", function (guidelines) {
|
|
135
|
-
var _this$props$pluginInj, _this$props$pluginInj2, _this$props$pluginInj3
|
|
136
|
-
return (_this$props$pluginInj = _this.props.pluginInjectionApi) === null || _this$props$pluginInj === void 0 ? void 0 : (_this$props$pluginInj2 = _this$props$pluginInj.
|
|
135
|
+
var _this$props$pluginInj, _this$props$pluginInj2, _this$props$pluginInj3;
|
|
136
|
+
return (_this$props$pluginInj = _this.props.pluginInjectionApi) === null || _this$props$pluginInj === void 0 ? void 0 : (_this$props$pluginInj2 = _this$props$pluginInj.guideline) === null || _this$props$pluginInj2 === void 0 ? void 0 : (_this$props$pluginInj3 = _this$props$pluginInj2.actions) === null || _this$props$pluginInj3 === void 0 ? void 0 : _this$props$pluginInj3.displayGuideline(_this.props.view)({
|
|
137
137
|
guidelines: guidelines
|
|
138
138
|
});
|
|
139
139
|
});
|
|
@@ -163,8 +163,8 @@ var ResizableMediaSingleNext = /*#__PURE__*/function (_React$Component) {
|
|
|
163
163
|
return Math.min(contentWidth || _editorSharedStyles.akEditorDefaultLayoutWidth, isVideoFile ? _mediaSingle.MEDIA_SINGLE_VIDEO_MIN_PIXEL_WIDTH : _mediaSingle.MEDIA_SINGLE_DEFAULT_MIN_PIXEL_WIDTH);
|
|
164
164
|
}));
|
|
165
165
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "getRelativeGuides", function () {
|
|
166
|
-
var _this$props$
|
|
167
|
-
var guidelinePluginState = (_this$props$
|
|
166
|
+
var _this$props$pluginInj4, _this$props$pluginInj5, _this$props$pluginInj6;
|
|
167
|
+
var guidelinePluginState = (_this$props$pluginInj4 = _this.props.pluginInjectionApi) === null || _this$props$pluginInj4 === void 0 ? void 0 : (_this$props$pluginInj5 = _this$props$pluginInj4.guideline) === null || _this$props$pluginInj5 === void 0 ? void 0 : (_this$props$pluginInj6 = _this$props$pluginInj5.sharedState) === null || _this$props$pluginInj6 === void 0 ? void 0 : _this$props$pluginInj6.currentState();
|
|
168
168
|
var _ref = (guidelinePluginState === null || guidelinePluginState === void 0 ? void 0 : guidelinePluginState.rect) || {
|
|
169
169
|
top: 0,
|
|
170
170
|
left: 0
|
|
@@ -42,11 +42,11 @@ var ResizableMediaSingle = /*#__PURE__*/function (_React$Component) {
|
|
|
42
42
|
isVideoFile: true
|
|
43
43
|
});
|
|
44
44
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "displayGrid", function (visible, gridType, highlight) {
|
|
45
|
-
var _pluginInjectionApi$
|
|
45
|
+
var _pluginInjectionApi$g, _pluginInjectionApi$g2;
|
|
46
46
|
var _this$props = _this.props,
|
|
47
47
|
pluginInjectionApi = _this$props.pluginInjectionApi,
|
|
48
48
|
view = _this$props.view;
|
|
49
|
-
pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$
|
|
49
|
+
pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$g = pluginInjectionApi.grid) === null || _pluginInjectionApi$g === void 0 ? void 0 : (_pluginInjectionApi$g2 = _pluginInjectionApi$g.actions) === null || _pluginInjectionApi$g2 === void 0 ? void 0 : _pluginInjectionApi$g2.displayGrid(view)({
|
|
50
50
|
visible: visible,
|
|
51
51
|
gridType: gridType,
|
|
52
52
|
highlight: highlight
|
|
@@ -30,12 +30,14 @@ var getSharedState = function getSharedState(editorState) {
|
|
|
30
30
|
}
|
|
31
31
|
return _key.mentionPluginKey.getState(editorState);
|
|
32
32
|
};
|
|
33
|
-
var mentionsPlugin = function mentionsPlugin(
|
|
33
|
+
var mentionsPlugin = function mentionsPlugin(_ref) {
|
|
34
|
+
var options = _ref.config,
|
|
35
|
+
api = _ref.api;
|
|
34
36
|
var sessionId = (0, _uuid.default)();
|
|
35
37
|
var fireEvent = function fireEvent(payload) {
|
|
36
|
-
var _api$
|
|
37
|
-
var
|
|
38
|
-
createAnalyticsEvent =
|
|
38
|
+
var _api$analytics$shared, _api$analytics;
|
|
39
|
+
var _ref2 = (_api$analytics$shared = api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.sharedState.currentState()) !== null && _api$analytics$shared !== void 0 ? _api$analytics$shared : {},
|
|
40
|
+
createAnalyticsEvent = _ref2.createAnalyticsEvent;
|
|
39
41
|
if (!createAnalyticsEvent) {
|
|
40
42
|
return;
|
|
41
43
|
}
|
|
@@ -66,17 +68,17 @@ var mentionsPlugin = function mentionsPlugin(options, api) {
|
|
|
66
68
|
}
|
|
67
69
|
}];
|
|
68
70
|
},
|
|
69
|
-
secondaryToolbarComponent: function secondaryToolbarComponent(
|
|
70
|
-
var editorView =
|
|
71
|
-
disabled =
|
|
71
|
+
secondaryToolbarComponent: function secondaryToolbarComponent(_ref3) {
|
|
72
|
+
var editorView = _ref3.editorView,
|
|
73
|
+
disabled = _ref3.disabled;
|
|
72
74
|
return /*#__PURE__*/_react.default.createElement(_WithPluginState.default, {
|
|
73
75
|
editorView: editorView,
|
|
74
76
|
plugins: {
|
|
75
77
|
mentionState: _key.mentionPluginKey
|
|
76
78
|
},
|
|
77
|
-
render: function render(
|
|
78
|
-
var
|
|
79
|
-
mentionState =
|
|
79
|
+
render: function render(_ref4) {
|
|
80
|
+
var _ref4$mentionState = _ref4.mentionState,
|
|
81
|
+
mentionState = _ref4$mentionState === void 0 ? {} : _ref4$mentionState;
|
|
80
82
|
return !mentionState.mentionProvider ? null : /*#__PURE__*/_react.default.createElement(_ToolbarMention.default, {
|
|
81
83
|
editorView: editorView,
|
|
82
84
|
isDisabled: disabled || (0, _utils.isTypeAheadAllowed)(editorView.state)
|
|
@@ -86,8 +88,8 @@ var mentionsPlugin = function mentionsPlugin(options, api) {
|
|
|
86
88
|
},
|
|
87
89
|
getSharedState: getSharedState,
|
|
88
90
|
pluginsOptions: {
|
|
89
|
-
quickInsert: function quickInsert(
|
|
90
|
-
var formatMessage =
|
|
91
|
+
quickInsert: function quickInsert(_ref5) {
|
|
92
|
+
var formatMessage = _ref5.formatMessage;
|
|
91
93
|
return [{
|
|
92
94
|
id: 'mention',
|
|
93
95
|
title: formatMessage(_messages.messages.mention),
|
|
@@ -99,19 +101,19 @@ var mentionsPlugin = function mentionsPlugin(options, api) {
|
|
|
99
101
|
return /*#__PURE__*/_react.default.createElement(_quickInsert.IconMention, null);
|
|
100
102
|
},
|
|
101
103
|
action: function action(insert, state) {
|
|
102
|
-
var _api$
|
|
104
|
+
var _api$analytics2;
|
|
103
105
|
var tr = insert(undefined);
|
|
104
106
|
var pluginState = getSharedState(state);
|
|
105
107
|
if (pluginState && pluginState.canInsertMention === false) {
|
|
106
108
|
return false;
|
|
107
109
|
}
|
|
108
|
-
api === null || api === void 0 ? void 0 : api.
|
|
110
|
+
api === null || api === void 0 ? void 0 : api.typeAhead.commands.openTypeAheadAtCursor({
|
|
109
111
|
triggerHandler: typeAhead,
|
|
110
112
|
inputMethod: _analytics.INPUT_METHOD.QUICK_INSERT
|
|
111
113
|
})({
|
|
112
114
|
tr: tr
|
|
113
115
|
});
|
|
114
|
-
api === null || api === void 0 ? void 0 : (_api$
|
|
116
|
+
api === null || api === void 0 ? void 0 : (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions.attachAnalyticsEvent({
|
|
115
117
|
action: _analytics.ACTION.INVOKED,
|
|
116
118
|
actionSubject: _analytics.ACTION_SUBJECT.TYPEAHEAD,
|
|
117
119
|
actionSubjectId: _analytics.ACTION_SUBJECT_ID.TYPEAHEAD_MENTION,
|