@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
|
@@ -172,16 +172,16 @@ export class MediaPluginStateImplementation {
|
|
|
172
172
|
});
|
|
173
173
|
}
|
|
174
174
|
if (isMediaSingle(state.schema, mediaStateWithContext.fileMimeType)) {
|
|
175
|
-
var _this$pluginInjection, _pluginInjectionApi$
|
|
175
|
+
var _this$pluginInjection, _pluginInjectionApi$a;
|
|
176
176
|
// read width state right before inserting to get up-to-date and define values
|
|
177
|
-
const widthPluginState = (_this$pluginInjection = this.pluginInjectionApi) === null || _this$pluginInjection === void 0 ? void 0 : _this$pluginInjection.
|
|
178
|
-
insertMediaSingleNode(this.view, mediaStateWithContext, this.getInputMethod(pickerType), collection, this.mediaOptions && this.mediaOptions.alignLeftOnInsert, this.newInsertionBehaviour, widthPluginState, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$
|
|
177
|
+
const widthPluginState = (_this$pluginInjection = this.pluginInjectionApi) === null || _this$pluginInjection === void 0 ? void 0 : _this$pluginInjection.width.sharedState.currentState();
|
|
178
|
+
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);
|
|
179
179
|
} 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)) {
|
|
180
|
-
var _pluginInjectionApi$
|
|
181
|
-
insertMediaInlineNode(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$
|
|
180
|
+
var _pluginInjectionApi$a2;
|
|
181
|
+
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));
|
|
182
182
|
} else {
|
|
183
|
-
var _pluginInjectionApi$
|
|
184
|
-
insertMediaGroupNode(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$
|
|
183
|
+
var _pluginInjectionApi$a3;
|
|
184
|
+
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));
|
|
185
185
|
}
|
|
186
186
|
|
|
187
187
|
// do events when media state changes
|
|
@@ -18,7 +18,7 @@ import { messages } from '@atlaskit/media-ui';
|
|
|
18
18
|
import { cardMessages } from '@atlaskit/editor-common/messages';
|
|
19
19
|
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
20
20
|
import { FilePreviewItem } from './filePreviewItem';
|
|
21
|
-
import { downloadMedia, getSelectedMediaSingle, removeMediaGroupNode, getPixelWidthOfElement } from './utils';
|
|
21
|
+
import { downloadMedia, getSelectedMediaSingle, removeMediaGroupNode, getPixelWidthOfElement, calcNewLayout } from './utils';
|
|
22
22
|
import { isVideo } from '../utils/media-single';
|
|
23
23
|
import { changeInlineToMediaCard, changeMediaCardToInline, removeInlineCard, setBorderMark, toggleBorderMark } from './commands';
|
|
24
24
|
import { MediaInlineNodeSelector, MediaSingleNodeSelector } from '../nodeviews/styles';
|
|
@@ -206,7 +206,7 @@ const generateMediaSingleFloatingToolbar = (state, intl, options, pluginState, m
|
|
|
206
206
|
let toolbarButtons = [];
|
|
207
207
|
const {
|
|
208
208
|
hoverDecoration
|
|
209
|
-
} = (_pluginInjectionApi$d = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.
|
|
209
|
+
} = (_pluginInjectionApi$d = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.decorations.actions) !== null && _pluginInjectionApi$d !== void 0 ? _pluginInjectionApi$d : {};
|
|
210
210
|
if (shouldShowImageBorder(state)) {
|
|
211
211
|
toolbarButtons.push({
|
|
212
212
|
type: 'custom',
|
|
@@ -222,12 +222,12 @@ const generateMediaSingleFloatingToolbar = (state, intl, options, pluginState, m
|
|
|
222
222
|
const borderMark = currentMediaNodeBorderMark(state);
|
|
223
223
|
return /*#__PURE__*/React.createElement(ImageBorderItem, {
|
|
224
224
|
toggleBorder: () => {
|
|
225
|
-
var _pluginInjectionApi$
|
|
226
|
-
toggleBorderMark(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$
|
|
225
|
+
var _pluginInjectionApi$a;
|
|
226
|
+
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: attrs => {
|
|
229
|
-
var _pluginInjectionApi$
|
|
230
|
-
setBorderMark(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$
|
|
229
|
+
var _pluginInjectionApi$a2;
|
|
230
|
+
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 @@ const generateMediaSingleFloatingToolbar = (state, intl, options, pluginState, m
|
|
|
240
240
|
});
|
|
241
241
|
}
|
|
242
242
|
if (allowAdvancedToolBarOptions) {
|
|
243
|
-
var _pluginInjectionApi$
|
|
244
|
-
const widthPlugin = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.
|
|
243
|
+
var _pluginInjectionApi$a3;
|
|
244
|
+
const widthPlugin = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.width;
|
|
245
245
|
let isChangingLayoutDisabled = false;
|
|
246
246
|
if (getBooleanFF('platform.editor.media.extended-resize-experience')) {
|
|
247
247
|
var _widthPlugin$sharedSt;
|
|
@@ -256,7 +256,7 @@ const generateMediaSingleFloatingToolbar = (state, intl, options, pluginState, m
|
|
|
256
256
|
}
|
|
257
257
|
}
|
|
258
258
|
}
|
|
259
|
-
const layoutButtons = buildLayoutButtons(state, intl, state.schema.nodes.mediaSingle, widthPlugin, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$
|
|
259
|
+
const 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);
|
|
260
260
|
toolbarButtons = [...toolbarButtons, ...layoutButtons];
|
|
261
261
|
if (layoutButtons.length) {
|
|
262
262
|
toolbarButtons.push({
|
|
@@ -285,7 +285,9 @@ const generateMediaSingleFloatingToolbar = (state, intl, options, pluginState, m
|
|
|
285
285
|
return null;
|
|
286
286
|
}
|
|
287
287
|
const {
|
|
288
|
-
|
|
288
|
+
width: mediaSingleWidth,
|
|
289
|
+
widthType,
|
|
290
|
+
layout
|
|
289
291
|
} = selectedMediaSingleNode.node.attrs;
|
|
290
292
|
const {
|
|
291
293
|
width: mediaWidth,
|
|
@@ -296,9 +298,10 @@ const generateMediaSingleFloatingToolbar = (state, intl, options, pluginState, m
|
|
|
296
298
|
const isVideoFile = isVideo(selectedMediaNode.attrs.__fileMimeType);
|
|
297
299
|
const minWidth = calcMinWidth(isVideoFile, maxWidthForNestedNode || contentWidth);
|
|
298
300
|
const isLegacy = widthType !== 'pixel';
|
|
299
|
-
const
|
|
301
|
+
const pixelWidthFromElement = getPixelWidthOfElement(editorView, selectedMediaSingleNode.pos + 1,
|
|
300
302
|
// get pos of media node
|
|
301
303
|
mediaWidth || DEFAULT_IMAGE_WIDTH);
|
|
304
|
+
const pixelWidth = isLegacy ? pixelWidthFromElement : mediaSingleWidth;
|
|
302
305
|
return /*#__PURE__*/React.createElement(PixelEntry, {
|
|
303
306
|
intl: intl,
|
|
304
307
|
width: pluginState.isResizing ? pluginState.resizingWidth : pixelWidth,
|
|
@@ -327,7 +330,8 @@ const generateMediaSingleFloatingToolbar = (state, intl, options, pluginState, m
|
|
|
327
330
|
const tr = state.tr.setNodeMarkup(selectedMediaSingleNode.pos, undefined, {
|
|
328
331
|
...selectedMediaSingleNode.node.attrs,
|
|
329
332
|
width,
|
|
330
|
-
widthType: 'pixel'
|
|
333
|
+
widthType: 'pixel',
|
|
334
|
+
layout: calcNewLayout(width, layout, contentWidth, options.fullWidthEnabled)
|
|
331
335
|
});
|
|
332
336
|
tr.setMeta('scrollIntoView', false);
|
|
333
337
|
tr.setSelection(NodeSelection.create(tr.doc, selectedMediaSingleNode.pos));
|
|
@@ -336,7 +340,7 @@ const generateMediaSingleFloatingToolbar = (state, intl, options, pluginState, m
|
|
|
336
340
|
onMigrate: () => {
|
|
337
341
|
const tr = state.tr.setNodeMarkup(selectedMediaSingleNode.pos, undefined, {
|
|
338
342
|
...selectedMediaSingleNode.node.attrs,
|
|
339
|
-
width:
|
|
343
|
+
width: pixelWidthFromElement,
|
|
340
344
|
widthType: 'pixel'
|
|
341
345
|
});
|
|
342
346
|
tr.setMeta('scrollIntoView', false);
|
|
@@ -391,14 +395,14 @@ const generateMediaSingleFloatingToolbar = (state, intl, options, pluginState, m
|
|
|
391
395
|
};
|
|
392
396
|
const openLink = () => {
|
|
393
397
|
if (editorView) {
|
|
394
|
-
var _pluginInjectionApi$
|
|
398
|
+
var _pluginInjectionApi$a4;
|
|
395
399
|
const {
|
|
396
400
|
state: {
|
|
397
401
|
tr
|
|
398
402
|
},
|
|
399
403
|
dispatch
|
|
400
404
|
} = editorView;
|
|
401
|
-
pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$
|
|
405
|
+
pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a4 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a4 === void 0 ? void 0 : _pluginInjectionApi$a4.actions.attachAnalyticsEvent({
|
|
402
406
|
eventType: EVENT_TYPE.TRACK,
|
|
403
407
|
action: ACTION.VISITED,
|
|
404
408
|
actionSubject: ACTION_SUBJECT.MEDIA,
|
|
@@ -424,8 +428,8 @@ const generateMediaSingleFloatingToolbar = (state, intl, options, pluginState, m
|
|
|
424
428
|
}
|
|
425
429
|
}
|
|
426
430
|
if (allowAltTextOnImages) {
|
|
427
|
-
var _pluginInjectionApi$
|
|
428
|
-
toolbarButtons.push(altTextButton(intl, state, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$
|
|
431
|
+
var _pluginInjectionApi$a5;
|
|
432
|
+
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), {
|
|
429
433
|
type: 'separator'
|
|
430
434
|
});
|
|
431
435
|
}
|
|
@@ -456,7 +460,7 @@ const generateMediaSingleFloatingToolbar = (state, intl, options, pluginState, m
|
|
|
456
460
|
return items;
|
|
457
461
|
};
|
|
458
462
|
export const floatingToolbar = (state, intl, options = {}, pluginInjectionApi) => {
|
|
459
|
-
var _pluginInjectionApi$
|
|
463
|
+
var _pluginInjectionApi$d2;
|
|
460
464
|
const {
|
|
461
465
|
media,
|
|
462
466
|
mediaInline,
|
|
@@ -475,7 +479,7 @@ export const floatingToolbar = (state, intl, options = {}, pluginInjectionApi) =
|
|
|
475
479
|
const mediaLinkingState = getMediaLinkingState(state);
|
|
476
480
|
const {
|
|
477
481
|
hoverDecoration
|
|
478
|
-
} = (_pluginInjectionApi$
|
|
482
|
+
} = (_pluginInjectionApi$d2 = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.decorations.actions) !== null && _pluginInjectionApi$d2 !== void 0 ? _pluginInjectionApi$d2 : {};
|
|
479
483
|
if (!mediaPluginState) {
|
|
480
484
|
return;
|
|
481
485
|
}
|
|
@@ -494,10 +498,10 @@ export const floatingToolbar = (state, intl, options = {}, pluginInjectionApi) =
|
|
|
494
498
|
if (allowAltTextOnImages) {
|
|
495
499
|
const mediaAltTextPluginState = getMediaAltTextPluginState(state);
|
|
496
500
|
if (mediaAltTextPluginState.isAltTextEditorOpen) {
|
|
497
|
-
var _pluginInjectionApi$
|
|
501
|
+
var _pluginInjectionApi$f;
|
|
498
502
|
return getAltTextToolbar(baseToolbar, {
|
|
499
503
|
altTextValidator,
|
|
500
|
-
forceFocusSelector: pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$
|
|
504
|
+
forceFocusSelector: pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$f = pluginInjectionApi.floatingToolbar.actions) === null || _pluginInjectionApi$f === void 0 ? void 0 : _pluginInjectionApi$f.forceFocusSelector
|
|
501
505
|
});
|
|
502
506
|
}
|
|
503
507
|
}
|
|
@@ -508,22 +512,22 @@ export const floatingToolbar = (state, intl, options = {}, pluginInjectionApi) =
|
|
|
508
512
|
selectedNodeType = state.selection.node.type;
|
|
509
513
|
}
|
|
510
514
|
if (allowMediaInline && (parentMediaGroupNode === null || parentMediaGroupNode === void 0 ? void 0 : parentMediaGroupNode.node.type) === mediaGroup) {
|
|
511
|
-
var _pluginInjectionApi$
|
|
515
|
+
var _pluginInjectionApi$a6;
|
|
512
516
|
const mediaOffset = state.selection.$from.parentOffset + 1;
|
|
513
517
|
baseToolbar.getDomRef = () => {
|
|
514
518
|
var _mediaPluginState$ele;
|
|
515
519
|
const selector = mediaFilmstripItemDOMSelector(mediaOffset);
|
|
516
520
|
return (_mediaPluginState$ele = mediaPluginState.element) === null || _mediaPluginState$ele === void 0 ? void 0 : _mediaPluginState$ele.querySelector(selector);
|
|
517
521
|
};
|
|
518
|
-
items = generateMediaCardFloatingToolbar(state, intl, mediaPluginState, hoverDecoration, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$
|
|
522
|
+
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);
|
|
519
523
|
} else if (allowMediaInline && selectedNodeType && selectedNodeType === mediaInline) {
|
|
520
|
-
var _pluginInjectionApi$
|
|
524
|
+
var _pluginInjectionApi$a7;
|
|
521
525
|
baseToolbar.getDomRef = () => {
|
|
522
526
|
var _mediaPluginState$ele2;
|
|
523
527
|
const element = (_mediaPluginState$ele2 = mediaPluginState.element) === null || _mediaPluginState$ele2 === void 0 ? void 0 : _mediaPluginState$ele2.querySelector(`.${MediaInlineNodeSelector}`);
|
|
524
528
|
return element || mediaPluginState.element;
|
|
525
529
|
};
|
|
526
|
-
items = generateMediaInlineFloatingToolbar(state, intl, mediaPluginState, hoverDecoration, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$
|
|
530
|
+
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);
|
|
527
531
|
} else {
|
|
528
532
|
baseToolbar.getDomRef = () => {
|
|
529
533
|
var _mediaPluginState$ele3;
|
|
@@ -56,8 +56,8 @@ export const getLinkingToolbar = (toolbarBaseConfig, mediaLinkingState, state, i
|
|
|
56
56
|
intl: intl,
|
|
57
57
|
editing: editing,
|
|
58
58
|
onUnlink: () => {
|
|
59
|
-
var _pluginInjectionApi$
|
|
60
|
-
return unlink(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$
|
|
59
|
+
var _pluginInjectionApi$a;
|
|
60
|
+
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);
|
|
61
61
|
},
|
|
62
62
|
onBack: (href, meta) => {
|
|
63
63
|
if (href.trim() && meta.inputMethod) {
|
|
@@ -66,7 +66,7 @@ export const getLinkingToolbar = (toolbarBaseConfig, mediaLinkingState, state, i
|
|
|
66
66
|
hideLinkingToolbar(view.state, view.dispatch, view);
|
|
67
67
|
},
|
|
68
68
|
onCancel: () => {
|
|
69
|
-
var _pluginInjectionApi$
|
|
69
|
+
var _pluginInjectionApi$f;
|
|
70
70
|
hideLinkingToolbar(view.state, view.dispatch, view, true);
|
|
71
71
|
/** Focus should move to the 'Add link' button when the toolbar closes
|
|
72
72
|
* and not close the floating toolbar.
|
|
@@ -77,7 +77,7 @@ export const getLinkingToolbar = (toolbarBaseConfig, mediaLinkingState, state, i
|
|
|
77
77
|
},
|
|
78
78
|
dispatch
|
|
79
79
|
} = view;
|
|
80
|
-
pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$
|
|
80
|
+
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);
|
|
81
81
|
dispatch(tr);
|
|
82
82
|
},
|
|
83
83
|
onSubmit: (href, meta) => {
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { getMediaClient } from '@atlaskit/media-client';
|
|
2
2
|
import { findParentNodeOfType, removeParentNodeOfType, removeSelectedNode, findSelectedNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
3
|
+
import { akEditorFullWidthLayoutWidth } from '@atlaskit/editor-shared-styles';
|
|
4
|
+
import { wrappedLayouts } from '@atlaskit/editor-common/media-single';
|
|
3
5
|
export const getSelectedMediaContainerNodeAttrs = mediaPluginState => {
|
|
4
6
|
const selectedNode = mediaPluginState.selectedMediaContainerNode();
|
|
5
7
|
if (selectedNode && selectedNode.attrs) {
|
|
@@ -53,4 +55,20 @@ export const getPixelWidthOfElement = (editorView, pos, mediaWidth) => {
|
|
|
53
55
|
return domNode.offsetWidth;
|
|
54
56
|
}
|
|
55
57
|
return mediaWidth;
|
|
58
|
+
};
|
|
59
|
+
export const calcNewLayout = (width, layout, contentWidth, fullWidthMode = false) => {
|
|
60
|
+
const isWrappedLayout = wrappedLayouts.indexOf(layout) > -1;
|
|
61
|
+
if (width >= akEditorFullWidthLayoutWidth) {
|
|
62
|
+
// If width is greater than or equal to full editor width
|
|
63
|
+
return 'full-width';
|
|
64
|
+
}
|
|
65
|
+
if (fullWidthMode) {
|
|
66
|
+
// If under editor full width mode
|
|
67
|
+
return isWrappedLayout ? layout : 'center';
|
|
68
|
+
}
|
|
69
|
+
if (width > contentWidth) {
|
|
70
|
+
// If width is greater than content length and not nested
|
|
71
|
+
return 'wide';
|
|
72
|
+
}
|
|
73
|
+
return isWrappedLayout && width !== contentWidth ? layout : 'center';
|
|
56
74
|
};
|
|
@@ -113,8 +113,8 @@ class ResizableMediaSingleNext extends React.Component {
|
|
|
113
113
|
});
|
|
114
114
|
_defineProperty(this, "saveWrapper", wrapper => this.wrapper = wrapper);
|
|
115
115
|
_defineProperty(this, "displayGuideline", guidelines => {
|
|
116
|
-
var _this$props$pluginInj, _this$props$pluginInj2, _this$props$pluginInj3
|
|
117
|
-
return (_this$props$pluginInj = this.props.pluginInjectionApi) === null || _this$props$pluginInj === void 0 ? void 0 : (_this$props$pluginInj2 = _this$props$pluginInj.
|
|
116
|
+
var _this$props$pluginInj, _this$props$pluginInj2, _this$props$pluginInj3;
|
|
117
|
+
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)({
|
|
118
118
|
guidelines
|
|
119
119
|
});
|
|
120
120
|
});
|
|
@@ -146,8 +146,8 @@ class ResizableMediaSingleNext extends React.Component {
|
|
|
146
146
|
return Math.min(contentWidth || akEditorDefaultLayoutWidth, isVideoFile ? MEDIA_SINGLE_VIDEO_MIN_PIXEL_WIDTH : MEDIA_SINGLE_DEFAULT_MIN_PIXEL_WIDTH);
|
|
147
147
|
}));
|
|
148
148
|
_defineProperty(this, "getRelativeGuides", () => {
|
|
149
|
-
var _this$props$
|
|
150
|
-
const guidelinePluginState = (_this$props$
|
|
149
|
+
var _this$props$pluginInj4, _this$props$pluginInj5, _this$props$pluginInj6;
|
|
150
|
+
const 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();
|
|
151
151
|
const {
|
|
152
152
|
top: topOffset
|
|
153
153
|
} = (guidelinePluginState === null || guidelinePluginState === void 0 ? void 0 : guidelinePluginState.rect) || {
|
|
@@ -19,12 +19,12 @@ export default class ResizableMediaSingle extends React.Component {
|
|
|
19
19
|
isVideoFile: true
|
|
20
20
|
});
|
|
21
21
|
_defineProperty(this, "displayGrid", (visible, gridType, highlight) => {
|
|
22
|
-
var _pluginInjectionApi$
|
|
22
|
+
var _pluginInjectionApi$g, _pluginInjectionApi$g2;
|
|
23
23
|
const {
|
|
24
24
|
pluginInjectionApi,
|
|
25
25
|
view
|
|
26
26
|
} = this.props;
|
|
27
|
-
pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$
|
|
27
|
+
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)({
|
|
28
28
|
visible,
|
|
29
29
|
gridType,
|
|
30
30
|
highlight: highlight
|
|
@@ -18,13 +18,16 @@ const getSharedState = editorState => {
|
|
|
18
18
|
}
|
|
19
19
|
return mentionPluginKey.getState(editorState);
|
|
20
20
|
};
|
|
21
|
-
const mentionsPlugin = (
|
|
21
|
+
const mentionsPlugin = ({
|
|
22
|
+
config: options,
|
|
23
|
+
api
|
|
24
|
+
}) => {
|
|
22
25
|
let sessionId = uuid();
|
|
23
26
|
const fireEvent = payload => {
|
|
24
|
-
var _api$
|
|
27
|
+
var _api$analytics$shared, _api$analytics;
|
|
25
28
|
const {
|
|
26
29
|
createAnalyticsEvent
|
|
27
|
-
} = (_api$
|
|
30
|
+
} = (_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 : {};
|
|
28
31
|
if (!createAnalyticsEvent) {
|
|
29
32
|
return;
|
|
30
33
|
}
|
|
@@ -83,19 +86,19 @@ const mentionsPlugin = (options, api) => {
|
|
|
83
86
|
keyshortcut: '@',
|
|
84
87
|
icon: () => /*#__PURE__*/React.createElement(IconMention, null),
|
|
85
88
|
action(insert, state) {
|
|
86
|
-
var _api$
|
|
89
|
+
var _api$analytics2;
|
|
87
90
|
const tr = insert(undefined);
|
|
88
91
|
const pluginState = getSharedState(state);
|
|
89
92
|
if (pluginState && pluginState.canInsertMention === false) {
|
|
90
93
|
return false;
|
|
91
94
|
}
|
|
92
|
-
api === null || api === void 0 ? void 0 : api.
|
|
95
|
+
api === null || api === void 0 ? void 0 : api.typeAhead.commands.openTypeAheadAtCursor({
|
|
93
96
|
triggerHandler: typeAhead,
|
|
94
97
|
inputMethod: INPUT_METHOD.QUICK_INSERT
|
|
95
98
|
})({
|
|
96
99
|
tr
|
|
97
100
|
});
|
|
98
|
-
api === null || api === void 0 ? void 0 : (_api$
|
|
101
|
+
api === null || api === void 0 ? void 0 : (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions.attachAnalyticsEvent({
|
|
99
102
|
action: ACTION.INVOKED,
|
|
100
103
|
actionSubject: ACTION_SUBJECT.TYPEAHEAD,
|
|
101
104
|
actionSubjectId: ACTION_SUBJECT_ID.TYPEAHEAD_MENTION,
|
|
@@ -12,7 +12,10 @@ import { T50 } from '@atlaskit/theme/colors';
|
|
|
12
12
|
// Insertions via the drop down menu
|
|
13
13
|
// tslint-ignore-next-line
|
|
14
14
|
import { createWrapSelectionTransaction } from '../block-type/commands/block-type';
|
|
15
|
-
const panelPlugin = (
|
|
15
|
+
const panelPlugin = ({
|
|
16
|
+
config: options = {},
|
|
17
|
+
api
|
|
18
|
+
}) => ({
|
|
16
19
|
name: 'panel',
|
|
17
20
|
nodes() {
|
|
18
21
|
const panelNode = panel(!!options.allowCustomPanel);
|
|
@@ -135,7 +138,7 @@ const panelPlugin = (options = {}, api) => ({
|
|
|
135
138
|
}
|
|
136
139
|
return quickInsertOptions;
|
|
137
140
|
},
|
|
138
|
-
floatingToolbar: (state, intl, providerFactory) => getToolbarConfig(state, intl, options, providerFactory, api === null || api === void 0 ? void 0 : api.
|
|
141
|
+
floatingToolbar: (state, intl, providerFactory) => getToolbarConfig(state, intl, options, providerFactory, api === null || api === void 0 ? void 0 : api.decorations.actions.hoverDecoration)
|
|
139
142
|
}
|
|
140
143
|
});
|
|
141
144
|
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import { createPlugin } from './pm-plugins/main';
|
|
2
2
|
const pastePlugin = ({
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
}
|
|
6
|
-
var _api$
|
|
7
|
-
const
|
|
3
|
+
config,
|
|
4
|
+
api
|
|
5
|
+
}) => {
|
|
6
|
+
var _api$featureFlags;
|
|
7
|
+
const {
|
|
8
|
+
cardOptions,
|
|
9
|
+
sanitizePrivateContent
|
|
10
|
+
} = config !== null && config !== void 0 ? config : {};
|
|
11
|
+
const featureFlags = (api === null || api === void 0 ? void 0 : (_api$featureFlags = api.featureFlags) === null || _api$featureFlags === void 0 ? void 0 : _api$featureFlags.sharedState.currentState()) || {};
|
|
8
12
|
return {
|
|
9
13
|
name: 'paste',
|
|
10
14
|
pmPlugins() {
|
|
@@ -227,10 +227,10 @@ export const handlePasteAsPlainTextWithAnalytics = (view, event, slice) => injec
|
|
|
227
227
|
asPlain: true
|
|
228
228
|
}))(handlePasteAsPlainText(slice, event));
|
|
229
229
|
export const handlePasteIntoTaskAndDecisionWithAnalytics = (view, event, slice, type, pluginInjectionApi) => {
|
|
230
|
-
var _pluginInjectionApi$
|
|
230
|
+
var _pluginInjectionApi$c, _pluginInjectionApi$c2;
|
|
231
231
|
return injectAnalyticsPayloadBeforeCommand(createPasteAnalyticsPayloadBySelection(event, slice, {
|
|
232
232
|
type
|
|
233
|
-
}))(handlePasteIntoTaskOrDecisionOrPanel(slice, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$
|
|
233
|
+
}))(handlePasteIntoTaskOrDecisionOrPanel(slice, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$c = pluginInjectionApi.card) === null || _pluginInjectionApi$c === void 0 ? void 0 : (_pluginInjectionApi$c2 = _pluginInjectionApi$c.actions) === null || _pluginInjectionApi$c2 === void 0 ? void 0 : _pluginInjectionApi$c2.queueCardsFromChangedTr));
|
|
234
234
|
};
|
|
235
235
|
export const handlePasteIntoCaptionWithAnalytics = (view, event, slice, type) => injectAnalyticsPayloadBeforeCommand(createPasteAnalyticsPayloadBySelection(event, slice, {
|
|
236
236
|
type
|
|
@@ -242,22 +242,22 @@ export const handleMediaSingleWithAnalytics = (view, event, slice, type, editorA
|
|
|
242
242
|
type
|
|
243
243
|
}))(handleMediaSingle(INPUT_METHOD.CLIPBOARD, editorAnalyticsAPI)(slice));
|
|
244
244
|
export const handlePastePreservingMarksWithAnalytics = (view, event, slice, type, pluginInjectionApi) => {
|
|
245
|
-
var _pluginInjectionApi$
|
|
245
|
+
var _pluginInjectionApi$c3, _pluginInjectionApi$c4;
|
|
246
246
|
return injectAnalyticsPayloadBeforeCommand(createPasteAnalyticsPayloadBySelection(event, slice, {
|
|
247
247
|
type
|
|
248
|
-
}))(handlePastePreservingMarks(slice, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$
|
|
248
|
+
}))(handlePastePreservingMarks(slice, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$c3 = pluginInjectionApi.card) === null || _pluginInjectionApi$c3 === void 0 ? void 0 : (_pluginInjectionApi$c4 = _pluginInjectionApi$c3.actions) === null || _pluginInjectionApi$c4 === void 0 ? void 0 : _pluginInjectionApi$c4.queueCardsFromChangedTr));
|
|
249
249
|
};
|
|
250
250
|
export const handleMarkdownWithAnalytics = (view, event, slice, pluginInjectionApi) => {
|
|
251
|
-
var _pluginInjectionApi$
|
|
251
|
+
var _pluginInjectionApi$c5, _pluginInjectionApi$c6;
|
|
252
252
|
return injectAnalyticsPayloadBeforeCommand(createPasteAnalyticsPayloadBySelection(event, slice, {
|
|
253
253
|
type: PasteTypes.markdown
|
|
254
|
-
}))(handleMarkdown(slice, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$
|
|
254
|
+
}))(handleMarkdown(slice, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$c5 = pluginInjectionApi.card) === null || _pluginInjectionApi$c5 === void 0 ? void 0 : (_pluginInjectionApi$c6 = _pluginInjectionApi$c5.actions) === null || _pluginInjectionApi$c6 === void 0 ? void 0 : _pluginInjectionApi$c6.queueCardsFromChangedTr));
|
|
255
255
|
};
|
|
256
256
|
export const handleRichTextWithAnalytics = (view, event, slice, pluginInjectionApi) => {
|
|
257
|
-
var _pluginInjectionApi$
|
|
257
|
+
var _pluginInjectionApi$c7, _pluginInjectionApi$c8;
|
|
258
258
|
return injectAnalyticsPayloadBeforeCommand(createPasteAnalyticsPayloadBySelection(event, slice, {
|
|
259
259
|
type: PasteTypes.richText
|
|
260
|
-
}))(handleRichText(slice, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$
|
|
260
|
+
}))(handleRichText(slice, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$c7 = pluginInjectionApi.card) === null || _pluginInjectionApi$c7 === void 0 ? void 0 : (_pluginInjectionApi$c8 = _pluginInjectionApi$c7.actions) === null || _pluginInjectionApi$c8 === void 0 ? void 0 : _pluginInjectionApi$c8.queueCardsFromChangedTr));
|
|
261
261
|
};
|
|
262
262
|
function injectAnalyticsPayloadBeforeCommand(createPayloadByTransaction) {
|
|
263
263
|
return mainCommand => {
|
|
@@ -77,7 +77,7 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
|
|
|
77
77
|
}
|
|
78
78
|
},
|
|
79
79
|
handlePaste(view, rawEvent, slice) {
|
|
80
|
-
var _text, _analyticsPlugin$perf, _analyticsPlugin$perf2, _schema$nodes, _schema$nodes2, _schema$nodes3, _pluginInjectionApi$
|
|
80
|
+
var _text, _analyticsPlugin$perf, _analyticsPlugin$perf2, _schema$nodes, _schema$nodes2, _schema$nodes3, _pluginInjectionApi$a;
|
|
81
81
|
const event = rawEvent;
|
|
82
82
|
if (!event.clipboardData) {
|
|
83
83
|
return false;
|
|
@@ -177,9 +177,9 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
|
|
|
177
177
|
});
|
|
178
178
|
return tableExists;
|
|
179
179
|
});
|
|
180
|
-
if (!isPastingTextInsidePlaceholderText && !isPastingTable && !isPastingOverLayoutColumns && pluginInjectionApi !== null && pluginInjectionApi !== void 0 && pluginInjectionApi.
|
|
181
|
-
var _pluginInjectionApi$
|
|
182
|
-
tr = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$
|
|
180
|
+
if (!isPastingTextInsidePlaceholderText && !isPastingTable && !isPastingOverLayoutColumns && pluginInjectionApi !== null && pluginInjectionApi !== void 0 && pluginInjectionApi.betterTypeHistory) {
|
|
181
|
+
var _pluginInjectionApi$b;
|
|
182
|
+
tr = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$b = pluginInjectionApi.betterTypeHistory) === null || _pluginInjectionApi$b === void 0 ? void 0 : _pluginInjectionApi$b.actions.flagPasteEvent(tr);
|
|
183
183
|
}
|
|
184
184
|
addLinkMetadata(view.state.selection, tr, {
|
|
185
185
|
action: isPlainText ? ACTION.PASTED_AS_PLAIN : ACTION.PASTED,
|
|
@@ -207,14 +207,14 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
|
|
|
207
207
|
// force a "paste as plain text" action by clearing the markdownSlice.
|
|
208
208
|
markdownSlice = !((_markdownSlice = markdownSlice) !== null && _markdownSlice !== void 0 && _markdownSlice.size) ? undefined : markdownSlice;
|
|
209
209
|
if (markdownSlice) {
|
|
210
|
-
var _pluginInjectionApi$
|
|
210
|
+
var _pluginInjectionApi$c, _pluginInjectionApi$c2;
|
|
211
211
|
// linkify text prior to converting to macro
|
|
212
212
|
if (handlePasteLinkOnSelectedTextWithAnalytics(view, event, markdownSlice, PasteTypes.markdown)(state, dispatch)) {
|
|
213
213
|
return true;
|
|
214
214
|
}
|
|
215
215
|
|
|
216
216
|
// run macro autoconvert prior to other conversions
|
|
217
|
-
if (handleMacroAutoConvert(text, markdownSlice, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$
|
|
217
|
+
if (handleMacroAutoConvert(text, markdownSlice, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$c = pluginInjectionApi.card) === null || _pluginInjectionApi$c === void 0 ? void 0 : (_pluginInjectionApi$c2 = _pluginInjectionApi$c.actions) === null || _pluginInjectionApi$c2 === void 0 ? void 0 : _pluginInjectionApi$c2.queueCardsFromChangedTr, cardOptions, extensionAutoConverter)(state, dispatch, view)) {
|
|
218
218
|
// TODO: handleMacroAutoConvert dispatch twice, so we can't use the helper
|
|
219
219
|
sendPasteAnalyticsEvent(view, event, markdownSlice, {
|
|
220
220
|
type: PasteTypes.markdown
|
|
@@ -246,7 +246,7 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
|
|
|
246
246
|
if (handleCodeBlockWithAnalytics(view, event, slice, text)(state, dispatch)) {
|
|
247
247
|
return true;
|
|
248
248
|
}
|
|
249
|
-
if (handleMediaSingleWithAnalytics(view, event, slice, isPastedFile ? PasteTypes.binary : PasteTypes.richText, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$
|
|
249
|
+
if (handleMediaSingleWithAnalytics(view, event, slice, isPastedFile ? PasteTypes.binary : PasteTypes.richText, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions)(state, dispatch, view)) {
|
|
250
250
|
return true;
|
|
251
251
|
}
|
|
252
252
|
if (handleSelectedTableWithAnalytics(view, event, slice)(state, dispatch)) {
|
|
@@ -281,7 +281,7 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
|
|
|
281
281
|
|
|
282
282
|
// finally, handle rich-text copy-paste
|
|
283
283
|
if (isRichText) {
|
|
284
|
-
var _pluginInjectionApi$
|
|
284
|
+
var _pluginInjectionApi$c3, _pluginInjectionApi$c4, _pluginInjectionApi$l;
|
|
285
285
|
// linkify the text where possible
|
|
286
286
|
slice = linkifyContent(state.schema)(slice);
|
|
287
287
|
if (handlePasteLinkOnSelectedTextWithAnalytics(view, event, slice, PasteTypes.richText)(state, dispatch)) {
|
|
@@ -289,7 +289,7 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
|
|
|
289
289
|
}
|
|
290
290
|
|
|
291
291
|
// run macro autoconvert prior to other conversions
|
|
292
|
-
if (handleMacroAutoConvert(text, slice, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$
|
|
292
|
+
if (handleMacroAutoConvert(text, slice, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$c3 = pluginInjectionApi.card) === null || _pluginInjectionApi$c3 === void 0 ? void 0 : (_pluginInjectionApi$c4 = _pluginInjectionApi$c3.actions) === null || _pluginInjectionApi$c4 === void 0 ? void 0 : _pluginInjectionApi$c4.queueCardsFromChangedTr, cardOptions, extensionAutoConverter)(state, dispatch, view)) {
|
|
293
293
|
// TODO: handleMacroAutoConvert dispatch twice, so we can't use the helper
|
|
294
294
|
sendPasteAnalyticsEvent(view, event, slice, {
|
|
295
295
|
type: PasteTypes.richText
|
|
@@ -344,7 +344,7 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
|
|
|
344
344
|
if (handlePasteIntoCaptionWithAnalytics(view, event, slice, PasteTypes.richText)(state, dispatch)) {
|
|
345
345
|
return true;
|
|
346
346
|
}
|
|
347
|
-
if (handlePastePanelOrDecisionIntoListWithAnalytics(view, event, slice, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$
|
|
347
|
+
if (handlePastePanelOrDecisionIntoListWithAnalytics(view, event, slice, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$l = pluginInjectionApi.list) === null || _pluginInjectionApi$l === void 0 ? void 0 : _pluginInjectionApi$l.actions.findRootParentListNode)(state, dispatch)) {
|
|
348
348
|
return true;
|
|
349
349
|
}
|
|
350
350
|
if (featureFlags !== null && featureFlags !== void 0 && featureFlags.restartNumberedLists && handlePasteNonNestableBlockNodesIntoListWithAnalytics(view, event, slice)(state, dispatch)) {
|
|
@@ -74,13 +74,13 @@ export function createPlugin(defaultPlaceholderText, bracketPlaceholderText, api
|
|
|
74
74
|
key: pluginKey,
|
|
75
75
|
state: {
|
|
76
76
|
init: (_, state) => {
|
|
77
|
-
var _api$
|
|
78
|
-
return createPlaceHolderStateFrom(Boolean(api === null || api === void 0 ? void 0 : (_api$
|
|
77
|
+
var _api$focus, _api$focus$sharedStat;
|
|
78
|
+
return createPlaceHolderStateFrom(Boolean(api === null || api === void 0 ? void 0 : (_api$focus = api.focus) === null || _api$focus === void 0 ? void 0 : (_api$focus$sharedStat = _api$focus.sharedState.currentState()) === null || _api$focus$sharedStat === void 0 ? void 0 : _api$focus$sharedStat.hasFocus), state, defaultPlaceholderText, bracketPlaceholderText);
|
|
79
79
|
},
|
|
80
80
|
apply: (tr, _oldPluginState, _oldEditorState, newEditorState) => {
|
|
81
|
-
var _api$
|
|
81
|
+
var _api$focus2, _api$focus2$sharedSta;
|
|
82
82
|
const meta = tr.getMeta(pluginKey);
|
|
83
|
-
const isEditorFocused = Boolean(api === null || api === void 0 ? void 0 : (_api$
|
|
83
|
+
const isEditorFocused = Boolean(api === null || api === void 0 ? void 0 : (_api$focus2 = api.focus) === null || _api$focus2 === void 0 ? void 0 : (_api$focus2$sharedSta = _api$focus2.sharedState.currentState()) === null || _api$focus2$sharedSta === void 0 ? void 0 : _api$focus2$sharedSta.hasFocus);
|
|
84
84
|
if (meta) {
|
|
85
85
|
if (meta.removePlaceholder) {
|
|
86
86
|
return emptyPlaceholder;
|
|
@@ -94,13 +94,13 @@ export function createPlugin(defaultPlaceholderText, bracketPlaceholderText, api
|
|
|
94
94
|
},
|
|
95
95
|
props: {
|
|
96
96
|
decorations(editorState) {
|
|
97
|
-
var _api$
|
|
97
|
+
var _api$composition;
|
|
98
98
|
const {
|
|
99
99
|
hasPlaceholder,
|
|
100
100
|
placeholderText,
|
|
101
101
|
pos
|
|
102
102
|
} = getPlaceholderState(editorState);
|
|
103
|
-
const compositionPluginState = api === null || api === void 0 ? void 0 : (_api$
|
|
103
|
+
const compositionPluginState = api === null || api === void 0 ? void 0 : (_api$composition = api.composition) === null || _api$composition === void 0 ? void 0 : _api$composition.sharedState.currentState();
|
|
104
104
|
if (hasPlaceholder && placeholderText && pos !== undefined && !(compositionPluginState !== null && compositionPluginState !== void 0 && compositionPluginState.isComposing)) {
|
|
105
105
|
return createPlaceholderDecoration(editorState, placeholderText, pos);
|
|
106
106
|
}
|
|
@@ -109,7 +109,10 @@ export function createPlugin(defaultPlaceholderText, bracketPlaceholderText, api
|
|
|
109
109
|
}
|
|
110
110
|
});
|
|
111
111
|
}
|
|
112
|
-
const placeholderPlugin = (
|
|
112
|
+
const placeholderPlugin = ({
|
|
113
|
+
config: options,
|
|
114
|
+
api
|
|
115
|
+
}) => ({
|
|
113
116
|
name: 'placeholder',
|
|
114
117
|
pmPlugins() {
|
|
115
118
|
return [{
|
|
@@ -124,7 +124,9 @@ export function createPlugin(dispatch, options) {
|
|
|
124
124
|
}
|
|
125
125
|
});
|
|
126
126
|
}
|
|
127
|
-
const basePlaceholderTextPlugin =
|
|
127
|
+
const basePlaceholderTextPlugin = ({
|
|
128
|
+
config: options
|
|
129
|
+
}) => ({
|
|
128
130
|
name: 'placeholderText',
|
|
129
131
|
nodes() {
|
|
130
132
|
return [{
|
|
@@ -192,12 +194,12 @@ const decorateWithPluginOptions = (plugin, options, api) => {
|
|
|
192
194
|
label: ""
|
|
193
195
|
}),
|
|
194
196
|
action(insert, state) {
|
|
195
|
-
var _api$
|
|
197
|
+
var _api$analytics;
|
|
196
198
|
const tr = state.tr;
|
|
197
199
|
tr.setMeta(pluginKey, {
|
|
198
200
|
showInsertPanelAt: tr.selection.anchor
|
|
199
201
|
});
|
|
200
|
-
api === null || api === void 0 ? void 0 : (_api$
|
|
202
|
+
api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions.attachAnalyticsEvent({
|
|
201
203
|
action: ACTION.INSERTED,
|
|
202
204
|
actionSubject: ACTION_SUBJECT.DOCUMENT,
|
|
203
205
|
actionSubjectId: ACTION_SUBJECT_ID.PLACEHOLDER_TEXT,
|
|
@@ -212,5 +214,11 @@ const decorateWithPluginOptions = (plugin, options, api) => {
|
|
|
212
214
|
};
|
|
213
215
|
return plugin;
|
|
214
216
|
};
|
|
215
|
-
const placeholderTextPlugin = (
|
|
217
|
+
const placeholderTextPlugin = ({
|
|
218
|
+
config: options = {},
|
|
219
|
+
api
|
|
220
|
+
}) => decorateWithPluginOptions(basePlaceholderTextPlugin({
|
|
221
|
+
config: options,
|
|
222
|
+
api
|
|
223
|
+
}), options, api);
|
|
216
224
|
export default placeholderTextPlugin;
|