@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.
Files changed (134) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/dist/cjs/create-editor/create-plugins-list.js +7 -0
  3. package/dist/cjs/plugins/analytics/types/toolbar-button.js +2 -0
  4. package/dist/cjs/plugins/breakout/index.js +7 -0
  5. package/dist/cjs/plugins/breakout/ui/LayoutButton.js +3 -1
  6. package/dist/cjs/plugins/card/pm-plugins/util/resolve.js +6 -1
  7. package/dist/cjs/plugins/card/styles.js +4 -2
  8. package/dist/cjs/plugins/card/toolbar.js +6 -1
  9. package/dist/cjs/plugins/code-block/styles.js +17 -41
  10. package/dist/cjs/plugins/code-block/ui/class-names.js +5 -2
  11. package/dist/cjs/plugins/copy-button/commands.js +85 -0
  12. package/dist/cjs/plugins/copy-button/index.js +27 -0
  13. package/dist/cjs/plugins/copy-button/pm-plugins/main.js +38 -0
  14. package/dist/cjs/plugins/copy-button/pm-plugins/plugin-key.js +11 -0
  15. package/dist/cjs/plugins/copy-button/utils.js +51 -0
  16. package/dist/cjs/plugins/feature-flags-context/feature-flags-from-props.js +4 -2
  17. package/dist/cjs/plugins/indentation/messages.js +23 -0
  18. package/dist/cjs/plugins/index.js +16 -0
  19. package/dist/cjs/plugins/list/index.js +0 -43
  20. package/dist/cjs/plugins/panel/toolbar.js +10 -2
  21. package/dist/cjs/plugins/table/commands/hover.js +2 -2
  22. package/dist/cjs/plugins/table/toolbar.js +5 -1
  23. package/dist/cjs/plugins/table/utils/decoration.js +5 -1
  24. package/dist/cjs/plugins/toolbar-lists-indentation/index.js +65 -0
  25. package/dist/cjs/plugins/toolbar-lists-indentation/types.js +5 -0
  26. package/dist/cjs/plugins/toolbar-lists-indentation/ui/Toolbar.js +122 -0
  27. package/dist/cjs/plugins/toolbar-lists-indentation/ui/ToolbarDropdown.js +173 -0
  28. package/dist/cjs/plugins/toolbar-lists-indentation/ui/index.js +58 -0
  29. package/dist/cjs/plugins/toolbar-lists-indentation/ui/onItemActivated.js +48 -0
  30. package/dist/cjs/plugins/type-ahead/ui/TypeAheadList.js +4 -5
  31. package/dist/cjs/plugins/type-ahead/ui/TypeAheadListItem.js +17 -51
  32. package/dist/cjs/ui/ElementBrowser/InsertMenu.js +12 -39
  33. package/dist/cjs/ui/ElementBrowser/components/ElementList/ElementList.js +31 -87
  34. package/dist/cjs/utils/clipboard.js +67 -2
  35. package/dist/cjs/version-wrapper.js +1 -1
  36. package/dist/cjs/version.json +1 -1
  37. package/dist/es2019/create-editor/create-plugins-list.js +8 -1
  38. package/dist/es2019/plugins/analytics/types/toolbar-button.js +2 -0
  39. package/dist/es2019/plugins/breakout/index.js +7 -0
  40. package/dist/es2019/plugins/breakout/ui/LayoutButton.js +3 -1
  41. package/dist/es2019/plugins/card/pm-plugins/util/resolve.js +6 -1
  42. package/dist/es2019/plugins/card/styles.js +5 -0
  43. package/dist/es2019/plugins/card/toolbar.js +5 -1
  44. package/dist/es2019/plugins/code-block/styles.js +18 -95
  45. package/dist/es2019/plugins/code-block/ui/class-names.js +3 -2
  46. package/dist/es2019/plugins/copy-button/commands.js +64 -0
  47. package/dist/es2019/plugins/copy-button/index.js +15 -0
  48. package/dist/es2019/plugins/copy-button/pm-plugins/main.js +28 -0
  49. package/dist/es2019/plugins/copy-button/pm-plugins/plugin-key.js +2 -0
  50. package/dist/es2019/plugins/copy-button/utils.js +29 -0
  51. package/dist/es2019/plugins/feature-flags-context/feature-flags-from-props.js +4 -2
  52. package/dist/es2019/plugins/indentation/messages.js +14 -0
  53. package/dist/es2019/plugins/index.js +3 -1
  54. package/dist/es2019/plugins/list/index.js +1 -44
  55. package/dist/es2019/plugins/panel/toolbar.js +9 -2
  56. package/dist/es2019/plugins/table/commands/hover.js +2 -2
  57. package/dist/es2019/plugins/table/toolbar.js +5 -2
  58. package/dist/es2019/plugins/table/utils/decoration.js +5 -1
  59. package/dist/es2019/plugins/toolbar-lists-indentation/index.js +53 -0
  60. package/dist/es2019/plugins/toolbar-lists-indentation/types.js +1 -0
  61. package/dist/es2019/plugins/toolbar-lists-indentation/ui/Toolbar.js +94 -0
  62. package/dist/es2019/plugins/toolbar-lists-indentation/ui/ToolbarDropdown.js +149 -0
  63. package/dist/es2019/plugins/toolbar-lists-indentation/ui/index.js +49 -0
  64. package/dist/es2019/plugins/toolbar-lists-indentation/ui/onItemActivated.js +35 -0
  65. package/dist/es2019/plugins/type-ahead/ui/TypeAheadList.js +11 -10
  66. package/dist/es2019/plugins/type-ahead/ui/TypeAheadListItem.js +17 -48
  67. package/dist/es2019/ui/ElementBrowser/InsertMenu.js +10 -30
  68. package/dist/es2019/ui/ElementBrowser/components/ElementList/ElementList.js +34 -93
  69. package/dist/es2019/utils/clipboard.js +26 -0
  70. package/dist/es2019/version-wrapper.js +1 -1
  71. package/dist/es2019/version.json +1 -1
  72. package/dist/esm/create-editor/create-plugins-list.js +8 -1
  73. package/dist/esm/plugins/analytics/types/toolbar-button.js +2 -0
  74. package/dist/esm/plugins/breakout/index.js +7 -0
  75. package/dist/esm/plugins/breakout/ui/LayoutButton.js +3 -1
  76. package/dist/esm/plugins/card/pm-plugins/util/resolve.js +6 -1
  77. package/dist/esm/plugins/card/styles.js +2 -1
  78. package/dist/esm/plugins/card/toolbar.js +5 -1
  79. package/dist/esm/plugins/code-block/styles.js +16 -35
  80. package/dist/esm/plugins/code-block/ui/class-names.js +3 -2
  81. package/dist/esm/plugins/copy-button/commands.js +66 -0
  82. package/dist/esm/plugins/copy-button/index.js +17 -0
  83. package/dist/esm/plugins/copy-button/pm-plugins/main.js +26 -0
  84. package/dist/esm/plugins/copy-button/pm-plugins/plugin-key.js +2 -0
  85. package/dist/esm/plugins/copy-button/utils.js +31 -0
  86. package/dist/esm/plugins/feature-flags-context/feature-flags-from-props.js +4 -2
  87. package/dist/esm/plugins/indentation/messages.js +14 -0
  88. package/dist/esm/plugins/index.js +3 -1
  89. package/dist/esm/plugins/list/index.js +1 -41
  90. package/dist/esm/plugins/panel/toolbar.js +9 -2
  91. package/dist/esm/plugins/table/commands/hover.js +2 -2
  92. package/dist/esm/plugins/table/toolbar.js +5 -2
  93. package/dist/esm/plugins/table/utils/decoration.js +5 -1
  94. package/dist/esm/plugins/toolbar-lists-indentation/index.js +51 -0
  95. package/dist/esm/plugins/toolbar-lists-indentation/types.js +1 -0
  96. package/dist/esm/plugins/toolbar-lists-indentation/ui/Toolbar.js +96 -0
  97. package/dist/esm/plugins/toolbar-lists-indentation/ui/ToolbarDropdown.js +153 -0
  98. package/dist/esm/plugins/toolbar-lists-indentation/ui/index.js +47 -0
  99. package/dist/esm/plugins/toolbar-lists-indentation/ui/onItemActivated.js +39 -0
  100. package/dist/esm/plugins/type-ahead/ui/TypeAheadList.js +6 -8
  101. package/dist/esm/plugins/type-ahead/ui/TypeAheadListItem.js +18 -51
  102. package/dist/esm/ui/ElementBrowser/InsertMenu.js +12 -35
  103. package/dist/esm/ui/ElementBrowser/components/ElementList/ElementList.js +31 -89
  104. package/dist/esm/utils/clipboard.js +55 -0
  105. package/dist/esm/version-wrapper.js +1 -1
  106. package/dist/esm/version.json +1 -1
  107. package/dist/types/plugins/analytics/types/toolbar-button.d.ts +3 -1
  108. package/dist/types/plugins/card/styles.d.ts +1 -0
  109. package/dist/types/plugins/copy-button/commands.d.ts +4 -0
  110. package/dist/types/plugins/copy-button/index.d.ts +3 -0
  111. package/dist/types/plugins/copy-button/pm-plugins/main.d.ts +3 -0
  112. package/dist/types/plugins/copy-button/pm-plugins/plugin-key.d.ts +2 -0
  113. package/dist/types/plugins/copy-button/utils.d.ts +7 -0
  114. package/dist/types/plugins/indentation/messages.d.ts +12 -0
  115. package/dist/types/plugins/index.d.ts +2 -0
  116. package/dist/types/plugins/panel/toolbar.d.ts +1 -1
  117. package/dist/types/plugins/table/commands/hover.d.ts +1 -1
  118. package/dist/types/plugins/table/utils/decoration.d.ts +1 -1
  119. package/dist/types/plugins/text-formatting/utils.d.ts +1 -1
  120. package/dist/types/plugins/toolbar-lists-indentation/index.d.ts +5 -0
  121. package/dist/types/plugins/toolbar-lists-indentation/types.d.ts +16 -0
  122. package/dist/types/plugins/toolbar-lists-indentation/ui/Toolbar.d.ts +4 -0
  123. package/dist/types/plugins/toolbar-lists-indentation/ui/ToolbarDropdown.d.ts +9 -0
  124. package/dist/types/plugins/{list/ui/ToolbarLists → toolbar-lists-indentation/ui}/index.d.ts +4 -10
  125. package/dist/types/plugins/toolbar-lists-indentation/ui/onItemActivated.d.ts +6 -0
  126. package/dist/types/plugins/type-ahead/ui/TypeAheadListItem.d.ts +0 -25
  127. package/dist/types/types/feature-flags.d.ts +18 -0
  128. package/dist/types/ui/ElementBrowser/components/ElementList/ElementList.d.ts +11 -0
  129. package/dist/types/utils/clipboard.d.ts +1 -0
  130. package/package.json +19 -19
  131. package/report.api.md +5373 -1324
  132. package/dist/cjs/plugins/list/ui/ToolbarLists/index.js +0 -266
  133. package/dist/es2019/plugins/list/ui/ToolbarLists/index.js +0 -220
  134. package/dist/esm/plugins/list/ui/ToolbarLists/index.js +0 -241
