@atlaskit/editor-core 187.35.4 → 187.36.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 -24
- 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/ui/ContentStyles/index.js +15 -13
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/es2019/index.js +0 -2
- 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/ui/ContentStyles/index.js +28 -2
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/esm/index.js +0 -2
- 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/ui/ContentStyles/index.js +8 -6
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/types/index.d.ts +0 -2
- 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-ts4.5/index.d.ts +0 -2
- 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/package.json +2 -2
- package/report.api.md +0 -14
- package/tmp/api-report-tmp.d.ts +0 -6
- package/dist/cjs/plugins/mentions/styles.js +0 -15
- package/dist/es2019/plugins/mentions/styles.js +0 -29
- package/dist/esm/plugins/mentions/styles.js +0 -7
- package/dist/types/plugins/mentions/styles.d.ts +0 -1
- package/dist/types-ts4.5/plugins/mentions/styles.d.ts +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @atlaskit/editor-core
|
|
2
2
|
|
|
3
|
+
## 187.36.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`085d722e77f`](https://bitbucket.org/atlassian/atlassian-frontend/commits/085d722e77f) - Decoupling the rule plugin and adding the insertHorizontalRule action to the rule plugin.
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- [`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.
|
|
12
|
+
|
|
13
|
+
## 187.35.7
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- [`c377886771f`](https://bitbucket.org/atlassian/atlassian-frontend/commits/c377886771f) - ED-19744 moved `mention` styles to `ContentStyles` as part of Scalability Project
|
|
18
|
+
|
|
3
19
|
## 187.35.4
|
|
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", {
|
|
@@ -323,12 +317,6 @@ Object.defineProperty(exports, "mediaPluginKey", {
|
|
|
323
317
|
return _main.stateKey;
|
|
324
318
|
}
|
|
325
319
|
});
|
|
326
|
-
Object.defineProperty(exports, "mentionPluginKey", {
|
|
327
|
-
enumerable: true,
|
|
328
|
-
get: function get() {
|
|
329
|
-
return _mentions.mentionPluginKey;
|
|
330
|
-
}
|
|
331
|
-
});
|
|
332
320
|
Object.defineProperty(exports, "messages", {
|
|
333
321
|
enumerable: true,
|
|
334
322
|
get: function get() {
|
|
@@ -362,19 +350,19 @@ Object.defineProperty(exports, "selectionPluginKey", {
|
|
|
362
350
|
Object.defineProperty(exports, "setIsExpanded", {
|
|
363
351
|
enumerable: true,
|
|
364
352
|
get: function get() {
|
|
365
|
-
return
|
|
353
|
+
return _commands4.setIsExpanded;
|
|
366
354
|
}
|
|
367
355
|
});
|
|
368
356
|
Object.defineProperty(exports, "setKeyboardHeight", {
|
|
369
357
|
enumerable: true,
|
|
370
358
|
get: function get() {
|
|
371
|
-
return
|
|
359
|
+
return _commands4.setKeyboardHeight;
|
|
372
360
|
}
|
|
373
361
|
});
|
|
374
362
|
Object.defineProperty(exports, "setMobilePaddingTop", {
|
|
375
363
|
enumerable: true,
|
|
376
364
|
get: function get() {
|
|
377
|
-
return
|
|
365
|
+
return _commands4.setMobilePaddingTop;
|
|
378
366
|
}
|
|
379
367
|
});
|
|
380
368
|
Object.defineProperty(exports, "setStatusPickerAt", {
|
|
@@ -459,14 +447,12 @@ var _resource2 = require("@atlaskit/mention/resource");
|
|
|
459
447
|
var _teamResource = require("@atlaskit/mention/team-resource");
|
|
460
448
|
var _annotation = require("./plugins/annotation");
|
|
461
449
|
var _main = require("./plugins/media/pm-plugins/main");
|
|
462
|
-
var _mentions = require("./plugins/mentions");
|
|
463
450
|
var _textColor = require("./plugins/text-color");
|
|
464
451
|
var _changeColor = require("./plugins/text-color/commands/change-color");
|
|
465
|
-
var _commands2 = require("./plugins/rule/commands");
|
|
466
452
|
var _toolbarAndPickerUpdates = require("./plugins/view-update-subscription/subscribe/toolbarAndPickerUpdates");
|
|
467
453
|
var _typeAheadUpdates = require("./plugins/view-update-subscription/subscribe/type-ahead-updates");
|
|
468
|
-
var
|
|
469
|
-
var
|
|
454
|
+
var _commands2 = require("@atlaskit/editor-plugin-table/commands");
|
|
455
|
+
var _commands3 = require("./plugins/tasks-and-decisions/commands");
|
|
470
456
|
var _eventDispatcher = require("./event-dispatcher");
|
|
471
457
|
var _plugin = require("./plugins/status/plugin");
|
|
472
458
|
var _actions = require("./plugins/date/actions");
|
|
@@ -476,7 +462,7 @@ var _actions2 = require("./plugins/status/actions");
|
|
|
476
462
|
var _typeAhead = require("./plugins/type-ahead");
|
|
477
463
|
var _history = require("./plugins/history");
|
|
478
464
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
479
|
-
var
|
|
465
|
+
var _commands4 = require("./plugins/mobile-dimensions/commands");
|
|
480
466
|
var _utils = require("./utils");
|
|
481
467
|
var _utils2 = require("@atlaskit/editor-common/utils");
|
|
482
468
|
var _createEditor = require("./create-editor");
|
|
@@ -484,7 +470,7 @@ var _actions3 = _interopRequireDefault(require("./actions"));
|
|
|
484
470
|
var _portalProvider = require("@atlaskit/editor-common/portal-provider");
|
|
485
471
|
var _gapCursorSelection = require("./plugins/selection/gap-cursor-selection");
|
|
486
472
|
var _mobileSelection = require("./plugins/mobile-selection");
|
|
487
|
-
var
|
|
473
|
+
var _commands5 = require("./plugins/expand/commands");
|
|
488
474
|
var _WithPluginState = _interopRequireDefault(require("./ui/WithPluginState"));
|
|
489
475
|
var _statusColorPalette = require("./ui/ColorPalette/Palettes/statusColorPalette");
|
|
490
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);
|
|
@@ -11,6 +11,7 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
11
11
|
var _react2 = require("@emotion/react");
|
|
12
12
|
var _styles = require("@atlaskit/editor-common/styles");
|
|
13
13
|
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
14
|
+
var _mention = require("@atlaskit/editor-common/mention");
|
|
14
15
|
var _styles2 = require("../../plugins/collab-edit/styles");
|
|
15
16
|
var _styles3 = require("../../plugins/selection/gap-cursor/styles");
|
|
16
17
|
var _commonStyles = require("@atlaskit/editor-plugin-table/ui/common-styles");
|
|
@@ -22,30 +23,31 @@ var _styles8 = require("../../plugins/media/styles");
|
|
|
22
23
|
var _styles9 = require("../../plugins/layout/styles");
|
|
23
24
|
var _styles10 = require("../../plugins/panel/styles");
|
|
24
25
|
var _styles11 = require("../../plugins/fake-text-cursor/styles");
|
|
25
|
-
var _styles12 = require("../../plugins/
|
|
26
|
-
var _styles13 = require("../../plugins/
|
|
27
|
-
var _styles14 = require("../../plugins/
|
|
28
|
-
var _styles15 = require("../../plugins/expand/ui/styles");
|
|
26
|
+
var _styles12 = require("../../plugins/placeholder-text/styles");
|
|
27
|
+
var _styles13 = require("../../plugins/extension/ui/styles");
|
|
28
|
+
var _styles14 = require("../../plugins/expand/ui/styles");
|
|
29
29
|
var _style = require("../../plugins/media/pm-plugins/alt-text/style");
|
|
30
|
-
var
|
|
31
|
-
var
|
|
32
|
-
var
|
|
33
|
-
var
|
|
30
|
+
var _styles15 = require("../../plugins/find-replace/styles");
|
|
31
|
+
var _styles16 = require("../../plugins/tasks-and-decisions/styles");
|
|
32
|
+
var _styles17 = require("../../plugins/status/styles");
|
|
33
|
+
var _styles18 = require("../../plugins/date/styles");
|
|
34
34
|
var _getInlineNodeViewProducer = require("../../nodeviews/getInlineNodeViewProducer.styles");
|
|
35
35
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
36
36
|
var _emoji = require("@atlaskit/editor-common/emoji");
|
|
37
|
-
var
|
|
37
|
+
var _colors = require("@atlaskit/theme/colors");
|
|
38
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5;
|
|
38
39
|
/** @jsx jsx */
|
|
39
40
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
40
41
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
41
42
|
var linkStyles = (0, _react2.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n .ProseMirror {\n ", "\n }\n"])), _styles.linkSharedStyle);
|
|
42
43
|
exports.linkStyles = linkStyles;
|
|
43
|
-
var
|
|
44
|
-
var
|
|
44
|
+
var mentionsStyles = (0, _react2.css)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n .", " {\n &.", " [data-mention-id] > span {\n ", "\n\n /* need to specify dark text colour because personal mentions\n (in dark blue) have white text by default */\n color: ", ";\n }\n }\n\n .danger {\n .", ".", "\n > span\n > span\n > span {\n box-shadow: 0 0 0 ", "px ", ";\n background-color: ", ";\n }\n .", " > span > span > span {\n background-color: ", ";\n color: ", ";\n }\n }\n"])), _mention.MentionSharedCssClassName.MENTION_CONTAINER, _editorSharedStyles.akEditorSelectedNodeClassName, (0, _editorSharedStyles.getSelectionStyles)([_editorSharedStyles.SelectionStyle.BoxShadow, _editorSharedStyles.SelectionStyle.Background]), "var(--ds-text-subtle, ".concat(_colors.N500, ")"), _mention.MentionSharedCssClassName.MENTION_CONTAINER, _editorSharedStyles.akEditorSelectedNodeClassName, _editorSharedStyles.akEditorSelectedBorderSize, _editorSharedStyles.akEditorDeleteBorder, "var(--ds-background-danger, ".concat(_editorSharedStyles.akEditorDeleteBackgroundWithOpacity, ")"), _mention.MentionSharedCssClassName.MENTION_CONTAINER, "var(--ds-background-neutral, ".concat(_colors.N30A, ")"), "var(--ds-text-subtle, ".concat(_colors.N500, ")"));
|
|
45
|
+
var listsStyles = (0, _react2.css)(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n .ProseMirror {\n li {\n position: relative;\n\n > p:not(:first-child) {\n margin: ", " 0 0 0;\n }\n\n // In SSR the above rule will apply to all p tags because first-child would be a style tag.\n // The following rule resets the first p tag back to its original margin\n // defined in packages/editor/editor-common/src/styles/shared/paragraph.ts\n > style:first-child + p {\n margin-top: ", ";\n }\n }\n\n & :not([data-node-type='decisionList']) > li {\n ", "\n }\n }\n"])), "var(--ds-space-050, 4px)", _editorSharedStyles.blockNodesVerticalMargin, _utils.browser.safari ? _styles.codeBlockInListSafariFix : '');
|
|
46
|
+
var emojiStyles = (0, _react2.css)(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2.default)(["\n .", " {\n display: inline-block;\n\n .", " {\n cursor: pointer;\n\n &.", " > span {\n /** needed for selection style to cover custom emoji image properly */\n display: flex;\n }\n }\n\n &.", " {\n .", ",\n .", " {\n border-radius: 2px;\n ", "\n }\n }\n }\n"])), _emoji.EmojiSharedCssClassName.EMOJI_CONTAINER, _emoji.EmojiSharedCssClassName.EMOJI_NODE, _emoji.EmojiSharedCssClassName.EMOJI_IMAGE, _editorSharedStyles.akEditorSelectedNodeClassName, _emoji.EmojiSharedCssClassName.EMOJI_SPRITE, _emoji.EmojiSharedCssClassName.EMOJI_IMAGE, (0, _editorSharedStyles.getSelectionStyles)([_editorSharedStyles.SelectionStyle.Blanket, _editorSharedStyles.SelectionStyle.BoxShadow]));
|
|
45
47
|
var contentStyles = function contentStyles(props) {
|
|
46
|
-
return (0, _react2.css)(
|
|
48
|
+
return (0, _react2.css)(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2.default)(["\n .ProseMirror {\n outline: none;\n font-size: ", "px;\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n }\n\n .ProseMirror[contenteditable='false'] .taskItemView-content-wrap {\n pointer-events: none;\n opacity: 0.7;\n }\n\n .ProseMirror-hideselection *::selection {\n background: transparent;\n }\n\n .ProseMirror-hideselection *::-moz-selection {\n background: transparent;\n }\n\n .ProseMirror-selectednode {\n outline: none;\n }\n\n .ProseMirror-selectednode:empty {\n outline: 2px solid ", ";\n }\n\n ", "\n ", "\n ", "\n\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", ";\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n\n .panelView-content-wrap {\n box-sizing: border-box;\n }\n\n .mediaGroupView-content-wrap ul {\n padding: 0;\n }\n\n /** Needed to override any cleared floats, e.g. image wrapping */\n\n div.fabric-editor-block-mark[class^='fabric-editor-align'] {\n clear: none !important;\n }\n\n .fabric-editor-align-end {\n text-align: right;\n }\n\n .fabric-editor-align-start {\n text-align: left;\n }\n\n .fabric-editor-align-center {\n text-align: center;\n }\n\n .pm-table-header-content-wrap :not(.fabric-editor-alignment),\n .pm-table-header-content-wrap\n :not(p, .fabric-editor-block-mark)\n + div.fabric-editor-block-mark,\n .pm-table-cell-content-wrap\n :not(p, .fabric-editor-block-mark)\n + div.fabric-editor-block-mark {\n p:first-of-type {\n margin-top: 0;\n }\n }\n\n .hyperlink-floating-toolbar,\n .", " {\n padding: 0;\n }\n\n /* Link icon in the Atlaskit package\n is bigger than the others\n */\n .hyperlink-open-link {\n svg {\n max-width: 18px;\n }\n &[href] {\n padding: 0 4px;\n }\n }\n"])), (0, _editorSharedStyles.editorFontSize)({
|
|
47
49
|
theme: props.theme
|
|
48
|
-
}), _styles.whitespaceSharedStyles, _styles.paragraphSharedStyles, _styles.listsSharedStyles, _styles.indentationSharedStyles, _styles.shadowSharedStyle, _getInlineNodeViewProducer.InlineNodeViewSharedStyles, "var(--ds-border-focused, #8cf)",
|
|
50
|
+
}), _styles.whitespaceSharedStyles, _styles.paragraphSharedStyles, _styles.listsSharedStyles, _styles.indentationSharedStyles, _styles.shadowSharedStyle, _getInlineNodeViewProducer.InlineNodeViewSharedStyles, "var(--ds-border-focused, #8cf)", _styles12.placeholderTextStyles, _styles4.placeholderStyles, (0, _styles6.codeBlockStyles)(props), (0, _styles5.blocktypeStyles)(props), (0, _styles.codeMarkSharedStyles)(props), _styles.textColorStyles, listsStyles, (0, _styles7.ruleStyles)(props), _styles8.mediaStyles, (0, _styles9.layoutStyles)(props), _styles2.telepointerStyle, _styles3.gapCursorStyles, (0, _commonStyles.tableStyles)(props), (0, _styles10.panelStyles)(props), _styles11.fakeCursorStyles, mentionsStyles, emojiStyles, _styles.tasksAndDecisionsStyles, _styles.gridStyles, linkStyles, _styles.blockMarksSharedStyles, _styles.dateSharedStyle, _styles13.extensionStyles, (0, _styles14.expandStyles)(props), _styles15.findReplaceStyles, _styles16.taskDecisionStyles, _styles17.statusStyles, (0, _styles.annotationSharedStyles)(props), _styles.smartCardStyles, _styles.smartCardSharedStyles, _styles18.dateStyles, _styles.embedCardStyles, _styles.unsupportedStyles, _styles.resizerStyles, _style.ClassNames.FLOATING_TOOLBAR_COMPONENT);
|
|
49
51
|
};
|
|
50
52
|
var createEditorContentStyle = function createEditorContentStyle(styles) {
|
|
51
53
|
return /*#__PURE__*/_react.default.forwardRef(function (props, ref) {
|
|
@@ -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.36.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
|
@@ -16,10 +16,8 @@ export { TeamMentionResource } from '@atlaskit/mention/team-resource';
|
|
|
16
16
|
export { AnnotationUpdateEmitter } from './plugins/annotation';
|
|
17
17
|
// Used in mobile bridge
|
|
18
18
|
export { stateKey as mediaPluginKey } from './plugins/media/pm-plugins/main';
|
|
19
|
-
export { mentionPluginKey } from './plugins/mentions';
|
|
20
19
|
export { textColorPluginKey } from './plugins/text-color';
|
|
21
20
|
export { changeColor } from './plugins/text-color/commands/change-color';
|
|
22
|
-
export { insertHorizontalRule } from './plugins/rule/commands';
|
|
23
21
|
|
|
24
22
|
/**
|
|
25
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
|
}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { Fragment, Slice } from '@atlaskit/editor-prosemirror/model';
|
|
2
|
-
import { createRule, createPlugin } from '@atlaskit/prosemirror-input-rules';
|
|
3
|
-
import { leafNodeReplacementCharacter } from '@atlaskit/prosemirror-input-rules';
|
|
2
|
+
import { createRule, createPlugin, leafNodeReplacementCharacter } from '@atlaskit/prosemirror-input-rules';
|
|
4
3
|
import { safeInsert } from '@atlaskit/editor-common/insert';
|
|
5
4
|
import { hasParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
6
|
-
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID,
|
|
7
|
-
export const createHorizontalRule = (state, featureFlags, start, end, inputMethod) => {
|
|
5
|
+
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
6
|
+
export const createHorizontalRule = (state, featureFlags, start, end, inputMethod, editorAnalyticsAPI) => {
|
|
8
7
|
if (!state.selection.empty) {
|
|
9
8
|
return null;
|
|
10
9
|
}
|
|
@@ -27,7 +26,7 @@ export const createHorizontalRule = (state, featureFlags, start, end, inputMetho
|
|
|
27
26
|
if (!tr) {
|
|
28
27
|
tr = state.tr.replaceRange(start, end, new Slice(Fragment.from(state.schema.nodes.rule.createChecked()), 0, 0));
|
|
29
28
|
}
|
|
30
|
-
|
|
29
|
+
editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 ? void 0 : editorAnalyticsAPI.attachAnalyticsEvent({
|
|
31
30
|
action: ACTION.INSERTED,
|
|
32
31
|
actionSubject: ACTION_SUBJECT.DOCUMENT,
|
|
33
32
|
actionSubjectId: ACTION_SUBJECT_ID.DIVIDER,
|
|
@@ -35,22 +34,23 @@ export const createHorizontalRule = (state, featureFlags, start, end, inputMetho
|
|
|
35
34
|
inputMethod
|
|
36
35
|
},
|
|
37
36
|
eventType: EVENT_TYPE.TRACK
|
|
38
|
-
});
|
|
37
|
+
})(tr);
|
|
38
|
+
return tr;
|
|
39
39
|
};
|
|
40
|
-
const createHorizontalRuleAutoformat = (state, featureFlags, start, end) => {
|
|
40
|
+
const createHorizontalRuleAutoformat = (state, featureFlags, start, end, editorAnalyticsAPI) => {
|
|
41
41
|
const {
|
|
42
42
|
listItem
|
|
43
43
|
} = state.schema.nodes;
|
|
44
44
|
if (hasParentNodeOfType(listItem)(state.selection)) {
|
|
45
45
|
return null;
|
|
46
46
|
}
|
|
47
|
-
return createHorizontalRule(state, featureFlags, start, end, INPUT_METHOD.FORMATTING);
|
|
47
|
+
return createHorizontalRule(state, featureFlags, start, end, INPUT_METHOD.FORMATTING, editorAnalyticsAPI);
|
|
48
48
|
};
|
|
49
|
-
export function inputRulePlugin(schema, featureFlags) {
|
|
49
|
+
export function inputRulePlugin(schema, featureFlags, editorAnalyticsAPI) {
|
|
50
50
|
const rules = [];
|
|
51
51
|
if (schema.nodes.rule) {
|
|
52
52
|
// '---' and '***' for hr
|
|
53
|
-
rules.push(createRule(/^(\-\-\-|\*\*\*)$/, (state, _match, start, end) => createHorizontalRuleAutoformat(state, featureFlags, start, end)));
|
|
53
|
+
rules.push(createRule(/^(\-\-\-|\*\*\*)$/, (state, _match, start, end) => createHorizontalRuleAutoformat(state, featureFlags, start, end, editorAnalyticsAPI)));
|
|
54
54
|
|
|
55
55
|
// '---' and '***' after shift+enter for hr
|
|
56
56
|
rules.push(createRule(new RegExp(`${leafNodeReplacementCharacter}(\\-\\-\\-|\\*\\*\\*)`), (state, _match, start, end) => {
|
|
@@ -60,7 +60,7 @@ export function inputRulePlugin(schema, featureFlags) {
|
|
|
60
60
|
if (state.doc.resolve(start).nodeAfter.type !== hardBreak) {
|
|
61
61
|
return null;
|
|
62
62
|
}
|
|
63
|
-
return createHorizontalRuleAutoformat(state, featureFlags, start, end);
|
|
63
|
+
return createHorizontalRuleAutoformat(state, featureFlags, start, end, editorAnalyticsAPI);
|
|
64
64
|
}));
|
|
65
65
|
}
|
|
66
66
|
if (rules.length !== 0) {
|
|
@@ -2,9 +2,9 @@ import { keymap } from '@atlaskit/editor-prosemirror/keymap';
|
|
|
2
2
|
import { bindKeymapWithCommand, insertRule, escape } from '@atlaskit/editor-common/keymaps';
|
|
3
3
|
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
4
4
|
import { insertHorizontalRule } from '../commands';
|
|
5
|
-
export function keymapPlugin(featureFlags) {
|
|
5
|
+
export function keymapPlugin(featureFlags, editorAnalyticsAPI) {
|
|
6
6
|
const list = {};
|
|
7
|
-
bindKeymapWithCommand(insertRule.common, insertHorizontalRule(INPUT_METHOD.SHORTCUT
|
|
7
|
+
bindKeymapWithCommand(insertRule.common, insertHorizontalRule(featureFlags, editorAnalyticsAPI)(INPUT_METHOD.SHORTCUT), list);
|
|
8
8
|
bindKeymapWithCommand(escape.common, () => true, list);
|
|
9
9
|
return keymap(list);
|
|
10
10
|
}
|