@atlaskit/editor-plugin-status 17.2.5 → 17.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +20 -0
- package/dist/cjs/pm-plugins/actions.js +4 -15
- package/dist/cjs/statusPlugin.js +22 -0
- package/dist/cjs/ui/ContentComponent.js +2 -2
- package/dist/cjs/ui/statusBlockMenuItem.js +63 -0
- package/dist/cjs/ui/statusPicker.js +9 -9
- package/dist/cjs/utils/createStatusNode.js +31 -0
- package/dist/cjs/utils/turnInto.js +29 -0
- package/dist/es2019/pm-plugins/actions.js +3 -15
- package/dist/es2019/statusPlugin.js +22 -0
- package/dist/es2019/ui/ContentComponent.js +2 -2
- package/dist/es2019/ui/statusBlockMenuItem.js +55 -0
- package/dist/es2019/ui/statusPicker.js +7 -7
- package/dist/es2019/utils/createStatusNode.js +17 -0
- package/dist/es2019/utils/turnInto.js +21 -0
- package/dist/esm/pm-plugins/actions.js +3 -14
- package/dist/esm/statusPlugin.js +22 -0
- package/dist/esm/ui/ContentComponent.js +2 -2
- package/dist/esm/ui/statusBlockMenuItem.js +56 -0
- package/dist/esm/ui/statusPicker.js +7 -7
- package/dist/esm/utils/createStatusNode.js +24 -0
- package/dist/esm/utils/turnInto.js +23 -0
- package/dist/types/pm-plugins/actions.d.ts +0 -2
- package/dist/types/statusPluginType.d.ts +7 -1
- package/dist/types/ui/statusBlockMenuItem.d.ts +5 -0
- package/dist/types/utils/createStatusNode.d.ts +6 -0
- package/dist/types/utils/turnInto.d.ts +4 -0
- package/package.json +9 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-status
|
|
2
2
|
|
|
3
|
+
## 17.3.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`c7130b14cc4b2`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/c7130b14cc4b2) -
|
|
8
|
+
[ux] Add Status to the block menu Turn into list behind platform_editor_turn_into_status.
|
|
9
|
+
|
|
10
|
+
### Patch Changes
|
|
11
|
+
|
|
12
|
+
- Updated dependencies
|
|
13
|
+
|
|
14
|
+
## 17.2.6
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- [`a6c26b16402ca`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/a6c26b16402ca) -
|
|
19
|
+
Migrate nine dogfooding editor experiments from `@atlaskit/tmp-editor-statsig` to the Platform
|
|
20
|
+
experiment API and move their tests to Platform experiment mocks.
|
|
21
|
+
- Updated dependencies
|
|
22
|
+
|
|
3
23
|
## 17.2.5
|
|
4
24
|
|
|
5
25
|
### Patch Changes
|
|
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.verifyAndInsertStatus = exports.updateStatusWithAnalytics = exports.updateStatus = exports.setStatusPickerAt = exports.setFocusOnStatusInput = exports.removeStatus = exports.insertStatus = exports.createStatus = exports.commitStatusPicker =
|
|
7
|
+
exports.verifyAndInsertStatus = exports.updateStatusWithAnalytics = exports.updateStatus = exports.setStatusPickerAt = exports.setFocusOnStatusInput = exports.removeStatus = exports.insertStatus = exports.createStatus = exports.commitStatusPicker = void 0;
|
|
8
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
9
|
var _uuid = require("@atlaskit/adf-schema/uuid");
|
|
10
10
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
@@ -13,19 +13,10 @@ var _utils = require("@atlaskit/editor-common/utils");
|
|
|
13
13
|
var _model = require("@atlaskit/editor-prosemirror/model");
|
|
14
14
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
15
15
|
var _utils2 = require("@atlaskit/editor-prosemirror/utils");
|
|
16
|
-
var
|
|
16
|
+
var _createStatusNode = require("../utils/createStatusNode");
|
|
17
17
|
var _pluginKey = require("./plugin-key");
|
|
18
18
|
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; }
|
|
19
19
|
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; } // oxlint-disable-next-line import/no-duplicates
|
|
20
|
-
var DEFAULT_STATUS = exports.DEFAULT_STATUS = {
|
|
21
|
-
text: '',
|
|
22
|
-
color: 'neutral'
|
|
23
|
-
};
|
|
24
|
-
var DEFAULT_STATUS_NEW = exports.DEFAULT_STATUS_NEW = {
|
|
25
|
-
text: '',
|
|
26
|
-
color: 'neutral',
|
|
27
|
-
style: 'mixedCase'
|
|
28
|
-
};
|
|
29
20
|
var verifyAndInsertStatus = exports.verifyAndInsertStatus = function verifyAndInsertStatus(statusNode, tr, annotationMarks) {
|
|
30
21
|
var fragment = _model.Fragment.fromArray([statusNode, tr.doc.type.schema.text(' ', annotationMarks)]);
|
|
31
22
|
var insertable = (0, _utils2.canInsert)(tr.selection.$from, fragment);
|
|
@@ -42,9 +33,7 @@ var verifyAndInsertStatus = exports.verifyAndInsertStatus = function verifyAndIn
|
|
|
42
33
|
};
|
|
43
34
|
var createStatus = exports.createStatus = function createStatus(tr) {
|
|
44
35
|
var annotationMarksForPos = (0, _utils.getAnnotationMarksForPos)(tr.selection.$head);
|
|
45
|
-
var statusNode = tr.doc.type.schema
|
|
46
|
-
localId: _uuid.uuid.generate()
|
|
47
|
-
}), null, annotationMarksForPos);
|
|
36
|
+
var statusNode = (0, _createStatusNode.createStatusNode)(tr.doc.type.schema, {}, annotationMarksForPos);
|
|
48
37
|
return verifyAndInsertStatus(statusNode, tr, annotationMarksForPos);
|
|
49
38
|
};
|
|
50
39
|
var insertStatus = exports.insertStatus = function insertStatus(editorAnalyticsAPI) {
|
|
@@ -73,7 +62,7 @@ var updateStatus = exports.updateStatus = function updateStatus(status) {
|
|
|
73
62
|
text: status.text.trim(),
|
|
74
63
|
localId: status.localId || _uuid.uuid.generate()
|
|
75
64
|
}) : status;
|
|
76
|
-
var statusProps = _objectSpread(_objectSpread({}, (0,
|
|
65
|
+
var statusProps = _objectSpread(_objectSpread({}, (0, _createStatusNode.getDefaultStatusAttrs)()), selectedStatus);
|
|
77
66
|
var tr = state.tr;
|
|
78
67
|
var _ref2 = _pluginKey.pluginKey.getState(state) || {},
|
|
79
68
|
showStatusPickerAt = _ref2.showStatusPickerAt;
|
package/dist/cjs/statusPlugin.js
CHANGED
|
@@ -9,24 +9,46 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
|
|
|
9
9
|
var _react = _interopRequireDefault(require("react"));
|
|
10
10
|
var _status = require("@atlaskit/adf-schema/status");
|
|
11
11
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
12
|
+
var _blockMenu = require("@atlaskit/editor-common/block-menu");
|
|
13
|
+
var _key = require("@atlaskit/editor-common/block-menu/key");
|
|
12
14
|
var _keymaps = require("@atlaskit/editor-common/keymaps");
|
|
13
15
|
var _messages = require("@atlaskit/editor-common/messages");
|
|
14
16
|
var _quickInsert = require("@atlaskit/editor-common/quick-insert");
|
|
15
17
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
16
18
|
var _comment = _interopRequireDefault(require("@atlaskit/icon/core/comment"));
|
|
17
19
|
var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
|
|
20
|
+
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
18
21
|
var _actions = require("./pm-plugins/actions");
|
|
22
|
+
var _turnInto = require("./utils/turnInto");
|
|
19
23
|
var _keymap = require("./pm-plugins/keymap");
|
|
20
24
|
var _plugin = _interopRequireDefault(require("./pm-plugins/plugin"));
|
|
21
25
|
var _pluginKey = require("./pm-plugins/plugin-key");
|
|
22
26
|
var _ContentComponent = require("./ui/ContentComponent");
|
|
23
27
|
var _getStatusQuickInsertComponents = require("./ui/quick-insert/getStatusQuickInsertComponents");
|
|
28
|
+
var _statusBlockMenuItem = require("./ui/statusBlockMenuItem");
|
|
24
29
|
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; }
|
|
25
30
|
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; }
|
|
26
31
|
var statusPlugin = exports.statusPlugin = function statusPlugin(_ref) {
|
|
27
32
|
var _api$analytics, _api$analytics2;
|
|
28
33
|
var options = _ref.config,
|
|
29
34
|
api = _ref.api;
|
|
35
|
+
if ((0, _expValEquals.expValEquals)('platform_editor_block_menu', 'isEnabled', true) && (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_turn_into_status')) {
|
|
36
|
+
var _api$blockMenu;
|
|
37
|
+
api === null || api === void 0 || (_api$blockMenu = api.blockMenu) === null || _api$blockMenu === void 0 || _api$blockMenu.actions.registerBlockMenuComponents([{
|
|
38
|
+
type: 'block-menu-item',
|
|
39
|
+
key: _key.TRANSFORM_STRUCTURE_STATUS_MENU_ITEM.key,
|
|
40
|
+
parent: {
|
|
41
|
+
type: 'block-menu-section',
|
|
42
|
+
key: _blockMenu.TRANSFORM_STRUCTURE_MENU_SECTION.key,
|
|
43
|
+
rank: _blockMenu.TRANSFORM_STRUCTURE_MENU_SECTION_RANK[_key.TRANSFORM_STRUCTURE_STATUS_MENU_ITEM.key]
|
|
44
|
+
},
|
|
45
|
+
component: (0, _statusBlockMenuItem.createStatusBlockMenuItem)(api),
|
|
46
|
+
isHidden: function isHidden() {
|
|
47
|
+
var _api$blockControls;
|
|
48
|
+
return (0, _turnInto.isStatusTurnIntoHidden)(api === null || api === void 0 || (_api$blockControls = api.blockControls) === null || _api$blockControls === void 0 || (_api$blockControls = _api$blockControls.sharedState.currentState()) === null || _api$blockControls === void 0 ? void 0 : _api$blockControls.preservedSelection);
|
|
49
|
+
}
|
|
50
|
+
}]);
|
|
51
|
+
}
|
|
30
52
|
var isRegisteredSlashCommandEnabled = (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_slash_command');
|
|
31
53
|
if ((options === null || options === void 0 ? void 0 : options.menuDisabled) !== true && isRegisteredSlashCommandEnabled) {
|
|
32
54
|
var _api$uiControlRegistr;
|
|
@@ -10,8 +10,8 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
|
|
|
10
10
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
11
|
var _hooks = require("@atlaskit/editor-common/hooks");
|
|
12
12
|
var _utils = require("@atlaskit/editor-prosemirror/utils");
|
|
13
|
+
var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
|
|
13
14
|
var _fg = require("@atlaskit/platform-feature-flags/fg");
|
|
14
|
-
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
15
15
|
var _actions = require("../pm-plugins/actions");
|
|
16
16
|
var _getSuggestedStatuses = require("./getSuggestedStatuses");
|
|
17
17
|
var _statusPicker = _interopRequireDefault(require("./statusPicker"));
|
|
@@ -72,7 +72,7 @@ function ContentComponent(_ref) {
|
|
|
72
72
|
}
|
|
73
73
|
}, [editorView, showStatusPickerAt]);
|
|
74
74
|
var suggestedStatuses = (0, _react.useMemo)(function () {
|
|
75
|
-
if (typeof showStatusPickerAt !== 'number' || !(0,
|
|
75
|
+
if (typeof showStatusPickerAt !== 'number' || !(0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_status_popup_suggestions')) {
|
|
76
76
|
return [];
|
|
77
77
|
}
|
|
78
78
|
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.createStatusBlockMenuItem = void 0;
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _reactIntl = require("react-intl");
|
|
10
|
+
var _messages = require("@atlaskit/editor-common/messages");
|
|
11
|
+
var _editorToolbar = require("@atlaskit/editor-toolbar");
|
|
12
|
+
var _lozenge = _interopRequireDefault(require("@atlaskit/icon-lab/core/lozenge"));
|
|
13
|
+
var _createStatusNode = require("../utils/createStatusNode");
|
|
14
|
+
var _pluginKey = require("../pm-plugins/plugin-key");
|
|
15
|
+
var StatusBlockMenuItem = function StatusBlockMenuItem(_ref) {
|
|
16
|
+
var api = _ref.api,
|
|
17
|
+
isSuggested = _ref.isSuggested;
|
|
18
|
+
var _useIntl = (0, _reactIntl.useIntl)(),
|
|
19
|
+
formatMessage = _useIntl.formatMessage;
|
|
20
|
+
var handleClick = function handleClick() {
|
|
21
|
+
api === null || api === void 0 || api.core.actions.execute(function (_ref2) {
|
|
22
|
+
var _api$blockMenu;
|
|
23
|
+
var tr = _ref2.tr;
|
|
24
|
+
var command = api === null || api === void 0 || (_api$blockMenu = api.blockMenu) === null || _api$blockMenu === void 0 ? void 0 : _api$blockMenu.commands.transformInlineNode({
|
|
25
|
+
buildInlineNode: function buildInlineNode(source) {
|
|
26
|
+
return (0, _createStatusNode.createStatusNode)(tr.doc.type.schema, {
|
|
27
|
+
text: source.textContent.trim()
|
|
28
|
+
});
|
|
29
|
+
},
|
|
30
|
+
isSuggested: isSuggested,
|
|
31
|
+
targetTypeName: 'status'
|
|
32
|
+
});
|
|
33
|
+
var nextTr = command === null || command === void 0 ? void 0 : command({
|
|
34
|
+
tr: tr
|
|
35
|
+
});
|
|
36
|
+
if (!(nextTr !== null && nextTr !== void 0 && nextTr.docChanged)) {
|
|
37
|
+
return null;
|
|
38
|
+
}
|
|
39
|
+
return nextTr.setMeta(_pluginKey.pluginKey, {
|
|
40
|
+
focusStatusInput: true,
|
|
41
|
+
isNew: true,
|
|
42
|
+
showStatusPickerAt: nextTr.selection.from
|
|
43
|
+
});
|
|
44
|
+
});
|
|
45
|
+
};
|
|
46
|
+
return /*#__PURE__*/_react.default.createElement(_editorToolbar.ToolbarDropdownItem, {
|
|
47
|
+
onClick: handleClick,
|
|
48
|
+
elemBefore: /*#__PURE__*/_react.default.createElement(_lozenge.default, {
|
|
49
|
+
label: "",
|
|
50
|
+
size: "small"
|
|
51
|
+
})
|
|
52
|
+
}, formatMessage(_messages.toolbarInsertBlockMessages.status));
|
|
53
|
+
};
|
|
54
|
+
var createStatusBlockMenuItem = exports.createStatusBlockMenuItem = function createStatusBlockMenuItem(api) {
|
|
55
|
+
return function () {
|
|
56
|
+
var _ref3 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
57
|
+
isSuggested = _ref3.isSuggested;
|
|
58
|
+
return /*#__PURE__*/_react.default.createElement(StatusBlockMenuItem, {
|
|
59
|
+
api: api,
|
|
60
|
+
isSuggested: isSuggested
|
|
61
|
+
});
|
|
62
|
+
};
|
|
63
|
+
};
|
|
@@ -21,13 +21,13 @@ var _ui = require("@atlaskit/editor-common/ui");
|
|
|
21
21
|
var _uiReact = require("@atlaskit/editor-common/ui-react");
|
|
22
22
|
var _userIntent = require("@atlaskit/editor-common/user-intent");
|
|
23
23
|
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
24
|
+
var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
|
|
25
|
+
var _unsafeExpValNoExposure = require("@atlaskit/platform-feature-experiments/unsafe-exp-val-no-exposure");
|
|
24
26
|
var _fg = require("@atlaskit/platform-feature-flags/fg");
|
|
25
27
|
var _element = require("@atlaskit/status/element");
|
|
26
28
|
var _picker = require("@atlaskit/status/picker");
|
|
27
|
-
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
28
|
-
var _expValEqualsNoExposure = require("@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure");
|
|
29
29
|
var _visuallyHidden = _interopRequireDefault(require("@atlaskit/visually-hidden/visually-hidden"));
|
|
30
|
-
var
|
|
30
|
+
var _createStatusNode = require("../utils/createStatusNode");
|
|
31
31
|
var _analytics = require("./analytics");
|
|
32
32
|
function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2.default)(o), (0, _possibleConstructorReturn2.default)(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2.default)(t).constructor) : o.apply(t, e)); }
|
|
33
33
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } /**
|
|
@@ -161,7 +161,7 @@ var StatusPickerWithIntl = /*#__PURE__*/function (_React$Component) {
|
|
|
161
161
|
});
|
|
162
162
|
(0, _defineProperty2.default)(_this, "handleTabPress", function (event) {
|
|
163
163
|
var _getDocument2;
|
|
164
|
-
if (!(0,
|
|
164
|
+
if (!(0, _unsafeExpValNoExposure.UNSAFE_expValNoExposure)('platform_editor_status_popup_suggestions', 'isEnabled', false)) {
|
|
165
165
|
var _getDocument;
|
|
166
166
|
/* original tab-navigation behaviour: cycle between color buttons and the input field */
|
|
167
167
|
var _colorButtons = event.currentTarget.querySelectorAll('button');
|
|
@@ -422,8 +422,8 @@ var StatusPickerWithIntl = /*#__PURE__*/function (_React$Component) {
|
|
|
422
422
|
defaultLocalId = props.defaultLocalId,
|
|
423
423
|
isNew = props.isNew;
|
|
424
424
|
return {
|
|
425
|
-
color: defaultColor ||
|
|
426
|
-
text: defaultText ||
|
|
425
|
+
color: defaultColor || _createStatusNode.DEFAULT_STATUS.color,
|
|
426
|
+
text: defaultText || _createStatusNode.DEFAULT_STATUS.text,
|
|
427
427
|
localId: defaultLocalId,
|
|
428
428
|
isNew: isNew
|
|
429
429
|
};
|
|
@@ -450,8 +450,8 @@ var StatusPickerWithIntl = /*#__PURE__*/function (_React$Component) {
|
|
|
450
450
|
var _this$state3 = this.state,
|
|
451
451
|
color = _this$state3.color,
|
|
452
452
|
text = _this$state3.text;
|
|
453
|
-
var suggestionsPatchEnabled = (0,
|
|
454
|
-
var suggestedStatusList = suggestedStatuses !== null && suggestedStatuses !== void 0 && suggestedStatuses.length && (0,
|
|
453
|
+
var suggestionsPatchEnabled = (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_status_popup_suggestions') && (0, _fg.fg)('platform_editor_status_popup_suggestions_patch_1');
|
|
454
|
+
var suggestedStatusList = suggestedStatuses !== null && suggestedStatuses !== void 0 && suggestedStatuses.length && (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_status_popup_suggestions') ? (0, _react2.jsx)("div", {
|
|
455
455
|
css: [suggestedStatusesContainerStyles, suggestionsPatchEnabled ? suggestedStatusesContainerPatchStyles : undefined],
|
|
456
456
|
"data-suggested-status-list": true
|
|
457
457
|
}, suggestedStatuses.map(function (suggestedStatus, index) {
|
|
@@ -516,7 +516,7 @@ var StatusPickerWithIntl = /*#__PURE__*/function (_React$Component) {
|
|
|
516
516
|
handleClickOutside: this.handleClickOutside,
|
|
517
517
|
handleEscapeKeydown: this.handleEscapeKeydown,
|
|
518
518
|
zIndex: _editorSharedStyles.akEditorFloatingDialogZIndex,
|
|
519
|
-
fitHeight: (0,
|
|
519
|
+
fitHeight: (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_status_popup_suggestions') && (0, _fg.fg)('platform_editor_status_popup_suggestions_patch_1') ? STATUS_PICKER_FIT_HEIGHT : 40,
|
|
520
520
|
mountTo: mountTo,
|
|
521
521
|
boundariesElement: boundariesElement,
|
|
522
522
|
scrollableElement: scrollableElement,
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.getDefaultStatusAttrs = exports.createStatusNode = exports.DEFAULT_STATUS_NEW = exports.DEFAULT_STATUS = void 0;
|
|
8
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
|
+
var _adfSchema = require("@atlaskit/adf-schema");
|
|
10
|
+
var _fg = require("@atlaskit/platform-feature-flags/fg");
|
|
11
|
+
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; }
|
|
12
|
+
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; }
|
|
13
|
+
var DEFAULT_STATUS = exports.DEFAULT_STATUS = {
|
|
14
|
+
text: '',
|
|
15
|
+
color: 'neutral'
|
|
16
|
+
};
|
|
17
|
+
var DEFAULT_STATUS_NEW = exports.DEFAULT_STATUS_NEW = {
|
|
18
|
+
text: '',
|
|
19
|
+
color: 'neutral',
|
|
20
|
+
style: 'mixedCase'
|
|
21
|
+
};
|
|
22
|
+
var getDefaultStatusAttrs = exports.getDefaultStatusAttrs = function getDefaultStatusAttrs() {
|
|
23
|
+
return (0, _fg.fg)('platform-dst-lozenge-tag-badge-visual-uplifts') ? DEFAULT_STATUS_NEW : DEFAULT_STATUS;
|
|
24
|
+
};
|
|
25
|
+
var createStatusNode = exports.createStatusNode = function createStatusNode(schema) {
|
|
26
|
+
var attrs = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
27
|
+
var marks = arguments.length > 2 ? arguments[2] : undefined;
|
|
28
|
+
return schema.nodes.status.createChecked(_objectSpread(_objectSpread({}, getDefaultStatusAttrs()), {}, {
|
|
29
|
+
localId: _adfSchema.uuid.generate()
|
|
30
|
+
}, attrs), null, marks);
|
|
31
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.isStatusTurnIntoHidden = exports.canTurnIntoStatus = void 0;
|
|
7
|
+
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
8
|
+
var MAX_STATUS_TURN_INTO_CHARS = 30;
|
|
9
|
+
var SUPPORTED_SOURCE_TYPES = new Set(['paragraph', 'heading']);
|
|
10
|
+
var getTurnIntoStatusSourceNode = function getTurnIntoStatusSourceNode(selection) {
|
|
11
|
+
if (!selection || !(selection instanceof _state.NodeSelection)) {
|
|
12
|
+
return null;
|
|
13
|
+
}
|
|
14
|
+
return selection.node;
|
|
15
|
+
};
|
|
16
|
+
var canTurnIntoStatus = exports.canTurnIntoStatus = function canTurnIntoStatus(node) {
|
|
17
|
+
if (!node || !SUPPORTED_SOURCE_TYPES.has(node.type.name)) {
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
for (var i = 0; i < node.childCount; i++) {
|
|
21
|
+
if (!node.child(i).isText) {
|
|
22
|
+
return false;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
return node.textContent.trim().length <= MAX_STATUS_TURN_INTO_CHARS;
|
|
26
|
+
};
|
|
27
|
+
var isStatusTurnIntoHidden = exports.isStatusTurnIntoHidden = function isStatusTurnIntoHidden(selection) {
|
|
28
|
+
return !canTurnIntoStatus(getTurnIntoStatusSourceNode(selection));
|
|
29
|
+
};
|
|
@@ -6,17 +6,8 @@ import { getAnnotationMarksForPos } from '@atlaskit/editor-common/utils';
|
|
|
6
6
|
import { Fragment } from '@atlaskit/editor-prosemirror/model';
|
|
7
7
|
import { NodeSelection, Selection } from '@atlaskit/editor-prosemirror/state';
|
|
8
8
|
import { canInsert } from '@atlaskit/editor-prosemirror/utils';
|
|
9
|
-
import {
|
|
9
|
+
import { createStatusNode, getDefaultStatusAttrs } from '../utils/createStatusNode';
|
|
10
10
|
import { pluginKey } from './plugin-key';
|
|
11
|
-
export const DEFAULT_STATUS = {
|
|
12
|
-
text: '',
|
|
13
|
-
color: 'neutral'
|
|
14
|
-
};
|
|
15
|
-
export const DEFAULT_STATUS_NEW = {
|
|
16
|
-
text: '',
|
|
17
|
-
color: 'neutral',
|
|
18
|
-
style: 'mixedCase'
|
|
19
|
-
};
|
|
20
11
|
export const verifyAndInsertStatus = (statusNode, tr, annotationMarks) => {
|
|
21
12
|
const fragment = Fragment.fromArray([statusNode, tr.doc.type.schema.text(' ', annotationMarks)]);
|
|
22
13
|
const insertable = canInsert(tr.selection.$from, fragment);
|
|
@@ -33,10 +24,7 @@ export const verifyAndInsertStatus = (statusNode, tr, annotationMarks) => {
|
|
|
33
24
|
};
|
|
34
25
|
export const createStatus = tr => {
|
|
35
26
|
const annotationMarksForPos = getAnnotationMarksForPos(tr.selection.$head);
|
|
36
|
-
const statusNode = tr.doc.type.schema
|
|
37
|
-
...(fg('platform-dst-lozenge-tag-badge-visual-uplifts') ? DEFAULT_STATUS_NEW : DEFAULT_STATUS),
|
|
38
|
-
localId: uuid.generate()
|
|
39
|
-
}, null, annotationMarksForPos);
|
|
27
|
+
const statusNode = createStatusNode(tr.doc.type.schema, {}, annotationMarksForPos);
|
|
40
28
|
return verifyAndInsertStatus(statusNode, tr, annotationMarksForPos);
|
|
41
29
|
};
|
|
42
30
|
export const insertStatus = editorAnalyticsAPI => (inputMethod = INPUT_METHOD.TOOLBAR) => ({
|
|
@@ -63,7 +51,7 @@ export const updateStatus = status => (state, dispatch) => {
|
|
|
63
51
|
localId: status.localId || uuid.generate()
|
|
64
52
|
}) : status;
|
|
65
53
|
const statusProps = {
|
|
66
|
-
...(
|
|
54
|
+
...getDefaultStatusAttrs(),
|
|
67
55
|
...selectedStatus
|
|
68
56
|
};
|
|
69
57
|
let tr = state.tr;
|
|
@@ -1,23 +1,45 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { status } from '@atlaskit/adf-schema/status';
|
|
3
3
|
import { ACTION_SUBJECT_ID, ACTION, ACTION_SUBJECT, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
4
|
+
import { TRANSFORM_STRUCTURE_MENU_SECTION, TRANSFORM_STRUCTURE_MENU_SECTION_RANK } from '@atlaskit/editor-common/block-menu';
|
|
5
|
+
import { TRANSFORM_STRUCTURE_STATUS_MENU_ITEM } from '@atlaskit/editor-common/block-menu/key';
|
|
4
6
|
import { addInlineComment, ToolTipContent } from '@atlaskit/editor-common/keymaps';
|
|
5
7
|
import { annotationMessages, toolbarInsertBlockMessages as messages } from '@atlaskit/editor-common/messages';
|
|
6
8
|
import { IconStatus } from '@atlaskit/editor-common/quick-insert';
|
|
7
9
|
import { calculateToolbarPositionAboveSelection } from '@atlaskit/editor-common/utils';
|
|
8
10
|
import CommentIcon from '@atlaskit/icon/core/comment';
|
|
9
11
|
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
12
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
10
13
|
import { commitStatusPicker, insertStatus, removeStatus, updateStatusWithAnalytics } from './pm-plugins/actions';
|
|
14
|
+
import { isStatusTurnIntoHidden } from './utils/turnInto';
|
|
11
15
|
import { keymapPlugin } from './pm-plugins/keymap';
|
|
12
16
|
import createStatusPlugin from './pm-plugins/plugin';
|
|
13
17
|
import { pluginKey } from './pm-plugins/plugin-key';
|
|
14
18
|
import { ContentComponent } from './ui/ContentComponent';
|
|
15
19
|
import { getStatusQuickInsertComponents } from './ui/quick-insert/getStatusQuickInsertComponents';
|
|
20
|
+
import { createStatusBlockMenuItem } from './ui/statusBlockMenuItem';
|
|
16
21
|
export const statusPlugin = ({
|
|
17
22
|
config: options,
|
|
18
23
|
api
|
|
19
24
|
}) => {
|
|
20
25
|
var _api$analytics, _api$analytics2;
|
|
26
|
+
if (expValEquals('platform_editor_block_menu', 'isEnabled', true) && isExperimentEnabled('platform_editor_turn_into_status')) {
|
|
27
|
+
var _api$blockMenu;
|
|
28
|
+
api === null || api === void 0 ? void 0 : (_api$blockMenu = api.blockMenu) === null || _api$blockMenu === void 0 ? void 0 : _api$blockMenu.actions.registerBlockMenuComponents([{
|
|
29
|
+
type: 'block-menu-item',
|
|
30
|
+
key: TRANSFORM_STRUCTURE_STATUS_MENU_ITEM.key,
|
|
31
|
+
parent: {
|
|
32
|
+
type: 'block-menu-section',
|
|
33
|
+
key: TRANSFORM_STRUCTURE_MENU_SECTION.key,
|
|
34
|
+
rank: TRANSFORM_STRUCTURE_MENU_SECTION_RANK[TRANSFORM_STRUCTURE_STATUS_MENU_ITEM.key]
|
|
35
|
+
},
|
|
36
|
+
component: createStatusBlockMenuItem(api),
|
|
37
|
+
isHidden: () => {
|
|
38
|
+
var _api$blockControls, _api$blockControls$sh;
|
|
39
|
+
return isStatusTurnIntoHidden(api === null || api === void 0 ? void 0 : (_api$blockControls = api.blockControls) === null || _api$blockControls === void 0 ? void 0 : (_api$blockControls$sh = _api$blockControls.sharedState.currentState()) === null || _api$blockControls$sh === void 0 ? void 0 : _api$blockControls$sh.preservedSelection);
|
|
40
|
+
}
|
|
41
|
+
}]);
|
|
42
|
+
}
|
|
21
43
|
const isRegisteredSlashCommandEnabled = isExperimentEnabled('platform_editor_slash_command');
|
|
22
44
|
if ((options === null || options === void 0 ? void 0 : options.menuDisabled) !== true && isRegisteredSlashCommandEnabled) {
|
|
23
45
|
var _api$uiControlRegistr;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React, { useCallback, useMemo } from 'react';
|
|
2
2
|
import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
3
3
|
import { findDomRefAtPos } from '@atlaskit/editor-prosemirror/utils';
|
|
4
|
+
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
4
5
|
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
5
|
-
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
6
6
|
import { commitStatusPicker, updateStatus } from '../pm-plugins/actions';
|
|
7
7
|
import { getSuggestedStatuses, MAX_SUGGESTED_STATUSES, MAX_SUGGESTED_STATUSES_OLD } from './getSuggestedStatuses';
|
|
8
8
|
import StatusPicker from './statusPicker';
|
|
@@ -59,7 +59,7 @@ export function ContentComponent({
|
|
|
59
59
|
}
|
|
60
60
|
}, [editorView, showStatusPickerAt]);
|
|
61
61
|
const suggestedStatuses = useMemo(() => {
|
|
62
|
-
if (typeof showStatusPickerAt !== 'number' || !
|
|
62
|
+
if (typeof showStatusPickerAt !== 'number' || !isExperimentEnabled('platform_editor_status_popup_suggestions')) {
|
|
63
63
|
return [];
|
|
64
64
|
}
|
|
65
65
|
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { useIntl } from 'react-intl';
|
|
3
|
+
import { toolbarInsertBlockMessages } from '@atlaskit/editor-common/messages';
|
|
4
|
+
import { ToolbarDropdownItem } from '@atlaskit/editor-toolbar';
|
|
5
|
+
import LozengeIcon from '@atlaskit/icon-lab/core/lozenge';
|
|
6
|
+
import { createStatusNode } from '../utils/createStatusNode';
|
|
7
|
+
import { pluginKey } from '../pm-plugins/plugin-key';
|
|
8
|
+
const StatusBlockMenuItem = ({
|
|
9
|
+
api,
|
|
10
|
+
isSuggested
|
|
11
|
+
}) => {
|
|
12
|
+
const {
|
|
13
|
+
formatMessage
|
|
14
|
+
} = useIntl();
|
|
15
|
+
const handleClick = () => {
|
|
16
|
+
api === null || api === void 0 ? void 0 : api.core.actions.execute(({
|
|
17
|
+
tr
|
|
18
|
+
}) => {
|
|
19
|
+
var _api$blockMenu;
|
|
20
|
+
const command = api === null || api === void 0 ? void 0 : (_api$blockMenu = api.blockMenu) === null || _api$blockMenu === void 0 ? void 0 : _api$blockMenu.commands.transformInlineNode({
|
|
21
|
+
buildInlineNode: source => createStatusNode(tr.doc.type.schema, {
|
|
22
|
+
text: source.textContent.trim()
|
|
23
|
+
}),
|
|
24
|
+
isSuggested,
|
|
25
|
+
targetTypeName: 'status'
|
|
26
|
+
});
|
|
27
|
+
const nextTr = command === null || command === void 0 ? void 0 : command({
|
|
28
|
+
tr
|
|
29
|
+
});
|
|
30
|
+
if (!(nextTr !== null && nextTr !== void 0 && nextTr.docChanged)) {
|
|
31
|
+
return null;
|
|
32
|
+
}
|
|
33
|
+
return nextTr.setMeta(pluginKey, {
|
|
34
|
+
focusStatusInput: true,
|
|
35
|
+
isNew: true,
|
|
36
|
+
showStatusPickerAt: nextTr.selection.from
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
};
|
|
40
|
+
return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
|
|
41
|
+
onClick: handleClick,
|
|
42
|
+
elemBefore: /*#__PURE__*/React.createElement(LozengeIcon, {
|
|
43
|
+
label: "",
|
|
44
|
+
size: "small"
|
|
45
|
+
})
|
|
46
|
+
}, formatMessage(toolbarInsertBlockMessages.status));
|
|
47
|
+
};
|
|
48
|
+
export const createStatusBlockMenuItem = api => {
|
|
49
|
+
return ({
|
|
50
|
+
isSuggested
|
|
51
|
+
} = {}) => /*#__PURE__*/React.createElement(StatusBlockMenuItem, {
|
|
52
|
+
api: api,
|
|
53
|
+
isSuggested: isSuggested
|
|
54
|
+
});
|
|
55
|
+
};
|
|
@@ -16,13 +16,13 @@ import { Popup } from '@atlaskit/editor-common/ui';
|
|
|
16
16
|
import { OutsideClickTargetRefContext, withReactEditorViewOuterListeners as withOuterListeners } from '@atlaskit/editor-common/ui-react';
|
|
17
17
|
import { UserIntentPopupWrapper } from '@atlaskit/editor-common/user-intent';
|
|
18
18
|
import { akEditorFloatingDialogZIndex } from '@atlaskit/editor-shared-styles';
|
|
19
|
+
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
20
|
+
import { UNSAFE_expValNoExposure } from '@atlaskit/platform-feature-experiments/unsafe-exp-val-no-exposure';
|
|
19
21
|
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
20
22
|
import { Status } from '@atlaskit/status/element';
|
|
21
23
|
import { StatusPicker as AkStatusPicker } from '@atlaskit/status/picker';
|
|
22
|
-
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
23
|
-
import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
|
|
24
24
|
import VisuallyHidden from '@atlaskit/visually-hidden/visually-hidden';
|
|
25
|
-
import { DEFAULT_STATUS } from '../
|
|
25
|
+
import { DEFAULT_STATUS } from '../utils/createStatusNode';
|
|
26
26
|
import { analyticsState, createStatusAnalyticsAndFire } from './analytics';
|
|
27
27
|
const PopupWithListeners = withOuterListeners(Popup);
|
|
28
28
|
export let InputMethod = /*#__PURE__*/function (InputMethod) {
|
|
@@ -149,7 +149,7 @@ class StatusPickerWithIntl extends React.Component {
|
|
|
149
149
|
});
|
|
150
150
|
_defineProperty(this, "handleTabPress", event => {
|
|
151
151
|
var _getDocument2;
|
|
152
|
-
if (!
|
|
152
|
+
if (!UNSAFE_expValNoExposure('platform_editor_status_popup_suggestions', 'isEnabled', false)) {
|
|
153
153
|
var _getDocument;
|
|
154
154
|
/* original tab-navigation behaviour: cycle between color buttons and the input field */
|
|
155
155
|
const colorButtons = event.currentTarget.querySelectorAll('button');
|
|
@@ -424,8 +424,8 @@ class StatusPickerWithIntl extends React.Component {
|
|
|
424
424
|
color,
|
|
425
425
|
text
|
|
426
426
|
} = this.state;
|
|
427
|
-
const suggestionsPatchEnabled =
|
|
428
|
-
const suggestedStatusList = suggestedStatuses !== null && suggestedStatuses !== void 0 && suggestedStatuses.length &&
|
|
427
|
+
const suggestionsPatchEnabled = isExperimentEnabled('platform_editor_status_popup_suggestions') && fg('platform_editor_status_popup_suggestions_patch_1');
|
|
428
|
+
const suggestedStatusList = suggestedStatuses !== null && suggestedStatuses !== void 0 && suggestedStatuses.length && isExperimentEnabled('platform_editor_status_popup_suggestions') ? jsx("div", {
|
|
429
429
|
css: [suggestedStatusesContainerStyles, suggestionsPatchEnabled ? suggestedStatusesContainerPatchStyles : undefined],
|
|
430
430
|
"data-suggested-status-list": true
|
|
431
431
|
}, suggestedStatuses.map((suggestedStatus, index) => jsx("div", {
|
|
@@ -485,7 +485,7 @@ class StatusPickerWithIntl extends React.Component {
|
|
|
485
485
|
handleClickOutside: this.handleClickOutside,
|
|
486
486
|
handleEscapeKeydown: this.handleEscapeKeydown,
|
|
487
487
|
zIndex: akEditorFloatingDialogZIndex,
|
|
488
|
-
fitHeight:
|
|
488
|
+
fitHeight: isExperimentEnabled('platform_editor_status_popup_suggestions') && fg('platform_editor_status_popup_suggestions_patch_1') ? STATUS_PICKER_FIT_HEIGHT : 40,
|
|
489
489
|
mountTo: mountTo,
|
|
490
490
|
boundariesElement: boundariesElement,
|
|
491
491
|
scrollableElement: scrollableElement,
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { uuid } from '@atlaskit/adf-schema';
|
|
2
|
+
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
3
|
+
export const DEFAULT_STATUS = {
|
|
4
|
+
text: '',
|
|
5
|
+
color: 'neutral'
|
|
6
|
+
};
|
|
7
|
+
export const DEFAULT_STATUS_NEW = {
|
|
8
|
+
text: '',
|
|
9
|
+
color: 'neutral',
|
|
10
|
+
style: 'mixedCase'
|
|
11
|
+
};
|
|
12
|
+
export const getDefaultStatusAttrs = () => fg('platform-dst-lozenge-tag-badge-visual-uplifts') ? DEFAULT_STATUS_NEW : DEFAULT_STATUS;
|
|
13
|
+
export const createStatusNode = (schema, attrs = {}, marks) => schema.nodes.status.createChecked({
|
|
14
|
+
...getDefaultStatusAttrs(),
|
|
15
|
+
localId: uuid.generate(),
|
|
16
|
+
...attrs
|
|
17
|
+
}, null, marks);
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
|
|
2
|
+
const MAX_STATUS_TURN_INTO_CHARS = 30;
|
|
3
|
+
const SUPPORTED_SOURCE_TYPES = new Set(['paragraph', 'heading']);
|
|
4
|
+
const getTurnIntoStatusSourceNode = selection => {
|
|
5
|
+
if (!selection || !(selection instanceof NodeSelection)) {
|
|
6
|
+
return null;
|
|
7
|
+
}
|
|
8
|
+
return selection.node;
|
|
9
|
+
};
|
|
10
|
+
export const canTurnIntoStatus = node => {
|
|
11
|
+
if (!node || !SUPPORTED_SOURCE_TYPES.has(node.type.name)) {
|
|
12
|
+
return false;
|
|
13
|
+
}
|
|
14
|
+
for (let i = 0; i < node.childCount; i++) {
|
|
15
|
+
if (!node.child(i).isText) {
|
|
16
|
+
return false;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
return node.textContent.trim().length <= MAX_STATUS_TURN_INTO_CHARS;
|
|
20
|
+
};
|
|
21
|
+
export const isStatusTurnIntoHidden = selection => !canTurnIntoStatus(getTurnIntoStatusSourceNode(selection));
|
|
@@ -9,17 +9,8 @@ import { getAnnotationMarksForPos } from '@atlaskit/editor-common/utils';
|
|
|
9
9
|
import { Fragment } from '@atlaskit/editor-prosemirror/model';
|
|
10
10
|
import { NodeSelection, Selection } from '@atlaskit/editor-prosemirror/state';
|
|
11
11
|
import { canInsert } from '@atlaskit/editor-prosemirror/utils';
|
|
12
|
-
import {
|
|
12
|
+
import { createStatusNode, getDefaultStatusAttrs } from '../utils/createStatusNode';
|
|
13
13
|
import { pluginKey } from './plugin-key';
|
|
14
|
-
export var DEFAULT_STATUS = {
|
|
15
|
-
text: '',
|
|
16
|
-
color: 'neutral'
|
|
17
|
-
};
|
|
18
|
-
export var DEFAULT_STATUS_NEW = {
|
|
19
|
-
text: '',
|
|
20
|
-
color: 'neutral',
|
|
21
|
-
style: 'mixedCase'
|
|
22
|
-
};
|
|
23
14
|
export var verifyAndInsertStatus = function verifyAndInsertStatus(statusNode, tr, annotationMarks) {
|
|
24
15
|
var fragment = Fragment.fromArray([statusNode, tr.doc.type.schema.text(' ', annotationMarks)]);
|
|
25
16
|
var insertable = canInsert(tr.selection.$from, fragment);
|
|
@@ -36,9 +27,7 @@ export var verifyAndInsertStatus = function verifyAndInsertStatus(statusNode, tr
|
|
|
36
27
|
};
|
|
37
28
|
export var createStatus = function createStatus(tr) {
|
|
38
29
|
var annotationMarksForPos = getAnnotationMarksForPos(tr.selection.$head);
|
|
39
|
-
var statusNode = tr.doc.type.schema
|
|
40
|
-
localId: uuid.generate()
|
|
41
|
-
}), null, annotationMarksForPos);
|
|
30
|
+
var statusNode = createStatusNode(tr.doc.type.schema, {}, annotationMarksForPos);
|
|
42
31
|
return verifyAndInsertStatus(statusNode, tr, annotationMarksForPos);
|
|
43
32
|
};
|
|
44
33
|
export var insertStatus = function insertStatus(editorAnalyticsAPI) {
|
|
@@ -67,7 +56,7 @@ export var updateStatus = function updateStatus(status) {
|
|
|
67
56
|
text: status.text.trim(),
|
|
68
57
|
localId: status.localId || uuid.generate()
|
|
69
58
|
}) : status;
|
|
70
|
-
var statusProps = _objectSpread(_objectSpread({},
|
|
59
|
+
var statusProps = _objectSpread(_objectSpread({}, getDefaultStatusAttrs()), selectedStatus);
|
|
71
60
|
var tr = state.tr;
|
|
72
61
|
var _ref2 = pluginKey.getState(state) || {},
|
|
73
62
|
showStatusPickerAt = _ref2.showStatusPickerAt;
|
package/dist/esm/statusPlugin.js
CHANGED
|
@@ -4,22 +4,44 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
4
4
|
import React from 'react';
|
|
5
5
|
import { status } from '@atlaskit/adf-schema/status';
|
|
6
6
|
import { ACTION_SUBJECT_ID, ACTION, ACTION_SUBJECT, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
7
|
+
import { TRANSFORM_STRUCTURE_MENU_SECTION, TRANSFORM_STRUCTURE_MENU_SECTION_RANK } from '@atlaskit/editor-common/block-menu';
|
|
8
|
+
import { TRANSFORM_STRUCTURE_STATUS_MENU_ITEM } from '@atlaskit/editor-common/block-menu/key';
|
|
7
9
|
import { addInlineComment, ToolTipContent } from '@atlaskit/editor-common/keymaps';
|
|
8
10
|
import { annotationMessages, toolbarInsertBlockMessages as messages } from '@atlaskit/editor-common/messages';
|
|
9
11
|
import { IconStatus } from '@atlaskit/editor-common/quick-insert';
|
|
10
12
|
import { calculateToolbarPositionAboveSelection } from '@atlaskit/editor-common/utils';
|
|
11
13
|
import CommentIcon from '@atlaskit/icon/core/comment';
|
|
12
14
|
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
15
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
13
16
|
import { commitStatusPicker, insertStatus, removeStatus, updateStatusWithAnalytics } from './pm-plugins/actions';
|
|
17
|
+
import { isStatusTurnIntoHidden } from './utils/turnInto';
|
|
14
18
|
import { keymapPlugin } from './pm-plugins/keymap';
|
|
15
19
|
import createStatusPlugin from './pm-plugins/plugin';
|
|
16
20
|
import { pluginKey } from './pm-plugins/plugin-key';
|
|
17
21
|
import { ContentComponent } from './ui/ContentComponent';
|
|
18
22
|
import { getStatusQuickInsertComponents } from './ui/quick-insert/getStatusQuickInsertComponents';
|
|
23
|
+
import { createStatusBlockMenuItem } from './ui/statusBlockMenuItem';
|
|
19
24
|
export var statusPlugin = function statusPlugin(_ref) {
|
|
20
25
|
var _api$analytics, _api$analytics2;
|
|
21
26
|
var options = _ref.config,
|
|
22
27
|
api = _ref.api;
|
|
28
|
+
if (expValEquals('platform_editor_block_menu', 'isEnabled', true) && isExperimentEnabled('platform_editor_turn_into_status')) {
|
|
29
|
+
var _api$blockMenu;
|
|
30
|
+
api === null || api === void 0 || (_api$blockMenu = api.blockMenu) === null || _api$blockMenu === void 0 || _api$blockMenu.actions.registerBlockMenuComponents([{
|
|
31
|
+
type: 'block-menu-item',
|
|
32
|
+
key: TRANSFORM_STRUCTURE_STATUS_MENU_ITEM.key,
|
|
33
|
+
parent: {
|
|
34
|
+
type: 'block-menu-section',
|
|
35
|
+
key: TRANSFORM_STRUCTURE_MENU_SECTION.key,
|
|
36
|
+
rank: TRANSFORM_STRUCTURE_MENU_SECTION_RANK[TRANSFORM_STRUCTURE_STATUS_MENU_ITEM.key]
|
|
37
|
+
},
|
|
38
|
+
component: createStatusBlockMenuItem(api),
|
|
39
|
+
isHidden: function isHidden() {
|
|
40
|
+
var _api$blockControls;
|
|
41
|
+
return isStatusTurnIntoHidden(api === null || api === void 0 || (_api$blockControls = api.blockControls) === null || _api$blockControls === void 0 || (_api$blockControls = _api$blockControls.sharedState.currentState()) === null || _api$blockControls === void 0 ? void 0 : _api$blockControls.preservedSelection);
|
|
42
|
+
}
|
|
43
|
+
}]);
|
|
44
|
+
}
|
|
23
45
|
var isRegisteredSlashCommandEnabled = isExperimentEnabled('platform_editor_slash_command');
|
|
24
46
|
if ((options === null || options === void 0 ? void 0 : options.menuDisabled) !== true && isRegisteredSlashCommandEnabled) {
|
|
25
47
|
var _api$uiControlRegistr;
|
|
@@ -4,8 +4,8 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
4
4
|
import React, { useCallback, useMemo } from 'react';
|
|
5
5
|
import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
6
6
|
import { findDomRefAtPos } from '@atlaskit/editor-prosemirror/utils';
|
|
7
|
+
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
7
8
|
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
8
|
-
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
9
9
|
import { commitStatusPicker, updateStatus } from '../pm-plugins/actions';
|
|
10
10
|
import { getSuggestedStatuses, MAX_SUGGESTED_STATUSES, MAX_SUGGESTED_STATUSES_OLD } from './getSuggestedStatuses';
|
|
11
11
|
import StatusPicker from './statusPicker';
|
|
@@ -63,7 +63,7 @@ export function ContentComponent(_ref) {
|
|
|
63
63
|
}
|
|
64
64
|
}, [editorView, showStatusPickerAt]);
|
|
65
65
|
var suggestedStatuses = useMemo(function () {
|
|
66
|
-
if (typeof showStatusPickerAt !== 'number' || !
|
|
66
|
+
if (typeof showStatusPickerAt !== 'number' || !isExperimentEnabled('platform_editor_status_popup_suggestions')) {
|
|
67
67
|
return [];
|
|
68
68
|
}
|
|
69
69
|
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { useIntl } from 'react-intl';
|
|
3
|
+
import { toolbarInsertBlockMessages } from '@atlaskit/editor-common/messages';
|
|
4
|
+
import { ToolbarDropdownItem } from '@atlaskit/editor-toolbar';
|
|
5
|
+
import LozengeIcon from '@atlaskit/icon-lab/core/lozenge';
|
|
6
|
+
import { createStatusNode } from '../utils/createStatusNode';
|
|
7
|
+
import { pluginKey } from '../pm-plugins/plugin-key';
|
|
8
|
+
var StatusBlockMenuItem = function StatusBlockMenuItem(_ref) {
|
|
9
|
+
var api = _ref.api,
|
|
10
|
+
isSuggested = _ref.isSuggested;
|
|
11
|
+
var _useIntl = useIntl(),
|
|
12
|
+
formatMessage = _useIntl.formatMessage;
|
|
13
|
+
var handleClick = function handleClick() {
|
|
14
|
+
api === null || api === void 0 || api.core.actions.execute(function (_ref2) {
|
|
15
|
+
var _api$blockMenu;
|
|
16
|
+
var tr = _ref2.tr;
|
|
17
|
+
var command = api === null || api === void 0 || (_api$blockMenu = api.blockMenu) === null || _api$blockMenu === void 0 ? void 0 : _api$blockMenu.commands.transformInlineNode({
|
|
18
|
+
buildInlineNode: function buildInlineNode(source) {
|
|
19
|
+
return createStatusNode(tr.doc.type.schema, {
|
|
20
|
+
text: source.textContent.trim()
|
|
21
|
+
});
|
|
22
|
+
},
|
|
23
|
+
isSuggested: isSuggested,
|
|
24
|
+
targetTypeName: 'status'
|
|
25
|
+
});
|
|
26
|
+
var nextTr = command === null || command === void 0 ? void 0 : command({
|
|
27
|
+
tr: tr
|
|
28
|
+
});
|
|
29
|
+
if (!(nextTr !== null && nextTr !== void 0 && nextTr.docChanged)) {
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
return nextTr.setMeta(pluginKey, {
|
|
33
|
+
focusStatusInput: true,
|
|
34
|
+
isNew: true,
|
|
35
|
+
showStatusPickerAt: nextTr.selection.from
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
};
|
|
39
|
+
return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
|
|
40
|
+
onClick: handleClick,
|
|
41
|
+
elemBefore: /*#__PURE__*/React.createElement(LozengeIcon, {
|
|
42
|
+
label: "",
|
|
43
|
+
size: "small"
|
|
44
|
+
})
|
|
45
|
+
}, formatMessage(toolbarInsertBlockMessages.status));
|
|
46
|
+
};
|
|
47
|
+
export var createStatusBlockMenuItem = function createStatusBlockMenuItem(api) {
|
|
48
|
+
return function () {
|
|
49
|
+
var _ref3 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
50
|
+
isSuggested = _ref3.isSuggested;
|
|
51
|
+
return /*#__PURE__*/React.createElement(StatusBlockMenuItem, {
|
|
52
|
+
api: api,
|
|
53
|
+
isSuggested: isSuggested
|
|
54
|
+
});
|
|
55
|
+
};
|
|
56
|
+
};
|
|
@@ -23,13 +23,13 @@ import { Popup } from '@atlaskit/editor-common/ui';
|
|
|
23
23
|
import { OutsideClickTargetRefContext, withReactEditorViewOuterListeners as withOuterListeners } from '@atlaskit/editor-common/ui-react';
|
|
24
24
|
import { UserIntentPopupWrapper } from '@atlaskit/editor-common/user-intent';
|
|
25
25
|
import { akEditorFloatingDialogZIndex } from '@atlaskit/editor-shared-styles';
|
|
26
|
+
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
27
|
+
import { UNSAFE_expValNoExposure } from '@atlaskit/platform-feature-experiments/unsafe-exp-val-no-exposure';
|
|
26
28
|
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
27
29
|
import { Status } from '@atlaskit/status/element';
|
|
28
30
|
import { StatusPicker as AkStatusPicker } from '@atlaskit/status/picker';
|
|
29
|
-
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
30
|
-
import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
|
|
31
31
|
import VisuallyHidden from '@atlaskit/visually-hidden/visually-hidden';
|
|
32
|
-
import { DEFAULT_STATUS } from '../
|
|
32
|
+
import { DEFAULT_STATUS } from '../utils/createStatusNode';
|
|
33
33
|
import { analyticsState, createStatusAnalyticsAndFire } from './analytics';
|
|
34
34
|
var PopupWithListeners = withOuterListeners(Popup);
|
|
35
35
|
export var InputMethod = /*#__PURE__*/function (InputMethod) {
|
|
@@ -158,7 +158,7 @@ var StatusPickerWithIntl = /*#__PURE__*/function (_React$Component) {
|
|
|
158
158
|
});
|
|
159
159
|
_defineProperty(_this, "handleTabPress", function (event) {
|
|
160
160
|
var _getDocument2;
|
|
161
|
-
if (!
|
|
161
|
+
if (!UNSAFE_expValNoExposure('platform_editor_status_popup_suggestions', 'isEnabled', false)) {
|
|
162
162
|
var _getDocument;
|
|
163
163
|
/* original tab-navigation behaviour: cycle between color buttons and the input field */
|
|
164
164
|
var _colorButtons = event.currentTarget.querySelectorAll('button');
|
|
@@ -447,8 +447,8 @@ var StatusPickerWithIntl = /*#__PURE__*/function (_React$Component) {
|
|
|
447
447
|
var _this$state3 = this.state,
|
|
448
448
|
color = _this$state3.color,
|
|
449
449
|
text = _this$state3.text;
|
|
450
|
-
var suggestionsPatchEnabled =
|
|
451
|
-
var suggestedStatusList = suggestedStatuses !== null && suggestedStatuses !== void 0 && suggestedStatuses.length &&
|
|
450
|
+
var suggestionsPatchEnabled = isExperimentEnabled('platform_editor_status_popup_suggestions') && fg('platform_editor_status_popup_suggestions_patch_1');
|
|
451
|
+
var suggestedStatusList = suggestedStatuses !== null && suggestedStatuses !== void 0 && suggestedStatuses.length && isExperimentEnabled('platform_editor_status_popup_suggestions') ? jsx("div", {
|
|
452
452
|
css: [suggestedStatusesContainerStyles, suggestionsPatchEnabled ? suggestedStatusesContainerPatchStyles : undefined],
|
|
453
453
|
"data-suggested-status-list": true
|
|
454
454
|
}, suggestedStatuses.map(function (suggestedStatus, index) {
|
|
@@ -513,7 +513,7 @@ var StatusPickerWithIntl = /*#__PURE__*/function (_React$Component) {
|
|
|
513
513
|
handleClickOutside: this.handleClickOutside,
|
|
514
514
|
handleEscapeKeydown: this.handleEscapeKeydown,
|
|
515
515
|
zIndex: akEditorFloatingDialogZIndex,
|
|
516
|
-
fitHeight:
|
|
516
|
+
fitHeight: isExperimentEnabled('platform_editor_status_popup_suggestions') && fg('platform_editor_status_popup_suggestions_patch_1') ? STATUS_PICKER_FIT_HEIGHT : 40,
|
|
517
517
|
mountTo: mountTo,
|
|
518
518
|
boundariesElement: boundariesElement,
|
|
519
519
|
scrollableElement: scrollableElement,
|
|
@@ -0,0 +1,24 @@
|
|
|
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 { uuid } from '@atlaskit/adf-schema';
|
|
5
|
+
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
6
|
+
export var DEFAULT_STATUS = {
|
|
7
|
+
text: '',
|
|
8
|
+
color: 'neutral'
|
|
9
|
+
};
|
|
10
|
+
export var DEFAULT_STATUS_NEW = {
|
|
11
|
+
text: '',
|
|
12
|
+
color: 'neutral',
|
|
13
|
+
style: 'mixedCase'
|
|
14
|
+
};
|
|
15
|
+
export var getDefaultStatusAttrs = function getDefaultStatusAttrs() {
|
|
16
|
+
return fg('platform-dst-lozenge-tag-badge-visual-uplifts') ? DEFAULT_STATUS_NEW : DEFAULT_STATUS;
|
|
17
|
+
};
|
|
18
|
+
export var createStatusNode = function createStatusNode(schema) {
|
|
19
|
+
var attrs = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
20
|
+
var marks = arguments.length > 2 ? arguments[2] : undefined;
|
|
21
|
+
return schema.nodes.status.createChecked(_objectSpread(_objectSpread({}, getDefaultStatusAttrs()), {}, {
|
|
22
|
+
localId: uuid.generate()
|
|
23
|
+
}, attrs), null, marks);
|
|
24
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
|
|
2
|
+
var MAX_STATUS_TURN_INTO_CHARS = 30;
|
|
3
|
+
var SUPPORTED_SOURCE_TYPES = new Set(['paragraph', 'heading']);
|
|
4
|
+
var getTurnIntoStatusSourceNode = function getTurnIntoStatusSourceNode(selection) {
|
|
5
|
+
if (!selection || !(selection instanceof NodeSelection)) {
|
|
6
|
+
return null;
|
|
7
|
+
}
|
|
8
|
+
return selection.node;
|
|
9
|
+
};
|
|
10
|
+
export var canTurnIntoStatus = function canTurnIntoStatus(node) {
|
|
11
|
+
if (!node || !SUPPORTED_SOURCE_TYPES.has(node.type.name)) {
|
|
12
|
+
return false;
|
|
13
|
+
}
|
|
14
|
+
for (var i = 0; i < node.childCount; i++) {
|
|
15
|
+
if (!node.child(i).isText) {
|
|
16
|
+
return false;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
return node.textContent.trim().length <= MAX_STATUS_TURN_INTO_CHARS;
|
|
20
|
+
};
|
|
21
|
+
export var isStatusTurnIntoHidden = function isStatusTurnIntoHidden(selection) {
|
|
22
|
+
return !canTurnIntoStatus(getTurnIntoStatusSourceNode(selection));
|
|
23
|
+
};
|
|
@@ -6,8 +6,6 @@ import type { Node } from '@atlaskit/editor-prosemirror/model';
|
|
|
6
6
|
import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
7
7
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
8
8
|
import type { ClosingPayload, StatusType } from '../types';
|
|
9
|
-
export declare const DEFAULT_STATUS: StatusType;
|
|
10
|
-
export declare const DEFAULT_STATUS_NEW: StatusType;
|
|
11
9
|
export declare const verifyAndInsertStatus: (statusNode: Node, tr: Transaction, annotationMarks?: Mark[] | undefined) => Transaction;
|
|
12
10
|
export declare const createStatus: (tr: Transaction) => Transaction;
|
|
13
11
|
export declare const insertStatus: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (inputMethod?: INPUT_METHOD.INSERT_MENU | INPUT_METHOD.QUICK_INSERT | INPUT_METHOD.TOOLBAR) => EditorCommand;
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import type { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
2
2
|
import type { NextEditorPlugin, OptionalPlugin, Command } from '@atlaskit/editor-common/types';
|
|
3
3
|
import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
4
|
+
import type { BlockControlsPlugin } from '@atlaskit/editor-plugin-block-controls/blockControlsPluginType';
|
|
5
|
+
import type { BlockMenuPlugin } from '@atlaskit/editor-plugin-block-menu/blockMenuPluginType';
|
|
6
|
+
import type { SelectionPlugin } from '@atlaskit/editor-plugin-selection';
|
|
4
7
|
import type { UiControlRegistryPlugin } from '@atlaskit/editor-plugin-ui-control-registry/ui-control-registry-plugin-type';
|
|
5
8
|
import type { commitStatusPicker, insertStatus, removeStatus, UpdateStatus } from './pm-plugins/actions';
|
|
6
9
|
import type { StatusPluginOptions, StatusState } from './types';
|
|
@@ -26,7 +29,10 @@ export type StatusPluginDependencies = [
|
|
|
26
29
|
OptionalPlugin<AnalyticsPlugin>,
|
|
27
30
|
OptionalPlugin<DummyAnnotationPlugin>,
|
|
28
31
|
OptionalPlugin<DummyEditorViewModePlugin>,
|
|
29
|
-
OptionalPlugin<UiControlRegistryPlugin
|
|
32
|
+
OptionalPlugin<UiControlRegistryPlugin>,
|
|
33
|
+
OptionalPlugin<BlockMenuPlugin>,
|
|
34
|
+
OptionalPlugin<BlockControlsPlugin>,
|
|
35
|
+
OptionalPlugin<SelectionPlugin>
|
|
30
36
|
];
|
|
31
37
|
export type StatusPluginActions = {
|
|
32
38
|
commitStatusPicker: typeof commitStatusPicker;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
3
|
+
import type { BlockMenuItemComponentProps } from '@atlaskit/editor-plugin-block-menu/blockMenuPluginType';
|
|
4
|
+
import type { StatusPlugin } from '../statusPluginType';
|
|
5
|
+
export declare const createStatusBlockMenuItem: (api: ExtractInjectionAPI<StatusPlugin> | undefined) => ({ isSuggested }?: BlockMenuItemComponentProps) => React.JSX.Element;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { Mark, Node, Schema } from '@atlaskit/editor-prosemirror/model';
|
|
2
|
+
import type { StatusType } from '../types';
|
|
3
|
+
export declare const DEFAULT_STATUS: StatusType;
|
|
4
|
+
export declare const DEFAULT_STATUS_NEW: StatusType;
|
|
5
|
+
export declare const getDefaultStatusAttrs: () => StatusType;
|
|
6
|
+
export declare const createStatusNode: (schema: Schema, attrs?: Partial<StatusType>, marks?: readonly Mark[]) => Node;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { Node } from '@atlaskit/editor-prosemirror/model';
|
|
2
|
+
import { type Selection } from '@atlaskit/editor-prosemirror/state';
|
|
3
|
+
export declare const canTurnIntoStatus: (node: Node | null) => boolean;
|
|
4
|
+
export declare const isStatusTurnIntoHidden: (selection: Selection | undefined) => boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-status",
|
|
3
|
-
"version": "17.
|
|
3
|
+
"version": "17.3.0",
|
|
4
4
|
"description": "Status plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -21,27 +21,31 @@
|
|
|
21
21
|
],
|
|
22
22
|
"atlaskit:src": "src/index.ts",
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@atlaskit/adf-schema": "^57.
|
|
24
|
+
"@atlaskit/adf-schema": "^57.3.0",
|
|
25
25
|
"@atlaskit/analytics-next": "^12.5.0",
|
|
26
26
|
"@atlaskit/browser-apis": "^1.2.0",
|
|
27
27
|
"@atlaskit/editor-plugin-analytics": "^16.1.0",
|
|
28
|
+
"@atlaskit/editor-plugin-block-controls": "^17.3.0",
|
|
29
|
+
"@atlaskit/editor-plugin-block-menu": "^15.1.0",
|
|
30
|
+
"@atlaskit/editor-plugin-selection": "^16.1.0",
|
|
28
31
|
"@atlaskit/editor-plugin-ui-control-registry": "^10.0.0",
|
|
29
32
|
"@atlaskit/editor-prosemirror": "^8.0.0",
|
|
30
33
|
"@atlaskit/editor-shared-styles": "^4.1.0",
|
|
34
|
+
"@atlaskit/editor-toolbar": "^2.6.0",
|
|
31
35
|
"@atlaskit/editor-ui-control-model": "^2.9.0",
|
|
32
36
|
"@atlaskit/icon": "^37.6.0",
|
|
33
|
-
"@atlaskit/icon-lab": "^7.
|
|
37
|
+
"@atlaskit/icon-lab": "^7.8.0",
|
|
34
38
|
"@atlaskit/platform-feature-experiments": "^0.3.0",
|
|
35
39
|
"@atlaskit/platform-feature-flags": "^2.2.0",
|
|
36
40
|
"@atlaskit/status": "^5.9.0",
|
|
37
|
-
"@atlaskit/tmp-editor-statsig": "^
|
|
41
|
+
"@atlaskit/tmp-editor-statsig": "^174.0.0",
|
|
38
42
|
"@atlaskit/tokens": "^16.11.0",
|
|
39
43
|
"@atlaskit/visually-hidden": "^4.4.0",
|
|
40
44
|
"@babel/runtime": "^7.0.0",
|
|
41
45
|
"@emotion/react": "^11.7.1"
|
|
42
46
|
},
|
|
43
47
|
"peerDependencies": {
|
|
44
|
-
"@atlaskit/editor-common": "^120.
|
|
48
|
+
"@atlaskit/editor-common": "^120.15.0",
|
|
45
49
|
"react": "^18.2.0 || ^19.2.0",
|
|
46
50
|
"react-dom": "^18.2.0 || ^19.2.0",
|
|
47
51
|
"react-intl": "^5.25.1 || ^6.0.0 || ^7.0.0"
|