@@ -1,241 +0,0 @@
1
- import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
2
- import _createClass from "@babel/runtime/helpers/createClass";
3
- import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
4
- import _inherits from "@babel/runtime/helpers/inherits";
5
- import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
6
- import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
7
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
8
-
9
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
10
-
11
- 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; } }
12
-
13
- /** @jsx jsx */
14
- import { jsx } from '@emotion/react';
15
- import { PureComponent } from 'react';
16
- import { injectIntl } from 'react-intl-next';
17
- import BulletListIcon from '@atlaskit/icon/glyph/editor/bullet-list';
18
- import NumberListIcon from '@atlaskit/icon/glyph/editor/number-list';
19
- import ExpandIcon from '@atlaskit/icon/glyph/chevron-down';
20
- import { toggleBulletList as toggleBulletListKeymap, toggleOrderedList as toggleOrderedListKeymap, tooltip, ToolTipContent } from '../../../../keymaps';
21
- import ToolbarButton, { TOOLBAR_BUTTON } from '../../../../ui/ToolbarButton';
22
- import DropdownMenu from '../../../../ui/DropdownMenu';
23
- import { buttonGroupStyle, separatorStyles, wrapperStyle, expandIconWrapperStyle, shortcutStyle } from '../../../../ui/styles';
24
- import { toggleBulletList, toggleOrderedList } from '../../commands';
25
- import { messages } from '../../messages';
26
- import { INPUT_METHOD } from '../../../analytics';
27
-
28
- var ToolbarLists = /*#__PURE__*/function (_PureComponent) {
29
- _inherits(ToolbarLists, _PureComponent);
30
-
31
- var _super = _createSuper(ToolbarLists);
32
-
33
- function ToolbarLists() {
34
- var _this;
35
-
36
- _classCallCheck(this, ToolbarLists);
37
-
38
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
39
- args[_key] = arguments[_key];
40
- }
41
-
42
- _this = _super.call.apply(_super, [this].concat(args));
43
-
44
- _defineProperty(_assertThisInitialized(_this), "state", {
45
- isDropdownOpen: false
46
- });
47
-
48
- _defineProperty(_assertThisInitialized(_this), "onOpenChange", function (attrs) {
49
- _this.setState({
50
- isDropdownOpen: attrs.isDropdownOpen
51
- });
52
- });
53
-
54
- _defineProperty(_assertThisInitialized(_this), "handleTriggerClick", function () {
55
- _this.onOpenChange({
56
- isDropdownOpen: !_this.state.isDropdownOpen
57
- });
58
- });
59
-
60
- _defineProperty(_assertThisInitialized(_this), "createItems", function () {
61
- var _this$props = _this.props,
62
- bulletListDisabled = _this$props.bulletListDisabled,
63
- orderedListDisabled = _this$props.orderedListDisabled,
64
- bulletListActive = _this$props.bulletListActive,
65
- orderedListActive = _this$props.orderedListActive,
66
- formatMessage = _this$props.intl.formatMessage;
67
- var labelUnorderedList = formatMessage(messages.unorderedList);
68
- var labelOrderedList = formatMessage(messages.orderedList);
69
- var items = [{
70
- key: 'unorderedList',
71
- content: labelUnorderedList,
72
- value: {
73
- name: 'bullet_list'
74
- },
75
- isDisabled: bulletListDisabled,
76
- isActive: Boolean(bulletListActive),
77
- elemAfter: jsx("div", {
78
- css: shortcutStyle
79
- }, tooltip(toggleBulletListKeymap))
80
- }, {
81
- key: 'orderedList',
82
- content: labelOrderedList,
83
- value: {
84
- name: 'ordered_list'
85
- },
86
- isDisabled: orderedListDisabled,
87
- isActive: Boolean(orderedListActive),
88
- elemAfter: jsx("div", {
89
- css: shortcutStyle
90
- }, tooltip(toggleOrderedListKeymap))
91
- }];
92
- return [{
93
- items: items
94
- }];
95
- });
96
-
97
- _defineProperty(_assertThisInitialized(_this), "handleBulletListClick", function () {
98
- if (!_this.props.bulletListDisabled) {
99
- if (toggleBulletList(_this.props.editorView, INPUT_METHOD.TOOLBAR)) {
100
- return true;
101
- }
102
- }
103
-
104
- return false;
105
- });
106
-
107
- _defineProperty(_assertThisInitialized(_this), "handleOrderedListClick", function () {
108
- if (!_this.props.orderedListDisabled) {
109
- if (toggleOrderedList(_this.props.editorView, INPUT_METHOD.TOOLBAR)) {
110
- return true;
111
- }
112
- }
113
-
114
- return false;
115
- });
116
-
117
- _defineProperty(_assertThisInitialized(_this), "onItemActivated", function (_ref) {
118
- var item = _ref.item;
119
-
120
- _this.setState({
121
- isDropdownOpen: false
122
- });
123
-
124
- switch (item.value.name) {
125
- case 'bullet_list':
126
- _this.handleBulletListClick();
127
-
128
- break;
129
-
130
- case 'ordered_list':
131
- _this.handleOrderedListClick();
132
-
133
- break;
134
- }
135
- });
136
-
137
- return _this;
138
- }
139
-
140
- _createClass(ToolbarLists, [{
141
- key: "render",
142
- value: function render() {
143
- var _this$props2 = this.props,
144
- disabled = _this$props2.disabled,
145
- isSmall = _this$props2.isSmall,
146
- isReducedSpacing = _this$props2.isReducedSpacing,
147
- isSeparator = _this$props2.isSeparator,
148
- bulletListActive = _this$props2.bulletListActive,
149
- bulletListDisabled = _this$props2.bulletListDisabled,
150
- orderedListActive = _this$props2.orderedListActive,
151
- orderedListDisabled = _this$props2.orderedListDisabled,
152
- formatMessage = _this$props2.intl.formatMessage;
153
- var isDropdownOpen = this.state.isDropdownOpen;
154
-
155
- if (!isSmall) {
156
- var labelUnorderedList = formatMessage(messages.unorderedList);
157
- var labelOrderedList = formatMessage(messages.orderedList);
158
- return jsx("span", {
159
- css: buttonGroupStyle
160
- }, jsx(ToolbarButton, {
161
- buttonId: TOOLBAR_BUTTON.BULLET_LIST,
162
- spacing: isReducedSpacing ? 'none' : 'default',
163
- onClick: this.handleBulletListClick,
164
- selected: bulletListActive,
165
- "aria-pressed": bulletListActive,
166
- "aria-label": labelUnorderedList,
167
- disabled: bulletListDisabled || disabled,
168
- title: jsx(ToolTipContent, {
169
- description: labelUnorderedList,
170
- keymap: toggleBulletListKeymap
171
- }),
172
- iconBefore: jsx(BulletListIcon, {
173
- label: ""
174
- })
175
- }), jsx(ToolbarButton, {
176
- buttonId: TOOLBAR_BUTTON.ORDERED_LIST,
177
- spacing: isReducedSpacing ? 'none' : 'default',
178
- onClick: this.handleOrderedListClick,
179
- selected: orderedListActive,
180
- "aria-pressed": orderedListActive,
181
- "aria-label": labelOrderedList,
182
- disabled: orderedListDisabled || disabled,
183
- title: jsx(ToolTipContent, {
184
- description: labelOrderedList,
185
- keymap: toggleOrderedListKeymap
186
- }),
187
- iconBefore: jsx(NumberListIcon, {
188
- label: ""
189
- })
190
- }), isSeparator && jsx("span", {
191
- css: separatorStyles
192
- }));
193
- } else {
194
- var items = this.createItems();
195
- var _this$props3 = this.props,
196
- popupsMountPoint = _this$props3.popupsMountPoint,
197
- popupsBoundariesElement = _this$props3.popupsBoundariesElement,
198
- popupsScrollableElement = _this$props3.popupsScrollableElement;
199
- var labelLists = formatMessage(messages.lists);
200
- return jsx("span", {
201
- css: wrapperStyle
202
- }, jsx(DropdownMenu, {
203
- items: items,
204
- onItemActivated: this.onItemActivated,
205
- mountTo: popupsMountPoint,
206
- boundariesElement: popupsBoundariesElement,
207
- scrollableElement: popupsScrollableElement,
208
- isOpen: isDropdownOpen,
209
- onOpenChange: this.onOpenChange,
210
- fitHeight: 188,
211
- fitWidth: 175,
212
- shouldUseDefaultRole: true
213
- }, jsx(ToolbarButton, {
214
- spacing: isReducedSpacing ? 'none' : 'default',
215
- selected: bulletListActive || orderedListActive,
216
- "aria-expanded": isDropdownOpen,
217
- "aria-haspopup": true,
218
- "aria-label": labelLists,
219
- disabled: disabled,
220
- onClick: this.handleTriggerClick,
221
- title: labelLists,
222
- iconBefore: jsx("span", {
223
- css: wrapperStyle
224
- }, jsx(BulletListIcon, {
225
- label: labelLists
226
- }), jsx("span", {
227
- css: expandIconWrapperStyle
228
- }, jsx(ExpandIcon, {
229
- label: ""
230
- })))
231
- })), isSeparator && jsx("span", {
232
- css: separatorStyles
233
- }));
234
- }
235
- }
236
- }]);
237
-
238
- return ToolbarLists;
239
- }(PureComponent);
240
-
241
- export default injectIntl(ToolbarLists);