@atlaskit/editor-plugin-media 3.0.1 → 3.0.3
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 +16 -0
- package/dist/cjs/mediaPlugin.js +2 -1
- package/dist/cjs/pm-plugins/alt-text/ui/AltTextEdit.js +21 -10
- package/dist/cjs/pm-plugins/pixel-resizing/ui/index.js +15 -4
- package/dist/cjs/pm-plugins/pixel-resizing/ui/pixel-entry.js +7 -4
- package/dist/cjs/ui/MediaLinkingToolbar.js +20 -5
- package/dist/cjs/ui/toolbar/alt-text.js +7 -3
- package/dist/cjs/ui/toolbar/comments.js +7 -2
- package/dist/cjs/ui/toolbar/index.js +15 -6
- package/dist/cjs/ui/toolbar/linking.js +20 -5
- package/dist/cjs/ui/toolbar/pixel-resizing.js +4 -2
- package/dist/es2019/mediaPlugin.js +2 -1
- package/dist/es2019/pm-plugins/alt-text/ui/AltTextEdit.js +14 -3
- package/dist/es2019/pm-plugins/pixel-resizing/ui/index.js +17 -6
- package/dist/es2019/pm-plugins/pixel-resizing/ui/pixel-entry.js +7 -4
- package/dist/es2019/ui/MediaLinkingToolbar.js +19 -6
- package/dist/es2019/ui/toolbar/alt-text.js +7 -3
- package/dist/es2019/ui/toolbar/comments.js +7 -2
- package/dist/es2019/ui/toolbar/index.js +14 -5
- package/dist/es2019/ui/toolbar/linking.js +24 -5
- package/dist/es2019/ui/toolbar/pixel-resizing.js +4 -2
- package/dist/esm/mediaPlugin.js +2 -1
- package/dist/esm/pm-plugins/alt-text/ui/AltTextEdit.js +21 -10
- package/dist/esm/pm-plugins/pixel-resizing/ui/index.js +15 -4
- package/dist/esm/pm-plugins/pixel-resizing/ui/pixel-entry.js +7 -4
- package/dist/esm/ui/MediaLinkingToolbar.js +20 -5
- package/dist/esm/ui/toolbar/alt-text.js +7 -3
- package/dist/esm/ui/toolbar/comments.js +7 -2
- package/dist/esm/ui/toolbar/index.js +14 -5
- package/dist/esm/ui/toolbar/linking.js +20 -5
- package/dist/esm/ui/toolbar/pixel-resizing.js +4 -2
- package/dist/types/pm-plugins/alt-text/ui/AltTextEdit.d.ts +2 -0
- package/dist/types/pm-plugins/pixel-resizing/ui/index.d.ts +2 -1
- package/dist/types/pm-plugins/pixel-resizing/ui/types.d.ts +7 -2
- package/dist/types/types/index.d.ts +2 -0
- package/dist/types/ui/MediaLinkingToolbar.d.ts +3 -3
- package/dist/types/ui/toolbar/alt-text.d.ts +1 -0
- package/dist/types/ui/toolbar/comments.d.ts +1 -1
- package/dist/types/ui/toolbar/index.d.ts +1 -0
- package/dist/types/ui/toolbar/pixel-resizing.d.ts +1 -1
- package/dist/types-ts4.5/pm-plugins/alt-text/ui/AltTextEdit.d.ts +2 -0
- package/dist/types-ts4.5/pm-plugins/pixel-resizing/ui/index.d.ts +2 -1
- package/dist/types-ts4.5/pm-plugins/pixel-resizing/ui/types.d.ts +7 -2
- package/dist/types-ts4.5/types/index.d.ts +2 -0
- package/dist/types-ts4.5/ui/MediaLinkingToolbar.d.ts +3 -3
- package/dist/types-ts4.5/ui/toolbar/alt-text.d.ts +1 -0
- package/dist/types-ts4.5/ui/toolbar/comments.d.ts +1 -1
- package/dist/types-ts4.5/ui/toolbar/index.d.ts +1 -0
- package/dist/types-ts4.5/ui/toolbar/pixel-resizing.d.ts +1 -1
- package/package.json +11 -5
|
@@ -11,6 +11,7 @@ import { IconButton } from '@atlaskit/button/new';
|
|
|
11
11
|
import { pixelEntryMessages as messages } from '@atlaskit/editor-common/media';
|
|
12
12
|
import Form, { Field } from '@atlaskit/form';
|
|
13
13
|
import CloseIcon from '@atlaskit/icon/core/close';
|
|
14
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
14
15
|
import { Inline, Box, Text, xcss } from '@atlaskit/primitives';
|
|
15
16
|
import Textfield from '@atlaskit/textfield';
|
|
16
17
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
@@ -84,7 +85,7 @@ export const PixelEntryComponent = ({
|
|
|
84
85
|
};
|
|
85
86
|
|
|
86
87
|
// Handle submit when user presses enter or click close button in PixelEntryComponentNext
|
|
87
|
-
const handleCloseAndSave = useCallback(data => {
|
|
88
|
+
const handleCloseAndSave = useCallback((data, setFocus) => {
|
|
88
89
|
if (data.inputWidth === '' || data.inputHeight === '') {
|
|
89
90
|
return;
|
|
90
91
|
}
|
|
@@ -110,7 +111,7 @@ export const PixelEntryComponent = ({
|
|
|
110
111
|
onCloseAndSave({
|
|
111
112
|
width: widthToBeSubmitted,
|
|
112
113
|
validation
|
|
113
|
-
});
|
|
114
|
+
}, setFocus);
|
|
114
115
|
}
|
|
115
116
|
}, [maxWidth, minWidth, onCloseAndSave, ratioWidth]);
|
|
116
117
|
|
|
@@ -274,10 +275,11 @@ export const PixelEntryComponentNext = ({
|
|
|
274
275
|
}, [isViewMode, widthInputRef]);
|
|
275
276
|
const handleKeyDown = useCallback(event => {
|
|
276
277
|
if (event.key === 'Enter') {
|
|
278
|
+
const shouldSetFocus = true;
|
|
277
279
|
handleCloseAndSave({
|
|
278
280
|
inputWidth: computedWidth,
|
|
279
281
|
inputHeight: computedHeight
|
|
280
|
-
});
|
|
282
|
+
}, shouldSetFocus);
|
|
281
283
|
}
|
|
282
284
|
}, [computedWidth, computedHeight, handleCloseAndSave]);
|
|
283
285
|
return jsx(Box, {
|
|
@@ -344,6 +346,7 @@ export const PixelEntryComponentNext = ({
|
|
|
344
346
|
inputWidth: computedWidth,
|
|
345
347
|
inputHeight: computedHeight
|
|
346
348
|
});
|
|
347
|
-
}
|
|
349
|
+
},
|
|
350
|
+
onKeyDown: fg('platform_editor_controls_patch_8') ? handleKeyDown : undefined
|
|
348
351
|
}))));
|
|
349
352
|
};
|
|
@@ -50,14 +50,14 @@ class LinkAddToolbar extends React.PureComponent {
|
|
|
50
50
|
_defineProperty(this, "handleOnBack", ({
|
|
51
51
|
url,
|
|
52
52
|
inputMethod
|
|
53
|
-
}) => {
|
|
53
|
+
}, setFocus) => {
|
|
54
54
|
const {
|
|
55
55
|
onBack
|
|
56
56
|
} = this.props;
|
|
57
57
|
if (onBack) {
|
|
58
58
|
onBack(url, {
|
|
59
59
|
inputMethod
|
|
60
|
-
});
|
|
60
|
+
}, setFocus);
|
|
61
61
|
}
|
|
62
62
|
});
|
|
63
63
|
_defineProperty(this, "handleCancel", () => {
|
|
@@ -68,12 +68,12 @@ class LinkAddToolbar extends React.PureComponent {
|
|
|
68
68
|
onCancel();
|
|
69
69
|
}
|
|
70
70
|
});
|
|
71
|
-
_defineProperty(this, "handleUnlink",
|
|
71
|
+
_defineProperty(this, "handleUnlink", setFocus => {
|
|
72
72
|
const {
|
|
73
73
|
onUnlink
|
|
74
74
|
} = this.props;
|
|
75
75
|
if (onUnlink) {
|
|
76
|
-
onUnlink();
|
|
76
|
+
onUnlink(setFocus);
|
|
77
77
|
}
|
|
78
78
|
});
|
|
79
79
|
_defineProperty(this, "handleOnBlur", options => {
|
|
@@ -124,7 +124,15 @@ class LinkAddToolbar extends React.PureComponent {
|
|
|
124
124
|
onClick: () => this.handleOnBack({
|
|
125
125
|
url: value,
|
|
126
126
|
inputMethod: currentInputMethod
|
|
127
|
-
})
|
|
127
|
+
}),
|
|
128
|
+
onKeyDown: event => {
|
|
129
|
+
if (event.key === 'Enter') {
|
|
130
|
+
this.handleOnBack({
|
|
131
|
+
url: value,
|
|
132
|
+
inputMethod: currentInputMethod
|
|
133
|
+
}, true);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
128
136
|
})), jsx(PanelTextInput, {
|
|
129
137
|
inputId: "media-link-search-input",
|
|
130
138
|
testId: "media-link-input",
|
|
@@ -156,7 +164,12 @@ class LinkAddToolbar extends React.PureComponent {
|
|
|
156
164
|
icon: jsx(EditorUnlinkIcon, {
|
|
157
165
|
label: formatUnlinkText
|
|
158
166
|
}),
|
|
159
|
-
onClick: this.handleUnlink
|
|
167
|
+
onClick: () => this.handleUnlink(),
|
|
168
|
+
onKeyDown: event => {
|
|
169
|
+
if (event.key === 'Enter') {
|
|
170
|
+
this.handleUnlink(true);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
160
173
|
}))), !!errorsList.length && jsx("section", {
|
|
161
174
|
css: validationWrapper
|
|
162
175
|
}, errorsList), renderRecentList()))
|
|
@@ -5,6 +5,8 @@ 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 TextIcon from '@atlaskit/icon/core/text';
|
|
8
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
9
|
+
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
8
10
|
import { openMediaAltTextMenu } from '../../pm-plugins/alt-text/commands';
|
|
9
11
|
import AltTextEdit from '../../pm-plugins/alt-text/ui/AltTextEdit';
|
|
10
12
|
import { isImage } from '../../pm-plugins/utils/is-type';
|
|
@@ -45,7 +47,7 @@ const altTextEditComponent = options => {
|
|
|
45
47
|
/** Focus should move to the 'Alt text' button when the toolbar closes
|
|
46
48
|
* and not close the floating toolbar.
|
|
47
49
|
*/
|
|
48
|
-
const
|
|
50
|
+
const setFocus = () => {
|
|
49
51
|
var _options$forceFocusSe;
|
|
50
52
|
const {
|
|
51
53
|
state: {
|
|
@@ -53,7 +55,8 @@ const altTextEditComponent = options => {
|
|
|
53
55
|
},
|
|
54
56
|
dispatch
|
|
55
57
|
} = view;
|
|
56
|
-
const
|
|
58
|
+
const elementSelector = options !== null && options !== void 0 && options.triggerButtonSelector && editorExperiment('platform_editor_controls', 'variant1') && fg('platform_editor_controls_patch_8') ? options.triggerButtonSelector : `[data-testid="${testId}"]`;
|
|
59
|
+
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);
|
|
57
60
|
if (newTr) {
|
|
58
61
|
dispatch(newTr);
|
|
59
62
|
}
|
|
@@ -66,7 +69,8 @@ const altTextEditComponent = options => {
|
|
|
66
69
|
mediaType: mediaNode.attrs.type,
|
|
67
70
|
value: mediaNode.attrs.alt,
|
|
68
71
|
altTextValidator: options && options.altTextValidator,
|
|
69
|
-
onEscape:
|
|
72
|
+
onEscape: setFocus,
|
|
73
|
+
onEnter: setFocus
|
|
70
74
|
});
|
|
71
75
|
}
|
|
72
76
|
};
|
|
@@ -8,7 +8,7 @@ import { fg } from '@atlaskit/platform-feature-flags';
|
|
|
8
8
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
9
9
|
import { CommentWithDotIcon } from './assets/commentWithDotIcon';
|
|
10
10
|
import { getSelectedMediaSingle } from './utils';
|
|
11
|
-
export const commentButton = (intl, state, api) => {
|
|
11
|
+
export const commentButton = (intl, state, api, onCommentButtonMount) => {
|
|
12
12
|
var _getSelectedMediaSing, _api$annotation, _api$annotation$share, _api$connectivity, _api$connectivity$sha, _api$connectivity$sha2;
|
|
13
13
|
const selectMediaNode = (_getSelectedMediaSing = getSelectedMediaSingle(state)) === null || _getSelectedMediaSing === void 0 ? void 0 : _getSelectedMediaSing.node.firstChild;
|
|
14
14
|
let hasActiveComments = false;
|
|
@@ -46,6 +46,11 @@ export const commentButton = (intl, state, api) => {
|
|
|
46
46
|
description: title
|
|
47
47
|
}),
|
|
48
48
|
supportsViewMode: true,
|
|
49
|
-
disabled: (api === null || api === void 0 ? void 0 : (_api$connectivity = api.connectivity) === null || _api$connectivity === void 0 ? void 0 : (_api$connectivity$sha = _api$connectivity.sharedState) === null || _api$connectivity$sha === void 0 ? void 0 : (_api$connectivity$sha2 = _api$connectivity$sha.currentState()) === null || _api$connectivity$sha2 === void 0 ? void 0 : _api$connectivity$sha2.mode) === 'offline'
|
|
49
|
+
disabled: (api === null || api === void 0 ? void 0 : (_api$connectivity = api.connectivity) === null || _api$connectivity === void 0 ? void 0 : (_api$connectivity$sha = _api$connectivity.sharedState) === null || _api$connectivity$sha === void 0 ? void 0 : (_api$connectivity$sha2 = _api$connectivity$sha.currentState()) === null || _api$connectivity$sha2 === void 0 ? void 0 : _api$connectivity$sha2.mode) === 'offline',
|
|
50
|
+
onMount: () => {
|
|
51
|
+
if (fg('confluence_frontend_preload_inline_comment_editor')) {
|
|
52
|
+
onCommentButtonMount && onCommentButtonMount();
|
|
53
|
+
}
|
|
54
|
+
}
|
|
50
55
|
};
|
|
51
56
|
};
|
|
@@ -266,7 +266,8 @@ const generateMediaSingleFloatingToolbar = (state, intl, options, pluginState, m
|
|
|
266
266
|
allowMediaInlineImages,
|
|
267
267
|
allowImagePreview,
|
|
268
268
|
isViewOnly,
|
|
269
|
-
allowPixelResizing
|
|
269
|
+
allowPixelResizing,
|
|
270
|
+
onCommentButtonMount
|
|
270
271
|
} = options;
|
|
271
272
|
let toolbarButtons = [];
|
|
272
273
|
const {
|
|
@@ -538,7 +539,7 @@ const generateMediaSingleFloatingToolbar = (state, intl, options, pluginState, m
|
|
|
538
539
|
}
|
|
539
540
|
if (!isEditorControlsEnabled) {
|
|
540
541
|
if (allowCommentsOnMedia) {
|
|
541
|
-
toolbarButtons.push(commentButton(intl, state, pluginInjectionApi), {
|
|
542
|
+
toolbarButtons.push(commentButton(intl, state, pluginInjectionApi, onCommentButtonMount), {
|
|
542
543
|
type: 'separator',
|
|
543
544
|
supportsViewMode: true
|
|
544
545
|
});
|
|
@@ -731,7 +732,7 @@ const generateMediaSingleFloatingToolbar = (state, intl, options, pluginState, m
|
|
|
731
732
|
});
|
|
732
733
|
if (allowAdvancedToolBarOptions && allowCommentsOnMedia) {
|
|
733
734
|
updateToFullHeightSeparator(toolbarButtons);
|
|
734
|
-
toolbarButtons.push(commentButton(intl, state, pluginInjectionApi));
|
|
735
|
+
toolbarButtons.push(commentButton(intl, state, pluginInjectionApi, onCommentButtonMount));
|
|
735
736
|
}
|
|
736
737
|
return toolbarButtons;
|
|
737
738
|
}
|
|
@@ -740,6 +741,7 @@ const getMediaTypeMessage = selectedNodeTypeSingle => {
|
|
|
740
741
|
const mediaType = Object.keys(mediaTypeMessages).find(key => selectedNodeTypeSingle === null || selectedNodeTypeSingle === void 0 ? void 0 : selectedNodeTypeSingle.includes(key));
|
|
741
742
|
return mediaType ? mediaTypeMessages[mediaType] : messages.file_unknown_is_selected;
|
|
742
743
|
};
|
|
744
|
+
export const overflowDropdwonBtnTriggerTestId = 'media-overflow-dropdown-trigger';
|
|
743
745
|
export const floatingToolbar = (state, intl, options = {}, pluginInjectionApi) => {
|
|
744
746
|
var _pluginInjectionApi$d3, _pluginInjectionApi$d4;
|
|
745
747
|
const {
|
|
@@ -789,13 +791,18 @@ export const floatingToolbar = (state, intl, options = {}, pluginInjectionApi) =
|
|
|
789
791
|
return linkingToolbar;
|
|
790
792
|
}
|
|
791
793
|
}
|
|
794
|
+
|
|
795
|
+
// testId is required to show focus on trigger button on ESC key press
|
|
796
|
+
// see hideOnEsc in platform/packages/editor/editor-plugin-floating-toolbar/src/ui/Dropdown.tsx
|
|
797
|
+
const overflowButtonSelector = editorExperiment('platform_editor_controls', 'variant1') && fg('platform_editor_controls_patch_8') ? `[data-testid="${overflowDropdwonBtnTriggerTestId}"]` : undefined;
|
|
792
798
|
if (allowAltTextOnImages) {
|
|
793
799
|
const mediaAltTextPluginState = getMediaAltTextPluginState(state);
|
|
794
800
|
if (mediaAltTextPluginState.isAltTextEditorOpen) {
|
|
795
801
|
var _pluginInjectionApi$f, _pluginInjectionApi$f2;
|
|
796
802
|
return getAltTextToolbar(baseToolbar, {
|
|
797
803
|
altTextValidator,
|
|
798
|
-
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
|
|
804
|
+
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,
|
|
805
|
+
triggerButtonSelector: overflowButtonSelector
|
|
799
806
|
});
|
|
800
807
|
}
|
|
801
808
|
}
|
|
@@ -811,7 +818,8 @@ export const floatingToolbar = (state, intl, options = {}, pluginInjectionApi) =
|
|
|
811
818
|
pluginInjectionApi,
|
|
812
819
|
pluginState: mediaPluginState,
|
|
813
820
|
hoverDecoration,
|
|
814
|
-
isEditorFullWidthEnabled: options.fullWidthEnabled
|
|
821
|
+
isEditorFullWidthEnabled: options.fullWidthEnabled,
|
|
822
|
+
triggerButtonSelector: overflowButtonSelector
|
|
815
823
|
});
|
|
816
824
|
}
|
|
817
825
|
}
|
|
@@ -862,6 +870,7 @@ export const floatingToolbar = (state, intl, options = {}, pluginInjectionApi) =
|
|
|
862
870
|
items.push({
|
|
863
871
|
type: 'overflow-dropdown',
|
|
864
872
|
id: 'media',
|
|
873
|
+
testId: overflowDropdwonBtnTriggerTestId,
|
|
865
874
|
options: [...customOptions, {
|
|
866
875
|
title: intl === null || intl === void 0 ? void 0 : intl.formatMessage(commonMessages.copyToClipboard),
|
|
867
876
|
onClick: () => {
|
|
@@ -6,11 +6,13 @@ import { RECENT_SEARCH_HEIGHT_IN_PX, RECENT_SEARCH_WIDTH_IN_PX } from '@atlaskit
|
|
|
6
6
|
import LinkIcon from '@atlaskit/icon/core/link';
|
|
7
7
|
import LinkExternalIcon from '@atlaskit/icon/core/link-external';
|
|
8
8
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
9
|
+
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
9
10
|
import { hideLinkingToolbar, setUrlToMedia, showLinkingToolbar, unlink } from '../../pm-plugins/commands/linking';
|
|
10
11
|
import { getMediaLinkingState } from '../../pm-plugins/linking';
|
|
11
12
|
import { currentMediaInlineNode, currentMediaNode } from '../../pm-plugins/utils/current-media-node';
|
|
12
13
|
import MediaLinkingToolbar from '../../ui/MediaLinkingToolbar';
|
|
13
14
|
const FORCE_FOCUS_SELECTOR = '[data-testid="add-link-button"],[data-testid="edit-link-button"]';
|
|
15
|
+
const FORCE_FOCUS_SELECTOR_EDITOR_CONTROLS = '[data-testid="media-overflow-dropdown-trigger"]';
|
|
14
16
|
export function shouldShowMediaLinkToolbar(editorState) {
|
|
15
17
|
const mediaLinkingState = getMediaLinkingState(editorState);
|
|
16
18
|
if (!mediaLinkingState || mediaLinkingState.mediaPos === null) {
|
|
@@ -57,25 +59,40 @@ export const getLinkingToolbar = (toolbarBaseConfig, mediaLinkingState, state, i
|
|
|
57
59
|
if (!view || !providerFactory) {
|
|
58
60
|
return null;
|
|
59
61
|
}
|
|
62
|
+
const setFocusOnFloatingToolbar = setFocus => {
|
|
63
|
+
if (setFocus && editorExperiment('platform_editor_controls', 'variant1') && fg('platform_editor_controls_patch_8')) {
|
|
64
|
+
var _pluginInjectionApi$f, _pluginInjectionApi$f2;
|
|
65
|
+
const {
|
|
66
|
+
state: {
|
|
67
|
+
tr
|
|
68
|
+
},
|
|
69
|
+
dispatch
|
|
70
|
+
} = view;
|
|
71
|
+
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(FORCE_FOCUS_SELECTOR_EDITOR_CONTROLS)(tr);
|
|
72
|
+
dispatch(tr);
|
|
73
|
+
}
|
|
74
|
+
};
|
|
60
75
|
return /*#__PURE__*/React.createElement(MediaLinkingToolbar, {
|
|
61
76
|
key: idx,
|
|
62
77
|
displayUrl: link,
|
|
63
78
|
providerFactory: providerFactory,
|
|
64
79
|
intl: intl,
|
|
65
80
|
editing: editing,
|
|
66
|
-
onUnlink:
|
|
81
|
+
onUnlink: setFocus => {
|
|
67
82
|
var _pluginInjectionApi$a;
|
|
68
|
-
|
|
83
|
+
unlink(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions)(view.state, view.dispatch, view);
|
|
84
|
+
setFocusOnFloatingToolbar(setFocus);
|
|
69
85
|
},
|
|
70
|
-
onBack: (href, meta) => {
|
|
86
|
+
onBack: (href, meta, setFocus) => {
|
|
71
87
|
if (href.trim() && meta.inputMethod) {
|
|
72
88
|
var _pluginInjectionApi$a2;
|
|
73
89
|
setUrlToMedia(href, meta.inputMethod, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a2 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a2 === void 0 ? void 0 : _pluginInjectionApi$a2.actions)(view.state, view.dispatch, view);
|
|
74
90
|
}
|
|
75
91
|
hideLinkingToolbar(view.state, view.dispatch, view);
|
|
92
|
+
setFocusOnFloatingToolbar(setFocus);
|
|
76
93
|
},
|
|
77
94
|
onCancel: () => {
|
|
78
|
-
var _pluginInjectionApi$
|
|
95
|
+
var _pluginInjectionApi$f3, _pluginInjectionApi$f4;
|
|
79
96
|
hideLinkingToolbar(view.state, view.dispatch, view, true);
|
|
80
97
|
/** Focus should move to the 'Add link' button when the toolbar closes
|
|
81
98
|
* and not close the floating toolbar.
|
|
@@ -86,13 +103,15 @@ export const getLinkingToolbar = (toolbarBaseConfig, mediaLinkingState, state, i
|
|
|
86
103
|
},
|
|
87
104
|
dispatch
|
|
88
105
|
} = view;
|
|
89
|
-
|
|
106
|
+
const selector = editorExperiment('platform_editor_controls', 'variant1') && fg('platform_editor_controls_patch_8') ? FORCE_FOCUS_SELECTOR_EDITOR_CONTROLS : FORCE_FOCUS_SELECTOR;
|
|
107
|
+
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);
|
|
90
108
|
dispatch(tr);
|
|
91
109
|
},
|
|
92
110
|
onSubmit: (href, meta) => {
|
|
93
111
|
var _pluginInjectionApi$a3;
|
|
94
112
|
setUrlToMedia(href, meta.inputMethod, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a3 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a3 === void 0 ? void 0 : _pluginInjectionApi$a3.actions)(view.state, view.dispatch, view);
|
|
95
113
|
hideLinkingToolbar(view.state, view.dispatch, view);
|
|
114
|
+
setFocusOnFloatingToolbar(true);
|
|
96
115
|
},
|
|
97
116
|
onBlur: () => {
|
|
98
117
|
hideLinkingToolbar(view.state, view.dispatch, view);
|
|
@@ -13,7 +13,8 @@ export const getPixelResizingToolbar = (toolbarBaseConfig, {
|
|
|
13
13
|
intl,
|
|
14
14
|
pluginState,
|
|
15
15
|
hoverDecoration,
|
|
16
|
-
isEditorFullWidthEnabled
|
|
16
|
+
isEditorFullWidthEnabled,
|
|
17
|
+
triggerButtonSelector
|
|
17
18
|
}) => ({
|
|
18
19
|
...toolbarBaseConfig,
|
|
19
20
|
width: PIXEL_RESIZING_TOOLBAR_WIDTH,
|
|
@@ -36,7 +37,8 @@ export const getPixelResizingToolbar = (toolbarBaseConfig, {
|
|
|
36
37
|
pluginInjectionApi: pluginInjectionApi,
|
|
37
38
|
pluginState: pluginState,
|
|
38
39
|
hoverDecoration: hoverDecoration,
|
|
39
|
-
isEditorFullWidthEnabled: isEditorFullWidthEnabled
|
|
40
|
+
isEditorFullWidthEnabled: isEditorFullWidthEnabled,
|
|
41
|
+
triggerButtonSelector: triggerButtonSelector
|
|
40
42
|
});
|
|
41
43
|
}
|
|
42
44
|
}]
|
package/dist/esm/mediaPlugin.js
CHANGED
|
@@ -356,7 +356,8 @@ export var mediaPlugin = function mediaPlugin(_ref3) {
|
|
|
356
356
|
fullWidthEnabled: options && options.fullWidthEnabled,
|
|
357
357
|
allowMediaInlineImages: options && options.allowMediaInlineImages,
|
|
358
358
|
isViewOnly: (api === null || api === void 0 || (_api$editorViewMode = api.editorViewMode) === null || _api$editorViewMode === void 0 || (_api$editorViewMode = _api$editorViewMode.sharedState.currentState()) === null || _api$editorViewMode === void 0 ? void 0 : _api$editorViewMode.mode) === 'view',
|
|
359
|
-
allowPixelResizing: options === null || options === void 0 ? void 0 : options.allowPixelResizing
|
|
359
|
+
allowPixelResizing: options === null || options === void 0 ? void 0 : options.allowPixelResizing,
|
|
360
|
+
onCommentButtonMount: options === null || options === void 0 ? void 0 : options.onCommentButtonMount
|
|
360
361
|
}, api);
|
|
361
362
|
}
|
|
362
363
|
}
|
|
@@ -24,7 +24,9 @@ import { RECENT_SEARCH_WIDTH_IN_PX as CONTAINER_WIDTH_IN_PX, FloatingToolbarButt
|
|
|
24
24
|
import { relativeFontSizeToBase16 } from '@atlaskit/editor-shared-styles';
|
|
25
25
|
import CrossCircleIcon from '@atlaskit/icon/core/migration/cross-circle';
|
|
26
26
|
import ChevronLeftLargeIcon from '@atlaskit/icon/utility/migration/chevron-left--chevron-left-large';
|
|
27
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
27
28
|
import { N200, N30, N80, R400 } from '@atlaskit/theme/colors';
|
|
29
|
+
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
28
30
|
import { closeMediaAltTextMenu, closeMediaAltTextMenuAndSave } from '../commands';
|
|
29
31
|
export var MAX_ALT_TEXT_LENGTH = 510; // double tweet length
|
|
30
32
|
|
|
@@ -90,11 +92,15 @@ export var AltTextEditComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
90
92
|
closeMediaAltTextMenu(view.state, view.dispatch);
|
|
91
93
|
}
|
|
92
94
|
});
|
|
95
|
+
_defineProperty(_this, "closeMediaAltTextMenuAndSetFocus", function () {
|
|
96
|
+
var _this$props$onEnter, _this$props;
|
|
97
|
+
_this.closeMediaAltTextMenu();
|
|
98
|
+
(_this$props$onEnter = (_this$props = _this.props).onEnter) === null || _this$props$onEnter === void 0 || _this$props$onEnter.call(_this$props);
|
|
99
|
+
});
|
|
93
100
|
_defineProperty(_this, "dispatchCancelEvent", function (event) {
|
|
94
|
-
var _this$
|
|
95
|
-
view = _this$
|
|
96
|
-
onEscape = _this$
|
|
97
|
-
|
|
101
|
+
var _this$props2 = _this.props,
|
|
102
|
+
view = _this$props2.view,
|
|
103
|
+
onEscape = _this$props2.onEscape;
|
|
98
104
|
// We need to pass down the ESCAPE keymap
|
|
99
105
|
// because when we focus on the Toolbar, Prosemirror blur,
|
|
100
106
|
// making all keyboard shortcuts not working
|
|
@@ -127,7 +133,11 @@ export var AltTextEditComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
127
133
|
_defineProperty(_this, "handleOnBlur", function (e) {
|
|
128
134
|
// prevent other selection transaction gets triggered
|
|
129
135
|
e.stopPropagation();
|
|
130
|
-
|
|
136
|
+
if (editorExperiment('platform_editor_controls', 'variant1') && fg('platform_editor_controls_patch_8')) {
|
|
137
|
+
_this.closeMediaAltTextMenuAndSetFocus();
|
|
138
|
+
} else {
|
|
139
|
+
_this.closeMediaAltTextMenu(); // Why do we close the menu on blur? Is it a bug?
|
|
140
|
+
}
|
|
131
141
|
});
|
|
132
142
|
_defineProperty(_this, "handleClearText", function () {
|
|
133
143
|
_this.handleOnChange('');
|
|
@@ -185,6 +195,7 @@ export var AltTextEditComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
185
195
|
}, error);
|
|
186
196
|
});
|
|
187
197
|
var hasErrors = !!errorsList.length;
|
|
198
|
+
var onSubmit = editorExperiment('platform_editor_controls', 'variant1') && fg('platform_editor_controls_patch_8') ? this.closeMediaAltTextMenuAndSetFocus : this.closeMediaAltTextMenu;
|
|
188
199
|
return jsx("div", {
|
|
189
200
|
css: containerStyles
|
|
190
201
|
}, jsx("section", {
|
|
@@ -207,7 +218,7 @@ export var AltTextEditComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
207
218
|
onCancel: this.dispatchCancelEvent,
|
|
208
219
|
onChange: this.handleOnChange,
|
|
209
220
|
onBlur: this.handleOnBlur,
|
|
210
|
-
onSubmit:
|
|
221
|
+
onSubmit: onSubmit,
|
|
211
222
|
maxLength: MAX_ALT_TEXT_LENGTH,
|
|
212
223
|
ariaRequired: true,
|
|
213
224
|
ariaInvalid: hasErrors,
|
|
@@ -237,10 +248,10 @@ export var AltTextEditComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
237
248
|
}, {
|
|
238
249
|
key: "fireAnalytics",
|
|
239
250
|
value: function fireAnalytics(actionType) {
|
|
240
|
-
var _this$
|
|
241
|
-
createAnalyticsEvent = _this$
|
|
242
|
-
nodeType = _this$
|
|
243
|
-
mediaType = _this$
|
|
251
|
+
var _this$props3 = this.props,
|
|
252
|
+
createAnalyticsEvent = _this$props3.createAnalyticsEvent,
|
|
253
|
+
nodeType = _this$props3.nodeType,
|
|
254
|
+
mediaType = _this$props3.mediaType;
|
|
244
255
|
if (createAnalyticsEvent && this.fireCustomAnalytics) {
|
|
245
256
|
this.fireCustomAnalytics({
|
|
246
257
|
payload: {
|
|
@@ -22,14 +22,15 @@ import { closePixelEditorAndSave } from '../commands';
|
|
|
22
22
|
import { PixelEntryComponent } from './pixel-entry';
|
|
23
23
|
import { pixelSizingFullWidthLabelStyles } from './styles';
|
|
24
24
|
export var PixelEntry = function PixelEntry(_ref) {
|
|
25
|
-
var _pluginInjectionApi$w, _pluginInjectionApi$m;
|
|
25
|
+
var _pluginInjectionApi$w, _pluginInjectionApi$m, _pluginInjectionApi$f;
|
|
26
26
|
var editorView = _ref.editorView,
|
|
27
27
|
selectedMediaSingleNode = _ref.selectedMediaSingleNode,
|
|
28
28
|
pluginInjectionApi = _ref.pluginInjectionApi,
|
|
29
29
|
intl = _ref.intl,
|
|
30
30
|
pluginState = _ref.pluginState,
|
|
31
31
|
hoverDecoration = _ref.hoverDecoration,
|
|
32
|
-
isEditorFullWidthEnabled = _ref.isEditorFullWidthEnabled
|
|
32
|
+
isEditorFullWidthEnabled = _ref.isEditorFullWidthEnabled,
|
|
33
|
+
triggerButtonSelector = _ref.triggerButtonSelector;
|
|
33
34
|
var state = editorView.state,
|
|
34
35
|
dispatch = editorView.dispatch;
|
|
35
36
|
var mediaSingle = state.schema.nodes.mediaSingle;
|
|
@@ -64,6 +65,7 @@ export var PixelEntry = function PixelEntry(_ref) {
|
|
|
64
65
|
// get pos of media node
|
|
65
66
|
mediaWidth || DEFAULT_IMAGE_WIDTH);
|
|
66
67
|
var pixelWidth = hasPixelType ? mediaSingleWidth : pixelWidthFromElement;
|
|
68
|
+
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;
|
|
67
69
|
return jsx(PixelEntryComponent, {
|
|
68
70
|
intl: intl,
|
|
69
71
|
width: pluginState.isResizing ? pluginState.resizingWidth : pixelWidth,
|
|
@@ -94,19 +96,28 @@ export var PixelEntry = function PixelEntry(_ref) {
|
|
|
94
96
|
}));
|
|
95
97
|
tr.setMeta('scrollIntoView', false);
|
|
96
98
|
tr.setSelection(NodeSelection.create(tr.doc, selectedMediaSingleNode.pos));
|
|
99
|
+
if (triggerButtonSelector) {
|
|
100
|
+
var newTr = forceFocusSelector && forceFocusSelector(triggerButtonSelector)(tr);
|
|
101
|
+
tr = newTr !== undefined ? newTr : tr;
|
|
102
|
+
}
|
|
97
103
|
dispatch(tr);
|
|
98
104
|
},
|
|
99
|
-
onCloseAndSave: function onCloseAndSave(_ref3) {
|
|
105
|
+
onCloseAndSave: function onCloseAndSave(_ref3, setFocus) {
|
|
100
106
|
var width = _ref3.width,
|
|
101
107
|
validation = _ref3.validation;
|
|
102
108
|
var tr = updateNodeWithTr(width, validation);
|
|
109
|
+
if (setFocus && triggerButtonSelector) {
|
|
110
|
+
var newTr = forceFocusSelector && tr && forceFocusSelector(triggerButtonSelector)(tr);
|
|
111
|
+
tr = newTr !== undefined ? newTr : tr;
|
|
112
|
+
}
|
|
103
113
|
if (tr) {
|
|
104
114
|
return closePixelEditorAndSave(function () {
|
|
105
115
|
return tr;
|
|
106
116
|
})(state, dispatch);
|
|
107
117
|
}
|
|
108
118
|
},
|
|
109
|
-
isViewMode: pluginState.isResizing
|
|
119
|
+
isViewMode: pluginState.isResizing,
|
|
120
|
+
triggerButtonSelector: triggerButtonSelector
|
|
110
121
|
});
|
|
111
122
|
};
|
|
112
123
|
export var FullWidthDisplay = function FullWidthDisplay(_ref4) {
|
|
@@ -12,6 +12,7 @@ import { IconButton } from '@atlaskit/button/new';
|
|
|
12
12
|
import { pixelEntryMessages as messages } from '@atlaskit/editor-common/media';
|
|
13
13
|
import Form, { Field } from '@atlaskit/form';
|
|
14
14
|
import CloseIcon from '@atlaskit/icon/core/close';
|
|
15
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
15
16
|
import { Inline, Box, Text, xcss } from '@atlaskit/primitives';
|
|
16
17
|
import Textfield from '@atlaskit/textfield';
|
|
17
18
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
@@ -88,7 +89,7 @@ export var PixelEntryComponent = function PixelEntryComponent(_ref) {
|
|
|
88
89
|
};
|
|
89
90
|
|
|
90
91
|
// Handle submit when user presses enter or click close button in PixelEntryComponentNext
|
|
91
|
-
var handleCloseAndSave = useCallback(function (data) {
|
|
92
|
+
var handleCloseAndSave = useCallback(function (data, setFocus) {
|
|
92
93
|
if (data.inputWidth === '' || data.inputHeight === '') {
|
|
93
94
|
return;
|
|
94
95
|
}
|
|
@@ -114,7 +115,7 @@ export var PixelEntryComponent = function PixelEntryComponent(_ref) {
|
|
|
114
115
|
onCloseAndSave({
|
|
115
116
|
width: widthToBeSubmitted,
|
|
116
117
|
validation: validation
|
|
117
|
-
});
|
|
118
|
+
}, setFocus);
|
|
118
119
|
}
|
|
119
120
|
}, [maxWidth, minWidth, onCloseAndSave, ratioWidth]);
|
|
120
121
|
|
|
@@ -280,10 +281,11 @@ export var PixelEntryComponentNext = function PixelEntryComponentNext(_ref5) {
|
|
|
280
281
|
}, [isViewMode, widthInputRef]);
|
|
281
282
|
var handleKeyDown = useCallback(function (event) {
|
|
282
283
|
if (event.key === 'Enter') {
|
|
284
|
+
var shouldSetFocus = true;
|
|
283
285
|
handleCloseAndSave({
|
|
284
286
|
inputWidth: computedWidth,
|
|
285
287
|
inputHeight: computedHeight
|
|
286
|
-
});
|
|
288
|
+
}, shouldSetFocus);
|
|
287
289
|
}
|
|
288
290
|
}, [computedWidth, computedHeight, handleCloseAndSave]);
|
|
289
291
|
return jsx(Box, {
|
|
@@ -352,6 +354,7 @@ export var PixelEntryComponentNext = function PixelEntryComponentNext(_ref5) {
|
|
|
352
354
|
inputWidth: computedWidth,
|
|
353
355
|
inputHeight: computedHeight
|
|
354
356
|
});
|
|
355
|
-
}
|
|
357
|
+
},
|
|
358
|
+
onKeyDown: fg('platform_editor_controls_patch_8') ? handleKeyDown : undefined
|
|
356
359
|
}))));
|
|
357
360
|
};
|
|
@@ -58,14 +58,14 @@ var LinkAddToolbar = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
58
58
|
inputMethod: inputMethod
|
|
59
59
|
});
|
|
60
60
|
});
|
|
61
|
-
_defineProperty(_this, "handleOnBack", function (_ref2) {
|
|
61
|
+
_defineProperty(_this, "handleOnBack", function (_ref2, setFocus) {
|
|
62
62
|
var url = _ref2.url,
|
|
63
63
|
inputMethod = _ref2.inputMethod;
|
|
64
64
|
var onBack = _this.props.onBack;
|
|
65
65
|
if (onBack) {
|
|
66
66
|
onBack(url, {
|
|
67
67
|
inputMethod: inputMethod
|
|
68
|
-
});
|
|
68
|
+
}, setFocus);
|
|
69
69
|
}
|
|
70
70
|
});
|
|
71
71
|
_defineProperty(_this, "handleCancel", function () {
|
|
@@ -74,10 +74,10 @@ var LinkAddToolbar = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
74
74
|
onCancel();
|
|
75
75
|
}
|
|
76
76
|
});
|
|
77
|
-
_defineProperty(_this, "handleUnlink", function () {
|
|
77
|
+
_defineProperty(_this, "handleUnlink", function (setFocus) {
|
|
78
78
|
var onUnlink = _this.props.onUnlink;
|
|
79
79
|
if (onUnlink) {
|
|
80
|
-
onUnlink();
|
|
80
|
+
onUnlink(setFocus);
|
|
81
81
|
}
|
|
82
82
|
});
|
|
83
83
|
_defineProperty(_this, "handleOnBlur", function (options) {
|
|
@@ -127,6 +127,14 @@ var LinkAddToolbar = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
127
127
|
url: value,
|
|
128
128
|
inputMethod: currentInputMethod
|
|
129
129
|
});
|
|
130
|
+
},
|
|
131
|
+
onKeyDown: function onKeyDown(event) {
|
|
132
|
+
if (event.key === 'Enter') {
|
|
133
|
+
_this.handleOnBack({
|
|
134
|
+
url: value,
|
|
135
|
+
inputMethod: currentInputMethod
|
|
136
|
+
}, true);
|
|
137
|
+
}
|
|
130
138
|
}
|
|
131
139
|
})), jsx(PanelTextInput, {
|
|
132
140
|
inputId: "media-link-search-input",
|
|
@@ -159,7 +167,14 @@ var LinkAddToolbar = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
159
167
|
icon: jsx(EditorUnlinkIcon, {
|
|
160
168
|
label: formatUnlinkText
|
|
161
169
|
}),
|
|
162
|
-
onClick:
|
|
170
|
+
onClick: function onClick() {
|
|
171
|
+
return _this.handleUnlink();
|
|
172
|
+
},
|
|
173
|
+
onKeyDown: function onKeyDown(event) {
|
|
174
|
+
if (event.key === 'Enter') {
|
|
175
|
+
_this.handleUnlink(true);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
163
178
|
}))), !!errorsList.length && jsx("section", {
|
|
164
179
|
css: validationWrapper
|
|
165
180
|
}, errorsList), renderRecentList()))
|
|
@@ -8,6 +8,8 @@ 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 TextIcon from '@atlaskit/icon/core/text';
|
|
11
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
12
|
+
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
11
13
|
import { openMediaAltTextMenu } from '../../pm-plugins/alt-text/commands';
|
|
12
14
|
import AltTextEdit from '../../pm-plugins/alt-text/ui/AltTextEdit';
|
|
13
15
|
import { isImage } from '../../pm-plugins/utils/is-type';
|
|
@@ -48,11 +50,12 @@ var altTextEditComponent = function altTextEditComponent(options) {
|
|
|
48
50
|
/** Focus should move to the 'Alt text' button when the toolbar closes
|
|
49
51
|
* and not close the floating toolbar.
|
|
50
52
|
*/
|
|
51
|
-
var
|
|
53
|
+
var setFocus = function setFocus() {
|
|
52
54
|
var _options$forceFocusSe;
|
|
53
55
|
var tr = view.state.tr,
|
|
54
56
|
dispatch = view.dispatch;
|
|
55
|
-
var
|
|
57
|
+
var elementSelector = options !== null && options !== void 0 && options.triggerButtonSelector && editorExperiment('platform_editor_controls', 'variant1') && fg('platform_editor_controls_patch_8') ? options.triggerButtonSelector : "[data-testid=\"".concat(testId, "\"]");
|
|
58
|
+
var newTr = options === null || options === void 0 || (_options$forceFocusSe = options.forceFocusSelector) === null || _options$forceFocusSe === void 0 ? void 0 : _options$forceFocusSe.call(options, elementSelector)(tr);
|
|
56
59
|
if (newTr) {
|
|
57
60
|
dispatch(newTr);
|
|
58
61
|
}
|
|
@@ -65,7 +68,8 @@ var altTextEditComponent = function altTextEditComponent(options) {
|
|
|
65
68
|
mediaType: mediaNode.attrs.type,
|
|
66
69
|
value: mediaNode.attrs.alt,
|
|
67
70
|
altTextValidator: options && options.altTextValidator,
|
|
68
|
-
onEscape:
|
|
71
|
+
onEscape: setFocus,
|
|
72
|
+
onEnter: setFocus
|
|
69
73
|
});
|
|
70
74
|
}
|
|
71
75
|
};
|
|
@@ -8,7 +8,7 @@ import { fg } from '@atlaskit/platform-feature-flags';
|
|
|
8
8
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
9
9
|
import { CommentWithDotIcon } from './assets/commentWithDotIcon';
|
|
10
10
|
import { getSelectedMediaSingle } from './utils';
|
|
11
|
-
export var commentButton = function commentButton(intl, state, api) {
|
|
11
|
+
export var commentButton = function commentButton(intl, state, api, onCommentButtonMount) {
|
|
12
12
|
var _getSelectedMediaSing, _api$annotation, _api$connectivity;
|
|
13
13
|
var selectMediaNode = (_getSelectedMediaSing = getSelectedMediaSingle(state)) === null || _getSelectedMediaSing === void 0 ? void 0 : _getSelectedMediaSing.node.firstChild;
|
|
14
14
|
var hasActiveComments = false;
|
|
@@ -47,6 +47,11 @@ export var commentButton = function commentButton(intl, state, api) {
|
|
|
47
47
|
description: title
|
|
48
48
|
}),
|
|
49
49
|
supportsViewMode: true,
|
|
50
|
-
disabled: (api === null || api === void 0 || (_api$connectivity = api.connectivity) === null || _api$connectivity === void 0 || (_api$connectivity = _api$connectivity.sharedState) === null || _api$connectivity === void 0 || (_api$connectivity = _api$connectivity.currentState()) === null || _api$connectivity === void 0 ? void 0 : _api$connectivity.mode) === 'offline'
|
|
50
|
+
disabled: (api === null || api === void 0 || (_api$connectivity = api.connectivity) === null || _api$connectivity === void 0 || (_api$connectivity = _api$connectivity.sharedState) === null || _api$connectivity === void 0 || (_api$connectivity = _api$connectivity.currentState()) === null || _api$connectivity === void 0 ? void 0 : _api$connectivity.mode) === 'offline',
|
|
51
|
+
onMount: function onMount() {
|
|
52
|
+
if (fg('confluence_frontend_preload_inline_comment_editor')) {
|
|
53
|
+
onCommentButtonMount && onCommentButtonMount();
|
|
54
|
+
}
|
|
55
|
+
}
|
|
51
56
|
};
|
|
52
57
|
};
|