@atlaskit/editor-core 168.0.0 → 169.1.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/CHANGELOG.md +38 -0
- package/dist/cjs/create-editor/create-plugins-list.js +7 -0
- package/dist/cjs/plugins/analytics/types/toolbar-button.js +2 -0
- package/dist/cjs/plugins/breakout/index.js +7 -0
- package/dist/cjs/plugins/breakout/ui/LayoutButton.js +3 -1
- package/dist/cjs/plugins/card/pm-plugins/util/resolve.js +6 -1
- package/dist/cjs/plugins/card/styles.js +4 -2
- package/dist/cjs/plugins/card/toolbar.js +6 -1
- package/dist/cjs/plugins/code-block/styles.js +17 -41
- package/dist/cjs/plugins/code-block/ui/class-names.js +5 -2
- package/dist/cjs/plugins/copy-button/commands.js +85 -0
- package/dist/cjs/plugins/copy-button/index.js +27 -0
- package/dist/cjs/plugins/copy-button/pm-plugins/main.js +38 -0
- package/dist/cjs/plugins/copy-button/pm-plugins/plugin-key.js +11 -0
- package/dist/cjs/plugins/copy-button/utils.js +51 -0
- package/dist/cjs/plugins/feature-flags-context/feature-flags-from-props.js +4 -2
- package/dist/cjs/plugins/indentation/messages.js +23 -0
- package/dist/cjs/plugins/index.js +16 -0
- package/dist/cjs/plugins/list/index.js +0 -43
- package/dist/cjs/plugins/panel/toolbar.js +10 -2
- package/dist/cjs/plugins/quick-insert/search.js +3 -4
- package/dist/cjs/plugins/table/commands/hover.js +2 -2
- package/dist/cjs/plugins/table/toolbar.js +5 -1
- package/dist/cjs/plugins/table/utils/decoration.js +5 -1
- package/dist/cjs/plugins/toolbar-lists-indentation/index.js +65 -0
- package/dist/cjs/plugins/toolbar-lists-indentation/types.js +5 -0
- package/dist/cjs/plugins/toolbar-lists-indentation/ui/Toolbar.js +122 -0
- package/dist/cjs/plugins/toolbar-lists-indentation/ui/ToolbarDropdown.js +173 -0
- package/dist/cjs/plugins/toolbar-lists-indentation/ui/index.js +58 -0
- package/dist/cjs/plugins/toolbar-lists-indentation/ui/onItemActivated.js +48 -0
- package/dist/cjs/plugins/type-ahead/ui/TypeAheadList.js +4 -5
- package/dist/cjs/plugins/type-ahead/ui/TypeAheadListItem.js +17 -51
- package/dist/cjs/ui/ElementBrowser/InsertMenu.js +12 -39
- package/dist/cjs/ui/ElementBrowser/components/ElementList/ElementList.js +31 -87
- package/dist/cjs/utils/clipboard.js +67 -2
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/create-editor/create-plugins-list.js +8 -1
- package/dist/es2019/plugins/analytics/types/toolbar-button.js +2 -0
- package/dist/es2019/plugins/breakout/index.js +7 -0
- package/dist/es2019/plugins/breakout/ui/LayoutButton.js +3 -1
- package/dist/es2019/plugins/card/pm-plugins/util/resolve.js +6 -1
- package/dist/es2019/plugins/card/styles.js +5 -0
- package/dist/es2019/plugins/card/toolbar.js +5 -1
- package/dist/es2019/plugins/code-block/styles.js +18 -95
- package/dist/es2019/plugins/code-block/ui/class-names.js +3 -2
- package/dist/es2019/plugins/copy-button/commands.js +64 -0
- package/dist/es2019/plugins/copy-button/index.js +15 -0
- package/dist/es2019/plugins/copy-button/pm-plugins/main.js +28 -0
- package/dist/es2019/plugins/copy-button/pm-plugins/plugin-key.js +2 -0
- package/dist/es2019/plugins/copy-button/utils.js +29 -0
- package/dist/es2019/plugins/feature-flags-context/feature-flags-from-props.js +4 -2
- package/dist/es2019/plugins/indentation/messages.js +14 -0
- package/dist/es2019/plugins/index.js +3 -1
- package/dist/es2019/plugins/list/index.js +1 -44
- package/dist/es2019/plugins/panel/toolbar.js +9 -2
- package/dist/es2019/plugins/quick-insert/search.js +3 -4
- package/dist/es2019/plugins/table/commands/hover.js +2 -2
- package/dist/es2019/plugins/table/toolbar.js +5 -2
- package/dist/es2019/plugins/table/utils/decoration.js +5 -1
- package/dist/es2019/plugins/toolbar-lists-indentation/index.js +53 -0
- package/dist/es2019/plugins/toolbar-lists-indentation/types.js +1 -0
- package/dist/es2019/plugins/toolbar-lists-indentation/ui/Toolbar.js +94 -0
- package/dist/es2019/plugins/toolbar-lists-indentation/ui/ToolbarDropdown.js +149 -0
- package/dist/es2019/plugins/toolbar-lists-indentation/ui/index.js +49 -0
- package/dist/es2019/plugins/toolbar-lists-indentation/ui/onItemActivated.js +35 -0
- package/dist/es2019/plugins/type-ahead/ui/TypeAheadList.js +11 -10
- package/dist/es2019/plugins/type-ahead/ui/TypeAheadListItem.js +17 -48
- package/dist/es2019/ui/ElementBrowser/InsertMenu.js +10 -30
- package/dist/es2019/ui/ElementBrowser/components/ElementList/ElementList.js +34 -93
- package/dist/es2019/utils/clipboard.js +26 -0
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/create-editor/create-plugins-list.js +8 -1
- package/dist/esm/plugins/analytics/types/toolbar-button.js +2 -0
- package/dist/esm/plugins/breakout/index.js +7 -0
- package/dist/esm/plugins/breakout/ui/LayoutButton.js +3 -1
- package/dist/esm/plugins/card/pm-plugins/util/resolve.js +6 -1
- package/dist/esm/plugins/card/styles.js +2 -1
- package/dist/esm/plugins/card/toolbar.js +5 -1
- package/dist/esm/plugins/code-block/styles.js +16 -35
- package/dist/esm/plugins/code-block/ui/class-names.js +3 -2
- package/dist/esm/plugins/copy-button/commands.js +66 -0
- package/dist/esm/plugins/copy-button/index.js +17 -0
- package/dist/esm/plugins/copy-button/pm-plugins/main.js +26 -0
- package/dist/esm/plugins/copy-button/pm-plugins/plugin-key.js +2 -0
- package/dist/esm/plugins/copy-button/utils.js +31 -0
- package/dist/esm/plugins/feature-flags-context/feature-flags-from-props.js +4 -2
- package/dist/esm/plugins/indentation/messages.js +14 -0
- package/dist/esm/plugins/index.js +3 -1
- package/dist/esm/plugins/list/index.js +1 -41
- package/dist/esm/plugins/panel/toolbar.js +9 -2
- package/dist/esm/plugins/quick-insert/search.js +3 -4
- package/dist/esm/plugins/table/commands/hover.js +2 -2
- package/dist/esm/plugins/table/toolbar.js +5 -2
- package/dist/esm/plugins/table/utils/decoration.js +5 -1
- package/dist/esm/plugins/toolbar-lists-indentation/index.js +51 -0
- package/dist/esm/plugins/toolbar-lists-indentation/types.js +1 -0
- package/dist/esm/plugins/toolbar-lists-indentation/ui/Toolbar.js +96 -0
- package/dist/esm/plugins/toolbar-lists-indentation/ui/ToolbarDropdown.js +153 -0
- package/dist/esm/plugins/toolbar-lists-indentation/ui/index.js +47 -0
- package/dist/esm/plugins/toolbar-lists-indentation/ui/onItemActivated.js +39 -0
- package/dist/esm/plugins/type-ahead/ui/TypeAheadList.js +6 -8
- package/dist/esm/plugins/type-ahead/ui/TypeAheadListItem.js +18 -51
- package/dist/esm/ui/ElementBrowser/InsertMenu.js +12 -35
- package/dist/esm/ui/ElementBrowser/components/ElementList/ElementList.js +31 -89
- package/dist/esm/utils/clipboard.js +55 -0
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/plugins/analytics/types/toolbar-button.d.ts +3 -1
- package/dist/types/plugins/card/styles.d.ts +1 -0
- package/dist/types/plugins/copy-button/commands.d.ts +4 -0
- package/dist/types/plugins/copy-button/index.d.ts +3 -0
- package/dist/types/plugins/copy-button/pm-plugins/main.d.ts +3 -0
- package/dist/types/plugins/copy-button/pm-plugins/plugin-key.d.ts +2 -0
- package/dist/types/plugins/copy-button/utils.d.ts +7 -0
- package/dist/types/plugins/indentation/messages.d.ts +12 -0
- package/dist/types/plugins/index.d.ts +2 -0
- package/dist/types/plugins/panel/toolbar.d.ts +1 -1
- package/dist/types/plugins/table/commands/hover.d.ts +1 -1
- package/dist/types/plugins/table/utils/decoration.d.ts +1 -1
- package/dist/types/plugins/text-formatting/utils.d.ts +1 -1
- package/dist/types/plugins/toolbar-lists-indentation/index.d.ts +5 -0
- package/dist/types/plugins/toolbar-lists-indentation/types.d.ts +16 -0
- package/dist/types/plugins/toolbar-lists-indentation/ui/Toolbar.d.ts +4 -0
- package/dist/types/plugins/toolbar-lists-indentation/ui/ToolbarDropdown.d.ts +9 -0
- package/dist/types/plugins/{list/ui/ToolbarLists → toolbar-lists-indentation/ui}/index.d.ts +4 -10
- package/dist/types/plugins/toolbar-lists-indentation/ui/onItemActivated.d.ts +6 -0
- package/dist/types/plugins/type-ahead/ui/TypeAheadListItem.d.ts +0 -25
- package/dist/types/types/feature-flags.d.ts +18 -0
- package/dist/types/ui/ElementBrowser/components/ElementList/ElementList.d.ts +11 -0
- package/dist/types/utils/clipboard.d.ts +1 -0
- package/package.json +20 -20
- package/report.api.md +5373 -1324
- package/dist/cjs/plugins/list/ui/ToolbarLists/index.js +0 -266
- package/dist/es2019/plugins/list/ui/ToolbarLists/index.js +0 -220
- package/dist/esm/plugins/list/ui/ToolbarLists/index.js +0 -241
|
@@ -19,7 +19,7 @@ var safeNumberFeatureFlag = function safeNumberFeatureFlag(value) {
|
|
|
19
19
|
|
|
20
20
|
|
|
21
21
|
export function createFeatureFlagsFromProps(props) {
|
|
22
|
-
var _props$allowTextColor, _props$allowLayouts, _props$performanceTra, _props$performanceTra2, _props$featureFlags, _props$featureFlags2, _props$allowTables, _props$featureFlags3, _props$featureFlags4, _props$allowTables2, _props$featureFlags5, _props$featureFlags6, _props$allowTables3, _props$featureFlags7, _props$featureFlags8, _props$allowTables4, _props$featureFlags9, _props$featureFlags10, _props$allowTables5, _props$allowExtension, _props$featureFlags11, _props$featureFlags12, _props$featureFlags13, _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$featureFlags32, _props$featureFlags33, _props$collabEdit, _props$collabEdit2, _props$featureFlags34, _props$featureFlags35, _props$featureFlags36, _props$featureFlags37;
|
|
22
|
+
var _props$allowTextColor, _props$allowLayouts, _props$performanceTra, _props$performanceTra2, _props$featureFlags, _props$featureFlags2, _props$allowTables, _props$featureFlags3, _props$featureFlags4, _props$allowTables2, _props$featureFlags5, _props$featureFlags6, _props$allowTables3, _props$featureFlags7, _props$featureFlags8, _props$allowTables4, _props$featureFlags9, _props$featureFlags10, _props$allowTables5, _props$allowExtension, _props$featureFlags11, _props$featureFlags12, _props$featureFlags13, _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$featureFlags32, _props$featureFlags33, _props$collabEdit, _props$collabEdit2, _props$featureFlags34, _props$featureFlags35, _props$featureFlags36, _props$featureFlags37, _props$featureFlags38, _props$featureFlags39, _props$featureFlags40, _props$featureFlags41;
|
|
23
23
|
|
|
24
24
|
var normalizedFeatureFlags = normalizeFeatureFlags(props.featureFlags);
|
|
25
25
|
return _objectSpread(_objectSpread({}, normalizedFeatureFlags), {}, {
|
|
@@ -57,6 +57,8 @@ export function createFeatureFlagsFromProps(props) {
|
|
|
57
57
|
useNativeCollabPlugin: Boolean(typeof ((_props$collabEdit = props.collabEdit) === null || _props$collabEdit === void 0 ? void 0 : _props$collabEdit.useNativePlugin) === 'boolean' ? !!((_props$collabEdit2 = props.collabEdit) !== null && _props$collabEdit2 !== void 0 && _props$collabEdit2.useNativePlugin) : false),
|
|
58
58
|
chromeCursorHandlerFixedVersion: typeof ((_props$featureFlags34 = props.featureFlags) === null || _props$featureFlags34 === void 0 ? void 0 : _props$featureFlags34.chromeCursorHandlerFixedVersion) === 'string' ? Number(props.featureFlags.chromeCursorHandlerFixedVersion) || undefined : undefined,
|
|
59
59
|
viewChangingExperimentToolbarStyle: typeof ((_props$featureFlags35 = props.featureFlags) === null || _props$featureFlags35 === void 0 ? void 0 : _props$featureFlags35['view-changing-experiment-toolbar-style']) === 'string' ? props.featureFlags['view-changing-experiment-toolbar-style'] || undefined : undefined,
|
|
60
|
-
showHoverPreview: Boolean(typeof ((_props$featureFlags36 = props.featureFlags) === null || _props$featureFlags36 === void 0 ? void 0 : _props$featureFlags36.showHoverPreview) === 'boolean' ? !!((_props$featureFlags37 = props.featureFlags) !== null && _props$featureFlags37 !== void 0 && _props$featureFlags37.showHoverPreview) : false)
|
|
60
|
+
showHoverPreview: Boolean(typeof ((_props$featureFlags36 = props.featureFlags) === null || _props$featureFlags36 === void 0 ? void 0 : _props$featureFlags36.showHoverPreview) === 'boolean' ? !!((_props$featureFlags37 = props.featureFlags) !== null && _props$featureFlags37 !== void 0 && _props$featureFlags37.showHoverPreview) : false),
|
|
61
|
+
indentationButtonsInTheToolbar: Boolean(typeof ((_props$featureFlags38 = props.featureFlags) === null || _props$featureFlags38 === void 0 ? void 0 : _props$featureFlags38['indentation-buttons-in-the-toolbar']) === 'boolean' ? !!((_props$featureFlags39 = props.featureFlags) !== null && _props$featureFlags39 !== void 0 && _props$featureFlags39['indentation-buttons-in-the-toolbar']) : false),
|
|
62
|
+
floatingToolbarCopyButton: Boolean(typeof ((_props$featureFlags40 = props.featureFlags) === null || _props$featureFlags40 === void 0 ? void 0 : _props$featureFlags40.floatingToolbarCopyButton) === 'boolean' ? !!((_props$featureFlags41 = props.featureFlags) !== null && _props$featureFlags41 !== void 0 && _props$featureFlags41.floatingToolbarCopyButton) : false)
|
|
61
63
|
});
|
|
62
64
|
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// Common Translations will live here
|
|
2
|
+
import { defineMessages } from 'react-intl-next';
|
|
3
|
+
export var messages = defineMessages({
|
|
4
|
+
indent: {
|
|
5
|
+
id: 'fabric.editor.indent',
|
|
6
|
+
defaultMessage: 'Indent',
|
|
7
|
+
description: 'Indent a list item, paragraph or heading'
|
|
8
|
+
},
|
|
9
|
+
outdent: {
|
|
10
|
+
id: 'fabric.editor.outdent',
|
|
11
|
+
defaultMessage: 'Outdent',
|
|
12
|
+
description: 'Outdent a list item, paragraph or heading'
|
|
13
|
+
}
|
|
14
|
+
});
|
|
@@ -15,6 +15,7 @@ export { default as insertBlockPlugin } from './insert-block';
|
|
|
15
15
|
export { default as jiraIssuePlugin } from './jira-issue';
|
|
16
16
|
export { default as layoutPlugin } from './layout';
|
|
17
17
|
export { default as listPlugin } from './list';
|
|
18
|
+
export { default as toolbarListsIndentationPlugin } from './toolbar-lists-indentation';
|
|
18
19
|
export { default as macroPlugin } from './macro';
|
|
19
20
|
export { default as maxContentSizePlugin } from './max-content-size';
|
|
20
21
|
export { default as mediaPlugin } from './media';
|
|
@@ -63,4 +64,5 @@ export { default as undoRedoPlugin } from './undo-redo';
|
|
|
63
64
|
export { default as avatarGroupPlugin } from './avatar-group';
|
|
64
65
|
export { default as viewUpdateSubscriptionPlugin } from './view-update-subscription';
|
|
65
66
|
export { default as beforePrimaryToolbarPlugin } from './before-primaryToolbar';
|
|
66
|
-
export { default as codeBidiWarningPlugin } from './code-bidi-warning';
|
|
67
|
+
export { default as codeBidiWarningPlugin } from './code-bidi-warning';
|
|
68
|
+
export { default as copyButtonPlugin } from './copy-button';
|
|
@@ -1,15 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { orderedList, bulletList, listItem } from '@atlaskit/adf-schema';
|
|
3
|
-
import
|
|
4
|
-
import { createPlugin, pluginKey } from './pm-plugins/main';
|
|
3
|
+
import { createPlugin } from './pm-plugins/main';
|
|
5
4
|
import inputRulePlugin from './pm-plugins/input-rules';
|
|
6
5
|
import keymapPlugin from './pm-plugins/keymap';
|
|
7
|
-
import WithPluginState from '../../ui/WithPluginState';
|
|
8
6
|
import { messages } from './messages';
|
|
9
7
|
import { addAnalytics, ACTION, EVENT_TYPE, INPUT_METHOD, ACTION_SUBJECT, ACTION_SUBJECT_ID } from '../analytics';
|
|
10
8
|
import { tooltip, toggleBulletList, toggleOrderedList } from '../../keymaps';
|
|
11
9
|
import { IconList, IconListNumber } from '../quick-insert/assets';
|
|
12
|
-
import { ToolbarSize } from '../../ui/Toolbar/types';
|
|
13
10
|
|
|
14
11
|
var listPlugin = function listPlugin() {
|
|
15
12
|
return {
|
|
@@ -96,43 +93,6 @@ var listPlugin = function listPlugin() {
|
|
|
96
93
|
}
|
|
97
94
|
}];
|
|
98
95
|
}
|
|
99
|
-
},
|
|
100
|
-
primaryToolbarComponent: function primaryToolbarComponent(_ref4) {
|
|
101
|
-
var editorView = _ref4.editorView,
|
|
102
|
-
popupsMountPoint = _ref4.popupsMountPoint,
|
|
103
|
-
popupsBoundariesElement = _ref4.popupsBoundariesElement,
|
|
104
|
-
popupsScrollableElement = _ref4.popupsScrollableElement,
|
|
105
|
-
toolbarSize = _ref4.toolbarSize,
|
|
106
|
-
disabled = _ref4.disabled,
|
|
107
|
-
isToolbarReducedSpacing = _ref4.isToolbarReducedSpacing;
|
|
108
|
-
var isSmall = toolbarSize < ToolbarSize.L;
|
|
109
|
-
return /*#__PURE__*/React.createElement(WithPluginState, {
|
|
110
|
-
plugins: {
|
|
111
|
-
listState: pluginKey
|
|
112
|
-
},
|
|
113
|
-
render: function render(_ref5) {
|
|
114
|
-
var listState = _ref5.listState;
|
|
115
|
-
|
|
116
|
-
if (!listState) {
|
|
117
|
-
return null;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
return /*#__PURE__*/React.createElement(ToolbarLists, {
|
|
121
|
-
isSmall: isSmall,
|
|
122
|
-
isSeparator: true,
|
|
123
|
-
isReducedSpacing: isToolbarReducedSpacing,
|
|
124
|
-
disabled: disabled,
|
|
125
|
-
editorView: editorView,
|
|
126
|
-
popupsMountPoint: popupsMountPoint,
|
|
127
|
-
popupsBoundariesElement: popupsBoundariesElement,
|
|
128
|
-
popupsScrollableElement: popupsScrollableElement,
|
|
129
|
-
bulletListActive: listState.bulletListActive,
|
|
130
|
-
bulletListDisabled: listState.bulletListDisabled,
|
|
131
|
-
orderedListActive: listState.orderedListActive,
|
|
132
|
-
orderedListDisabled: listState.orderedListDisabled
|
|
133
|
-
});
|
|
134
|
-
}
|
|
135
|
-
});
|
|
136
96
|
}
|
|
137
97
|
};
|
|
138
98
|
};
|
|
@@ -24,6 +24,7 @@ import { DEFAULT_BORDER_COLOR } from '../../ui/ColorPalette/Palettes';
|
|
|
24
24
|
import { PanelType } from '@atlaskit/adf-schema';
|
|
25
25
|
import { ACTION, ACTION_SUBJECT, EVENT_TYPE, ACTION_SUBJECT_ID, withAnalytics } from '../analytics';
|
|
26
26
|
import { messages } from './message';
|
|
27
|
+
import { getCopyButtonConfig, showCopyButton } from '../copy-button/utils';
|
|
27
28
|
export var panelIconMap = (_panelIconMap = {}, _defineProperty(_panelIconMap, PanelType.INFO, {
|
|
28
29
|
shortName: ':info:',
|
|
29
30
|
id: 'atlassian-info'
|
|
@@ -43,7 +44,7 @@ export var panelIconMap = (_panelIconMap = {}, _defineProperty(_panelIconMap, Pa
|
|
|
43
44
|
shortName: ':tip:',
|
|
44
45
|
id: 'atlassian-tip'
|
|
45
46
|
}), _panelIconMap);
|
|
46
|
-
export var getToolbarItems = function getToolbarItems(formatMessage, panelNodeType, isCustomPanelEnabled, isCustomPanelEditable, providerFactory, activePanelType, activePanelColor, activePanelIcon) {
|
|
47
|
+
export var getToolbarItems = function getToolbarItems(formatMessage, panelNodeType, isCustomPanelEnabled, isCustomPanelEditable, providerFactory, activePanelType, activePanelColor, activePanelIcon, state) {
|
|
47
48
|
// TODO: ED-14403 investigate why these titles are not getting translated for the tooltips
|
|
48
49
|
var items = [{
|
|
49
50
|
id: 'editor.panel.info',
|
|
@@ -242,6 +243,12 @@ export var getToolbarItems = function getToolbarItems(formatMessage, panelNodeTy
|
|
|
242
243
|
}
|
|
243
244
|
}
|
|
244
245
|
|
|
246
|
+
if (state && showCopyButton(state)) {
|
|
247
|
+
items.push({
|
|
248
|
+
type: 'separator'
|
|
249
|
+
}, getCopyButtonConfig(state, formatMessage, panelNodeType));
|
|
250
|
+
}
|
|
251
|
+
|
|
245
252
|
items.push({
|
|
246
253
|
type: 'separator'
|
|
247
254
|
}, {
|
|
@@ -277,7 +284,7 @@ export var getToolbarConfig = function getToolbarConfig(state, intl) {
|
|
|
277
284
|
}; // force toolbar to be turned on
|
|
278
285
|
|
|
279
286
|
|
|
280
|
-
var items = getToolbarItems(formatMessage, nodeType, options.allowCustomPanel || false, options.allowCustomPanel && options.allowCustomPanelEdit || false, providerFactory, panelType, options.allowCustomPanel ? panelColor : undefined, options.allowCustomPanel ? panelIcon || isStandardPanel(panelType) : undefined);
|
|
287
|
+
var items = getToolbarItems(formatMessage, nodeType, options.allowCustomPanel || false, options.allowCustomPanel && options.allowCustomPanelEdit || false, providerFactory, panelType, options.allowCustomPanel ? panelColor : undefined, options.allowCustomPanel ? panelIcon || isStandardPanel(panelType) : undefined, state);
|
|
281
288
|
|
|
282
289
|
var getDomRef = function getDomRef(editorView) {
|
|
283
290
|
var domAtPos = editorView.domAtPos.bind(editorView);
|
|
@@ -3,16 +3,15 @@ import Fuse from 'fuse.js';
|
|
|
3
3
|
import { dedupe } from '../../utils';
|
|
4
4
|
var options = {
|
|
5
5
|
threshold: 0.3,
|
|
6
|
-
keys: [
|
|
7
|
-
{
|
|
6
|
+
keys: [{
|
|
8
7
|
name: 'title',
|
|
9
|
-
weight: 0.
|
|
8
|
+
weight: 0.57
|
|
10
9
|
}, {
|
|
11
10
|
name: 'priority',
|
|
12
11
|
weight: 0.3
|
|
13
12
|
}, {
|
|
14
13
|
name: 'keywords',
|
|
15
|
-
weight: 0.
|
|
14
|
+
weight: 0.08
|
|
16
15
|
}, {
|
|
17
16
|
name: 'description',
|
|
18
17
|
weight: 0.04
|
|
@@ -86,7 +86,7 @@ export var hoverRows = function hoverRows(hoveredRows, isInDanger) {
|
|
|
86
86
|
return tr.setMeta('addToHistory', false);
|
|
87
87
|
});
|
|
88
88
|
};
|
|
89
|
-
export var hoverTable = function hoverTable(isInDanger) {
|
|
89
|
+
export var hoverTable = function hoverTable(isInDanger, isSelected) {
|
|
90
90
|
return createCommand(function (state) {
|
|
91
91
|
var table = findTable(state.selection);
|
|
92
92
|
|
|
@@ -103,7 +103,7 @@ export var hoverTable = function hoverTable(isInDanger) {
|
|
|
103
103
|
return false;
|
|
104
104
|
}
|
|
105
105
|
|
|
106
|
-
var decorations = createControlsHoverDecoration(cells, 'table', isInDanger);
|
|
106
|
+
var decorations = createControlsHoverDecoration(cells, 'table', isInDanger, isSelected);
|
|
107
107
|
return {
|
|
108
108
|
type: 'HOVER_TABLE',
|
|
109
109
|
data: {
|
|
@@ -15,7 +15,8 @@ import { splitCell } from '@atlaskit/editor-tables/utils';
|
|
|
15
15
|
import tableMessages from './ui/messages';
|
|
16
16
|
import { messages as ContextualMenuMessages } from './ui/FloatingContextualMenu/ContextualMenu';
|
|
17
17
|
import { findParentDomRefOfType } from 'prosemirror-utils';
|
|
18
|
-
import { closestElement } from '../../utils/dom';
|
|
18
|
+
import { closestElement } from '../../utils/dom';
|
|
19
|
+
import { getCopyButtonConfig, showCopyButton } from '../copy-button/utils'; // TODO: ED-14403 investigate why these translations don't work
|
|
19
20
|
|
|
20
21
|
export var messages = defineMessages({
|
|
21
22
|
tableOptions: {
|
|
@@ -244,7 +245,9 @@ export var getToolbarConfig = function getToolbarConfig(config) {
|
|
|
244
245
|
items: [menu, separator(menu.hidden)].concat(_toConsumableArray(cellItems), [{
|
|
245
246
|
type: 'extensions-placeholder',
|
|
246
247
|
separator: 'end'
|
|
247
|
-
}, {
|
|
248
|
+
}], _toConsumableArray(state && showCopyButton(state) ? [getCopyButtonConfig(state, intl.formatMessage, nodeType, hoverTable(false, true), clearHoverSelection()), {
|
|
249
|
+
type: 'separator'
|
|
250
|
+
}] : []), [{
|
|
248
251
|
id: 'editor.table.delete',
|
|
249
252
|
type: 'button',
|
|
250
253
|
appearance: 'danger',
|
|
@@ -25,7 +25,7 @@ export var createCellHoverDecoration = function createCellHoverDecoration(cells,
|
|
|
25
25
|
});
|
|
26
26
|
});
|
|
27
27
|
};
|
|
28
|
-
export var createControlsHoverDecoration = function createControlsHoverDecoration(cells, type, danger) {
|
|
28
|
+
export var createControlsHoverDecoration = function createControlsHoverDecoration(cells, type, danger, selected) {
|
|
29
29
|
return cells.map(function (cell) {
|
|
30
30
|
var classes = [ClassName.HOVERED_CELL];
|
|
31
31
|
|
|
@@ -33,6 +33,10 @@ export var createControlsHoverDecoration = function createControlsHoverDecoratio
|
|
|
33
33
|
classes.push(ClassName.HOVERED_CELL_IN_DANGER);
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
+
if (selected) {
|
|
37
|
+
classes.push(ClassName.SELECTED_CELL);
|
|
38
|
+
}
|
|
39
|
+
|
|
36
40
|
classes.push(type === 'column' ? ClassName.HOVERED_COLUMN : type === 'row' ? ClassName.HOVERED_ROW : ClassName.HOVERED_TABLE);
|
|
37
41
|
var key;
|
|
38
42
|
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import ToolbarListsIndentation from './ui';
|
|
3
|
+
import WithPluginState from '../../ui/WithPluginState';
|
|
4
|
+
import { ToolbarSize } from '../../ui/Toolbar/types';
|
|
5
|
+
import { pluginKey as listPluginKey } from '../list/pm-plugins/main';
|
|
6
|
+
|
|
7
|
+
var toolbarListsIndentationPlugin = function toolbarListsIndentationPlugin(_ref) {
|
|
8
|
+
var showIndentationButtons = _ref.showIndentationButtons;
|
|
9
|
+
return {
|
|
10
|
+
name: 'toolbarListsIndentation',
|
|
11
|
+
primaryToolbarComponent: function primaryToolbarComponent(_ref2) {
|
|
12
|
+
var editorView = _ref2.editorView,
|
|
13
|
+
popupsMountPoint = _ref2.popupsMountPoint,
|
|
14
|
+
popupsBoundariesElement = _ref2.popupsBoundariesElement,
|
|
15
|
+
popupsScrollableElement = _ref2.popupsScrollableElement,
|
|
16
|
+
toolbarSize = _ref2.toolbarSize,
|
|
17
|
+
disabled = _ref2.disabled,
|
|
18
|
+
isToolbarReducedSpacing = _ref2.isToolbarReducedSpacing;
|
|
19
|
+
var isSmall = toolbarSize < ToolbarSize.L;
|
|
20
|
+
return /*#__PURE__*/React.createElement(WithPluginState, {
|
|
21
|
+
plugins: {
|
|
22
|
+
listState: listPluginKey
|
|
23
|
+
},
|
|
24
|
+
render: function render(_ref3) {
|
|
25
|
+
var listState = _ref3.listState;
|
|
26
|
+
|
|
27
|
+
if (!listState) {
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
return /*#__PURE__*/React.createElement(ToolbarListsIndentation, {
|
|
32
|
+
isSmall: isSmall,
|
|
33
|
+
isReducedSpacing: isToolbarReducedSpacing,
|
|
34
|
+
disabled: disabled,
|
|
35
|
+
editorView: editorView,
|
|
36
|
+
popupsMountPoint: popupsMountPoint,
|
|
37
|
+
popupsBoundariesElement: popupsBoundariesElement,
|
|
38
|
+
popupsScrollableElement: popupsScrollableElement,
|
|
39
|
+
bulletListActive: listState.bulletListActive,
|
|
40
|
+
bulletListDisabled: listState.bulletListDisabled,
|
|
41
|
+
orderedListActive: listState.orderedListActive,
|
|
42
|
+
orderedListDisabled: listState.orderedListDisabled,
|
|
43
|
+
showIndentationButtons: !!showIndentationButtons
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
export default toolbarListsIndentationPlugin;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import { jsx } from '@emotion/react';
|
|
3
|
+
import { useIntl } from 'react-intl-next';
|
|
4
|
+
import BulletListIcon from '@atlaskit/icon/glyph/editor/bullet-list';
|
|
5
|
+
import NumberListIcon from '@atlaskit/icon/glyph/editor/number-list';
|
|
6
|
+
import IndentIcon from '@atlaskit/icon/glyph/editor/indent';
|
|
7
|
+
import OutdentIcon from '@atlaskit/icon/glyph/editor/outdent';
|
|
8
|
+
import { toggleBulletList as toggleBulletListKeymap, toggleOrderedList as toggleOrderedListKeymap, indent as toggleIndentKeymap, outdent as toggleOutdentKeymap, ToolTipContent } from '../../../keymaps';
|
|
9
|
+
import ToolbarButton, { TOOLBAR_BUTTON } from '../../../ui/ToolbarButton';
|
|
10
|
+
import { messages } from '../../list/messages';
|
|
11
|
+
import { messages as indentationMessages } from '../../indentation/messages';
|
|
12
|
+
import { buttonGroupStyle, separatorStyles } from '../../../ui/styles';
|
|
13
|
+
export function Toolbar(props) {
|
|
14
|
+
var _useIntl = useIntl(),
|
|
15
|
+
formatMessage = _useIntl.formatMessage;
|
|
16
|
+
|
|
17
|
+
var disabled = props.disabled,
|
|
18
|
+
isReducedSpacing = props.isReducedSpacing,
|
|
19
|
+
bulletListActive = props.bulletListActive,
|
|
20
|
+
bulletListDisabled = props.bulletListDisabled,
|
|
21
|
+
orderedListActive = props.orderedListActive,
|
|
22
|
+
orderedListDisabled = props.orderedListDisabled,
|
|
23
|
+
showIndentationButtons = props.showIndentationButtons,
|
|
24
|
+
onItemActivated = props.onItemActivated;
|
|
25
|
+
var labelUnorderedList = formatMessage(messages.unorderedList);
|
|
26
|
+
var labelOrderedList = formatMessage(messages.orderedList);
|
|
27
|
+
|
|
28
|
+
var handleOnItemActivated = function handleOnItemActivated(buttonName) {
|
|
29
|
+
return function (event) {
|
|
30
|
+
return onItemActivated({
|
|
31
|
+
editorView: props.editorView,
|
|
32
|
+
buttonName: buttonName
|
|
33
|
+
});
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
return jsx("span", {
|
|
38
|
+
css: buttonGroupStyle
|
|
39
|
+
}, jsx(ToolbarButton, {
|
|
40
|
+
buttonId: TOOLBAR_BUTTON.BULLET_LIST,
|
|
41
|
+
spacing: isReducedSpacing ? 'none' : 'default',
|
|
42
|
+
onClick: handleOnItemActivated('bullet_list'),
|
|
43
|
+
selected: bulletListActive,
|
|
44
|
+
"aria-pressed": bulletListActive,
|
|
45
|
+
"aria-label": labelUnorderedList,
|
|
46
|
+
disabled: bulletListDisabled || disabled,
|
|
47
|
+
title: jsx(ToolTipContent, {
|
|
48
|
+
description: labelUnorderedList,
|
|
49
|
+
keymap: toggleBulletListKeymap
|
|
50
|
+
}),
|
|
51
|
+
iconBefore: jsx(BulletListIcon, {
|
|
52
|
+
label: ""
|
|
53
|
+
})
|
|
54
|
+
}), jsx(ToolbarButton, {
|
|
55
|
+
buttonId: TOOLBAR_BUTTON.ORDERED_LIST,
|
|
56
|
+
spacing: isReducedSpacing ? 'none' : 'default',
|
|
57
|
+
onClick: handleOnItemActivated('ordered_list'),
|
|
58
|
+
selected: orderedListActive,
|
|
59
|
+
"aria-pressed": orderedListActive,
|
|
60
|
+
"aria-label": labelOrderedList,
|
|
61
|
+
disabled: orderedListDisabled || disabled,
|
|
62
|
+
title: jsx(ToolTipContent, {
|
|
63
|
+
description: labelOrderedList,
|
|
64
|
+
keymap: toggleOrderedListKeymap
|
|
65
|
+
}),
|
|
66
|
+
iconBefore: jsx(NumberListIcon, {
|
|
67
|
+
label: ""
|
|
68
|
+
})
|
|
69
|
+
}), showIndentationButtons && jsx(ToolbarButton, {
|
|
70
|
+
buttonId: TOOLBAR_BUTTON.INDENT,
|
|
71
|
+
spacing: isReducedSpacing ? 'none' : 'default',
|
|
72
|
+
onClick: handleOnItemActivated('indent'),
|
|
73
|
+
iconBefore: jsx(IndentIcon, {
|
|
74
|
+
label: ""
|
|
75
|
+
}),
|
|
76
|
+
disabled: true,
|
|
77
|
+
title: jsx(ToolTipContent, {
|
|
78
|
+
description: formatMessage(indentationMessages.indent),
|
|
79
|
+
keymap: toggleIndentKeymap
|
|
80
|
+
})
|
|
81
|
+
}), showIndentationButtons && jsx(ToolbarButton, {
|
|
82
|
+
buttonId: TOOLBAR_BUTTON.OUTDENT,
|
|
83
|
+
spacing: isReducedSpacing ? 'none' : 'default',
|
|
84
|
+
onClick: handleOnItemActivated('outdent'),
|
|
85
|
+
iconBefore: jsx(OutdentIcon, {
|
|
86
|
+
label: ""
|
|
87
|
+
}),
|
|
88
|
+
disabled: true,
|
|
89
|
+
title: jsx(ToolTipContent, {
|
|
90
|
+
description: formatMessage(indentationMessages.outdent),
|
|
91
|
+
keymap: toggleOutdentKeymap
|
|
92
|
+
})
|
|
93
|
+
}), jsx("span", {
|
|
94
|
+
css: separatorStyles
|
|
95
|
+
}));
|
|
96
|
+
}
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
|
+
|
|
3
|
+
/** @jsx jsx */
|
|
4
|
+
import { jsx } from '@emotion/react';
|
|
5
|
+
import React from 'react';
|
|
6
|
+
import { useIntl } from 'react-intl-next';
|
|
7
|
+
import ExpandIcon from '@atlaskit/icon/glyph/chevron-down';
|
|
8
|
+
import BulletListIcon from '@atlaskit/icon/glyph/editor/bullet-list';
|
|
9
|
+
import { toggleBulletList as toggleBulletListKeymap, toggleOrderedList as toggleOrderedListKeymap, indent as toggleIndentKeymap, outdent as toggleOutdentKeymap, tooltip } from '../../../keymaps';
|
|
10
|
+
import DropdownMenu from '../../../ui/DropdownMenu';
|
|
11
|
+
import ToolbarButton from '../../../ui/ToolbarButton';
|
|
12
|
+
import { wrapperStyle, expandIconWrapperStyle, shortcutStyle, separatorStyles } from '../../../ui/styles';
|
|
13
|
+
import { messages as listMessages } from '../../list/messages';
|
|
14
|
+
import { messages as indentationMessages } from '../../indentation/messages';
|
|
15
|
+
export function ToolbarDropdown(props) {
|
|
16
|
+
var _useIntl = useIntl(),
|
|
17
|
+
formatMessage = _useIntl.formatMessage;
|
|
18
|
+
|
|
19
|
+
var disabled = props.disabled,
|
|
20
|
+
isReducedSpacing = props.isReducedSpacing,
|
|
21
|
+
bulletListActive = props.bulletListActive,
|
|
22
|
+
orderedListActive = props.orderedListActive,
|
|
23
|
+
popupsMountPoint = props.popupsMountPoint,
|
|
24
|
+
popupsBoundariesElement = props.popupsBoundariesElement,
|
|
25
|
+
popupsScrollableElement = props.popupsScrollableElement,
|
|
26
|
+
onItemActivated = props.onItemActivated;
|
|
27
|
+
|
|
28
|
+
var _React$useState = React.useState(false),
|
|
29
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
30
|
+
isDropdownOpen = _React$useState2[0],
|
|
31
|
+
setIsDropdownOpen = _React$useState2[1];
|
|
32
|
+
|
|
33
|
+
var labelLists = formatMessage(listMessages.lists);
|
|
34
|
+
|
|
35
|
+
var onOpenChange = function onOpenChange(attrs) {
|
|
36
|
+
setIsDropdownOpen(attrs.isDropdownOpen);
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
var handleTriggerClick = function handleTriggerClick() {
|
|
40
|
+
onOpenChange({
|
|
41
|
+
isDropdownOpen: !isDropdownOpen
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
var items = useItems(props);
|
|
46
|
+
|
|
47
|
+
var handleOnItemActivated = function handleOnItemActivated(_ref) {
|
|
48
|
+
var item = _ref.item;
|
|
49
|
+
setIsDropdownOpen(false);
|
|
50
|
+
return onItemActivated({
|
|
51
|
+
editorView: props.editorView,
|
|
52
|
+
buttonName: item.value.name
|
|
53
|
+
});
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
return jsx("span", {
|
|
57
|
+
css: wrapperStyle
|
|
58
|
+
}, jsx(DropdownMenu, {
|
|
59
|
+
items: items,
|
|
60
|
+
onItemActivated: handleOnItemActivated,
|
|
61
|
+
mountTo: popupsMountPoint,
|
|
62
|
+
boundariesElement: popupsBoundariesElement,
|
|
63
|
+
scrollableElement: popupsScrollableElement,
|
|
64
|
+
isOpen: isDropdownOpen,
|
|
65
|
+
onOpenChange: onOpenChange,
|
|
66
|
+
fitHeight: 188,
|
|
67
|
+
fitWidth: 175,
|
|
68
|
+
shouldUseDefaultRole: true
|
|
69
|
+
}, jsx(ToolbarButton, {
|
|
70
|
+
spacing: isReducedSpacing ? 'none' : 'default',
|
|
71
|
+
selected: bulletListActive || orderedListActive,
|
|
72
|
+
"aria-expanded": isDropdownOpen,
|
|
73
|
+
"aria-haspopup": true,
|
|
74
|
+
"aria-label": labelLists,
|
|
75
|
+
disabled: disabled,
|
|
76
|
+
onClick: handleTriggerClick,
|
|
77
|
+
title: labelLists,
|
|
78
|
+
iconBefore: jsx("span", {
|
|
79
|
+
css: wrapperStyle
|
|
80
|
+
}, jsx(BulletListIcon, {
|
|
81
|
+
label: labelLists
|
|
82
|
+
}), jsx("span", {
|
|
83
|
+
css: expandIconWrapperStyle
|
|
84
|
+
}, jsx(ExpandIcon, {
|
|
85
|
+
label: ""
|
|
86
|
+
})))
|
|
87
|
+
})), jsx("span", {
|
|
88
|
+
css: separatorStyles
|
|
89
|
+
}));
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
function useItems(props) {
|
|
93
|
+
var _useIntl2 = useIntl(),
|
|
94
|
+
formatMessage = _useIntl2.formatMessage;
|
|
95
|
+
|
|
96
|
+
var labelUnorderedList = formatMessage(listMessages.unorderedList);
|
|
97
|
+
var labelOrderedList = formatMessage(listMessages.orderedList);
|
|
98
|
+
var items = [{
|
|
99
|
+
key: 'unorderedList',
|
|
100
|
+
content: labelUnorderedList,
|
|
101
|
+
value: {
|
|
102
|
+
name: 'bullet_list'
|
|
103
|
+
},
|
|
104
|
+
isDisabled: props.bulletListDisabled,
|
|
105
|
+
isActive: Boolean(props.bulletListActive),
|
|
106
|
+
elemAfter: jsx("div", {
|
|
107
|
+
css: shortcutStyle
|
|
108
|
+
}, tooltip(toggleBulletListKeymap))
|
|
109
|
+
}, {
|
|
110
|
+
key: 'orderedList',
|
|
111
|
+
content: labelOrderedList,
|
|
112
|
+
value: {
|
|
113
|
+
name: 'ordered_list'
|
|
114
|
+
},
|
|
115
|
+
isDisabled: props.orderedListDisabled,
|
|
116
|
+
isActive: Boolean(props.orderedListActive),
|
|
117
|
+
elemAfter: jsx("div", {
|
|
118
|
+
css: shortcutStyle
|
|
119
|
+
}, tooltip(toggleOrderedListKeymap))
|
|
120
|
+
}];
|
|
121
|
+
|
|
122
|
+
if (props.showIndentationButtons) {
|
|
123
|
+
var labelIndent = formatMessage(indentationMessages.indent);
|
|
124
|
+
var labelOutdent = formatMessage(indentationMessages.outdent);
|
|
125
|
+
items.push({
|
|
126
|
+
key: 'indent',
|
|
127
|
+
content: labelIndent,
|
|
128
|
+
value: {
|
|
129
|
+
name: 'indent'
|
|
130
|
+
},
|
|
131
|
+
isDisabled: true,
|
|
132
|
+
isActive: false,
|
|
133
|
+
elemAfter: jsx("div", {
|
|
134
|
+
css: shortcutStyle
|
|
135
|
+
}, tooltip(toggleIndentKeymap))
|
|
136
|
+
}, {
|
|
137
|
+
key: 'outdent',
|
|
138
|
+
content: labelOutdent,
|
|
139
|
+
value: {
|
|
140
|
+
name: 'outdent'
|
|
141
|
+
},
|
|
142
|
+
isDisabled: true,
|
|
143
|
+
isActive: false,
|
|
144
|
+
elemAfter: jsx("div", {
|
|
145
|
+
css: shortcutStyle
|
|
146
|
+
}, tooltip(toggleOutdentKeymap))
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
return [{
|
|
151
|
+
items: items
|
|
152
|
+
}];
|
|
153
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import { jsx } from '@emotion/react';
|
|
3
|
+
import { onItemActivated } from './onItemActivated';
|
|
4
|
+
import { ToolbarDropdown } from './ToolbarDropdown';
|
|
5
|
+
import { Toolbar } from './Toolbar';
|
|
6
|
+
export default function ToolbarListsIndentation(props) {
|
|
7
|
+
var disabled = props.disabled,
|
|
8
|
+
isSmall = props.isSmall,
|
|
9
|
+
isReducedSpacing = props.isReducedSpacing,
|
|
10
|
+
bulletListActive = props.bulletListActive,
|
|
11
|
+
bulletListDisabled = props.bulletListDisabled,
|
|
12
|
+
orderedListActive = props.orderedListActive,
|
|
13
|
+
orderedListDisabled = props.orderedListDisabled,
|
|
14
|
+
showIndentationButtons = props.showIndentationButtons,
|
|
15
|
+
popupsMountPoint = props.popupsMountPoint,
|
|
16
|
+
popupsBoundariesElement = props.popupsBoundariesElement,
|
|
17
|
+
popupsScrollableElement = props.popupsScrollableElement;
|
|
18
|
+
|
|
19
|
+
if (isSmall) {
|
|
20
|
+
return jsx(ToolbarDropdown, {
|
|
21
|
+
editorView: props.editorView,
|
|
22
|
+
isReducedSpacing: isReducedSpacing,
|
|
23
|
+
popupsMountPoint: popupsMountPoint,
|
|
24
|
+
popupsBoundariesElement: popupsBoundariesElement,
|
|
25
|
+
popupsScrollableElement: popupsScrollableElement,
|
|
26
|
+
bulletListActive: bulletListActive,
|
|
27
|
+
bulletListDisabled: bulletListDisabled,
|
|
28
|
+
showIndentationButtons: showIndentationButtons,
|
|
29
|
+
orderedListActive: orderedListActive,
|
|
30
|
+
orderedListDisabled: orderedListDisabled,
|
|
31
|
+
disabled: disabled,
|
|
32
|
+
onItemActivated: onItemActivated
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
return jsx(Toolbar, {
|
|
37
|
+
editorView: props.editorView,
|
|
38
|
+
isReducedSpacing: isReducedSpacing,
|
|
39
|
+
bulletListActive: bulletListActive,
|
|
40
|
+
bulletListDisabled: bulletListDisabled,
|
|
41
|
+
showIndentationButtons: showIndentationButtons,
|
|
42
|
+
orderedListActive: orderedListActive,
|
|
43
|
+
orderedListDisabled: orderedListDisabled,
|
|
44
|
+
disabled: disabled,
|
|
45
|
+
onItemActivated: onItemActivated
|
|
46
|
+
});
|
|
47
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { toggleBulletList, toggleOrderedList } from '../../list/commands';
|
|
2
|
+
import { INPUT_METHOD } from '../../analytics';
|
|
3
|
+
export function onItemActivated(_ref) {
|
|
4
|
+
var buttonName = _ref.buttonName,
|
|
5
|
+
editorView = _ref.editorView;
|
|
6
|
+
|
|
7
|
+
switch (buttonName) {
|
|
8
|
+
case 'bullet_list':
|
|
9
|
+
toggleBulletList(editorView, INPUT_METHOD.TOOLBAR);
|
|
10
|
+
break;
|
|
11
|
+
|
|
12
|
+
case 'ordered_list':
|
|
13
|
+
toggleOrderedList(editorView, INPUT_METHOD.TOOLBAR);
|
|
14
|
+
break;
|
|
15
|
+
|
|
16
|
+
case 'indent':
|
|
17
|
+
editorView.someProp('handleKeyDown', function (handleKeyDown) {
|
|
18
|
+
return handleKeyDown(editorView, new KeyboardEvent('keydown', {
|
|
19
|
+
bubbles: true,
|
|
20
|
+
cancelable: true,
|
|
21
|
+
key: 'Tab',
|
|
22
|
+
code: 'Tab'
|
|
23
|
+
}));
|
|
24
|
+
});
|
|
25
|
+
break;
|
|
26
|
+
|
|
27
|
+
case 'outdent':
|
|
28
|
+
editorView.someProp('handleKeyDown', function (handleKeyDown) {
|
|
29
|
+
return handleKeyDown(editorView, new KeyboardEvent('keydown', {
|
|
30
|
+
bubbles: true,
|
|
31
|
+
cancelable: true,
|
|
32
|
+
shiftKey: true,
|
|
33
|
+
key: 'Tab',
|
|
34
|
+
code: 'Tab'
|
|
35
|
+
}));
|
|
36
|
+
});
|
|
37
|
+
break;
|
|
38
|
+
}
|
|
39
|
+
}
|