@atlaskit/editor-core 188.5.2 → 188.7.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 +16 -0
- package/dist/cjs/plugins/insert-block/ui/ToolbarInsertBlock/index.js +30 -29
- package/dist/cjs/plugins/status/actions.js +14 -11
- package/dist/cjs/plugins/status/index.js +17 -8
- package/dist/cjs/plugins/status/keymap.js +1 -1
- package/dist/cjs/plugins/status/ui/statusPicker.js +2 -2
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/es2019/plugins/insert-block/ui/ToolbarInsertBlock/index.js +3 -3
- package/dist/es2019/plugins/status/actions.js +3 -2
- package/dist/es2019/plugins/status/index.js +91 -80
- package/dist/es2019/plugins/status/keymap.js +1 -1
- package/dist/es2019/plugins/status/ui/statusPicker.js +1 -1
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/esm/plugins/insert-block/ui/ToolbarInsertBlock/index.js +30 -29
- package/dist/esm/plugins/status/actions.js +14 -11
- package/dist/esm/plugins/status/index.js +17 -8
- package/dist/esm/plugins/status/keymap.js +1 -1
- package/dist/esm/plugins/status/ui/statusPicker.js +1 -1
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/types/plugins/insert-block/types.d.ts +3 -1
- package/dist/types/plugins/status/actions.d.ts +4 -2
- package/dist/types/plugins/status/index.d.ts +12 -3
- package/dist/types/plugins/status/nodeviews/status.d.ts +1 -1
- package/dist/types/plugins/status/plugin.d.ts +1 -1
- package/package.json +4 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @atlaskit/editor-core
|
|
2
2
|
|
|
3
|
+
## 188.7.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#41355](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/41355) [`150c2a815ac`](https://bitbucket.org/atlassian/atlassian-frontend/commits/150c2a815ac) - Editor now forcibly sets position static on its dropdown menu items.
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies
|
|
12
|
+
|
|
13
|
+
## 188.6.0
|
|
14
|
+
|
|
15
|
+
### Minor Changes
|
|
16
|
+
|
|
17
|
+
- [#41341](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/41341) [`bd128fb1cfb`](https://bitbucket.org/atlassian/atlassian-frontend/commits/bd128fb1cfb) - Decouple status plugin from editor-core. Add new actions for updating status.
|
|
18
|
+
|
|
3
19
|
## 188.5.2
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
|
@@ -26,7 +26,6 @@ var _actions = require("../../../placeholder-text/actions");
|
|
|
26
26
|
var _actions2 = require("../../../layout/actions");
|
|
27
27
|
var _commands = require("../../../tasks-and-decisions/commands");
|
|
28
28
|
var _commands2 = require("../../../expand/commands");
|
|
29
|
-
var _actions3 = require("../../../status/actions");
|
|
30
29
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
31
30
|
var _messages = require("./messages");
|
|
32
31
|
var _createItems3 = require("./create-items");
|
|
@@ -220,14 +219,16 @@ var ToolbarInsertBlock = exports.ToolbarInsertBlock = /*#__PURE__*/function (_Re
|
|
|
220
219
|
return true;
|
|
221
220
|
});
|
|
222
221
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "createStatus", function (inputMethod) {
|
|
223
|
-
var
|
|
224
|
-
|
|
225
|
-
|
|
222
|
+
var _pluginInjectionApi$s, _pluginInjectionApi$s2;
|
|
223
|
+
var _this$props4 = _this.props,
|
|
224
|
+
pluginInjectionApi = _this$props4.pluginInjectionApi,
|
|
225
|
+
editorView = _this$props4.editorView;
|
|
226
|
+
return (_pluginInjectionApi$s = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$s2 = pluginInjectionApi.status) === null || _pluginInjectionApi$s2 === void 0 || (_pluginInjectionApi$s2 = _pluginInjectionApi$s2.actions) === null || _pluginInjectionApi$s2 === void 0 ? void 0 : _pluginInjectionApi$s2.updateStatus(inputMethod)(editorView.state, editorView.dispatch)) !== null && _pluginInjectionApi$s !== void 0 ? _pluginInjectionApi$s : false;
|
|
226
227
|
});
|
|
227
228
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "openMediaPicker", function (inputMethod) {
|
|
228
|
-
var _this$
|
|
229
|
-
onShowMediaPicker = _this$
|
|
230
|
-
dispatchAnalyticsEvent = _this$
|
|
229
|
+
var _this$props5 = _this.props,
|
|
230
|
+
onShowMediaPicker = _this$props5.onShowMediaPicker,
|
|
231
|
+
dispatchAnalyticsEvent = _this$props5.dispatchAnalyticsEvent;
|
|
231
232
|
if (onShowMediaPicker) {
|
|
232
233
|
onShowMediaPicker();
|
|
233
234
|
if (dispatchAnalyticsEvent) {
|
|
@@ -255,11 +256,11 @@ var ToolbarInsertBlock = exports.ToolbarInsertBlock = /*#__PURE__*/function (_Re
|
|
|
255
256
|
});
|
|
256
257
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "insertHorizontalRule", function (inputMethod) {
|
|
257
258
|
var _pluginInjectionApi$r, _pluginInjectionApi$r2;
|
|
258
|
-
var _this$
|
|
259
|
-
_this$
|
|
260
|
-
state = _this$
|
|
261
|
-
dispatch = _this$
|
|
262
|
-
pluginInjectionApi = _this$
|
|
259
|
+
var _this$props6 = _this.props,
|
|
260
|
+
_this$props6$editorVi = _this$props6.editorView,
|
|
261
|
+
state = _this$props6$editorVi.state,
|
|
262
|
+
dispatch = _this$props6$editorVi.dispatch,
|
|
263
|
+
pluginInjectionApi = _this$props6.pluginInjectionApi;
|
|
263
264
|
return (_pluginInjectionApi$r = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$r2 = pluginInjectionApi.rule) === null || _pluginInjectionApi$r2 === void 0 ? void 0 : _pluginInjectionApi$r2.actions.insertHorizontalRule(inputMethod)(state, dispatch)) !== null && _pluginInjectionApi$r !== void 0 ? _pluginInjectionApi$r : false;
|
|
264
265
|
});
|
|
265
266
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "insertExpand", function () {
|
|
@@ -270,9 +271,9 @@ var ToolbarInsertBlock = exports.ToolbarInsertBlock = /*#__PURE__*/function (_Re
|
|
|
270
271
|
});
|
|
271
272
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "insertBlockType", function (itemName) {
|
|
272
273
|
return function () {
|
|
273
|
-
var _this$
|
|
274
|
-
editorView = _this$
|
|
275
|
-
onInsertBlockType = _this$
|
|
274
|
+
var _this$props7 = _this.props,
|
|
275
|
+
editorView = _this$props7.editorView,
|
|
276
|
+
onInsertBlockType = _this$props7.onInsertBlockType;
|
|
276
277
|
var state = editorView.state,
|
|
277
278
|
dispatch = editorView.dispatch;
|
|
278
279
|
onInsertBlockType(itemName)(state, dispatch);
|
|
@@ -295,11 +296,11 @@ var ToolbarInsertBlock = exports.ToolbarInsertBlock = /*#__PURE__*/function (_Re
|
|
|
295
296
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onItemActivated", function (_ref2) {
|
|
296
297
|
var item = _ref2.item,
|
|
297
298
|
inputMethod = _ref2.inputMethod;
|
|
298
|
-
var _this$
|
|
299
|
-
editorView = _this$
|
|
300
|
-
editorActions = _this$
|
|
301
|
-
handleImageUpload = _this$
|
|
302
|
-
expandEnabled = _this$
|
|
299
|
+
var _this$props8 = _this.props,
|
|
300
|
+
editorView = _this$props8.editorView,
|
|
301
|
+
editorActions = _this$props8.editorActions,
|
|
302
|
+
handleImageUpload = _this$props8.handleImageUpload,
|
|
303
|
+
expandEnabled = _this$props8.expandEnabled;
|
|
303
304
|
|
|
304
305
|
// need to do this before inserting nodes so scrollIntoView works properly
|
|
305
306
|
if (!editorView.hasFocus()) {
|
|
@@ -415,12 +416,12 @@ var ToolbarInsertBlock = exports.ToolbarInsertBlock = /*#__PURE__*/function (_Re
|
|
|
415
416
|
key: "renderPopup",
|
|
416
417
|
value: function renderPopup() {
|
|
417
418
|
var emojiPickerOpen = this.state.emojiPickerOpen;
|
|
418
|
-
var _this$
|
|
419
|
-
popupsMountPoint = _this$
|
|
420
|
-
popupsBoundariesElement = _this$
|
|
421
|
-
popupsScrollableElement = _this$
|
|
422
|
-
emojiProvider = _this$
|
|
423
|
-
replacePlusMenuWithElementBrowser = _this$
|
|
419
|
+
var _this$props9 = this.props,
|
|
420
|
+
popupsMountPoint = _this$props9.popupsMountPoint,
|
|
421
|
+
popupsBoundariesElement = _this$props9.popupsBoundariesElement,
|
|
422
|
+
popupsScrollableElement = _this$props9.popupsScrollableElement,
|
|
423
|
+
emojiProvider = _this$props9.emojiProvider,
|
|
424
|
+
replacePlusMenuWithElementBrowser = _this$props9.replacePlusMenuWithElementBrowser;
|
|
424
425
|
var dropdownEmoji = this.state.dropdownItems.some(function (_ref4) {
|
|
425
426
|
var name = _ref4.value.name;
|
|
426
427
|
return name === 'emoji';
|
|
@@ -457,9 +458,9 @@ var ToolbarInsertBlock = exports.ToolbarInsertBlock = /*#__PURE__*/function (_Re
|
|
|
457
458
|
buttons = _this$state.buttons,
|
|
458
459
|
dropdownItems = _this$state.dropdownItems,
|
|
459
460
|
emojiPickerOpen = _this$state.emojiPickerOpen;
|
|
460
|
-
var _this$
|
|
461
|
-
isDisabled = _this$
|
|
462
|
-
isReducedSpacing = _this$
|
|
461
|
+
var _this$props10 = this.props,
|
|
462
|
+
isDisabled = _this$props10.isDisabled,
|
|
463
|
+
isReducedSpacing = _this$props10.isReducedSpacing;
|
|
463
464
|
if (buttons.length === 0 && dropdownItems.length === 0) {
|
|
464
465
|
return null;
|
|
465
466
|
}
|
|
@@ -9,7 +9,8 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
|
|
|
9
9
|
var _model = require("@atlaskit/editor-prosemirror/model");
|
|
10
10
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
11
11
|
var _adfSchema = require("@atlaskit/adf-schema");
|
|
12
|
-
var _analytics = require("
|
|
12
|
+
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
13
|
+
var _editorAnalytics = require("@atlaskit/editor-common/editor-analytics");
|
|
13
14
|
var _pluginKey = require("./plugin-key");
|
|
14
15
|
var _utils = require("@atlaskit/editor-prosemirror/utils");
|
|
15
16
|
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; }
|
|
@@ -78,16 +79,18 @@ var updateStatus = exports.updateStatus = function updateStatus(status) {
|
|
|
78
79
|
return false;
|
|
79
80
|
};
|
|
80
81
|
};
|
|
81
|
-
var updateStatusWithAnalytics = exports.updateStatusWithAnalytics = function updateStatusWithAnalytics(
|
|
82
|
-
return (
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
82
|
+
var updateStatusWithAnalytics = exports.updateStatusWithAnalytics = function updateStatusWithAnalytics(editorAnalyticsAPI) {
|
|
83
|
+
return function (inputMethod, status) {
|
|
84
|
+
return (0, _editorAnalytics.withAnalytics)(editorAnalyticsAPI, {
|
|
85
|
+
action: _analytics.ACTION.INSERTED,
|
|
86
|
+
actionSubject: _analytics.ACTION_SUBJECT.DOCUMENT,
|
|
87
|
+
actionSubjectId: _analytics.ACTION_SUBJECT_ID.STATUS,
|
|
88
|
+
attributes: {
|
|
89
|
+
inputMethod: inputMethod
|
|
90
|
+
},
|
|
91
|
+
eventType: _analytics.EVENT_TYPE.TRACK
|
|
92
|
+
})(updateStatus(status));
|
|
93
|
+
};
|
|
91
94
|
};
|
|
92
95
|
var setStatusPickerAt = exports.setStatusPickerAt = function setStatusPickerAt(showStatusPickerAt) {
|
|
93
96
|
return function (state, dispatch) {
|
|
@@ -8,8 +8,8 @@ exports.default = void 0;
|
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
var _utils = require("@atlaskit/editor-prosemirror/utils");
|
|
10
10
|
var _adfSchema = require("@atlaskit/adf-schema");
|
|
11
|
-
var
|
|
12
|
-
var _analytics = require("
|
|
11
|
+
var _withPluginState = require("@atlaskit/editor-common/with-plugin-state");
|
|
12
|
+
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
13
13
|
var _messages = require("../insert-block/ui/ToolbarInsertBlock/messages");
|
|
14
14
|
var _quickInsert = require("@atlaskit/editor-common/quick-insert");
|
|
15
15
|
var _actions = require("./actions");
|
|
@@ -18,7 +18,9 @@ var _plugin = _interopRequireDefault(require("./plugin"));
|
|
|
18
18
|
var _pluginKey = require("./plugin-key");
|
|
19
19
|
var _statusPicker = _interopRequireDefault(require("./ui/statusPicker"));
|
|
20
20
|
var baseStatusPlugin = function baseStatusPlugin(_ref) {
|
|
21
|
-
var
|
|
21
|
+
var _api$analytics;
|
|
22
|
+
var options = _ref.config,
|
|
23
|
+
api = _ref.api;
|
|
22
24
|
return {
|
|
23
25
|
name: 'status',
|
|
24
26
|
nodes: function nodes() {
|
|
@@ -38,13 +40,17 @@ var baseStatusPlugin = function baseStatusPlugin(_ref) {
|
|
|
38
40
|
plugin: _keymap.keymapPlugin
|
|
39
41
|
}];
|
|
40
42
|
},
|
|
43
|
+
actions: {
|
|
44
|
+
commitStatusPicker: _actions.commitStatusPicker,
|
|
45
|
+
updateStatus: (0, _actions.updateStatusWithAnalytics)(api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions)
|
|
46
|
+
},
|
|
41
47
|
contentComponent: function contentComponent(_ref2) {
|
|
42
48
|
var editorView = _ref2.editorView,
|
|
43
49
|
popupsMountPoint = _ref2.popupsMountPoint,
|
|
44
50
|
popupsBoundariesElement = _ref2.popupsBoundariesElement,
|
|
45
51
|
popupsScrollableElement = _ref2.popupsScrollableElement;
|
|
46
52
|
var domAtPos = editorView.domAtPos.bind(editorView);
|
|
47
|
-
return /*#__PURE__*/_react.default.createElement(
|
|
53
|
+
return /*#__PURE__*/_react.default.createElement(_withPluginState.WithPluginState, {
|
|
48
54
|
plugins: {
|
|
49
55
|
statusState: _pluginKey.pluginKey
|
|
50
56
|
},
|
|
@@ -91,7 +97,7 @@ var baseStatusPlugin = function baseStatusPlugin(_ref) {
|
|
|
91
97
|
}
|
|
92
98
|
};
|
|
93
99
|
};
|
|
94
|
-
var decorateWithPluginOptions = function decorateWithPluginOptions(plugin, options) {
|
|
100
|
+
var decorateWithPluginOptions = function decorateWithPluginOptions(plugin, options, api) {
|
|
95
101
|
if ((options === null || options === void 0 ? void 0 : options.menuDisabled) === true) {
|
|
96
102
|
return plugin;
|
|
97
103
|
}
|
|
@@ -108,7 +114,9 @@ var decorateWithPluginOptions = function decorateWithPluginOptions(plugin, optio
|
|
|
108
114
|
return /*#__PURE__*/_react.default.createElement(_quickInsert.IconStatus, null);
|
|
109
115
|
},
|
|
110
116
|
action: function action(insert, state) {
|
|
111
|
-
|
|
117
|
+
var _api$analytics2;
|
|
118
|
+
var tr = (0, _actions.createStatus)()(insert, state);
|
|
119
|
+
api === null || api === void 0 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 || _api$analytics2.actions.attachAnalyticsEvent({
|
|
112
120
|
action: _analytics.ACTION.INSERTED,
|
|
113
121
|
actionSubject: _analytics.ACTION_SUBJECT.DOCUMENT,
|
|
114
122
|
actionSubjectId: _analytics.ACTION_SUBJECT_ID.STATUS,
|
|
@@ -116,7 +124,8 @@ var decorateWithPluginOptions = function decorateWithPluginOptions(plugin, optio
|
|
|
116
124
|
inputMethod: _analytics.INPUT_METHOD.QUICK_INSERT
|
|
117
125
|
},
|
|
118
126
|
eventType: _analytics.EVENT_TYPE.TRACK
|
|
119
|
-
});
|
|
127
|
+
})(tr);
|
|
128
|
+
return tr;
|
|
120
129
|
}
|
|
121
130
|
}];
|
|
122
131
|
}
|
|
@@ -129,6 +138,6 @@ var statusPlugin = function statusPlugin(_ref5) {
|
|
|
129
138
|
return decorateWithPluginOptions(baseStatusPlugin({
|
|
130
139
|
config: options,
|
|
131
140
|
api: api
|
|
132
|
-
}), options);
|
|
141
|
+
}), options, api);
|
|
133
142
|
};
|
|
134
143
|
var _default = exports.default = statusPlugin;
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
exports.keymapPlugin = keymapPlugin;
|
|
8
8
|
var _keymap = require("@atlaskit/editor-prosemirror/keymap");
|
|
9
|
-
var _keymaps = require("
|
|
9
|
+
var _keymaps = require("@atlaskit/editor-common/keymaps");
|
|
10
10
|
var _utils = require("./utils");
|
|
11
11
|
function keymapPlugin() {
|
|
12
12
|
var list = {};
|
|
@@ -21,14 +21,14 @@ var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
|
21
21
|
var _picker = require("@atlaskit/status/picker");
|
|
22
22
|
var _constants = require("@atlaskit/theme/constants");
|
|
23
23
|
var _colors = require("@atlaskit/theme/colors");
|
|
24
|
-
var
|
|
24
|
+
var _uiReact = require("@atlaskit/editor-common/ui-react");
|
|
25
25
|
var _actions = require("../actions");
|
|
26
26
|
var _analytics = require("../analytics");
|
|
27
27
|
var _templateObject;
|
|
28
28
|
/** @jsx jsx */
|
|
29
29
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
|
|
30
30
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
31
|
-
var PopupWithListeners = (0,
|
|
31
|
+
var PopupWithListeners = (0, _uiReact.withReactEditorViewOuterListeners)(_ui.Popup);
|
|
32
32
|
var InputMethod = exports.InputMethod = /*#__PURE__*/function (InputMethod) {
|
|
33
33
|
InputMethod["blur"] = "blur";
|
|
34
34
|
InputMethod["escKey"] = "escKey";
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.version = exports.nextMajorVersion = exports.name = void 0;
|
|
7
7
|
var name = exports.name = "@atlaskit/editor-core";
|
|
8
|
-
var version = exports.version = "188.
|
|
8
|
+
var version = exports.version = "188.7.0";
|
|
9
9
|
var nextMajorVersion = exports.nextMajorVersion = function nextMajorVersion() {
|
|
10
10
|
return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
|
|
11
11
|
};
|
|
@@ -13,7 +13,6 @@ import { showPlaceholderFloatingToolbar } from '../../../placeholder-text/action
|
|
|
13
13
|
import { insertLayoutColumnsWithAnalytics } from '../../../layout/actions';
|
|
14
14
|
import { insertTaskDecisionCommand } from '../../../tasks-and-decisions/commands';
|
|
15
15
|
import { insertExpand } from '../../../expand/commands';
|
|
16
|
-
import { updateStatusWithAnalytics } from '../../../status/actions';
|
|
17
16
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
18
17
|
import { messages } from './messages';
|
|
19
18
|
import { createItems } from './create-items';
|
|
@@ -212,11 +211,12 @@ export class ToolbarInsertBlock extends React.PureComponent {
|
|
|
212
211
|
return true;
|
|
213
212
|
});
|
|
214
213
|
_defineProperty(this, "createStatus", inputMethod => {
|
|
214
|
+
var _pluginInjectionApi$s, _pluginInjectionApi$s2, _pluginInjectionApi$s3;
|
|
215
215
|
const {
|
|
216
|
+
pluginInjectionApi,
|
|
216
217
|
editorView
|
|
217
218
|
} = this.props;
|
|
218
|
-
|
|
219
|
-
return true;
|
|
219
|
+
return (_pluginInjectionApi$s = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$s2 = pluginInjectionApi.status) === null || _pluginInjectionApi$s2 === void 0 ? void 0 : (_pluginInjectionApi$s3 = _pluginInjectionApi$s2.actions) === null || _pluginInjectionApi$s3 === void 0 ? void 0 : _pluginInjectionApi$s3.updateStatus(inputMethod)(editorView.state, editorView.dispatch)) !== null && _pluginInjectionApi$s !== void 0 ? _pluginInjectionApi$s : false;
|
|
220
220
|
});
|
|
221
221
|
_defineProperty(this, "openMediaPicker", inputMethod => {
|
|
222
222
|
const {
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { Fragment } from '@atlaskit/editor-prosemirror/model';
|
|
2
2
|
import { NodeSelection, Selection } from '@atlaskit/editor-prosemirror/state';
|
|
3
3
|
import { uuid } from '@atlaskit/adf-schema';
|
|
4
|
-
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE
|
|
4
|
+
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
|
|
5
|
+
import { withAnalytics } from '@atlaskit/editor-common/editor-analytics';
|
|
5
6
|
import { pluginKey } from './plugin-key';
|
|
6
7
|
import { canInsert } from '@atlaskit/editor-prosemirror/utils';
|
|
7
8
|
export const DEFAULT_STATUS = {
|
|
@@ -70,7 +71,7 @@ export const updateStatus = status => (state, dispatch) => {
|
|
|
70
71
|
}
|
|
71
72
|
return false;
|
|
72
73
|
};
|
|
73
|
-
export const updateStatusWithAnalytics = (inputMethod, status) => withAnalytics({
|
|
74
|
+
export const updateStatusWithAnalytics = editorAnalyticsAPI => (inputMethod, status) => withAnalytics(editorAnalyticsAPI, {
|
|
74
75
|
action: ACTION.INSERTED,
|
|
75
76
|
actionSubject: ACTION_SUBJECT.DOCUMENT,
|
|
76
77
|
actionSubjectId: ACTION_SUBJECT_ID.STATUS,
|
|
@@ -1,91 +1,99 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { findDomRefAtPos } from '@atlaskit/editor-prosemirror/utils';
|
|
3
3
|
import { status } from '@atlaskit/adf-schema';
|
|
4
|
-
import WithPluginState from '
|
|
5
|
-
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID,
|
|
4
|
+
import { WithPluginState } from '@atlaskit/editor-common/with-plugin-state';
|
|
5
|
+
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
6
6
|
import { messages } from '../insert-block/ui/ToolbarInsertBlock/messages';
|
|
7
7
|
import { IconStatus } from '@atlaskit/editor-common/quick-insert';
|
|
8
|
-
import { commitStatusPicker, createStatus, updateStatus } from './actions';
|
|
8
|
+
import { updateStatusWithAnalytics, commitStatusPicker, createStatus, updateStatus } from './actions';
|
|
9
9
|
import { keymapPlugin } from './keymap';
|
|
10
10
|
import createStatusPlugin from './plugin';
|
|
11
11
|
import { pluginKey } from './plugin-key';
|
|
12
12
|
import StatusPicker from './ui/statusPicker';
|
|
13
13
|
const baseStatusPlugin = ({
|
|
14
|
-
config: options
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
text,
|
|
59
|
-
color,
|
|
60
|
-
localId
|
|
61
|
-
} = statusNode.attrs;
|
|
62
|
-
return /*#__PURE__*/React.createElement(StatusPicker, {
|
|
63
|
-
isNew: statusState.isNew,
|
|
64
|
-
target: target,
|
|
65
|
-
defaultText: text,
|
|
66
|
-
defaultColor: color,
|
|
67
|
-
defaultLocalId: localId,
|
|
68
|
-
mountTo: popupsMountPoint,
|
|
69
|
-
boundariesElement: popupsBoundariesElement,
|
|
70
|
-
scrollableElement: popupsScrollableElement,
|
|
71
|
-
onSelect: status => {
|
|
72
|
-
updateStatus(status)(editorView.state, editorView.dispatch);
|
|
73
|
-
},
|
|
74
|
-
onTextChanged: status => {
|
|
75
|
-
updateStatus(status)(editorView.state, editorView.dispatch);
|
|
76
|
-
},
|
|
77
|
-
closeStatusPicker: closingPayload => {
|
|
78
|
-
commitStatusPicker(closingPayload)(editorView);
|
|
79
|
-
},
|
|
80
|
-
onEnter: () => {
|
|
81
|
-
commitStatusPicker()(editorView);
|
|
14
|
+
config: options,
|
|
15
|
+
api
|
|
16
|
+
}) => {
|
|
17
|
+
var _api$analytics;
|
|
18
|
+
return {
|
|
19
|
+
name: 'status',
|
|
20
|
+
nodes() {
|
|
21
|
+
return [{
|
|
22
|
+
name: 'status',
|
|
23
|
+
node: status
|
|
24
|
+
}];
|
|
25
|
+
},
|
|
26
|
+
pmPlugins() {
|
|
27
|
+
return [{
|
|
28
|
+
name: 'status',
|
|
29
|
+
plugin: pmPluginFactoryParams => createStatusPlugin(pmPluginFactoryParams, options)
|
|
30
|
+
}, {
|
|
31
|
+
name: 'statusKeymap',
|
|
32
|
+
plugin: keymapPlugin
|
|
33
|
+
}];
|
|
34
|
+
},
|
|
35
|
+
actions: {
|
|
36
|
+
commitStatusPicker,
|
|
37
|
+
updateStatus: updateStatusWithAnalytics(api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions)
|
|
38
|
+
},
|
|
39
|
+
contentComponent({
|
|
40
|
+
editorView,
|
|
41
|
+
popupsMountPoint,
|
|
42
|
+
popupsBoundariesElement,
|
|
43
|
+
popupsScrollableElement
|
|
44
|
+
}) {
|
|
45
|
+
const domAtPos = editorView.domAtPos.bind(editorView);
|
|
46
|
+
return /*#__PURE__*/React.createElement(WithPluginState, {
|
|
47
|
+
plugins: {
|
|
48
|
+
statusState: pluginKey
|
|
49
|
+
},
|
|
50
|
+
render: ({
|
|
51
|
+
statusState = {}
|
|
52
|
+
}) => {
|
|
53
|
+
const {
|
|
54
|
+
showStatusPickerAt
|
|
55
|
+
} = statusState;
|
|
56
|
+
if (typeof showStatusPickerAt !== 'number') {
|
|
57
|
+
return null;
|
|
82
58
|
}
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
}
|
|
88
|
-
const
|
|
59
|
+
const target = findDomRefAtPos(showStatusPickerAt, domAtPos);
|
|
60
|
+
const statusNode = editorView.state.doc.nodeAt(showStatusPickerAt);
|
|
61
|
+
if (!statusNode || statusNode.type.name !== 'status') {
|
|
62
|
+
return null;
|
|
63
|
+
}
|
|
64
|
+
const {
|
|
65
|
+
text,
|
|
66
|
+
color,
|
|
67
|
+
localId
|
|
68
|
+
} = statusNode.attrs;
|
|
69
|
+
return /*#__PURE__*/React.createElement(StatusPicker, {
|
|
70
|
+
isNew: statusState.isNew,
|
|
71
|
+
target: target,
|
|
72
|
+
defaultText: text,
|
|
73
|
+
defaultColor: color,
|
|
74
|
+
defaultLocalId: localId,
|
|
75
|
+
mountTo: popupsMountPoint,
|
|
76
|
+
boundariesElement: popupsBoundariesElement,
|
|
77
|
+
scrollableElement: popupsScrollableElement,
|
|
78
|
+
onSelect: status => {
|
|
79
|
+
updateStatus(status)(editorView.state, editorView.dispatch);
|
|
80
|
+
},
|
|
81
|
+
onTextChanged: status => {
|
|
82
|
+
updateStatus(status)(editorView.state, editorView.dispatch);
|
|
83
|
+
},
|
|
84
|
+
closeStatusPicker: closingPayload => {
|
|
85
|
+
commitStatusPicker(closingPayload)(editorView);
|
|
86
|
+
},
|
|
87
|
+
onEnter: () => {
|
|
88
|
+
commitStatusPicker()(editorView);
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
};
|
|
96
|
+
const decorateWithPluginOptions = (plugin, options, api) => {
|
|
89
97
|
if ((options === null || options === void 0 ? void 0 : options.menuDisabled) === true) {
|
|
90
98
|
return plugin;
|
|
91
99
|
}
|
|
@@ -100,7 +108,9 @@ const decorateWithPluginOptions = (plugin, options) => {
|
|
|
100
108
|
keywords: ['lozenge'],
|
|
101
109
|
icon: () => /*#__PURE__*/React.createElement(IconStatus, null),
|
|
102
110
|
action(insert, state) {
|
|
103
|
-
|
|
111
|
+
var _api$analytics2;
|
|
112
|
+
const tr = createStatus()(insert, state);
|
|
113
|
+
api === null || api === void 0 ? void 0 : (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions.attachAnalyticsEvent({
|
|
104
114
|
action: ACTION.INSERTED,
|
|
105
115
|
actionSubject: ACTION_SUBJECT.DOCUMENT,
|
|
106
116
|
actionSubjectId: ACTION_SUBJECT_ID.STATUS,
|
|
@@ -108,7 +118,8 @@ const decorateWithPluginOptions = (plugin, options) => {
|
|
|
108
118
|
inputMethod: INPUT_METHOD.QUICK_INSERT
|
|
109
119
|
},
|
|
110
120
|
eventType: EVENT_TYPE.TRACK
|
|
111
|
-
});
|
|
121
|
+
})(tr);
|
|
122
|
+
return tr;
|
|
112
123
|
}
|
|
113
124
|
}]
|
|
114
125
|
};
|
|
@@ -120,5 +131,5 @@ const statusPlugin = ({
|
|
|
120
131
|
}) => decorateWithPluginOptions(baseStatusPlugin({
|
|
121
132
|
config: options,
|
|
122
133
|
api
|
|
123
|
-
}), options);
|
|
134
|
+
}), options, api);
|
|
124
135
|
export default statusPlugin;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { keymap } from '@atlaskit/editor-prosemirror/keymap';
|
|
2
|
-
import { bindKeymapWithCommand, enter, tab } from '
|
|
2
|
+
import { bindKeymapWithCommand, enter, tab } from '@atlaskit/editor-common/keymaps';
|
|
3
3
|
import { mayGetStatusAtSelection } from './utils';
|
|
4
4
|
export function keymapPlugin() {
|
|
5
5
|
const list = {};
|
|
@@ -9,7 +9,7 @@ import { akEditorFloatingDialogZIndex } from '@atlaskit/editor-shared-styles';
|
|
|
9
9
|
import { StatusPicker as AkStatusPicker } from '@atlaskit/status/picker';
|
|
10
10
|
import { borderRadius } from '@atlaskit/theme/constants';
|
|
11
11
|
import { N0 } from '@atlaskit/theme/colors';
|
|
12
|
-
import withOuterListeners from '
|
|
12
|
+
import { withReactEditorViewOuterListeners as withOuterListeners } from '@atlaskit/editor-common/ui-react';
|
|
13
13
|
import { DEFAULT_STATUS } from '../actions';
|
|
14
14
|
import { analyticsState, createStatusAnalyticsAndFire } from '../analytics';
|
|
15
15
|
const PopupWithListeners = withOuterListeners(Popup);
|
|
@@ -24,7 +24,6 @@ import { showPlaceholderFloatingToolbar } from '../../../placeholder-text/action
|
|
|
24
24
|
import { insertLayoutColumnsWithAnalytics } from '../../../layout/actions';
|
|
25
25
|
import { insertTaskDecisionCommand } from '../../../tasks-and-decisions/commands';
|
|
26
26
|
import { insertExpand } from '../../../expand/commands';
|
|
27
|
-
import { updateStatusWithAnalytics } from '../../../status/actions';
|
|
28
27
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
29
28
|
import { messages } from './messages';
|
|
30
29
|
import { createItems } from './create-items';
|
|
@@ -215,14 +214,16 @@ export var ToolbarInsertBlock = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
215
214
|
return true;
|
|
216
215
|
});
|
|
217
216
|
_defineProperty(_assertThisInitialized(_this), "createStatus", function (inputMethod) {
|
|
218
|
-
var
|
|
219
|
-
|
|
220
|
-
|
|
217
|
+
var _pluginInjectionApi$s, _pluginInjectionApi$s2;
|
|
218
|
+
var _this$props4 = _this.props,
|
|
219
|
+
pluginInjectionApi = _this$props4.pluginInjectionApi,
|
|
220
|
+
editorView = _this$props4.editorView;
|
|
221
|
+
return (_pluginInjectionApi$s = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$s2 = pluginInjectionApi.status) === null || _pluginInjectionApi$s2 === void 0 || (_pluginInjectionApi$s2 = _pluginInjectionApi$s2.actions) === null || _pluginInjectionApi$s2 === void 0 ? void 0 : _pluginInjectionApi$s2.updateStatus(inputMethod)(editorView.state, editorView.dispatch)) !== null && _pluginInjectionApi$s !== void 0 ? _pluginInjectionApi$s : false;
|
|
221
222
|
});
|
|
222
223
|
_defineProperty(_assertThisInitialized(_this), "openMediaPicker", function (inputMethod) {
|
|
223
|
-
var _this$
|
|
224
|
-
onShowMediaPicker = _this$
|
|
225
|
-
dispatchAnalyticsEvent = _this$
|
|
224
|
+
var _this$props5 = _this.props,
|
|
225
|
+
onShowMediaPicker = _this$props5.onShowMediaPicker,
|
|
226
|
+
dispatchAnalyticsEvent = _this$props5.dispatchAnalyticsEvent;
|
|
226
227
|
if (onShowMediaPicker) {
|
|
227
228
|
onShowMediaPicker();
|
|
228
229
|
if (dispatchAnalyticsEvent) {
|
|
@@ -250,11 +251,11 @@ export var ToolbarInsertBlock = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
250
251
|
});
|
|
251
252
|
_defineProperty(_assertThisInitialized(_this), "insertHorizontalRule", function (inputMethod) {
|
|
252
253
|
var _pluginInjectionApi$r, _pluginInjectionApi$r2;
|
|
253
|
-
var _this$
|
|
254
|
-
_this$
|
|
255
|
-
state = _this$
|
|
256
|
-
dispatch = _this$
|
|
257
|
-
pluginInjectionApi = _this$
|
|
254
|
+
var _this$props6 = _this.props,
|
|
255
|
+
_this$props6$editorVi = _this$props6.editorView,
|
|
256
|
+
state = _this$props6$editorVi.state,
|
|
257
|
+
dispatch = _this$props6$editorVi.dispatch,
|
|
258
|
+
pluginInjectionApi = _this$props6.pluginInjectionApi;
|
|
258
259
|
return (_pluginInjectionApi$r = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$r2 = pluginInjectionApi.rule) === null || _pluginInjectionApi$r2 === void 0 ? void 0 : _pluginInjectionApi$r2.actions.insertHorizontalRule(inputMethod)(state, dispatch)) !== null && _pluginInjectionApi$r !== void 0 ? _pluginInjectionApi$r : false;
|
|
259
260
|
});
|
|
260
261
|
_defineProperty(_assertThisInitialized(_this), "insertExpand", function () {
|
|
@@ -265,9 +266,9 @@ export var ToolbarInsertBlock = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
265
266
|
});
|
|
266
267
|
_defineProperty(_assertThisInitialized(_this), "insertBlockType", function (itemName) {
|
|
267
268
|
return function () {
|
|
268
|
-
var _this$
|
|
269
|
-
editorView = _this$
|
|
270
|
-
onInsertBlockType = _this$
|
|
269
|
+
var _this$props7 = _this.props,
|
|
270
|
+
editorView = _this$props7.editorView,
|
|
271
|
+
onInsertBlockType = _this$props7.onInsertBlockType;
|
|
271
272
|
var state = editorView.state,
|
|
272
273
|
dispatch = editorView.dispatch;
|
|
273
274
|
onInsertBlockType(itemName)(state, dispatch);
|
|
@@ -290,11 +291,11 @@ export var ToolbarInsertBlock = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
290
291
|
_defineProperty(_assertThisInitialized(_this), "onItemActivated", function (_ref2) {
|
|
291
292
|
var item = _ref2.item,
|
|
292
293
|
inputMethod = _ref2.inputMethod;
|
|
293
|
-
var _this$
|
|
294
|
-
editorView = _this$
|
|
295
|
-
editorActions = _this$
|
|
296
|
-
handleImageUpload = _this$
|
|
297
|
-
expandEnabled = _this$
|
|
294
|
+
var _this$props8 = _this.props,
|
|
295
|
+
editorView = _this$props8.editorView,
|
|
296
|
+
editorActions = _this$props8.editorActions,
|
|
297
|
+
handleImageUpload = _this$props8.handleImageUpload,
|
|
298
|
+
expandEnabled = _this$props8.expandEnabled;
|
|
298
299
|
|
|
299
300
|
// need to do this before inserting nodes so scrollIntoView works properly
|
|
300
301
|
if (!editorView.hasFocus()) {
|
|
@@ -410,12 +411,12 @@ export var ToolbarInsertBlock = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
410
411
|
key: "renderPopup",
|
|
411
412
|
value: function renderPopup() {
|
|
412
413
|
var emojiPickerOpen = this.state.emojiPickerOpen;
|
|
413
|
-
var _this$
|
|
414
|
-
popupsMountPoint = _this$
|
|
415
|
-
popupsBoundariesElement = _this$
|
|
416
|
-
popupsScrollableElement = _this$
|
|
417
|
-
emojiProvider = _this$
|
|
418
|
-
replacePlusMenuWithElementBrowser = _this$
|
|
414
|
+
var _this$props9 = this.props,
|
|
415
|
+
popupsMountPoint = _this$props9.popupsMountPoint,
|
|
416
|
+
popupsBoundariesElement = _this$props9.popupsBoundariesElement,
|
|
417
|
+
popupsScrollableElement = _this$props9.popupsScrollableElement,
|
|
418
|
+
emojiProvider = _this$props9.emojiProvider,
|
|
419
|
+
replacePlusMenuWithElementBrowser = _this$props9.replacePlusMenuWithElementBrowser;
|
|
419
420
|
var dropdownEmoji = this.state.dropdownItems.some(function (_ref4) {
|
|
420
421
|
var name = _ref4.value.name;
|
|
421
422
|
return name === 'emoji';
|
|
@@ -452,9 +453,9 @@ export var ToolbarInsertBlock = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
452
453
|
buttons = _this$state.buttons,
|
|
453
454
|
dropdownItems = _this$state.dropdownItems,
|
|
454
455
|
emojiPickerOpen = _this$state.emojiPickerOpen;
|
|
455
|
-
var _this$
|
|
456
|
-
isDisabled = _this$
|
|
457
|
-
isReducedSpacing = _this$
|
|
456
|
+
var _this$props10 = this.props,
|
|
457
|
+
isDisabled = _this$props10.isDisabled,
|
|
458
|
+
isReducedSpacing = _this$props10.isReducedSpacing;
|
|
458
459
|
if (buttons.length === 0 && dropdownItems.length === 0) {
|
|
459
460
|
return null;
|
|
460
461
|
}
|
|
@@ -4,7 +4,8 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
4
4
|
import { Fragment } from '@atlaskit/editor-prosemirror/model';
|
|
5
5
|
import { NodeSelection, Selection } from '@atlaskit/editor-prosemirror/state';
|
|
6
6
|
import { uuid } from '@atlaskit/adf-schema';
|
|
7
|
-
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE
|
|
7
|
+
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
|
|
8
|
+
import { withAnalytics } from '@atlaskit/editor-common/editor-analytics';
|
|
8
9
|
import { pluginKey } from './plugin-key';
|
|
9
10
|
import { canInsert } from '@atlaskit/editor-prosemirror/utils';
|
|
10
11
|
export var DEFAULT_STATUS = {
|
|
@@ -71,16 +72,18 @@ export var updateStatus = function updateStatus(status) {
|
|
|
71
72
|
return false;
|
|
72
73
|
};
|
|
73
74
|
};
|
|
74
|
-
export var updateStatusWithAnalytics = function updateStatusWithAnalytics(
|
|
75
|
-
return
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
75
|
+
export var updateStatusWithAnalytics = function updateStatusWithAnalytics(editorAnalyticsAPI) {
|
|
76
|
+
return function (inputMethod, status) {
|
|
77
|
+
return withAnalytics(editorAnalyticsAPI, {
|
|
78
|
+
action: ACTION.INSERTED,
|
|
79
|
+
actionSubject: ACTION_SUBJECT.DOCUMENT,
|
|
80
|
+
actionSubjectId: ACTION_SUBJECT_ID.STATUS,
|
|
81
|
+
attributes: {
|
|
82
|
+
inputMethod: inputMethod
|
|
83
|
+
},
|
|
84
|
+
eventType: EVENT_TYPE.TRACK
|
|
85
|
+
})(updateStatus(status));
|
|
86
|
+
};
|
|
84
87
|
};
|
|
85
88
|
export var setStatusPickerAt = function setStatusPickerAt(showStatusPickerAt) {
|
|
86
89
|
return function (state, dispatch) {
|
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { findDomRefAtPos } from '@atlaskit/editor-prosemirror/utils';
|
|
3
3
|
import { status } from '@atlaskit/adf-schema';
|
|
4
|
-
import WithPluginState from '
|
|
5
|
-
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID,
|
|
4
|
+
import { WithPluginState } from '@atlaskit/editor-common/with-plugin-state';
|
|
5
|
+
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
6
6
|
import { messages } from '../insert-block/ui/ToolbarInsertBlock/messages';
|
|
7
7
|
import { IconStatus } from '@atlaskit/editor-common/quick-insert';
|
|
8
|
-
import { commitStatusPicker, createStatus, updateStatus } from './actions';
|
|
8
|
+
import { updateStatusWithAnalytics, commitStatusPicker, createStatus, updateStatus } from './actions';
|
|
9
9
|
import { keymapPlugin } from './keymap';
|
|
10
10
|
import createStatusPlugin from './plugin';
|
|
11
11
|
import { pluginKey } from './plugin-key';
|
|
12
12
|
import StatusPicker from './ui/statusPicker';
|
|
13
13
|
var baseStatusPlugin = function baseStatusPlugin(_ref) {
|
|
14
|
-
var
|
|
14
|
+
var _api$analytics;
|
|
15
|
+
var options = _ref.config,
|
|
16
|
+
api = _ref.api;
|
|
15
17
|
return {
|
|
16
18
|
name: 'status',
|
|
17
19
|
nodes: function nodes() {
|
|
@@ -31,6 +33,10 @@ var baseStatusPlugin = function baseStatusPlugin(_ref) {
|
|
|
31
33
|
plugin: keymapPlugin
|
|
32
34
|
}];
|
|
33
35
|
},
|
|
36
|
+
actions: {
|
|
37
|
+
commitStatusPicker: commitStatusPicker,
|
|
38
|
+
updateStatus: updateStatusWithAnalytics(api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions)
|
|
39
|
+
},
|
|
34
40
|
contentComponent: function contentComponent(_ref2) {
|
|
35
41
|
var editorView = _ref2.editorView,
|
|
36
42
|
popupsMountPoint = _ref2.popupsMountPoint,
|
|
@@ -84,7 +90,7 @@ var baseStatusPlugin = function baseStatusPlugin(_ref) {
|
|
|
84
90
|
}
|
|
85
91
|
};
|
|
86
92
|
};
|
|
87
|
-
var decorateWithPluginOptions = function decorateWithPluginOptions(plugin, options) {
|
|
93
|
+
var decorateWithPluginOptions = function decorateWithPluginOptions(plugin, options, api) {
|
|
88
94
|
if ((options === null || options === void 0 ? void 0 : options.menuDisabled) === true) {
|
|
89
95
|
return plugin;
|
|
90
96
|
}
|
|
@@ -101,7 +107,9 @@ var decorateWithPluginOptions = function decorateWithPluginOptions(plugin, optio
|
|
|
101
107
|
return /*#__PURE__*/React.createElement(IconStatus, null);
|
|
102
108
|
},
|
|
103
109
|
action: function action(insert, state) {
|
|
104
|
-
|
|
110
|
+
var _api$analytics2;
|
|
111
|
+
var tr = createStatus()(insert, state);
|
|
112
|
+
api === null || api === void 0 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 || _api$analytics2.actions.attachAnalyticsEvent({
|
|
105
113
|
action: ACTION.INSERTED,
|
|
106
114
|
actionSubject: ACTION_SUBJECT.DOCUMENT,
|
|
107
115
|
actionSubjectId: ACTION_SUBJECT_ID.STATUS,
|
|
@@ -109,7 +117,8 @@ var decorateWithPluginOptions = function decorateWithPluginOptions(plugin, optio
|
|
|
109
117
|
inputMethod: INPUT_METHOD.QUICK_INSERT
|
|
110
118
|
},
|
|
111
119
|
eventType: EVENT_TYPE.TRACK
|
|
112
|
-
});
|
|
120
|
+
})(tr);
|
|
121
|
+
return tr;
|
|
113
122
|
}
|
|
114
123
|
}];
|
|
115
124
|
}
|
|
@@ -122,6 +131,6 @@ var statusPlugin = function statusPlugin(_ref5) {
|
|
|
122
131
|
return decorateWithPluginOptions(baseStatusPlugin({
|
|
123
132
|
config: options,
|
|
124
133
|
api: api
|
|
125
|
-
}), options);
|
|
134
|
+
}), options, api);
|
|
126
135
|
};
|
|
127
136
|
export default statusPlugin;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { keymap } from '@atlaskit/editor-prosemirror/keymap';
|
|
2
|
-
import { bindKeymapWithCommand, enter, tab } from '
|
|
2
|
+
import { bindKeymapWithCommand, enter, tab } from '@atlaskit/editor-common/keymaps';
|
|
3
3
|
import { mayGetStatusAtSelection } from './utils';
|
|
4
4
|
export function keymapPlugin() {
|
|
5
5
|
var list = {};
|
|
@@ -19,7 +19,7 @@ import { akEditorFloatingDialogZIndex } from '@atlaskit/editor-shared-styles';
|
|
|
19
19
|
import { StatusPicker as AkStatusPicker } from '@atlaskit/status/picker';
|
|
20
20
|
import { borderRadius } from '@atlaskit/theme/constants';
|
|
21
21
|
import { N0 } from '@atlaskit/theme/colors';
|
|
22
|
-
import withOuterListeners from '
|
|
22
|
+
import { withReactEditorViewOuterListeners as withOuterListeners } from '@atlaskit/editor-common/ui-react';
|
|
23
23
|
import { DEFAULT_STATUS } from '../actions';
|
|
24
24
|
import { analyticsState, createStatusAnalyticsAndFire } from '../analytics';
|
|
25
25
|
var PopupWithListeners = withOuterListeners(Popup);
|
|
@@ -14,6 +14,7 @@ import type panelPlugin from '../panel';
|
|
|
14
14
|
import type { RulePlugin } from '@atlaskit/editor-plugin-rule';
|
|
15
15
|
import type { MediaPlugin } from '@atlaskit/editor-plugin-media';
|
|
16
16
|
import type { MentionPlugin } from '../mentions';
|
|
17
|
+
import type { StatusPlugin } from '../status';
|
|
17
18
|
export type InsertBlockPluginDependencies = [
|
|
18
19
|
FeatureFlagsPlugin,
|
|
19
20
|
OptionalPlugin<typeof tablesPlugin>,
|
|
@@ -29,5 +30,6 @@ export type InsertBlockPluginDependencies = [
|
|
|
29
30
|
OptionalPlugin<typeof codeBlockPlugin>,
|
|
30
31
|
OptionalPlugin<typeof panelPlugin>,
|
|
31
32
|
OptionalPlugin<MediaPlugin>,
|
|
32
|
-
OptionalPlugin<MentionPlugin
|
|
33
|
+
OptionalPlugin<MentionPlugin>,
|
|
34
|
+
OptionalPlugin<StatusPlugin>
|
|
33
35
|
];
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
2
2
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
3
|
-
import type { Command } from '
|
|
3
|
+
import type { Command } from '@atlaskit/editor-common/types';
|
|
4
|
+
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
4
5
|
import type { TOOLBAR_MENU_TYPE } from '@atlaskit/editor-common/types';
|
|
5
6
|
import type { StatusType, ClosingPayload } from './types';
|
|
6
7
|
export declare const DEFAULT_STATUS: StatusType;
|
|
@@ -8,7 +9,8 @@ export declare const createStatus: (showStatusPickerAtOffset?: number) => (inser
|
|
|
8
9
|
selectInlineNode: boolean;
|
|
9
10
|
}) => Transaction, state: EditorState) => Transaction;
|
|
10
11
|
export declare const updateStatus: (status?: StatusType) => Command;
|
|
11
|
-
export
|
|
12
|
+
export type UpdateStatus = (inputMethod: TOOLBAR_MENU_TYPE, status?: StatusType) => Command;
|
|
13
|
+
export declare const updateStatusWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (inputMethod: TOOLBAR_MENU_TYPE, status?: StatusType) => Command;
|
|
12
14
|
export declare const setStatusPickerAt: (showStatusPickerAt: number | null) => (state: EditorState, dispatch: (tr: Transaction) => void) => boolean;
|
|
13
15
|
export declare const removeStatus: (showStatusPickerAt: number) => Command;
|
|
14
16
|
export declare const commitStatusPicker: (closingPayload?: ClosingPayload) => (editorView: EditorView) => void;
|
|
@@ -1,6 +1,15 @@
|
|
|
1
|
-
import type { NextEditorPlugin } from '@atlaskit/editor-common/types';
|
|
1
|
+
import type { NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
|
|
2
|
+
import type { UpdateStatus } from './actions';
|
|
3
|
+
import { commitStatusPicker } from './actions';
|
|
2
4
|
import type { StatusPluginOptions } from './types';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
+
import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
6
|
+
export type StatusPlugin = NextEditorPlugin<'status', {
|
|
7
|
+
dependencies: [OptionalPlugin<AnalyticsPlugin>];
|
|
8
|
+
pluginConfiguration: StatusPluginOptions | undefined;
|
|
9
|
+
actions: {
|
|
10
|
+
commitStatusPicker: typeof commitStatusPicker;
|
|
11
|
+
updateStatus: UpdateStatus;
|
|
12
|
+
};
|
|
5
13
|
}>;
|
|
14
|
+
declare const statusPlugin: StatusPlugin;
|
|
6
15
|
export default statusPlugin;
|
|
@@ -3,7 +3,7 @@ import React from 'react';
|
|
|
3
3
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
4
4
|
import type { IntlShape } from 'react-intl-next';
|
|
5
5
|
import type { Color, StatusStyle } from '@atlaskit/status/element';
|
|
6
|
-
import type { EventDispatcher } from '
|
|
6
|
+
import type { EventDispatcher } from '@atlaskit/editor-common/event-dispatcher';
|
|
7
7
|
import type { InlineNodeViewComponentProps } from '@atlaskit/editor-common/react-node-view';
|
|
8
8
|
import type { StatusPluginOptions } from '../types';
|
|
9
9
|
export interface ContainerProps {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
|
-
import type { PMPluginFactoryParams } from '
|
|
2
|
+
import type { PMPluginFactoryParams } from '@atlaskit/editor-common/types';
|
|
3
3
|
import type { StatusPluginOptions } from './types';
|
|
4
4
|
export { pluginKey, pluginKeyName } from './plugin-key';
|
|
5
5
|
export type { StatusState, StatusType, ClosingPayload } from './types';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-core",
|
|
3
|
-
"version": "188.
|
|
3
|
+
"version": "188.7.0",
|
|
4
4
|
"description": "A package contains Atlassian editor core functionality",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"@atlaskit/code": "^14.6.0",
|
|
56
56
|
"@atlaskit/date": "^0.10.0",
|
|
57
57
|
"@atlaskit/datetime-picker": "^12.10.0",
|
|
58
|
-
"@atlaskit/editor-common": "^76.
|
|
58
|
+
"@atlaskit/editor-common": "^76.9.0",
|
|
59
59
|
"@atlaskit/editor-json-transformer": "^8.10.0",
|
|
60
60
|
"@atlaskit/editor-markdown-transformer": "^5.2.5",
|
|
61
61
|
"@atlaskit/editor-palette": "1.5.1",
|
|
@@ -106,7 +106,7 @@
|
|
|
106
106
|
"@atlaskit/media-client": "^24.0.0",
|
|
107
107
|
"@atlaskit/media-common": "^9.0.0",
|
|
108
108
|
"@atlaskit/mention": "^22.1.0",
|
|
109
|
-
"@atlaskit/menu": "^
|
|
109
|
+
"@atlaskit/menu": "^2.0.0",
|
|
110
110
|
"@atlaskit/platform-feature-flags": "^0.2.0",
|
|
111
111
|
"@atlaskit/prosemirror-collab": "^0.2.0",
|
|
112
112
|
"@atlaskit/prosemirror-input-rules": "^2.4.0",
|
|
@@ -155,7 +155,7 @@
|
|
|
155
155
|
"@af/integration-testing": "*",
|
|
156
156
|
"@af/visual-regression": "*",
|
|
157
157
|
"@atlaskit/collab-provider": "9.15.1",
|
|
158
|
-
"@atlaskit/dropdown-menu": "^
|
|
158
|
+
"@atlaskit/dropdown-menu": "^12.0.0",
|
|
159
159
|
"@atlaskit/editor-extension-dropbox": "^0.4.0",
|
|
160
160
|
"@atlaskit/flag": "^15.2.0",
|
|
161
161
|
"@atlaskit/icon-object": "^6.3.0",
|
|
@@ -240,10 +240,6 @@
|
|
|
240
240
|
"platform.linking-platform.editor.fix-link-insert-analytics": {
|
|
241
241
|
"type": "boolean"
|
|
242
242
|
},
|
|
243
|
-
"platform.design-system-team.menu-selected-state-change_0see9": {
|
|
244
|
-
"type": "boolean",
|
|
245
|
-
"referenceOnly": "true"
|
|
246
|
-
},
|
|
247
243
|
"platform.editor.table-sticky-scrollbar": {
|
|
248
244
|
"type": "boolean"
|
|
249
245
|
},
|