@atlaskit/editor-plugin-toolbar 23.0.3 → 23.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/dist/cjs/pm-plugins/experiences/selection-toolbar-open-experience.js +9 -5
- package/dist/cjs/toolbarPlugin.js +2 -2
- package/dist/cjs/ui/OverflowMenu.js +8 -6
- package/dist/cjs/ui/OverflowMenuSection.js +4 -4
- package/dist/cjs/ui/OverflowSection.js +4 -4
- package/dist/cjs/ui/PrimaryToolbar.js +4 -4
- package/dist/cjs/ui/Section.js +10 -9
- package/dist/cjs/ui/SelectionToolbar/index.js +35 -29
- package/dist/cjs/ui/SelectionToolbar/keyboard-config.js +7 -7
- package/dist/cjs/ui/SelectionToolbar/utils.js +7 -7
- package/dist/cjs/ui/TextCollapsedMenu.js +9 -7
- package/dist/cjs/ui/toolbar-components.js +85 -83
- package/dist/es2019/pm-plugins/experiences/selection-toolbar-open-experience.js +6 -2
- package/dist/es2019/toolbarPlugin.js +1 -1
- package/dist/es2019/ui/OverflowMenu.js +4 -2
- package/dist/es2019/ui/OverflowMenuSection.js +2 -2
- package/dist/es2019/ui/OverflowSection.js +2 -2
- package/dist/es2019/ui/PrimaryToolbar.js +2 -2
- package/dist/es2019/ui/Section.js +4 -3
- package/dist/es2019/ui/SelectionToolbar/index.js +16 -11
- package/dist/es2019/ui/SelectionToolbar/keyboard-config.js +3 -3
- package/dist/es2019/ui/SelectionToolbar/utils.js +2 -2
- package/dist/es2019/ui/TextCollapsedMenu.js +4 -2
- package/dist/es2019/ui/toolbar-components.js +5 -3
- package/dist/esm/pm-plugins/experiences/selection-toolbar-open-experience.js +6 -2
- package/dist/esm/toolbarPlugin.js +1 -1
- package/dist/esm/ui/OverflowMenu.js +4 -2
- package/dist/esm/ui/OverflowMenuSection.js +2 -2
- package/dist/esm/ui/OverflowSection.js +2 -2
- package/dist/esm/ui/PrimaryToolbar.js +2 -2
- package/dist/esm/ui/Section.js +4 -3
- package/dist/esm/ui/SelectionToolbar/index.js +16 -11
- package/dist/esm/ui/SelectionToolbar/keyboard-config.js +3 -3
- package/dist/esm/ui/SelectionToolbar/utils.js +2 -2
- package/dist/esm/ui/TextCollapsedMenu.js +4 -2
- package/dist/esm/ui/toolbar-components.js +5 -3
- package/dist/types/pm-plugins/experiences/selection-toolbar-open-experience.d.ts +1 -1
- package/dist/types/toolbarPluginType.d.ts +11 -10
- package/dist/types/types/index.d.ts +3 -3
- package/dist/types/ui/OverflowSection.d.ts +1 -1
- package/dist/types/ui/PrimaryToolbar.d.ts +1 -1
- package/dist/types/ui/Section.d.ts +2 -2
- package/dist/types/ui/SelectionToolbar/index.d.ts +1 -1
- package/dist/types/ui/SelectionToolbar/keyboard-config.d.ts +2 -2
- package/dist/types/ui/SelectionToolbar/utils.d.ts +1 -1
- package/dist/types/ui/toolbar-components.d.ts +4 -4
- package/docs/0-intro.tsx +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -6,8 +6,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.getSelectionToolbarOpenExperiencePlugin = void 0;
|
|
8
8
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
9
|
-
var
|
|
9
|
+
var _enums = require("@atlaskit/editor-common/analytics/types/enums");
|
|
10
10
|
var _experiences = require("@atlaskit/editor-common/experiences");
|
|
11
|
+
var _consts = require("@atlaskit/editor-common/experiences/consts");
|
|
12
|
+
var _Experience = require("@atlaskit/editor-common/experiences/Experience");
|
|
13
|
+
var _ExperienceCheckDomMutation = require("@atlaskit/editor-common/experiences/ExperienceCheckDomMutation");
|
|
14
|
+
var _ExperienceCheckTimeout = require("@atlaskit/editor-common/experiences/ExperienceCheckTimeout");
|
|
11
15
|
var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
|
|
12
16
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
13
17
|
var _visibility = require("../../ui/SelectionToolbar/visibility");
|
|
@@ -55,10 +59,10 @@ var getSelectionToolbarOpenExperiencePlugin = exports.getSelectionToolbarOpenExp
|
|
|
55
59
|
var isCellSelection = !selection.empty && '$anchorCell' in selection;
|
|
56
60
|
return (0, _visibility.isSelectionToolbarSuppressedByUserIntent)(getCurrentUserIntent === null || getCurrentUserIntent === void 0 ? void 0 : getCurrentUserIntent(), isCellSelection);
|
|
57
61
|
};
|
|
58
|
-
var experience = new
|
|
59
|
-
actionSubjectId:
|
|
62
|
+
var experience = new _Experience.Experience(_consts.EXPERIENCE_ID.TOOLBAR_OPEN, {
|
|
63
|
+
actionSubjectId: _enums.ACTION_SUBJECT_ID.SELECTION_TOOLBAR,
|
|
60
64
|
dispatchAnalyticsEvent: dispatchAnalyticsEvent,
|
|
61
|
-
checks: [new
|
|
65
|
+
checks: [new _ExperienceCheckTimeout.ExperienceCheckTimeout({
|
|
62
66
|
durationMs: 1000,
|
|
63
67
|
onTimeout: function onTimeout() {
|
|
64
68
|
var _editorView2, _editorView3;
|
|
@@ -79,7 +83,7 @@ var getSelectionToolbarOpenExperiencePlugin = exports.getSelectionToolbarOpenExp
|
|
|
79
83
|
};
|
|
80
84
|
}
|
|
81
85
|
}
|
|
82
|
-
}), new
|
|
86
|
+
}), new _ExperienceCheckDomMutation.ExperienceCheckDomMutation({
|
|
83
87
|
onDomMutation: function onDomMutation(_ref2) {
|
|
84
88
|
var mutations = _ref2.mutations;
|
|
85
89
|
if (mutations.some(isSelectionToolbarAddedInMutation)) {
|
|
@@ -13,7 +13,7 @@ var _bindEventListener = require("bind-event-listener");
|
|
|
13
13
|
var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
|
|
14
14
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
15
15
|
var _utils = require("@atlaskit/editor-prosemirror/utils");
|
|
16
|
-
var
|
|
16
|
+
var _createRegistry = require("@atlaskit/editor-toolbar-model/create-registry");
|
|
17
17
|
var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
|
|
18
18
|
var _selectionToolbarOpenExperience = require("./pm-plugins/experiences/selection-toolbar-open-experience");
|
|
19
19
|
var _pluginKey = require("./pm-plugins/plugin-key");
|
|
@@ -85,7 +85,7 @@ var toolbarPlugin = exports.toolbarPlugin = function toolbarPlugin(_ref) {
|
|
|
85
85
|
_config$contextualFor = config.contextualFormattingEnabled,
|
|
86
86
|
contextualFormattingEnabled = _config$contextualFor === void 0 ? 'always-pinned' : _config$contextualFor,
|
|
87
87
|
breakpointPreset = config.breakpointPreset;
|
|
88
|
-
var registry = (0,
|
|
88
|
+
var registry = (0, _createRegistry.createComponentRegistry)();
|
|
89
89
|
registry.register((0, _toolbarComponents.getToolbarComponents)(contextualFormattingEnabled, api, breakpointPreset));
|
|
90
90
|
return {
|
|
91
91
|
name: 'toolbar',
|
|
@@ -7,18 +7,20 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.OverflowMenu = void 0;
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
var _reactIntl = require("react-intl");
|
|
10
|
-
var
|
|
11
|
-
var
|
|
10
|
+
var _toolbar = require("@atlaskit/editor-common/messages/toolbar");
|
|
11
|
+
var _showMoreHorizontal = require("@atlaskit/editor-toolbar/show-more-horizontal");
|
|
12
|
+
var _toolbarDropdownMenu = require("@atlaskit/editor-toolbar/toolbar-dropdown-menu");
|
|
13
|
+
var _toolbarTooltip = require("@atlaskit/editor-toolbar/toolbar-tooltip");
|
|
12
14
|
var OverflowMenu = exports.OverflowMenu = function OverflowMenu(_ref) {
|
|
13
15
|
var children = _ref.children;
|
|
14
16
|
var intl = (0, _reactIntl.useIntl)();
|
|
15
|
-
var tooltipContent = intl.formatMessage(
|
|
16
|
-
return /*#__PURE__*/_react.default.createElement(
|
|
17
|
+
var tooltipContent = intl.formatMessage(_toolbar.toolbarMessages.selectionToolbarOverflowMenuTooltip);
|
|
18
|
+
return /*#__PURE__*/_react.default.createElement(_toolbarDropdownMenu.ToolbarDropdownMenu, {
|
|
17
19
|
label: tooltipContent,
|
|
18
|
-
iconBefore: /*#__PURE__*/_react.default.createElement(
|
|
20
|
+
iconBefore: /*#__PURE__*/_react.default.createElement(_showMoreHorizontal.ShowMoreHorizontalIcon, {
|
|
19
21
|
label: ""
|
|
20
22
|
}),
|
|
21
|
-
tooltipComponent: /*#__PURE__*/_react.default.createElement(
|
|
23
|
+
tooltipComponent: /*#__PURE__*/_react.default.createElement(_toolbarTooltip.ToolbarTooltip, {
|
|
22
24
|
content: tooltipContent,
|
|
23
25
|
position: "top"
|
|
24
26
|
})
|
|
@@ -6,16 +6,16 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.OverflowMenuSection = void 0;
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
var
|
|
10
|
-
var
|
|
9
|
+
var _context = require("@atlaskit/editor-common/toolbar/context");
|
|
10
|
+
var _toolbarDropdownItemSection = require("@atlaskit/editor-toolbar/toolbar-dropdown-item-section");
|
|
11
11
|
var OverflowMenuSection = exports.OverflowMenuSection = function OverflowMenuSection(_ref) {
|
|
12
12
|
var children = _ref.children;
|
|
13
|
-
var _useEditorToolbar = (0,
|
|
13
|
+
var _useEditorToolbar = (0, _context.useEditorToolbar)(),
|
|
14
14
|
editorViewMode = _useEditorToolbar.editorViewMode;
|
|
15
15
|
var isEdit = editorViewMode === 'edit';
|
|
16
16
|
|
|
17
17
|
// only show separator in edit mode, when the pinned toolbar option is available
|
|
18
|
-
return /*#__PURE__*/_react.default.createElement(
|
|
18
|
+
return /*#__PURE__*/_react.default.createElement(_toolbarDropdownItemSection.ToolbarDropdownItemSection, {
|
|
19
19
|
hasSeparator: isEdit
|
|
20
20
|
}, children);
|
|
21
21
|
};
|
|
@@ -6,18 +6,18 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.OverflowSection = void 0;
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
var
|
|
10
|
-
var
|
|
9
|
+
var _context = require("@atlaskit/editor-common/toolbar/context");
|
|
10
|
+
var _toolbarSection = require("@atlaskit/editor-toolbar/toolbar-section");
|
|
11
11
|
var OverflowSection = exports.OverflowSection = function OverflowSection(_ref) {
|
|
12
12
|
var children = _ref.children,
|
|
13
13
|
hasSeparator = _ref.hasSeparator,
|
|
14
14
|
testId = _ref.testId;
|
|
15
|
-
var _useEditorToolbar = (0,
|
|
15
|
+
var _useEditorToolbar = (0, _context.useEditorToolbar)(),
|
|
16
16
|
editorAppearance = _useEditorToolbar.editorAppearance;
|
|
17
17
|
if (editorAppearance === 'full-page') {
|
|
18
18
|
return null;
|
|
19
19
|
}
|
|
20
|
-
return /*#__PURE__*/_react.default.createElement(
|
|
20
|
+
return /*#__PURE__*/_react.default.createElement(_toolbarSection.ToolbarSection, {
|
|
21
21
|
hasSeparator: hasSeparator,
|
|
22
22
|
testId: testId
|
|
23
23
|
}, children);
|
|
@@ -6,8 +6,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.PrimaryToolbar = void 0;
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
var
|
|
10
|
-
var
|
|
9
|
+
var _context = require("@atlaskit/editor-common/toolbar/context");
|
|
10
|
+
var _toolbar = require("@atlaskit/editor-toolbar/toolbar");
|
|
11
11
|
var isFullPage = function isFullPage(editorAppearance) {
|
|
12
12
|
return editorAppearance === 'full-page' || editorAppearance === 'full-width';
|
|
13
13
|
};
|
|
@@ -20,9 +20,9 @@ var getBreakpointPreset = function getBreakpointPreset(breakpointPreset, editorA
|
|
|
20
20
|
var PrimaryToolbar = exports.PrimaryToolbar = function PrimaryToolbar(_ref) {
|
|
21
21
|
var children = _ref.children,
|
|
22
22
|
breakpointPreset = _ref.breakpointPreset;
|
|
23
|
-
var _useEditorToolbar = (0,
|
|
23
|
+
var _useEditorToolbar = (0, _context.useEditorToolbar)(),
|
|
24
24
|
editorAppearance = _useEditorToolbar.editorAppearance;
|
|
25
|
-
return /*#__PURE__*/_react.default.createElement(
|
|
25
|
+
return /*#__PURE__*/_react.default.createElement(_toolbar.PrimaryToolbar, {
|
|
26
26
|
testId: "editor-primary-toolbar",
|
|
27
27
|
breakpointPreset: getBreakpointPreset(breakpointPreset, editorAppearance)
|
|
28
28
|
}, children);
|
package/dist/cjs/ui/Section.js
CHANGED
|
@@ -6,23 +6,24 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.Section = void 0;
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
var
|
|
10
|
-
var
|
|
11
|
-
var
|
|
9
|
+
var _context = require("@atlaskit/editor-common/toolbar/context");
|
|
10
|
+
var _keys = require("@atlaskit/editor-common/toolbar/keys");
|
|
11
|
+
var _useSharedPluginStateWithSelector = require("@atlaskit/editor-common/useSharedPluginStateWithSelector");
|
|
12
|
+
var _toolbarSection = require("@atlaskit/editor-toolbar/toolbar-section");
|
|
12
13
|
var shouldShowSection = function shouldShowSection(editMode, toolbar, toolbarDocking, contextualFormattingEnabled) {
|
|
13
14
|
if (editMode === 'view') {
|
|
14
15
|
return false;
|
|
15
16
|
}
|
|
16
|
-
if ((toolbar === null || toolbar === void 0 ? void 0 : toolbar.key) ===
|
|
17
|
+
if ((toolbar === null || toolbar === void 0 ? void 0 : toolbar.key) === _keys.TOOLBARS.INLINE_TEXT_TOOLBAR) {
|
|
17
18
|
return toolbarDocking !== 'top' || contextualFormattingEnabled === 'always-inline';
|
|
18
19
|
}
|
|
19
|
-
if ((toolbar === null || toolbar === void 0 ? void 0 : toolbar.key) ===
|
|
20
|
+
if ((toolbar === null || toolbar === void 0 ? void 0 : toolbar.key) === _keys.TOOLBARS.PRIMARY_TOOLBAR) {
|
|
20
21
|
return toolbarDocking !== 'none' || contextualFormattingEnabled === 'always-pinned';
|
|
21
22
|
}
|
|
22
23
|
return false;
|
|
23
24
|
};
|
|
24
25
|
var usePluginState = function usePluginState(_api) {
|
|
25
|
-
var _useEditorToolbar = (0,
|
|
26
|
+
var _useEditorToolbar = (0, _context.useEditorToolbar)(),
|
|
26
27
|
editorViewMode = _useEditorToolbar.editorViewMode,
|
|
27
28
|
editorToolbarDockingPreference = _useEditorToolbar.editorToolbarDockingPreference,
|
|
28
29
|
editorAppearance = _useEditorToolbar.editorAppearance;
|
|
@@ -45,7 +46,7 @@ var Section = exports.Section = function Section(_ref) {
|
|
|
45
46
|
editorViewMode = _usePluginState.editorViewMode,
|
|
46
47
|
editorToolbarDockingPreference = _usePluginState.editorToolbarDockingPreference,
|
|
47
48
|
editorAppearance = _usePluginState.editorAppearance;
|
|
48
|
-
var runtimeOverride = (0,
|
|
49
|
+
var runtimeOverride = (0, _useSharedPluginStateWithSelector.useSharedPluginStateWithSelector)(api, ['toolbar'], function (states) {
|
|
49
50
|
var _states$toolbarState;
|
|
50
51
|
return (_states$toolbarState = states.toolbarState) === null || _states$toolbarState === void 0 ? void 0 : _states$toolbarState.contextualFormattingModeOverride;
|
|
51
52
|
});
|
|
@@ -58,8 +59,8 @@ var Section = exports.Section = function Section(_ref) {
|
|
|
58
59
|
}
|
|
59
60
|
var isFullPage = editorAppearance === 'full-page';
|
|
60
61
|
var hasSeparator = showSeparatorInFullPagePrimaryToolbar && isFullPage;
|
|
61
|
-
return /*#__PURE__*/_react.default.createElement(
|
|
62
|
+
return /*#__PURE__*/_react.default.createElement(_toolbarSection.ToolbarSection, {
|
|
62
63
|
testId: testId,
|
|
63
|
-
hasSeparator: hasSeparator ?
|
|
64
|
+
hasSeparator: hasSeparator ? _toolbarSection.SeparatorPosition.START : hasSeparator
|
|
64
65
|
}, children);
|
|
65
66
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
3
4
|
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
4
5
|
Object.defineProperty(exports, "__esModule", {
|
|
5
6
|
value: true
|
|
@@ -7,31 +8,36 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
8
|
exports.SelectionToolbarWithErrorBoundary = exports.SelectionToolbar = void 0;
|
|
8
9
|
var _react = _interopRequireWildcard(require("react"));
|
|
9
10
|
var _reactIntl = require("react-intl");
|
|
10
|
-
var
|
|
11
|
-
var
|
|
11
|
+
var _enums = require("@atlaskit/editor-common/analytics/types/enums");
|
|
12
|
+
var _isOfflineMode = require("@atlaskit/editor-common/connectivity/isOfflineMode");
|
|
12
13
|
var _errorBoundary = require("@atlaskit/editor-common/error-boundary");
|
|
13
|
-
var
|
|
14
|
-
var
|
|
14
|
+
var _isSsr = require("@atlaskit/editor-common/is-ssr");
|
|
15
|
+
var _error = require("@atlaskit/editor-common/monitoring/error");
|
|
16
|
+
var _Popup = _interopRequireDefault(require("@atlaskit/editor-common/Popup"));
|
|
15
17
|
var _toolbar = require("@atlaskit/editor-common/toolbar");
|
|
16
|
-
var
|
|
17
|
-
var
|
|
18
|
-
var
|
|
18
|
+
var _context = require("@atlaskit/editor-common/toolbar/context");
|
|
19
|
+
var _EditorToolbarUIProvider = require("@atlaskit/editor-common/toolbar/EditorToolbarUIProvider");
|
|
20
|
+
var _useSharedPluginStateWithSelector = require("@atlaskit/editor-common/useSharedPluginStateWithSelector");
|
|
21
|
+
var _calculateToolbarPosition = require("@atlaskit/editor-common/utils/calculate-toolbar-position");
|
|
19
22
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
20
|
-
var
|
|
21
|
-
var
|
|
22
|
-
var
|
|
23
|
+
var _constants = require("@atlaskit/editor-shared-styles/constants");
|
|
24
|
+
var _toolbarModelRenderer = require("@atlaskit/editor-toolbar-model/toolbar-model-renderer");
|
|
25
|
+
var _toolbarButtonGroup = require("@atlaskit/editor-toolbar/toolbar-button-group");
|
|
26
|
+
var _toolbarDropdownItemSection = require("@atlaskit/editor-toolbar/toolbar-dropdown-item-section");
|
|
27
|
+
var _toolbarSection = require("@atlaskit/editor-toolbar/toolbar-section");
|
|
28
|
+
var _uiContext = require("@atlaskit/editor-toolbar/ui-context");
|
|
23
29
|
var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
|
|
24
30
|
var _editorExperiment = require("@atlaskit/tmp-editor-statsig/editor-experiment");
|
|
25
31
|
var _consts = require("../consts");
|
|
26
32
|
var _keyboardConfig = require("./keyboard-config");
|
|
27
|
-
var
|
|
33
|
+
var _utils = require("./utils");
|
|
28
34
|
var _visibility = require("./visibility");
|
|
29
35
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
30
36
|
var isToolbarComponent = function isToolbarComponent(component) {
|
|
31
37
|
return component.type === 'toolbar' && component.key === 'inline-text-toolbar';
|
|
32
38
|
};
|
|
33
39
|
var usePluginState = function usePluginState(api) {
|
|
34
|
-
return (0,
|
|
40
|
+
return (0, _useSharedPluginStateWithSelector.useSharedPluginStateWithSelector)(api, ['connectivity', 'userPreferences', 'toolbar', 'selection', 'userIntent', 'editorViewMode'], function (state) {
|
|
35
41
|
var _state$connectivitySt, _state$userPreference, _state$toolbarState, _state$toolbarState2, _state$toolbarState3, _state$selectionState, _state$userIntentStat, _state$editorViewMode;
|
|
36
42
|
return {
|
|
37
43
|
connectivityStateMode: (_state$connectivitySt = state.connectivityState) === null || _state$connectivitySt === void 0 ? void 0 : _state$connectivitySt.mode,
|
|
@@ -54,11 +60,11 @@ var useOnPositionCalculated = function useOnPositionCalculated(editorView) {
|
|
|
54
60
|
});
|
|
55
61
|
var isCellSelection = ('$anchorCell' in editorView.state.selection);
|
|
56
62
|
if (isCellSelection && isEditorControlsEnabled) {
|
|
57
|
-
return (0,
|
|
63
|
+
return (0, _calculateToolbarPosition.calculateToolbarPositionOnCellSelection)(_consts.SELECTION_TOOLBAR_LABEL)(editorView, position);
|
|
58
64
|
}
|
|
59
|
-
return (0,
|
|
65
|
+
return (0, _calculateToolbarPosition.calculateToolbarPositionTrackHead)(_consts.SELECTION_TOOLBAR_LABEL)(editorView, position);
|
|
60
66
|
} catch (error) {
|
|
61
|
-
(0,
|
|
67
|
+
(0, _error.logException)(error, {
|
|
62
68
|
location: 'editor-plugin-toolbar/selectionToolbar'
|
|
63
69
|
});
|
|
64
70
|
return position;
|
|
@@ -90,9 +96,9 @@ var SelectionToolbar = exports.SelectionToolbar = function SelectionToolbar(_ref
|
|
|
90
96
|
var keyboardNavigation = (0, _react.useMemo)(function () {
|
|
91
97
|
return (0, _keyboardConfig.getKeyboardNavigationConfig)(editorView, intl, api);
|
|
92
98
|
}, [editorView, intl, api]);
|
|
93
|
-
var _useToolbarUI = (0,
|
|
99
|
+
var _useToolbarUI = (0, _uiContext.useToolbarUI)(),
|
|
94
100
|
isDisabled = _useToolbarUI.isDisabled;
|
|
95
|
-
var isOffline = (0,
|
|
101
|
+
var isOffline = (0, _isOfflineMode.isOfflineMode)(connectivityStateMode);
|
|
96
102
|
var isTextSelection = !editorView.state.selection.empty && editorView.state.selection instanceof _state.TextSelection;
|
|
97
103
|
var isAllSelection = !editorView.state.selection.empty && editorView.state.selection instanceof _state.AllSelection;
|
|
98
104
|
var isCellSelection = !editorView.state.selection.empty && '$anchorCell' in editorView.state.selection;
|
|
@@ -102,15 +108,15 @@ var SelectionToolbar = exports.SelectionToolbar = function SelectionToolbar(_ref
|
|
|
102
108
|
}
|
|
103
109
|
if (!(isTextSelection || isCellSelection || isAllSelection) || currentUserIntent === 'dragging' || !shouldShowToolbar || currentUserIntent === 'blockMenuOpen' ||
|
|
104
110
|
// hide toolbar when user intent is not default, except when it's dragHandleSelected without cell selection
|
|
105
|
-
(0, _visibility.isSelectionToolbarSuppressedByUserIntent)(currentUserIntent, isCellSelection) || (0,
|
|
111
|
+
(0, _visibility.isSelectionToolbarSuppressedByUserIntent)(currentUserIntent, isCellSelection) || (0, _isSsr.isSSR)()) {
|
|
106
112
|
return null;
|
|
107
113
|
}
|
|
108
|
-
var toolbarContent = /*#__PURE__*/_react.default.createElement(
|
|
114
|
+
var toolbarContent = /*#__PURE__*/_react.default.createElement(_context.EditorToolbarProvider, {
|
|
109
115
|
editorView: editorView,
|
|
110
116
|
editorToolbarDockingPreference: editorToolbarDockingPreference,
|
|
111
117
|
editorViewMode: editorViewMode !== null && editorViewMode !== void 0 ? editorViewMode : 'edit',
|
|
112
118
|
isOffline: isOffline
|
|
113
|
-
}, /*#__PURE__*/_react.default.createElement(
|
|
119
|
+
}, /*#__PURE__*/_react.default.createElement(_EditorToolbarUIProvider.EditorToolbarUIProvider, {
|
|
114
120
|
api: api,
|
|
115
121
|
isDisabled: isDisabled
|
|
116
122
|
// eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
|
|
@@ -120,25 +126,25 @@ var SelectionToolbar = exports.SelectionToolbar = function SelectionToolbar(_ref
|
|
|
120
126
|
api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 || _api$analytics.actions.fireAnalyticsEvent(payload);
|
|
121
127
|
},
|
|
122
128
|
keyboardNavigation: keyboardNavigation
|
|
123
|
-
}, /*#__PURE__*/_react.default.createElement(
|
|
129
|
+
}, /*#__PURE__*/_react.default.createElement(_toolbarModelRenderer.ToolbarModelRenderer, {
|
|
124
130
|
toolbar: toolbar,
|
|
125
131
|
components: components
|
|
126
132
|
// eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
|
|
127
133
|
,
|
|
128
134
|
fallbacks: {
|
|
129
|
-
section:
|
|
130
|
-
menuSection:
|
|
131
|
-
group:
|
|
135
|
+
section: _toolbarSection.ToolbarSection,
|
|
136
|
+
menuSection: _toolbarDropdownItemSection.ToolbarDropdownItemSection,
|
|
137
|
+
group: _toolbarButtonGroup.ToolbarButtonGroup
|
|
132
138
|
}
|
|
133
139
|
})));
|
|
134
|
-
return /*#__PURE__*/_react.default.createElement(
|
|
140
|
+
return /*#__PURE__*/_react.default.createElement(_Popup.default
|
|
135
141
|
// eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
|
|
136
142
|
, {
|
|
137
143
|
offset: [0, 10],
|
|
138
|
-
target: (0,
|
|
144
|
+
target: (0, _utils.getDomRefFromSelection)(editorView),
|
|
139
145
|
onPositionCalculated: onPositionCalculated,
|
|
140
146
|
mountTo: mountPoint,
|
|
141
|
-
zIndex:
|
|
147
|
+
zIndex: _constants.akEditorFloatingDialogZIndex
|
|
142
148
|
}, (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_toolbar_multi_editor_fix') ? /*#__PURE__*/_react.default.createElement("div", {
|
|
143
149
|
onMouseUpCapture: onToolbarMouseUp
|
|
144
150
|
}, toolbarContent) : toolbarContent);
|
|
@@ -151,8 +157,8 @@ var SelectionToolbarWithErrorBoundary = exports.SelectionToolbarWithErrorBoundar
|
|
|
151
157
|
disableSelectionToolbarWhenPinned = _ref3.disableSelectionToolbarWhenPinned,
|
|
152
158
|
onToolbarMouseUp = _ref3.onToolbarMouseUp;
|
|
153
159
|
return /*#__PURE__*/_react.default.createElement(_errorBoundary.ErrorBoundary, {
|
|
154
|
-
component:
|
|
155
|
-
componentId:
|
|
160
|
+
component: _enums.ACTION_SUBJECT.TOOLBAR,
|
|
161
|
+
componentId: _enums.ACTION_SUBJECT_ID.SELECTION_TOOLBAR,
|
|
156
162
|
dispatchAnalyticsEvent: api === null || api === void 0 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions.fireAnalyticsEvent,
|
|
157
163
|
fallbackComponent: null
|
|
158
164
|
}, /*#__PURE__*/_react.default.createElement(SelectionToolbar, {
|
|
@@ -5,9 +5,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.getKeyboardNavigationConfig = void 0;
|
|
7
7
|
var _browserApis = require("@atlaskit/browser-apis");
|
|
8
|
-
var
|
|
9
|
-
var
|
|
10
|
-
var
|
|
8
|
+
var _fullPage = require("@atlaskit/editor-common/messages/full-page");
|
|
9
|
+
var _error = require("@atlaskit/editor-common/monitoring/error");
|
|
10
|
+
var _uiToolbar = require("@atlaskit/editor-common/ui-toolbar");
|
|
11
11
|
var _toolbar = require("../utils/toolbar");
|
|
12
12
|
var getKeyboardNavigationConfig = exports.getKeyboardNavigationConfig = function getKeyboardNavigationConfig(editorView, intl, api) {
|
|
13
13
|
if (!(editorView.dom instanceof HTMLElement)) {
|
|
@@ -41,7 +41,7 @@ var getKeyboardNavigationConfig = exports.getKeyboardNavigationConfig = function
|
|
|
41
41
|
event.stopPropagation();
|
|
42
42
|
} catch (error) {
|
|
43
43
|
if (error instanceof Error) {
|
|
44
|
-
(0,
|
|
44
|
+
(0, _error.logException)(error, {
|
|
45
45
|
location: 'editor-plugin-toolbar/selectionToolbar'
|
|
46
46
|
});
|
|
47
47
|
}
|
|
@@ -58,13 +58,13 @@ var getKeyboardNavigationConfig = exports.getKeyboardNavigationConfig = function
|
|
|
58
58
|
event.stopPropagation();
|
|
59
59
|
} catch (error) {
|
|
60
60
|
if (error instanceof Error) {
|
|
61
|
-
(0,
|
|
61
|
+
(0, _error.logException)(error, {
|
|
62
62
|
location: 'editor-plugin-toolbar/selectionToolbar'
|
|
63
63
|
});
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
66
|
},
|
|
67
|
-
ariaControls:
|
|
68
|
-
ariaLabel: intl.formatMessage(
|
|
67
|
+
ariaControls: _uiToolbar.EDIT_AREA_ID,
|
|
68
|
+
ariaLabel: intl.formatMessage(_fullPage.messages.toolbarLabel)
|
|
69
69
|
};
|
|
70
70
|
};
|
|
@@ -4,8 +4,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.getDomRefFromSelection = void 0;
|
|
7
|
-
var
|
|
8
|
-
var
|
|
7
|
+
var _enums = require("@atlaskit/editor-common/analytics/types/enums");
|
|
8
|
+
var _error = require("@atlaskit/editor-common/monitoring/error");
|
|
9
9
|
var _utils = require("@atlaskit/editor-prosemirror/utils");
|
|
10
10
|
var getDomRefFromSelection = exports.getDomRefFromSelection = function getDomRefFromSelection(view, dispatchAnalyticsEvent) {
|
|
11
11
|
try {
|
|
@@ -17,11 +17,11 @@ var getDomRefFromSelection = exports.getDomRefFromSelection = function getDomRef
|
|
|
17
17
|
} catch (error) {
|
|
18
18
|
if (dispatchAnalyticsEvent) {
|
|
19
19
|
var payload = {
|
|
20
|
-
action:
|
|
21
|
-
actionSubject:
|
|
22
|
-
eventType:
|
|
20
|
+
action: _enums.ACTION.ERRORED,
|
|
21
|
+
actionSubject: _enums.ACTION_SUBJECT.CONTENT_COMPONENT,
|
|
22
|
+
eventType: _enums.EVENT_TYPE.OPERATIONAL,
|
|
23
23
|
attributes: {
|
|
24
|
-
component:
|
|
24
|
+
component: _enums.CONTENT_COMPONENT.SELECTION_TOOLBAR,
|
|
25
25
|
selection: view.state.selection.toJSON(),
|
|
26
26
|
position: view.state.selection.from,
|
|
27
27
|
docSize: view.state.doc.nodeSize,
|
|
@@ -34,7 +34,7 @@ var getDomRefFromSelection = exports.getDomRefFromSelection = function getDomRef
|
|
|
34
34
|
dispatchAnalyticsEvent(payload);
|
|
35
35
|
}
|
|
36
36
|
if (error instanceof Error) {
|
|
37
|
-
(0,
|
|
37
|
+
(0, _error.logException)(error, {
|
|
38
38
|
location: 'editor-plugin-toolbar/selectionToolbar'
|
|
39
39
|
});
|
|
40
40
|
}
|
|
@@ -7,8 +7,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.TextCollapsedMenu = void 0;
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
var _reactIntl = require("react-intl");
|
|
10
|
-
var
|
|
11
|
-
var
|
|
10
|
+
var _toolbar = require("@atlaskit/editor-common/messages/toolbar");
|
|
11
|
+
var _textIcon = require("@atlaskit/editor-toolbar/text-icon");
|
|
12
|
+
var _toolbarDropdownMenu = require("@atlaskit/editor-toolbar/toolbar-dropdown-menu");
|
|
13
|
+
var _toolbarTooltip = require("@atlaskit/editor-toolbar/toolbar-tooltip");
|
|
12
14
|
/**
|
|
13
15
|
* Basic version of existing 'Text Styles' Menu - which doesn't dynamically change icon
|
|
14
16
|
* and is also placeholder to render all other menus in the collapsed state.
|
|
@@ -17,14 +19,14 @@ var TextCollapsedMenu = exports.TextCollapsedMenu = function TextCollapsedMenu(_
|
|
|
17
19
|
var children = _ref.children;
|
|
18
20
|
var _useIntl = (0, _reactIntl.useIntl)(),
|
|
19
21
|
formatMessage = _useIntl.formatMessage;
|
|
20
|
-
return /*#__PURE__*/_react.default.createElement(
|
|
21
|
-
iconBefore: /*#__PURE__*/_react.default.createElement(
|
|
22
|
-
label: formatMessage(
|
|
22
|
+
return /*#__PURE__*/_react.default.createElement(_toolbarDropdownMenu.ToolbarDropdownMenu, {
|
|
23
|
+
iconBefore: /*#__PURE__*/_react.default.createElement(_textIcon.TextIcon, {
|
|
24
|
+
label: formatMessage(_toolbar.toolbarMessages.textStylesTooltip),
|
|
23
25
|
size: "small"
|
|
24
26
|
}),
|
|
25
27
|
enableMaxHeight: true,
|
|
26
|
-
tooltipComponent: /*#__PURE__*/_react.default.createElement(
|
|
27
|
-
content: formatMessage(
|
|
28
|
+
tooltipComponent: /*#__PURE__*/_react.default.createElement(_toolbarTooltip.ToolbarTooltip, {
|
|
29
|
+
content: formatMessage(_toolbar.toolbarMessages.textStylesTooltip)
|
|
28
30
|
})
|
|
29
31
|
}, children);
|
|
30
32
|
};
|