@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
|
@@ -0,0 +1,53 @@
|
|
|
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
|
+
const toolbarListsIndentationPlugin = ({
|
|
8
|
+
showIndentationButtons
|
|
9
|
+
}) => ({
|
|
10
|
+
name: 'toolbarListsIndentation',
|
|
11
|
+
|
|
12
|
+
primaryToolbarComponent({
|
|
13
|
+
editorView,
|
|
14
|
+
popupsMountPoint,
|
|
15
|
+
popupsBoundariesElement,
|
|
16
|
+
popupsScrollableElement,
|
|
17
|
+
toolbarSize,
|
|
18
|
+
disabled,
|
|
19
|
+
isToolbarReducedSpacing
|
|
20
|
+
}) {
|
|
21
|
+
const isSmall = toolbarSize < ToolbarSize.L;
|
|
22
|
+
return /*#__PURE__*/React.createElement(WithPluginState, {
|
|
23
|
+
plugins: {
|
|
24
|
+
listState: listPluginKey
|
|
25
|
+
},
|
|
26
|
+
render: ({
|
|
27
|
+
listState: listState
|
|
28
|
+
}) => {
|
|
29
|
+
if (!listState) {
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return /*#__PURE__*/React.createElement(ToolbarListsIndentation, {
|
|
34
|
+
isSmall: isSmall,
|
|
35
|
+
isReducedSpacing: isToolbarReducedSpacing,
|
|
36
|
+
disabled: disabled,
|
|
37
|
+
editorView: editorView,
|
|
38
|
+
popupsMountPoint: popupsMountPoint,
|
|
39
|
+
popupsBoundariesElement: popupsBoundariesElement,
|
|
40
|
+
popupsScrollableElement: popupsScrollableElement,
|
|
41
|
+
bulletListActive: listState.bulletListActive,
|
|
42
|
+
bulletListDisabled: listState.bulletListDisabled,
|
|
43
|
+
orderedListActive: listState.orderedListActive,
|
|
44
|
+
orderedListDisabled: listState.orderedListDisabled,
|
|
45
|
+
showIndentationButtons: !!showIndentationButtons
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
export default toolbarListsIndentationPlugin;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,94 @@
|
|
|
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
|
+
const {
|
|
15
|
+
formatMessage
|
|
16
|
+
} = useIntl();
|
|
17
|
+
const {
|
|
18
|
+
disabled,
|
|
19
|
+
isReducedSpacing,
|
|
20
|
+
bulletListActive,
|
|
21
|
+
bulletListDisabled,
|
|
22
|
+
orderedListActive,
|
|
23
|
+
orderedListDisabled,
|
|
24
|
+
showIndentationButtons,
|
|
25
|
+
onItemActivated
|
|
26
|
+
} = props;
|
|
27
|
+
const labelUnorderedList = formatMessage(messages.unorderedList);
|
|
28
|
+
const labelOrderedList = formatMessage(messages.orderedList);
|
|
29
|
+
|
|
30
|
+
const handleOnItemActivated = buttonName => event => onItemActivated({
|
|
31
|
+
editorView: props.editorView,
|
|
32
|
+
buttonName
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
return jsx("span", {
|
|
36
|
+
css: buttonGroupStyle
|
|
37
|
+
}, jsx(ToolbarButton, {
|
|
38
|
+
buttonId: TOOLBAR_BUTTON.BULLET_LIST,
|
|
39
|
+
spacing: isReducedSpacing ? 'none' : 'default',
|
|
40
|
+
onClick: handleOnItemActivated('bullet_list'),
|
|
41
|
+
selected: bulletListActive,
|
|
42
|
+
"aria-pressed": bulletListActive,
|
|
43
|
+
"aria-label": labelUnorderedList,
|
|
44
|
+
disabled: bulletListDisabled || disabled,
|
|
45
|
+
title: jsx(ToolTipContent, {
|
|
46
|
+
description: labelUnorderedList,
|
|
47
|
+
keymap: toggleBulletListKeymap
|
|
48
|
+
}),
|
|
49
|
+
iconBefore: jsx(BulletListIcon, {
|
|
50
|
+
label: ""
|
|
51
|
+
})
|
|
52
|
+
}), jsx(ToolbarButton, {
|
|
53
|
+
buttonId: TOOLBAR_BUTTON.ORDERED_LIST,
|
|
54
|
+
spacing: isReducedSpacing ? 'none' : 'default',
|
|
55
|
+
onClick: handleOnItemActivated('ordered_list'),
|
|
56
|
+
selected: orderedListActive,
|
|
57
|
+
"aria-pressed": orderedListActive,
|
|
58
|
+
"aria-label": labelOrderedList,
|
|
59
|
+
disabled: orderedListDisabled || disabled,
|
|
60
|
+
title: jsx(ToolTipContent, {
|
|
61
|
+
description: labelOrderedList,
|
|
62
|
+
keymap: toggleOrderedListKeymap
|
|
63
|
+
}),
|
|
64
|
+
iconBefore: jsx(NumberListIcon, {
|
|
65
|
+
label: ""
|
|
66
|
+
})
|
|
67
|
+
}), showIndentationButtons && jsx(ToolbarButton, {
|
|
68
|
+
buttonId: TOOLBAR_BUTTON.INDENT,
|
|
69
|
+
spacing: isReducedSpacing ? 'none' : 'default',
|
|
70
|
+
onClick: handleOnItemActivated('indent'),
|
|
71
|
+
iconBefore: jsx(IndentIcon, {
|
|
72
|
+
label: ""
|
|
73
|
+
}),
|
|
74
|
+
disabled: true,
|
|
75
|
+
title: jsx(ToolTipContent, {
|
|
76
|
+
description: formatMessage(indentationMessages.indent),
|
|
77
|
+
keymap: toggleIndentKeymap
|
|
78
|
+
})
|
|
79
|
+
}), showIndentationButtons && jsx(ToolbarButton, {
|
|
80
|
+
buttonId: TOOLBAR_BUTTON.OUTDENT,
|
|
81
|
+
spacing: isReducedSpacing ? 'none' : 'default',
|
|
82
|
+
onClick: handleOnItemActivated('outdent'),
|
|
83
|
+
iconBefore: jsx(OutdentIcon, {
|
|
84
|
+
label: ""
|
|
85
|
+
}),
|
|
86
|
+
disabled: true,
|
|
87
|
+
title: jsx(ToolTipContent, {
|
|
88
|
+
description: formatMessage(indentationMessages.outdent),
|
|
89
|
+
keymap: toggleOutdentKeymap
|
|
90
|
+
})
|
|
91
|
+
}), jsx("span", {
|
|
92
|
+
css: separatorStyles
|
|
93
|
+
}));
|
|
94
|
+
}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import { jsx } from '@emotion/react';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { useIntl } from 'react-intl-next';
|
|
5
|
+
import ExpandIcon from '@atlaskit/icon/glyph/chevron-down';
|
|
6
|
+
import BulletListIcon from '@atlaskit/icon/glyph/editor/bullet-list';
|
|
7
|
+
import { toggleBulletList as toggleBulletListKeymap, toggleOrderedList as toggleOrderedListKeymap, indent as toggleIndentKeymap, outdent as toggleOutdentKeymap, tooltip } from '../../../keymaps';
|
|
8
|
+
import DropdownMenu from '../../../ui/DropdownMenu';
|
|
9
|
+
import ToolbarButton from '../../../ui/ToolbarButton';
|
|
10
|
+
import { wrapperStyle, expandIconWrapperStyle, shortcutStyle, separatorStyles } from '../../../ui/styles';
|
|
11
|
+
import { messages as listMessages } from '../../list/messages';
|
|
12
|
+
import { messages as indentationMessages } from '../../indentation/messages';
|
|
13
|
+
export function ToolbarDropdown(props) {
|
|
14
|
+
const {
|
|
15
|
+
formatMessage
|
|
16
|
+
} = useIntl();
|
|
17
|
+
const {
|
|
18
|
+
disabled,
|
|
19
|
+
isReducedSpacing,
|
|
20
|
+
bulletListActive,
|
|
21
|
+
orderedListActive,
|
|
22
|
+
popupsMountPoint,
|
|
23
|
+
popupsBoundariesElement,
|
|
24
|
+
popupsScrollableElement,
|
|
25
|
+
onItemActivated
|
|
26
|
+
} = props;
|
|
27
|
+
const [isDropdownOpen, setIsDropdownOpen] = React.useState(false);
|
|
28
|
+
const labelLists = formatMessage(listMessages.lists);
|
|
29
|
+
|
|
30
|
+
const onOpenChange = attrs => {
|
|
31
|
+
setIsDropdownOpen(attrs.isDropdownOpen);
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
const handleTriggerClick = () => {
|
|
35
|
+
onOpenChange({
|
|
36
|
+
isDropdownOpen: !isDropdownOpen
|
|
37
|
+
});
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
const items = useItems(props);
|
|
41
|
+
|
|
42
|
+
const handleOnItemActivated = ({
|
|
43
|
+
item
|
|
44
|
+
}) => {
|
|
45
|
+
setIsDropdownOpen(false);
|
|
46
|
+
return onItemActivated({
|
|
47
|
+
editorView: props.editorView,
|
|
48
|
+
buttonName: item.value.name
|
|
49
|
+
});
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
return jsx("span", {
|
|
53
|
+
css: wrapperStyle
|
|
54
|
+
}, jsx(DropdownMenu, {
|
|
55
|
+
items: items,
|
|
56
|
+
onItemActivated: handleOnItemActivated,
|
|
57
|
+
mountTo: popupsMountPoint,
|
|
58
|
+
boundariesElement: popupsBoundariesElement,
|
|
59
|
+
scrollableElement: popupsScrollableElement,
|
|
60
|
+
isOpen: isDropdownOpen,
|
|
61
|
+
onOpenChange: onOpenChange,
|
|
62
|
+
fitHeight: 188,
|
|
63
|
+
fitWidth: 175,
|
|
64
|
+
shouldUseDefaultRole: true
|
|
65
|
+
}, jsx(ToolbarButton, {
|
|
66
|
+
spacing: isReducedSpacing ? 'none' : 'default',
|
|
67
|
+
selected: bulletListActive || orderedListActive,
|
|
68
|
+
"aria-expanded": isDropdownOpen,
|
|
69
|
+
"aria-haspopup": true,
|
|
70
|
+
"aria-label": labelLists,
|
|
71
|
+
disabled: disabled,
|
|
72
|
+
onClick: handleTriggerClick,
|
|
73
|
+
title: labelLists,
|
|
74
|
+
iconBefore: jsx("span", {
|
|
75
|
+
css: wrapperStyle
|
|
76
|
+
}, jsx(BulletListIcon, {
|
|
77
|
+
label: labelLists
|
|
78
|
+
}), jsx("span", {
|
|
79
|
+
css: expandIconWrapperStyle
|
|
80
|
+
}, jsx(ExpandIcon, {
|
|
81
|
+
label: ""
|
|
82
|
+
})))
|
|
83
|
+
})), jsx("span", {
|
|
84
|
+
css: separatorStyles
|
|
85
|
+
}));
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
function useItems(props) {
|
|
89
|
+
const {
|
|
90
|
+
formatMessage
|
|
91
|
+
} = useIntl();
|
|
92
|
+
const labelUnorderedList = formatMessage(listMessages.unorderedList);
|
|
93
|
+
const labelOrderedList = formatMessage(listMessages.orderedList);
|
|
94
|
+
let items = [{
|
|
95
|
+
key: 'unorderedList',
|
|
96
|
+
content: labelUnorderedList,
|
|
97
|
+
value: {
|
|
98
|
+
name: 'bullet_list'
|
|
99
|
+
},
|
|
100
|
+
isDisabled: props.bulletListDisabled,
|
|
101
|
+
isActive: Boolean(props.bulletListActive),
|
|
102
|
+
elemAfter: jsx("div", {
|
|
103
|
+
css: shortcutStyle
|
|
104
|
+
}, tooltip(toggleBulletListKeymap))
|
|
105
|
+
}, {
|
|
106
|
+
key: 'orderedList',
|
|
107
|
+
content: labelOrderedList,
|
|
108
|
+
value: {
|
|
109
|
+
name: 'ordered_list'
|
|
110
|
+
},
|
|
111
|
+
isDisabled: props.orderedListDisabled,
|
|
112
|
+
isActive: Boolean(props.orderedListActive),
|
|
113
|
+
elemAfter: jsx("div", {
|
|
114
|
+
css: shortcutStyle
|
|
115
|
+
}, tooltip(toggleOrderedListKeymap))
|
|
116
|
+
}];
|
|
117
|
+
|
|
118
|
+
if (props.showIndentationButtons) {
|
|
119
|
+
const labelIndent = formatMessage(indentationMessages.indent);
|
|
120
|
+
const labelOutdent = formatMessage(indentationMessages.outdent);
|
|
121
|
+
items.push({
|
|
122
|
+
key: 'indent',
|
|
123
|
+
content: labelIndent,
|
|
124
|
+
value: {
|
|
125
|
+
name: 'indent'
|
|
126
|
+
},
|
|
127
|
+
isDisabled: true,
|
|
128
|
+
isActive: false,
|
|
129
|
+
elemAfter: jsx("div", {
|
|
130
|
+
css: shortcutStyle
|
|
131
|
+
}, tooltip(toggleIndentKeymap))
|
|
132
|
+
}, {
|
|
133
|
+
key: 'outdent',
|
|
134
|
+
content: labelOutdent,
|
|
135
|
+
value: {
|
|
136
|
+
name: 'outdent'
|
|
137
|
+
},
|
|
138
|
+
isDisabled: true,
|
|
139
|
+
isActive: false,
|
|
140
|
+
elemAfter: jsx("div", {
|
|
141
|
+
css: shortcutStyle
|
|
142
|
+
}, tooltip(toggleOutdentKeymap))
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
return [{
|
|
147
|
+
items
|
|
148
|
+
}];
|
|
149
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
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
|
+
const {
|
|
8
|
+
disabled,
|
|
9
|
+
isSmall,
|
|
10
|
+
isReducedSpacing,
|
|
11
|
+
bulletListActive,
|
|
12
|
+
bulletListDisabled,
|
|
13
|
+
orderedListActive,
|
|
14
|
+
orderedListDisabled,
|
|
15
|
+
showIndentationButtons,
|
|
16
|
+
popupsMountPoint,
|
|
17
|
+
popupsBoundariesElement,
|
|
18
|
+
popupsScrollableElement
|
|
19
|
+
} = props;
|
|
20
|
+
|
|
21
|
+
if (isSmall) {
|
|
22
|
+
return jsx(ToolbarDropdown, {
|
|
23
|
+
editorView: props.editorView,
|
|
24
|
+
isReducedSpacing: isReducedSpacing,
|
|
25
|
+
popupsMountPoint: popupsMountPoint,
|
|
26
|
+
popupsBoundariesElement: popupsBoundariesElement,
|
|
27
|
+
popupsScrollableElement: popupsScrollableElement,
|
|
28
|
+
bulletListActive: bulletListActive,
|
|
29
|
+
bulletListDisabled: bulletListDisabled,
|
|
30
|
+
showIndentationButtons: showIndentationButtons,
|
|
31
|
+
orderedListActive: orderedListActive,
|
|
32
|
+
orderedListDisabled: orderedListDisabled,
|
|
33
|
+
disabled: disabled,
|
|
34
|
+
onItemActivated: onItemActivated
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
return jsx(Toolbar, {
|
|
39
|
+
editorView: props.editorView,
|
|
40
|
+
isReducedSpacing: isReducedSpacing,
|
|
41
|
+
bulletListActive: bulletListActive,
|
|
42
|
+
bulletListDisabled: bulletListDisabled,
|
|
43
|
+
showIndentationButtons: showIndentationButtons,
|
|
44
|
+
orderedListActive: orderedListActive,
|
|
45
|
+
orderedListDisabled: orderedListDisabled,
|
|
46
|
+
disabled: disabled,
|
|
47
|
+
onItemActivated: onItemActivated
|
|
48
|
+
});
|
|
49
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { toggleBulletList, toggleOrderedList } from '../../list/commands';
|
|
2
|
+
import { INPUT_METHOD } from '../../analytics';
|
|
3
|
+
export function onItemActivated({
|
|
4
|
+
buttonName,
|
|
5
|
+
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', handleKeyDown => handleKeyDown(editorView, new KeyboardEvent('keydown', {
|
|
18
|
+
bubbles: true,
|
|
19
|
+
cancelable: true,
|
|
20
|
+
key: 'Tab',
|
|
21
|
+
code: 'Tab'
|
|
22
|
+
})));
|
|
23
|
+
break;
|
|
24
|
+
|
|
25
|
+
case 'outdent':
|
|
26
|
+
editorView.someProp('handleKeyDown', handleKeyDown => handleKeyDown(editorView, new KeyboardEvent('keydown', {
|
|
27
|
+
bubbles: true,
|
|
28
|
+
cancelable: true,
|
|
29
|
+
shiftKey: true,
|
|
30
|
+
key: 'Tab',
|
|
31
|
+
code: 'Tab'
|
|
32
|
+
})));
|
|
33
|
+
break;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
import React, { useMemo, useEffect, useRef, useCallback, useLayoutEffect } from 'react';
|
|
3
|
-
import { jsx, css } from '@emotion/react';
|
|
4
|
-
|
|
5
|
-
import {
|
|
6
|
-
import { ICON_HEIGHT, itemTheme, ITEM_PADDING } from './TypeAheadListItem';
|
|
3
|
+
import { jsx, css } from '@emotion/react';
|
|
4
|
+
import { MenuGroup } from '@atlaskit/menu';
|
|
5
|
+
import { ICON_HEIGHT, ITEM_PADDING } from './TypeAheadListItem';
|
|
7
6
|
import { VariableSizeList as List } from 'react-window';
|
|
8
7
|
import { ResizeObserverProvider } from './hooks/use-resize-observer';
|
|
9
8
|
import { useDynamicListHeightCalculation } from './hooks/use-dynamic-list-height-calculation';
|
|
@@ -100,12 +99,11 @@ const TypeAheadListComponent = /*#__PURE__*/React.memo(({
|
|
|
100
99
|
|
|
101
100
|
const estimatedHeight = items.length * LIST_ITEM_ESTIMATED_HEIGHT;
|
|
102
101
|
const height = Math.min(typeof renderedListHeight === 'number' ? renderedListHeight : estimatedHeight, fitHeight);
|
|
103
|
-
return jsx(
|
|
102
|
+
return jsx(MenuGroup, {
|
|
104
103
|
role: "listbox",
|
|
105
104
|
"aria-live": "polite",
|
|
106
105
|
"aria-label": intl.formatMessage(typeAheadListMessages.typeAheadResultLabel),
|
|
107
|
-
"aria-relevant": "additions removals"
|
|
108
|
-
theme: itemTheme
|
|
106
|
+
"aria-relevant": "additions removals"
|
|
109
107
|
}, jsx(ResizeObserverProvider, null, jsx(UpdateListItemHeightContext.Provider, {
|
|
110
108
|
value: setListItemHeight
|
|
111
109
|
}, jsx(ListItemActionsContext.Provider, {
|
|
@@ -125,9 +123,12 @@ const TypeAheadListComponent = /*#__PURE__*/React.memo(({
|
|
|
125
123
|
height: height,
|
|
126
124
|
overscanCount: 3,
|
|
127
125
|
css: css`
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
126
|
+
button {
|
|
127
|
+
padding: 12px 12px 11px;
|
|
128
|
+
|
|
129
|
+
span:last-child span:last-child {
|
|
130
|
+
white-space: normal;
|
|
131
|
+
}
|
|
131
132
|
}
|
|
132
133
|
`
|
|
133
134
|
}, DynamicHeightListItem))))));
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
import React, { useCallback, useMemo, useRef, useLayoutEffect } from 'react';
|
|
3
3
|
import { css, jsx } from '@emotion/react';
|
|
4
|
-
import {
|
|
4
|
+
import { DN600, N200, N800 } from '@atlaskit/theme/colors';
|
|
5
5
|
import { themed } from '@atlaskit/theme/components';
|
|
6
|
-
import { borderRadius } from '@atlaskit/theme/constants';
|
|
7
|
-
|
|
8
|
-
import Item, { itemThemeNamespace } from '@atlaskit/item';
|
|
6
|
+
import { borderRadius } from '@atlaskit/theme/constants';
|
|
7
|
+
import { ButtonItem } from '@atlaskit/menu';
|
|
9
8
|
import { relativeFontSizeToBase16 } from '@atlaskit/editor-shared-styles';
|
|
10
9
|
import IconFallback from '../../quick-insert/assets/fallback';
|
|
11
10
|
import { shortcutStyle } from '../../../ui/styles';
|
|
@@ -14,41 +13,6 @@ import { token } from '@atlaskit/tokens';
|
|
|
14
13
|
export const ICON_HEIGHT = 40;
|
|
15
14
|
export const ICON_WIDTH = 40;
|
|
16
15
|
export const ITEM_PADDING = 12;
|
|
17
|
-
export const itemTheme = {
|
|
18
|
-
[itemThemeNamespace]: {
|
|
19
|
-
padding: {
|
|
20
|
-
default: {
|
|
21
|
-
bottom: ITEM_PADDING,
|
|
22
|
-
left: ITEM_PADDING,
|
|
23
|
-
right: ITEM_PADDING,
|
|
24
|
-
top: ITEM_PADDING
|
|
25
|
-
}
|
|
26
|
-
},
|
|
27
|
-
beforeItemSpacing: {
|
|
28
|
-
default: () => ITEM_PADDING
|
|
29
|
-
},
|
|
30
|
-
borderRadius: () => 0,
|
|
31
|
-
hover: {
|
|
32
|
-
// background: colors.transparent, transparent is not a thing
|
|
33
|
-
text: colorsText,
|
|
34
|
-
secondaryText: token('color.text.subtlest', N200)
|
|
35
|
-
},
|
|
36
|
-
selected: {
|
|
37
|
-
background: themed({
|
|
38
|
-
light: token('color.background.neutral.subtle.hovered', N20),
|
|
39
|
-
dark: token('color.background.neutral.subtle.hovered', DN70)
|
|
40
|
-
}),
|
|
41
|
-
text: themed({
|
|
42
|
-
light: token('color.text', N800),
|
|
43
|
-
dark: token('color.text', DN600)
|
|
44
|
-
}),
|
|
45
|
-
secondaryText: themed({
|
|
46
|
-
light: token('color.text.subtlest', N200),
|
|
47
|
-
dark: token('color.text.subtlest', DN300)
|
|
48
|
-
})
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
};
|
|
52
16
|
export const itemIcon = css`
|
|
53
17
|
width: ${ICON_WIDTH}px;
|
|
54
18
|
height: ${ICON_HEIGHT}px;
|
|
@@ -73,14 +37,20 @@ const itemBody = css`
|
|
|
73
37
|
justify-content: space-between;
|
|
74
38
|
line-height: 1.4;
|
|
75
39
|
`;
|
|
76
|
-
|
|
40
|
+
|
|
41
|
+
const itemText = theme => css`
|
|
77
42
|
white-space: initial;
|
|
43
|
+
color: ${themed({
|
|
44
|
+
light: token('color.text', N800),
|
|
45
|
+
dark: token('color.text', DN600)
|
|
46
|
+
})(theme)};
|
|
78
47
|
.item-description {
|
|
79
48
|
font-size: ${relativeFontSizeToBase16(11.67)};
|
|
80
49
|
color: ${token('color.text.subtlest', N200)};
|
|
81
50
|
margin-top: 4px;
|
|
82
51
|
}
|
|
83
52
|
`;
|
|
53
|
+
|
|
84
54
|
const itemAfter = css`
|
|
85
55
|
flex: 0 0 auto;
|
|
86
56
|
`;
|
|
@@ -162,26 +132,25 @@ export const TypeAheadListItem = ({
|
|
|
162
132
|
return customItem;
|
|
163
133
|
}
|
|
164
134
|
|
|
165
|
-
return jsx(
|
|
135
|
+
return jsx("span", {
|
|
136
|
+
onMouseMove: onMouseMove
|
|
137
|
+
}, jsx(ButtonItem, {
|
|
166
138
|
onClick: insertSelectedItem,
|
|
167
|
-
|
|
168
|
-
elemBefore: elementIcon,
|
|
139
|
+
iconBefore: elementIcon,
|
|
169
140
|
isSelected: isSelected,
|
|
170
141
|
"aria-selected": isSelected,
|
|
171
142
|
"aria-label": item.title,
|
|
172
143
|
role: "option",
|
|
173
|
-
|
|
144
|
+
description: item.description
|
|
174
145
|
}, jsx("div", {
|
|
175
146
|
css: itemBody
|
|
176
147
|
}, jsx("div", {
|
|
177
148
|
css: itemText
|
|
178
149
|
}, jsx("div", {
|
|
179
150
|
className: "item-title"
|
|
180
|
-
}, item.title),
|
|
181
|
-
className: "item-description"
|
|
182
|
-
}, item.description)), jsx("div", {
|
|
151
|
+
}, item.title)), jsx("div", {
|
|
183
152
|
css: itemAfter
|
|
184
153
|
}, item.keyshortcut && jsx("div", {
|
|
185
154
|
css: shortcutStyle
|
|
186
|
-
}, item.keyshortcut))));
|
|
155
|
+
}, item.keyshortcut)))));
|
|
187
156
|
};
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
|
|
3
3
|
/** @jsx jsx */
|
|
4
|
-
import
|
|
4
|
+
import { useState, useCallback } from 'react';
|
|
5
5
|
import { css, jsx } from '@emotion/react';
|
|
6
|
-
|
|
7
|
-
import Item, { itemThemeNamespace } from '@atlaskit/item'; // AFP-2532 TODO: Fix automatic suppressions below
|
|
6
|
+
import { Section, ButtonItem } from '@atlaskit/menu'; // AFP-2532 TODO: Fix automatic suppressions below
|
|
8
7
|
// eslint-disable-next-line @atlassian/tangerine/import/entry-points
|
|
9
8
|
|
|
10
9
|
import { borderRadius, gridSize } from '@atlaskit/theme';
|
|
@@ -94,26 +93,19 @@ const InsertMenu = ({
|
|
|
94
93
|
const ViewMore = ({
|
|
95
94
|
item
|
|
96
95
|
}) => {
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
if (e.which === ENTER_KEY || e.which === SPACE_KEY) {
|
|
102
|
-
// @ts-ignore We manually transformed "view more" to a quickInsert item
|
|
103
|
-
// action would always toggle the ModalElementBrowser
|
|
104
|
-
item.action();
|
|
105
|
-
}
|
|
106
|
-
}, [item]);
|
|
107
|
-
return jsx(Item, {
|
|
96
|
+
return jsx(Section, {
|
|
97
|
+
hasSeparator: true
|
|
98
|
+
}, jsx(ButtonItem, {
|
|
108
99
|
onClick: item.action,
|
|
109
|
-
|
|
100
|
+
iconBefore: jsx("div", {
|
|
110
101
|
css: itemBefore
|
|
111
102
|
}, item.icon()),
|
|
112
103
|
"aria-describedby": item.title,
|
|
113
104
|
"data-testid": "view-more-elements-item",
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
105
|
+
css: css`
|
|
106
|
+
padding: 0px 12px;
|
|
107
|
+
`
|
|
108
|
+
}, item.title));
|
|
117
109
|
};
|
|
118
110
|
|
|
119
111
|
const getSvgIconForItem = ({
|
|
@@ -173,18 +165,6 @@ const itemBefore = css`
|
|
|
173
165
|
align-items: center;
|
|
174
166
|
margin-right: ${gridSize() / 2}px;
|
|
175
167
|
`;
|
|
176
|
-
const PADDING_LEFT = 14;
|
|
177
|
-
const HEIGHT = 40;
|
|
178
|
-
const viewMoreItemTheme = {
|
|
179
|
-
[itemThemeNamespace]: {
|
|
180
|
-
padding: {
|
|
181
|
-
default: {
|
|
182
|
-
left: PADDING_LEFT
|
|
183
|
-
}
|
|
184
|
-
},
|
|
185
|
-
height: HEIGHT
|
|
186
|
-
}
|
|
187
|
-
};
|
|
188
168
|
const flexWrapperStyles = css`
|
|
189
169
|
display: flex;
|
|
190
170
|
flex: 1;
|