@atlaskit/editor-core 169.0.0 → 169.1.0
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 +26 -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/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/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/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 +19 -19
- 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
|
@@ -1,266 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
|
-
|
|
7
|
-
Object.defineProperty(exports, "__esModule", {
|
|
8
|
-
value: true
|
|
9
|
-
});
|
|
10
|
-
exports.default = void 0;
|
|
11
|
-
|
|
12
|
-
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
13
|
-
|
|
14
|
-
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
15
|
-
|
|
16
|
-
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
17
|
-
|
|
18
|
-
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
19
|
-
|
|
20
|
-
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
21
|
-
|
|
22
|
-
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
23
|
-
|
|
24
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
25
|
-
|
|
26
|
-
var _react = require("@emotion/react");
|
|
27
|
-
|
|
28
|
-
var _react2 = require("react");
|
|
29
|
-
|
|
30
|
-
var _reactIntlNext = require("react-intl-next");
|
|
31
|
-
|
|
32
|
-
var _bulletList = _interopRequireDefault(require("@atlaskit/icon/glyph/editor/bullet-list"));
|
|
33
|
-
|
|
34
|
-
var _numberList = _interopRequireDefault(require("@atlaskit/icon/glyph/editor/number-list"));
|
|
35
|
-
|
|
36
|
-
var _chevronDown = _interopRequireDefault(require("@atlaskit/icon/glyph/chevron-down"));
|
|
37
|
-
|
|
38
|
-
var _keymaps = require("../../../../keymaps");
|
|
39
|
-
|
|
40
|
-
var _ToolbarButton = _interopRequireWildcard(require("../../../../ui/ToolbarButton"));
|
|
41
|
-
|
|
42
|
-
var _DropdownMenu = _interopRequireDefault(require("../../../../ui/DropdownMenu"));
|
|
43
|
-
|
|
44
|
-
var _styles = require("../../../../ui/styles");
|
|
45
|
-
|
|
46
|
-
var _commands = require("../../commands");
|
|
47
|
-
|
|
48
|
-
var _messages = require("../../messages");
|
|
49
|
-
|
|
50
|
-
var _analytics = require("../../../analytics");
|
|
51
|
-
|
|
52
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
53
|
-
|
|
54
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
55
|
-
|
|
56
|
-
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
|
|
57
|
-
|
|
58
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
59
|
-
|
|
60
|
-
var ToolbarLists = /*#__PURE__*/function (_PureComponent) {
|
|
61
|
-
(0, _inherits2.default)(ToolbarLists, _PureComponent);
|
|
62
|
-
|
|
63
|
-
var _super = _createSuper(ToolbarLists);
|
|
64
|
-
|
|
65
|
-
function ToolbarLists() {
|
|
66
|
-
var _this;
|
|
67
|
-
|
|
68
|
-
(0, _classCallCheck2.default)(this, ToolbarLists);
|
|
69
|
-
|
|
70
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
71
|
-
args[_key] = arguments[_key];
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
_this = _super.call.apply(_super, [this].concat(args));
|
|
75
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "state", {
|
|
76
|
-
isDropdownOpen: false
|
|
77
|
-
});
|
|
78
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onOpenChange", function (attrs) {
|
|
79
|
-
_this.setState({
|
|
80
|
-
isDropdownOpen: attrs.isDropdownOpen
|
|
81
|
-
});
|
|
82
|
-
});
|
|
83
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleTriggerClick", function () {
|
|
84
|
-
_this.onOpenChange({
|
|
85
|
-
isDropdownOpen: !_this.state.isDropdownOpen
|
|
86
|
-
});
|
|
87
|
-
});
|
|
88
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "createItems", function () {
|
|
89
|
-
var _this$props = _this.props,
|
|
90
|
-
bulletListDisabled = _this$props.bulletListDisabled,
|
|
91
|
-
orderedListDisabled = _this$props.orderedListDisabled,
|
|
92
|
-
bulletListActive = _this$props.bulletListActive,
|
|
93
|
-
orderedListActive = _this$props.orderedListActive,
|
|
94
|
-
formatMessage = _this$props.intl.formatMessage;
|
|
95
|
-
var labelUnorderedList = formatMessage(_messages.messages.unorderedList);
|
|
96
|
-
var labelOrderedList = formatMessage(_messages.messages.orderedList);
|
|
97
|
-
var items = [{
|
|
98
|
-
key: 'unorderedList',
|
|
99
|
-
content: labelUnorderedList,
|
|
100
|
-
value: {
|
|
101
|
-
name: 'bullet_list'
|
|
102
|
-
},
|
|
103
|
-
isDisabled: bulletListDisabled,
|
|
104
|
-
isActive: Boolean(bulletListActive),
|
|
105
|
-
elemAfter: (0, _react.jsx)("div", {
|
|
106
|
-
css: _styles.shortcutStyle
|
|
107
|
-
}, (0, _keymaps.tooltip)(_keymaps.toggleBulletList))
|
|
108
|
-
}, {
|
|
109
|
-
key: 'orderedList',
|
|
110
|
-
content: labelOrderedList,
|
|
111
|
-
value: {
|
|
112
|
-
name: 'ordered_list'
|
|
113
|
-
},
|
|
114
|
-
isDisabled: orderedListDisabled,
|
|
115
|
-
isActive: Boolean(orderedListActive),
|
|
116
|
-
elemAfter: (0, _react.jsx)("div", {
|
|
117
|
-
css: _styles.shortcutStyle
|
|
118
|
-
}, (0, _keymaps.tooltip)(_keymaps.toggleOrderedList))
|
|
119
|
-
}];
|
|
120
|
-
return [{
|
|
121
|
-
items: items
|
|
122
|
-
}];
|
|
123
|
-
});
|
|
124
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleBulletListClick", function () {
|
|
125
|
-
if (!_this.props.bulletListDisabled) {
|
|
126
|
-
if ((0, _commands.toggleBulletList)(_this.props.editorView, _analytics.INPUT_METHOD.TOOLBAR)) {
|
|
127
|
-
return true;
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
return false;
|
|
132
|
-
});
|
|
133
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleOrderedListClick", function () {
|
|
134
|
-
if (!_this.props.orderedListDisabled) {
|
|
135
|
-
if ((0, _commands.toggleOrderedList)(_this.props.editorView, _analytics.INPUT_METHOD.TOOLBAR)) {
|
|
136
|
-
return true;
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
return false;
|
|
141
|
-
});
|
|
142
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onItemActivated", function (_ref) {
|
|
143
|
-
var item = _ref.item;
|
|
144
|
-
|
|
145
|
-
_this.setState({
|
|
146
|
-
isDropdownOpen: false
|
|
147
|
-
});
|
|
148
|
-
|
|
149
|
-
switch (item.value.name) {
|
|
150
|
-
case 'bullet_list':
|
|
151
|
-
_this.handleBulletListClick();
|
|
152
|
-
|
|
153
|
-
break;
|
|
154
|
-
|
|
155
|
-
case 'ordered_list':
|
|
156
|
-
_this.handleOrderedListClick();
|
|
157
|
-
|
|
158
|
-
break;
|
|
159
|
-
}
|
|
160
|
-
});
|
|
161
|
-
return _this;
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
(0, _createClass2.default)(ToolbarLists, [{
|
|
165
|
-
key: "render",
|
|
166
|
-
value: function render() {
|
|
167
|
-
var _this$props2 = this.props,
|
|
168
|
-
disabled = _this$props2.disabled,
|
|
169
|
-
isSmall = _this$props2.isSmall,
|
|
170
|
-
isReducedSpacing = _this$props2.isReducedSpacing,
|
|
171
|
-
isSeparator = _this$props2.isSeparator,
|
|
172
|
-
bulletListActive = _this$props2.bulletListActive,
|
|
173
|
-
bulletListDisabled = _this$props2.bulletListDisabled,
|
|
174
|
-
orderedListActive = _this$props2.orderedListActive,
|
|
175
|
-
orderedListDisabled = _this$props2.orderedListDisabled,
|
|
176
|
-
formatMessage = _this$props2.intl.formatMessage;
|
|
177
|
-
var isDropdownOpen = this.state.isDropdownOpen;
|
|
178
|
-
|
|
179
|
-
if (!isSmall) {
|
|
180
|
-
var labelUnorderedList = formatMessage(_messages.messages.unorderedList);
|
|
181
|
-
var labelOrderedList = formatMessage(_messages.messages.orderedList);
|
|
182
|
-
return (0, _react.jsx)("span", {
|
|
183
|
-
css: _styles.buttonGroupStyle
|
|
184
|
-
}, (0, _react.jsx)(_ToolbarButton.default, {
|
|
185
|
-
buttonId: _ToolbarButton.TOOLBAR_BUTTON.BULLET_LIST,
|
|
186
|
-
spacing: isReducedSpacing ? 'none' : 'default',
|
|
187
|
-
onClick: this.handleBulletListClick,
|
|
188
|
-
selected: bulletListActive,
|
|
189
|
-
"aria-pressed": bulletListActive,
|
|
190
|
-
"aria-label": labelUnorderedList,
|
|
191
|
-
disabled: bulletListDisabled || disabled,
|
|
192
|
-
title: (0, _react.jsx)(_keymaps.ToolTipContent, {
|
|
193
|
-
description: labelUnorderedList,
|
|
194
|
-
keymap: _keymaps.toggleBulletList
|
|
195
|
-
}),
|
|
196
|
-
iconBefore: (0, _react.jsx)(_bulletList.default, {
|
|
197
|
-
label: ""
|
|
198
|
-
})
|
|
199
|
-
}), (0, _react.jsx)(_ToolbarButton.default, {
|
|
200
|
-
buttonId: _ToolbarButton.TOOLBAR_BUTTON.ORDERED_LIST,
|
|
201
|
-
spacing: isReducedSpacing ? 'none' : 'default',
|
|
202
|
-
onClick: this.handleOrderedListClick,
|
|
203
|
-
selected: orderedListActive,
|
|
204
|
-
"aria-pressed": orderedListActive,
|
|
205
|
-
"aria-label": labelOrderedList,
|
|
206
|
-
disabled: orderedListDisabled || disabled,
|
|
207
|
-
title: (0, _react.jsx)(_keymaps.ToolTipContent, {
|
|
208
|
-
description: labelOrderedList,
|
|
209
|
-
keymap: _keymaps.toggleOrderedList
|
|
210
|
-
}),
|
|
211
|
-
iconBefore: (0, _react.jsx)(_numberList.default, {
|
|
212
|
-
label: ""
|
|
213
|
-
})
|
|
214
|
-
}), isSeparator && (0, _react.jsx)("span", {
|
|
215
|
-
css: _styles.separatorStyles
|
|
216
|
-
}));
|
|
217
|
-
} else {
|
|
218
|
-
var items = this.createItems();
|
|
219
|
-
var _this$props3 = this.props,
|
|
220
|
-
popupsMountPoint = _this$props3.popupsMountPoint,
|
|
221
|
-
popupsBoundariesElement = _this$props3.popupsBoundariesElement,
|
|
222
|
-
popupsScrollableElement = _this$props3.popupsScrollableElement;
|
|
223
|
-
var labelLists = formatMessage(_messages.messages.lists);
|
|
224
|
-
return (0, _react.jsx)("span", {
|
|
225
|
-
css: _styles.wrapperStyle
|
|
226
|
-
}, (0, _react.jsx)(_DropdownMenu.default, {
|
|
227
|
-
items: items,
|
|
228
|
-
onItemActivated: this.onItemActivated,
|
|
229
|
-
mountTo: popupsMountPoint,
|
|
230
|
-
boundariesElement: popupsBoundariesElement,
|
|
231
|
-
scrollableElement: popupsScrollableElement,
|
|
232
|
-
isOpen: isDropdownOpen,
|
|
233
|
-
onOpenChange: this.onOpenChange,
|
|
234
|
-
fitHeight: 188,
|
|
235
|
-
fitWidth: 175,
|
|
236
|
-
shouldUseDefaultRole: true
|
|
237
|
-
}, (0, _react.jsx)(_ToolbarButton.default, {
|
|
238
|
-
spacing: isReducedSpacing ? 'none' : 'default',
|
|
239
|
-
selected: bulletListActive || orderedListActive,
|
|
240
|
-
"aria-expanded": isDropdownOpen,
|
|
241
|
-
"aria-haspopup": true,
|
|
242
|
-
"aria-label": labelLists,
|
|
243
|
-
disabled: disabled,
|
|
244
|
-
onClick: this.handleTriggerClick,
|
|
245
|
-
title: labelLists,
|
|
246
|
-
iconBefore: (0, _react.jsx)("span", {
|
|
247
|
-
css: _styles.wrapperStyle
|
|
248
|
-
}, (0, _react.jsx)(_bulletList.default, {
|
|
249
|
-
label: labelLists
|
|
250
|
-
}), (0, _react.jsx)("span", {
|
|
251
|
-
css: _styles.expandIconWrapperStyle
|
|
252
|
-
}, (0, _react.jsx)(_chevronDown.default, {
|
|
253
|
-
label: ""
|
|
254
|
-
})))
|
|
255
|
-
})), isSeparator && (0, _react.jsx)("span", {
|
|
256
|
-
css: _styles.separatorStyles
|
|
257
|
-
}));
|
|
258
|
-
}
|
|
259
|
-
}
|
|
260
|
-
}]);
|
|
261
|
-
return ToolbarLists;
|
|
262
|
-
}(_react2.PureComponent);
|
|
263
|
-
|
|
264
|
-
var _default = (0, _reactIntlNext.injectIntl)(ToolbarLists);
|
|
265
|
-
|
|
266
|
-
exports.default = _default;
|
|
@@ -1,220 +0,0 @@
|
|
|
1
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
-
|
|
3
|
-
/** @jsx jsx */
|
|
4
|
-
import { jsx } from '@emotion/react';
|
|
5
|
-
import { PureComponent } from 'react';
|
|
6
|
-
import { injectIntl } from 'react-intl-next';
|
|
7
|
-
import BulletListIcon from '@atlaskit/icon/glyph/editor/bullet-list';
|
|
8
|
-
import NumberListIcon from '@atlaskit/icon/glyph/editor/number-list';
|
|
9
|
-
import ExpandIcon from '@atlaskit/icon/glyph/chevron-down';
|
|
10
|
-
import { toggleBulletList as toggleBulletListKeymap, toggleOrderedList as toggleOrderedListKeymap, tooltip, ToolTipContent } from '../../../../keymaps';
|
|
11
|
-
import ToolbarButton, { TOOLBAR_BUTTON } from '../../../../ui/ToolbarButton';
|
|
12
|
-
import DropdownMenu from '../../../../ui/DropdownMenu';
|
|
13
|
-
import { buttonGroupStyle, separatorStyles, wrapperStyle, expandIconWrapperStyle, shortcutStyle } from '../../../../ui/styles';
|
|
14
|
-
import { toggleBulletList, toggleOrderedList } from '../../commands';
|
|
15
|
-
import { messages } from '../../messages';
|
|
16
|
-
import { INPUT_METHOD } from '../../../analytics';
|
|
17
|
-
|
|
18
|
-
class ToolbarLists extends PureComponent {
|
|
19
|
-
constructor(...args) {
|
|
20
|
-
super(...args);
|
|
21
|
-
|
|
22
|
-
_defineProperty(this, "state", {
|
|
23
|
-
isDropdownOpen: false
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
_defineProperty(this, "onOpenChange", attrs => {
|
|
27
|
-
this.setState({
|
|
28
|
-
isDropdownOpen: attrs.isDropdownOpen
|
|
29
|
-
});
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
_defineProperty(this, "handleTriggerClick", () => {
|
|
33
|
-
this.onOpenChange({
|
|
34
|
-
isDropdownOpen: !this.state.isDropdownOpen
|
|
35
|
-
});
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
_defineProperty(this, "createItems", () => {
|
|
39
|
-
const {
|
|
40
|
-
bulletListDisabled,
|
|
41
|
-
orderedListDisabled,
|
|
42
|
-
bulletListActive,
|
|
43
|
-
orderedListActive,
|
|
44
|
-
intl: {
|
|
45
|
-
formatMessage
|
|
46
|
-
}
|
|
47
|
-
} = this.props;
|
|
48
|
-
const labelUnorderedList = formatMessage(messages.unorderedList);
|
|
49
|
-
const labelOrderedList = formatMessage(messages.orderedList);
|
|
50
|
-
let items = [{
|
|
51
|
-
key: 'unorderedList',
|
|
52
|
-
content: labelUnorderedList,
|
|
53
|
-
value: {
|
|
54
|
-
name: 'bullet_list'
|
|
55
|
-
},
|
|
56
|
-
isDisabled: bulletListDisabled,
|
|
57
|
-
isActive: Boolean(bulletListActive),
|
|
58
|
-
elemAfter: jsx("div", {
|
|
59
|
-
css: shortcutStyle
|
|
60
|
-
}, tooltip(toggleBulletListKeymap))
|
|
61
|
-
}, {
|
|
62
|
-
key: 'orderedList',
|
|
63
|
-
content: labelOrderedList,
|
|
64
|
-
value: {
|
|
65
|
-
name: 'ordered_list'
|
|
66
|
-
},
|
|
67
|
-
isDisabled: orderedListDisabled,
|
|
68
|
-
isActive: Boolean(orderedListActive),
|
|
69
|
-
elemAfter: jsx("div", {
|
|
70
|
-
css: shortcutStyle
|
|
71
|
-
}, tooltip(toggleOrderedListKeymap))
|
|
72
|
-
}];
|
|
73
|
-
return [{
|
|
74
|
-
items
|
|
75
|
-
}];
|
|
76
|
-
});
|
|
77
|
-
|
|
78
|
-
_defineProperty(this, "handleBulletListClick", () => {
|
|
79
|
-
if (!this.props.bulletListDisabled) {
|
|
80
|
-
if (toggleBulletList(this.props.editorView, INPUT_METHOD.TOOLBAR)) {
|
|
81
|
-
return true;
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
return false;
|
|
86
|
-
});
|
|
87
|
-
|
|
88
|
-
_defineProperty(this, "handleOrderedListClick", () => {
|
|
89
|
-
if (!this.props.orderedListDisabled) {
|
|
90
|
-
if (toggleOrderedList(this.props.editorView, INPUT_METHOD.TOOLBAR)) {
|
|
91
|
-
return true;
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
return false;
|
|
96
|
-
});
|
|
97
|
-
|
|
98
|
-
_defineProperty(this, "onItemActivated", ({
|
|
99
|
-
item
|
|
100
|
-
}) => {
|
|
101
|
-
this.setState({
|
|
102
|
-
isDropdownOpen: false
|
|
103
|
-
});
|
|
104
|
-
|
|
105
|
-
switch (item.value.name) {
|
|
106
|
-
case 'bullet_list':
|
|
107
|
-
this.handleBulletListClick();
|
|
108
|
-
break;
|
|
109
|
-
|
|
110
|
-
case 'ordered_list':
|
|
111
|
-
this.handleOrderedListClick();
|
|
112
|
-
break;
|
|
113
|
-
}
|
|
114
|
-
});
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
render() {
|
|
118
|
-
const {
|
|
119
|
-
disabled,
|
|
120
|
-
isSmall,
|
|
121
|
-
isReducedSpacing,
|
|
122
|
-
isSeparator,
|
|
123
|
-
bulletListActive,
|
|
124
|
-
bulletListDisabled,
|
|
125
|
-
orderedListActive,
|
|
126
|
-
orderedListDisabled,
|
|
127
|
-
intl: {
|
|
128
|
-
formatMessage
|
|
129
|
-
}
|
|
130
|
-
} = this.props;
|
|
131
|
-
const {
|
|
132
|
-
isDropdownOpen
|
|
133
|
-
} = this.state;
|
|
134
|
-
|
|
135
|
-
if (!isSmall) {
|
|
136
|
-
const labelUnorderedList = formatMessage(messages.unorderedList);
|
|
137
|
-
const labelOrderedList = formatMessage(messages.orderedList);
|
|
138
|
-
return jsx("span", {
|
|
139
|
-
css: buttonGroupStyle
|
|
140
|
-
}, jsx(ToolbarButton, {
|
|
141
|
-
buttonId: TOOLBAR_BUTTON.BULLET_LIST,
|
|
142
|
-
spacing: isReducedSpacing ? 'none' : 'default',
|
|
143
|
-
onClick: this.handleBulletListClick,
|
|
144
|
-
selected: bulletListActive,
|
|
145
|
-
"aria-pressed": bulletListActive,
|
|
146
|
-
"aria-label": labelUnorderedList,
|
|
147
|
-
disabled: bulletListDisabled || disabled,
|
|
148
|
-
title: jsx(ToolTipContent, {
|
|
149
|
-
description: labelUnorderedList,
|
|
150
|
-
keymap: toggleBulletListKeymap
|
|
151
|
-
}),
|
|
152
|
-
iconBefore: jsx(BulletListIcon, {
|
|
153
|
-
label: ""
|
|
154
|
-
})
|
|
155
|
-
}), jsx(ToolbarButton, {
|
|
156
|
-
buttonId: TOOLBAR_BUTTON.ORDERED_LIST,
|
|
157
|
-
spacing: isReducedSpacing ? 'none' : 'default',
|
|
158
|
-
onClick: this.handleOrderedListClick,
|
|
159
|
-
selected: orderedListActive,
|
|
160
|
-
"aria-pressed": orderedListActive,
|
|
161
|
-
"aria-label": labelOrderedList,
|
|
162
|
-
disabled: orderedListDisabled || disabled,
|
|
163
|
-
title: jsx(ToolTipContent, {
|
|
164
|
-
description: labelOrderedList,
|
|
165
|
-
keymap: toggleOrderedListKeymap
|
|
166
|
-
}),
|
|
167
|
-
iconBefore: jsx(NumberListIcon, {
|
|
168
|
-
label: ""
|
|
169
|
-
})
|
|
170
|
-
}), isSeparator && jsx("span", {
|
|
171
|
-
css: separatorStyles
|
|
172
|
-
}));
|
|
173
|
-
} else {
|
|
174
|
-
const items = this.createItems();
|
|
175
|
-
const {
|
|
176
|
-
popupsMountPoint,
|
|
177
|
-
popupsBoundariesElement,
|
|
178
|
-
popupsScrollableElement
|
|
179
|
-
} = this.props;
|
|
180
|
-
const labelLists = formatMessage(messages.lists);
|
|
181
|
-
return jsx("span", {
|
|
182
|
-
css: wrapperStyle
|
|
183
|
-
}, jsx(DropdownMenu, {
|
|
184
|
-
items: items,
|
|
185
|
-
onItemActivated: this.onItemActivated,
|
|
186
|
-
mountTo: popupsMountPoint,
|
|
187
|
-
boundariesElement: popupsBoundariesElement,
|
|
188
|
-
scrollableElement: popupsScrollableElement,
|
|
189
|
-
isOpen: isDropdownOpen,
|
|
190
|
-
onOpenChange: this.onOpenChange,
|
|
191
|
-
fitHeight: 188,
|
|
192
|
-
fitWidth: 175,
|
|
193
|
-
shouldUseDefaultRole: true
|
|
194
|
-
}, jsx(ToolbarButton, {
|
|
195
|
-
spacing: isReducedSpacing ? 'none' : 'default',
|
|
196
|
-
selected: bulletListActive || orderedListActive,
|
|
197
|
-
"aria-expanded": isDropdownOpen,
|
|
198
|
-
"aria-haspopup": true,
|
|
199
|
-
"aria-label": labelLists,
|
|
200
|
-
disabled: disabled,
|
|
201
|
-
onClick: this.handleTriggerClick,
|
|
202
|
-
title: labelLists,
|
|
203
|
-
iconBefore: jsx("span", {
|
|
204
|
-
css: wrapperStyle
|
|
205
|
-
}, jsx(BulletListIcon, {
|
|
206
|
-
label: labelLists
|
|
207
|
-
}), jsx("span", {
|
|
208
|
-
css: expandIconWrapperStyle
|
|
209
|
-
}, jsx(ExpandIcon, {
|
|
210
|
-
label: ""
|
|
211
|
-
})))
|
|
212
|
-
})), isSeparator && jsx("span", {
|
|
213
|
-
css: separatorStyles
|
|
214
|
-
}));
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
export default injectIntl(ToolbarLists);
|