@atlaskit/editor-plugin-insert-block 3.2.2 → 3.2.4
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 +18 -0
- package/dist/cjs/ui/ElementBrowser/InsertMenu.js +9 -3
- package/dist/cjs/ui/ToolbarInsertBlock/block-insert-menu.js +9 -2
- package/dist/cjs/ui/ToolbarInsertBlock/create-items.js +1 -1
- package/dist/cjs/ui/ToolbarInsertBlock/index.js +12 -3
- package/dist/cjs/ui/ToolbarInsertBlock/item.js +8 -0
- package/dist/es2019/ui/ElementBrowser/InsertMenu.js +9 -3
- package/dist/es2019/ui/ToolbarInsertBlock/block-insert-menu.js +9 -2
- package/dist/es2019/ui/ToolbarInsertBlock/create-items.js +1 -1
- package/dist/es2019/ui/ToolbarInsertBlock/index.js +12 -3
- package/dist/es2019/ui/ToolbarInsertBlock/item.js +8 -0
- package/dist/esm/ui/ElementBrowser/InsertMenu.js +9 -3
- package/dist/esm/ui/ToolbarInsertBlock/block-insert-menu.js +9 -2
- package/dist/esm/ui/ToolbarInsertBlock/create-items.js +1 -1
- package/dist/esm/ui/ToolbarInsertBlock/index.js +12 -3
- package/dist/esm/ui/ToolbarInsertBlock/item.js +8 -0
- package/dist/types/ui/ToolbarInsertBlock/item.d.ts +7 -0
- package/dist/types-ts4.5/ui/ToolbarInsertBlock/item.d.ts +7 -0
- package/package.json +18 -12
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-insert-block
|
|
2
2
|
|
|
3
|
+
## 3.2.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#146116](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/146116)
|
|
8
|
+
[`67279b54bce62`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/67279b54bce62) -
|
|
9
|
+
[ux] Add all block insert actions in Editor primary toolbar
|
|
10
|
+
- Updated dependencies
|
|
11
|
+
|
|
12
|
+
## 3.2.3
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- [#142191](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/142191)
|
|
17
|
+
[`8a39e59bec14f`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/8a39e59bec14f) -
|
|
18
|
+
A11Y-9980: Update how View Item button is created.
|
|
19
|
+
- Updated dependencies
|
|
20
|
+
|
|
3
21
|
## 3.2.2
|
|
4
22
|
|
|
5
23
|
### Patch Changes
|
|
@@ -27,8 +27,6 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
27
27
|
* @jsxRuntime classic
|
|
28
28
|
* @jsx jsx
|
|
29
29
|
*/ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
30
|
-
// AFP-2532 TODO: Fix automatic suppressions below
|
|
31
|
-
// eslint-disable-next-line @atlassian/tangerine/import/entry-points
|
|
32
30
|
var DEFAULT_HEIGHT = exports.DEFAULT_HEIGHT = 560;
|
|
33
31
|
var InsertMenu = function InsertMenu(_ref) {
|
|
34
32
|
var _pluginInjectionApi$q6, _pluginInjectionApi$q7;
|
|
@@ -93,7 +91,9 @@ var InsertMenu = function InsertMenu(_ref) {
|
|
|
93
91
|
};
|
|
94
92
|
}, [onInsert]);
|
|
95
93
|
var quickInsertDropdownItems = dropdownItems.map(transform);
|
|
96
|
-
|
|
94
|
+
|
|
95
|
+
// Please clean up viewMoreItem when cleaning up platform_editor_refactor_view_more
|
|
96
|
+
var viewMoreItem = !(0, _platformFeatureFlags.fg)('platform_editor_refactor_view_more') && showElementBrowserLink ? quickInsertDropdownItems.pop() : undefined;
|
|
97
97
|
var onInsertItem = (0, _react.useCallback)(function (item) {
|
|
98
98
|
var _pluginInjectionApi$q;
|
|
99
99
|
toggleVisiblity();
|
|
@@ -138,6 +138,11 @@ var InsertMenu = function InsertMenu(_ref) {
|
|
|
138
138
|
return result;
|
|
139
139
|
}, [pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$q6 = pluginInjectionApi.quickInsert) === null || _pluginInjectionApi$q6 === void 0 ? void 0 : _pluginInjectionApi$q6.actions, quickInsertDropdownItems, connectivityState]);
|
|
140
140
|
var emptyStateHandler = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$q7 = pluginInjectionApi.quickInsert) === null || _pluginInjectionApi$q7 === void 0 || (_pluginInjectionApi$q7 = _pluginInjectionApi$q7.sharedState.currentState()) === null || _pluginInjectionApi$q7 === void 0 ? void 0 : _pluginInjectionApi$q7.emptyStateHandler;
|
|
141
|
+
var onViewMore = (0, _react.useCallback)(function () {
|
|
142
|
+
var _pluginInjectionApi$c, _pluginInjectionApi$q8;
|
|
143
|
+
toggleVisiblity();
|
|
144
|
+
pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$c = pluginInjectionApi.core) === null || _pluginInjectionApi$c === void 0 || _pluginInjectionApi$c.actions.execute(pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$q8 = pluginInjectionApi.quickInsert) === null || _pluginInjectionApi$q8 === void 0 ? void 0 : _pluginInjectionApi$q8.commands.openElementBrowserModal);
|
|
145
|
+
}, [pluginInjectionApi, toggleVisiblity]);
|
|
141
146
|
return (
|
|
142
147
|
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
|
|
143
148
|
(0, _react2.jsx)("div", {
|
|
@@ -157,6 +162,7 @@ var InsertMenu = function InsertMenu(_ref) {
|
|
|
157
162
|
,
|
|
158
163
|
key: quickInsertDropdownItems.length,
|
|
159
164
|
viewMoreItem: viewMoreItem,
|
|
165
|
+
onViewMore: onViewMore,
|
|
160
166
|
cache: cache
|
|
161
167
|
})))
|
|
162
168
|
);
|
|
@@ -6,11 +6,18 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.BlockInsertMenu = void 0;
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
9
10
|
var _blockInsertElementBrowser = require("./block-insert-element-browser");
|
|
10
11
|
var _dropdownButton = require("./dropdown-button");
|
|
11
12
|
var BlockInsertMenu = exports.BlockInsertMenu = function BlockInsertMenu(props) {
|
|
12
|
-
if (
|
|
13
|
-
|
|
13
|
+
if ((0, _platformFeatureFlags.fg)('platform_editor_refactor_view_more')) {
|
|
14
|
+
if (props.items.length === 0 && !props.showElementBrowserLink) {
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
} else {
|
|
18
|
+
if (props.items.length === 0) {
|
|
19
|
+
return null;
|
|
20
|
+
}
|
|
14
21
|
}
|
|
15
22
|
if (props.disabled) {
|
|
16
23
|
return /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(_dropdownButton.DropDownButton, {
|
|
@@ -211,7 +211,7 @@ var createInsertBlockItems = function createInsertBlockItems(config) {
|
|
|
211
211
|
if (insertMenuItems) {
|
|
212
212
|
items.push.apply(items, (0, _toConsumableArray2.default)(insertMenuItems));
|
|
213
213
|
}
|
|
214
|
-
if (showElementBrowserLink) {
|
|
214
|
+
if (showElementBrowserLink && !(0, _platformFeatureFlags.fg)('platform_editor_refactor_view_more')) {
|
|
215
215
|
items.push((0, _item.more)({
|
|
216
216
|
content: formatMessage(_messages.toolbarInsertBlockMessages.viewMore),
|
|
217
217
|
disabled: false
|
|
@@ -27,6 +27,7 @@ var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
|
27
27
|
var _picker = require("@atlaskit/emoji/picker");
|
|
28
28
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
29
29
|
var _colors = require("@atlaskit/theme/colors");
|
|
30
|
+
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
30
31
|
var _blockInsertMenu = require("./block-insert-menu");
|
|
31
32
|
var _createItems3 = require("./create-items");
|
|
32
33
|
var _templateObject;
|
|
@@ -478,7 +479,15 @@ var ToolbarInsertBlock = exports.ToolbarInsertBlock = /*#__PURE__*/function (_Re
|
|
|
478
479
|
_this.insertHorizontalRule(inputMethod);
|
|
479
480
|
break;
|
|
480
481
|
case 'macro':
|
|
481
|
-
|
|
482
|
+
/**
|
|
483
|
+
* Remove 'macro' case when cleaning up platform_editor_refactor_view_more
|
|
484
|
+
* along with the 'more' function from platform/packages/editor/editor-plugin-insert-block/src/ui/ToolbarInsertBlock/item.tsx
|
|
485
|
+
* as it will no longer be needed for the View More button.
|
|
486
|
+
* This will also reduce confusion from the 'macro' naming.
|
|
487
|
+
*/
|
|
488
|
+
if (!(0, _platformFeatureFlags.fg)('platform_editor_refactor_view_more')) {
|
|
489
|
+
_this.openElementBrowser();
|
|
490
|
+
}
|
|
482
491
|
break;
|
|
483
492
|
case 'date':
|
|
484
493
|
_this.createDate(inputMethod);
|
|
@@ -672,6 +681,7 @@ var ToolbarInsertBlock = exports.ToolbarInsertBlock = /*#__PURE__*/function (_Re
|
|
|
672
681
|
isDisabled = _this$props13.isDisabled,
|
|
673
682
|
isReducedSpacing = _this$props13.isReducedSpacing,
|
|
674
683
|
editorAppearance = _this$props13.editorAppearance;
|
|
684
|
+
var isFullPageAppearance = ['full-page', 'full-width'].includes(editorAppearance !== null && editorAppearance !== void 0 ? editorAppearance : '');
|
|
675
685
|
var isTableButtonVisible = buttons.some(function (_ref7) {
|
|
676
686
|
var value = _ref7.value;
|
|
677
687
|
return value.name === 'table';
|
|
@@ -706,7 +716,6 @@ var ToolbarInsertBlock = exports.ToolbarInsertBlock = /*#__PURE__*/function (_Re
|
|
|
706
716
|
} finally {
|
|
707
717
|
_iterator.f();
|
|
708
718
|
}
|
|
709
|
-
var isFullPageAppearance = ['full-page', 'full-width'].includes(editorAppearance !== null && editorAppearance !== void 0 ? editorAppearance : '');
|
|
710
719
|
return (0, _react2.jsx)("span", {
|
|
711
720
|
css:
|
|
712
721
|
// eslint-disable-next-line @atlaskit/platform/ensure-feature-flag-registration, @atlaskit/platform/ensure-feature-flag-prefix
|
|
@@ -796,7 +805,7 @@ var ToolbarInsertBlock = exports.ToolbarInsertBlock = /*#__PURE__*/function (_Re
|
|
|
796
805
|
showElementBrowserLink: this.props.showElementBrowserLink || false,
|
|
797
806
|
pluginInjectionApi: this.props.pluginInjectionApi,
|
|
798
807
|
isFullPageAppearance: isFullPageAppearance
|
|
799
|
-
})), !((_this$props$pluginInj = this.props.pluginInjectionApi) !== null && _this$props$pluginInj !== void 0 && _this$props$pluginInj.primaryToolbar) && this.props.showSeparator && /* eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage */
|
|
808
|
+
})), (!((_this$props$pluginInj = this.props.pluginInjectionApi) !== null && _this$props$pluginInj !== void 0 && _this$props$pluginInj.primaryToolbar) && this.props.showSeparator || isFullPageAppearance && (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') && (0, _platformFeatureFlags.fg)('platform_editor_insert_button_on_primary_toolbar')) && /* eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage */
|
|
800
809
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
|
|
801
810
|
(0, _react2.jsx)("span", {
|
|
802
811
|
css: _styles.separatorStyles
|
|
@@ -279,6 +279,14 @@ var status = exports.status = mem(function (init) {
|
|
|
279
279
|
}
|
|
280
280
|
});
|
|
281
281
|
});
|
|
282
|
+
|
|
283
|
+
/**
|
|
284
|
+
* @private
|
|
285
|
+
* @deprecated
|
|
286
|
+
* Deprecated as view more is not an item in the element browser.
|
|
287
|
+
* View more is implemented directly in the ViewMore component inside the StatelessElementBrowser when
|
|
288
|
+
* platform_editor_refactor_view_more is used.
|
|
289
|
+
*/
|
|
282
290
|
var more = exports.more = mem(function (init) {
|
|
283
291
|
return from({
|
|
284
292
|
content: init.content,
|
|
@@ -14,8 +14,6 @@ import { ELEMENT_ITEM_HEIGHT, ElementBrowser } from '@atlaskit/editor-common/ele
|
|
|
14
14
|
import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
15
15
|
import { IconCode, IconDate, IconDecision, IconDivider, IconExpand, IconPanel, IconQuote, IconStatus } from '@atlaskit/editor-common/quick-insert';
|
|
16
16
|
import { OutsideClickTargetRefContext, withReactEditorViewOuterListeners as withOuterListeners } from '@atlaskit/editor-common/ui-react';
|
|
17
|
-
// AFP-2532 TODO: Fix automatic suppressions below
|
|
18
|
-
// eslint-disable-next-line @atlassian/tangerine/import/entry-points
|
|
19
17
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
20
18
|
import { borderRadius } from '@atlaskit/theme';
|
|
21
19
|
import { N0, N30A, N60A } from '@atlaskit/theme/colors';
|
|
@@ -70,7 +68,9 @@ const InsertMenu = ({
|
|
|
70
68
|
value: item.value
|
|
71
69
|
}), [onInsert]);
|
|
72
70
|
const quickInsertDropdownItems = dropdownItems.map(transform);
|
|
73
|
-
|
|
71
|
+
|
|
72
|
+
// Please clean up viewMoreItem when cleaning up platform_editor_refactor_view_more
|
|
73
|
+
const viewMoreItem = !fg('platform_editor_refactor_view_more') && showElementBrowserLink ? quickInsertDropdownItems.pop() : undefined;
|
|
74
74
|
const onInsertItem = useCallback(item => {
|
|
75
75
|
var _pluginInjectionApi$q;
|
|
76
76
|
toggleVisiblity();
|
|
@@ -114,6 +114,11 @@ const InsertMenu = ({
|
|
|
114
114
|
return result;
|
|
115
115
|
}, [pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$q8 = pluginInjectionApi.quickInsert) === null || _pluginInjectionApi$q8 === void 0 ? void 0 : _pluginInjectionApi$q8.actions, quickInsertDropdownItems, connectivityState]);
|
|
116
116
|
const emptyStateHandler = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$q9 = pluginInjectionApi.quickInsert) === null || _pluginInjectionApi$q9 === void 0 ? void 0 : (_pluginInjectionApi$q10 = _pluginInjectionApi$q9.sharedState.currentState()) === null || _pluginInjectionApi$q10 === void 0 ? void 0 : _pluginInjectionApi$q10.emptyStateHandler;
|
|
117
|
+
const onViewMore = useCallback(() => {
|
|
118
|
+
var _pluginInjectionApi$c, _pluginInjectionApi$q11;
|
|
119
|
+
toggleVisiblity();
|
|
120
|
+
pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$c = pluginInjectionApi.core) === null || _pluginInjectionApi$c === void 0 ? void 0 : _pluginInjectionApi$c.actions.execute(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$q11 = pluginInjectionApi.quickInsert) === null || _pluginInjectionApi$q11 === void 0 ? void 0 : _pluginInjectionApi$q11.commands.openElementBrowserModal);
|
|
121
|
+
}, [pluginInjectionApi, toggleVisiblity]);
|
|
117
122
|
return (
|
|
118
123
|
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
|
|
119
124
|
jsx("div", {
|
|
@@ -133,6 +138,7 @@ const InsertMenu = ({
|
|
|
133
138
|
,
|
|
134
139
|
key: quickInsertDropdownItems.length,
|
|
135
140
|
viewMoreItem: viewMoreItem,
|
|
141
|
+
onViewMore: onViewMore,
|
|
136
142
|
cache: cache
|
|
137
143
|
})))
|
|
138
144
|
);
|
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
2
3
|
import { BlockInsertElementBrowser } from './block-insert-element-browser';
|
|
3
4
|
import { DropDownButton } from './dropdown-button';
|
|
4
5
|
export const BlockInsertMenu = props => {
|
|
5
|
-
if (
|
|
6
|
-
|
|
6
|
+
if (fg('platform_editor_refactor_view_more')) {
|
|
7
|
+
if (props.items.length === 0 && !props.showElementBrowserLink) {
|
|
8
|
+
return null;
|
|
9
|
+
}
|
|
10
|
+
} else {
|
|
11
|
+
if (props.items.length === 0) {
|
|
12
|
+
return null;
|
|
13
|
+
}
|
|
7
14
|
}
|
|
8
15
|
if (props.disabled) {
|
|
9
16
|
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(DropDownButton, {
|
|
@@ -192,7 +192,7 @@ const createInsertBlockItems = config => {
|
|
|
192
192
|
if (insertMenuItems) {
|
|
193
193
|
items.push(...insertMenuItems);
|
|
194
194
|
}
|
|
195
|
-
if (showElementBrowserLink) {
|
|
195
|
+
if (showElementBrowserLink && !fg('platform_editor_refactor_view_more')) {
|
|
196
196
|
items.push(more({
|
|
197
197
|
content: formatMessage(messages.viewMore),
|
|
198
198
|
disabled: false
|
|
@@ -22,6 +22,7 @@ import { EmojiPicker as AkEmojiPicker } from '@atlaskit/emoji/picker';
|
|
|
22
22
|
// eslint-disable-next-line import/no-namespace
|
|
23
23
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
24
24
|
import { N20A, N30A } from '@atlaskit/theme/colors';
|
|
25
|
+
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
25
26
|
import { BlockInsertMenu } from './block-insert-menu';
|
|
26
27
|
import { createItems } from './create-items';
|
|
27
28
|
// Ignored via go/ees005
|
|
@@ -510,7 +511,15 @@ export class ToolbarInsertBlock extends React.PureComponent {
|
|
|
510
511
|
this.insertHorizontalRule(inputMethod);
|
|
511
512
|
break;
|
|
512
513
|
case 'macro':
|
|
513
|
-
|
|
514
|
+
/**
|
|
515
|
+
* Remove 'macro' case when cleaning up platform_editor_refactor_view_more
|
|
516
|
+
* along with the 'more' function from platform/packages/editor/editor-plugin-insert-block/src/ui/ToolbarInsertBlock/item.tsx
|
|
517
|
+
* as it will no longer be needed for the View More button.
|
|
518
|
+
* This will also reduce confusion from the 'macro' naming.
|
|
519
|
+
*/
|
|
520
|
+
if (!fg('platform_editor_refactor_view_more')) {
|
|
521
|
+
this.openElementBrowser();
|
|
522
|
+
}
|
|
514
523
|
break;
|
|
515
524
|
case 'date':
|
|
516
525
|
this.createDate(inputMethod);
|
|
@@ -721,6 +730,7 @@ export class ToolbarInsertBlock extends React.PureComponent {
|
|
|
721
730
|
isReducedSpacing,
|
|
722
731
|
editorAppearance
|
|
723
732
|
} = this.props;
|
|
733
|
+
const isFullPageAppearance = ['full-page', 'full-width'].includes(editorAppearance !== null && editorAppearance !== void 0 ? editorAppearance : '');
|
|
724
734
|
const isTableButtonVisible = buttons.some(({
|
|
725
735
|
value
|
|
726
736
|
}) => value.name === 'table');
|
|
@@ -744,7 +754,6 @@ export class ToolbarInsertBlock extends React.PureComponent {
|
|
|
744
754
|
toolbarButtons.push(btn);
|
|
745
755
|
}
|
|
746
756
|
}
|
|
747
|
-
const isFullPageAppearance = ['full-page', 'full-width'].includes(editorAppearance !== null && editorAppearance !== void 0 ? editorAppearance : '');
|
|
748
757
|
return jsx("span", {
|
|
749
758
|
css:
|
|
750
759
|
// eslint-disable-next-line @atlaskit/platform/ensure-feature-flag-registration, @atlaskit/platform/ensure-feature-flag-prefix
|
|
@@ -834,7 +843,7 @@ export class ToolbarInsertBlock extends React.PureComponent {
|
|
|
834
843
|
showElementBrowserLink: this.props.showElementBrowserLink || false,
|
|
835
844
|
pluginInjectionApi: this.props.pluginInjectionApi,
|
|
836
845
|
isFullPageAppearance: isFullPageAppearance
|
|
837
|
-
})), !((_this$props$pluginInj4 = this.props.pluginInjectionApi) !== null && _this$props$pluginInj4 !== void 0 && _this$props$pluginInj4.primaryToolbar) && this.props.showSeparator && /* eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage */
|
|
846
|
+
})), (!((_this$props$pluginInj4 = this.props.pluginInjectionApi) !== null && _this$props$pluginInj4 !== void 0 && _this$props$pluginInj4.primaryToolbar) && this.props.showSeparator || isFullPageAppearance && editorExperiment('platform_editor_controls', 'variant1') && fg('platform_editor_insert_button_on_primary_toolbar')) && /* eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage */
|
|
838
847
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
|
|
839
848
|
jsx("span", {
|
|
840
849
|
css: separatorStyles
|
|
@@ -225,6 +225,14 @@ export const status = mem(init => from({
|
|
|
225
225
|
LEGACY_fallbackIcon: StatusIconLegacy
|
|
226
226
|
})
|
|
227
227
|
}));
|
|
228
|
+
|
|
229
|
+
/**
|
|
230
|
+
* @private
|
|
231
|
+
* @deprecated
|
|
232
|
+
* Deprecated as view more is not an item in the element browser.
|
|
233
|
+
* View more is implemented directly in the ViewMore component inside the StatelessElementBrowser when
|
|
234
|
+
* platform_editor_refactor_view_more is used.
|
|
235
|
+
*/
|
|
228
236
|
export const more = mem(init => from({
|
|
229
237
|
content: init.content,
|
|
230
238
|
tooltipDescription: init.tooltipDescription,
|
|
@@ -21,8 +21,6 @@ import { ELEMENT_ITEM_HEIGHT, ElementBrowser } from '@atlaskit/editor-common/ele
|
|
|
21
21
|
import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
22
22
|
import { IconCode, IconDate, IconDecision, IconDivider, IconExpand, IconPanel, IconQuote, IconStatus } from '@atlaskit/editor-common/quick-insert';
|
|
23
23
|
import { OutsideClickTargetRefContext, withReactEditorViewOuterListeners as withOuterListeners } from '@atlaskit/editor-common/ui-react';
|
|
24
|
-
// AFP-2532 TODO: Fix automatic suppressions below
|
|
25
|
-
// eslint-disable-next-line @atlassian/tangerine/import/entry-points
|
|
26
24
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
27
25
|
import { borderRadius } from '@atlaskit/theme';
|
|
28
26
|
import { N0, N30A, N60A } from '@atlaskit/theme/colors';
|
|
@@ -90,7 +88,9 @@ var InsertMenu = function InsertMenu(_ref) {
|
|
|
90
88
|
};
|
|
91
89
|
}, [onInsert]);
|
|
92
90
|
var quickInsertDropdownItems = dropdownItems.map(transform);
|
|
93
|
-
|
|
91
|
+
|
|
92
|
+
// Please clean up viewMoreItem when cleaning up platform_editor_refactor_view_more
|
|
93
|
+
var viewMoreItem = !fg('platform_editor_refactor_view_more') && showElementBrowserLink ? quickInsertDropdownItems.pop() : undefined;
|
|
94
94
|
var onInsertItem = useCallback(function (item) {
|
|
95
95
|
var _pluginInjectionApi$q;
|
|
96
96
|
toggleVisiblity();
|
|
@@ -135,6 +135,11 @@ var InsertMenu = function InsertMenu(_ref) {
|
|
|
135
135
|
return result;
|
|
136
136
|
}, [pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$q6 = pluginInjectionApi.quickInsert) === null || _pluginInjectionApi$q6 === void 0 ? void 0 : _pluginInjectionApi$q6.actions, quickInsertDropdownItems, connectivityState]);
|
|
137
137
|
var emptyStateHandler = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$q7 = pluginInjectionApi.quickInsert) === null || _pluginInjectionApi$q7 === void 0 || (_pluginInjectionApi$q7 = _pluginInjectionApi$q7.sharedState.currentState()) === null || _pluginInjectionApi$q7 === void 0 ? void 0 : _pluginInjectionApi$q7.emptyStateHandler;
|
|
138
|
+
var onViewMore = useCallback(function () {
|
|
139
|
+
var _pluginInjectionApi$c, _pluginInjectionApi$q8;
|
|
140
|
+
toggleVisiblity();
|
|
141
|
+
pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$c = pluginInjectionApi.core) === null || _pluginInjectionApi$c === void 0 || _pluginInjectionApi$c.actions.execute(pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$q8 = pluginInjectionApi.quickInsert) === null || _pluginInjectionApi$q8 === void 0 ? void 0 : _pluginInjectionApi$q8.commands.openElementBrowserModal);
|
|
142
|
+
}, [pluginInjectionApi, toggleVisiblity]);
|
|
138
143
|
return (
|
|
139
144
|
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
|
|
140
145
|
jsx("div", {
|
|
@@ -154,6 +159,7 @@ var InsertMenu = function InsertMenu(_ref) {
|
|
|
154
159
|
,
|
|
155
160
|
key: quickInsertDropdownItems.length,
|
|
156
161
|
viewMoreItem: viewMoreItem,
|
|
162
|
+
onViewMore: onViewMore,
|
|
157
163
|
cache: cache
|
|
158
164
|
})))
|
|
159
165
|
);
|
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
2
3
|
import { BlockInsertElementBrowser } from './block-insert-element-browser';
|
|
3
4
|
import { DropDownButton } from './dropdown-button';
|
|
4
5
|
export var BlockInsertMenu = function BlockInsertMenu(props) {
|
|
5
|
-
if (
|
|
6
|
-
|
|
6
|
+
if (fg('platform_editor_refactor_view_more')) {
|
|
7
|
+
if (props.items.length === 0 && !props.showElementBrowserLink) {
|
|
8
|
+
return null;
|
|
9
|
+
}
|
|
10
|
+
} else {
|
|
11
|
+
if (props.items.length === 0) {
|
|
12
|
+
return null;
|
|
13
|
+
}
|
|
7
14
|
}
|
|
8
15
|
if (props.disabled) {
|
|
9
16
|
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(DropDownButton, {
|
|
@@ -204,7 +204,7 @@ var createInsertBlockItems = function createInsertBlockItems(config) {
|
|
|
204
204
|
if (insertMenuItems) {
|
|
205
205
|
items.push.apply(items, _toConsumableArray(insertMenuItems));
|
|
206
206
|
}
|
|
207
|
-
if (showElementBrowserLink) {
|
|
207
|
+
if (showElementBrowserLink && !fg('platform_editor_refactor_view_more')) {
|
|
208
208
|
items.push(more({
|
|
209
209
|
content: formatMessage(messages.viewMore),
|
|
210
210
|
disabled: false
|
|
@@ -37,6 +37,7 @@ import { EmojiPicker as AkEmojiPicker } from '@atlaskit/emoji/picker';
|
|
|
37
37
|
// eslint-disable-next-line import/no-namespace
|
|
38
38
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
39
39
|
import { N20A, N30A } from '@atlaskit/theme/colors';
|
|
40
|
+
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
40
41
|
import { BlockInsertMenu } from './block-insert-menu';
|
|
41
42
|
import { createItems } from './create-items';
|
|
42
43
|
// Ignored via go/ees005
|
|
@@ -472,7 +473,15 @@ export var ToolbarInsertBlock = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
472
473
|
_this.insertHorizontalRule(inputMethod);
|
|
473
474
|
break;
|
|
474
475
|
case 'macro':
|
|
475
|
-
|
|
476
|
+
/**
|
|
477
|
+
* Remove 'macro' case when cleaning up platform_editor_refactor_view_more
|
|
478
|
+
* along with the 'more' function from platform/packages/editor/editor-plugin-insert-block/src/ui/ToolbarInsertBlock/item.tsx
|
|
479
|
+
* as it will no longer be needed for the View More button.
|
|
480
|
+
* This will also reduce confusion from the 'macro' naming.
|
|
481
|
+
*/
|
|
482
|
+
if (!fg('platform_editor_refactor_view_more')) {
|
|
483
|
+
_this.openElementBrowser();
|
|
484
|
+
}
|
|
476
485
|
break;
|
|
477
486
|
case 'date':
|
|
478
487
|
_this.createDate(inputMethod);
|
|
@@ -666,6 +675,7 @@ export var ToolbarInsertBlock = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
666
675
|
isDisabled = _this$props13.isDisabled,
|
|
667
676
|
isReducedSpacing = _this$props13.isReducedSpacing,
|
|
668
677
|
editorAppearance = _this$props13.editorAppearance;
|
|
678
|
+
var isFullPageAppearance = ['full-page', 'full-width'].includes(editorAppearance !== null && editorAppearance !== void 0 ? editorAppearance : '');
|
|
669
679
|
var isTableButtonVisible = buttons.some(function (_ref7) {
|
|
670
680
|
var value = _ref7.value;
|
|
671
681
|
return value.name === 'table';
|
|
@@ -700,7 +710,6 @@ export var ToolbarInsertBlock = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
700
710
|
} finally {
|
|
701
711
|
_iterator.f();
|
|
702
712
|
}
|
|
703
|
-
var isFullPageAppearance = ['full-page', 'full-width'].includes(editorAppearance !== null && editorAppearance !== void 0 ? editorAppearance : '');
|
|
704
713
|
return jsx("span", {
|
|
705
714
|
css:
|
|
706
715
|
// eslint-disable-next-line @atlaskit/platform/ensure-feature-flag-registration, @atlaskit/platform/ensure-feature-flag-prefix
|
|
@@ -790,7 +799,7 @@ export var ToolbarInsertBlock = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
790
799
|
showElementBrowserLink: this.props.showElementBrowserLink || false,
|
|
791
800
|
pluginInjectionApi: this.props.pluginInjectionApi,
|
|
792
801
|
isFullPageAppearance: isFullPageAppearance
|
|
793
|
-
})), !((_this$props$pluginInj = this.props.pluginInjectionApi) !== null && _this$props$pluginInj !== void 0 && _this$props$pluginInj.primaryToolbar) && this.props.showSeparator && /* eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage */
|
|
802
|
+
})), (!((_this$props$pluginInj = this.props.pluginInjectionApi) !== null && _this$props$pluginInj !== void 0 && _this$props$pluginInj.primaryToolbar) && this.props.showSeparator || isFullPageAppearance && editorExperiment('platform_editor_controls', 'variant1') && fg('platform_editor_insert_button_on_primary_toolbar')) && /* eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage */
|
|
794
803
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
|
|
795
804
|
jsx("span", {
|
|
796
805
|
css: separatorStyles
|
|
@@ -271,6 +271,14 @@ export var status = mem(function (init) {
|
|
|
271
271
|
}
|
|
272
272
|
});
|
|
273
273
|
});
|
|
274
|
+
|
|
275
|
+
/**
|
|
276
|
+
* @private
|
|
277
|
+
* @deprecated
|
|
278
|
+
* Deprecated as view more is not an item in the element browser.
|
|
279
|
+
* View more is implemented directly in the ViewMore component inside the StatelessElementBrowser when
|
|
280
|
+
* platform_editor_refactor_view_more is used.
|
|
281
|
+
*/
|
|
274
282
|
export var more = mem(function (init) {
|
|
275
283
|
return from({
|
|
276
284
|
content: init.content,
|
|
@@ -36,4 +36,11 @@ export declare const expand: MemoizedFn<(init: CreateInit) => MenuItem>;
|
|
|
36
36
|
export declare const date: MemoizedFn<(init: CreateInit) => MenuItem>;
|
|
37
37
|
export declare const placeholder: MemoizedFn<(init: CreateInit) => MenuItem>;
|
|
38
38
|
export declare const status: MemoizedFn<(init: CreateInit) => MenuItem>;
|
|
39
|
+
/**
|
|
40
|
+
* @private
|
|
41
|
+
* @deprecated
|
|
42
|
+
* Deprecated as view more is not an item in the element browser.
|
|
43
|
+
* View more is implemented directly in the ViewMore component inside the StatelessElementBrowser when
|
|
44
|
+
* platform_editor_refactor_view_more is used.
|
|
45
|
+
*/
|
|
39
46
|
export declare const more: MemoizedFn<(init: CreateInit) => MenuItem>;
|
|
@@ -36,4 +36,11 @@ export declare const expand: MemoizedFn<(init: CreateInit) => MenuItem>;
|
|
|
36
36
|
export declare const date: MemoizedFn<(init: CreateInit) => MenuItem>;
|
|
37
37
|
export declare const placeholder: MemoizedFn<(init: CreateInit) => MenuItem>;
|
|
38
38
|
export declare const status: MemoizedFn<(init: CreateInit) => MenuItem>;
|
|
39
|
+
/**
|
|
40
|
+
* @private
|
|
41
|
+
* @deprecated
|
|
42
|
+
* Deprecated as view more is not an item in the element browser.
|
|
43
|
+
* View more is implemented directly in the ViewMore component inside the StatelessElementBrowser when
|
|
44
|
+
* platform_editor_refactor_view_more is used.
|
|
45
|
+
*/
|
|
39
46
|
export declare const more: MemoizedFn<(init: CreateInit) => MenuItem>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-insert-block",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.4",
|
|
4
4
|
"description": "Insert block plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@atlaskit/button": "^23.0.0",
|
|
37
|
-
"@atlaskit/editor-common": "^103.
|
|
37
|
+
"@atlaskit/editor-common": "^103.17.0",
|
|
38
38
|
"@atlaskit/editor-plugin-analytics": "^2.2.0",
|
|
39
39
|
"@atlaskit/editor-plugin-block-type": "^5.1.0",
|
|
40
40
|
"@atlaskit/editor-plugin-code-block": "^4.4.0",
|
|
@@ -42,14 +42,14 @@
|
|
|
42
42
|
"@atlaskit/editor-plugin-date": "^4.2.0",
|
|
43
43
|
"@atlaskit/editor-plugin-emoji": "^3.6.0",
|
|
44
44
|
"@atlaskit/editor-plugin-expand": "^3.2.0",
|
|
45
|
-
"@atlaskit/editor-plugin-extension": "^5.
|
|
45
|
+
"@atlaskit/editor-plugin-extension": "^5.3.0",
|
|
46
46
|
"@atlaskit/editor-plugin-feature-flags": "^1.4.0",
|
|
47
47
|
"@atlaskit/editor-plugin-hyperlink": "^4.4.0",
|
|
48
48
|
"@atlaskit/editor-plugin-image-upload": "^2.0.0",
|
|
49
|
-
"@atlaskit/editor-plugin-layout": "^2.
|
|
49
|
+
"@atlaskit/editor-plugin-layout": "^2.6.0",
|
|
50
50
|
"@atlaskit/editor-plugin-media": "^2.6.0",
|
|
51
51
|
"@atlaskit/editor-plugin-media-insert": "^6.2.0",
|
|
52
|
-
"@atlaskit/editor-plugin-mentions": "^4.
|
|
52
|
+
"@atlaskit/editor-plugin-mentions": "^4.5.0",
|
|
53
53
|
"@atlaskit/editor-plugin-metrics": "^3.4.0",
|
|
54
54
|
"@atlaskit/editor-plugin-panel": "^4.3.0",
|
|
55
55
|
"@atlaskit/editor-plugin-placeholder-text": "^2.2.0",
|
|
@@ -57,19 +57,19 @@
|
|
|
57
57
|
"@atlaskit/editor-plugin-quick-insert": "^2.4.0",
|
|
58
58
|
"@atlaskit/editor-plugin-rule": "^2.1.0",
|
|
59
59
|
"@atlaskit/editor-plugin-status": "^3.1.0",
|
|
60
|
-
"@atlaskit/editor-plugin-table": "^10.
|
|
60
|
+
"@atlaskit/editor-plugin-table": "^10.9.0",
|
|
61
61
|
"@atlaskit/editor-plugin-tasks-and-decisions": "^5.1.0",
|
|
62
62
|
"@atlaskit/editor-plugin-type-ahead": "^2.5.0",
|
|
63
63
|
"@atlaskit/editor-prosemirror": "7.0.0",
|
|
64
64
|
"@atlaskit/editor-shared-styles": "^3.4.0",
|
|
65
|
-
"@atlaskit/emoji": "^69.
|
|
65
|
+
"@atlaskit/emoji": "^69.1.0",
|
|
66
66
|
"@atlaskit/heading": "^5.2.0",
|
|
67
67
|
"@atlaskit/icon": "^25.6.0",
|
|
68
68
|
"@atlaskit/icon-lab": "^4.9.0",
|
|
69
69
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
70
70
|
"@atlaskit/primitives": "^14.4.0",
|
|
71
71
|
"@atlaskit/theme": "^18.0.0",
|
|
72
|
-
"@atlaskit/tmp-editor-statsig": "^4.
|
|
72
|
+
"@atlaskit/tmp-editor-statsig": "^4.14.0",
|
|
73
73
|
"@atlaskit/tokens": "^4.8.0",
|
|
74
74
|
"@atlaskit/tooltip": "^20.0.0",
|
|
75
75
|
"@babel/runtime": "^7.0.0",
|
|
@@ -85,10 +85,10 @@
|
|
|
85
85
|
"react-intl-next": "npm:react-intl@^5.18.1"
|
|
86
86
|
},
|
|
87
87
|
"devDependencies": {
|
|
88
|
-
"@af/integration-testing": "
|
|
89
|
-
"@af/visual-regression": "
|
|
90
|
-
"@atlaskit/ssr": "
|
|
91
|
-
"@atlaskit/visual-regression": "
|
|
88
|
+
"@af/integration-testing": "workspace:^",
|
|
89
|
+
"@af/visual-regression": "workspace:^",
|
|
90
|
+
"@atlaskit/ssr": "workspace:^",
|
|
91
|
+
"@atlaskit/visual-regression": "workspace:^",
|
|
92
92
|
"@testing-library/react": "^13.4.0",
|
|
93
93
|
"@types/react-virtualized": "^9.18.12",
|
|
94
94
|
"typescript": "~5.4.2"
|
|
@@ -141,6 +141,12 @@
|
|
|
141
141
|
},
|
|
142
142
|
"platform_editor_add_media_from_url_rollout": {
|
|
143
143
|
"type": "boolean"
|
|
144
|
+
},
|
|
145
|
+
"platform_editor_insert_button_on_primary_toolbar": {
|
|
146
|
+
"type": "boolean"
|
|
147
|
+
},
|
|
148
|
+
"platform_editor_refactor_view_more": {
|
|
149
|
+
"type": "boolean"
|
|
144
150
|
}
|
|
145
151
|
}
|
|
146
152
|
}
|