@atlaskit/editor-plugin-expand 16.0.0 → 16.0.2
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 +14 -0
- package/dist/cjs/legacyExpand/plugin.js +19 -5
- package/dist/cjs/singlePlayerExpand/commands.js +1 -0
- package/dist/cjs/singlePlayerExpand/plugin.js +23 -9
- package/dist/cjs/ui/quick-insert/ExpandQuickInsertMenuItem.js +65 -0
- package/dist/cjs/ui/quick-insert/getExpandQuickInsertComponents.js +41 -0
- package/dist/es2019/legacyExpand/plugin.js +48 -36
- package/dist/es2019/singlePlayerExpand/commands.js +2 -0
- package/dist/es2019/singlePlayerExpand/plugin.js +49 -37
- package/dist/es2019/ui/quick-insert/ExpandQuickInsertMenuItem.js +63 -0
- package/dist/es2019/ui/quick-insert/getExpandQuickInsertComponents.js +28 -0
- package/dist/esm/legacyExpand/plugin.js +18 -4
- package/dist/esm/singlePlayerExpand/commands.js +2 -0
- package/dist/esm/singlePlayerExpand/plugin.js +19 -5
- package/dist/esm/ui/quick-insert/ExpandQuickInsertMenuItem.js +57 -0
- package/dist/esm/ui/quick-insert/getExpandQuickInsertComponents.js +34 -0
- package/dist/types/types.d.ts +3 -1
- package/dist/types/ui/quick-insert/ExpandQuickInsertMenuItem.d.ts +9 -0
- package/dist/types/ui/quick-insert/getExpandQuickInsertComponents.d.ts +7 -0
- package/package.json +4 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-expand
|
|
2
2
|
|
|
3
|
+
## 16.0.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
|
|
9
|
+
## 16.0.1
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [`4273da2e1a648`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/4273da2e1a648) -
|
|
14
|
+
Register native Quick Insert items behind `platform_editor_slash_command`.
|
|
15
|
+
- Updated dependencies
|
|
16
|
+
|
|
3
17
|
## 16.0.0
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
|
@@ -5,21 +5,26 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.expandPlugin = void 0;
|
|
8
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
8
9
|
var _react = _interopRequireDefault(require("react"));
|
|
9
10
|
var _adfSchema = require("@atlaskit/adf-schema");
|
|
10
11
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
11
12
|
var _blockMenu = require("@atlaskit/editor-common/block-menu");
|
|
12
13
|
var _messages = require("@atlaskit/editor-common/messages");
|
|
13
|
-
var
|
|
14
|
+
var _assets = require("@atlaskit/editor-common/assets");
|
|
15
|
+
var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
|
|
14
16
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
15
17
|
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
16
18
|
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
17
19
|
var _toggleExpandRange = require("../editor-commands/toggleExpandRange");
|
|
18
20
|
var _ExpandBlockMenuItem = require("../ui/ExpandBlockMenuItem");
|
|
21
|
+
var _getExpandQuickInsertComponents = require("../ui/quick-insert/getExpandQuickInsertComponents");
|
|
19
22
|
var _commands = require("./commands");
|
|
20
23
|
var _keymap = require("./pm-plugins/keymap");
|
|
21
24
|
var _main = require("./pm-plugins/main");
|
|
22
25
|
var _toolbar = require("./toolbar");
|
|
26
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
27
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
23
28
|
var EXPAND_NODE_NAME = 'expand';
|
|
24
29
|
// Ignored via go/ees005
|
|
25
30
|
// eslint-disable-next-line prefer-const
|
|
@@ -28,6 +33,7 @@ var expandPlugin = exports.expandPlugin = function expandPlugin(_ref) {
|
|
|
28
33
|
var _ref$config = _ref.config,
|
|
29
34
|
options = _ref$config === void 0 ? {} : _ref$config,
|
|
30
35
|
api = _ref.api;
|
|
36
|
+
var isRegisteredSlashCommandEnabled = (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_slash_command');
|
|
31
37
|
if ((0, _experiments.editorExperiment)('platform_editor_block_menu', true)) {
|
|
32
38
|
var _api$blockMenu;
|
|
33
39
|
api === null || api === void 0 || (_api$blockMenu = api.blockMenu) === null || _api$blockMenu === void 0 || _api$blockMenu.actions.registerBlockMenuComponents([{
|
|
@@ -45,6 +51,13 @@ var expandPlugin = exports.expandPlugin = function expandPlugin(_ref) {
|
|
|
45
51
|
}
|
|
46
52
|
}]);
|
|
47
53
|
}
|
|
54
|
+
if (isRegisteredSlashCommandEnabled && options.allowInsertion === true) {
|
|
55
|
+
var _api$uiControlRegistr;
|
|
56
|
+
api === null || api === void 0 || (_api$uiControlRegistr = api.uiControlRegistry) === null || _api$uiControlRegistr === void 0 || _api$uiControlRegistr.actions.register((0, _getExpandQuickInsertComponents.getExpandQuickInsertComponents)({
|
|
57
|
+
api: api,
|
|
58
|
+
isLegacy: true
|
|
59
|
+
}));
|
|
60
|
+
}
|
|
48
61
|
return {
|
|
49
62
|
name: 'expand',
|
|
50
63
|
nodes: function nodes() {
|
|
@@ -91,8 +104,9 @@ var expandPlugin = exports.expandPlugin = function expandPlugin(_ref) {
|
|
|
91
104
|
}
|
|
92
105
|
}];
|
|
93
106
|
},
|
|
94
|
-
pluginsOptions: {
|
|
95
|
-
floatingToolbar: (0, _toolbar.getToolbarConfig)(api)
|
|
107
|
+
pluginsOptions: _objectSpread({
|
|
108
|
+
floatingToolbar: (0, _toolbar.getToolbarConfig)(api)
|
|
109
|
+
}, !isRegisteredSlashCommandEnabled && {
|
|
96
110
|
quickInsert: function quickInsert(_ref3) {
|
|
97
111
|
var formatMessage = _ref3.formatMessage;
|
|
98
112
|
if (options && options.allowInsertion !== true) {
|
|
@@ -105,7 +119,7 @@ var expandPlugin = exports.expandPlugin = function expandPlugin(_ref) {
|
|
|
105
119
|
keywords: ['accordion', 'collapse'],
|
|
106
120
|
priority: 600,
|
|
107
121
|
icon: function icon() {
|
|
108
|
-
return /*#__PURE__*/_react.default.createElement(
|
|
122
|
+
return /*#__PURE__*/_react.default.createElement(_assets.IconExpand, null);
|
|
109
123
|
},
|
|
110
124
|
action: function action(insert, state) {
|
|
111
125
|
var _api$analytics3;
|
|
@@ -130,6 +144,6 @@ var expandPlugin = exports.expandPlugin = function expandPlugin(_ref) {
|
|
|
130
144
|
}
|
|
131
145
|
}];
|
|
132
146
|
}
|
|
133
|
-
}
|
|
147
|
+
})
|
|
134
148
|
};
|
|
135
149
|
};
|
|
@@ -22,6 +22,7 @@ var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
|
22
22
|
var _utils4 = require("../utils");
|
|
23
23
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
24
24
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } // eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
25
|
+
// oxlint-disable-next-line import/no-duplicates
|
|
25
26
|
// Creates either an expand or a nestedExpand node based on the current selection
|
|
26
27
|
var createExpandNode = exports.createExpandNode = function createExpandNode(state) {
|
|
27
28
|
var setExpandedState = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
@@ -5,22 +5,27 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.expandPlugin = void 0;
|
|
8
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
8
9
|
var _react = _interopRequireDefault(require("react"));
|
|
9
10
|
var _adfSchema = require("@atlaskit/adf-schema");
|
|
10
11
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
11
12
|
var _blockMenu = require("@atlaskit/editor-common/block-menu");
|
|
12
13
|
var _messages = require("@atlaskit/editor-common/messages");
|
|
13
|
-
var
|
|
14
|
+
var _assets = require("@atlaskit/editor-common/assets");
|
|
14
15
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
15
|
-
var
|
|
16
|
+
var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
|
|
17
|
+
var _fg = require("@atlaskit/platform-feature-flags/fg");
|
|
16
18
|
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
17
19
|
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
18
20
|
var _toggleExpandRange = require("../editor-commands/toggleExpandRange");
|
|
19
21
|
var _ExpandBlockMenuItem = require("../ui/ExpandBlockMenuItem");
|
|
22
|
+
var _getExpandQuickInsertComponents = require("../ui/quick-insert/getExpandQuickInsertComponents");
|
|
20
23
|
var _commands = require("./commands");
|
|
21
24
|
var _keymap = require("./pm-plugins/keymap");
|
|
22
25
|
var _main = require("./pm-plugins/main");
|
|
23
26
|
var _toolbar = require("./toolbar");
|
|
27
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
28
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
24
29
|
var EXPAND_NODE_NAME = 'expand';
|
|
25
30
|
// Ignored via go/ees005
|
|
26
31
|
// eslint-disable-next-line prefer-const
|
|
@@ -28,6 +33,7 @@ var expandPlugin = exports.expandPlugin = function expandPlugin(_ref) {
|
|
|
28
33
|
var _ref$config = _ref.config,
|
|
29
34
|
options = _ref$config === void 0 ? {} : _ref$config,
|
|
30
35
|
api = _ref.api;
|
|
36
|
+
var isRegisteredSlashCommandEnabled = (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_slash_command');
|
|
31
37
|
if ((0, _experiments.editorExperiment)('platform_editor_block_menu', true)) {
|
|
32
38
|
var _api$blockMenu;
|
|
33
39
|
api === null || api === void 0 || (_api$blockMenu = api.blockMenu) === null || _api$blockMenu === void 0 || _api$blockMenu.actions.registerBlockMenuComponents([{
|
|
@@ -45,15 +51,22 @@ var expandPlugin = exports.expandPlugin = function expandPlugin(_ref) {
|
|
|
45
51
|
}
|
|
46
52
|
}]);
|
|
47
53
|
}
|
|
54
|
+
if (isRegisteredSlashCommandEnabled && options.allowInsertion === true) {
|
|
55
|
+
var _api$uiControlRegistr;
|
|
56
|
+
api === null || api === void 0 || (_api$uiControlRegistr = api.uiControlRegistry) === null || _api$uiControlRegistr === void 0 || _api$uiControlRegistr.actions.register((0, _getExpandQuickInsertComponents.getExpandQuickInsertComponents)({
|
|
57
|
+
api: api,
|
|
58
|
+
isLegacy: false
|
|
59
|
+
}));
|
|
60
|
+
}
|
|
48
61
|
return {
|
|
49
62
|
name: 'expand',
|
|
50
63
|
nodes: function nodes() {
|
|
51
64
|
return [{
|
|
52
65
|
name: 'expand',
|
|
53
|
-
node: (0,
|
|
66
|
+
node: (0, _fg.fg)('platform_editor_adf_with_localid') ? _adfSchema.expandWithNestedExpandLocalId : _adfSchema.expandWithNestedExpand
|
|
54
67
|
}, {
|
|
55
68
|
name: 'nestedExpand',
|
|
56
|
-
node: (0,
|
|
69
|
+
node: (0, _fg.fg)('platform_editor_adf_with_localid') ? _adfSchema.nestedExpandWithLocalId : _adfSchema.nestedExpand
|
|
57
70
|
}];
|
|
58
71
|
},
|
|
59
72
|
actions: {
|
|
@@ -89,8 +102,9 @@ var expandPlugin = exports.expandPlugin = function expandPlugin(_ref) {
|
|
|
89
102
|
}
|
|
90
103
|
}];
|
|
91
104
|
},
|
|
92
|
-
pluginsOptions: {
|
|
93
|
-
floatingToolbar: (0, _toolbar.getToolbarConfig)(api)
|
|
105
|
+
pluginsOptions: _objectSpread({
|
|
106
|
+
floatingToolbar: (0, _toolbar.getToolbarConfig)(api)
|
|
107
|
+
}, !isRegisteredSlashCommandEnabled && {
|
|
94
108
|
quickInsert: function quickInsert(_ref3) {
|
|
95
109
|
var formatMessage = _ref3.formatMessage;
|
|
96
110
|
if (options && options.allowInsertion !== true) {
|
|
@@ -103,7 +117,7 @@ var expandPlugin = exports.expandPlugin = function expandPlugin(_ref) {
|
|
|
103
117
|
keywords: ['accordion', 'collapse'],
|
|
104
118
|
priority: 600,
|
|
105
119
|
icon: function icon() {
|
|
106
|
-
return /*#__PURE__*/_react.default.createElement(
|
|
120
|
+
return /*#__PURE__*/_react.default.createElement(_assets.IconExpand, null);
|
|
107
121
|
},
|
|
108
122
|
action: function action(insert, state, source) {
|
|
109
123
|
var _api$analytics;
|
|
@@ -111,7 +125,7 @@ var expandPlugin = exports.expandPlugin = function expandPlugin(_ref) {
|
|
|
111
125
|
if (!node) {
|
|
112
126
|
return false;
|
|
113
127
|
}
|
|
114
|
-
var tr = state.selection.empty ? insert(node) : (0,
|
|
128
|
+
var tr = state.selection.empty ? insert(node) : (0, _fg.fg)('platform_editor_adf_with_localid') ? (0, _commands.wrapSelectionAndSetExpandedState)(state, node) : (0, _utils.createWrapSelectionTransaction)({
|
|
115
129
|
state: state,
|
|
116
130
|
type: node.type
|
|
117
131
|
});
|
|
@@ -128,6 +142,6 @@ var expandPlugin = exports.expandPlugin = function expandPlugin(_ref) {
|
|
|
128
142
|
}
|
|
129
143
|
}];
|
|
130
144
|
}
|
|
131
|
-
}
|
|
145
|
+
})
|
|
132
146
|
};
|
|
133
147
|
};
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.ExpandQuickInsertMenuItem = void 0;
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
+
var _reactIntl = require("react-intl");
|
|
10
|
+
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
11
|
+
var _hooks = require("@atlaskit/editor-common/hooks");
|
|
12
|
+
var _messages = require("@atlaskit/editor-common/messages");
|
|
13
|
+
var _assets = require("@atlaskit/editor-common/assets");
|
|
14
|
+
var _menuItem = require("@atlaskit/editor-common/quick-insert/menu-item");
|
|
15
|
+
var _utils = require("@atlaskit/editor-common/utils");
|
|
16
|
+
var _fg = require("@atlaskit/platform-feature-flags/fg");
|
|
17
|
+
var _commands = require("../../legacyExpand/commands");
|
|
18
|
+
var _commands2 = require("../../singlePlayerExpand/commands");
|
|
19
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
20
|
+
var ExpandQuickInsertMenuItem = exports.ExpandQuickInsertMenuItem = function ExpandQuickInsertMenuItem(_ref) {
|
|
21
|
+
var api = _ref.api,
|
|
22
|
+
isLegacy = _ref.isLegacy;
|
|
23
|
+
var _useIntl = (0, _reactIntl.useIntl)(),
|
|
24
|
+
formatMessage = _useIntl.formatMessage;
|
|
25
|
+
var _useSharedPluginState = (0, _hooks.useSharedPluginStateWithSelector)(api, ['editorDisabled', 'editorViewMode'], function (states) {
|
|
26
|
+
var _states$editorDisable, _states$editorViewMod;
|
|
27
|
+
return {
|
|
28
|
+
editorDisabled: (_states$editorDisable = states.editorDisabledState) === null || _states$editorDisable === void 0 ? void 0 : _states$editorDisable.editorDisabled,
|
|
29
|
+
mode: (_states$editorViewMod = states.editorViewModeState) === null || _states$editorViewMod === void 0 ? void 0 : _states$editorViewMod.mode
|
|
30
|
+
};
|
|
31
|
+
}),
|
|
32
|
+
editorDisabled = _useSharedPluginState.editorDisabled,
|
|
33
|
+
mode = _useSharedPluginState.mode;
|
|
34
|
+
var onSelect = (0, _react.useCallback)(function (_ref2) {
|
|
35
|
+
var _api$analytics;
|
|
36
|
+
var editorView = _ref2.editorView,
|
|
37
|
+
insert = _ref2.insert,
|
|
38
|
+
source = _ref2.source;
|
|
39
|
+
var state = editorView.state;
|
|
40
|
+
var node = isLegacy ? (0, _commands.createExpandNode)(state) : (0, _commands2.createExpandNode)(state, undefined, !!(api !== null && api !== void 0 && api.localId));
|
|
41
|
+
if (!node) {
|
|
42
|
+
return false;
|
|
43
|
+
}
|
|
44
|
+
var tr = state.selection.empty ? insert(node) : isLegacy || !(0, _fg.fg)('platform_editor_adf_with_localid') ? (0, _utils.createWrapSelectionTransaction)({
|
|
45
|
+
state: state,
|
|
46
|
+
type: node.type
|
|
47
|
+
}) : (0, _commands2.wrapSelectionAndSetExpandedState)(state, node);
|
|
48
|
+
api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 || _api$analytics.actions.attachAnalyticsEvent({
|
|
49
|
+
action: _analytics.ACTION.INSERTED,
|
|
50
|
+
actionSubject: _analytics.ACTION_SUBJECT.DOCUMENT,
|
|
51
|
+
actionSubjectId: node.type === state.schema.nodes.nestedExpand ? _analytics.ACTION_SUBJECT_ID.NESTED_EXPAND : _analytics.ACTION_SUBJECT_ID.EXPAND,
|
|
52
|
+
attributes: {
|
|
53
|
+
inputMethod: isLegacy ? _analytics.INPUT_METHOD.QUICK_INSERT : source
|
|
54
|
+
},
|
|
55
|
+
eventType: _analytics.EVENT_TYPE.TRACK
|
|
56
|
+
})(tr);
|
|
57
|
+
return tr;
|
|
58
|
+
}, [api, isLegacy]);
|
|
59
|
+
return /*#__PURE__*/_react.default.createElement(_menuItem.QuickInsertMenuItem, {
|
|
60
|
+
iconBefore: /*#__PURE__*/_react.default.createElement(_assets.IconExpand, null),
|
|
61
|
+
isDisabled: editorDisabled || mode === 'view',
|
|
62
|
+
onSelect: onSelect,
|
|
63
|
+
title: formatMessage(_messages.toolbarInsertBlockMessages.expand)
|
|
64
|
+
});
|
|
65
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.getExpandQuickInsertComponents = void 0;
|
|
8
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
|
+
var _react = _interopRequireDefault(require("react"));
|
|
10
|
+
var _messages = require("@atlaskit/editor-common/messages");
|
|
11
|
+
var _createQuickInsertMatcher = require("@atlaskit/editor-common/quick-insert/create-quick-insert-matcher");
|
|
12
|
+
var _keys = require("@atlaskit/editor-common/quick-insert/keys");
|
|
13
|
+
var _rank = require("@atlaskit/editor-common/quick-insert/rank");
|
|
14
|
+
var _ExpandQuickInsertMenuItem = require("./ExpandQuickInsertMenuItem");
|
|
15
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
16
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
17
|
+
var getExpandQuickInsertComponents = exports.getExpandQuickInsertComponents = function getExpandQuickInsertComponents(_ref) {
|
|
18
|
+
var api = _ref.api,
|
|
19
|
+
isLegacy = _ref.isLegacy;
|
|
20
|
+
return [{
|
|
21
|
+
key: _keys.EXPAND_MENU_ITEM.key,
|
|
22
|
+
type: _keys.EXPAND_MENU_ITEM.type,
|
|
23
|
+
parents: [_objectSpread(_objectSpread({}, _keys.STRUCTURE_SECTION), {}, {
|
|
24
|
+
rank: _rank.STRUCTURE_SECTION_RANK[_keys.EXPAND_MENU_ITEM.key]
|
|
25
|
+
})],
|
|
26
|
+
match: (0, _createQuickInsertMatcher.createQuickInsertMatcher)(function (_ref2) {
|
|
27
|
+
var formatMessage = _ref2.formatMessage;
|
|
28
|
+
return {
|
|
29
|
+
description: formatMessage(_messages.toolbarInsertBlockMessages.expandDescription),
|
|
30
|
+
keywords: ['accordion', 'collapse'],
|
|
31
|
+
title: formatMessage(_messages.toolbarInsertBlockMessages.expand)
|
|
32
|
+
};
|
|
33
|
+
}),
|
|
34
|
+
component: function component() {
|
|
35
|
+
return /*#__PURE__*/_react.default.createElement(_ExpandQuickInsertMenuItem.ExpandQuickInsertMenuItem, {
|
|
36
|
+
api: api,
|
|
37
|
+
isLegacy: isLegacy
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
}];
|
|
41
|
+
};
|
|
@@ -3,12 +3,14 @@ import { expandWithNestedExpand, nestedExpand } from '@atlaskit/adf-schema';
|
|
|
3
3
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
4
4
|
import { TRANSFORM_STRUCTURE_EXPAND_MENU_ITEM, TRANSFORM_STRUCTURE_MENU_SECTION, TRANSFORM_STRUCTURE_MENU_SECTION_RANK } from '@atlaskit/editor-common/block-menu';
|
|
5
5
|
import { toolbarInsertBlockMessages as messages } from '@atlaskit/editor-common/messages';
|
|
6
|
-
import { IconExpand } from '@atlaskit/editor-common/
|
|
6
|
+
import { IconExpand } from '@atlaskit/editor-common/assets';
|
|
7
|
+
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
7
8
|
import { createWrapSelectionTransaction } from '@atlaskit/editor-common/utils';
|
|
8
9
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
9
10
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
10
11
|
import { toggleExpandRange } from '../editor-commands/toggleExpandRange';
|
|
11
12
|
import { createExpandBlockMenuItem } from '../ui/ExpandBlockMenuItem';
|
|
13
|
+
import { getExpandQuickInsertComponents } from '../ui/quick-insert/getExpandQuickInsertComponents';
|
|
12
14
|
const EXPAND_NODE_NAME = 'expand';
|
|
13
15
|
import { createExpandNode, insertExpand, insertExpandWithInputMethod, toggleExpandWithMatch } from './commands';
|
|
14
16
|
import { expandKeymap } from './pm-plugins/keymap';
|
|
@@ -22,6 +24,7 @@ export let expandPlugin = ({
|
|
|
22
24
|
api
|
|
23
25
|
}) => {
|
|
24
26
|
var _api$analytics, _api$analytics2;
|
|
27
|
+
const isRegisteredSlashCommandEnabled = isExperimentEnabled('platform_editor_slash_command');
|
|
25
28
|
if (editorExperiment('platform_editor_block_menu', true)) {
|
|
26
29
|
var _api$blockMenu;
|
|
27
30
|
api === null || api === void 0 ? void 0 : (_api$blockMenu = api.blockMenu) === null || _api$blockMenu === void 0 ? void 0 : _api$blockMenu.actions.registerBlockMenuComponents([{
|
|
@@ -39,6 +42,13 @@ export let expandPlugin = ({
|
|
|
39
42
|
}
|
|
40
43
|
}]);
|
|
41
44
|
}
|
|
45
|
+
if (isRegisteredSlashCommandEnabled && options.allowInsertion === true) {
|
|
46
|
+
var _api$uiControlRegistr;
|
|
47
|
+
api === null || api === void 0 ? void 0 : (_api$uiControlRegistr = api.uiControlRegistry) === null || _api$uiControlRegistr === void 0 ? void 0 : _api$uiControlRegistr.actions.register(getExpandQuickInsertComponents({
|
|
48
|
+
api,
|
|
49
|
+
isLegacy: true
|
|
50
|
+
}));
|
|
51
|
+
}
|
|
42
52
|
return {
|
|
43
53
|
name: 'expand',
|
|
44
54
|
nodes() {
|
|
@@ -84,42 +94,44 @@ export let expandPlugin = ({
|
|
|
84
94
|
},
|
|
85
95
|
pluginsOptions: {
|
|
86
96
|
floatingToolbar: getToolbarConfig(api),
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
return [{
|
|
94
|
-
id: 'expand',
|
|
95
|
-
title: formatMessage(messages.expand),
|
|
96
|
-
description: formatMessage(messages.expandDescription),
|
|
97
|
-
keywords: ['accordion', 'collapse'],
|
|
98
|
-
priority: 600,
|
|
99
|
-
icon: () => /*#__PURE__*/React.createElement(IconExpand, null),
|
|
100
|
-
action(insert, state) {
|
|
101
|
-
var _api$analytics3;
|
|
102
|
-
const node = createExpandNode(state);
|
|
103
|
-
if (!node) {
|
|
104
|
-
return false;
|
|
105
|
-
}
|
|
106
|
-
const tr = state.selection.empty ? insert(node) : createWrapSelectionTransaction({
|
|
107
|
-
state,
|
|
108
|
-
type: node.type
|
|
109
|
-
});
|
|
110
|
-
api === null || api === void 0 ? void 0 : (_api$analytics3 = api.analytics) === null || _api$analytics3 === void 0 ? void 0 : _api$analytics3.actions.attachAnalyticsEvent({
|
|
111
|
-
action: ACTION.INSERTED,
|
|
112
|
-
actionSubject: ACTION_SUBJECT.DOCUMENT,
|
|
113
|
-
actionSubjectId: node.type === state.schema.nodes.nestedExpand ? ACTION_SUBJECT_ID.NESTED_EXPAND : ACTION_SUBJECT_ID.EXPAND,
|
|
114
|
-
attributes: {
|
|
115
|
-
inputMethod: INPUT_METHOD.QUICK_INSERT
|
|
116
|
-
},
|
|
117
|
-
eventType: EVENT_TYPE.TRACK
|
|
118
|
-
})(tr);
|
|
119
|
-
return tr;
|
|
97
|
+
...(!isRegisteredSlashCommandEnabled && {
|
|
98
|
+
quickInsert: ({
|
|
99
|
+
formatMessage
|
|
100
|
+
}) => {
|
|
101
|
+
if (options && options.allowInsertion !== true) {
|
|
102
|
+
return [];
|
|
120
103
|
}
|
|
121
|
-
|
|
122
|
-
|
|
104
|
+
return [{
|
|
105
|
+
id: 'expand',
|
|
106
|
+
title: formatMessage(messages.expand),
|
|
107
|
+
description: formatMessage(messages.expandDescription),
|
|
108
|
+
keywords: ['accordion', 'collapse'],
|
|
109
|
+
priority: 600,
|
|
110
|
+
icon: () => /*#__PURE__*/React.createElement(IconExpand, null),
|
|
111
|
+
action(insert, state) {
|
|
112
|
+
var _api$analytics3;
|
|
113
|
+
const node = createExpandNode(state);
|
|
114
|
+
if (!node) {
|
|
115
|
+
return false;
|
|
116
|
+
}
|
|
117
|
+
const tr = state.selection.empty ? insert(node) : createWrapSelectionTransaction({
|
|
118
|
+
state,
|
|
119
|
+
type: node.type
|
|
120
|
+
});
|
|
121
|
+
api === null || api === void 0 ? void 0 : (_api$analytics3 = api.analytics) === null || _api$analytics3 === void 0 ? void 0 : _api$analytics3.actions.attachAnalyticsEvent({
|
|
122
|
+
action: ACTION.INSERTED,
|
|
123
|
+
actionSubject: ACTION_SUBJECT.DOCUMENT,
|
|
124
|
+
actionSubjectId: node.type === state.schema.nodes.nestedExpand ? ACTION_SUBJECT_ID.NESTED_EXPAND : ACTION_SUBJECT_ID.EXPAND,
|
|
125
|
+
attributes: {
|
|
126
|
+
inputMethod: INPUT_METHOD.QUICK_INSERT
|
|
127
|
+
},
|
|
128
|
+
eventType: EVENT_TYPE.TRACK
|
|
129
|
+
})(tr);
|
|
130
|
+
return tr;
|
|
131
|
+
}
|
|
132
|
+
}];
|
|
133
|
+
}
|
|
134
|
+
})
|
|
123
135
|
}
|
|
124
136
|
};
|
|
125
137
|
};
|
|
@@ -6,6 +6,8 @@ import { expandedState } from '@atlaskit/editor-common/expand';
|
|
|
6
6
|
import { GapCursorSelection, Side } from '@atlaskit/editor-common/selection';
|
|
7
7
|
import { expandClassNames } from '@atlaskit/editor-common/styles';
|
|
8
8
|
import { findExpand } from '@atlaskit/editor-common/transforms';
|
|
9
|
+
// oxlint-disable-next-line import/no-duplicates
|
|
10
|
+
|
|
9
11
|
import { createWrapSelectionTransaction } from '@atlaskit/editor-common/utils';
|
|
10
12
|
import { Selection, TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
11
13
|
import { findParentNodeOfType, safeInsert } from '@atlaskit/editor-prosemirror/utils';
|
|
@@ -3,13 +3,15 @@ import { expandWithNestedExpand, expandWithNestedExpandLocalId, nestedExpand, ne
|
|
|
3
3
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
4
4
|
import { TRANSFORM_STRUCTURE_EXPAND_MENU_ITEM, TRANSFORM_STRUCTURE_MENU_SECTION, TRANSFORM_STRUCTURE_MENU_SECTION_RANK } from '@atlaskit/editor-common/block-menu';
|
|
5
5
|
import { toolbarInsertBlockMessages as messages } from '@atlaskit/editor-common/messages';
|
|
6
|
-
import { IconExpand } from '@atlaskit/editor-common/
|
|
6
|
+
import { IconExpand } from '@atlaskit/editor-common/assets';
|
|
7
7
|
import { createWrapSelectionTransaction } from '@atlaskit/editor-common/utils';
|
|
8
|
-
import {
|
|
8
|
+
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
9
|
+
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
9
10
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
10
11
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
11
12
|
import { toggleExpandRange } from '../editor-commands/toggleExpandRange';
|
|
12
13
|
import { createExpandBlockMenuItem } from '../ui/ExpandBlockMenuItem';
|
|
14
|
+
import { getExpandQuickInsertComponents } from '../ui/quick-insert/getExpandQuickInsertComponents';
|
|
13
15
|
const EXPAND_NODE_NAME = 'expand';
|
|
14
16
|
import { createExpandNode, insertExpand, insertExpandWithInputMethod, toggleExpandWithMatch, wrapSelectionAndSetExpandedState } from './commands';
|
|
15
17
|
import { expandKeymap } from './pm-plugins/keymap';
|
|
@@ -22,6 +24,7 @@ export let expandPlugin = ({
|
|
|
22
24
|
config: options = {},
|
|
23
25
|
api
|
|
24
26
|
}) => {
|
|
27
|
+
const isRegisteredSlashCommandEnabled = isExperimentEnabled('platform_editor_slash_command');
|
|
25
28
|
if (editorExperiment('platform_editor_block_menu', true)) {
|
|
26
29
|
var _api$blockMenu;
|
|
27
30
|
api === null || api === void 0 ? void 0 : (_api$blockMenu = api.blockMenu) === null || _api$blockMenu === void 0 ? void 0 : _api$blockMenu.actions.registerBlockMenuComponents([{
|
|
@@ -39,6 +42,13 @@ export let expandPlugin = ({
|
|
|
39
42
|
}
|
|
40
43
|
}]);
|
|
41
44
|
}
|
|
45
|
+
if (isRegisteredSlashCommandEnabled && options.allowInsertion === true) {
|
|
46
|
+
var _api$uiControlRegistr;
|
|
47
|
+
api === null || api === void 0 ? void 0 : (_api$uiControlRegistr = api.uiControlRegistry) === null || _api$uiControlRegistr === void 0 ? void 0 : _api$uiControlRegistr.actions.register(getExpandQuickInsertComponents({
|
|
48
|
+
api,
|
|
49
|
+
isLegacy: false
|
|
50
|
+
}));
|
|
51
|
+
}
|
|
42
52
|
return {
|
|
43
53
|
name: 'expand',
|
|
44
54
|
nodes() {
|
|
@@ -82,42 +92,44 @@ export let expandPlugin = ({
|
|
|
82
92
|
},
|
|
83
93
|
pluginsOptions: {
|
|
84
94
|
floatingToolbar: getToolbarConfig(api),
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
return [{
|
|
92
|
-
id: 'expand',
|
|
93
|
-
title: formatMessage(messages.expand),
|
|
94
|
-
description: formatMessage(messages.expandDescription),
|
|
95
|
-
keywords: ['accordion', 'collapse'],
|
|
96
|
-
priority: 600,
|
|
97
|
-
icon: () => /*#__PURE__*/React.createElement(IconExpand, null),
|
|
98
|
-
action(insert, state, source) {
|
|
99
|
-
var _api$analytics;
|
|
100
|
-
const node = createExpandNode(state, undefined, !!(api !== null && api !== void 0 && api.localId));
|
|
101
|
-
if (!node) {
|
|
102
|
-
return false;
|
|
103
|
-
}
|
|
104
|
-
const tr = state.selection.empty ? insert(node) : fg('platform_editor_adf_with_localid') ? wrapSelectionAndSetExpandedState(state, node) : createWrapSelectionTransaction({
|
|
105
|
-
state,
|
|
106
|
-
type: node.type
|
|
107
|
-
});
|
|
108
|
-
api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions.attachAnalyticsEvent({
|
|
109
|
-
action: ACTION.INSERTED,
|
|
110
|
-
actionSubject: ACTION_SUBJECT.DOCUMENT,
|
|
111
|
-
actionSubjectId: node.type === state.schema.nodes.nestedExpand ? ACTION_SUBJECT_ID.NESTED_EXPAND : ACTION_SUBJECT_ID.EXPAND,
|
|
112
|
-
attributes: {
|
|
113
|
-
inputMethod: source !== null && source !== void 0 ? source : INPUT_METHOD.QUICK_INSERT
|
|
114
|
-
},
|
|
115
|
-
eventType: EVENT_TYPE.TRACK
|
|
116
|
-
})(tr);
|
|
117
|
-
return tr;
|
|
95
|
+
...(!isRegisteredSlashCommandEnabled && {
|
|
96
|
+
quickInsert: ({
|
|
97
|
+
formatMessage
|
|
98
|
+
}) => {
|
|
99
|
+
if (options && options.allowInsertion !== true) {
|
|
100
|
+
return [];
|
|
118
101
|
}
|
|
119
|
-
|
|
120
|
-
|
|
102
|
+
return [{
|
|
103
|
+
id: 'expand',
|
|
104
|
+
title: formatMessage(messages.expand),
|
|
105
|
+
description: formatMessage(messages.expandDescription),
|
|
106
|
+
keywords: ['accordion', 'collapse'],
|
|
107
|
+
priority: 600,
|
|
108
|
+
icon: () => /*#__PURE__*/React.createElement(IconExpand, null),
|
|
109
|
+
action(insert, state, source) {
|
|
110
|
+
var _api$analytics;
|
|
111
|
+
const node = createExpandNode(state, undefined, !!(api !== null && api !== void 0 && api.localId));
|
|
112
|
+
if (!node) {
|
|
113
|
+
return false;
|
|
114
|
+
}
|
|
115
|
+
const tr = state.selection.empty ? insert(node) : fg('platform_editor_adf_with_localid') ? wrapSelectionAndSetExpandedState(state, node) : createWrapSelectionTransaction({
|
|
116
|
+
state,
|
|
117
|
+
type: node.type
|
|
118
|
+
});
|
|
119
|
+
api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions.attachAnalyticsEvent({
|
|
120
|
+
action: ACTION.INSERTED,
|
|
121
|
+
actionSubject: ACTION_SUBJECT.DOCUMENT,
|
|
122
|
+
actionSubjectId: node.type === state.schema.nodes.nestedExpand ? ACTION_SUBJECT_ID.NESTED_EXPAND : ACTION_SUBJECT_ID.EXPAND,
|
|
123
|
+
attributes: {
|
|
124
|
+
inputMethod: source !== null && source !== void 0 ? source : INPUT_METHOD.QUICK_INSERT
|
|
125
|
+
},
|
|
126
|
+
eventType: EVENT_TYPE.TRACK
|
|
127
|
+
})(tr);
|
|
128
|
+
return tr;
|
|
129
|
+
}
|
|
130
|
+
}];
|
|
131
|
+
}
|
|
132
|
+
})
|
|
121
133
|
}
|
|
122
134
|
};
|
|
123
135
|
};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import React, { useCallback } from 'react';
|
|
2
|
+
import { useIntl } from 'react-intl';
|
|
3
|
+
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
4
|
+
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
5
|
+
import { toolbarInsertBlockMessages as messages } from '@atlaskit/editor-common/messages';
|
|
6
|
+
import { IconExpand } from '@atlaskit/editor-common/assets';
|
|
7
|
+
import { QuickInsertMenuItem } from '@atlaskit/editor-common/quick-insert/menu-item';
|
|
8
|
+
import { createWrapSelectionTransaction } from '@atlaskit/editor-common/utils';
|
|
9
|
+
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
10
|
+
import { createExpandNode as createLegacyExpandNode } from '../../legacyExpand/commands';
|
|
11
|
+
import { createExpandNode as createSinglePlayerExpandNode, wrapSelectionAndSetExpandedState } from '../../singlePlayerExpand/commands';
|
|
12
|
+
export const ExpandQuickInsertMenuItem = ({
|
|
13
|
+
api,
|
|
14
|
+
isLegacy
|
|
15
|
+
}) => {
|
|
16
|
+
const {
|
|
17
|
+
formatMessage
|
|
18
|
+
} = useIntl();
|
|
19
|
+
const {
|
|
20
|
+
editorDisabled,
|
|
21
|
+
mode
|
|
22
|
+
} = useSharedPluginStateWithSelector(api, ['editorDisabled', 'editorViewMode'], states => {
|
|
23
|
+
var _states$editorDisable, _states$editorViewMod;
|
|
24
|
+
return {
|
|
25
|
+
editorDisabled: (_states$editorDisable = states.editorDisabledState) === null || _states$editorDisable === void 0 ? void 0 : _states$editorDisable.editorDisabled,
|
|
26
|
+
mode: (_states$editorViewMod = states.editorViewModeState) === null || _states$editorViewMod === void 0 ? void 0 : _states$editorViewMod.mode
|
|
27
|
+
};
|
|
28
|
+
});
|
|
29
|
+
const onSelect = useCallback(({
|
|
30
|
+
editorView,
|
|
31
|
+
insert,
|
|
32
|
+
source
|
|
33
|
+
}) => {
|
|
34
|
+
var _api$analytics;
|
|
35
|
+
const {
|
|
36
|
+
state
|
|
37
|
+
} = editorView;
|
|
38
|
+
const node = isLegacy ? createLegacyExpandNode(state) : createSinglePlayerExpandNode(state, undefined, !!(api !== null && api !== void 0 && api.localId));
|
|
39
|
+
if (!node) {
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
42
|
+
const tr = state.selection.empty ? insert(node) : isLegacy || !fg('platform_editor_adf_with_localid') ? createWrapSelectionTransaction({
|
|
43
|
+
state,
|
|
44
|
+
type: node.type
|
|
45
|
+
}) : wrapSelectionAndSetExpandedState(state, node);
|
|
46
|
+
api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions.attachAnalyticsEvent({
|
|
47
|
+
action: ACTION.INSERTED,
|
|
48
|
+
actionSubject: ACTION_SUBJECT.DOCUMENT,
|
|
49
|
+
actionSubjectId: node.type === state.schema.nodes.nestedExpand ? ACTION_SUBJECT_ID.NESTED_EXPAND : ACTION_SUBJECT_ID.EXPAND,
|
|
50
|
+
attributes: {
|
|
51
|
+
inputMethod: isLegacy ? INPUT_METHOD.QUICK_INSERT : source
|
|
52
|
+
},
|
|
53
|
+
eventType: EVENT_TYPE.TRACK
|
|
54
|
+
})(tr);
|
|
55
|
+
return tr;
|
|
56
|
+
}, [api, isLegacy]);
|
|
57
|
+
return /*#__PURE__*/React.createElement(QuickInsertMenuItem, {
|
|
58
|
+
iconBefore: /*#__PURE__*/React.createElement(IconExpand, null),
|
|
59
|
+
isDisabled: editorDisabled || mode === 'view',
|
|
60
|
+
onSelect: onSelect,
|
|
61
|
+
title: formatMessage(messages.expand)
|
|
62
|
+
});
|
|
63
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { toolbarInsertBlockMessages as messages } from '@atlaskit/editor-common/messages';
|
|
3
|
+
import { createQuickInsertMatcher } from '@atlaskit/editor-common/quick-insert/create-quick-insert-matcher';
|
|
4
|
+
import { EXPAND_MENU_ITEM, STRUCTURE_SECTION } from '@atlaskit/editor-common/quick-insert/keys';
|
|
5
|
+
import { STRUCTURE_SECTION_RANK } from '@atlaskit/editor-common/quick-insert/rank';
|
|
6
|
+
import { ExpandQuickInsertMenuItem } from './ExpandQuickInsertMenuItem';
|
|
7
|
+
export const getExpandQuickInsertComponents = ({
|
|
8
|
+
api,
|
|
9
|
+
isLegacy
|
|
10
|
+
}) => [{
|
|
11
|
+
key: EXPAND_MENU_ITEM.key,
|
|
12
|
+
type: EXPAND_MENU_ITEM.type,
|
|
13
|
+
parents: [{
|
|
14
|
+
...STRUCTURE_SECTION,
|
|
15
|
+
rank: STRUCTURE_SECTION_RANK[EXPAND_MENU_ITEM.key]
|
|
16
|
+
}],
|
|
17
|
+
match: createQuickInsertMatcher(({
|
|
18
|
+
formatMessage
|
|
19
|
+
}) => ({
|
|
20
|
+
description: formatMessage(messages.expandDescription),
|
|
21
|
+
keywords: ['accordion', 'collapse'],
|
|
22
|
+
title: formatMessage(messages.expand)
|
|
23
|
+
})),
|
|
24
|
+
component: () => /*#__PURE__*/React.createElement(ExpandQuickInsertMenuItem, {
|
|
25
|
+
api: api,
|
|
26
|
+
isLegacy: isLegacy
|
|
27
|
+
})
|
|
28
|
+
}];
|
|
@@ -1,14 +1,19 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
1
4
|
import React from 'react';
|
|
2
5
|
import { expandWithNestedExpand, nestedExpand } from '@atlaskit/adf-schema';
|
|
3
6
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
4
7
|
import { TRANSFORM_STRUCTURE_EXPAND_MENU_ITEM, TRANSFORM_STRUCTURE_MENU_SECTION, TRANSFORM_STRUCTURE_MENU_SECTION_RANK } from '@atlaskit/editor-common/block-menu';
|
|
5
8
|
import { toolbarInsertBlockMessages as messages } from '@atlaskit/editor-common/messages';
|
|
6
|
-
import { IconExpand } from '@atlaskit/editor-common/
|
|
9
|
+
import { IconExpand } from '@atlaskit/editor-common/assets';
|
|
10
|
+
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
7
11
|
import { createWrapSelectionTransaction } from '@atlaskit/editor-common/utils';
|
|
8
12
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
9
13
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
10
14
|
import { toggleExpandRange } from '../editor-commands/toggleExpandRange';
|
|
11
15
|
import { createExpandBlockMenuItem } from '../ui/ExpandBlockMenuItem';
|
|
16
|
+
import { getExpandQuickInsertComponents } from '../ui/quick-insert/getExpandQuickInsertComponents';
|
|
12
17
|
var EXPAND_NODE_NAME = 'expand';
|
|
13
18
|
import { createExpandNode, insertExpand, insertExpandWithInputMethod, toggleExpandWithMatch as _toggleExpandWithMatch } from './commands';
|
|
14
19
|
import { expandKeymap } from './pm-plugins/keymap';
|
|
@@ -22,6 +27,7 @@ export var expandPlugin = function expandPlugin(_ref) {
|
|
|
22
27
|
var _ref$config = _ref.config,
|
|
23
28
|
options = _ref$config === void 0 ? {} : _ref$config,
|
|
24
29
|
api = _ref.api;
|
|
30
|
+
var isRegisteredSlashCommandEnabled = isExperimentEnabled('platform_editor_slash_command');
|
|
25
31
|
if (editorExperiment('platform_editor_block_menu', true)) {
|
|
26
32
|
var _api$blockMenu;
|
|
27
33
|
api === null || api === void 0 || (_api$blockMenu = api.blockMenu) === null || _api$blockMenu === void 0 || _api$blockMenu.actions.registerBlockMenuComponents([{
|
|
@@ -39,6 +45,13 @@ export var expandPlugin = function expandPlugin(_ref) {
|
|
|
39
45
|
}
|
|
40
46
|
}]);
|
|
41
47
|
}
|
|
48
|
+
if (isRegisteredSlashCommandEnabled && options.allowInsertion === true) {
|
|
49
|
+
var _api$uiControlRegistr;
|
|
50
|
+
api === null || api === void 0 || (_api$uiControlRegistr = api.uiControlRegistry) === null || _api$uiControlRegistr === void 0 || _api$uiControlRegistr.actions.register(getExpandQuickInsertComponents({
|
|
51
|
+
api: api,
|
|
52
|
+
isLegacy: true
|
|
53
|
+
}));
|
|
54
|
+
}
|
|
42
55
|
return {
|
|
43
56
|
name: 'expand',
|
|
44
57
|
nodes: function nodes() {
|
|
@@ -85,8 +98,9 @@ export var expandPlugin = function expandPlugin(_ref) {
|
|
|
85
98
|
}
|
|
86
99
|
}];
|
|
87
100
|
},
|
|
88
|
-
pluginsOptions: {
|
|
89
|
-
floatingToolbar: getToolbarConfig(api)
|
|
101
|
+
pluginsOptions: _objectSpread({
|
|
102
|
+
floatingToolbar: getToolbarConfig(api)
|
|
103
|
+
}, !isRegisteredSlashCommandEnabled && {
|
|
90
104
|
quickInsert: function quickInsert(_ref3) {
|
|
91
105
|
var formatMessage = _ref3.formatMessage;
|
|
92
106
|
if (options && options.allowInsertion !== true) {
|
|
@@ -124,6 +138,6 @@ export var expandPlugin = function expandPlugin(_ref) {
|
|
|
124
138
|
}
|
|
125
139
|
}];
|
|
126
140
|
}
|
|
127
|
-
}
|
|
141
|
+
})
|
|
128
142
|
};
|
|
129
143
|
};
|
|
@@ -9,6 +9,8 @@ import { expandedState } from '@atlaskit/editor-common/expand';
|
|
|
9
9
|
import { GapCursorSelection, Side } from '@atlaskit/editor-common/selection';
|
|
10
10
|
import { expandClassNames } from '@atlaskit/editor-common/styles';
|
|
11
11
|
import { findExpand } from '@atlaskit/editor-common/transforms';
|
|
12
|
+
// oxlint-disable-next-line import/no-duplicates
|
|
13
|
+
|
|
12
14
|
import { createWrapSelectionTransaction } from '@atlaskit/editor-common/utils';
|
|
13
15
|
import { Selection, TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
14
16
|
import { findParentNodeOfType, safeInsert } from '@atlaskit/editor-prosemirror/utils';
|
|
@@ -1,15 +1,20 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
1
4
|
import React from 'react';
|
|
2
5
|
import { expandWithNestedExpand, expandWithNestedExpandLocalId, nestedExpand, nestedExpandWithLocalId } from '@atlaskit/adf-schema';
|
|
3
6
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
4
7
|
import { TRANSFORM_STRUCTURE_EXPAND_MENU_ITEM, TRANSFORM_STRUCTURE_MENU_SECTION, TRANSFORM_STRUCTURE_MENU_SECTION_RANK } from '@atlaskit/editor-common/block-menu';
|
|
5
8
|
import { toolbarInsertBlockMessages as messages } from '@atlaskit/editor-common/messages';
|
|
6
|
-
import { IconExpand } from '@atlaskit/editor-common/
|
|
9
|
+
import { IconExpand } from '@atlaskit/editor-common/assets';
|
|
7
10
|
import { createWrapSelectionTransaction } from '@atlaskit/editor-common/utils';
|
|
8
|
-
import {
|
|
11
|
+
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
12
|
+
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
9
13
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
10
14
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
11
15
|
import { toggleExpandRange } from '../editor-commands/toggleExpandRange';
|
|
12
16
|
import { createExpandBlockMenuItem } from '../ui/ExpandBlockMenuItem';
|
|
17
|
+
import { getExpandQuickInsertComponents } from '../ui/quick-insert/getExpandQuickInsertComponents';
|
|
13
18
|
var EXPAND_NODE_NAME = 'expand';
|
|
14
19
|
import { createExpandNode, insertExpand, insertExpandWithInputMethod, toggleExpandWithMatch as _toggleExpandWithMatch, wrapSelectionAndSetExpandedState } from './commands';
|
|
15
20
|
import { expandKeymap } from './pm-plugins/keymap';
|
|
@@ -22,6 +27,7 @@ export var expandPlugin = function expandPlugin(_ref) {
|
|
|
22
27
|
var _ref$config = _ref.config,
|
|
23
28
|
options = _ref$config === void 0 ? {} : _ref$config,
|
|
24
29
|
api = _ref.api;
|
|
30
|
+
var isRegisteredSlashCommandEnabled = isExperimentEnabled('platform_editor_slash_command');
|
|
25
31
|
if (editorExperiment('platform_editor_block_menu', true)) {
|
|
26
32
|
var _api$blockMenu;
|
|
27
33
|
api === null || api === void 0 || (_api$blockMenu = api.blockMenu) === null || _api$blockMenu === void 0 || _api$blockMenu.actions.registerBlockMenuComponents([{
|
|
@@ -39,6 +45,13 @@ export var expandPlugin = function expandPlugin(_ref) {
|
|
|
39
45
|
}
|
|
40
46
|
}]);
|
|
41
47
|
}
|
|
48
|
+
if (isRegisteredSlashCommandEnabled && options.allowInsertion === true) {
|
|
49
|
+
var _api$uiControlRegistr;
|
|
50
|
+
api === null || api === void 0 || (_api$uiControlRegistr = api.uiControlRegistry) === null || _api$uiControlRegistr === void 0 || _api$uiControlRegistr.actions.register(getExpandQuickInsertComponents({
|
|
51
|
+
api: api,
|
|
52
|
+
isLegacy: false
|
|
53
|
+
}));
|
|
54
|
+
}
|
|
42
55
|
return {
|
|
43
56
|
name: 'expand',
|
|
44
57
|
nodes: function nodes() {
|
|
@@ -83,8 +96,9 @@ export var expandPlugin = function expandPlugin(_ref) {
|
|
|
83
96
|
}
|
|
84
97
|
}];
|
|
85
98
|
},
|
|
86
|
-
pluginsOptions: {
|
|
87
|
-
floatingToolbar: getToolbarConfig(api)
|
|
99
|
+
pluginsOptions: _objectSpread({
|
|
100
|
+
floatingToolbar: getToolbarConfig(api)
|
|
101
|
+
}, !isRegisteredSlashCommandEnabled && {
|
|
88
102
|
quickInsert: function quickInsert(_ref3) {
|
|
89
103
|
var formatMessage = _ref3.formatMessage;
|
|
90
104
|
if (options && options.allowInsertion !== true) {
|
|
@@ -122,6 +136,6 @@ export var expandPlugin = function expandPlugin(_ref) {
|
|
|
122
136
|
}
|
|
123
137
|
}];
|
|
124
138
|
}
|
|
125
|
-
}
|
|
139
|
+
})
|
|
126
140
|
};
|
|
127
141
|
};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import React, { useCallback } from 'react';
|
|
2
|
+
import { useIntl } from 'react-intl';
|
|
3
|
+
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
4
|
+
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
5
|
+
import { toolbarInsertBlockMessages as messages } from '@atlaskit/editor-common/messages';
|
|
6
|
+
import { IconExpand } from '@atlaskit/editor-common/assets';
|
|
7
|
+
import { QuickInsertMenuItem } from '@atlaskit/editor-common/quick-insert/menu-item';
|
|
8
|
+
import { createWrapSelectionTransaction } from '@atlaskit/editor-common/utils';
|
|
9
|
+
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
10
|
+
import { createExpandNode as createLegacyExpandNode } from '../../legacyExpand/commands';
|
|
11
|
+
import { createExpandNode as createSinglePlayerExpandNode, wrapSelectionAndSetExpandedState } from '../../singlePlayerExpand/commands';
|
|
12
|
+
export var ExpandQuickInsertMenuItem = function ExpandQuickInsertMenuItem(_ref) {
|
|
13
|
+
var api = _ref.api,
|
|
14
|
+
isLegacy = _ref.isLegacy;
|
|
15
|
+
var _useIntl = useIntl(),
|
|
16
|
+
formatMessage = _useIntl.formatMessage;
|
|
17
|
+
var _useSharedPluginState = useSharedPluginStateWithSelector(api, ['editorDisabled', 'editorViewMode'], function (states) {
|
|
18
|
+
var _states$editorDisable, _states$editorViewMod;
|
|
19
|
+
return {
|
|
20
|
+
editorDisabled: (_states$editorDisable = states.editorDisabledState) === null || _states$editorDisable === void 0 ? void 0 : _states$editorDisable.editorDisabled,
|
|
21
|
+
mode: (_states$editorViewMod = states.editorViewModeState) === null || _states$editorViewMod === void 0 ? void 0 : _states$editorViewMod.mode
|
|
22
|
+
};
|
|
23
|
+
}),
|
|
24
|
+
editorDisabled = _useSharedPluginState.editorDisabled,
|
|
25
|
+
mode = _useSharedPluginState.mode;
|
|
26
|
+
var onSelect = useCallback(function (_ref2) {
|
|
27
|
+
var _api$analytics;
|
|
28
|
+
var editorView = _ref2.editorView,
|
|
29
|
+
insert = _ref2.insert,
|
|
30
|
+
source = _ref2.source;
|
|
31
|
+
var state = editorView.state;
|
|
32
|
+
var node = isLegacy ? createLegacyExpandNode(state) : createSinglePlayerExpandNode(state, undefined, !!(api !== null && api !== void 0 && api.localId));
|
|
33
|
+
if (!node) {
|
|
34
|
+
return false;
|
|
35
|
+
}
|
|
36
|
+
var tr = state.selection.empty ? insert(node) : isLegacy || !fg('platform_editor_adf_with_localid') ? createWrapSelectionTransaction({
|
|
37
|
+
state: state,
|
|
38
|
+
type: node.type
|
|
39
|
+
}) : wrapSelectionAndSetExpandedState(state, node);
|
|
40
|
+
api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 || _api$analytics.actions.attachAnalyticsEvent({
|
|
41
|
+
action: ACTION.INSERTED,
|
|
42
|
+
actionSubject: ACTION_SUBJECT.DOCUMENT,
|
|
43
|
+
actionSubjectId: node.type === state.schema.nodes.nestedExpand ? ACTION_SUBJECT_ID.NESTED_EXPAND : ACTION_SUBJECT_ID.EXPAND,
|
|
44
|
+
attributes: {
|
|
45
|
+
inputMethod: isLegacy ? INPUT_METHOD.QUICK_INSERT : source
|
|
46
|
+
},
|
|
47
|
+
eventType: EVENT_TYPE.TRACK
|
|
48
|
+
})(tr);
|
|
49
|
+
return tr;
|
|
50
|
+
}, [api, isLegacy]);
|
|
51
|
+
return /*#__PURE__*/React.createElement(QuickInsertMenuItem, {
|
|
52
|
+
iconBefore: /*#__PURE__*/React.createElement(IconExpand, null),
|
|
53
|
+
isDisabled: editorDisabled || mode === 'view',
|
|
54
|
+
onSelect: onSelect,
|
|
55
|
+
title: formatMessage(messages.expand)
|
|
56
|
+
});
|
|
57
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import { toolbarInsertBlockMessages as messages } from '@atlaskit/editor-common/messages';
|
|
6
|
+
import { createQuickInsertMatcher } from '@atlaskit/editor-common/quick-insert/create-quick-insert-matcher';
|
|
7
|
+
import { EXPAND_MENU_ITEM, STRUCTURE_SECTION } from '@atlaskit/editor-common/quick-insert/keys';
|
|
8
|
+
import { STRUCTURE_SECTION_RANK } from '@atlaskit/editor-common/quick-insert/rank';
|
|
9
|
+
import { ExpandQuickInsertMenuItem } from './ExpandQuickInsertMenuItem';
|
|
10
|
+
export var getExpandQuickInsertComponents = function getExpandQuickInsertComponents(_ref) {
|
|
11
|
+
var api = _ref.api,
|
|
12
|
+
isLegacy = _ref.isLegacy;
|
|
13
|
+
return [{
|
|
14
|
+
key: EXPAND_MENU_ITEM.key,
|
|
15
|
+
type: EXPAND_MENU_ITEM.type,
|
|
16
|
+
parents: [_objectSpread(_objectSpread({}, STRUCTURE_SECTION), {}, {
|
|
17
|
+
rank: STRUCTURE_SECTION_RANK[EXPAND_MENU_ITEM.key]
|
|
18
|
+
})],
|
|
19
|
+
match: createQuickInsertMatcher(function (_ref2) {
|
|
20
|
+
var formatMessage = _ref2.formatMessage;
|
|
21
|
+
return {
|
|
22
|
+
description: formatMessage(messages.expandDescription),
|
|
23
|
+
keywords: ['accordion', 'collapse'],
|
|
24
|
+
title: formatMessage(messages.expand)
|
|
25
|
+
};
|
|
26
|
+
}),
|
|
27
|
+
component: function component() {
|
|
28
|
+
return /*#__PURE__*/React.createElement(ExpandQuickInsertMenuItem, {
|
|
29
|
+
api: api,
|
|
30
|
+
isLegacy: isLegacy
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
}];
|
|
34
|
+
};
|
package/dist/types/types.d.ts
CHANGED
|
@@ -9,6 +9,7 @@ import type { EditorViewModePlugin } from '@atlaskit/editor-plugin-editor-viewmo
|
|
|
9
9
|
import type { FeatureFlagsPlugin } from '@atlaskit/editor-plugin-feature-flags';
|
|
10
10
|
import type { LimitedModePlugin } from '@atlaskit/editor-plugin-limited-mode/limited-mode-plugin-type';
|
|
11
11
|
import type { LocalIdPlugin } from '@atlaskit/editor-plugin-local-id';
|
|
12
|
+
import type { UiControlRegistryPlugin } from '@atlaskit/editor-plugin-ui-control-registry';
|
|
12
13
|
import type { SelectionPlugin } from '@atlaskit/editor-plugin-selection';
|
|
13
14
|
import type { SelectionMarkerPlugin } from '@atlaskit/editor-plugin-selection-marker';
|
|
14
15
|
import type { Selection } from '@atlaskit/editor-prosemirror/state';
|
|
@@ -57,7 +58,8 @@ export type ExpandPluginDependencies = [
|
|
|
57
58
|
OptionalPlugin<LimitedModePlugin>,
|
|
58
59
|
OptionalPlugin<BlockMenuPlugin>,
|
|
59
60
|
OptionalPlugin<LocalIdPlugin>,
|
|
60
|
-
OptionalPlugin<BlockControlsPlugin
|
|
61
|
+
OptionalPlugin<BlockControlsPlugin>,
|
|
62
|
+
OptionalPlugin<UiControlRegistryPlugin>
|
|
61
63
|
];
|
|
62
64
|
export type ExpandPlugin = NextEditorPlugin<'expand', {
|
|
63
65
|
actions: {
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
3
|
+
import type { ExpandPlugin } from '../../types';
|
|
4
|
+
type Props = {
|
|
5
|
+
api: ExtractInjectionAPI<ExpandPlugin> | undefined;
|
|
6
|
+
isLegacy: boolean;
|
|
7
|
+
};
|
|
8
|
+
export declare const ExpandQuickInsertMenuItem: ({ api, isLegacy }: Props) => React.JSX.Element;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
2
|
+
import type { RegisterMenuItem } from '@atlaskit/editor-ui-control-model/types';
|
|
3
|
+
import type { ExpandPlugin } from '../../types';
|
|
4
|
+
export declare const getExpandQuickInsertComponents: ({ api, isLegacy, }: {
|
|
5
|
+
api: ExtractInjectionAPI<ExpandPlugin> | undefined;
|
|
6
|
+
isLegacy: boolean;
|
|
7
|
+
}) => RegisterMenuItem[];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-expand",
|
|
3
|
-
"version": "16.0.
|
|
3
|
+
"version": "16.0.2",
|
|
4
4
|
"description": "Expand plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
],
|
|
22
22
|
"atlaskit:src": "src/index.ts",
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@atlaskit/adf-schema": "^
|
|
24
|
+
"@atlaskit/adf-schema": "^57.0.0",
|
|
25
25
|
"@atlaskit/button": "^25.0.0",
|
|
26
26
|
"@atlaskit/editor-plugin-analytics": "^15.0.0",
|
|
27
27
|
"@atlaskit/editor-plugin-block-controls": "^16.0.0",
|
|
@@ -37,6 +37,7 @@
|
|
|
37
37
|
"@atlaskit/editor-shared-styles": "^4.0.0",
|
|
38
38
|
"@atlaskit/editor-tables": "^3.0.0",
|
|
39
39
|
"@atlaskit/editor-toolbar": "^2.4.0",
|
|
40
|
+
"@atlaskit/editor-ui-control-model": "^2.6.0",
|
|
40
41
|
"@atlaskit/icon": "^37.3.0",
|
|
41
42
|
"@atlaskit/icon-lab": "^7.5.0",
|
|
42
43
|
"@atlaskit/platform-feature-experiments": "^0.3.0",
|
|
@@ -51,7 +52,7 @@
|
|
|
51
52
|
"w3c-keyname": "^2.1.8"
|
|
52
53
|
},
|
|
53
54
|
"peerDependencies": {
|
|
54
|
-
"@atlaskit/editor-common": "^119.
|
|
55
|
+
"@atlaskit/editor-common": "^119.4.0",
|
|
55
56
|
"react": "^18.2.0 || ^19.2.0",
|
|
56
57
|
"react-dom": "^18.2.0 || ^19.2.0",
|
|
57
58
|
"react-intl": "^5.25.1 || ^6.0.0 || ^7.0.0"
|