@atlaskit/editor-core 187.10.0 → 187.10.2
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 +13 -0
- package/dist/cjs/create-editor/feature-flags-from-props.js +3 -5
- package/dist/cjs/labs/next/presets/default.js +2 -2
- package/dist/cjs/labs/next/presets/universal.js +1 -3
- 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/ui/ColorPickerButton/index.js +3 -3
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/create-editor/feature-flags-from-props.js +3 -5
- package/dist/es2019/labs/next/presets/default.js +1 -1
- package/dist/es2019/labs/next/presets/universal.js +1 -3
- 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/ui/ColorPickerButton/index.js +2 -2
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/create-editor/feature-flags-from-props.js +3 -5
- package/dist/esm/labs/next/presets/default.js +1 -1
- package/dist/esm/labs/next/presets/universal.js +1 -3
- 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/ui/ColorPickerButton/index.js +3 -3
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/create-editor/feature-flags-from-props.d.ts +1 -1
- package/dist/types/labs/next/presets/default.d.ts +40 -8
- 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/list/types.d.ts +1 -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/view-update-subscription/subscribe/toolbarAndPickerUpdates.d.ts +1 -1
- package/dist/types/ui/ColorPickerButton/index.d.ts +2 -2
- package/dist/types-ts4.5/create-editor/feature-flags-from-props.d.ts +1 -1
- package/dist/types-ts4.5/labs/next/presets/default.d.ts +44 -8
- 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/list/types.d.ts +1 -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/view-update-subscription/subscribe/toolbarAndPickerUpdates.d.ts +1 -1
- package/dist/types-ts4.5/ui/ColorPickerButton/index.d.ts +2 -2
- package/package.json +3 -2
- package/report.api.md +3 -21
- package/tmp/api-report-tmp.d.ts +3 -18
- package/dist/cjs/plugins/editor-disabled/index.js +0 -75
- package/dist/es2019/plugins/editor-disabled/index.js +0 -62
- package/dist/esm/plugins/editor-disabled/index.js +0 -66
- package/dist/types/plugins/editor-disabled/index.d.ts +0 -13
- package/dist/types-ts4.5/plugins/editor-disabled/index.d.ts +0 -13
package/.eslintrc.js
CHANGED
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @atlaskit/editor-core
|
|
2
2
|
|
|
3
|
+
## 187.10.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`7cca8fcf473`](https://bitbucket.org/atlassian/atlassian-frontend/commits/7cca8fcf473) - ED-18274: Remove unused feature flags listNumberContinuity and restartNumberedListsToolbar (not planned for future use either) (all related to the restart lists project)
|
|
8
|
+
|
|
9
|
+
## 187.10.1
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [`31405891e32`](https://bitbucket.org/atlassian/atlassian-frontend/commits/31405891e32) - Extract editor disabled plugin as separate package.
|
|
14
|
+
- Updated dependencies
|
|
15
|
+
|
|
3
16
|
## 187.10.0
|
|
4
17
|
|
|
5
18
|
### Minor Changes
|
|
@@ -32,7 +32,7 @@ function getSpellCheck(featureFlags) {
|
|
|
32
32
|
* which is used by both current and archv3 editors.
|
|
33
33
|
*/
|
|
34
34
|
function createFeatureFlagsFromProps(props) {
|
|
35
|
-
var _props$featureFlags, _ref, _props$featureFlags$u, _props$featureFlags2, _props$featureFlags3, _props$allowLayouts, _props$performanceTra, _props$performanceTra2, _props$featureFlags4, _props$featureFlags5, _props$allowTables, _props$featureFlags6, _props$featureFlags7, _props$allowTables2, _props$featureFlags8, _props$featureFlags9, _props$allowTables3, _props$featureFlags10, _props$featureFlags11, _props$allowTables4, _props$allowTables5, _props$featureFlags12, _props$featureFlags13, _props$allowTables6, _props$allowExtension, _props$featureFlags14, _props$featureFlags15, _props$featureFlags16, _props$featureFlags17, _props$featureFlags18, _props$featureFlags19, _props$featureFlags20, _props$featureFlags21, _props$featureFlags22, _props$featureFlags23, _props$featureFlags24, _props$featureFlags25, _props$featureFlags26, _props$featureFlags27, _props$featureFlags28, _props$featureFlags29, _props$featureFlags30, _props$featureFlags31, _props$collabEdit, _props$collabEdit2, _props$featureFlags32, _props$featureFlags33, _props$featureFlags34, _props$featureFlags35, _props$featureFlags36, _props$featureFlags37, _props$featureFlags38, _props$featureFlags39, _props$featureFlags40, _props$featureFlags41, _props$featureFlags42, _props$featureFlags43, _props$featureFlags44
|
|
35
|
+
var _props$featureFlags, _ref, _props$featureFlags$u, _props$featureFlags2, _props$featureFlags3, _props$allowLayouts, _props$performanceTra, _props$performanceTra2, _props$featureFlags4, _props$featureFlags5, _props$allowTables, _props$featureFlags6, _props$featureFlags7, _props$allowTables2, _props$featureFlags8, _props$featureFlags9, _props$allowTables3, _props$featureFlags10, _props$featureFlags11, _props$allowTables4, _props$allowTables5, _props$featureFlags12, _props$featureFlags13, _props$allowTables6, _props$allowExtension, _props$featureFlags14, _props$featureFlags15, _props$featureFlags16, _props$featureFlags17, _props$featureFlags18, _props$featureFlags19, _props$featureFlags20, _props$featureFlags21, _props$featureFlags22, _props$featureFlags23, _props$featureFlags24, _props$featureFlags25, _props$featureFlags26, _props$featureFlags27, _props$featureFlags28, _props$featureFlags29, _props$featureFlags30, _props$featureFlags31, _props$collabEdit, _props$collabEdit2, _props$featureFlags32, _props$featureFlags33, _props$featureFlags34, _props$featureFlags35, _props$featureFlags36, _props$featureFlags37, _props$featureFlags38, _props$featureFlags39, _props$featureFlags40, _props$featureFlags41, _props$featureFlags42, _props$featureFlags43, _props$featureFlags44;
|
|
36
36
|
var normalizedFeatureFlags = (0, _normalizeFeatureFlags.normalizeFeatureFlags)(props.featureFlags);
|
|
37
37
|
var tableCellOptionsInFloatingToolbar = normalizedFeatureFlags.tableCellOptionsInFloatingToolbar || ((_props$featureFlags = props.featureFlags) === null || _props$featureFlags === void 0 ? void 0 : _props$featureFlags.tableCellOptionsInFloatingToolbar) || undefined;
|
|
38
38
|
|
|
@@ -74,11 +74,9 @@ function createFeatureFlagsFromProps(props) {
|
|
|
74
74
|
// Including fallback to props.featureFlags so that mobile feature flags
|
|
75
75
|
// are included (they are not kebab cased)
|
|
76
76
|
restartNumberedLists: normalizedFeatureFlags.restartNumberedLists === true || ((_props$featureFlags40 = props.featureFlags) === null || _props$featureFlags40 === void 0 ? void 0 : _props$featureFlags40.restartNumberedLists) === true,
|
|
77
|
-
|
|
78
|
-
restartNumberedListsToolbar: normalizedFeatureFlags.restartNumberedListsToolbar === true || ((_props$featureFlags42 = props.featureFlags) === null || _props$featureFlags42 === void 0 ? void 0 : _props$featureFlags42.restartNumberedListsToolbar) === true,
|
|
79
|
-
useSomewhatSemanticTextColorNames: Boolean(typeof normalizedFeatureFlags.useSomewhatSemanticTextColorNames === 'boolean' && !!normalizedFeatureFlags.useSomewhatSemanticTextColorNames || (typeof ((_props$featureFlags43 = props.featureFlags) === null || _props$featureFlags43 === void 0 ? void 0 : _props$featureFlags43.useSomewhatSemanticTextColorNames) === 'boolean' ? !!((_props$featureFlags44 = props.featureFlags) !== null && _props$featureFlags44 !== void 0 && _props$featureFlags44.useSomewhatSemanticTextColorNames) : false)),
|
|
77
|
+
useSomewhatSemanticTextColorNames: Boolean(typeof normalizedFeatureFlags.useSomewhatSemanticTextColorNames === 'boolean' && !!normalizedFeatureFlags.useSomewhatSemanticTextColorNames || (typeof ((_props$featureFlags41 = props.featureFlags) === null || _props$featureFlags41 === void 0 ? void 0 : _props$featureFlags41.useSomewhatSemanticTextColorNames) === 'boolean' ? !!((_props$featureFlags42 = props.featureFlags) !== null && _props$featureFlags42 !== void 0 && _props$featureFlags42.useSomewhatSemanticTextColorNames) : false)),
|
|
80
78
|
lpLinkPickerFocusTrap: Boolean(normalizedFeatureFlags.lpLinkPickerFocusTrap),
|
|
81
|
-
preventPopupOverflow: Boolean(typeof ((_props$
|
|
79
|
+
preventPopupOverflow: Boolean(typeof ((_props$featureFlags43 = props.featureFlags) === null || _props$featureFlags43 === void 0 ? void 0 : _props$featureFlags43['prevent-popup-overflow']) === 'boolean' ? !!((_props$featureFlags44 = props.featureFlags) !== null && _props$featureFlags44 !== void 0 && _props$featureFlags44['prevent-popup-overflow']) : false),
|
|
82
80
|
// duplicated logic from `create-plugins-list.ts` due to presets not being finalised
|
|
83
81
|
useBetterTypeaheadNavigation: Boolean(typeof pseudoNormalisedUseBetterTypeaheadNavigation === 'boolean' ? !!pseudoNormalisedUseBetterTypeaheadNavigation : true)
|
|
84
82
|
});
|
|
@@ -14,7 +14,7 @@ var _textFormatting = _interopRequireDefault(require("../../../plugins/text-form
|
|
|
14
14
|
var _editorPluginWidth = require("@atlaskit/editor-plugin-width");
|
|
15
15
|
var _unsupportedContent = _interopRequireDefault(require("../../../plugins/unsupported-content"));
|
|
16
16
|
var _base = _interopRequireDefault(require("../../../plugins/base"));
|
|
17
|
-
var
|
|
17
|
+
var _editorPluginEditorDisabled = require("@atlaskit/editor-plugin-editor-disabled");
|
|
18
18
|
var _typeAhead = _interopRequireDefault(require("../../../plugins/type-ahead"));
|
|
19
19
|
var _submitEditor = _interopRequireDefault(require("../../../plugins/submit-editor"));
|
|
20
20
|
var _fakeTextCursor = _interopRequireDefault(require("../../../plugins/fake-text-cursor"));
|
|
@@ -74,7 +74,7 @@ function createDefaultPreset(options) {
|
|
|
74
74
|
return builder;
|
|
75
75
|
}).add([_editorPluginHyperlink.hyperlinkPlugin, options.hyperlinkOptions]).add([_textFormatting.default, options.textFormatting]).add(_editorPluginWidth.widthPlugin).add([_quickInsert.default, options.quickInsert]).add([_typeAhead.default, options.typeAhead || {
|
|
76
76
|
createAnalyticsEvent: options.createAnalyticsEvent
|
|
77
|
-
}]).add(_unsupportedContent.default).add(
|
|
77
|
+
}]).add(_unsupportedContent.default).add(_editorPluginEditorDisabled.editorDisabledPlugin).add([_submitEditor.default, options.submitEditor]).add(_fakeTextCursor.default).add(_floatingToolbar.default).add([_selection.default, options.selection]).add([_codeBlock.default, options.codeBlock || {
|
|
78
78
|
appearance: 'full-page'
|
|
79
79
|
}]);
|
|
80
80
|
return preset;
|
|
@@ -69,9 +69,7 @@ function createUniversalPreset(appearance, props, featureFlags, prevAppearance,
|
|
|
69
69
|
}
|
|
70
70
|
return builder;
|
|
71
71
|
}).add([_plugins.listPlugin, {
|
|
72
|
-
restartNumberedLists: featureFlags === null || featureFlags === void 0 ? void 0 : featureFlags.restartNumberedLists
|
|
73
|
-
restartNumberedListsToolbar: featureFlags === null || featureFlags === void 0 ? void 0 : featureFlags.restartNumberedListsToolbar,
|
|
74
|
-
listNumberContinuity: featureFlags === null || featureFlags === void 0 ? void 0 : featureFlags.listNumberContinuity
|
|
72
|
+
restartNumberedLists: featureFlags === null || featureFlags === void 0 ? void 0 : featureFlags.restartNumberedLists
|
|
75
73
|
}]).maybeAdd(_plugins.rulePlugin, function (plugin, builder) {
|
|
76
74
|
if (props.allowRule) {
|
|
77
75
|
return builder.add(plugin);
|
|
@@ -13,12 +13,10 @@ var _state = require("@atlaskit/editor-prosemirror/state");
|
|
|
13
13
|
var _utils = require("@atlaskit/editor-prosemirror/utils");
|
|
14
14
|
var _camelCase = _interopRequireDefault(require("lodash/camelCase"));
|
|
15
15
|
var _ui = require("@atlaskit/editor-common/ui");
|
|
16
|
-
var
|
|
16
|
+
var _providerFactory = require("@atlaskit/editor-common/provider-factory");
|
|
17
17
|
var _types = require("../analytics/types");
|
|
18
18
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
19
|
-
var _pluginKey = require("
|
|
20
|
-
var _editorDisabled = require("../editor-disabled");
|
|
21
|
-
var _pluginKey2 = require("./pm-plugins/toolbar-data/plugin-key");
|
|
19
|
+
var _pluginKey = require("./pm-plugins/toolbar-data/plugin-key");
|
|
22
20
|
var _plugin = require("./pm-plugins/toolbar-data/plugin");
|
|
23
21
|
var _commands = require("./pm-plugins/toolbar-data/commands");
|
|
24
22
|
var _ConfirmationModal = require("./ui/ConfirmationModal");
|
|
@@ -27,6 +25,7 @@ var _utils2 = require("./utils");
|
|
|
27
25
|
var _ErrorBoundary = require("../../ui/ErrorBoundary");
|
|
28
26
|
var _toolbar = require("../copy-button/toolbar");
|
|
29
27
|
var _forceFocus = _interopRequireWildcard(require("./pm-plugins/force-focus"));
|
|
28
|
+
var _hooks = require("@atlaskit/editor-common/hooks");
|
|
30
29
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
31
30
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
32
31
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
@@ -123,8 +122,6 @@ function filterUndefined(x) {
|
|
|
123
122
|
return !!x;
|
|
124
123
|
}
|
|
125
124
|
var floatingToolbarPlugin = function floatingToolbarPlugin(_, api) {
|
|
126
|
-
var _api$dependencies, _api$dependencies$fea;
|
|
127
|
-
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()) || {};
|
|
128
125
|
return {
|
|
129
126
|
name: 'floatingToolbar',
|
|
130
127
|
pmPlugins: function pmPlugins() {
|
|
@@ -159,6 +156,17 @@ var floatingToolbarPlugin = function floatingToolbarPlugin(_, api) {
|
|
|
159
156
|
actions: {
|
|
160
157
|
forceFocusSelector: _forceFocus.forceFocusSelector
|
|
161
158
|
},
|
|
159
|
+
getSharedState: function getSharedState(editorState) {
|
|
160
|
+
var _pluginKey$getState$g, _pluginKey$getState, _pluginKey$getState$g2;
|
|
161
|
+
if (!editorState) {
|
|
162
|
+
return undefined;
|
|
163
|
+
}
|
|
164
|
+
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;
|
|
165
|
+
return {
|
|
166
|
+
configWithNodeInfo: configWithNodeInfo,
|
|
167
|
+
floatingToolbarData: _pluginKey.pluginKey.getState(editorState)
|
|
168
|
+
};
|
|
169
|
+
},
|
|
162
170
|
contentComponent: function contentComponent(_ref3) {
|
|
163
171
|
var popupsMountPoint = _ref3.popupsMountPoint,
|
|
164
172
|
popupsBoundariesElement = _ref3.popupsBoundariesElement,
|
|
@@ -166,134 +174,150 @@ var floatingToolbarPlugin = function floatingToolbarPlugin(_, api) {
|
|
|
166
174
|
editorView = _ref3.editorView,
|
|
167
175
|
providerFactory = _ref3.providerFactory,
|
|
168
176
|
dispatchAnalyticsEvent = _ref3.dispatchAnalyticsEvent;
|
|
169
|
-
return /*#__PURE__*/_react.default.createElement(
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
var _configWithNodeInfo$c, _configWithNodeInfo$c2;
|
|
178
|
-
var editorDisabledPlugin = _ref4.editorDisabledPlugin,
|
|
179
|
-
floatingToolbarState = _ref4.floatingToolbarState,
|
|
180
|
-
floatingToolbarData = _ref4.floatingToolbarData,
|
|
181
|
-
extensionsState = _ref4.extensionsState;
|
|
182
|
-
var configWithNodeInfo = floatingToolbarState === null || floatingToolbarState === void 0 ? void 0 : floatingToolbarState.getConfigWithNodeInfo(editorView.state);
|
|
183
|
-
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)) {
|
|
184
|
-
return null;
|
|
185
|
-
}
|
|
186
|
-
var config = configWithNodeInfo.config,
|
|
187
|
-
node = configWithNodeInfo.node;
|
|
188
|
-
var title = config.title,
|
|
189
|
-
_config$getDomRef = config.getDomRef,
|
|
190
|
-
getDomRef = _config$getDomRef === void 0 ? getDomRefFromSelection : _config$getDomRef,
|
|
191
|
-
items = config.items,
|
|
192
|
-
_config$align = config.align,
|
|
193
|
-
align = _config$align === void 0 ? 'center' : _config$align,
|
|
194
|
-
_config$className = config.className,
|
|
195
|
-
className = _config$className === void 0 ? '' : _config$className,
|
|
196
|
-
height = config.height,
|
|
197
|
-
width = config.width,
|
|
198
|
-
zIndex = config.zIndex,
|
|
199
|
-
_config$offset = config.offset,
|
|
200
|
-
offset = _config$offset === void 0 ? [0, 12] : _config$offset,
|
|
201
|
-
forcePlacement = config.forcePlacement,
|
|
202
|
-
preventPopupOverflow = config.preventPopupOverflow,
|
|
203
|
-
onPositionCalculated = config.onPositionCalculated,
|
|
204
|
-
focusTrap = config.focusTrap;
|
|
205
|
-
var targetRef = getDomRef(editorView, dispatchAnalyticsEvent);
|
|
206
|
-
if (!targetRef || editorDisabledPlugin && editorDisabledPlugin.editorDisabled) {
|
|
207
|
-
return null;
|
|
208
|
-
}
|
|
209
|
-
var customPositionCalculation;
|
|
210
|
-
var toolbarItems = (0, _toolbar.processCopyButtonItems)(editorView.state)(Array.isArray(items) ? items : items(node), api === null || api === void 0 ? void 0 : api.dependencies.decorations.actions.hoverDecoration);
|
|
211
|
-
if (onPositionCalculated) {
|
|
212
|
-
customPositionCalculation = function customPositionCalculation(nextPos) {
|
|
213
|
-
return onPositionCalculated(editorView, nextPos);
|
|
214
|
-
};
|
|
215
|
-
}
|
|
216
|
-
var dispatchCommand = function dispatchCommand(fn) {
|
|
217
|
-
return fn && fn(editorView.state, editorView.dispatch, editorView);
|
|
218
|
-
};
|
|
219
|
-
|
|
220
|
-
// Confirm dialog
|
|
221
|
-
var _ref5 = floatingToolbarData || {},
|
|
222
|
-
confirmDialogForItem = _ref5.confirmDialogForItem;
|
|
223
|
-
var confirmButtonItem = confirmDialogForItem ? toolbarItems[confirmDialogForItem] : undefined;
|
|
224
|
-
var scrollable = featureFlags.floatingToolbarCopyButton && config.scrollable;
|
|
225
|
-
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;
|
|
226
|
-
return /*#__PURE__*/_react.default.createElement(_ErrorBoundary.ErrorBoundary, {
|
|
227
|
-
component: _analytics.ACTION_SUBJECT.FLOATING_TOOLBAR_PLUGIN,
|
|
228
|
-
componentId: (0, _camelCase.default)(title),
|
|
229
|
-
dispatchAnalyticsEvent: dispatchAnalyticsEvent,
|
|
230
|
-
fallbackComponent: null
|
|
231
|
-
}, /*#__PURE__*/_react.default.createElement(_ui.Popup, {
|
|
232
|
-
ariaLabel: title,
|
|
233
|
-
offset: offset,
|
|
234
|
-
target: targetRef,
|
|
235
|
-
alignY: "bottom",
|
|
236
|
-
forcePlacement: forcePlacement,
|
|
237
|
-
fitHeight: height,
|
|
238
|
-
fitWidth: width,
|
|
239
|
-
alignX: align,
|
|
240
|
-
stick: true,
|
|
241
|
-
zIndex: zIndex,
|
|
242
|
-
mountTo: popupsMountPoint,
|
|
243
|
-
boundariesElement: popupsBoundariesElement,
|
|
244
|
-
scrollableElement: popupsScrollableElement,
|
|
245
|
-
onPositionCalculated: customPositionCalculation,
|
|
246
|
-
style: scrollable ? {
|
|
247
|
-
maxWidth: '100%'
|
|
248
|
-
} : {},
|
|
249
|
-
focusTrap: focusTrap,
|
|
250
|
-
preventOverflow: preventPopupOverflow
|
|
251
|
-
}, /*#__PURE__*/_react.default.createElement(_ToolbarLoader.ToolbarLoader, {
|
|
252
|
-
target: targetRef,
|
|
253
|
-
items: toolbarItems,
|
|
254
|
-
node: node,
|
|
255
|
-
dispatchCommand: dispatchCommand,
|
|
256
|
-
editorView: editorView,
|
|
257
|
-
className: className,
|
|
258
|
-
focusEditor: function focusEditor() {
|
|
259
|
-
return editorView.focus();
|
|
260
|
-
},
|
|
261
|
-
providerFactory: providerFactory,
|
|
262
|
-
popupsMountPoint: popupsMountPoint,
|
|
263
|
-
popupsBoundariesElement: popupsBoundariesElement,
|
|
264
|
-
popupsScrollableElement: popupsScrollableElement,
|
|
265
|
-
dispatchAnalyticsEvent: dispatchAnalyticsEvent,
|
|
266
|
-
extensionsProvider: extensionsState === null || extensionsState === void 0 ? void 0 : extensionsState.extensionProvider,
|
|
267
|
-
scrollable: scrollable,
|
|
268
|
-
featureFlags: featureFlags,
|
|
269
|
-
api: api
|
|
270
|
-
})), /*#__PURE__*/_react.default.createElement(_ConfirmationModal.ConfirmationModal, {
|
|
271
|
-
testId: "ak-floating-toolbar-confirmation-modal",
|
|
272
|
-
options: confirmDialogOptions,
|
|
273
|
-
onConfirm: function onConfirm() {
|
|
274
|
-
var isChecked = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
275
|
-
if (!!confirmDialogOptions.onConfirm) {
|
|
276
|
-
dispatchCommand(confirmDialogOptions.onConfirm(isChecked));
|
|
277
|
-
} else {
|
|
278
|
-
dispatchCommand(confirmButtonItem.onClick);
|
|
279
|
-
}
|
|
280
|
-
},
|
|
281
|
-
onClose: function onClose() {
|
|
282
|
-
dispatchCommand((0, _commands.hideConfirmDialog)());
|
|
283
|
-
// Need to set focus to Editor here,
|
|
284
|
-
// As when the Confirmation dialog pop up, and user interacts with the dialog, Editor loses focus.
|
|
285
|
-
// So when Confirmation dialog is closed, Editor does not have the focus, then cursor goes to the position 1 of the doc,
|
|
286
|
-
// instead of the cursor position before the dialog pop up.
|
|
287
|
-
if (!editorView.hasFocus()) {
|
|
288
|
-
editorView.focus();
|
|
289
|
-
}
|
|
290
|
-
}
|
|
291
|
-
}));
|
|
292
|
-
}
|
|
177
|
+
return /*#__PURE__*/_react.default.createElement(ContentComponent, {
|
|
178
|
+
editorView: editorView,
|
|
179
|
+
pluginInjectionApi: api,
|
|
180
|
+
popupsMountPoint: popupsMountPoint,
|
|
181
|
+
popupsBoundariesElement: popupsBoundariesElement,
|
|
182
|
+
popupsScrollableElement: popupsScrollableElement,
|
|
183
|
+
providerFactory: providerFactory,
|
|
184
|
+
dispatchAnalyticsEvent: dispatchAnalyticsEvent
|
|
293
185
|
});
|
|
294
186
|
}
|
|
295
187
|
};
|
|
296
188
|
};
|
|
189
|
+
function ContentComponent(_ref4) {
|
|
190
|
+
var _pluginInjectionApi$d, _pluginInjectionApi$d2, _configWithNodeInfo$c, _configWithNodeInfo$c2;
|
|
191
|
+
var pluginInjectionApi = _ref4.pluginInjectionApi,
|
|
192
|
+
editorView = _ref4.editorView,
|
|
193
|
+
popupsMountPoint = _ref4.popupsMountPoint,
|
|
194
|
+
popupsBoundariesElement = _ref4.popupsBoundariesElement,
|
|
195
|
+
popupsScrollableElement = _ref4.popupsScrollableElement,
|
|
196
|
+
providerFactory = _ref4.providerFactory,
|
|
197
|
+
dispatchAnalyticsEvent = _ref4.dispatchAnalyticsEvent;
|
|
198
|
+
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()) || {};
|
|
199
|
+
var _useSharedPluginState = (0, _hooks.useSharedPluginState)(pluginInjectionApi, ['floatingToolbar', 'editorDisabled']),
|
|
200
|
+
floatingToolbarState = _useSharedPluginState.floatingToolbarState,
|
|
201
|
+
editorDisabledState = _useSharedPluginState.editorDisabledState;
|
|
202
|
+
var _ref5 = floatingToolbarState !== null && floatingToolbarState !== void 0 ? floatingToolbarState : {},
|
|
203
|
+
configWithNodeInfo = _ref5.configWithNodeInfo,
|
|
204
|
+
floatingToolbarData = _ref5.floatingToolbarData;
|
|
205
|
+
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)) {
|
|
206
|
+
return null;
|
|
207
|
+
}
|
|
208
|
+
var config = configWithNodeInfo.config,
|
|
209
|
+
node = configWithNodeInfo.node;
|
|
210
|
+
var title = config.title,
|
|
211
|
+
_config$getDomRef = config.getDomRef,
|
|
212
|
+
getDomRef = _config$getDomRef === void 0 ? getDomRefFromSelection : _config$getDomRef,
|
|
213
|
+
items = config.items,
|
|
214
|
+
_config$align = config.align,
|
|
215
|
+
align = _config$align === void 0 ? 'center' : _config$align,
|
|
216
|
+
_config$className = config.className,
|
|
217
|
+
className = _config$className === void 0 ? '' : _config$className,
|
|
218
|
+
height = config.height,
|
|
219
|
+
width = config.width,
|
|
220
|
+
zIndex = config.zIndex,
|
|
221
|
+
_config$offset = config.offset,
|
|
222
|
+
offset = _config$offset === void 0 ? [0, 12] : _config$offset,
|
|
223
|
+
forcePlacement = config.forcePlacement,
|
|
224
|
+
preventPopupOverflow = config.preventPopupOverflow,
|
|
225
|
+
onPositionCalculated = config.onPositionCalculated,
|
|
226
|
+
focusTrap = config.focusTrap;
|
|
227
|
+
var targetRef = getDomRef(editorView, dispatchAnalyticsEvent);
|
|
228
|
+
if (!targetRef || editorDisabledState && editorDisabledState.editorDisabled) {
|
|
229
|
+
return null;
|
|
230
|
+
}
|
|
231
|
+
var customPositionCalculation;
|
|
232
|
+
var toolbarItems = (0, _toolbar.processCopyButtonItems)(editorView.state)(Array.isArray(items) ? items : items(node), pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.dependencies.decorations.actions.hoverDecoration);
|
|
233
|
+
if (onPositionCalculated) {
|
|
234
|
+
customPositionCalculation = function customPositionCalculation(nextPos) {
|
|
235
|
+
return onPositionCalculated(editorView, nextPos);
|
|
236
|
+
};
|
|
237
|
+
}
|
|
238
|
+
var dispatchCommand = function dispatchCommand(fn) {
|
|
239
|
+
return fn && fn(editorView.state, editorView.dispatch, editorView);
|
|
240
|
+
};
|
|
241
|
+
|
|
242
|
+
// Confirm dialog
|
|
243
|
+
var _ref6 = floatingToolbarData || {},
|
|
244
|
+
confirmDialogForItem = _ref6.confirmDialogForItem;
|
|
245
|
+
var confirmButtonItem = confirmDialogForItem ? toolbarItems[confirmDialogForItem] : undefined;
|
|
246
|
+
var scrollable = featureFlags.floatingToolbarCopyButton && config.scrollable;
|
|
247
|
+
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;
|
|
248
|
+
return /*#__PURE__*/_react.default.createElement(_ErrorBoundary.ErrorBoundary, {
|
|
249
|
+
component: _analytics.ACTION_SUBJECT.FLOATING_TOOLBAR_PLUGIN,
|
|
250
|
+
componentId: (0, _camelCase.default)(title),
|
|
251
|
+
dispatchAnalyticsEvent: dispatchAnalyticsEvent,
|
|
252
|
+
fallbackComponent: null
|
|
253
|
+
}, /*#__PURE__*/_react.default.createElement(_ui.Popup, {
|
|
254
|
+
ariaLabel: title,
|
|
255
|
+
offset: offset,
|
|
256
|
+
target: targetRef,
|
|
257
|
+
alignY: "bottom",
|
|
258
|
+
forcePlacement: forcePlacement,
|
|
259
|
+
fitHeight: height,
|
|
260
|
+
fitWidth: width,
|
|
261
|
+
alignX: align,
|
|
262
|
+
stick: true,
|
|
263
|
+
zIndex: zIndex,
|
|
264
|
+
mountTo: popupsMountPoint,
|
|
265
|
+
boundariesElement: popupsBoundariesElement,
|
|
266
|
+
scrollableElement: popupsScrollableElement,
|
|
267
|
+
onPositionCalculated: customPositionCalculation,
|
|
268
|
+
style: scrollable ? {
|
|
269
|
+
maxWidth: '100%'
|
|
270
|
+
} : {},
|
|
271
|
+
focusTrap: focusTrap,
|
|
272
|
+
preventOverflow: preventPopupOverflow
|
|
273
|
+
}, /*#__PURE__*/_react.default.createElement(_providerFactory.WithProviders, {
|
|
274
|
+
providerFactory: providerFactory,
|
|
275
|
+
providers: ['extensionProvider'],
|
|
276
|
+
renderNode: function renderNode(providers) {
|
|
277
|
+
return /*#__PURE__*/_react.default.createElement(_ToolbarLoader.ToolbarLoader, {
|
|
278
|
+
target: targetRef,
|
|
279
|
+
items: toolbarItems,
|
|
280
|
+
node: node,
|
|
281
|
+
dispatchCommand: dispatchCommand,
|
|
282
|
+
editorView: editorView,
|
|
283
|
+
className: className,
|
|
284
|
+
focusEditor: function focusEditor() {
|
|
285
|
+
return editorView.focus();
|
|
286
|
+
},
|
|
287
|
+
providerFactory: providerFactory,
|
|
288
|
+
popupsMountPoint: popupsMountPoint,
|
|
289
|
+
popupsBoundariesElement: popupsBoundariesElement,
|
|
290
|
+
popupsScrollableElement: popupsScrollableElement,
|
|
291
|
+
dispatchAnalyticsEvent: dispatchAnalyticsEvent,
|
|
292
|
+
extensionsProvider: providers.extensionProvider,
|
|
293
|
+
scrollable: scrollable,
|
|
294
|
+
featureFlags: featureFlags,
|
|
295
|
+
api: pluginInjectionApi
|
|
296
|
+
});
|
|
297
|
+
}
|
|
298
|
+
})), /*#__PURE__*/_react.default.createElement(_ConfirmationModal.ConfirmationModal, {
|
|
299
|
+
testId: "ak-floating-toolbar-confirmation-modal",
|
|
300
|
+
options: confirmDialogOptions,
|
|
301
|
+
onConfirm: function onConfirm() {
|
|
302
|
+
var isChecked = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
303
|
+
if (!!confirmDialogOptions.onConfirm) {
|
|
304
|
+
dispatchCommand(confirmDialogOptions.onConfirm(isChecked));
|
|
305
|
+
} else {
|
|
306
|
+
dispatchCommand(confirmButtonItem.onClick);
|
|
307
|
+
}
|
|
308
|
+
},
|
|
309
|
+
onClose: function onClose() {
|
|
310
|
+
dispatchCommand((0, _commands.hideConfirmDialog)());
|
|
311
|
+
// Need to set focus to Editor here,
|
|
312
|
+
// As when the Confirmation dialog pop up, and user interacts with the dialog, Editor loses focus.
|
|
313
|
+
// So when Confirmation dialog is closed, Editor does not have the focus, then cursor goes to the position 1 of the doc,
|
|
314
|
+
// instead of the cursor position before the dialog pop up.
|
|
315
|
+
if (!editorView.hasFocus()) {
|
|
316
|
+
editorView.focus();
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
}));
|
|
320
|
+
}
|
|
297
321
|
var _default = floatingToolbarPlugin;
|
|
298
322
|
/**
|
|
299
323
|
*
|
|
@@ -320,7 +344,6 @@ function sanitizeFloatingToolbarConfig(config) {
|
|
|
320
344
|
}
|
|
321
345
|
function floatingToolbarPluginFactory(options) {
|
|
322
346
|
var floatingToolbarHandlers = options.floatingToolbarHandlers,
|
|
323
|
-
dispatch = options.dispatch,
|
|
324
347
|
providerFactory = options.providerFactory,
|
|
325
348
|
getIntl = options.getIntl;
|
|
326
349
|
var intl = getIntl();
|
|
@@ -335,7 +358,6 @@ function floatingToolbarPluginFactory(options) {
|
|
|
335
358
|
};
|
|
336
359
|
var apply = function apply(tr, pluginState) {
|
|
337
360
|
var newPluginState = _objectSpread({}, pluginState);
|
|
338
|
-
dispatch(pluginKey, newPluginState);
|
|
339
361
|
return newPluginState;
|
|
340
362
|
};
|
|
341
363
|
return new _safePlugin.SafePlugin({
|
|
@@ -4,9 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.checkShouldForceFocusAndApply = checkShouldForceFocusAndApply;
|
|
7
|
-
exports.default = void 0;
|
|
8
|
-
exports.forceFocusSelector = forceFocusSelector;
|
|
9
|
-
exports.forceFocusStateKey = void 0;
|
|
7
|
+
exports.forceFocusStateKey = exports.forceFocusSelector = exports.default = void 0;
|
|
10
8
|
var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
|
|
11
9
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
12
10
|
var forceFocusStateKey = new _state.PluginKey('forceFocusStatePlugin');
|
|
@@ -40,17 +38,18 @@ var _default = function _default() {
|
|
|
40
38
|
* The provided selector should be the floating toolbar button that needs focus.
|
|
41
39
|
*/
|
|
42
40
|
exports.default = _default;
|
|
43
|
-
function forceFocusSelector(selector
|
|
44
|
-
|
|
45
|
-
return
|
|
41
|
+
var forceFocusSelector = function forceFocusSelector(selector) {
|
|
42
|
+
return function (tr) {
|
|
43
|
+
return tr.setMeta(forceFocusStateKey, {
|
|
46
44
|
selector: selector
|
|
47
|
-
})
|
|
48
|
-
}
|
|
49
|
-
}
|
|
45
|
+
});
|
|
46
|
+
};
|
|
47
|
+
};
|
|
50
48
|
|
|
51
49
|
/**
|
|
52
50
|
* If a selector is set and the element exists, focus it.
|
|
53
51
|
*/
|
|
52
|
+
exports.forceFocusSelector = forceFocusSelector;
|
|
54
53
|
function checkShouldForceFocusAndApply(view) {
|
|
55
54
|
var state = view === null || view === void 0 ? void 0 : view.state;
|
|
56
55
|
if (state) {
|
|
@@ -65,7 +64,9 @@ function checkShouldForceFocusAndApply(view) {
|
|
|
65
64
|
inline: 'nearest'
|
|
66
65
|
});
|
|
67
66
|
focusableElement.focus();
|
|
68
|
-
|
|
67
|
+
var tr = view.state.tr,
|
|
68
|
+
dispatch = view.dispatch;
|
|
69
|
+
dispatch(forceFocusSelector(null)(tr));
|
|
69
70
|
}
|
|
70
71
|
}
|
|
71
72
|
}
|
|
@@ -112,25 +112,32 @@ var ExtensionsPlaceholder = function ExtensionsPlaceholder(props) {
|
|
|
112
112
|
extensions = _useState2[0],
|
|
113
113
|
setExtensions = _useState2[1];
|
|
114
114
|
(0, _react.useEffect)(function () {
|
|
115
|
-
|
|
116
|
-
getExtensions();
|
|
117
|
-
}
|
|
115
|
+
getExtensions();
|
|
118
116
|
function getExtensions() {
|
|
119
117
|
return _getExtensions.apply(this, arguments);
|
|
120
118
|
} // leaving dependencies array empty so that this effect runs just once on component mount
|
|
121
119
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
122
120
|
function _getExtensions() {
|
|
123
121
|
_getExtensions = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3() {
|
|
122
|
+
var provider;
|
|
124
123
|
return _regenerator.default.wrap(function _callee3$(_context3) {
|
|
125
124
|
while (1) switch (_context3.prev = _context3.next) {
|
|
126
125
|
case 0:
|
|
126
|
+
_context3.next = 2;
|
|
127
|
+
return extensionProvider;
|
|
128
|
+
case 2:
|
|
129
|
+
provider = _context3.sent;
|
|
130
|
+
if (!provider) {
|
|
131
|
+
_context3.next = 9;
|
|
132
|
+
break;
|
|
133
|
+
}
|
|
127
134
|
_context3.t0 = setExtensions;
|
|
128
|
-
_context3.next =
|
|
129
|
-
return
|
|
130
|
-
case
|
|
135
|
+
_context3.next = 7;
|
|
136
|
+
return provider.getExtensions();
|
|
137
|
+
case 7:
|
|
131
138
|
_context3.t1 = _context3.sent;
|
|
132
139
|
(0, _context3.t0)(_context3.t1);
|
|
133
|
-
case
|
|
140
|
+
case 9:
|
|
134
141
|
case "end":
|
|
135
142
|
return _context3.stop();
|
|
136
143
|
}
|
|
@@ -427,7 +427,12 @@ var Toolbar = /*#__PURE__*/function (_Component) {
|
|
|
427
427
|
}, {
|
|
428
428
|
key: "componentWillUnmount",
|
|
429
429
|
value: function componentWillUnmount() {
|
|
430
|
-
|
|
430
|
+
var editorView = this.props.editorView;
|
|
431
|
+
if (editorView) {
|
|
432
|
+
var tr = editorView.state.tr,
|
|
433
|
+
dispatch = editorView.dispatch;
|
|
434
|
+
dispatch((0, _forceFocus.forceFocusSelector)(null)(tr));
|
|
435
|
+
}
|
|
431
436
|
this.resetStyling({
|
|
432
437
|
table: this.props.node.type.name === 'table'
|
|
433
438
|
});
|
|
@@ -125,12 +125,6 @@ Object.defineProperty(exports, "datePlugin", {
|
|
|
125
125
|
return _date.default;
|
|
126
126
|
}
|
|
127
127
|
});
|
|
128
|
-
Object.defineProperty(exports, "editorDisabledPlugin", {
|
|
129
|
-
enumerable: true,
|
|
130
|
-
get: function get() {
|
|
131
|
-
return _editorDisabled.default;
|
|
132
|
-
}
|
|
133
|
-
});
|
|
134
128
|
Object.defineProperty(exports, "emojiPlugin", {
|
|
135
129
|
enumerable: true,
|
|
136
130
|
get: function get() {
|
|
@@ -421,7 +415,6 @@ var _status = _interopRequireDefault(require("./status"));
|
|
|
421
415
|
var _breakout = _interopRequireDefault(require("./breakout"));
|
|
422
416
|
var _alignment = _interopRequireDefault(require("./alignment"));
|
|
423
417
|
var _dataConsumer = _interopRequireDefault(require("./data-consumer"));
|
|
424
|
-
var _editorDisabled = _interopRequireDefault(require("./editor-disabled"));
|
|
425
418
|
var _fragment = _interopRequireDefault(require("./fragment"));
|
|
426
419
|
var _indentation = _interopRequireDefault(require("./indentation"));
|
|
427
420
|
var _annotation = _interopRequireDefault(require("./annotation"));
|
|
@@ -60,7 +60,9 @@ var AltTextEditComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
60
60
|
(0, _commands.closeMediaAltTextMenu)(view.state, view.dispatch);
|
|
61
61
|
});
|
|
62
62
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "dispatchCancelEvent", function (event) {
|
|
63
|
-
var
|
|
63
|
+
var _this$props = _this.props,
|
|
64
|
+
view = _this$props.view,
|
|
65
|
+
onEscape = _this$props.onEscape;
|
|
64
66
|
|
|
65
67
|
// We need to pass down the ESCAPE keymap
|
|
66
68
|
// because when we focus on the Toolbar, Prosemirror blur,
|
|
@@ -68,6 +70,7 @@ var AltTextEditComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
68
70
|
view.someProp('handleKeyDown', function (fn) {
|
|
69
71
|
return fn(view, event);
|
|
70
72
|
});
|
|
73
|
+
onEscape === null || onEscape === void 0 ? void 0 : onEscape();
|
|
71
74
|
});
|
|
72
75
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "updateAltText", function (newAltText) {
|
|
73
76
|
var view = _this.props.view;
|
|
@@ -14,7 +14,6 @@ var _messages = require("../pm-plugins/alt-text/messages");
|
|
|
14
14
|
var _AltTextEdit = _interopRequireWildcard(require("../pm-plugins/alt-text/ui/AltTextEdit"));
|
|
15
15
|
var _mediaCommon = require("../utils/media-common");
|
|
16
16
|
var _style = require("../pm-plugins/alt-text/style");
|
|
17
|
-
var _ui = require("@atlaskit/editor-common/ui");
|
|
18
17
|
var _forceFocus = require("../../floating-toolbar/pm-plugins/force-focus");
|
|
19
18
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
20
19
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
@@ -39,7 +38,6 @@ var altTextButton = function altTextButton(intl, state) {
|
|
|
39
38
|
};
|
|
40
39
|
};
|
|
41
40
|
exports.altTextButton = altTextButton;
|
|
42
|
-
var AltTextEditWithListeners = (0, _ui.withOuterListeners)(_AltTextEdit.default);
|
|
43
41
|
var altTextEditComponent = function altTextEditComponent(options) {
|
|
44
42
|
return {
|
|
45
43
|
type: 'custom',
|
|
@@ -56,15 +54,17 @@ var altTextEditComponent = function altTextEditComponent(options) {
|
|
|
56
54
|
/** Focus should move to the 'Alt text' button when the toolbar closes
|
|
57
55
|
* and not close the floating toolbar.
|
|
58
56
|
*/
|
|
59
|
-
var handleEsc = function handleEsc(
|
|
60
|
-
|
|
57
|
+
var handleEsc = function handleEsc() {
|
|
58
|
+
var tr = view.state.tr,
|
|
59
|
+
dispatch = view.dispatch;
|
|
60
|
+
dispatch((0, _forceFocus.forceFocusSelector)("[data-testid=\"".concat(testId, "\"]"))(tr));
|
|
61
61
|
};
|
|
62
|
-
return /*#__PURE__*/_react.default.createElement(
|
|
62
|
+
return /*#__PURE__*/_react.default.createElement(_AltTextEdit.default, {
|
|
63
63
|
view: view,
|
|
64
64
|
key: idx,
|
|
65
65
|
value: mediaNode.attrs.alt,
|
|
66
66
|
altTextValidator: options && options.altTextValidator,
|
|
67
|
-
|
|
67
|
+
onEscape: handleEsc
|
|
68
68
|
});
|
|
69
69
|
}
|
|
70
70
|
};
|
|
@@ -72,7 +72,10 @@ var getLinkingToolbar = function getLinkingToolbar(toolbarBaseConfig, mediaLinki
|
|
|
72
72
|
/** Focus should move to the 'Add link' button when the toolbar closes
|
|
73
73
|
* and not close the floating toolbar.
|
|
74
74
|
*/
|
|
75
|
-
|
|
75
|
+
var tr = view.state.tr,
|
|
76
|
+
dispatch = view.dispatch;
|
|
77
|
+
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);
|
|
78
|
+
dispatch(tr);
|
|
76
79
|
},
|
|
77
80
|
onSubmit: function onSubmit(href, meta) {
|
|
78
81
|
(0, _linking.setUrlToMedia)(href, meta.inputMethod)(view.state, view.dispatch, view);
|