@atlaskit/editor-plugin-media 8.3.0 → 8.4.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 +15 -0
- package/dist/cjs/mediaPlugin.js +2 -2
- package/dist/cjs/nodeviews/mediaNodeView/index.js +2 -1
- package/dist/cjs/nodeviews/mediaNodeView/media.js +3 -1
- package/dist/cjs/pm-plugins/alt-text/ui/AltTextEdit.js +6 -6
- package/dist/cjs/pm-plugins/main.js +10 -1
- 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 +2 -2
- package/dist/es2019/nodeviews/mediaNodeView/index.js +2 -1
- package/dist/es2019/nodeviews/mediaNodeView/media.js +3 -1
- package/dist/es2019/pm-plugins/alt-text/ui/AltTextEdit.js +6 -6
- package/dist/es2019/pm-plugins/main.js +9 -0
- 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 +2 -2
- package/dist/esm/nodeviews/mediaNodeView/index.js +2 -1
- package/dist/esm/nodeviews/mediaNodeView/media.js +3 -1
- package/dist/esm/pm-plugins/alt-text/ui/AltTextEdit.js +6 -6
- package/dist/esm/pm-plugins/main.js +10 -1
- 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/nodeviews/mediaNodeView/media.d.ts +1 -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/types/index.d.ts +6 -0
- package/dist/types-ts4.5/nodeviews/mediaNodeView/media.d.ts +1 -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/dist/types-ts4.5/types/index.d.ts +6 -0
- package/package.json +6 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-media
|
|
2
2
|
|
|
3
|
+
## 8.4.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`641ffaa365b47`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/641ffaa365b47) -
|
|
8
|
+
[ux] add prevent auto focus after uploading support
|
|
9
|
+
|
|
10
|
+
## 8.3.1
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- [`507be0327d12c`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/507be0327d12c) -
|
|
15
|
+
[ux] ED-29558 [Jira] Media element toolbar 'resize' doesn't work
|
|
16
|
+
- Updated dependencies
|
|
17
|
+
|
|
3
18
|
## 8.3.0
|
|
4
19
|
|
|
5
20
|
### Minor Changes
|
package/dist/cjs/mediaPlugin.js
CHANGED
|
@@ -10,10 +10,10 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
10
10
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
11
11
|
var _hooks = require("@atlaskit/editor-common/hooks");
|
|
12
12
|
var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
|
|
13
|
+
var _toolbarFlagCheck = require("@atlaskit/editor-common/toolbar-flag-check");
|
|
13
14
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
14
15
|
var _mediaCommon = require("@atlaskit/media-common");
|
|
15
16
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
16
|
-
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
17
17
|
var _lazyMedia = require("./nodeviews/lazy-media");
|
|
18
18
|
var _lazyMediaGroup = require("./nodeviews/lazy-media-group");
|
|
19
19
|
var _lazyMediaInline = require("./nodeviews/lazy-media-inline");
|
|
@@ -278,7 +278,7 @@ var mediaPlugin = exports.mediaPlugin = function mediaPlugin(_ref3) {
|
|
|
278
278
|
}
|
|
279
279
|
});
|
|
280
280
|
}
|
|
281
|
-
if (options && options.allowAdvancedToolBarOptions && options.allowResizing && (0,
|
|
281
|
+
if (options && options.allowAdvancedToolBarOptions && options.allowResizing && (0, _toolbarFlagCheck.areToolbarFlagsEnabled)(Boolean(api === null || api === void 0 ? void 0 : api.toolbar)) && options.allowPixelResizing) {
|
|
282
282
|
pmPlugins.push({
|
|
283
283
|
name: 'mediaPixelResizing',
|
|
284
284
|
plugin: _pixelResizing.createPlugin
|
|
@@ -123,7 +123,8 @@ var MediaNodeView = /*#__PURE__*/function (_SelectionBasedNodeVi) {
|
|
|
123
123
|
contextIdentifierProvider: contextIdentifierProvider,
|
|
124
124
|
mediaOptions: mediaOptions,
|
|
125
125
|
onExternalImageLoaded: _this.onExternalImageLoaded,
|
|
126
|
-
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'
|
|
126
|
+
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',
|
|
127
|
+
pluginInjectionApi: _this.reactComponentProps.pluginInjectionApi
|
|
127
128
|
});
|
|
128
129
|
};
|
|
129
130
|
});
|
|
@@ -18,6 +18,7 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
18
18
|
var _bindEventListener = require("bind-event-listener");
|
|
19
19
|
var _analyticsNamespacedContext = require("@atlaskit/analytics-namespaced-context");
|
|
20
20
|
var _analyticsNext = require("@atlaskit/analytics-next");
|
|
21
|
+
var _toolbarFlagCheck = require("@atlaskit/editor-common/toolbar-flag-check");
|
|
21
22
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
22
23
|
var _cellSelection = require("@atlaskit/editor-tables/cell-selection");
|
|
23
24
|
var _mediaCard = require("@atlaskit/media-card");
|
|
@@ -65,13 +66,14 @@ var MediaNode = exports.MediaNode = /*#__PURE__*/function (_Component) {
|
|
|
65
66
|
}, _callee);
|
|
66
67
|
})));
|
|
67
68
|
(0, _defineProperty2.default)(_this, "selectMediaSingleFromCard", function (_ref2) {
|
|
69
|
+
var _this$props$pluginInj;
|
|
68
70
|
var event = _ref2.event;
|
|
69
71
|
_this.selectMediaSingle(event);
|
|
70
72
|
|
|
71
73
|
// In edit mode (node content wrapper has contenteditable set to true), link redirection is disabled by default
|
|
72
74
|
// We need to call "stopPropagation" here in order to prevent in editor view mode, the browser from navigating to
|
|
73
75
|
// another URL if the media node is wrapped in a link mark.
|
|
74
|
-
if (_this.props.isViewOnly && (0,
|
|
76
|
+
if (_this.props.isViewOnly && (0, _toolbarFlagCheck.areToolbarFlagsEnabled)(Boolean((_this$props$pluginInj = _this.props.pluginInjectionApi) === null || _this$props$pluginInj === void 0 ? void 0 : _this$props$pluginInj.toolbar))) {
|
|
75
77
|
event.preventDefault();
|
|
76
78
|
}
|
|
77
79
|
});
|
|
@@ -24,7 +24,6 @@ var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
|
24
24
|
var _chevronLeftChevronLeftLarge = _interopRequireDefault(require("@atlaskit/icon/core/migration/chevron-left--chevron-left-large"));
|
|
25
25
|
var _crossCircle = _interopRequireDefault(require("@atlaskit/icon/core/migration/cross-circle"));
|
|
26
26
|
var _colors = require("@atlaskit/theme/colors");
|
|
27
|
-
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
28
27
|
var _commands = require("../commands");
|
|
29
28
|
function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2.default)(o), (0, _possibleConstructorReturn2.default)(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2.default)(t).constructor) : o.apply(t, e)); }
|
|
30
29
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } /**
|
|
@@ -134,9 +133,10 @@ var AltTextEditComponent = exports.AltTextEditComponent = /*#__PURE__*/function
|
|
|
134
133
|
});
|
|
135
134
|
});
|
|
136
135
|
(0, _defineProperty2.default)(_this, "handleOnBlur", function (e) {
|
|
136
|
+
var _this$props$areAnyNew;
|
|
137
137
|
// prevent other selection transaction gets triggered
|
|
138
138
|
e.stopPropagation();
|
|
139
|
-
if ((
|
|
139
|
+
if ((_this$props$areAnyNew = _this.props.areAnyNewToolbarFlagsEnabled) !== null && _this$props$areAnyNew !== void 0 ? _this$props$areAnyNew : (0, _toolbarFlagCheck.areToolbarFlagsEnabled)()) {
|
|
140
140
|
_this.closeMediaAltTextMenuAndSetFocus();
|
|
141
141
|
} else {
|
|
142
142
|
_this.closeMediaAltTextMenu();
|
|
@@ -182,7 +182,7 @@ var AltTextEditComponent = exports.AltTextEditComponent = /*#__PURE__*/function
|
|
|
182
182
|
}, {
|
|
183
183
|
key: "render",
|
|
184
184
|
value: function render() {
|
|
185
|
-
var _this$props$
|
|
185
|
+
var _this$props$areAnyNew2, _this$props$areAnyNew3, _this$props$areAnyNew4;
|
|
186
186
|
var formatMessage = this.props.intl.formatMessage;
|
|
187
187
|
var showClearTextButton = this.state.showClearTextButton;
|
|
188
188
|
var backButtonMessage = formatMessage(_media.altTextMessages.back);
|
|
@@ -199,7 +199,7 @@ var AltTextEditComponent = exports.AltTextEditComponent = /*#__PURE__*/function
|
|
|
199
199
|
}, error);
|
|
200
200
|
});
|
|
201
201
|
var hasErrors = !!errorsList.length;
|
|
202
|
-
var onSubmit = (
|
|
202
|
+
var onSubmit = ((_this$props$areAnyNew2 = this.props.areAnyNewToolbarFlagsEnabled) !== null && _this$props$areAnyNew2 !== void 0 ? _this$props$areAnyNew2 : (0, _toolbarFlagCheck.areToolbarFlagsEnabled)()) ? this.closeMediaAltTextMenuAndSetFocus : this.closeMediaAltTextMenu;
|
|
203
203
|
return (0, _react2.jsx)("div", {
|
|
204
204
|
css: containerStyles
|
|
205
205
|
}, (0, _react2.jsx)("section", {
|
|
@@ -214,7 +214,7 @@ var AltTextEditComponent = exports.AltTextEditComponent = /*#__PURE__*/function
|
|
|
214
214
|
}),
|
|
215
215
|
tooltipContent: backButtonMessageComponent,
|
|
216
216
|
onClick: this.closeMediaAltTextMenu,
|
|
217
|
-
areAnyNewToolbarFlagsEnabled: (_this$props$
|
|
217
|
+
areAnyNewToolbarFlagsEnabled: (_this$props$areAnyNew3 = this.props.areAnyNewToolbarFlagsEnabled) !== null && _this$props$areAnyNew3 !== void 0 ? _this$props$areAnyNew3 : (0, _toolbarFlagCheck.areToolbarFlagsEnabled)()
|
|
218
218
|
})), (0, _react2.jsx)(_ui.PanelTextInput, {
|
|
219
219
|
testId: "alt-text-input",
|
|
220
220
|
ariaLabel: formatMessage(_media.altTextMessages.placeholder),
|
|
@@ -241,7 +241,7 @@ var AltTextEditComponent = exports.AltTextEditComponent = /*#__PURE__*/function
|
|
|
241
241
|
})),
|
|
242
242
|
tooltipContent: formatMessage(_media.altTextMessages.clear),
|
|
243
243
|
onClick: this.handleClearText,
|
|
244
|
-
areAnyNewToolbarFlagsEnabled: (_this$props$
|
|
244
|
+
areAnyNewToolbarFlagsEnabled: (_this$props$areAnyNew4 = this.props.areAnyNewToolbarFlagsEnabled) !== null && _this$props$areAnyNew4 !== void 0 ? _this$props$areAnyNew4 : (0, _toolbarFlagCheck.areToolbarFlagsEnabled)()
|
|
245
245
|
}))), hasErrors && (0, _react2.jsx)("section", {
|
|
246
246
|
id: "errors-list",
|
|
247
247
|
ref: this.errorsListRef,
|
|
@@ -50,6 +50,7 @@ var MEDIA_CONTENT_WRAP_CLASS_NAME = exports.MEDIA_CONTENT_WRAP_CLASS_NAME = 'med
|
|
|
50
50
|
var MEDIA_PLUGIN_IS_RESIZING_KEY = exports.MEDIA_PLUGIN_IS_RESIZING_KEY = 'mediaSinglePlugin.isResizing';
|
|
51
51
|
var MEDIA_PLUGIN_RESIZING_WIDTH_KEY = exports.MEDIA_PLUGIN_RESIZING_WIDTH_KEY = 'mediaSinglePlugin.resizing-width';
|
|
52
52
|
var createDropPlaceholder = function createDropPlaceholder(intl, nodeViewPortalProviderAPI, dropPlaceholderKey, allowDropLine) {
|
|
53
|
+
// eslint-disable-next-line @atlaskit/platform/no-direct-document-usage
|
|
53
54
|
var dropPlaceholder = document.createElement('div');
|
|
54
55
|
var createElement = _react.default.createElement;
|
|
55
56
|
if (allowDropLine) {
|
|
@@ -670,7 +671,14 @@ var MediaPluginStateImplementation = exports.MediaPluginStateImplementation = /*
|
|
|
670
671
|
}, {
|
|
671
672
|
key: "selectLastAddedMediaNode",
|
|
672
673
|
value: function selectLastAddedMediaNode() {
|
|
673
|
-
var
|
|
674
|
+
var _this$mediaOptions5,
|
|
675
|
+
_this2 = this;
|
|
676
|
+
// if preventAutoFocusOnUpload is enabled, skip auto-selection and just clear the tracking array
|
|
677
|
+
if ((_this$mediaOptions5 = this.mediaOptions) !== null && _this$mediaOptions5 !== void 0 && _this$mediaOptions5.preventAutoFocusOnUpload && (0, _platformFeatureFlags.fg)('jira_kuro-jjj_disable_auto_focus_after_img_upload')) {
|
|
678
|
+
this.lastAddedMediaSingleFileIds = [];
|
|
679
|
+
return;
|
|
680
|
+
}
|
|
681
|
+
|
|
674
682
|
// if lastAddedMediaSingleFileIds is empty exit because there are no added media single nodes to be selected
|
|
675
683
|
if (this.lastAddedMediaSingleFileIds.length !== 0) {
|
|
676
684
|
this.waitForPendingTasks().then(function () {
|
|
@@ -969,6 +977,7 @@ var createPlugin = exports.createPlugin = function createPlugin(_schema, options
|
|
|
969
977
|
var videoControls = videoControlsWrapperRef === null || videoControlsWrapperRef === void 0 ? void 0 : videoControlsWrapperRef.querySelectorAll('button, [tabindex]:not([tabindex="-1"])');
|
|
970
978
|
if (videoControls) {
|
|
971
979
|
var isVideoControl = Array.from(videoControls).some(function (videoControl) {
|
|
980
|
+
// eslint-disable-next-line @atlaskit/platform/no-direct-document-usage
|
|
972
981
|
return document.activeElement === videoControl;
|
|
973
982
|
});
|
|
974
983
|
if (isVideoControl) {
|
|
@@ -10,6 +10,7 @@ var _react = require("react");
|
|
|
10
10
|
var _react2 = require("@emotion/react");
|
|
11
11
|
var _media = require("@atlaskit/editor-common/media");
|
|
12
12
|
var _mediaSingle = require("@atlaskit/editor-common/media-single");
|
|
13
|
+
var _toolbarFlagCheck = require("@atlaskit/editor-common/toolbar-flag-check");
|
|
13
14
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
14
15
|
var _utils = require("@atlaskit/editor-prosemirror/utils");
|
|
15
16
|
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
@@ -70,6 +71,7 @@ var PixelEntry = exports.PixelEntry = function PixelEntry(_ref) {
|
|
|
70
71
|
mediaWidth || _mediaSingle.DEFAULT_IMAGE_WIDTH);
|
|
71
72
|
var pixelWidth = hasPixelType ? mediaSingleWidth : pixelWidthFromElement;
|
|
72
73
|
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;
|
|
74
|
+
var areAnyNewToolbarFlagsEnabled = (0, _toolbarFlagCheck.areToolbarFlagsEnabled)(Boolean(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.toolbar));
|
|
73
75
|
return (0, _react2.jsx)(_pixelEntry.PixelEntryComponent, {
|
|
74
76
|
intl: intl,
|
|
75
77
|
width: pluginState.isResizing ? pluginState.resizingWidth : pixelWidth,
|
|
@@ -121,7 +123,8 @@ var PixelEntry = exports.PixelEntry = function PixelEntry(_ref) {
|
|
|
121
123
|
}
|
|
122
124
|
},
|
|
123
125
|
isViewMode: pluginState.isResizing,
|
|
124
|
-
triggerButtonSelector: triggerButtonSelector
|
|
126
|
+
triggerButtonSelector: triggerButtonSelector,
|
|
127
|
+
areAnyNewToolbarFlagsEnabled: areAnyNewToolbarFlagsEnabled
|
|
125
128
|
});
|
|
126
129
|
};
|
|
127
130
|
var FullWidthDisplay = exports.FullWidthDisplay = function FullWidthDisplay(_ref4) {
|
|
@@ -17,7 +17,6 @@ var _form = _interopRequireWildcard(require("@atlaskit/form"));
|
|
|
17
17
|
var _cross = _interopRequireDefault(require("@atlaskit/icon/core/cross"));
|
|
18
18
|
var _primitives = require("@atlaskit/primitives");
|
|
19
19
|
var _textfield = _interopRequireDefault(require("@atlaskit/textfield"));
|
|
20
|
-
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
21
20
|
var _tooltip = _interopRequireDefault(require("@atlaskit/tooltip"));
|
|
22
21
|
var _constants = require("./constants");
|
|
23
22
|
var _styles = require("./styles");
|
|
@@ -49,7 +48,8 @@ var PixelEntryComponent = exports.PixelEntryComponent = function PixelEntryCompo
|
|
|
49
48
|
showMigration = _ref.showMigration,
|
|
50
49
|
onMigrate = _ref.onMigrate,
|
|
51
50
|
onCloseAndSave = _ref.onCloseAndSave,
|
|
52
|
-
isViewMode = _ref.isViewMode
|
|
51
|
+
isViewMode = _ref.isViewMode,
|
|
52
|
+
areAnyNewToolbarFlagsEnabled = _ref.areAnyNewToolbarFlagsEnabled;
|
|
53
53
|
var ratioWidth = (0, _react.useMemo)(function () {
|
|
54
54
|
return mediaHeight / mediaWidth;
|
|
55
55
|
}, [mediaHeight, mediaWidth]);
|
|
@@ -170,7 +170,7 @@ var PixelEntryComponent = exports.PixelEntryComponent = function PixelEntryCompo
|
|
|
170
170
|
testId: _constants.PIXELENTRY_MIGRATION_BUTTON_TESTID
|
|
171
171
|
}, formatMessage(_media.pixelEntryMessages.migrationButtonText)));
|
|
172
172
|
}
|
|
173
|
-
if (
|
|
173
|
+
if (areAnyNewToolbarFlagsEnabled) {
|
|
174
174
|
return (0, _react2.jsx)(PixelEntryComponentNext, {
|
|
175
175
|
maxWidth: maxWidth,
|
|
176
176
|
formatMessage: formatMessage,
|
|
@@ -13,7 +13,6 @@ var _styles = require("@atlaskit/editor-common/styles");
|
|
|
13
13
|
var _ui = require("@atlaskit/editor-common/ui");
|
|
14
14
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
15
15
|
var _imageAltText = _interopRequireDefault(require("@atlaskit/icon-lab/core/image-alt-text"));
|
|
16
|
-
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
17
16
|
var _commands = require("../../pm-plugins/alt-text/commands");
|
|
18
17
|
var _AltTextEdit = _interopRequireDefault(require("../../pm-plugins/alt-text/ui/AltTextEdit"));
|
|
19
18
|
var _isType = require("../../pm-plugins/utils/is-type");
|
|
@@ -60,7 +59,7 @@ var altTextEditComponent = function altTextEditComponent(options) {
|
|
|
60
59
|
var _options$forceFocusSe;
|
|
61
60
|
var tr = view.state.tr,
|
|
62
61
|
dispatch = view.dispatch;
|
|
63
|
-
var elementSelector = options !== null && options !== void 0 && options.triggerButtonSelector &&
|
|
62
|
+
var elementSelector = options !== null && options !== void 0 && options.triggerButtonSelector && options !== null && options !== void 0 && options.areAnyNewToolbarFlagsEnabled ? options.triggerButtonSelector : "[data-testid=\"".concat(testId, "\"]");
|
|
64
63
|
var newTr = options === null || options === void 0 || (_options$forceFocusSe = options.forceFocusSelector) === null || _options$forceFocusSe === void 0 ? void 0 : _options$forceFocusSe.call(options, elementSelector)(tr);
|
|
65
64
|
if (newTr) {
|
|
66
65
|
dispatch(newTr);
|
|
@@ -31,7 +31,6 @@ var _mediaFilmstrip = require("@atlaskit/media-filmstrip");
|
|
|
31
31
|
var _mediaUi = require("@atlaskit/media-ui");
|
|
32
32
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
33
33
|
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
34
|
-
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
35
34
|
var _styles = require("../../nodeviews/styles");
|
|
36
35
|
var _altText = require("../../pm-plugins/alt-text");
|
|
37
36
|
var _linking = require("../../pm-plugins/commands/linking");
|
|
@@ -756,7 +755,7 @@ var floatingToolbar = exports.floatingToolbar = function floatingToolbar(state,
|
|
|
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
|
-
var overflowButtonSelector = (0,
|
|
758
|
+
var overflowButtonSelector = (0, _toolbarFlagCheck.areToolbarFlagsEnabled)(Boolean(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.toolbar)) ? "[data-testid=\"".concat(overflowDropdwonBtnTriggerTestId, "\"]") : undefined;
|
|
760
759
|
if (allowAltTextOnImages) {
|
|
761
760
|
var mediaAltTextPluginState = (0, _altText.getPluginState)(state);
|
|
762
761
|
if (mediaAltTextPluginState.isAltTextEditorOpen) {
|
|
@@ -771,7 +770,7 @@ var floatingToolbar = exports.floatingToolbar = function floatingToolbar(state,
|
|
|
771
770
|
}
|
|
772
771
|
var selection = state.selection;
|
|
773
772
|
var isWithinTable = (0, _utils.hasParentNodeOfType)([state.schema.nodes.table])(selection);
|
|
774
|
-
if (allowAdvancedToolBarOptions && allowResizing && (!isWithinTable || allowResizingInTables === true) && allowPixelResizing && (0,
|
|
773
|
+
if (allowAdvancedToolBarOptions && allowResizing && (!isWithinTable || allowResizingInTables === true) && allowPixelResizing && (0, _toolbarFlagCheck.areToolbarFlagsEnabled)(Boolean(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.toolbar))) {
|
|
775
774
|
var mediaPixelResizingPluginState = (0, _pixelResizing.getPluginState)(state);
|
|
776
775
|
if (mediaPixelResizingPluginState !== null && mediaPixelResizingPluginState !== void 0 && mediaPixelResizingPluginState.isPixelEditorOpen) {
|
|
777
776
|
return (0, _pixelResizing2.getPixelResizingToolbar)(baseToolbar, {
|
|
@@ -15,7 +15,6 @@ var _toolbarFlagCheck = require("@atlaskit/editor-common/toolbar-flag-check");
|
|
|
15
15
|
var _ui = require("@atlaskit/editor-common/ui");
|
|
16
16
|
var _link = _interopRequireDefault(require("@atlaskit/icon/core/link"));
|
|
17
17
|
var _linkExternal = _interopRequireDefault(require("@atlaskit/icon/core/link-external"));
|
|
18
|
-
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
19
18
|
var _linking = require("../../pm-plugins/commands/linking");
|
|
20
19
|
var _linking2 = require("../../pm-plugins/linking");
|
|
21
20
|
var _currentMediaNode = require("../../pm-plugins/utils/current-media-node");
|
|
@@ -63,7 +62,7 @@ var getLinkingToolbar = exports.getLinkingToolbar = function getLinkingToolbar(t
|
|
|
63
62
|
return null;
|
|
64
63
|
}
|
|
65
64
|
var setFocusOnFloatingToolbar = function setFocusOnFloatingToolbar(setFocus) {
|
|
66
|
-
if (setFocus && (0,
|
|
65
|
+
if (setFocus && (0, _toolbarFlagCheck.areToolbarFlagsEnabled)(Boolean(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.toolbar))) {
|
|
67
66
|
var _pluginInjectionApi$f;
|
|
68
67
|
var tr = view.state.tr,
|
|
69
68
|
dispatch = view.dispatch;
|
|
@@ -98,7 +97,7 @@ var getLinkingToolbar = exports.getLinkingToolbar = function getLinkingToolbar(t
|
|
|
98
97
|
*/
|
|
99
98
|
var tr = view.state.tr,
|
|
100
99
|
dispatch = view.dispatch;
|
|
101
|
-
var selector = (0,
|
|
100
|
+
var selector = (0, _toolbarFlagCheck.areToolbarFlagsEnabled)(Boolean(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.toolbar)) ? FORCE_FOCUS_SELECTOR_EDITOR_CONTROLS : FORCE_FOCUS_SELECTOR;
|
|
102
101
|
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);
|
|
103
102
|
dispatch(tr);
|
|
104
103
|
},
|
|
@@ -20,7 +20,6 @@ var _maximize = _interopRequireDefault(require("@atlaskit/icon/core/maximize"));
|
|
|
20
20
|
var _download = _interopRequireDefault(require("@atlaskit/icon/core/migration/download"));
|
|
21
21
|
var _smartLinkCard = _interopRequireDefault(require("@atlaskit/icon/core/smart-link-card"));
|
|
22
22
|
var _mediaUi = require("@atlaskit/media-ui");
|
|
23
|
-
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
24
23
|
var _linking = require("../../pm-plugins/commands/linking");
|
|
25
24
|
var _linking2 = require("../../pm-plugins/linking");
|
|
26
25
|
var _currentMediaNode = require("../../pm-plugins/utils/current-media-node");
|
|
@@ -189,7 +188,7 @@ var getMediaInlineImageToolbar = function getMediaInlineImageToolbar(state, intl
|
|
|
189
188
|
var mediaSingleTitle = intl.formatMessage(_messages.mediaAndEmbedToolbarMessages.changeToMediaSingle);
|
|
190
189
|
var widthPluginState = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$w = pluginInjectionApi.width) === null || _pluginInjectionApi$w === void 0 ? void 0 : _pluginInjectionApi$w.sharedState.currentState();
|
|
191
190
|
var inlineImageItems = [];
|
|
192
|
-
var isEditorControlsEnabled = (0,
|
|
191
|
+
var isEditorControlsEnabled = (0, _toolbarFlagCheck.areToolbarFlagsEnabled)(Boolean(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.toolbar));
|
|
193
192
|
var isViewOnly = options.isViewOnly,
|
|
194
193
|
allowAltTextOnImages = options.allowAltTextOnImages,
|
|
195
194
|
allowLinking = options.allowLinking,
|
|
@@ -2,10 +2,10 @@ import React, { useMemo } from 'react';
|
|
|
2
2
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
|
|
3
3
|
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
4
4
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
5
|
+
import { areToolbarFlagsEnabled } from '@atlaskit/editor-common/toolbar-flag-check';
|
|
5
6
|
import { NodeSelection, PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
6
7
|
import { getMediaFeatureFlag } from '@atlaskit/media-common';
|
|
7
8
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
8
|
-
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
9
9
|
import { lazyMediaView } from './nodeviews/lazy-media';
|
|
10
10
|
import { lazyMediaGroupView } from './nodeviews/lazy-media-group';
|
|
11
11
|
import { lazyMediaInlineView } from './nodeviews/lazy-media-inline';
|
|
@@ -270,7 +270,7 @@ export const mediaPlugin = ({
|
|
|
270
270
|
}) => keymapLinkingPlugin(schema)
|
|
271
271
|
});
|
|
272
272
|
}
|
|
273
|
-
if (options && options.allowAdvancedToolBarOptions && options.allowResizing &&
|
|
273
|
+
if (options && options.allowAdvancedToolBarOptions && options.allowResizing && areToolbarFlagsEnabled(Boolean(api === null || api === void 0 ? void 0 : api.toolbar)) && options.allowPixelResizing) {
|
|
274
274
|
pmPlugins.push({
|
|
275
275
|
name: 'mediaPixelResizing',
|
|
276
276
|
plugin: createMediaPixelResizingPlugin
|
|
@@ -112,7 +112,8 @@ class MediaNodeView extends SelectionBasedNodeView {
|
|
|
112
112
|
contextIdentifierProvider: contextIdentifierProvider,
|
|
113
113
|
mediaOptions: mediaOptions,
|
|
114
114
|
onExternalImageLoaded: this.onExternalImageLoaded,
|
|
115
|
-
isViewOnly: ((_this$reactComponentP = this.reactComponentProps.pluginInjectionApi) === null || _this$reactComponentP === void 0 ? void 0 : (_this$reactComponentP2 = _this$reactComponentP.editorViewMode) === null || _this$reactComponentP2 === void 0 ? void 0 : (_this$reactComponentP3 = _this$reactComponentP2.sharedState.currentState()) === null || _this$reactComponentP3 === void 0 ? void 0 : _this$reactComponentP3.mode) === 'view'
|
|
115
|
+
isViewOnly: ((_this$reactComponentP = this.reactComponentProps.pluginInjectionApi) === null || _this$reactComponentP === void 0 ? void 0 : (_this$reactComponentP2 = _this$reactComponentP.editorViewMode) === null || _this$reactComponentP2 === void 0 ? void 0 : (_this$reactComponentP3 = _this$reactComponentP2.sharedState.currentState()) === null || _this$reactComponentP3 === void 0 ? void 0 : _this$reactComponentP3.mode) === 'view',
|
|
116
|
+
pluginInjectionApi: this.reactComponentProps.pluginInjectionApi
|
|
116
117
|
});
|
|
117
118
|
};
|
|
118
119
|
});
|
|
@@ -3,6 +3,7 @@ import React, { Component } from 'react';
|
|
|
3
3
|
import { bind } from 'bind-event-listener';
|
|
4
4
|
import { MEDIA_CONTEXT } from '@atlaskit/analytics-namespaced-context';
|
|
5
5
|
import { AnalyticsContext } from '@atlaskit/analytics-next';
|
|
6
|
+
import { areToolbarFlagsEnabled } from '@atlaskit/editor-common/toolbar-flag-check';
|
|
6
7
|
import { setNodeSelection, setTextSelection, withImageLoader } from '@atlaskit/editor-common/utils';
|
|
7
8
|
import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
|
|
8
9
|
import { Card, CardLoading } from '@atlaskit/media-card';
|
|
@@ -36,12 +37,13 @@ export class MediaNode extends Component {
|
|
|
36
37
|
_defineProperty(this, "selectMediaSingleFromCard", ({
|
|
37
38
|
event
|
|
38
39
|
}) => {
|
|
40
|
+
var _this$props$pluginInj;
|
|
39
41
|
this.selectMediaSingle(event);
|
|
40
42
|
|
|
41
43
|
// In edit mode (node content wrapper has contenteditable set to true), link redirection is disabled by default
|
|
42
44
|
// We need to call "stopPropagation" here in order to prevent in editor view mode, the browser from navigating to
|
|
43
45
|
// another URL if the media node is wrapped in a link mark.
|
|
44
|
-
if (this.props.isViewOnly &&
|
|
46
|
+
if (this.props.isViewOnly && areToolbarFlagsEnabled(Boolean((_this$props$pluginInj = this.props.pluginInjectionApi) === null || _this$props$pluginInj === void 0 ? void 0 : _this$props$pluginInj.toolbar))) {
|
|
45
47
|
event.preventDefault();
|
|
46
48
|
}
|
|
47
49
|
});
|
|
@@ -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,
|
|
@@ -33,6 +33,7 @@ export const MEDIA_CONTENT_WRAP_CLASS_NAME = 'media-content-wrap';
|
|
|
33
33
|
export const MEDIA_PLUGIN_IS_RESIZING_KEY = 'mediaSinglePlugin.isResizing';
|
|
34
34
|
export const MEDIA_PLUGIN_RESIZING_WIDTH_KEY = 'mediaSinglePlugin.resizing-width';
|
|
35
35
|
const createDropPlaceholder = (intl, nodeViewPortalProviderAPI, dropPlaceholderKey, allowDropLine) => {
|
|
36
|
+
// eslint-disable-next-line @atlaskit/platform/no-direct-document-usage
|
|
36
37
|
const dropPlaceholder = document.createElement('div');
|
|
37
38
|
const createElement = React.createElement;
|
|
38
39
|
if (allowDropLine) {
|
|
@@ -595,6 +596,13 @@ export class MediaPluginStateImplementation {
|
|
|
595
596
|
return (_this$pluginInjection5 = this.pluginInjectionApi) === null || _this$pluginInjection5 === void 0 ? void 0 : (_this$pluginInjection6 = _this$pluginInjection5.contextIdentifier) === null || _this$pluginInjection6 === void 0 ? void 0 : (_this$pluginInjection7 = _this$pluginInjection6.sharedState.currentState()) === null || _this$pluginInjection7 === void 0 ? void 0 : _this$pluginInjection7.contextIdentifierProvider;
|
|
596
597
|
}
|
|
597
598
|
selectLastAddedMediaNode() {
|
|
599
|
+
var _this$mediaOptions5;
|
|
600
|
+
// if preventAutoFocusOnUpload is enabled, skip auto-selection and just clear the tracking array
|
|
601
|
+
if ((_this$mediaOptions5 = this.mediaOptions) !== null && _this$mediaOptions5 !== void 0 && _this$mediaOptions5.preventAutoFocusOnUpload && fg('jira_kuro-jjj_disable_auto_focus_after_img_upload')) {
|
|
602
|
+
this.lastAddedMediaSingleFileIds = [];
|
|
603
|
+
return;
|
|
604
|
+
}
|
|
605
|
+
|
|
598
606
|
// if lastAddedMediaSingleFileIds is empty exit because there are no added media single nodes to be selected
|
|
599
607
|
if (this.lastAddedMediaSingleFileIds.length !== 0) {
|
|
600
608
|
this.waitForPendingTasks().then(() => {
|
|
@@ -859,6 +867,7 @@ export const createPlugin = (_schema, options, getIntl, pluginInjectionApi, node
|
|
|
859
867
|
const videoControls = videoControlsWrapperRef === null || videoControlsWrapperRef === void 0 ? void 0 : videoControlsWrapperRef.querySelectorAll('button, [tabindex]:not([tabindex="-1"])');
|
|
860
868
|
if (videoControls) {
|
|
861
869
|
const isVideoControl = Array.from(videoControls).some(videoControl => {
|
|
870
|
+
// eslint-disable-next-line @atlaskit/platform/no-direct-document-usage
|
|
862
871
|
return document.activeElement === videoControl;
|
|
863
872
|
});
|
|
864
873
|
if (isVideoControl) {
|
|
@@ -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
|
@@ -2,10 +2,10 @@ import React, { useMemo } from 'react';
|
|
|
2
2
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
|
|
3
3
|
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
4
4
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
5
|
+
import { areToolbarFlagsEnabled } from '@atlaskit/editor-common/toolbar-flag-check';
|
|
5
6
|
import { NodeSelection, PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
6
7
|
import { getMediaFeatureFlag } from '@atlaskit/media-common';
|
|
7
8
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
8
|
-
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
9
9
|
import { lazyMediaView } from './nodeviews/lazy-media';
|
|
10
10
|
import { lazyMediaGroupView } from './nodeviews/lazy-media-group';
|
|
11
11
|
import { lazyMediaInlineView } from './nodeviews/lazy-media-inline';
|
|
@@ -269,7 +269,7 @@ export var mediaPlugin = function mediaPlugin(_ref3) {
|
|
|
269
269
|
}
|
|
270
270
|
});
|
|
271
271
|
}
|
|
272
|
-
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) {
|
|
273
273
|
pmPlugins.push({
|
|
274
274
|
name: 'mediaPixelResizing',
|
|
275
275
|
plugin: createMediaPixelResizingPlugin
|
|
@@ -117,7 +117,8 @@ var MediaNodeView = /*#__PURE__*/function (_SelectionBasedNodeVi) {
|
|
|
117
117
|
contextIdentifierProvider: contextIdentifierProvider,
|
|
118
118
|
mediaOptions: mediaOptions,
|
|
119
119
|
onExternalImageLoaded: _this.onExternalImageLoaded,
|
|
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'
|
|
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
|
|
121
122
|
});
|
|
122
123
|
};
|
|
123
124
|
});
|
|
@@ -12,6 +12,7 @@ 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';
|
|
@@ -57,13 +58,14 @@ export var MediaNode = /*#__PURE__*/function (_Component) {
|
|
|
57
58
|
}, _callee);
|
|
58
59
|
})));
|
|
59
60
|
_defineProperty(_this, "selectMediaSingleFromCard", function (_ref2) {
|
|
61
|
+
var _this$props$pluginInj;
|
|
60
62
|
var event = _ref2.event;
|
|
61
63
|
_this.selectMediaSingle(event);
|
|
62
64
|
|
|
63
65
|
// In edit mode (node content wrapper has contenteditable set to true), link redirection is disabled by default
|
|
64
66
|
// We need to call "stopPropagation" here in order to prevent in editor view mode, the browser from navigating to
|
|
65
67
|
// another URL if the media node is wrapped in a link mark.
|
|
66
|
-
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))) {
|
|
67
69
|
event.preventDefault();
|
|
68
70
|
}
|
|
69
71
|
});
|
|
@@ -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,
|
|
@@ -42,6 +42,7 @@ export var MEDIA_CONTENT_WRAP_CLASS_NAME = 'media-content-wrap';
|
|
|
42
42
|
export var MEDIA_PLUGIN_IS_RESIZING_KEY = 'mediaSinglePlugin.isResizing';
|
|
43
43
|
export var MEDIA_PLUGIN_RESIZING_WIDTH_KEY = 'mediaSinglePlugin.resizing-width';
|
|
44
44
|
var createDropPlaceholder = function createDropPlaceholder(intl, nodeViewPortalProviderAPI, dropPlaceholderKey, allowDropLine) {
|
|
45
|
+
// eslint-disable-next-line @atlaskit/platform/no-direct-document-usage
|
|
45
46
|
var dropPlaceholder = document.createElement('div');
|
|
46
47
|
var createElement = React.createElement;
|
|
47
48
|
if (allowDropLine) {
|
|
@@ -662,7 +663,14 @@ export var MediaPluginStateImplementation = /*#__PURE__*/function () {
|
|
|
662
663
|
}, {
|
|
663
664
|
key: "selectLastAddedMediaNode",
|
|
664
665
|
value: function selectLastAddedMediaNode() {
|
|
665
|
-
var
|
|
666
|
+
var _this$mediaOptions5,
|
|
667
|
+
_this2 = this;
|
|
668
|
+
// if preventAutoFocusOnUpload is enabled, skip auto-selection and just clear the tracking array
|
|
669
|
+
if ((_this$mediaOptions5 = this.mediaOptions) !== null && _this$mediaOptions5 !== void 0 && _this$mediaOptions5.preventAutoFocusOnUpload && fg('jira_kuro-jjj_disable_auto_focus_after_img_upload')) {
|
|
670
|
+
this.lastAddedMediaSingleFileIds = [];
|
|
671
|
+
return;
|
|
672
|
+
}
|
|
673
|
+
|
|
666
674
|
// if lastAddedMediaSingleFileIds is empty exit because there are no added media single nodes to be selected
|
|
667
675
|
if (this.lastAddedMediaSingleFileIds.length !== 0) {
|
|
668
676
|
this.waitForPendingTasks().then(function () {
|
|
@@ -961,6 +969,7 @@ export var createPlugin = function createPlugin(_schema, options, getIntl, plugi
|
|
|
961
969
|
var videoControls = videoControlsWrapperRef === null || videoControlsWrapperRef === void 0 ? void 0 : videoControlsWrapperRef.querySelectorAll('button, [tabindex]:not([tabindex="-1"])');
|
|
962
970
|
if (videoControls) {
|
|
963
971
|
var isVideoControl = Array.from(videoControls).some(function (videoControl) {
|
|
972
|
+
// eslint-disable-next-line @atlaskit/platform/no-direct-document-usage
|
|
964
973
|
return document.activeElement === videoControl;
|
|
965
974
|
});
|
|
966
975
|
if (isVideoControl) {
|
|
@@ -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,
|
|
@@ -24,6 +24,7 @@ export interface MediaNodeProps extends ReactNodeProps, ImageLoaderProps {
|
|
|
24
24
|
node: PMNode;
|
|
25
25
|
onClick?: CardOnClickCallback;
|
|
26
26
|
originalDimensions: NumericalCardDimensions;
|
|
27
|
+
pluginInjectionApi: ExtractInjectionAPI<MediaNextEditorPluginType> | undefined;
|
|
27
28
|
view: EditorView;
|
|
28
29
|
}
|
|
29
30
|
interface MediaNodeState {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { jsx } from '@emotion/react';
|
|
2
2
|
import type { PixelEntryComponentNextProps, PixelEntryProps } from './types';
|
|
3
|
-
export declare const PixelEntryComponent: ({ width, mediaWidth, mediaHeight, onSubmit, minWidth, maxWidth, onChange, intl: { formatMessage }, showMigration, onMigrate, onCloseAndSave, isViewMode, }: PixelEntryProps) => jsx.JSX.Element;
|
|
3
|
+
export declare const PixelEntryComponent: ({ width, mediaWidth, mediaHeight, onSubmit, minWidth, maxWidth, onChange, intl: { formatMessage }, showMigration, onMigrate, onCloseAndSave, isViewMode, areAnyNewToolbarFlagsEnabled, }: PixelEntryProps) => jsx.JSX.Element;
|
|
4
4
|
export declare const PixelEntryComponentNext: ({ maxWidth, formatMessage, handleFieldChange, computedWidth, computedHeight, handleCloseAndSave, isViewMode, }: PixelEntryComponentNextProps) => jsx.JSX.Element;
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import type { ChangeEvent } from 'react';
|
|
2
2
|
import type { IntlShape } from 'react-intl-next';
|
|
3
3
|
export type PixelEntryProps = {
|
|
4
|
+
/**
|
|
5
|
+
* Whether the new toolbar flags are enabled
|
|
6
|
+
*/
|
|
7
|
+
areAnyNewToolbarFlagsEnabled?: boolean;
|
|
4
8
|
/**
|
|
5
9
|
* IntlShape passed in for translations
|
|
6
10
|
*/
|
|
@@ -40,6 +40,12 @@ export interface MediaPluginOptions {
|
|
|
40
40
|
allowResizing?: boolean;
|
|
41
41
|
allowResizingInTables?: boolean;
|
|
42
42
|
allowTemplatePlaceholders?: boolean | PlaceholderTextOptions;
|
|
43
|
+
/**
|
|
44
|
+
* When enabled, prevents automatic focus/selection of media nodes after upload completion.
|
|
45
|
+
* The existing focus will be preserved instead of switching to the uploaded media.
|
|
46
|
+
* @default false
|
|
47
|
+
*/
|
|
48
|
+
preventAutoFocusOnUpload?: boolean;
|
|
43
49
|
altTextValidator?: (value: string) => string[];
|
|
44
50
|
customDropzoneContainer?: HTMLElement;
|
|
45
51
|
customMediaPicker?: CustomMediaPicker;
|
|
@@ -24,6 +24,7 @@ export interface MediaNodeProps extends ReactNodeProps, ImageLoaderProps {
|
|
|
24
24
|
node: PMNode;
|
|
25
25
|
onClick?: CardOnClickCallback;
|
|
26
26
|
originalDimensions: NumericalCardDimensions;
|
|
27
|
+
pluginInjectionApi: ExtractInjectionAPI<MediaNextEditorPluginType> | undefined;
|
|
27
28
|
view: EditorView;
|
|
28
29
|
}
|
|
29
30
|
interface MediaNodeState {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { jsx } from '@emotion/react';
|
|
2
2
|
import type { PixelEntryComponentNextProps, PixelEntryProps } from './types';
|
|
3
|
-
export declare const PixelEntryComponent: ({ width, mediaWidth, mediaHeight, onSubmit, minWidth, maxWidth, onChange, intl: { formatMessage }, showMigration, onMigrate, onCloseAndSave, isViewMode, }: PixelEntryProps) => jsx.JSX.Element;
|
|
3
|
+
export declare const PixelEntryComponent: ({ width, mediaWidth, mediaHeight, onSubmit, minWidth, maxWidth, onChange, intl: { formatMessage }, showMigration, onMigrate, onCloseAndSave, isViewMode, areAnyNewToolbarFlagsEnabled, }: PixelEntryProps) => jsx.JSX.Element;
|
|
4
4
|
export declare const PixelEntryComponentNext: ({ maxWidth, formatMessage, handleFieldChange, computedWidth, computedHeight, handleCloseAndSave, isViewMode, }: PixelEntryComponentNextProps) => jsx.JSX.Element;
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import type { ChangeEvent } from 'react';
|
|
2
2
|
import type { IntlShape } from 'react-intl-next';
|
|
3
3
|
export type PixelEntryProps = {
|
|
4
|
+
/**
|
|
5
|
+
* Whether the new toolbar flags are enabled
|
|
6
|
+
*/
|
|
7
|
+
areAnyNewToolbarFlagsEnabled?: boolean;
|
|
4
8
|
/**
|
|
5
9
|
* IntlShape passed in for translations
|
|
6
10
|
*/
|
|
@@ -40,6 +40,12 @@ export interface MediaPluginOptions {
|
|
|
40
40
|
allowResizing?: boolean;
|
|
41
41
|
allowResizingInTables?: boolean;
|
|
42
42
|
allowTemplatePlaceholders?: boolean | PlaceholderTextOptions;
|
|
43
|
+
/**
|
|
44
|
+
* When enabled, prevents automatic focus/selection of media nodes after upload completion.
|
|
45
|
+
* The existing focus will be preserved instead of switching to the uploaded media.
|
|
46
|
+
* @default false
|
|
47
|
+
*/
|
|
48
|
+
preventAutoFocusOnUpload?: boolean;
|
|
43
49
|
altTextValidator?: (value: string) => string[];
|
|
44
50
|
customDropzoneContainer?: HTMLElement;
|
|
45
51
|
customMediaPicker?: CustomMediaPicker;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-media",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.4.0",
|
|
4
4
|
"description": "Media plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
"@atlaskit/primitives": "^16.0.0",
|
|
67
67
|
"@atlaskit/textfield": "^8.0.0",
|
|
68
68
|
"@atlaskit/theme": "^21.0.0",
|
|
69
|
-
"@atlaskit/tmp-editor-statsig": "^13.
|
|
69
|
+
"@atlaskit/tmp-editor-statsig": "^13.18.0",
|
|
70
70
|
"@atlaskit/tokens": "^7.0.0",
|
|
71
71
|
"@atlaskit/tooltip": "^20.6.0",
|
|
72
72
|
"@babel/runtime": "^7.0.0",
|
|
@@ -78,7 +78,7 @@
|
|
|
78
78
|
"uuid": "^3.1.0"
|
|
79
79
|
},
|
|
80
80
|
"peerDependencies": {
|
|
81
|
-
"@atlaskit/editor-common": "^110.
|
|
81
|
+
"@atlaskit/editor-common": "^110.17.0",
|
|
82
82
|
"@atlaskit/media-core": "^37.0.0",
|
|
83
83
|
"react": "^18.2.0",
|
|
84
84
|
"react-dom": "^18.2.0",
|
|
@@ -162,6 +162,9 @@
|
|
|
162
162
|
},
|
|
163
163
|
"platform_editor_fix_media_card_removal": {
|
|
164
164
|
"type": "boolean"
|
|
165
|
+
},
|
|
166
|
+
"jira_kuro-jjj_disable_auto_focus_after_img_upload": {
|
|
167
|
+
"type": "boolean"
|
|
165
168
|
}
|
|
166
169
|
},
|
|
167
170
|
"stricter": {
|