@atlaskit/editor-core 187.35.7 → 187.37.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/index.js +10 -17
- package/dist/cjs/plugins/insert-block/ui/ToolbarInsertBlock/index.js +3 -3
- package/dist/cjs/plugins/rule/commands.js +11 -9
- package/dist/cjs/plugins/rule/index.js +17 -9
- package/dist/cjs/plugins/rule/pm-plugins/input-rule.js +10 -9
- package/dist/cjs/plugins/rule/pm-plugins/keymap.js +2 -2
- package/dist/cjs/plugins/tasks-and-decisions/commands.js +13 -6
- package/dist/cjs/plugins/tasks-and-decisions/pm-plugins/input-rules.js +15 -7
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/es2019/index.js +0 -1
- package/dist/es2019/plugins/insert-block/ui/ToolbarInsertBlock/index.js +3 -3
- package/dist/es2019/plugins/rule/commands.js +2 -2
- package/dist/es2019/plugins/rule/index.js +19 -7
- package/dist/es2019/plugins/rule/pm-plugins/input-rule.js +11 -11
- package/dist/es2019/plugins/rule/pm-plugins/keymap.js +2 -2
- package/dist/es2019/plugins/tasks-and-decisions/commands.js +9 -7
- package/dist/es2019/plugins/tasks-and-decisions/pm-plugins/input-rules.js +11 -5
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/esm/index.js +0 -1
- package/dist/esm/plugins/insert-block/ui/ToolbarInsertBlock/index.js +3 -3
- package/dist/esm/plugins/rule/commands.js +11 -9
- package/dist/esm/plugins/rule/index.js +15 -7
- package/dist/esm/plugins/rule/pm-plugins/input-rule.js +11 -11
- package/dist/esm/plugins/rule/pm-plugins/keymap.js +2 -2
- package/dist/esm/plugins/tasks-and-decisions/commands.js +12 -6
- package/dist/esm/plugins/tasks-and-decisions/pm-plugins/input-rules.js +14 -7
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/types/index.d.ts +0 -1
- package/dist/types/plugins/insert-block/types.d.ts +2 -0
- package/dist/types/plugins/rule/commands.d.ts +3 -4
- package/dist/types/plugins/rule/index.d.ts +9 -3
- package/dist/types/plugins/rule/pm-plugins/input-rule.d.ts +5 -4
- package/dist/types/plugins/rule/pm-plugins/keymap.d.ts +2 -1
- package/dist/types/plugins/tasks-and-decisions/commands.d.ts +4 -4
- package/dist/types/plugins/tasks-and-decisions/types.d.ts +3 -0
- package/dist/types-ts4.5/index.d.ts +0 -1
- package/dist/types-ts4.5/plugins/insert-block/types.d.ts +2 -0
- package/dist/types-ts4.5/plugins/rule/commands.d.ts +3 -4
- package/dist/types-ts4.5/plugins/rule/index.d.ts +10 -3
- package/dist/types-ts4.5/plugins/rule/pm-plugins/input-rule.d.ts +5 -4
- package/dist/types-ts4.5/plugins/rule/pm-plugins/keymap.d.ts +2 -1
- package/dist/types-ts4.5/plugins/tasks-and-decisions/commands.d.ts +4 -4
- package/dist/types-ts4.5/plugins/tasks-and-decisions/types.d.ts +3 -0
- package/package.json +2 -2
- package/report.api.md +8 -11
- package/tmp/api-report-tmp.d.ts +6 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @atlaskit/editor-core
|
|
2
2
|
|
|
3
|
+
## 187.37.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`082b7cf0ea7`](https://bitbucket.org/atlassian/atlassian-frontend/commits/082b7cf0ea7) - [ux] ECA11Y-1 Added new typeahead shortcut to create checked action item
|
|
8
|
+
|
|
9
|
+
## 187.36.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- [`085d722e77f`](https://bitbucket.org/atlassian/atlassian-frontend/commits/085d722e77f) - Decoupling the rule plugin and adding the insertHorizontalRule action to the rule plugin.
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- [`3b7bf91daa5`](https://bitbucket.org/atlassian/atlassian-frontend/commits/3b7bf91daa5) - [ux] ED-19785 Add dark mode icon for custom panel and update light mode icon with new colours.
|
|
18
|
+
|
|
3
19
|
## 187.35.7
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
package/dist/cjs/index.js
CHANGED
|
@@ -206,7 +206,7 @@ Object.defineProperty(exports, "commitStatusPicker", {
|
|
|
206
206
|
Object.defineProperty(exports, "createTable", {
|
|
207
207
|
enumerable: true,
|
|
208
208
|
get: function get() {
|
|
209
|
-
return
|
|
209
|
+
return _commands2.createTable;
|
|
210
210
|
}
|
|
211
211
|
});
|
|
212
212
|
Object.defineProperty(exports, "createTypeAheadTools", {
|
|
@@ -278,13 +278,7 @@ Object.defineProperty(exports, "insertDate", {
|
|
|
278
278
|
Object.defineProperty(exports, "insertExpand", {
|
|
279
279
|
enumerable: true,
|
|
280
280
|
get: function get() {
|
|
281
|
-
return
|
|
282
|
-
}
|
|
283
|
-
});
|
|
284
|
-
Object.defineProperty(exports, "insertHorizontalRule", {
|
|
285
|
-
enumerable: true,
|
|
286
|
-
get: function get() {
|
|
287
|
-
return _commands2.insertHorizontalRule;
|
|
281
|
+
return _commands5.insertExpand;
|
|
288
282
|
}
|
|
289
283
|
});
|
|
290
284
|
Object.defineProperty(exports, "insertMediaSingleNode", {
|
|
@@ -296,7 +290,7 @@ Object.defineProperty(exports, "insertMediaSingleNode", {
|
|
|
296
290
|
Object.defineProperty(exports, "insertTaskDecisionCommand", {
|
|
297
291
|
enumerable: true,
|
|
298
292
|
get: function get() {
|
|
299
|
-
return
|
|
293
|
+
return _commands3.insertTaskDecisionCommand;
|
|
300
294
|
}
|
|
301
295
|
});
|
|
302
296
|
Object.defineProperty(exports, "lightModeStatusColorPalette", {
|
|
@@ -356,19 +350,19 @@ Object.defineProperty(exports, "selectionPluginKey", {
|
|
|
356
350
|
Object.defineProperty(exports, "setIsExpanded", {
|
|
357
351
|
enumerable: true,
|
|
358
352
|
get: function get() {
|
|
359
|
-
return
|
|
353
|
+
return _commands4.setIsExpanded;
|
|
360
354
|
}
|
|
361
355
|
});
|
|
362
356
|
Object.defineProperty(exports, "setKeyboardHeight", {
|
|
363
357
|
enumerable: true,
|
|
364
358
|
get: function get() {
|
|
365
|
-
return
|
|
359
|
+
return _commands4.setKeyboardHeight;
|
|
366
360
|
}
|
|
367
361
|
});
|
|
368
362
|
Object.defineProperty(exports, "setMobilePaddingTop", {
|
|
369
363
|
enumerable: true,
|
|
370
364
|
get: function get() {
|
|
371
|
-
return
|
|
365
|
+
return _commands4.setMobilePaddingTop;
|
|
372
366
|
}
|
|
373
367
|
});
|
|
374
368
|
Object.defineProperty(exports, "setStatusPickerAt", {
|
|
@@ -455,11 +449,10 @@ var _annotation = require("./plugins/annotation");
|
|
|
455
449
|
var _main = require("./plugins/media/pm-plugins/main");
|
|
456
450
|
var _textColor = require("./plugins/text-color");
|
|
457
451
|
var _changeColor = require("./plugins/text-color/commands/change-color");
|
|
458
|
-
var _commands2 = require("./plugins/rule/commands");
|
|
459
452
|
var _toolbarAndPickerUpdates = require("./plugins/view-update-subscription/subscribe/toolbarAndPickerUpdates");
|
|
460
453
|
var _typeAheadUpdates = require("./plugins/view-update-subscription/subscribe/type-ahead-updates");
|
|
461
|
-
var
|
|
462
|
-
var
|
|
454
|
+
var _commands2 = require("@atlaskit/editor-plugin-table/commands");
|
|
455
|
+
var _commands3 = require("./plugins/tasks-and-decisions/commands");
|
|
463
456
|
var _eventDispatcher = require("./event-dispatcher");
|
|
464
457
|
var _plugin = require("./plugins/status/plugin");
|
|
465
458
|
var _actions = require("./plugins/date/actions");
|
|
@@ -469,7 +462,7 @@ var _actions2 = require("./plugins/status/actions");
|
|
|
469
462
|
var _typeAhead = require("./plugins/type-ahead");
|
|
470
463
|
var _history = require("./plugins/history");
|
|
471
464
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
472
|
-
var
|
|
465
|
+
var _commands4 = require("./plugins/mobile-dimensions/commands");
|
|
473
466
|
var _utils = require("./utils");
|
|
474
467
|
var _utils2 = require("@atlaskit/editor-common/utils");
|
|
475
468
|
var _createEditor = require("./create-editor");
|
|
@@ -477,7 +470,7 @@ var _actions3 = _interopRequireDefault(require("./actions"));
|
|
|
477
470
|
var _portalProvider = require("@atlaskit/editor-common/portal-provider");
|
|
478
471
|
var _gapCursorSelection = require("./plugins/selection/gap-cursor-selection");
|
|
479
472
|
var _mobileSelection = require("./plugins/mobile-selection");
|
|
480
|
-
var
|
|
473
|
+
var _commands5 = require("./plugins/expand/commands");
|
|
481
474
|
var _WithPluginState = _interopRequireDefault(require("./ui/WithPluginState"));
|
|
482
475
|
var _statusColorPalette = require("./ui/ColorPalette/Palettes/statusColorPalette");
|
|
483
476
|
var _common = require("./ui/ColorPalette/Palettes/common");
|
|
@@ -32,7 +32,6 @@ var _analytics = require("@atlaskit/editor-common/analytics");
|
|
|
32
32
|
var _messages = require("./messages");
|
|
33
33
|
var _createItems3 = require("./create-items");
|
|
34
34
|
var _blockInsertMenu = require("./block-insert-menu");
|
|
35
|
-
var _commands3 = require("../../../rule/commands");
|
|
36
35
|
var _withOuterListeners = _interopRequireDefault(require("../../../../ui/with-outer-listeners"));
|
|
37
36
|
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; }
|
|
38
37
|
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; }
|
|
@@ -255,12 +254,13 @@ var ToolbarInsertBlock = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
255
254
|
};
|
|
256
255
|
});
|
|
257
256
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "insertHorizontalRule", function (inputMethod) {
|
|
257
|
+
var _pluginInjectionApi$r, _pluginInjectionApi$r2;
|
|
258
258
|
var _this$props4 = _this.props,
|
|
259
259
|
_this$props4$editorVi = _this$props4.editorView,
|
|
260
260
|
state = _this$props4$editorVi.state,
|
|
261
261
|
dispatch = _this$props4$editorVi.dispatch,
|
|
262
|
-
|
|
263
|
-
return (0
|
|
262
|
+
pluginInjectionApi = _this$props4.pluginInjectionApi;
|
|
263
|
+
return (_pluginInjectionApi$r = pluginInjectionApi === null || pluginInjectionApi === void 0 ? 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
264
|
});
|
|
265
265
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "insertExpand", function () {
|
|
266
266
|
var _this$props$editorVie2 = _this.props.editorView,
|
|
@@ -5,16 +5,18 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.insertHorizontalRule = void 0;
|
|
7
7
|
var _inputRule = require("./pm-plugins/input-rule");
|
|
8
|
-
var insertHorizontalRule = function insertHorizontalRule(
|
|
9
|
-
return function (
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
if (
|
|
13
|
-
dispatch
|
|
8
|
+
var insertHorizontalRule = function insertHorizontalRule(featureFlags, editorAnalyticsAPI) {
|
|
9
|
+
return function (inputMethod) {
|
|
10
|
+
return function (state, dispatch) {
|
|
11
|
+
var tr = (0, _inputRule.createHorizontalRule)(state, featureFlags, state.selection.from, state.selection.to, inputMethod, editorAnalyticsAPI);
|
|
12
|
+
if (tr) {
|
|
13
|
+
if (dispatch) {
|
|
14
|
+
dispatch(tr);
|
|
15
|
+
}
|
|
16
|
+
return true;
|
|
14
17
|
}
|
|
15
|
-
return
|
|
16
|
-
}
|
|
17
|
-
return false;
|
|
18
|
+
return false;
|
|
19
|
+
};
|
|
18
20
|
};
|
|
19
21
|
};
|
|
20
22
|
exports.insertHorizontalRule = insertHorizontalRule;
|
|
@@ -7,13 +7,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.default = void 0;
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
var _adfSchema = require("@atlaskit/adf-schema");
|
|
10
|
-
var _analytics = require("
|
|
11
|
-
var _messages = require("
|
|
10
|
+
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
11
|
+
var _messages = require("@atlaskit/editor-common/messages");
|
|
12
12
|
var _quickInsert = require("@atlaskit/editor-common/quick-insert");
|
|
13
13
|
var _inputRule = _interopRequireDefault(require("./pm-plugins/input-rule"));
|
|
14
14
|
var _keymap = _interopRequireDefault(require("./pm-plugins/keymap"));
|
|
15
|
+
var _commands = require("./commands");
|
|
15
16
|
var rulePlugin = function rulePlugin(_ref) {
|
|
16
|
-
var _api$featureFlags;
|
|
17
|
+
var _api$featureFlags, _api$analytics;
|
|
17
18
|
var api = _ref.api;
|
|
18
19
|
var featureFlags = (api === null || api === void 0 ? void 0 : (_api$featureFlags = api.featureFlags) === null || _api$featureFlags === void 0 ? void 0 : _api$featureFlags.sharedState.currentState()) || {};
|
|
19
20
|
return {
|
|
@@ -24,17 +25,22 @@ var rulePlugin = function rulePlugin(_ref) {
|
|
|
24
25
|
node: _adfSchema.rule
|
|
25
26
|
}];
|
|
26
27
|
},
|
|
28
|
+
actions: {
|
|
29
|
+
insertHorizontalRule: (0, _commands.insertHorizontalRule)(featureFlags, api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions)
|
|
30
|
+
},
|
|
27
31
|
pmPlugins: function pmPlugins() {
|
|
28
32
|
return [{
|
|
29
33
|
name: 'ruleInputRule',
|
|
30
34
|
plugin: function plugin(_ref2) {
|
|
35
|
+
var _api$analytics2;
|
|
31
36
|
var schema = _ref2.schema;
|
|
32
|
-
return (0, _inputRule.default)(schema, featureFlags);
|
|
37
|
+
return (0, _inputRule.default)(schema, featureFlags, api === null || api === void 0 ? void 0 : (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions);
|
|
33
38
|
}
|
|
34
39
|
}, {
|
|
35
40
|
name: 'ruleKeymap',
|
|
36
41
|
plugin: function plugin() {
|
|
37
|
-
|
|
42
|
+
var _api$analytics3;
|
|
43
|
+
return (0, _keymap.default)(featureFlags, api === null || api === void 0 ? void 0 : (_api$analytics3 = api.analytics) === null || _api$analytics3 === void 0 ? void 0 : _api$analytics3.actions);
|
|
38
44
|
}
|
|
39
45
|
}];
|
|
40
46
|
},
|
|
@@ -43,8 +49,8 @@ var rulePlugin = function rulePlugin(_ref) {
|
|
|
43
49
|
var formatMessage = _ref3.formatMessage;
|
|
44
50
|
return [{
|
|
45
51
|
id: 'rule',
|
|
46
|
-
title: formatMessage(_messages.
|
|
47
|
-
description: formatMessage(_messages.
|
|
52
|
+
title: formatMessage(_messages.toolbarInsertBlockMessages.horizontalRule),
|
|
53
|
+
description: formatMessage(_messages.toolbarInsertBlockMessages.horizontalRuleDescription),
|
|
48
54
|
keywords: ['horizontal', 'rule', 'line', 'hr'],
|
|
49
55
|
priority: 1200,
|
|
50
56
|
keyshortcut: '---',
|
|
@@ -52,8 +58,9 @@ var rulePlugin = function rulePlugin(_ref) {
|
|
|
52
58
|
return /*#__PURE__*/_react.default.createElement(_quickInsert.IconDivider, null);
|
|
53
59
|
},
|
|
54
60
|
action: function action(insert, state) {
|
|
61
|
+
var _api$analytics4;
|
|
55
62
|
var tr = insert(state.schema.nodes.rule.createChecked());
|
|
56
|
-
|
|
63
|
+
api === null || api === void 0 ? void 0 : (_api$analytics4 = api.analytics) === null || _api$analytics4 === void 0 ? void 0 : _api$analytics4.actions.attachAnalyticsEvent({
|
|
57
64
|
action: _analytics.ACTION.INSERTED,
|
|
58
65
|
actionSubject: _analytics.ACTION_SUBJECT.DOCUMENT,
|
|
59
66
|
actionSubjectId: _analytics.ACTION_SUBJECT_ID.DIVIDER,
|
|
@@ -61,7 +68,8 @@ var rulePlugin = function rulePlugin(_ref) {
|
|
|
61
68
|
inputMethod: _analytics.INPUT_METHOD.QUICK_INSERT
|
|
62
69
|
},
|
|
63
70
|
eventType: _analytics.EVENT_TYPE.TRACK
|
|
64
|
-
});
|
|
71
|
+
})(tr);
|
|
72
|
+
return tr;
|
|
65
73
|
}
|
|
66
74
|
}];
|
|
67
75
|
}
|
|
@@ -9,8 +9,8 @@ var _model = require("@atlaskit/editor-prosemirror/model");
|
|
|
9
9
|
var _prosemirrorInputRules = require("@atlaskit/prosemirror-input-rules");
|
|
10
10
|
var _insert = require("@atlaskit/editor-common/insert");
|
|
11
11
|
var _utils = require("@atlaskit/editor-prosemirror/utils");
|
|
12
|
-
var _analytics = require("
|
|
13
|
-
var createHorizontalRule = function createHorizontalRule(state, featureFlags, start, end, inputMethod) {
|
|
12
|
+
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
13
|
+
var createHorizontalRule = function createHorizontalRule(state, featureFlags, start, end, inputMethod, editorAnalyticsAPI) {
|
|
14
14
|
if (!state.selection.empty) {
|
|
15
15
|
return null;
|
|
16
16
|
}
|
|
@@ -29,7 +29,7 @@ var createHorizontalRule = function createHorizontalRule(state, featureFlags, st
|
|
|
29
29
|
if (!tr) {
|
|
30
30
|
tr = state.tr.replaceRange(start, end, new _model.Slice(_model.Fragment.from(state.schema.nodes.rule.createChecked()), 0, 0));
|
|
31
31
|
}
|
|
32
|
-
|
|
32
|
+
editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 ? void 0 : editorAnalyticsAPI.attachAnalyticsEvent({
|
|
33
33
|
action: _analytics.ACTION.INSERTED,
|
|
34
34
|
actionSubject: _analytics.ACTION_SUBJECT.DOCUMENT,
|
|
35
35
|
actionSubjectId: _analytics.ACTION_SUBJECT_ID.DIVIDER,
|
|
@@ -37,22 +37,23 @@ var createHorizontalRule = function createHorizontalRule(state, featureFlags, st
|
|
|
37
37
|
inputMethod: inputMethod
|
|
38
38
|
},
|
|
39
39
|
eventType: _analytics.EVENT_TYPE.TRACK
|
|
40
|
-
});
|
|
40
|
+
})(tr);
|
|
41
|
+
return tr;
|
|
41
42
|
};
|
|
42
43
|
exports.createHorizontalRule = createHorizontalRule;
|
|
43
|
-
var createHorizontalRuleAutoformat = function createHorizontalRuleAutoformat(state, featureFlags, start, end) {
|
|
44
|
+
var createHorizontalRuleAutoformat = function createHorizontalRuleAutoformat(state, featureFlags, start, end, editorAnalyticsAPI) {
|
|
44
45
|
var listItem = state.schema.nodes.listItem;
|
|
45
46
|
if ((0, _utils.hasParentNodeOfType)(listItem)(state.selection)) {
|
|
46
47
|
return null;
|
|
47
48
|
}
|
|
48
|
-
return createHorizontalRule(state, featureFlags, start, end, _analytics.INPUT_METHOD.FORMATTING);
|
|
49
|
+
return createHorizontalRule(state, featureFlags, start, end, _analytics.INPUT_METHOD.FORMATTING, editorAnalyticsAPI);
|
|
49
50
|
};
|
|
50
|
-
function inputRulePlugin(schema, featureFlags) {
|
|
51
|
+
function inputRulePlugin(schema, featureFlags, editorAnalyticsAPI) {
|
|
51
52
|
var rules = [];
|
|
52
53
|
if (schema.nodes.rule) {
|
|
53
54
|
// '---' and '***' for hr
|
|
54
55
|
rules.push((0, _prosemirrorInputRules.createRule)(/^(\-\-\-|\*\*\*)$/, function (state, _match, start, end) {
|
|
55
|
-
return createHorizontalRuleAutoformat(state, featureFlags, start, end);
|
|
56
|
+
return createHorizontalRuleAutoformat(state, featureFlags, start, end, editorAnalyticsAPI);
|
|
56
57
|
}));
|
|
57
58
|
|
|
58
59
|
// '---' and '***' after shift+enter for hr
|
|
@@ -61,7 +62,7 @@ function inputRulePlugin(schema, featureFlags) {
|
|
|
61
62
|
if (state.doc.resolve(start).nodeAfter.type !== hardBreak) {
|
|
62
63
|
return null;
|
|
63
64
|
}
|
|
64
|
-
return createHorizontalRuleAutoformat(state, featureFlags, start, end);
|
|
65
|
+
return createHorizontalRuleAutoformat(state, featureFlags, start, end, editorAnalyticsAPI);
|
|
65
66
|
}));
|
|
66
67
|
}
|
|
67
68
|
if (rules.length !== 0) {
|
|
@@ -9,9 +9,9 @@ var _keymap = require("@atlaskit/editor-prosemirror/keymap");
|
|
|
9
9
|
var _keymaps = require("@atlaskit/editor-common/keymaps");
|
|
10
10
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
11
11
|
var _commands = require("../commands");
|
|
12
|
-
function keymapPlugin(featureFlags) {
|
|
12
|
+
function keymapPlugin(featureFlags, editorAnalyticsAPI) {
|
|
13
13
|
var list = {};
|
|
14
|
-
(0, _keymaps.bindKeymapWithCommand)(_keymaps.insertRule.common, (0, _commands.insertHorizontalRule)(_analytics.INPUT_METHOD.SHORTCUT
|
|
14
|
+
(0, _keymaps.bindKeymapWithCommand)(_keymaps.insertRule.common, (0, _commands.insertHorizontalRule)(featureFlags, editorAnalyticsAPI)(_analytics.INPUT_METHOD.SHORTCUT), list);
|
|
15
15
|
(0, _keymaps.bindKeymapWithCommand)(_keymaps.escape.common, function () {
|
|
16
16
|
return true;
|
|
17
17
|
}, list);
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
6
7
|
exports.isSupportedSourceNode = exports.insertTaskDecisionWithAnalytics = exports.insertTaskDecisionCommand = exports.insertTaskDecisionAction = exports.getListTypes = exports.createListAtSelection = exports.changeInDepth = void 0;
|
|
8
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
7
9
|
var _model = require("@atlaskit/editor-prosemirror/model");
|
|
8
10
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
9
11
|
var _utils = require("@atlaskit/editor-prosemirror/utils");
|
|
@@ -13,6 +15,8 @@ var _analytics = require("../analytics");
|
|
|
13
15
|
var _gapCursorSelection = require("../selection/gap-cursor-selection");
|
|
14
16
|
var _pluginKey = require("./pm-plugins/plugin-key");
|
|
15
17
|
var _utils2 = require("@atlaskit/editor-common/utils");
|
|
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
|
+
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; }
|
|
16
20
|
var getContextData = function getContextData() {
|
|
17
21
|
var contextProvider = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
18
22
|
var objectId = contextProvider.objectId,
|
|
@@ -73,6 +77,7 @@ var insertTaskDecisionAction = function insertTaskDecisionAction(state, listType
|
|
|
73
77
|
var addItem = arguments.length > 3 ? arguments[3] : undefined;
|
|
74
78
|
var listLocalId = arguments.length > 4 ? arguments[4] : undefined;
|
|
75
79
|
var itemLocalId = arguments.length > 5 ? arguments[5] : undefined;
|
|
80
|
+
var itemAttrs = arguments.length > 6 ? arguments[6] : undefined;
|
|
76
81
|
var schema = state.schema;
|
|
77
82
|
var addAndCreateList = function addAndCreateList(_ref) {
|
|
78
83
|
var tr = _ref.tr,
|
|
@@ -80,7 +85,7 @@ var insertTaskDecisionAction = function insertTaskDecisionAction(state, listType
|
|
|
80
85
|
item = _ref.item,
|
|
81
86
|
listLocalId = _ref.listLocalId,
|
|
82
87
|
itemLocalId = _ref.itemLocalId;
|
|
83
|
-
return createListAtSelection(tr, list, item, schema, state, listLocalId, itemLocalId);
|
|
88
|
+
return createListAtSelection(tr, list, item, schema, state, listLocalId, itemLocalId, itemAttrs);
|
|
84
89
|
};
|
|
85
90
|
var addToList = function addToList(_ref2) {
|
|
86
91
|
var state = _ref2.state,
|
|
@@ -98,7 +103,7 @@ var insertTaskDecisionAction = function insertTaskDecisionAction(state, listType
|
|
|
98
103
|
}]).setSelection(new _state.TextSelection(tr.doc.resolve(newItemParagraphPos)));
|
|
99
104
|
};
|
|
100
105
|
var addAndCreateListFn = addItem !== null && addItem !== void 0 ? addItem : addAndCreateList;
|
|
101
|
-
var tr = insertTaskDecisionWithAnalytics(state, listType, inputMethod, addAndCreateListFn, addToList, listLocalId, itemLocalId);
|
|
106
|
+
var tr = insertTaskDecisionWithAnalytics(state, listType, inputMethod, addAndCreateListFn, addToList, listLocalId, itemLocalId, itemAttrs);
|
|
102
107
|
if (!tr) {
|
|
103
108
|
return state.tr;
|
|
104
109
|
}
|
|
@@ -120,7 +125,7 @@ var insertTaskDecisionCommand = function insertTaskDecisionCommand(listType) {
|
|
|
120
125
|
};
|
|
121
126
|
};
|
|
122
127
|
exports.insertTaskDecisionCommand = insertTaskDecisionCommand;
|
|
123
|
-
var insertTaskDecisionWithAnalytics = function insertTaskDecisionWithAnalytics(state, listType, inputMethod, addAndCreateList, addToList, listLocalId, itemLocalId) {
|
|
128
|
+
var insertTaskDecisionWithAnalytics = function insertTaskDecisionWithAnalytics(state, listType, inputMethod, addAndCreateList, addToList, listLocalId, itemLocalId, itemAttrs) {
|
|
124
129
|
var schema = state.schema;
|
|
125
130
|
var _getListTypes = getListTypes(listType, schema),
|
|
126
131
|
list = _getListTypes.list,
|
|
@@ -154,7 +159,8 @@ var insertTaskDecisionWithAnalytics = function insertTaskDecisionWithAnalytics(s
|
|
|
154
159
|
list: list,
|
|
155
160
|
item: item,
|
|
156
161
|
listLocalId: listLocalId,
|
|
157
|
-
itemLocalId: itemLocalId
|
|
162
|
+
itemLocalId: itemLocalId,
|
|
163
|
+
itemAttrs: itemAttrs
|
|
158
164
|
});
|
|
159
165
|
if (insertTr) {
|
|
160
166
|
insertTr = (0, _analytics.addAnalytics)(state, insertTr, generateAnalyticsPayload(listType, contextData, inputMethod, itemLocalId, listLocalId, itemIdx || 0, listSize || 0));
|
|
@@ -180,6 +186,7 @@ exports.changeInDepth = changeInDepth;
|
|
|
180
186
|
var createListAtSelection = function createListAtSelection(tr, list, item, schema, state) {
|
|
181
187
|
var listLocalId = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : _adfSchema.uuid.generate();
|
|
182
188
|
var itemLocalId = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : _adfSchema.uuid.generate();
|
|
189
|
+
var itemAttrs = arguments.length > 7 ? arguments[7] : undefined;
|
|
183
190
|
var selection = state.selection;
|
|
184
191
|
var $from = selection.$from,
|
|
185
192
|
$to = selection.$to;
|
|
@@ -200,9 +207,9 @@ var createListAtSelection = function createListAtSelection(tr, list, item, schem
|
|
|
200
207
|
}
|
|
201
208
|
var emptyList = list.create({
|
|
202
209
|
localId: listLocalId
|
|
203
|
-
}, [item.create({
|
|
210
|
+
}, [item.create(_objectSpread({
|
|
204
211
|
localId: itemLocalId
|
|
205
|
-
})]);
|
|
212
|
+
}, itemAttrs))]);
|
|
206
213
|
|
|
207
214
|
// we don't take the content of a block node next to the gap cursor and always create an empty task
|
|
208
215
|
if (selection instanceof _gapCursorSelection.GapCursorSelection) {
|
|
@@ -1,16 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
6
7
|
exports.default = void 0;
|
|
7
8
|
exports.inputRulePlugin = inputRulePlugin;
|
|
9
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
8
10
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
9
11
|
var _utils = require("@atlaskit/editor-prosemirror/utils");
|
|
10
12
|
var _prosemirrorInputRules = require("@atlaskit/prosemirror-input-rules");
|
|
11
13
|
var _analytics = require("../../analytics");
|
|
12
14
|
var _commands = require("../commands");
|
|
13
|
-
var
|
|
15
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
16
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
17
|
+
var createListRule = function createListRule(regex, listType, itemAttrs) {
|
|
14
18
|
return (0, _prosemirrorInputRules.createRule)(regex, function (state, _match, start, end) {
|
|
15
19
|
var paragraph = state.schema.nodes.paragraph;
|
|
16
20
|
var _getListTypes = (0, _commands.getListTypes)(listType, state.schema),
|
|
@@ -22,7 +26,7 @@ var createListRule = function createListRule(regex, listType) {
|
|
|
22
26
|
if ($end.parent.type !== paragraph || !(0, _utils.canInsert)($endOfParent, list.createAndFill())) {
|
|
23
27
|
return null;
|
|
24
28
|
}
|
|
25
|
-
var insertTr = (0, _commands.insertTaskDecisionAction)(state, listType, _analytics.INPUT_METHOD.FORMATTING, addItem(start, end));
|
|
29
|
+
var insertTr = (0, _commands.insertTaskDecisionAction)(state, listType, _analytics.INPUT_METHOD.FORMATTING, addItem(start, end), undefined, undefined, itemAttrs);
|
|
26
30
|
return insertTr;
|
|
27
31
|
});
|
|
28
32
|
};
|
|
@@ -33,7 +37,8 @@ var addItem = function addItem(start, end) {
|
|
|
33
37
|
list = _ref.list,
|
|
34
38
|
item = _ref.item,
|
|
35
39
|
listLocalId = _ref.listLocalId,
|
|
36
|
-
itemLocalId = _ref.itemLocalId
|
|
40
|
+
itemLocalId = _ref.itemLocalId,
|
|
41
|
+
itemAttrs = _ref.itemAttrs;
|
|
37
42
|
var $from = state.selection.$from,
|
|
38
43
|
schema = state.schema;
|
|
39
44
|
var hardBreak = schema.nodes.hardBreak;
|
|
@@ -47,16 +52,16 @@ var addItem = function addItem(start, end) {
|
|
|
47
52
|
if (!shouldBreakNode) {
|
|
48
53
|
tr.replaceRangeWith($from.before(), $from.after(), list.create({
|
|
49
54
|
localId: listLocalId
|
|
50
|
-
}, [item.create({
|
|
55
|
+
}, [item.create(_objectSpread({
|
|
51
56
|
localId: itemLocalId
|
|
52
|
-
}, content)])).delete(start + 1, end + 1).setSelection(new _state.TextSelection(tr.doc.resolve(start + 1)));
|
|
57
|
+
}, itemAttrs), content)])).delete(start + 1, end + 1).setSelection(new _state.TextSelection(tr.doc.resolve(start + 1)));
|
|
53
58
|
} else {
|
|
54
59
|
var depthAdjustment = (0, _commands.changeInDepth)($from, tr.selection.$from);
|
|
55
60
|
tr.split($from.pos).setSelection(new _state.NodeSelection(tr.doc.resolve($from.pos + 1))).replaceSelectionWith(list.create({
|
|
56
61
|
localId: listLocalId
|
|
57
|
-
}, [item.create({
|
|
62
|
+
}, [item.create(_objectSpread({
|
|
58
63
|
localId: itemLocalId
|
|
59
|
-
},
|
|
64
|
+
}, itemAttrs),
|
|
60
65
|
// TODO: [ts30] handle void and null properly
|
|
61
66
|
tr.doc.nodeAt($from.pos + 1).content)])).setSelection(new _state.TextSelection(tr.doc.resolve($from.pos + depthAdjustment))).delete(start, end + 1);
|
|
62
67
|
}
|
|
@@ -75,6 +80,9 @@ function inputRulePlugin(schema, featureFlags) {
|
|
|
75
80
|
}
|
|
76
81
|
if (taskList && taskItem) {
|
|
77
82
|
rules.push(createListRule(new RegExp("(^|".concat(_prosemirrorInputRules.leafNodeReplacementCharacter, ")\\[\\]\\s$")), 'taskList'));
|
|
83
|
+
rules.push(createListRule(new RegExp("(^|".concat(_prosemirrorInputRules.leafNodeReplacementCharacter, ")\\[x\\]\\s$")), 'taskList', {
|
|
84
|
+
state: 'DONE'
|
|
85
|
+
}));
|
|
78
86
|
}
|
|
79
87
|
return (0, _prosemirrorInputRules.createPlugin)('tasks-and-decisions', rules, {
|
|
80
88
|
isBlockNodeRule: true
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.version = exports.nextMajorVersion = exports.name = void 0;
|
|
7
7
|
var name = "@atlaskit/editor-core";
|
|
8
8
|
exports.name = name;
|
|
9
|
-
var version = "187.
|
|
9
|
+
var version = "187.37.0";
|
|
10
10
|
exports.version = version;
|
|
11
11
|
var nextMajorVersion = function nextMajorVersion() {
|
|
12
12
|
return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
|
package/dist/es2019/index.js
CHANGED
|
@@ -18,7 +18,6 @@ export { AnnotationUpdateEmitter } from './plugins/annotation';
|
|
|
18
18
|
export { stateKey as mediaPluginKey } from './plugins/media/pm-plugins/main';
|
|
19
19
|
export { textColorPluginKey } from './plugins/text-color';
|
|
20
20
|
export { changeColor } from './plugins/text-color/commands/change-color';
|
|
21
|
-
export { insertHorizontalRule } from './plugins/rule/commands';
|
|
22
21
|
|
|
23
22
|
/**
|
|
24
23
|
* @private
|
|
@@ -19,7 +19,6 @@ import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } f
|
|
|
19
19
|
import { messages } from './messages';
|
|
20
20
|
import { createItems } from './create-items';
|
|
21
21
|
import { BlockInsertMenu } from './block-insert-menu';
|
|
22
|
-
import { insertHorizontalRule } from '../../../rule/commands';
|
|
23
22
|
import withOuterListeners from '../../../../ui/with-outer-listeners';
|
|
24
23
|
|
|
25
24
|
/**
|
|
@@ -252,14 +251,15 @@ export class ToolbarInsertBlock extends React.PureComponent {
|
|
|
252
251
|
return insertTaskDecisionCommand(listType, inputMethod)(state, dispatch);
|
|
253
252
|
});
|
|
254
253
|
_defineProperty(this, "insertHorizontalRule", inputMethod => {
|
|
254
|
+
var _pluginInjectionApi$r, _pluginInjectionApi$r2;
|
|
255
255
|
const {
|
|
256
256
|
editorView: {
|
|
257
257
|
state,
|
|
258
258
|
dispatch
|
|
259
259
|
},
|
|
260
|
-
|
|
260
|
+
pluginInjectionApi
|
|
261
261
|
} = this.props;
|
|
262
|
-
return insertHorizontalRule(inputMethod
|
|
262
|
+
return (_pluginInjectionApi$r = pluginInjectionApi === null || pluginInjectionApi === void 0 ? 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;
|
|
263
263
|
});
|
|
264
264
|
_defineProperty(this, "insertExpand", () => {
|
|
265
265
|
const {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createHorizontalRule } from './pm-plugins/input-rule';
|
|
2
|
-
export const insertHorizontalRule = (
|
|
3
|
-
const tr = createHorizontalRule(state, featureFlags, state.selection.from, state.selection.to, inputMethod);
|
|
2
|
+
export const insertHorizontalRule = (featureFlags, editorAnalyticsAPI) => inputMethod => (state, dispatch) => {
|
|
3
|
+
const tr = createHorizontalRule(state, featureFlags, state.selection.from, state.selection.to, inputMethod, editorAnalyticsAPI);
|
|
4
4
|
if (tr) {
|
|
5
5
|
if (dispatch) {
|
|
6
6
|
dispatch(tr);
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { rule } from '@atlaskit/adf-schema';
|
|
3
|
-
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID,
|
|
4
|
-
import { messages } from '
|
|
3
|
+
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
4
|
+
import { toolbarInsertBlockMessages as messages } from '@atlaskit/editor-common/messages';
|
|
5
5
|
import { IconDivider } from '@atlaskit/editor-common/quick-insert';
|
|
6
6
|
import inputRulePlugin from './pm-plugins/input-rule';
|
|
7
7
|
import keymapPlugin from './pm-plugins/keymap';
|
|
8
|
+
import { insertHorizontalRule } from './commands';
|
|
8
9
|
const rulePlugin = ({
|
|
9
10
|
api
|
|
10
11
|
}) => {
|
|
11
|
-
var _api$featureFlags;
|
|
12
|
+
var _api$featureFlags, _api$analytics;
|
|
12
13
|
const featureFlags = (api === null || api === void 0 ? void 0 : (_api$featureFlags = api.featureFlags) === null || _api$featureFlags === void 0 ? void 0 : _api$featureFlags.sharedState.currentState()) || {};
|
|
13
14
|
return {
|
|
14
15
|
name: 'rule',
|
|
@@ -18,15 +19,24 @@ const rulePlugin = ({
|
|
|
18
19
|
node: rule
|
|
19
20
|
}];
|
|
20
21
|
},
|
|
22
|
+
actions: {
|
|
23
|
+
insertHorizontalRule: insertHorizontalRule(featureFlags, api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions)
|
|
24
|
+
},
|
|
21
25
|
pmPlugins() {
|
|
22
26
|
return [{
|
|
23
27
|
name: 'ruleInputRule',
|
|
24
28
|
plugin: ({
|
|
25
29
|
schema
|
|
26
|
-
}) =>
|
|
30
|
+
}) => {
|
|
31
|
+
var _api$analytics2;
|
|
32
|
+
return inputRulePlugin(schema, featureFlags, api === null || api === void 0 ? void 0 : (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions);
|
|
33
|
+
}
|
|
27
34
|
}, {
|
|
28
35
|
name: 'ruleKeymap',
|
|
29
|
-
plugin: () =>
|
|
36
|
+
plugin: () => {
|
|
37
|
+
var _api$analytics3;
|
|
38
|
+
return keymapPlugin(featureFlags, api === null || api === void 0 ? void 0 : (_api$analytics3 = api.analytics) === null || _api$analytics3 === void 0 ? void 0 : _api$analytics3.actions);
|
|
39
|
+
}
|
|
30
40
|
}];
|
|
31
41
|
},
|
|
32
42
|
pluginsOptions: {
|
|
@@ -41,8 +51,9 @@ const rulePlugin = ({
|
|
|
41
51
|
keyshortcut: '---',
|
|
42
52
|
icon: () => /*#__PURE__*/React.createElement(IconDivider, null),
|
|
43
53
|
action(insert, state) {
|
|
54
|
+
var _api$analytics4;
|
|
44
55
|
let tr = insert(state.schema.nodes.rule.createChecked());
|
|
45
|
-
|
|
56
|
+
api === null || api === void 0 ? void 0 : (_api$analytics4 = api.analytics) === null || _api$analytics4 === void 0 ? void 0 : _api$analytics4.actions.attachAnalyticsEvent({
|
|
46
57
|
action: ACTION.INSERTED,
|
|
47
58
|
actionSubject: ACTION_SUBJECT.DOCUMENT,
|
|
48
59
|
actionSubjectId: ACTION_SUBJECT_ID.DIVIDER,
|
|
@@ -50,7 +61,8 @@ const rulePlugin = ({
|
|
|
50
61
|
inputMethod: INPUT_METHOD.QUICK_INSERT
|
|
51
62
|
},
|
|
52
63
|
eventType: EVENT_TYPE.TRACK
|
|
53
|
-
});
|
|
64
|
+
})(tr);
|
|
65
|
+
return tr;
|
|
54
66
|
}
|
|
55
67
|
}]
|
|
56
68
|
}
|