@atlaskit/editor-core 187.9.2 → 187.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.js +1 -0
- package/CHANGELOG.md +17 -0
- package/dist/cjs/commands/index.js +8 -134
- package/dist/cjs/labs/next/presets/default.js +2 -2
- package/dist/cjs/plugins/base/index.js +2 -2
- package/dist/cjs/plugins/block-type/commands/block-type.js +34 -36
- package/dist/cjs/plugins/block-type/commands/transform-to-code-block.js +1 -2
- package/dist/cjs/plugins/block-type/index.js +16 -13
- package/dist/cjs/plugins/block-type/pm-plugins/input-rule.js +19 -18
- package/dist/cjs/plugins/block-type/pm-plugins/keymap.js +12 -14
- package/dist/cjs/plugins/block-type/pm-plugins/main.js +9 -9
- package/dist/cjs/plugins/block-type/ui/ToolbarBlockType/blocktype-button.js +7 -7
- package/dist/cjs/plugins/block-type/ui/ToolbarBlockType/index.js +3 -4
- package/dist/cjs/plugins/block-type/ui/ToolbarBlockType/styled.js +13 -5
- package/dist/cjs/plugins/block-type/utils.js +73 -2
- package/dist/cjs/plugins/caption/pm-plugins/keymap.js +2 -2
- package/dist/cjs/plugins/floating-toolbar/index.js +154 -132
- package/dist/cjs/plugins/floating-toolbar/pm-plugins/force-focus/index.js +11 -10
- package/dist/cjs/plugins/floating-toolbar/ui/ExtensionsPlaceholder.js +14 -7
- package/dist/cjs/plugins/floating-toolbar/ui/Toolbar.js +6 -1
- package/dist/cjs/plugins/index.js +0 -7
- package/dist/cjs/plugins/media/pm-plugins/alt-text/ui/AltTextEdit.js +4 -1
- package/dist/cjs/plugins/media/toolbar/alt-text.js +6 -6
- package/dist/cjs/plugins/media/toolbar/linking.js +4 -1
- package/dist/cjs/plugins/media/ui/MediaLinkingToolbar.js +2 -2
- package/dist/cjs/plugins/media/utils/media-common.js +5 -5
- package/dist/cjs/plugins/undo-redo/pm-plugins/keymaps.js +2 -2
- package/dist/cjs/ui/ColorPickerButton/index.js +3 -3
- package/dist/cjs/ui/styles.js +4 -11
- package/dist/cjs/utils/index.js +4 -80
- package/dist/cjs/utils/input-rules.js +6 -66
- package/dist/cjs/utils/mark.js +2 -38
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/commands/index.js +1 -128
- package/dist/es2019/labs/next/presets/default.js +1 -1
- package/dist/es2019/plugins/base/index.js +1 -1
- package/dist/es2019/plugins/block-type/commands/block-type.js +11 -13
- package/dist/es2019/plugins/block-type/commands/transform-to-code-block.js +1 -2
- package/dist/es2019/plugins/block-type/index.js +21 -12
- package/dist/es2019/plugins/block-type/pm-plugins/input-rule.js +18 -18
- package/dist/es2019/plugins/block-type/pm-plugins/keymap.js +8 -9
- package/dist/es2019/plugins/block-type/pm-plugins/main.js +9 -9
- package/dist/es2019/plugins/block-type/ui/ToolbarBlockType/blocktype-button.js +2 -2
- package/dist/es2019/plugins/block-type/ui/ToolbarBlockType/index.js +2 -3
- package/dist/es2019/plugins/block-type/ui/ToolbarBlockType/styled.js +21 -2
- package/dist/es2019/plugins/block-type/utils.js +70 -1
- package/dist/es2019/plugins/caption/pm-plugins/keymap.js +1 -1
- package/dist/es2019/plugins/floating-toolbar/index.js +152 -128
- package/dist/es2019/plugins/floating-toolbar/pm-plugins/force-focus/index.js +12 -8
- package/dist/es2019/plugins/floating-toolbar/ui/ExtensionsPlaceholder.js +5 -4
- package/dist/es2019/plugins/floating-toolbar/ui/Toolbar.js +12 -1
- package/dist/es2019/plugins/index.js +0 -1
- package/dist/es2019/plugins/media/pm-plugins/alt-text/ui/AltTextEdit.js +3 -1
- package/dist/es2019/plugins/media/toolbar/alt-text.js +10 -6
- package/dist/es2019/plugins/media/toolbar/linking.js +8 -1
- package/dist/es2019/plugins/media/ui/MediaLinkingToolbar.js +5 -3
- package/dist/es2019/plugins/media/utils/media-common.js +1 -1
- package/dist/es2019/plugins/tasks-and-decisions/pm-plugins/keymaps.js +1 -1
- package/dist/es2019/plugins/undo-redo/pm-plugins/keymaps.js +1 -1
- package/dist/es2019/ui/ColorPickerButton/index.js +2 -2
- package/dist/es2019/ui/styles.js +0 -16
- package/dist/es2019/utils/index.js +0 -80
- package/dist/es2019/utils/input-rules.js +4 -61
- package/dist/es2019/utils/mark.js +0 -33
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/commands/index.js +7 -125
- package/dist/esm/labs/next/presets/default.js +1 -1
- package/dist/esm/plugins/base/index.js +1 -1
- package/dist/esm/plugins/block-type/commands/block-type.js +11 -13
- package/dist/esm/plugins/block-type/commands/transform-to-code-block.js +1 -2
- package/dist/esm/plugins/block-type/index.js +15 -12
- package/dist/esm/plugins/block-type/pm-plugins/input-rule.js +18 -18
- package/dist/esm/plugins/block-type/pm-plugins/keymap.js +8 -9
- package/dist/esm/plugins/block-type/pm-plugins/main.js +9 -9
- package/dist/esm/plugins/block-type/ui/ToolbarBlockType/blocktype-button.js +2 -2
- package/dist/esm/plugins/block-type/ui/ToolbarBlockType/index.js +2 -3
- package/dist/esm/plugins/block-type/ui/ToolbarBlockType/styled.js +8 -4
- package/dist/esm/plugins/block-type/utils.js +69 -1
- package/dist/esm/plugins/caption/pm-plugins/keymap.js +1 -1
- package/dist/esm/plugins/floating-toolbar/index.js +153 -131
- package/dist/esm/plugins/floating-toolbar/pm-plugins/force-focus/index.js +9 -7
- package/dist/esm/plugins/floating-toolbar/ui/ExtensionsPlaceholder.js +14 -7
- package/dist/esm/plugins/floating-toolbar/ui/Toolbar.js +6 -1
- package/dist/esm/plugins/index.js +0 -1
- package/dist/esm/plugins/media/pm-plugins/alt-text/ui/AltTextEdit.js +4 -1
- package/dist/esm/plugins/media/toolbar/alt-text.js +6 -6
- package/dist/esm/plugins/media/toolbar/linking.js +4 -1
- package/dist/esm/plugins/media/ui/MediaLinkingToolbar.js +2 -2
- package/dist/esm/plugins/media/utils/media-common.js +1 -1
- package/dist/esm/plugins/tasks-and-decisions/pm-plugins/keymaps.js +1 -1
- package/dist/esm/plugins/undo-redo/pm-plugins/keymaps.js +1 -1
- package/dist/esm/ui/ColorPickerButton/index.js +3 -3
- package/dist/esm/ui/styles.js +3 -6
- package/dist/esm/utils/index.js +3 -77
- package/dist/esm/utils/input-rules.js +4 -61
- package/dist/esm/utils/mark.js +0 -35
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/commands/index.d.ts +0 -6
- package/dist/types/labs/next/presets/default.d.ts +40 -8
- package/dist/types/plugins/block-type/commands/block-type.d.ts +5 -6
- package/dist/types/plugins/block-type/commands/delete-and-move-cursor.d.ts +1 -1
- package/dist/types/plugins/block-type/commands/delete-block-content.d.ts +1 -1
- package/dist/types/plugins/block-type/index.d.ts +1 -1
- package/dist/types/plugins/block-type/pm-plugins/input-rule.d.ts +3 -2
- package/dist/types/plugins/block-type/pm-plugins/keymap.d.ts +2 -2
- package/dist/types/plugins/block-type/pm-plugins/main.d.ts +2 -1
- package/dist/types/plugins/block-type/styles.d.ts +1 -1
- package/dist/types/plugins/block-type/types.d.ts +2 -3
- package/dist/types/plugins/block-type/ui/ToolbarBlockType/blocktype-button.d.ts +1 -2
- package/dist/types/plugins/block-type/ui/ToolbarBlockType/index.d.ts +2 -2
- package/dist/types/plugins/block-type/ui/ToolbarBlockType/styled.d.ts +5 -1
- package/dist/types/plugins/block-type/utils.d.ts +15 -1
- package/dist/types/plugins/date/index.d.ts +2 -2
- package/dist/types/plugins/floating-toolbar/index.d.ts +1 -7
- package/dist/types/plugins/floating-toolbar/pm-plugins/force-focus/index.d.ts +2 -1
- package/dist/types/plugins/floating-toolbar/pm-plugins/toolbar-data/plugin-factory.d.ts +1 -1
- package/dist/types/plugins/floating-toolbar/pm-plugins/toolbar-data/plugin-key.d.ts +1 -1
- package/dist/types/plugins/floating-toolbar/pm-plugins/toolbar-data/plugin.d.ts +1 -1
- package/dist/types/plugins/floating-toolbar/pm-plugins/toolbar-data/reducer.d.ts +2 -1
- package/dist/types/plugins/floating-toolbar/pm-plugins/toolbar-data/types.d.ts +0 -3
- package/dist/types/plugins/floating-toolbar/ui/ExtensionsPlaceholder.d.ts +1 -1
- package/dist/types/plugins/floating-toolbar/ui/Toolbar.d.ts +1 -1
- package/dist/types/plugins/index.d.ts +0 -1
- package/dist/types/plugins/media/index.d.ts +2 -2
- package/dist/types/plugins/media/pm-plugins/alt-text/ui/AltTextEdit.d.ts +1 -0
- package/dist/types/plugins/media/ui/MediaLinkingToolbar.d.ts +3 -3
- package/dist/types/plugins/undo-redo/pm-plugins/keymaps.d.ts +1 -1
- package/dist/types/plugins/view-update-subscription/subscribe/toolbarAndPickerUpdates.d.ts +1 -1
- package/dist/types/types/index.d.ts +1 -1
- package/dist/types/ui/Appearance/FullPage/StyledComponents.d.ts +1 -1
- package/dist/types/ui/ColorPickerButton/index.d.ts +2 -2
- package/dist/types/ui/ContentStyles/index.d.ts +2 -2
- package/dist/types/ui/styles.d.ts +0 -3
- package/dist/types/utils/index.d.ts +0 -6
- package/dist/types/utils/input-rules.d.ts +4 -16
- package/dist/types/utils/mark.d.ts +0 -1
- package/dist/types-ts4.5/commands/index.d.ts +0 -6
- package/dist/types-ts4.5/labs/next/presets/default.d.ts +44 -8
- package/dist/types-ts4.5/plugins/block-type/commands/block-type.d.ts +5 -6
- package/dist/types-ts4.5/plugins/block-type/commands/delete-and-move-cursor.d.ts +1 -1
- package/dist/types-ts4.5/plugins/block-type/commands/delete-block-content.d.ts +1 -1
- package/dist/types-ts4.5/plugins/block-type/index.d.ts +1 -1
- package/dist/types-ts4.5/plugins/block-type/pm-plugins/input-rule.d.ts +3 -2
- package/dist/types-ts4.5/plugins/block-type/pm-plugins/keymap.d.ts +2 -2
- package/dist/types-ts4.5/plugins/block-type/pm-plugins/main.d.ts +2 -1
- package/dist/types-ts4.5/plugins/block-type/styles.d.ts +1 -1
- package/dist/types-ts4.5/plugins/block-type/types.d.ts +2 -3
- package/dist/types-ts4.5/plugins/block-type/ui/ToolbarBlockType/blocktype-button.d.ts +1 -2
- package/dist/types-ts4.5/plugins/block-type/ui/ToolbarBlockType/index.d.ts +2 -2
- package/dist/types-ts4.5/plugins/block-type/ui/ToolbarBlockType/styled.d.ts +5 -1
- package/dist/types-ts4.5/plugins/block-type/utils.d.ts +15 -1
- package/dist/types-ts4.5/plugins/date/index.d.ts +2 -2
- package/dist/types-ts4.5/plugins/floating-toolbar/index.d.ts +1 -7
- package/dist/types-ts4.5/plugins/floating-toolbar/pm-plugins/force-focus/index.d.ts +2 -1
- package/dist/types-ts4.5/plugins/floating-toolbar/pm-plugins/toolbar-data/plugin-factory.d.ts +1 -1
- package/dist/types-ts4.5/plugins/floating-toolbar/pm-plugins/toolbar-data/plugin-key.d.ts +1 -1
- package/dist/types-ts4.5/plugins/floating-toolbar/pm-plugins/toolbar-data/plugin.d.ts +1 -1
- package/dist/types-ts4.5/plugins/floating-toolbar/pm-plugins/toolbar-data/reducer.d.ts +2 -1
- package/dist/types-ts4.5/plugins/floating-toolbar/pm-plugins/toolbar-data/types.d.ts +0 -3
- package/dist/types-ts4.5/plugins/floating-toolbar/ui/ExtensionsPlaceholder.d.ts +1 -1
- package/dist/types-ts4.5/plugins/floating-toolbar/ui/Toolbar.d.ts +1 -1
- package/dist/types-ts4.5/plugins/index.d.ts +0 -1
- package/dist/types-ts4.5/plugins/media/index.d.ts +2 -2
- package/dist/types-ts4.5/plugins/media/pm-plugins/alt-text/ui/AltTextEdit.d.ts +1 -0
- package/dist/types-ts4.5/plugins/media/ui/MediaLinkingToolbar.d.ts +3 -3
- package/dist/types-ts4.5/plugins/undo-redo/pm-plugins/keymaps.d.ts +1 -1
- package/dist/types-ts4.5/plugins/view-update-subscription/subscribe/toolbarAndPickerUpdates.d.ts +1 -1
- package/dist/types-ts4.5/types/index.d.ts +1 -1
- package/dist/types-ts4.5/ui/Appearance/FullPage/StyledComponents.d.ts +1 -1
- package/dist/types-ts4.5/ui/ColorPickerButton/index.d.ts +2 -2
- package/dist/types-ts4.5/ui/ContentStyles/index.d.ts +2 -2
- package/dist/types-ts4.5/ui/styles.d.ts +0 -3
- package/dist/types-ts4.5/utils/index.d.ts +0 -6
- package/dist/types-ts4.5/utils/input-rules.d.ts +4 -16
- package/dist/types-ts4.5/utils/mark.d.ts +0 -1
- package/package.json +6 -5
- package/report.api.md +9 -37
- package/tmp/api-report-tmp.d.ts +8 -34
- package/dist/cjs/plugins/editor-disabled/index.js +0 -75
- package/dist/cjs/types/allowed-block-types.js +0 -5
- package/dist/cjs/utils/keymap.js +0 -38
- package/dist/es2019/plugins/editor-disabled/index.js +0 -62
- package/dist/es2019/types/allowed-block-types.js +0 -1
- package/dist/es2019/utils/keymap.js +0 -33
- package/dist/esm/plugins/editor-disabled/index.js +0 -66
- package/dist/esm/types/allowed-block-types.js +0 -1
- package/dist/esm/utils/keymap.js +0 -33
- package/dist/types/plugins/editor-disabled/index.d.ts +0 -13
- package/dist/types/types/allowed-block-types.d.ts +0 -1
- package/dist/types/utils/keymap.d.ts +0 -11
- package/dist/types-ts4.5/plugins/editor-disabled/index.d.ts +0 -13
- package/dist/types-ts4.5/types/allowed-block-types.d.ts +0 -1
- package/dist/types-ts4.5/utils/keymap.d.ts +0 -11
- /package/dist/cjs/{keymaps → plugins/block-type}/consts.js +0 -0
- /package/dist/es2019/{keymaps → plugins/block-type}/consts.js +0 -0
- /package/dist/esm/{keymaps → plugins/block-type}/consts.js +0 -0
- /package/dist/types/{keymaps → plugins/block-type}/consts.d.ts +0 -0
- /package/dist/types-ts4.5/{keymaps → plugins/block-type}/consts.d.ts +0 -0
|
@@ -9,11 +9,9 @@ import camelCase from 'lodash/camelCase';
|
|
|
9
9
|
import { Popup } from '@atlaskit/editor-common/ui';
|
|
10
10
|
// AFP-2532 TODO: Fix automatic suppressions below
|
|
11
11
|
// eslint-disable-next-line @atlassian/tangerine/import/entry-points
|
|
12
|
-
import
|
|
12
|
+
import { WithProviders } from '@atlaskit/editor-common/provider-factory';
|
|
13
13
|
import { CONTENT_COMPONENT } from '../analytics/types';
|
|
14
14
|
import { ACTION, ACTION_SUBJECT, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
|
|
15
|
-
import { pluginKey as extensionsPluginKey } from '../extension/plugin-key';
|
|
16
|
-
import { pluginKey as editorDisabledPluginKey } from '../editor-disabled';
|
|
17
15
|
import { pluginKey as dataPluginKey } from './pm-plugins/toolbar-data/plugin-key';
|
|
18
16
|
import { createPlugin as floatingToolbarDataPluginFactory } from './pm-plugins/toolbar-data/plugin';
|
|
19
17
|
import { hideConfirmDialog } from './pm-plugins/toolbar-data/commands';
|
|
@@ -113,8 +111,6 @@ function filterUndefined(x) {
|
|
|
113
111
|
return !!x;
|
|
114
112
|
}
|
|
115
113
|
var floatingToolbarPlugin = function floatingToolbarPlugin(_, api) {
|
|
116
|
-
var _api$dependencies, _api$dependencies$fea;
|
|
117
|
-
var featureFlags = (api === null || api === void 0 ? void 0 : (_api$dependencies = api.dependencies) === null || _api$dependencies === void 0 ? void 0 : (_api$dependencies$fea = _api$dependencies.featureFlags) === null || _api$dependencies$fea === void 0 ? void 0 : _api$dependencies$fea.sharedState.currentState()) || {};
|
|
118
114
|
return {
|
|
119
115
|
name: 'floatingToolbar',
|
|
120
116
|
pmPlugins: function pmPlugins() {
|
|
@@ -149,6 +145,17 @@ var floatingToolbarPlugin = function floatingToolbarPlugin(_, api) {
|
|
|
149
145
|
actions: {
|
|
150
146
|
forceFocusSelector: forceFocusSelector
|
|
151
147
|
},
|
|
148
|
+
getSharedState: function getSharedState(editorState) {
|
|
149
|
+
var _pluginKey$getState$g, _pluginKey$getState, _pluginKey$getState$g2;
|
|
150
|
+
if (!editorState) {
|
|
151
|
+
return undefined;
|
|
152
|
+
}
|
|
153
|
+
var configWithNodeInfo = (_pluginKey$getState$g = (_pluginKey$getState = pluginKey.getState(editorState)) === null || _pluginKey$getState === void 0 ? void 0 : (_pluginKey$getState$g2 = _pluginKey$getState.getConfigWithNodeInfo) === null || _pluginKey$getState$g2 === void 0 ? void 0 : _pluginKey$getState$g2.call(_pluginKey$getState, editorState)) !== null && _pluginKey$getState$g !== void 0 ? _pluginKey$getState$g : undefined;
|
|
154
|
+
return {
|
|
155
|
+
configWithNodeInfo: configWithNodeInfo,
|
|
156
|
+
floatingToolbarData: dataPluginKey.getState(editorState)
|
|
157
|
+
};
|
|
158
|
+
},
|
|
152
159
|
contentComponent: function contentComponent(_ref3) {
|
|
153
160
|
var popupsMountPoint = _ref3.popupsMountPoint,
|
|
154
161
|
popupsBoundariesElement = _ref3.popupsBoundariesElement,
|
|
@@ -156,134 +163,151 @@ var floatingToolbarPlugin = function floatingToolbarPlugin(_, api) {
|
|
|
156
163
|
editorView = _ref3.editorView,
|
|
157
164
|
providerFactory = _ref3.providerFactory,
|
|
158
165
|
dispatchAnalyticsEvent = _ref3.dispatchAnalyticsEvent;
|
|
159
|
-
return /*#__PURE__*/React.createElement(
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
var _configWithNodeInfo$c, _configWithNodeInfo$c2;
|
|
168
|
-
var editorDisabledPlugin = _ref4.editorDisabledPlugin,
|
|
169
|
-
floatingToolbarState = _ref4.floatingToolbarState,
|
|
170
|
-
floatingToolbarData = _ref4.floatingToolbarData,
|
|
171
|
-
extensionsState = _ref4.extensionsState;
|
|
172
|
-
var configWithNodeInfo = floatingToolbarState === null || floatingToolbarState === void 0 ? void 0 : floatingToolbarState.getConfigWithNodeInfo(editorView.state);
|
|
173
|
-
if (!configWithNodeInfo || !configWithNodeInfo.config || typeof ((_configWithNodeInfo$c = configWithNodeInfo.config) === null || _configWithNodeInfo$c === void 0 ? void 0 : _configWithNodeInfo$c.visible) !== 'undefined' && !((_configWithNodeInfo$c2 = configWithNodeInfo.config) !== null && _configWithNodeInfo$c2 !== void 0 && _configWithNodeInfo$c2.visible)) {
|
|
174
|
-
return null;
|
|
175
|
-
}
|
|
176
|
-
var config = configWithNodeInfo.config,
|
|
177
|
-
node = configWithNodeInfo.node;
|
|
178
|
-
var title = config.title,
|
|
179
|
-
_config$getDomRef = config.getDomRef,
|
|
180
|
-
getDomRef = _config$getDomRef === void 0 ? getDomRefFromSelection : _config$getDomRef,
|
|
181
|
-
items = config.items,
|
|
182
|
-
_config$align = config.align,
|
|
183
|
-
align = _config$align === void 0 ? 'center' : _config$align,
|
|
184
|
-
_config$className = config.className,
|
|
185
|
-
className = _config$className === void 0 ? '' : _config$className,
|
|
186
|
-
height = config.height,
|
|
187
|
-
width = config.width,
|
|
188
|
-
zIndex = config.zIndex,
|
|
189
|
-
_config$offset = config.offset,
|
|
190
|
-
offset = _config$offset === void 0 ? [0, 12] : _config$offset,
|
|
191
|
-
forcePlacement = config.forcePlacement,
|
|
192
|
-
preventPopupOverflow = config.preventPopupOverflow,
|
|
193
|
-
onPositionCalculated = config.onPositionCalculated,
|
|
194
|
-
focusTrap = config.focusTrap;
|
|
195
|
-
var targetRef = getDomRef(editorView, dispatchAnalyticsEvent);
|
|
196
|
-
if (!targetRef || editorDisabledPlugin && editorDisabledPlugin.editorDisabled) {
|
|
197
|
-
return null;
|
|
198
|
-
}
|
|
199
|
-
var customPositionCalculation;
|
|
200
|
-
var toolbarItems = processCopyButtonItems(editorView.state)(Array.isArray(items) ? items : items(node), api === null || api === void 0 ? void 0 : api.dependencies.decorations.actions.hoverDecoration);
|
|
201
|
-
if (onPositionCalculated) {
|
|
202
|
-
customPositionCalculation = function customPositionCalculation(nextPos) {
|
|
203
|
-
return onPositionCalculated(editorView, nextPos);
|
|
204
|
-
};
|
|
205
|
-
}
|
|
206
|
-
var dispatchCommand = function dispatchCommand(fn) {
|
|
207
|
-
return fn && fn(editorView.state, editorView.dispatch, editorView);
|
|
208
|
-
};
|
|
209
|
-
|
|
210
|
-
// Confirm dialog
|
|
211
|
-
var _ref5 = floatingToolbarData || {},
|
|
212
|
-
confirmDialogForItem = _ref5.confirmDialogForItem;
|
|
213
|
-
var confirmButtonItem = confirmDialogForItem ? toolbarItems[confirmDialogForItem] : undefined;
|
|
214
|
-
var scrollable = featureFlags.floatingToolbarCopyButton && config.scrollable;
|
|
215
|
-
var confirmDialogOptions = typeof (confirmButtonItem === null || confirmButtonItem === void 0 ? void 0 : confirmButtonItem.confirmDialog) === 'function' ? confirmButtonItem === null || confirmButtonItem === void 0 ? void 0 : confirmButtonItem.confirmDialog() : confirmButtonItem === null || confirmButtonItem === void 0 ? void 0 : confirmButtonItem.confirmDialog;
|
|
216
|
-
return /*#__PURE__*/React.createElement(ErrorBoundary, {
|
|
217
|
-
component: ACTION_SUBJECT.FLOATING_TOOLBAR_PLUGIN,
|
|
218
|
-
componentId: camelCase(title),
|
|
219
|
-
dispatchAnalyticsEvent: dispatchAnalyticsEvent,
|
|
220
|
-
fallbackComponent: null
|
|
221
|
-
}, /*#__PURE__*/React.createElement(Popup, {
|
|
222
|
-
ariaLabel: title,
|
|
223
|
-
offset: offset,
|
|
224
|
-
target: targetRef,
|
|
225
|
-
alignY: "bottom",
|
|
226
|
-
forcePlacement: forcePlacement,
|
|
227
|
-
fitHeight: height,
|
|
228
|
-
fitWidth: width,
|
|
229
|
-
alignX: align,
|
|
230
|
-
stick: true,
|
|
231
|
-
zIndex: zIndex,
|
|
232
|
-
mountTo: popupsMountPoint,
|
|
233
|
-
boundariesElement: popupsBoundariesElement,
|
|
234
|
-
scrollableElement: popupsScrollableElement,
|
|
235
|
-
onPositionCalculated: customPositionCalculation,
|
|
236
|
-
style: scrollable ? {
|
|
237
|
-
maxWidth: '100%'
|
|
238
|
-
} : {},
|
|
239
|
-
focusTrap: focusTrap,
|
|
240
|
-
preventOverflow: preventPopupOverflow
|
|
241
|
-
}, /*#__PURE__*/React.createElement(ToolbarLoader, {
|
|
242
|
-
target: targetRef,
|
|
243
|
-
items: toolbarItems,
|
|
244
|
-
node: node,
|
|
245
|
-
dispatchCommand: dispatchCommand,
|
|
246
|
-
editorView: editorView,
|
|
247
|
-
className: className,
|
|
248
|
-
focusEditor: function focusEditor() {
|
|
249
|
-
return editorView.focus();
|
|
250
|
-
},
|
|
251
|
-
providerFactory: providerFactory,
|
|
252
|
-
popupsMountPoint: popupsMountPoint,
|
|
253
|
-
popupsBoundariesElement: popupsBoundariesElement,
|
|
254
|
-
popupsScrollableElement: popupsScrollableElement,
|
|
255
|
-
dispatchAnalyticsEvent: dispatchAnalyticsEvent,
|
|
256
|
-
extensionsProvider: extensionsState === null || extensionsState === void 0 ? void 0 : extensionsState.extensionProvider,
|
|
257
|
-
scrollable: scrollable,
|
|
258
|
-
featureFlags: featureFlags,
|
|
259
|
-
api: api
|
|
260
|
-
})), /*#__PURE__*/React.createElement(ConfirmationModal, {
|
|
261
|
-
testId: "ak-floating-toolbar-confirmation-modal",
|
|
262
|
-
options: confirmDialogOptions,
|
|
263
|
-
onConfirm: function onConfirm() {
|
|
264
|
-
var isChecked = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
265
|
-
if (!!confirmDialogOptions.onConfirm) {
|
|
266
|
-
dispatchCommand(confirmDialogOptions.onConfirm(isChecked));
|
|
267
|
-
} else {
|
|
268
|
-
dispatchCommand(confirmButtonItem.onClick);
|
|
269
|
-
}
|
|
270
|
-
},
|
|
271
|
-
onClose: function onClose() {
|
|
272
|
-
dispatchCommand(hideConfirmDialog());
|
|
273
|
-
// Need to set focus to Editor here,
|
|
274
|
-
// As when the Confirmation dialog pop up, and user interacts with the dialog, Editor loses focus.
|
|
275
|
-
// So when Confirmation dialog is closed, Editor does not have the focus, then cursor goes to the position 1 of the doc,
|
|
276
|
-
// instead of the cursor position before the dialog pop up.
|
|
277
|
-
if (!editorView.hasFocus()) {
|
|
278
|
-
editorView.focus();
|
|
279
|
-
}
|
|
280
|
-
}
|
|
281
|
-
}));
|
|
282
|
-
}
|
|
166
|
+
return /*#__PURE__*/React.createElement(ContentComponent, {
|
|
167
|
+
editorView: editorView,
|
|
168
|
+
pluginInjectionApi: api,
|
|
169
|
+
popupsMountPoint: popupsMountPoint,
|
|
170
|
+
popupsBoundariesElement: popupsBoundariesElement,
|
|
171
|
+
popupsScrollableElement: popupsScrollableElement,
|
|
172
|
+
providerFactory: providerFactory,
|
|
173
|
+
dispatchAnalyticsEvent: dispatchAnalyticsEvent
|
|
283
174
|
});
|
|
284
175
|
}
|
|
285
176
|
};
|
|
286
177
|
};
|
|
178
|
+
import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
179
|
+
function ContentComponent(_ref4) {
|
|
180
|
+
var _pluginInjectionApi$d, _pluginInjectionApi$d2, _configWithNodeInfo$c, _configWithNodeInfo$c2;
|
|
181
|
+
var pluginInjectionApi = _ref4.pluginInjectionApi,
|
|
182
|
+
editorView = _ref4.editorView,
|
|
183
|
+
popupsMountPoint = _ref4.popupsMountPoint,
|
|
184
|
+
popupsBoundariesElement = _ref4.popupsBoundariesElement,
|
|
185
|
+
popupsScrollableElement = _ref4.popupsScrollableElement,
|
|
186
|
+
providerFactory = _ref4.providerFactory,
|
|
187
|
+
dispatchAnalyticsEvent = _ref4.dispatchAnalyticsEvent;
|
|
188
|
+
var featureFlags = (pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d = pluginInjectionApi.dependencies) === null || _pluginInjectionApi$d === void 0 ? void 0 : (_pluginInjectionApi$d2 = _pluginInjectionApi$d.featureFlags) === null || _pluginInjectionApi$d2 === void 0 ? void 0 : _pluginInjectionApi$d2.sharedState.currentState()) || {};
|
|
189
|
+
var _useSharedPluginState = useSharedPluginState(pluginInjectionApi, ['floatingToolbar', 'editorDisabled']),
|
|
190
|
+
floatingToolbarState = _useSharedPluginState.floatingToolbarState,
|
|
191
|
+
editorDisabledState = _useSharedPluginState.editorDisabledState;
|
|
192
|
+
var _ref5 = floatingToolbarState !== null && floatingToolbarState !== void 0 ? floatingToolbarState : {},
|
|
193
|
+
configWithNodeInfo = _ref5.configWithNodeInfo,
|
|
194
|
+
floatingToolbarData = _ref5.floatingToolbarData;
|
|
195
|
+
if (!configWithNodeInfo || !configWithNodeInfo.config || typeof ((_configWithNodeInfo$c = configWithNodeInfo.config) === null || _configWithNodeInfo$c === void 0 ? void 0 : _configWithNodeInfo$c.visible) !== 'undefined' && !((_configWithNodeInfo$c2 = configWithNodeInfo.config) !== null && _configWithNodeInfo$c2 !== void 0 && _configWithNodeInfo$c2.visible)) {
|
|
196
|
+
return null;
|
|
197
|
+
}
|
|
198
|
+
var config = configWithNodeInfo.config,
|
|
199
|
+
node = configWithNodeInfo.node;
|
|
200
|
+
var title = config.title,
|
|
201
|
+
_config$getDomRef = config.getDomRef,
|
|
202
|
+
getDomRef = _config$getDomRef === void 0 ? getDomRefFromSelection : _config$getDomRef,
|
|
203
|
+
items = config.items,
|
|
204
|
+
_config$align = config.align,
|
|
205
|
+
align = _config$align === void 0 ? 'center' : _config$align,
|
|
206
|
+
_config$className = config.className,
|
|
207
|
+
className = _config$className === void 0 ? '' : _config$className,
|
|
208
|
+
height = config.height,
|
|
209
|
+
width = config.width,
|
|
210
|
+
zIndex = config.zIndex,
|
|
211
|
+
_config$offset = config.offset,
|
|
212
|
+
offset = _config$offset === void 0 ? [0, 12] : _config$offset,
|
|
213
|
+
forcePlacement = config.forcePlacement,
|
|
214
|
+
preventPopupOverflow = config.preventPopupOverflow,
|
|
215
|
+
onPositionCalculated = config.onPositionCalculated,
|
|
216
|
+
focusTrap = config.focusTrap;
|
|
217
|
+
var targetRef = getDomRef(editorView, dispatchAnalyticsEvent);
|
|
218
|
+
if (!targetRef || editorDisabledState && editorDisabledState.editorDisabled) {
|
|
219
|
+
return null;
|
|
220
|
+
}
|
|
221
|
+
var customPositionCalculation;
|
|
222
|
+
var toolbarItems = processCopyButtonItems(editorView.state)(Array.isArray(items) ? items : items(node), pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.dependencies.decorations.actions.hoverDecoration);
|
|
223
|
+
if (onPositionCalculated) {
|
|
224
|
+
customPositionCalculation = function customPositionCalculation(nextPos) {
|
|
225
|
+
return onPositionCalculated(editorView, nextPos);
|
|
226
|
+
};
|
|
227
|
+
}
|
|
228
|
+
var dispatchCommand = function dispatchCommand(fn) {
|
|
229
|
+
return fn && fn(editorView.state, editorView.dispatch, editorView);
|
|
230
|
+
};
|
|
231
|
+
|
|
232
|
+
// Confirm dialog
|
|
233
|
+
var _ref6 = floatingToolbarData || {},
|
|
234
|
+
confirmDialogForItem = _ref6.confirmDialogForItem;
|
|
235
|
+
var confirmButtonItem = confirmDialogForItem ? toolbarItems[confirmDialogForItem] : undefined;
|
|
236
|
+
var scrollable = featureFlags.floatingToolbarCopyButton && config.scrollable;
|
|
237
|
+
var confirmDialogOptions = typeof (confirmButtonItem === null || confirmButtonItem === void 0 ? void 0 : confirmButtonItem.confirmDialog) === 'function' ? confirmButtonItem === null || confirmButtonItem === void 0 ? void 0 : confirmButtonItem.confirmDialog() : confirmButtonItem === null || confirmButtonItem === void 0 ? void 0 : confirmButtonItem.confirmDialog;
|
|
238
|
+
return /*#__PURE__*/React.createElement(ErrorBoundary, {
|
|
239
|
+
component: ACTION_SUBJECT.FLOATING_TOOLBAR_PLUGIN,
|
|
240
|
+
componentId: camelCase(title),
|
|
241
|
+
dispatchAnalyticsEvent: dispatchAnalyticsEvent,
|
|
242
|
+
fallbackComponent: null
|
|
243
|
+
}, /*#__PURE__*/React.createElement(Popup, {
|
|
244
|
+
ariaLabel: title,
|
|
245
|
+
offset: offset,
|
|
246
|
+
target: targetRef,
|
|
247
|
+
alignY: "bottom",
|
|
248
|
+
forcePlacement: forcePlacement,
|
|
249
|
+
fitHeight: height,
|
|
250
|
+
fitWidth: width,
|
|
251
|
+
alignX: align,
|
|
252
|
+
stick: true,
|
|
253
|
+
zIndex: zIndex,
|
|
254
|
+
mountTo: popupsMountPoint,
|
|
255
|
+
boundariesElement: popupsBoundariesElement,
|
|
256
|
+
scrollableElement: popupsScrollableElement,
|
|
257
|
+
onPositionCalculated: customPositionCalculation,
|
|
258
|
+
style: scrollable ? {
|
|
259
|
+
maxWidth: '100%'
|
|
260
|
+
} : {},
|
|
261
|
+
focusTrap: focusTrap,
|
|
262
|
+
preventOverflow: preventPopupOverflow
|
|
263
|
+
}, /*#__PURE__*/React.createElement(WithProviders, {
|
|
264
|
+
providerFactory: providerFactory,
|
|
265
|
+
providers: ['extensionProvider'],
|
|
266
|
+
renderNode: function renderNode(providers) {
|
|
267
|
+
return /*#__PURE__*/React.createElement(ToolbarLoader, {
|
|
268
|
+
target: targetRef,
|
|
269
|
+
items: toolbarItems,
|
|
270
|
+
node: node,
|
|
271
|
+
dispatchCommand: dispatchCommand,
|
|
272
|
+
editorView: editorView,
|
|
273
|
+
className: className,
|
|
274
|
+
focusEditor: function focusEditor() {
|
|
275
|
+
return editorView.focus();
|
|
276
|
+
},
|
|
277
|
+
providerFactory: providerFactory,
|
|
278
|
+
popupsMountPoint: popupsMountPoint,
|
|
279
|
+
popupsBoundariesElement: popupsBoundariesElement,
|
|
280
|
+
popupsScrollableElement: popupsScrollableElement,
|
|
281
|
+
dispatchAnalyticsEvent: dispatchAnalyticsEvent,
|
|
282
|
+
extensionsProvider: providers.extensionProvider,
|
|
283
|
+
scrollable: scrollable,
|
|
284
|
+
featureFlags: featureFlags,
|
|
285
|
+
api: pluginInjectionApi
|
|
286
|
+
});
|
|
287
|
+
}
|
|
288
|
+
})), /*#__PURE__*/React.createElement(ConfirmationModal, {
|
|
289
|
+
testId: "ak-floating-toolbar-confirmation-modal",
|
|
290
|
+
options: confirmDialogOptions,
|
|
291
|
+
onConfirm: function onConfirm() {
|
|
292
|
+
var isChecked = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
293
|
+
if (!!confirmDialogOptions.onConfirm) {
|
|
294
|
+
dispatchCommand(confirmDialogOptions.onConfirm(isChecked));
|
|
295
|
+
} else {
|
|
296
|
+
dispatchCommand(confirmButtonItem.onClick);
|
|
297
|
+
}
|
|
298
|
+
},
|
|
299
|
+
onClose: function onClose() {
|
|
300
|
+
dispatchCommand(hideConfirmDialog());
|
|
301
|
+
// Need to set focus to Editor here,
|
|
302
|
+
// As when the Confirmation dialog pop up, and user interacts with the dialog, Editor loses focus.
|
|
303
|
+
// So when Confirmation dialog is closed, Editor does not have the focus, then cursor goes to the position 1 of the doc,
|
|
304
|
+
// instead of the cursor position before the dialog pop up.
|
|
305
|
+
if (!editorView.hasFocus()) {
|
|
306
|
+
editorView.focus();
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
}));
|
|
310
|
+
}
|
|
287
311
|
export default floatingToolbarPlugin;
|
|
288
312
|
|
|
289
313
|
/**
|
|
@@ -309,7 +333,6 @@ function sanitizeFloatingToolbarConfig(config) {
|
|
|
309
333
|
}
|
|
310
334
|
function floatingToolbarPluginFactory(options) {
|
|
311
335
|
var floatingToolbarHandlers = options.floatingToolbarHandlers,
|
|
312
|
-
dispatch = options.dispatch,
|
|
313
336
|
providerFactory = options.providerFactory,
|
|
314
337
|
getIntl = options.getIntl;
|
|
315
338
|
var intl = getIntl();
|
|
@@ -324,7 +347,6 @@ function floatingToolbarPluginFactory(options) {
|
|
|
324
347
|
};
|
|
325
348
|
var apply = function apply(tr, pluginState) {
|
|
326
349
|
var newPluginState = _objectSpread({}, pluginState);
|
|
327
|
-
dispatch(pluginKey, newPluginState);
|
|
328
350
|
return newPluginState;
|
|
329
351
|
};
|
|
330
352
|
return new SafePlugin({
|
|
@@ -30,13 +30,13 @@ export default (function () {
|
|
|
30
30
|
/**
|
|
31
31
|
* The provided selector should be the floating toolbar button that needs focus.
|
|
32
32
|
*/
|
|
33
|
-
export function forceFocusSelector(selector
|
|
34
|
-
|
|
35
|
-
return
|
|
33
|
+
export var forceFocusSelector = function forceFocusSelector(selector) {
|
|
34
|
+
return function (tr) {
|
|
35
|
+
return tr.setMeta(forceFocusStateKey, {
|
|
36
36
|
selector: selector
|
|
37
|
-
})
|
|
38
|
-
}
|
|
39
|
-
}
|
|
37
|
+
});
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
40
|
|
|
41
41
|
/**
|
|
42
42
|
* If a selector is set and the element exists, focus it.
|
|
@@ -55,7 +55,9 @@ export function checkShouldForceFocusAndApply(view) {
|
|
|
55
55
|
inline: 'nearest'
|
|
56
56
|
});
|
|
57
57
|
focusableElement.focus();
|
|
58
|
-
|
|
58
|
+
var tr = view.state.tr,
|
|
59
|
+
dispatch = view.dispatch;
|
|
60
|
+
dispatch(forceFocusSelector(null)(tr));
|
|
59
61
|
}
|
|
60
62
|
}
|
|
61
63
|
}
|
|
@@ -102,25 +102,32 @@ export var ExtensionsPlaceholder = function ExtensionsPlaceholder(props) {
|
|
|
102
102
|
extensions = _useState2[0],
|
|
103
103
|
setExtensions = _useState2[1];
|
|
104
104
|
useEffect(function () {
|
|
105
|
-
|
|
106
|
-
getExtensions();
|
|
107
|
-
}
|
|
105
|
+
getExtensions();
|
|
108
106
|
function getExtensions() {
|
|
109
107
|
return _getExtensions.apply(this, arguments);
|
|
110
108
|
} // leaving dependencies array empty so that this effect runs just once on component mount
|
|
111
109
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
112
110
|
function _getExtensions() {
|
|
113
111
|
_getExtensions = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
|
|
112
|
+
var provider;
|
|
114
113
|
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
115
114
|
while (1) switch (_context3.prev = _context3.next) {
|
|
116
115
|
case 0:
|
|
116
|
+
_context3.next = 2;
|
|
117
|
+
return extensionProvider;
|
|
118
|
+
case 2:
|
|
119
|
+
provider = _context3.sent;
|
|
120
|
+
if (!provider) {
|
|
121
|
+
_context3.next = 9;
|
|
122
|
+
break;
|
|
123
|
+
}
|
|
117
124
|
_context3.t0 = setExtensions;
|
|
118
|
-
_context3.next =
|
|
119
|
-
return
|
|
120
|
-
case
|
|
125
|
+
_context3.next = 7;
|
|
126
|
+
return provider.getExtensions();
|
|
127
|
+
case 7:
|
|
121
128
|
_context3.t1 = _context3.sent;
|
|
122
129
|
(0, _context3.t0)(_context3.t1);
|
|
123
|
-
case
|
|
130
|
+
case 9:
|
|
124
131
|
case "end":
|
|
125
132
|
return _context3.stop();
|
|
126
133
|
}
|
|
@@ -415,7 +415,12 @@ var Toolbar = /*#__PURE__*/function (_Component) {
|
|
|
415
415
|
}, {
|
|
416
416
|
key: "componentWillUnmount",
|
|
417
417
|
value: function componentWillUnmount() {
|
|
418
|
-
|
|
418
|
+
var editorView = this.props.editorView;
|
|
419
|
+
if (editorView) {
|
|
420
|
+
var tr = editorView.state.tr,
|
|
421
|
+
dispatch = editorView.dispatch;
|
|
422
|
+
dispatch(forceFocusSelector(null)(tr));
|
|
423
|
+
}
|
|
419
424
|
this.resetStyling({
|
|
420
425
|
table: this.props.node.type.name === 'table'
|
|
421
426
|
});
|
|
@@ -37,7 +37,6 @@ export { default as statusPlugin } from './status';
|
|
|
37
37
|
export { default as breakoutPlugin } from './breakout';
|
|
38
38
|
export { default as alignmentPlugin } from './alignment';
|
|
39
39
|
export { default as dataConsumerMarkPlugin } from './data-consumer';
|
|
40
|
-
export { default as editorDisabledPlugin } from './editor-disabled';
|
|
41
40
|
export { default as fragmentMarkPlugin } from './fragment';
|
|
42
41
|
export { default as indentationPlugin } from './indentation';
|
|
43
42
|
export { default as annotationPlugin } from './annotation';
|
|
@@ -54,7 +54,9 @@ export var AltTextEditComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
54
54
|
closeMediaAltTextMenu(view.state, view.dispatch);
|
|
55
55
|
});
|
|
56
56
|
_defineProperty(_assertThisInitialized(_this), "dispatchCancelEvent", function (event) {
|
|
57
|
-
var
|
|
57
|
+
var _this$props = _this.props,
|
|
58
|
+
view = _this$props.view,
|
|
59
|
+
onEscape = _this$props.onEscape;
|
|
58
60
|
|
|
59
61
|
// We need to pass down the ESCAPE keymap
|
|
60
62
|
// because when we focus on the Toolbar, Prosemirror blur,
|
|
@@ -62,6 +64,7 @@ export var AltTextEditComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
62
64
|
view.someProp('handleKeyDown', function (fn) {
|
|
63
65
|
return fn(view, event);
|
|
64
66
|
});
|
|
67
|
+
onEscape === null || onEscape === void 0 ? void 0 : onEscape();
|
|
65
68
|
});
|
|
66
69
|
_defineProperty(_assertThisInitialized(_this), "updateAltText", function (newAltText) {
|
|
67
70
|
var view = _this.props.view;
|
|
@@ -9,7 +9,6 @@ import AltTextEdit from '../pm-plugins/alt-text/ui/AltTextEdit';
|
|
|
9
9
|
import { CONTAINER_WIDTH_IN_PX } from '../pm-plugins/alt-text/ui/AltTextEdit';
|
|
10
10
|
import { getMediaNodeFromSelection } from '../utils/media-common';
|
|
11
11
|
import { ClassNames } from '../pm-plugins/alt-text/style';
|
|
12
|
-
import { withOuterListeners } from '@atlaskit/editor-common/ui';
|
|
13
12
|
import { forceFocusSelector } from '../../floating-toolbar/pm-plugins/force-focus';
|
|
14
13
|
var testId = 'alt-text-edit-button';
|
|
15
14
|
export var altTextButton = function altTextButton(intl, state) {
|
|
@@ -29,7 +28,6 @@ export var altTextButton = function altTextButton(intl, state) {
|
|
|
29
28
|
})
|
|
30
29
|
};
|
|
31
30
|
};
|
|
32
|
-
var AltTextEditWithListeners = withOuterListeners(AltTextEdit);
|
|
33
31
|
export var altTextEditComponent = function altTextEditComponent(options) {
|
|
34
32
|
return {
|
|
35
33
|
type: 'custom',
|
|
@@ -46,15 +44,17 @@ export var altTextEditComponent = function altTextEditComponent(options) {
|
|
|
46
44
|
/** Focus should move to the 'Alt text' button when the toolbar closes
|
|
47
45
|
* and not close the floating toolbar.
|
|
48
46
|
*/
|
|
49
|
-
var handleEsc = function handleEsc(
|
|
50
|
-
|
|
47
|
+
var handleEsc = function handleEsc() {
|
|
48
|
+
var tr = view.state.tr,
|
|
49
|
+
dispatch = view.dispatch;
|
|
50
|
+
dispatch(forceFocusSelector("[data-testid=\"".concat(testId, "\"]"))(tr));
|
|
51
51
|
};
|
|
52
|
-
return /*#__PURE__*/React.createElement(
|
|
52
|
+
return /*#__PURE__*/React.createElement(AltTextEdit, {
|
|
53
53
|
view: view,
|
|
54
54
|
key: idx,
|
|
55
55
|
value: mediaNode.attrs.alt,
|
|
56
56
|
altTextValidator: options && options.altTextValidator,
|
|
57
|
-
|
|
57
|
+
onEscape: handleEsc
|
|
58
58
|
});
|
|
59
59
|
}
|
|
60
60
|
};
|
|
@@ -64,7 +64,10 @@ export var getLinkingToolbar = function getLinkingToolbar(toolbarBaseConfig, med
|
|
|
64
64
|
/** Focus should move to the 'Add link' button when the toolbar closes
|
|
65
65
|
* and not close the floating toolbar.
|
|
66
66
|
*/
|
|
67
|
-
|
|
67
|
+
var tr = view.state.tr,
|
|
68
|
+
dispatch = view.dispatch;
|
|
69
|
+
pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d = pluginInjectionApi.dependencies.floatingToolbar.actions) === null || _pluginInjectionApi$d === void 0 ? void 0 : _pluginInjectionApi$d.forceFocusSelector(FORCE_FOCUS_SELECTOR)(tr);
|
|
70
|
+
dispatch(tr);
|
|
68
71
|
},
|
|
69
72
|
onSubmit: function onSubmit(href, meta) {
|
|
70
73
|
setUrlToMedia(href, meta.inputMethod)(view.state, view.dispatch, view);
|
|
@@ -26,8 +26,8 @@ import { normalizeUrl } from '@atlaskit/editor-common/utils';
|
|
|
26
26
|
import { R400 } from '@atlaskit/theme/colors';
|
|
27
27
|
import { INPUT_METHOD } from '../../analytics/types/enums';
|
|
28
28
|
import { mediaLinkToolbarMessages } from './media-linking-toolbar-messages';
|
|
29
|
-
var validationWrapper = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n line-height: 0;\n padding:
|
|
30
|
-
var buttonWrapper = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n padding:
|
|
29
|
+
var validationWrapper = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n line-height: 0;\n padding: ", " ", "\n ", " 0;\n margin: 0 ", " 0 ", ";\n border-top: 1px solid ", ";\n align-items: start;\n display: flex;\n flex-direction: column;\n"])), "var(--ds-space-150, 12px)", "var(--ds-space-300, 24px)", "var(--ds-space-150, 12px)", "var(--ds-space-050, 4px)", "var(--ds-space-400, 32px)", "var(--ds-border-danger, ".concat(R400, ")"));
|
|
30
|
+
var buttonWrapper = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n padding: ", " ", "\n ", " 0px;\n"])), "var(--ds-space-050, 4px)", "var(--ds-space-100, 8px)", "var(--ds-space-050, 4px)");
|
|
31
31
|
export var LinkAddToolbar = /*#__PURE__*/function (_React$PureComponent) {
|
|
32
32
|
_inherits(LinkAddToolbar, _React$PureComponent);
|
|
33
33
|
var _super = _createSuper(LinkAddToolbar);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { deleteSelection, splitBlock } from '@atlaskit/editor-prosemirror/commands';
|
|
2
2
|
import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
|
|
3
3
|
import { findPositionOfNodeBefore } from '@atlaskit/editor-prosemirror/utils';
|
|
4
|
-
import { createParagraphNear, createNewParagraphBelow } from '
|
|
4
|
+
import { createParagraphNear, createNewParagraphBelow } from '@atlaskit/editor-common/utils';
|
|
5
5
|
import { isTemporary } from '../../../utils';
|
|
6
6
|
import { mapSlice } from '../../../utils/slice';
|
|
7
7
|
import { walkUpTreeUntil, removeNestedEmptyEls, unwrap } from '../../../utils/dom';
|
|
@@ -7,7 +7,7 @@ import { Fragment, Slice } from '@atlaskit/editor-prosemirror/model';
|
|
|
7
7
|
import { TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
8
8
|
import { findParentNodeOfType, findParentNodeOfTypeClosestToPos } from '@atlaskit/editor-prosemirror/utils';
|
|
9
9
|
import { uuid } from '@atlaskit/adf-schema';
|
|
10
|
-
import { filterCommand as filter, isEmptySelectionAtStart,
|
|
10
|
+
import { filterCommand as filter, isEmptySelectionAtStart, isEmptySelectionAtEnd, deleteEmptyParagraphAndMoveBlockUp } from '@atlaskit/editor-common/utils';
|
|
11
11
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INDENT_DIRECTION, INDENT_TYPE, INPUT_METHOD, withAnalytics } from '../../analytics';
|
|
12
12
|
import { insertTaskDecisionWithAnalytics } from '../commands';
|
|
13
13
|
import { joinAtCut, liftSelection, wrapSelectionInTaskList } from './commands';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as keymaps from '../../../keymaps';
|
|
2
|
-
import { keymap } from '
|
|
2
|
+
import { keymap } from '@atlaskit/editor-common/keymaps';
|
|
3
3
|
import { redoFromKeyboard, undoFromKeyboard } from '../commands';
|
|
4
4
|
export function keymapPlugin() {
|
|
5
5
|
var list = {};
|
|
@@ -34,6 +34,7 @@ var colorPickerWrapper = function colorPickerWrapper(theme) {
|
|
|
34
34
|
};
|
|
35
35
|
/* eslint-enable @atlaskit/design-system/ensure-design-token-usage */
|
|
36
36
|
|
|
37
|
+
var ColorPaletteWithListeners = withOuterListeners(ColorPalette);
|
|
37
38
|
var ColorPickerButton = function ColorPickerButton(props) {
|
|
38
39
|
var buttonRef = React.useRef(null);
|
|
39
40
|
var _React$useState = React.useState(false),
|
|
@@ -75,7 +76,6 @@ var ColorPickerButton = function ColorPickerButton(props) {
|
|
|
75
76
|
setIsPopupPositioned(true);
|
|
76
77
|
return position;
|
|
77
78
|
}, []);
|
|
78
|
-
var ColorPaletteWithListeners = withOuterListeners(ColorPalette);
|
|
79
79
|
var onChange = props.onChange,
|
|
80
80
|
createAnalyticsEvent = props.createAnalyticsEvent,
|
|
81
81
|
colorPalette = props.colorPalette,
|
|
@@ -163,8 +163,8 @@ var ColorPickerButton = function ColorPickerButton(props) {
|
|
|
163
163
|
var currentColor = props.currentColor && props.hexToPaletteColor ? props.hexToPaletteColor(props.currentColor) : props.currentColor;
|
|
164
164
|
var buttonStyle = function buttonStyle(theme) {
|
|
165
165
|
var _props$size, _props$size2, _props$size3;
|
|
166
|
-
return css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n padding: 0 10px;\n background-color: ", ";\n ", "\n &:before {\n display: flex;\n justify-content: center;\n align-items: center;\n align-self: center;\n content: '';\n border: 1px solid ", ";\n border-radius: ", "px;\n background-color: ", ";\n width: ", ";\n height: ", ";\n padding: 0;\n margin: 0px
|
|
167
|
-
!!((_props$size = props.size) !== null && _props$size !== void 0 && _props$size.height) && "height: inherit;", DEFAULT_BORDER_COLOR, borderRadius(), currentColor || 'transparent', ((_props$size2 = props.size) === null || _props$size2 === void 0 ? void 0 : _props$size2.width) || '14px', ((_props$size3 = props.size) === null || _props$size3 === void 0 ? void 0 : _props$size3.height) || '14px', themed({
|
|
166
|
+
return css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n padding: 0 10px;\n background-color: ", ";\n ", "\n &:before {\n display: flex;\n justify-content: center;\n align-items: center;\n align-self: center;\n content: '';\n border: 1px solid ", ";\n border-radius: ", "px;\n background-color: ", ";\n width: ", ";\n height: ", ";\n padding: 0;\n margin: 0px ", ";\n }\n &:hover {\n background: ", ";\n }\n "])), "var(--ds-background-neutral-subtle, transparent)", /* If custom props size height, override the button base height property */
|
|
167
|
+
!!((_props$size = props.size) !== null && _props$size !== void 0 && _props$size.height) && "height: inherit;", DEFAULT_BORDER_COLOR, borderRadius(), currentColor || 'transparent', ((_props$size2 = props.size) === null || _props$size2 === void 0 ? void 0 : _props$size2.width) || '14px', ((_props$size3 = props.size) === null || _props$size3 === void 0 ? void 0 : _props$size3.height) || '14px', "var(--ds-space-025, 2px)", themed({
|
|
168
168
|
light: "var(--ds-background-neutral-subtle-hovered, ".concat(N30A, ")"),
|
|
169
169
|
dark: "var(--ds-background-neutral-subtle-hovered, ".concat(N30A, ")")
|
|
170
170
|
})(theme));
|
package/dist/esm/ui/styles.js
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
2
|
-
var _templateObject, _templateObject2
|
|
2
|
+
var _templateObject, _templateObject2;
|
|
3
3
|
import { css } from '@emotion/react';
|
|
4
4
|
export { shortcutStyle } from '@atlaskit/editor-shared-styles/shortcut';
|
|
5
5
|
export { scrollbarStyles } from '@atlaskit/editor-shared-styles/scrollbar';
|
|
6
|
-
export var
|
|
7
|
-
export var
|
|
8
|
-
export var buttonContentStyle = css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n display: flex;\n min-width: 80px;\n align-items: center;\n overflow: hidden;\n justify-content: center;\n flex-direction: column;\n padding: ", ";\n"])), "var(--ds-space-075, 6px)");
|
|
9
|
-
export var buttonContentReducedSpacingStyle = css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n padding: ", ";\n"])), "var(--ds-space-100, 8px)");
|
|
10
|
-
export var clickSelectWrapperStyle = css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n user-select: all;\n"])));
|
|
6
|
+
export var expandIconWrapperStyle = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n margin-left: -8px;\n"])));
|
|
7
|
+
export var clickSelectWrapperStyle = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n user-select: all;\n"])));
|