@atlaskit/editor-plugin-media 8.2.1 → 8.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +21 -0
- package/dist/cjs/mediaPlugin.js +28 -8
- package/dist/cjs/nodeviews/mediaNodeView/index.js +4 -1
- package/dist/cjs/nodeviews/mediaNodeView/media.js +10 -3
- package/dist/cjs/nodeviews/mediaSingleNext.js +7 -5
- package/dist/cjs/pm-plugins/alt-text/ui/AltTextEdit.js +6 -6
- package/dist/cjs/pm-plugins/pixel-resizing/ui/index.js +4 -1
- package/dist/cjs/pm-plugins/pixel-resizing/ui/pixel-entry.js +3 -3
- package/dist/cjs/ui/toolbar/alt-text.js +1 -2
- package/dist/cjs/ui/toolbar/index.js +2 -3
- package/dist/cjs/ui/toolbar/linking.js +2 -3
- package/dist/cjs/ui/toolbar/mediaInline.js +1 -2
- package/dist/es2019/mediaPlugin.js +28 -8
- package/dist/es2019/nodeviews/mediaNodeView/index.js +6 -1
- package/dist/es2019/nodeviews/mediaNodeView/media.js +8 -3
- package/dist/es2019/nodeviews/mediaSingleNext.js +3 -1
- package/dist/es2019/pm-plugins/alt-text/ui/AltTextEdit.js +6 -6
- package/dist/es2019/pm-plugins/pixel-resizing/ui/index.js +4 -1
- package/dist/es2019/pm-plugins/pixel-resizing/ui/pixel-entry.js +3 -3
- package/dist/es2019/ui/toolbar/alt-text.js +1 -2
- package/dist/es2019/ui/toolbar/index.js +2 -3
- package/dist/es2019/ui/toolbar/linking.js +2 -3
- package/dist/es2019/ui/toolbar/mediaInline.js +1 -2
- package/dist/esm/mediaPlugin.js +28 -8
- package/dist/esm/nodeviews/mediaNodeView/index.js +4 -1
- package/dist/esm/nodeviews/mediaNodeView/media.js +10 -3
- package/dist/esm/nodeviews/mediaSingleNext.js +3 -1
- package/dist/esm/pm-plugins/alt-text/ui/AltTextEdit.js +6 -6
- package/dist/esm/pm-plugins/pixel-resizing/ui/index.js +4 -1
- package/dist/esm/pm-plugins/pixel-resizing/ui/pixel-entry.js +3 -3
- package/dist/esm/ui/toolbar/alt-text.js +1 -2
- package/dist/esm/ui/toolbar/index.js +2 -3
- package/dist/esm/ui/toolbar/linking.js +2 -3
- package/dist/esm/ui/toolbar/mediaInline.js +1 -2
- package/dist/types/mediaPluginType.d.ts +5 -0
- package/dist/types/nodeviews/mediaNodeView/media.d.ts +4 -0
- package/dist/types/pm-plugins/pixel-resizing/ui/pixel-entry.d.ts +1 -1
- package/dist/types/pm-plugins/pixel-resizing/ui/types.d.ts +4 -0
- package/dist/types-ts4.5/mediaPluginType.d.ts +5 -0
- package/dist/types-ts4.5/nodeviews/mediaNodeView/media.d.ts +4 -0
- package/dist/types-ts4.5/pm-plugins/pixel-resizing/ui/pixel-entry.d.ts +1 -1
- package/dist/types-ts4.5/pm-plugins/pixel-resizing/ui/types.d.ts +4 -0
- package/package.json +4 -4
|
@@ -19,7 +19,6 @@ import { relativeFontSizeToBase16 } from '@atlaskit/editor-shared-styles';
|
|
|
19
19
|
import ChevronLeftLargeIcon from '@atlaskit/icon/core/migration/chevron-left--chevron-left-large';
|
|
20
20
|
import CrossCircleIcon from '@atlaskit/icon/core/migration/cross-circle';
|
|
21
21
|
import { N200, N30, N80, R400 } from '@atlaskit/theme/colors';
|
|
22
|
-
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
23
22
|
import { closeMediaAltTextMenu, closeMediaAltTextMenuAndSave } from '../commands';
|
|
24
23
|
export const MAX_ALT_TEXT_LENGTH = 510; // double tweet length
|
|
25
24
|
|
|
@@ -123,9 +122,10 @@ export class AltTextEditComponent extends React.Component {
|
|
|
123
122
|
});
|
|
124
123
|
});
|
|
125
124
|
_defineProperty(this, "handleOnBlur", e => {
|
|
125
|
+
var _this$props$areAnyNew;
|
|
126
126
|
// prevent other selection transaction gets triggered
|
|
127
127
|
e.stopPropagation();
|
|
128
|
-
if (
|
|
128
|
+
if ((_this$props$areAnyNew = this.props.areAnyNewToolbarFlagsEnabled) !== null && _this$props$areAnyNew !== void 0 ? _this$props$areAnyNew : areToolbarFlagsEnabled()) {
|
|
129
129
|
this.closeMediaAltTextMenuAndSetFocus();
|
|
130
130
|
} else {
|
|
131
131
|
this.closeMediaAltTextMenu();
|
|
@@ -165,7 +165,7 @@ export class AltTextEditComponent extends React.Component {
|
|
|
165
165
|
return [];
|
|
166
166
|
}
|
|
167
167
|
render() {
|
|
168
|
-
var _this$props$
|
|
168
|
+
var _this$props$areAnyNew2, _this$props$areAnyNew3, _this$props$areAnyNew4;
|
|
169
169
|
const {
|
|
170
170
|
intl: {
|
|
171
171
|
formatMessage
|
|
@@ -188,7 +188,7 @@ export class AltTextEditComponent extends React.Component {
|
|
|
188
188
|
}, error);
|
|
189
189
|
});
|
|
190
190
|
const hasErrors = !!errorsList.length;
|
|
191
|
-
const onSubmit =
|
|
191
|
+
const onSubmit = ((_this$props$areAnyNew2 = this.props.areAnyNewToolbarFlagsEnabled) !== null && _this$props$areAnyNew2 !== void 0 ? _this$props$areAnyNew2 : areToolbarFlagsEnabled()) ? this.closeMediaAltTextMenuAndSetFocus : this.closeMediaAltTextMenu;
|
|
192
192
|
return jsx("div", {
|
|
193
193
|
css: containerStyles
|
|
194
194
|
}, jsx("section", {
|
|
@@ -203,7 +203,7 @@ export class AltTextEditComponent extends React.Component {
|
|
|
203
203
|
}),
|
|
204
204
|
tooltipContent: backButtonMessageComponent,
|
|
205
205
|
onClick: this.closeMediaAltTextMenu,
|
|
206
|
-
areAnyNewToolbarFlagsEnabled: (_this$props$
|
|
206
|
+
areAnyNewToolbarFlagsEnabled: (_this$props$areAnyNew3 = this.props.areAnyNewToolbarFlagsEnabled) !== null && _this$props$areAnyNew3 !== void 0 ? _this$props$areAnyNew3 : areToolbarFlagsEnabled()
|
|
207
207
|
})), jsx(PanelTextInput, {
|
|
208
208
|
testId: "alt-text-input",
|
|
209
209
|
ariaLabel: formatMessage(messages.placeholder),
|
|
@@ -230,7 +230,7 @@ export class AltTextEditComponent extends React.Component {
|
|
|
230
230
|
})),
|
|
231
231
|
tooltipContent: formatMessage(messages.clear),
|
|
232
232
|
onClick: this.handleClearText,
|
|
233
|
-
areAnyNewToolbarFlagsEnabled: (_this$props$
|
|
233
|
+
areAnyNewToolbarFlagsEnabled: (_this$props$areAnyNew4 = this.props.areAnyNewToolbarFlagsEnabled) !== null && _this$props$areAnyNew4 !== void 0 ? _this$props$areAnyNew4 : areToolbarFlagsEnabled()
|
|
234
234
|
}))), hasErrors && jsx("section", {
|
|
235
235
|
id: "errors-list",
|
|
236
236
|
ref: this.errorsListRef,
|
|
@@ -8,6 +8,7 @@ import { useCallback } from 'react';
|
|
|
8
8
|
import { jsx } from '@emotion/react';
|
|
9
9
|
import { pixelEntryMessages as messages } from '@atlaskit/editor-common/media';
|
|
10
10
|
import { calcMinWidth, DEFAULT_IMAGE_HEIGHT, DEFAULT_IMAGE_WIDTH } from '@atlaskit/editor-common/media-single';
|
|
11
|
+
import { areToolbarFlagsEnabled } from '@atlaskit/editor-common/toolbar-flag-check';
|
|
11
12
|
import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
|
|
12
13
|
import { hasParentNode } from '@atlaskit/editor-prosemirror/utils';
|
|
13
14
|
import { akEditorDefaultLayoutWidth, akEditorFullWidthLayoutWidth } from '@atlaskit/editor-shared-styles';
|
|
@@ -68,6 +69,7 @@ export const PixelEntry = ({
|
|
|
68
69
|
mediaWidth || DEFAULT_IMAGE_WIDTH);
|
|
69
70
|
const pixelWidth = hasPixelType ? mediaSingleWidth : pixelWidthFromElement;
|
|
70
71
|
const forceFocusSelector = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$f = pluginInjectionApi.floatingToolbar) === null || _pluginInjectionApi$f === void 0 ? void 0 : (_pluginInjectionApi$f2 = _pluginInjectionApi$f.actions) === null || _pluginInjectionApi$f2 === void 0 ? void 0 : _pluginInjectionApi$f2.forceFocusSelector;
|
|
72
|
+
const areAnyNewToolbarFlagsEnabled = areToolbarFlagsEnabled(Boolean(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.toolbar));
|
|
71
73
|
return jsx(PixelEntryComponent, {
|
|
72
74
|
intl: intl,
|
|
73
75
|
width: pluginState.isResizing ? pluginState.resizingWidth : pixelWidth,
|
|
@@ -120,7 +122,8 @@ export const PixelEntry = ({
|
|
|
120
122
|
}
|
|
121
123
|
},
|
|
122
124
|
isViewMode: pluginState.isResizing,
|
|
123
|
-
triggerButtonSelector: triggerButtonSelector
|
|
125
|
+
triggerButtonSelector: triggerButtonSelector,
|
|
126
|
+
areAnyNewToolbarFlagsEnabled: areAnyNewToolbarFlagsEnabled
|
|
124
127
|
});
|
|
125
128
|
};
|
|
126
129
|
export const FullWidthDisplay = ({
|
|
@@ -16,7 +16,6 @@ import CrossIcon from '@atlaskit/icon/core/cross';
|
|
|
16
16
|
// eslint-disable-next-line @atlaskit/design-system/no-emotion-primitives -- to be migrated to @atlaskit/primitives/compiled – go/akcss
|
|
17
17
|
import { Inline, Box, Text, xcss } from '@atlaskit/primitives';
|
|
18
18
|
import Textfield from '@atlaskit/textfield';
|
|
19
|
-
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
20
19
|
import Tooltip from '@atlaskit/tooltip';
|
|
21
20
|
import { PIXEL_RESIZING_TOOLBAR_WIDTH, PIXEL_VIEW_MODE_TOOLBAR_WIDTH, PIXELENTRY_MIGRATION_BUTTON_TESTID } from './constants';
|
|
22
21
|
import { pixelEntryForm, pixelEntryHiddenSubmit, pixelSizingHeightInput, pixelSizingInput, pixelSizingWidthInput, pixelSizingWrapper } from './styles';
|
|
@@ -38,7 +37,8 @@ export const PixelEntryComponent = ({
|
|
|
38
37
|
showMigration,
|
|
39
38
|
onMigrate,
|
|
40
39
|
onCloseAndSave,
|
|
41
|
-
isViewMode
|
|
40
|
+
isViewMode,
|
|
41
|
+
areAnyNewToolbarFlagsEnabled
|
|
42
42
|
}) => {
|
|
43
43
|
const ratioWidth = useMemo(() => {
|
|
44
44
|
return mediaHeight / mediaWidth;
|
|
@@ -152,7 +152,7 @@ export const PixelEntryComponent = ({
|
|
|
152
152
|
testId: PIXELENTRY_MIGRATION_BUTTON_TESTID
|
|
153
153
|
}, formatMessage(messages.migrationButtonText)));
|
|
154
154
|
}
|
|
155
|
-
if (
|
|
155
|
+
if (areAnyNewToolbarFlagsEnabled) {
|
|
156
156
|
return jsx(PixelEntryComponentNext, {
|
|
157
157
|
maxWidth: maxWidth,
|
|
158
158
|
formatMessage: formatMessage,
|
|
@@ -5,7 +5,6 @@ import { MediaSharedClassNames as ClassNames } from '@atlaskit/editor-common/sty
|
|
|
5
5
|
import { RECENT_SEARCH_WIDTH_IN_PX as CONTAINER_WIDTH_IN_PX } from '@atlaskit/editor-common/ui';
|
|
6
6
|
import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
|
|
7
7
|
import ImageAltTextIcon from '@atlaskit/icon-lab/core/image-alt-text';
|
|
8
|
-
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
9
8
|
import { openMediaAltTextMenu } from '../../pm-plugins/alt-text/commands';
|
|
10
9
|
import AltTextEdit from '../../pm-plugins/alt-text/ui/AltTextEdit';
|
|
11
10
|
import { isImage } from '../../pm-plugins/utils/is-type';
|
|
@@ -54,7 +53,7 @@ const altTextEditComponent = options => {
|
|
|
54
53
|
},
|
|
55
54
|
dispatch
|
|
56
55
|
} = view;
|
|
57
|
-
const elementSelector = options !== null && options !== void 0 && options.triggerButtonSelector &&
|
|
56
|
+
const elementSelector = options !== null && options !== void 0 && options.triggerButtonSelector && options !== null && options !== void 0 && options.areAnyNewToolbarFlagsEnabled ? options.triggerButtonSelector : `[data-testid="${testId}"]`;
|
|
58
57
|
const newTr = options === null || options === void 0 ? void 0 : (_options$forceFocusSe = options.forceFocusSelector) === null || _options$forceFocusSe === void 0 ? void 0 : _options$forceFocusSe.call(options, elementSelector)(tr);
|
|
59
58
|
if (newTr) {
|
|
60
59
|
dispatch(newTr);
|
|
@@ -21,7 +21,6 @@ import { mediaFilmstripItemDOMSelector } from '@atlaskit/media-filmstrip';
|
|
|
21
21
|
import { messages } from '@atlaskit/media-ui';
|
|
22
22
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
23
23
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
24
|
-
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
25
24
|
import { MediaSingleNodeSelector } from '../../nodeviews/styles';
|
|
26
25
|
import { getPluginState as getMediaAltTextPluginState } from '../../pm-plugins/alt-text';
|
|
27
26
|
import { showLinkingToolbar } from '../../pm-plugins/commands/linking';
|
|
@@ -756,7 +755,7 @@ export const floatingToolbar = (state, intl, options = {}, pluginInjectionApi) =
|
|
|
756
755
|
|
|
757
756
|
// testId is required to show focus on trigger button on ESC key press
|
|
758
757
|
// see hideOnEsc in platform/packages/editor/editor-plugin-floating-toolbar/src/ui/Dropdown.tsx
|
|
759
|
-
const overflowButtonSelector =
|
|
758
|
+
const overflowButtonSelector = areToolbarFlagsEnabled(Boolean(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.toolbar)) ? `[data-testid="${overflowDropdwonBtnTriggerTestId}"]` : undefined;
|
|
760
759
|
if (allowAltTextOnImages) {
|
|
761
760
|
const mediaAltTextPluginState = getMediaAltTextPluginState(state);
|
|
762
761
|
if (mediaAltTextPluginState.isAltTextEditorOpen) {
|
|
@@ -773,7 +772,7 @@ export const floatingToolbar = (state, intl, options = {}, pluginInjectionApi) =
|
|
|
773
772
|
selection
|
|
774
773
|
} = state;
|
|
775
774
|
const isWithinTable = hasParentNodeOfType([state.schema.nodes.table])(selection);
|
|
776
|
-
if (allowAdvancedToolBarOptions && allowResizing && (!isWithinTable || allowResizingInTables === true) && allowPixelResizing &&
|
|
775
|
+
if (allowAdvancedToolBarOptions && allowResizing && (!isWithinTable || allowResizingInTables === true) && allowPixelResizing && areToolbarFlagsEnabled(Boolean(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.toolbar))) {
|
|
777
776
|
const mediaPixelResizingPluginState = getMediaPixelResizingPluginState(state);
|
|
778
777
|
if (mediaPixelResizingPluginState !== null && mediaPixelResizingPluginState !== void 0 && mediaPixelResizingPluginState.isPixelEditorOpen) {
|
|
779
778
|
return getPixelResizingToolbar(baseToolbar, {
|
|
@@ -6,7 +6,6 @@ import { areToolbarFlagsEnabled } from '@atlaskit/editor-common/toolbar-flag-che
|
|
|
6
6
|
import { RECENT_SEARCH_HEIGHT_IN_PX, RECENT_SEARCH_WIDTH_IN_PX } from '@atlaskit/editor-common/ui';
|
|
7
7
|
import LinkIcon from '@atlaskit/icon/core/link';
|
|
8
8
|
import LinkExternalIcon from '@atlaskit/icon/core/link-external';
|
|
9
|
-
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
10
9
|
import { hideLinkingToolbar, setUrlToMedia, showLinkingToolbar, unlink } from '../../pm-plugins/commands/linking';
|
|
11
10
|
import { getMediaLinkingState } from '../../pm-plugins/linking';
|
|
12
11
|
import { currentMediaInlineNode, currentMediaNode } from '../../pm-plugins/utils/current-media-node';
|
|
@@ -60,7 +59,7 @@ export const getLinkingToolbar = (toolbarBaseConfig, mediaLinkingState, state, i
|
|
|
60
59
|
return null;
|
|
61
60
|
}
|
|
62
61
|
const setFocusOnFloatingToolbar = setFocus => {
|
|
63
|
-
if (setFocus &&
|
|
62
|
+
if (setFocus && areToolbarFlagsEnabled(Boolean(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.toolbar))) {
|
|
64
63
|
var _pluginInjectionApi$f, _pluginInjectionApi$f2;
|
|
65
64
|
const {
|
|
66
65
|
state: {
|
|
@@ -103,7 +102,7 @@ export const getLinkingToolbar = (toolbarBaseConfig, mediaLinkingState, state, i
|
|
|
103
102
|
},
|
|
104
103
|
dispatch
|
|
105
104
|
} = view;
|
|
106
|
-
const selector =
|
|
105
|
+
const selector = areToolbarFlagsEnabled(Boolean(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.toolbar)) ? FORCE_FOCUS_SELECTOR_EDITOR_CONTROLS : FORCE_FOCUS_SELECTOR;
|
|
107
106
|
pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$f3 = pluginInjectionApi.floatingToolbar) === null || _pluginInjectionApi$f3 === void 0 ? void 0 : (_pluginInjectionApi$f4 = _pluginInjectionApi$f3.actions) === null || _pluginInjectionApi$f4 === void 0 ? void 0 : _pluginInjectionApi$f4.forceFocusSelector(selector)(tr);
|
|
108
107
|
dispatch(tr);
|
|
109
108
|
},
|
|
@@ -11,7 +11,6 @@ import MaximizeIcon from '@atlaskit/icon/core/maximize';
|
|
|
11
11
|
import DownloadIcon from '@atlaskit/icon/core/migration/download';
|
|
12
12
|
import SmartLinkCardIcon from '@atlaskit/icon/core/smart-link-card';
|
|
13
13
|
import { messages } from '@atlaskit/media-ui';
|
|
14
|
-
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
15
14
|
import { showLinkingToolbar } from '../../pm-plugins/commands/linking';
|
|
16
15
|
import { getMediaLinkingState } from '../../pm-plugins/linking';
|
|
17
16
|
import { currentMediaOrInlineNodeBorderMark } from '../../pm-plugins/utils/current-media-node';
|
|
@@ -175,7 +174,7 @@ const getMediaInlineImageToolbar = (state, intl, mediaPluginState, hoverDecorati
|
|
|
175
174
|
const mediaSingleTitle = intl.formatMessage(mediaAndEmbedToolbarMessages.changeToMediaSingle);
|
|
176
175
|
const widthPluginState = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$w = pluginInjectionApi.width) === null || _pluginInjectionApi$w === void 0 ? void 0 : _pluginInjectionApi$w.sharedState.currentState();
|
|
177
176
|
const inlineImageItems = [];
|
|
178
|
-
const isEditorControlsEnabled =
|
|
177
|
+
const isEditorControlsEnabled = areToolbarFlagsEnabled(Boolean(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.toolbar));
|
|
179
178
|
const {
|
|
180
179
|
isViewOnly,
|
|
181
180
|
allowAltTextOnImages,
|
package/dist/esm/mediaPlugin.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import React, { useMemo } from 'react';
|
|
2
|
+
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
|
|
2
3
|
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
3
4
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
5
|
+
import { areToolbarFlagsEnabled } from '@atlaskit/editor-common/toolbar-flag-check';
|
|
4
6
|
import { NodeSelection, PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
5
7
|
import { getMediaFeatureFlag } from '@atlaskit/media-common';
|
|
6
8
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
7
|
-
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
8
9
|
import { lazyMediaView } from './nodeviews/lazy-media';
|
|
9
10
|
import { lazyMediaGroupView } from './nodeviews/lazy-media-group';
|
|
10
11
|
import { lazyMediaInlineView } from './nodeviews/lazy-media-inline';
|
|
@@ -99,6 +100,7 @@ export var mediaPlugin = function mediaPlugin(_ref3) {
|
|
|
99
100
|
options = _ref3$config === void 0 ? {} : _ref3$config,
|
|
100
101
|
api = _ref3.api;
|
|
101
102
|
var previousMediaProvider;
|
|
103
|
+
var mediaErrorLocalIds = new Set();
|
|
102
104
|
return {
|
|
103
105
|
name: 'media',
|
|
104
106
|
getSharedState: function getSharedState(editorState) {
|
|
@@ -108,9 +110,27 @@ export var mediaPlugin = function mediaPlugin(_ref3) {
|
|
|
108
110
|
return stateKey.getState(editorState) || null;
|
|
109
111
|
},
|
|
110
112
|
actions: {
|
|
111
|
-
|
|
113
|
+
handleMediaNodeRenderError: function handleMediaNodeRenderError(node, reason) {
|
|
112
114
|
var _api$analytics;
|
|
113
|
-
|
|
115
|
+
// Only fire the errored event once per media node
|
|
116
|
+
if (mediaErrorLocalIds.has(node.attrs.localId)) {
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
mediaErrorLocalIds.add(node.attrs.localId);
|
|
120
|
+
api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 || _api$analytics.actions.fireAnalyticsEvent({
|
|
121
|
+
action: ACTION.ERRORED,
|
|
122
|
+
actionSubject: ACTION_SUBJECT.EDITOR,
|
|
123
|
+
actionSubjectId: ACTION_SUBJECT_ID.MEDIA,
|
|
124
|
+
eventType: EVENT_TYPE.UI,
|
|
125
|
+
attributes: {
|
|
126
|
+
reason: reason,
|
|
127
|
+
external: node.attrs.__external
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
},
|
|
131
|
+
insertMediaAsMediaSingle: function insertMediaAsMediaSingle(view, node, inputMethod, insertMediaVia) {
|
|
132
|
+
var _api$analytics2;
|
|
133
|
+
return _insertMediaAsMediaSingle(view, node, inputMethod, api === null || api === void 0 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions, insertMediaVia, options === null || options === void 0 ? void 0 : options.allowPixelResizing);
|
|
114
134
|
},
|
|
115
135
|
setProvider: function setProvider(provider) {
|
|
116
136
|
var _api$core$actions$exe;
|
|
@@ -205,9 +225,9 @@ export var mediaPlugin = function mediaPlugin(_ref3) {
|
|
|
205
225
|
}, {
|
|
206
226
|
name: 'mediaKeymap',
|
|
207
227
|
plugin: function plugin(_ref7) {
|
|
208
|
-
var _api$
|
|
228
|
+
var _api$analytics3, _api$selection;
|
|
209
229
|
var getIntl = _ref7.getIntl;
|
|
210
|
-
return keymapPlugin(options, api === null || api === void 0 || (_api$
|
|
230
|
+
return keymapPlugin(options, api === null || api === void 0 || (_api$analytics3 = api.analytics) === null || _api$analytics3 === void 0 ? void 0 : _api$analytics3.actions, api === null || api === void 0 || (_api$selection = api.selection) === null || _api$selection === void 0 ? void 0 : _api$selection.actions, api === null || api === void 0 ? void 0 : api.width, getIntl);
|
|
211
231
|
}
|
|
212
232
|
}];
|
|
213
233
|
if (options && options.allowMediaSingle) {
|
|
@@ -227,9 +247,9 @@ export var mediaPlugin = function mediaPlugin(_ref3) {
|
|
|
227
247
|
pmPlugins.push({
|
|
228
248
|
name: 'mediaAltTextKeymap',
|
|
229
249
|
plugin: function plugin(_ref9) {
|
|
230
|
-
var _api$
|
|
250
|
+
var _api$analytics4;
|
|
231
251
|
var schema = _ref9.schema;
|
|
232
|
-
return keymapMediaAltTextPlugin(schema, api === null || api === void 0 || (_api$
|
|
252
|
+
return keymapMediaAltTextPlugin(schema, api === null || api === void 0 || (_api$analytics4 = api.analytics) === null || _api$analytics4 === void 0 ? void 0 : _api$analytics4.actions);
|
|
233
253
|
}
|
|
234
254
|
});
|
|
235
255
|
}
|
|
@@ -249,7 +269,7 @@ export var mediaPlugin = function mediaPlugin(_ref3) {
|
|
|
249
269
|
}
|
|
250
270
|
});
|
|
251
271
|
}
|
|
252
|
-
if (options && options.allowAdvancedToolBarOptions && options.allowResizing &&
|
|
272
|
+
if (options && options.allowAdvancedToolBarOptions && options.allowResizing && areToolbarFlagsEnabled(Boolean(api === null || api === void 0 ? void 0 : api.toolbar)) && options.allowPixelResizing) {
|
|
253
273
|
pmPlugins.push({
|
|
254
274
|
name: 'mediaPixelResizing',
|
|
255
275
|
plugin: createMediaPixelResizingPlugin
|
|
@@ -103,7 +103,9 @@ var MediaNodeView = /*#__PURE__*/function (_SelectionBasedNodeVi) {
|
|
|
103
103
|
height: height
|
|
104
104
|
};
|
|
105
105
|
var isSelectedAndInteracted = _this.nodeInsideSelection() && interactionState !== 'hasNotHadInteraction';
|
|
106
|
+
var pluginInjectionApi = _this.reactComponentProps.pluginInjectionApi;
|
|
106
107
|
return /*#__PURE__*/React.createElement(MediaNode, {
|
|
108
|
+
api: pluginInjectionApi,
|
|
107
109
|
view: _this.view,
|
|
108
110
|
node: _this.node,
|
|
109
111
|
getPos: getPos,
|
|
@@ -115,7 +117,8 @@ var MediaNodeView = /*#__PURE__*/function (_SelectionBasedNodeVi) {
|
|
|
115
117
|
contextIdentifierProvider: contextIdentifierProvider,
|
|
116
118
|
mediaOptions: mediaOptions,
|
|
117
119
|
onExternalImageLoaded: _this.onExternalImageLoaded,
|
|
118
|
-
isViewOnly: ((_this$reactComponentP = _this.reactComponentProps.pluginInjectionApi) === null || _this$reactComponentP === void 0 || (_this$reactComponentP = _this$reactComponentP.editorViewMode) === null || _this$reactComponentP === void 0 || (_this$reactComponentP = _this$reactComponentP.sharedState.currentState()) === null || _this$reactComponentP === void 0 ? void 0 : _this$reactComponentP.mode) === 'view'
|
|
120
|
+
isViewOnly: ((_this$reactComponentP = _this.reactComponentProps.pluginInjectionApi) === null || _this$reactComponentP === void 0 || (_this$reactComponentP = _this$reactComponentP.editorViewMode) === null || _this$reactComponentP === void 0 || (_this$reactComponentP = _this$reactComponentP.sharedState.currentState()) === null || _this$reactComponentP === void 0 ? void 0 : _this$reactComponentP.mode) === 'view',
|
|
121
|
+
pluginInjectionApi: _this.reactComponentProps.pluginInjectionApi
|
|
119
122
|
});
|
|
120
123
|
};
|
|
121
124
|
});
|
|
@@ -12,10 +12,12 @@ import React, { Component } from 'react';
|
|
|
12
12
|
import { bind } from 'bind-event-listener';
|
|
13
13
|
import { MEDIA_CONTEXT } from '@atlaskit/analytics-namespaced-context';
|
|
14
14
|
import { AnalyticsContext } from '@atlaskit/analytics-next';
|
|
15
|
+
import { areToolbarFlagsEnabled } from '@atlaskit/editor-common/toolbar-flag-check';
|
|
15
16
|
import { setNodeSelection, setTextSelection, withImageLoader } from '@atlaskit/editor-common/utils';
|
|
16
17
|
import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
|
|
17
18
|
import { Card, CardLoading } from '@atlaskit/media-card';
|
|
18
19
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
20
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
19
21
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
20
22
|
import { stateKey as mediaStateKey } from '../../pm-plugins/plugin-key';
|
|
21
23
|
import { MediaCardWrapper } from '../styles';
|
|
@@ -56,13 +58,14 @@ export var MediaNode = /*#__PURE__*/function (_Component) {
|
|
|
56
58
|
}, _callee);
|
|
57
59
|
})));
|
|
58
60
|
_defineProperty(_this, "selectMediaSingleFromCard", function (_ref2) {
|
|
61
|
+
var _this$props$pluginInj;
|
|
59
62
|
var event = _ref2.event;
|
|
60
63
|
_this.selectMediaSingle(event);
|
|
61
64
|
|
|
62
65
|
// In edit mode (node content wrapper has contenteditable set to true), link redirection is disabled by default
|
|
63
66
|
// We need to call "stopPropagation" here in order to prevent in editor view mode, the browser from navigating to
|
|
64
67
|
// another URL if the media node is wrapped in a link mark.
|
|
65
|
-
if (_this.props.isViewOnly &&
|
|
68
|
+
if (_this.props.isViewOnly && areToolbarFlagsEnabled(Boolean((_this$props$pluginInj = _this.props.pluginInjectionApi) === null || _this$props$pluginInj === void 0 ? void 0 : _this$props$pluginInj.toolbar))) {
|
|
66
69
|
event.preventDefault();
|
|
67
70
|
}
|
|
68
71
|
});
|
|
@@ -235,7 +238,8 @@ export var MediaNode = /*#__PURE__*/function (_Component) {
|
|
|
235
238
|
originalDimensions = _this$props.originalDimensions,
|
|
236
239
|
isLoading = _this$props.isLoading,
|
|
237
240
|
maxDimensions = _this$props.maxDimensions,
|
|
238
|
-
mediaOptions = _this$props.mediaOptions
|
|
241
|
+
mediaOptions = _this$props.mediaOptions,
|
|
242
|
+
api = _this$props.api;
|
|
239
243
|
var borderMark = node.marks.find(function (m) {
|
|
240
244
|
return m.type.name === 'border';
|
|
241
245
|
});
|
|
@@ -316,7 +320,10 @@ export var MediaNode = /*#__PURE__*/function (_Component) {
|
|
|
316
320
|
ssr: ssr,
|
|
317
321
|
mediaSettings: {
|
|
318
322
|
canUpdateVideoCaptions: fg('platform_media_video_captions') ? !!viewAndUploadMediaClientConfig : false
|
|
319
|
-
}
|
|
323
|
+
},
|
|
324
|
+
onError: expValEquals('platform_editor_media_error_analytics', 'isEnabled', true) ? function (reason) {
|
|
325
|
+
return api === null || api === void 0 ? void 0 : api.media.actions.handleMediaNodeRenderError(node, reason);
|
|
326
|
+
} : undefined
|
|
320
327
|
})));
|
|
321
328
|
}
|
|
322
329
|
}]);
|
|
@@ -13,15 +13,16 @@ import React, { Fragment } from 'react';
|
|
|
13
13
|
|
|
14
14
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
15
15
|
import { css, jsx } from '@emotion/react';
|
|
16
|
+
import { browser as browserLegacy, getBrowserInfo } from '@atlaskit/editor-common/browser';
|
|
16
17
|
import { usePreviousState } from '@atlaskit/editor-common/hooks';
|
|
17
18
|
import { captionMessages } from '@atlaskit/editor-common/media';
|
|
18
19
|
import { calcMediaSinglePixelWidth, DEFAULT_IMAGE_HEIGHT, DEFAULT_IMAGE_WIDTH, ExternalImageBadge, getMaxWidthForNestedNode, MEDIA_SINGLE_GUTTER_SIZE, MediaBadges } from '@atlaskit/editor-common/media-single';
|
|
19
20
|
import { MediaSingle } from '@atlaskit/editor-common/ui';
|
|
20
|
-
import { browser } from '@atlaskit/editor-common/utils';
|
|
21
21
|
import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
|
|
22
22
|
import { findParentNodeOfTypeClosestToPos } from '@atlaskit/editor-prosemirror/utils';
|
|
23
23
|
import { getAttrsFromUrl } from '@atlaskit/media-client';
|
|
24
24
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
25
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
25
26
|
import { insertAndSelectCaptionFromMediaSinglePos } from '../pm-plugins/commands/captions';
|
|
26
27
|
import { isMediaBlobUrlFromAttrs } from '../pm-plugins/utils/media-common';
|
|
27
28
|
import { CaptionPlaceholder, CaptionPlaceholderButton } from '../ui/CaptionPlaceholder';
|
|
@@ -427,6 +428,7 @@ export var MediaSingleNodeNext = function MediaSingleNodeNext(mediaSingleNodeNex
|
|
|
427
428
|
var captionPlaceHolderRef = /*#__PURE__*/React.createRef();
|
|
428
429
|
var onMediaSingleClicked = React.useCallback(function (event) {
|
|
429
430
|
var _captionPlaceHolderRe;
|
|
431
|
+
var browser = expValEquals('platform_editor_hydratable_ui', 'isEnabled', true) ? getBrowserInfo() : browserLegacy;
|
|
430
432
|
// Workaround for iOS 16 Caption selection issue
|
|
431
433
|
// @see https://product-fabric.atlassian.net/browse/MEX-2012
|
|
432
434
|
if (!browser.ios) {
|
|
@@ -26,7 +26,6 @@ import { relativeFontSizeToBase16 } from '@atlaskit/editor-shared-styles';
|
|
|
26
26
|
import ChevronLeftLargeIcon from '@atlaskit/icon/core/migration/chevron-left--chevron-left-large';
|
|
27
27
|
import CrossCircleIcon from '@atlaskit/icon/core/migration/cross-circle';
|
|
28
28
|
import { N200, N30, N80, R400 } from '@atlaskit/theme/colors';
|
|
29
|
-
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
30
29
|
import { closeMediaAltTextMenu, closeMediaAltTextMenuAndSave } from '../commands';
|
|
31
30
|
export var MAX_ALT_TEXT_LENGTH = 510; // double tweet length
|
|
32
31
|
|
|
@@ -131,9 +130,10 @@ export var AltTextEditComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
131
130
|
});
|
|
132
131
|
});
|
|
133
132
|
_defineProperty(_this, "handleOnBlur", function (e) {
|
|
133
|
+
var _this$props$areAnyNew;
|
|
134
134
|
// prevent other selection transaction gets triggered
|
|
135
135
|
e.stopPropagation();
|
|
136
|
-
if (
|
|
136
|
+
if ((_this$props$areAnyNew = _this.props.areAnyNewToolbarFlagsEnabled) !== null && _this$props$areAnyNew !== void 0 ? _this$props$areAnyNew : areToolbarFlagsEnabled()) {
|
|
137
137
|
_this.closeMediaAltTextMenuAndSetFocus();
|
|
138
138
|
} else {
|
|
139
139
|
_this.closeMediaAltTextMenu();
|
|
@@ -179,7 +179,7 @@ export var AltTextEditComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
179
179
|
}, {
|
|
180
180
|
key: "render",
|
|
181
181
|
value: function render() {
|
|
182
|
-
var _this$props$
|
|
182
|
+
var _this$props$areAnyNew2, _this$props$areAnyNew3, _this$props$areAnyNew4;
|
|
183
183
|
var formatMessage = this.props.intl.formatMessage;
|
|
184
184
|
var showClearTextButton = this.state.showClearTextButton;
|
|
185
185
|
var backButtonMessage = formatMessage(messages.back);
|
|
@@ -196,7 +196,7 @@ export var AltTextEditComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
196
196
|
}, error);
|
|
197
197
|
});
|
|
198
198
|
var hasErrors = !!errorsList.length;
|
|
199
|
-
var onSubmit =
|
|
199
|
+
var onSubmit = ((_this$props$areAnyNew2 = this.props.areAnyNewToolbarFlagsEnabled) !== null && _this$props$areAnyNew2 !== void 0 ? _this$props$areAnyNew2 : areToolbarFlagsEnabled()) ? this.closeMediaAltTextMenuAndSetFocus : this.closeMediaAltTextMenu;
|
|
200
200
|
return jsx("div", {
|
|
201
201
|
css: containerStyles
|
|
202
202
|
}, jsx("section", {
|
|
@@ -211,7 +211,7 @@ export var AltTextEditComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
211
211
|
}),
|
|
212
212
|
tooltipContent: backButtonMessageComponent,
|
|
213
213
|
onClick: this.closeMediaAltTextMenu,
|
|
214
|
-
areAnyNewToolbarFlagsEnabled: (_this$props$
|
|
214
|
+
areAnyNewToolbarFlagsEnabled: (_this$props$areAnyNew3 = this.props.areAnyNewToolbarFlagsEnabled) !== null && _this$props$areAnyNew3 !== void 0 ? _this$props$areAnyNew3 : areToolbarFlagsEnabled()
|
|
215
215
|
})), jsx(PanelTextInput, {
|
|
216
216
|
testId: "alt-text-input",
|
|
217
217
|
ariaLabel: formatMessage(messages.placeholder),
|
|
@@ -238,7 +238,7 @@ export var AltTextEditComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
238
238
|
})),
|
|
239
239
|
tooltipContent: formatMessage(messages.clear),
|
|
240
240
|
onClick: this.handleClearText,
|
|
241
|
-
areAnyNewToolbarFlagsEnabled: (_this$props$
|
|
241
|
+
areAnyNewToolbarFlagsEnabled: (_this$props$areAnyNew4 = this.props.areAnyNewToolbarFlagsEnabled) !== null && _this$props$areAnyNew4 !== void 0 ? _this$props$areAnyNew4 : areToolbarFlagsEnabled()
|
|
242
242
|
}))), hasErrors && jsx("section", {
|
|
243
243
|
id: "errors-list",
|
|
244
244
|
ref: this.errorsListRef,
|
|
@@ -11,6 +11,7 @@ import { useCallback } from 'react';
|
|
|
11
11
|
import { jsx } from '@emotion/react';
|
|
12
12
|
import { pixelEntryMessages as messages } from '@atlaskit/editor-common/media';
|
|
13
13
|
import { calcMinWidth, DEFAULT_IMAGE_HEIGHT, DEFAULT_IMAGE_WIDTH } from '@atlaskit/editor-common/media-single';
|
|
14
|
+
import { areToolbarFlagsEnabled } from '@atlaskit/editor-common/toolbar-flag-check';
|
|
14
15
|
import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
|
|
15
16
|
import { hasParentNode } from '@atlaskit/editor-prosemirror/utils';
|
|
16
17
|
import { akEditorDefaultLayoutWidth, akEditorFullWidthLayoutWidth } from '@atlaskit/editor-shared-styles';
|
|
@@ -66,6 +67,7 @@ export var PixelEntry = function PixelEntry(_ref) {
|
|
|
66
67
|
mediaWidth || DEFAULT_IMAGE_WIDTH);
|
|
67
68
|
var pixelWidth = hasPixelType ? mediaSingleWidth : pixelWidthFromElement;
|
|
68
69
|
var forceFocusSelector = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$f = pluginInjectionApi.floatingToolbar) === null || _pluginInjectionApi$f === void 0 || (_pluginInjectionApi$f = _pluginInjectionApi$f.actions) === null || _pluginInjectionApi$f === void 0 ? void 0 : _pluginInjectionApi$f.forceFocusSelector;
|
|
70
|
+
var areAnyNewToolbarFlagsEnabled = areToolbarFlagsEnabled(Boolean(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.toolbar));
|
|
69
71
|
return jsx(PixelEntryComponent, {
|
|
70
72
|
intl: intl,
|
|
71
73
|
width: pluginState.isResizing ? pluginState.resizingWidth : pixelWidth,
|
|
@@ -117,7 +119,8 @@ export var PixelEntry = function PixelEntry(_ref) {
|
|
|
117
119
|
}
|
|
118
120
|
},
|
|
119
121
|
isViewMode: pluginState.isResizing,
|
|
120
|
-
triggerButtonSelector: triggerButtonSelector
|
|
122
|
+
triggerButtonSelector: triggerButtonSelector,
|
|
123
|
+
areAnyNewToolbarFlagsEnabled: areAnyNewToolbarFlagsEnabled
|
|
121
124
|
});
|
|
122
125
|
};
|
|
123
126
|
export var FullWidthDisplay = function FullWidthDisplay(_ref4) {
|
|
@@ -17,7 +17,6 @@ import CrossIcon from '@atlaskit/icon/core/cross';
|
|
|
17
17
|
// eslint-disable-next-line @atlaskit/design-system/no-emotion-primitives -- to be migrated to @atlaskit/primitives/compiled – go/akcss
|
|
18
18
|
import { Inline, Box, Text, xcss } from '@atlaskit/primitives';
|
|
19
19
|
import Textfield from '@atlaskit/textfield';
|
|
20
|
-
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
21
20
|
import Tooltip from '@atlaskit/tooltip';
|
|
22
21
|
import { PIXEL_RESIZING_TOOLBAR_WIDTH, PIXEL_VIEW_MODE_TOOLBAR_WIDTH, PIXELENTRY_MIGRATION_BUTTON_TESTID } from './constants';
|
|
23
22
|
import { pixelEntryForm, pixelEntryHiddenSubmit, pixelSizingHeightInput, pixelSizingInput, pixelSizingWidthInput, pixelSizingWrapper } from './styles';
|
|
@@ -37,7 +36,8 @@ export var PixelEntryComponent = function PixelEntryComponent(_ref) {
|
|
|
37
36
|
showMigration = _ref.showMigration,
|
|
38
37
|
onMigrate = _ref.onMigrate,
|
|
39
38
|
onCloseAndSave = _ref.onCloseAndSave,
|
|
40
|
-
isViewMode = _ref.isViewMode
|
|
39
|
+
isViewMode = _ref.isViewMode,
|
|
40
|
+
areAnyNewToolbarFlagsEnabled = _ref.areAnyNewToolbarFlagsEnabled;
|
|
41
41
|
var ratioWidth = useMemo(function () {
|
|
42
42
|
return mediaHeight / mediaWidth;
|
|
43
43
|
}, [mediaHeight, mediaWidth]);
|
|
@@ -158,7 +158,7 @@ export var PixelEntryComponent = function PixelEntryComponent(_ref) {
|
|
|
158
158
|
testId: PIXELENTRY_MIGRATION_BUTTON_TESTID
|
|
159
159
|
}, formatMessage(messages.migrationButtonText)));
|
|
160
160
|
}
|
|
161
|
-
if (
|
|
161
|
+
if (areAnyNewToolbarFlagsEnabled) {
|
|
162
162
|
return jsx(PixelEntryComponentNext, {
|
|
163
163
|
maxWidth: maxWidth,
|
|
164
164
|
formatMessage: formatMessage,
|
|
@@ -8,7 +8,6 @@ import { MediaSharedClassNames as ClassNames } from '@atlaskit/editor-common/sty
|
|
|
8
8
|
import { RECENT_SEARCH_WIDTH_IN_PX as CONTAINER_WIDTH_IN_PX } from '@atlaskit/editor-common/ui';
|
|
9
9
|
import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
|
|
10
10
|
import ImageAltTextIcon from '@atlaskit/icon-lab/core/image-alt-text';
|
|
11
|
-
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
12
11
|
import { openMediaAltTextMenu } from '../../pm-plugins/alt-text/commands';
|
|
13
12
|
import AltTextEdit from '../../pm-plugins/alt-text/ui/AltTextEdit';
|
|
14
13
|
import { isImage } from '../../pm-plugins/utils/is-type';
|
|
@@ -53,7 +52,7 @@ var altTextEditComponent = function altTextEditComponent(options) {
|
|
|
53
52
|
var _options$forceFocusSe;
|
|
54
53
|
var tr = view.state.tr,
|
|
55
54
|
dispatch = view.dispatch;
|
|
56
|
-
var elementSelector = options !== null && options !== void 0 && options.triggerButtonSelector &&
|
|
55
|
+
var elementSelector = options !== null && options !== void 0 && options.triggerButtonSelector && options !== null && options !== void 0 && options.areAnyNewToolbarFlagsEnabled ? options.triggerButtonSelector : "[data-testid=\"".concat(testId, "\"]");
|
|
57
56
|
var newTr = options === null || options === void 0 || (_options$forceFocusSe = options.forceFocusSelector) === null || _options$forceFocusSe === void 0 ? void 0 : _options$forceFocusSe.call(options, elementSelector)(tr);
|
|
58
57
|
if (newTr) {
|
|
59
58
|
dispatch(newTr);
|
|
@@ -25,7 +25,6 @@ import { mediaFilmstripItemDOMSelector } from '@atlaskit/media-filmstrip';
|
|
|
25
25
|
import { messages } from '@atlaskit/media-ui';
|
|
26
26
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
27
27
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
28
|
-
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
29
28
|
import { MediaSingleNodeSelector } from '../../nodeviews/styles';
|
|
30
29
|
import { getPluginState as getMediaAltTextPluginState } from '../../pm-plugins/alt-text';
|
|
31
30
|
import { showLinkingToolbar } from '../../pm-plugins/commands/linking';
|
|
@@ -747,7 +746,7 @@ export var floatingToolbar = function floatingToolbar(state, intl) {
|
|
|
747
746
|
|
|
748
747
|
// testId is required to show focus on trigger button on ESC key press
|
|
749
748
|
// see hideOnEsc in platform/packages/editor/editor-plugin-floating-toolbar/src/ui/Dropdown.tsx
|
|
750
|
-
var overflowButtonSelector =
|
|
749
|
+
var overflowButtonSelector = areToolbarFlagsEnabled(Boolean(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.toolbar)) ? "[data-testid=\"".concat(overflowDropdwonBtnTriggerTestId, "\"]") : undefined;
|
|
751
750
|
if (allowAltTextOnImages) {
|
|
752
751
|
var mediaAltTextPluginState = getMediaAltTextPluginState(state);
|
|
753
752
|
if (mediaAltTextPluginState.isAltTextEditorOpen) {
|
|
@@ -762,7 +761,7 @@ export var floatingToolbar = function floatingToolbar(state, intl) {
|
|
|
762
761
|
}
|
|
763
762
|
var selection = state.selection;
|
|
764
763
|
var isWithinTable = hasParentNodeOfType([state.schema.nodes.table])(selection);
|
|
765
|
-
if (allowAdvancedToolBarOptions && allowResizing && (!isWithinTable || allowResizingInTables === true) && allowPixelResizing &&
|
|
764
|
+
if (allowAdvancedToolBarOptions && allowResizing && (!isWithinTable || allowResizingInTables === true) && allowPixelResizing && areToolbarFlagsEnabled(Boolean(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.toolbar))) {
|
|
766
765
|
var mediaPixelResizingPluginState = getMediaPixelResizingPluginState(state);
|
|
767
766
|
if (mediaPixelResizingPluginState !== null && mediaPixelResizingPluginState !== void 0 && mediaPixelResizingPluginState.isPixelEditorOpen) {
|
|
768
767
|
return getPixelResizingToolbar(baseToolbar, {
|
|
@@ -9,7 +9,6 @@ import { areToolbarFlagsEnabled } from '@atlaskit/editor-common/toolbar-flag-che
|
|
|
9
9
|
import { RECENT_SEARCH_HEIGHT_IN_PX, RECENT_SEARCH_WIDTH_IN_PX } from '@atlaskit/editor-common/ui';
|
|
10
10
|
import LinkIcon from '@atlaskit/icon/core/link';
|
|
11
11
|
import LinkExternalIcon from '@atlaskit/icon/core/link-external';
|
|
12
|
-
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
13
12
|
import { hideLinkingToolbar, setUrlToMedia, showLinkingToolbar, unlink } from '../../pm-plugins/commands/linking';
|
|
14
13
|
import { getMediaLinkingState } from '../../pm-plugins/linking';
|
|
15
14
|
import { currentMediaInlineNode, currentMediaNode } from '../../pm-plugins/utils/current-media-node';
|
|
@@ -55,7 +54,7 @@ export var getLinkingToolbar = function getLinkingToolbar(toolbarBaseConfig, med
|
|
|
55
54
|
return null;
|
|
56
55
|
}
|
|
57
56
|
var setFocusOnFloatingToolbar = function setFocusOnFloatingToolbar(setFocus) {
|
|
58
|
-
if (setFocus &&
|
|
57
|
+
if (setFocus && areToolbarFlagsEnabled(Boolean(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.toolbar))) {
|
|
59
58
|
var _pluginInjectionApi$f;
|
|
60
59
|
var tr = view.state.tr,
|
|
61
60
|
dispatch = view.dispatch;
|
|
@@ -90,7 +89,7 @@ export var getLinkingToolbar = function getLinkingToolbar(toolbarBaseConfig, med
|
|
|
90
89
|
*/
|
|
91
90
|
var tr = view.state.tr,
|
|
92
91
|
dispatch = view.dispatch;
|
|
93
|
-
var selector =
|
|
92
|
+
var selector = areToolbarFlagsEnabled(Boolean(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.toolbar)) ? FORCE_FOCUS_SELECTOR_EDITOR_CONTROLS : FORCE_FOCUS_SELECTOR;
|
|
94
93
|
pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$f2 = pluginInjectionApi.floatingToolbar) === null || _pluginInjectionApi$f2 === void 0 || (_pluginInjectionApi$f2 = _pluginInjectionApi$f2.actions) === null || _pluginInjectionApi$f2 === void 0 || _pluginInjectionApi$f2.forceFocusSelector(selector)(tr);
|
|
95
94
|
dispatch(tr);
|
|
96
95
|
},
|
|
@@ -14,7 +14,6 @@ import MaximizeIcon from '@atlaskit/icon/core/maximize';
|
|
|
14
14
|
import DownloadIcon from '@atlaskit/icon/core/migration/download';
|
|
15
15
|
import SmartLinkCardIcon from '@atlaskit/icon/core/smart-link-card';
|
|
16
16
|
import { messages } from '@atlaskit/media-ui';
|
|
17
|
-
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
18
17
|
import { showLinkingToolbar } from '../../pm-plugins/commands/linking';
|
|
19
18
|
import { getMediaLinkingState } from '../../pm-plugins/linking';
|
|
20
19
|
import { currentMediaOrInlineNodeBorderMark } from '../../pm-plugins/utils/current-media-node';
|
|
@@ -180,7 +179,7 @@ var getMediaInlineImageToolbar = function getMediaInlineImageToolbar(state, intl
|
|
|
180
179
|
var mediaSingleTitle = intl.formatMessage(mediaAndEmbedToolbarMessages.changeToMediaSingle);
|
|
181
180
|
var widthPluginState = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$w = pluginInjectionApi.width) === null || _pluginInjectionApi$w === void 0 ? void 0 : _pluginInjectionApi$w.sharedState.currentState();
|
|
182
181
|
var inlineImageItems = [];
|
|
183
|
-
var isEditorControlsEnabled =
|
|
182
|
+
var isEditorControlsEnabled = areToolbarFlagsEnabled(Boolean(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.toolbar));
|
|
184
183
|
var isViewOnly = options.isViewOnly,
|
|
185
184
|
allowAltTextOnImages = options.allowAltTextOnImages,
|
|
186
185
|
allowLinking = options.allowLinking,
|
|
@@ -17,6 +17,7 @@ import type { InteractionPlugin } from '@atlaskit/editor-plugin-interaction';
|
|
|
17
17
|
import type { SelectionPlugin } from '@atlaskit/editor-plugin-selection';
|
|
18
18
|
import type { ToolbarPlugin } from '@atlaskit/editor-plugin-toolbar';
|
|
19
19
|
import type { WidthPlugin } from '@atlaskit/editor-plugin-width';
|
|
20
|
+
import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
20
21
|
import type { MediaPluginState } from './pm-plugins/types';
|
|
21
22
|
import type { InsertMediaAsMediaSingle } from './pm-plugins/utils/media-single';
|
|
22
23
|
import type { MediaOptions } from './types';
|
|
@@ -41,6 +42,10 @@ export type MediaPluginDependencies = [
|
|
|
41
42
|
];
|
|
42
43
|
export type MediaNextEditorPluginType = NextEditorPlugin<'media', {
|
|
43
44
|
actions: {
|
|
45
|
+
/**
|
|
46
|
+
* Callback to be called when there is an error rendering a media node.
|
|
47
|
+
*/
|
|
48
|
+
handleMediaNodeRenderError: (node: PMNode, reason: string) => void;
|
|
44
49
|
insertMediaAsMediaSingle: InsertMediaAsMediaSingle;
|
|
45
50
|
/**
|
|
46
51
|
* Used to update the initial provider passed to the media plugin.
|