@atlaskit/editor-core 187.35.7 → 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.
Files changed (37) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/dist/cjs/index.js +10 -17
  3. package/dist/cjs/plugins/insert-block/ui/ToolbarInsertBlock/index.js +3 -3
  4. package/dist/cjs/plugins/rule/commands.js +11 -9
  5. package/dist/cjs/plugins/rule/index.js +17 -9
  6. package/dist/cjs/plugins/rule/pm-plugins/input-rule.js +10 -9
  7. package/dist/cjs/plugins/rule/pm-plugins/keymap.js +2 -2
  8. package/dist/cjs/version-wrapper.js +1 -1
  9. package/dist/es2019/index.js +0 -1
  10. package/dist/es2019/plugins/insert-block/ui/ToolbarInsertBlock/index.js +3 -3
  11. package/dist/es2019/plugins/rule/commands.js +2 -2
  12. package/dist/es2019/plugins/rule/index.js +19 -7
  13. package/dist/es2019/plugins/rule/pm-plugins/input-rule.js +11 -11
  14. package/dist/es2019/plugins/rule/pm-plugins/keymap.js +2 -2
  15. package/dist/es2019/version-wrapper.js +1 -1
  16. package/dist/esm/index.js +0 -1
  17. package/dist/esm/plugins/insert-block/ui/ToolbarInsertBlock/index.js +3 -3
  18. package/dist/esm/plugins/rule/commands.js +11 -9
  19. package/dist/esm/plugins/rule/index.js +15 -7
  20. package/dist/esm/plugins/rule/pm-plugins/input-rule.js +11 -11
  21. package/dist/esm/plugins/rule/pm-plugins/keymap.js +2 -2
  22. package/dist/esm/version-wrapper.js +1 -1
  23. package/dist/types/index.d.ts +0 -1
  24. package/dist/types/plugins/insert-block/types.d.ts +2 -0
  25. package/dist/types/plugins/rule/commands.d.ts +3 -4
  26. package/dist/types/plugins/rule/index.d.ts +9 -3
  27. package/dist/types/plugins/rule/pm-plugins/input-rule.d.ts +5 -4
  28. package/dist/types/plugins/rule/pm-plugins/keymap.d.ts +2 -1
  29. package/dist/types-ts4.5/index.d.ts +0 -1
  30. package/dist/types-ts4.5/plugins/insert-block/types.d.ts +2 -0
  31. package/dist/types-ts4.5/plugins/rule/commands.d.ts +3 -4
  32. package/dist/types-ts4.5/plugins/rule/index.d.ts +10 -3
  33. package/dist/types-ts4.5/plugins/rule/pm-plugins/input-rule.d.ts +5 -4
  34. package/dist/types-ts4.5/plugins/rule/pm-plugins/keymap.d.ts +2 -1
  35. package/package.json +1 -1
  36. package/report.api.md +0 -11
  37. package/tmp/api-report-tmp.d.ts +0 -3
package/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
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
+
3
13
  ## 187.35.7
4
14
 
5
15
  ### 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 _commands3.createTable;
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 _commands6.insertExpand;
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 _commands4.insertTaskDecisionCommand;
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 _commands5.setIsExpanded;
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 _commands5.setKeyboardHeight;
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 _commands5.setMobilePaddingTop;
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 _commands3 = require("@atlaskit/editor-plugin-table/commands");
462
- var _commands4 = require("./plugins/tasks-and-decisions/commands");
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 _commands5 = require("./plugins/mobile-dimensions/commands");
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 _commands6 = require("./plugins/expand/commands");
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
- featureFlags = _this$props4.featureFlags;
263
- return (0, _commands3.insertHorizontalRule)(inputMethod, featureFlags)(state, dispatch);
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(inputMethod, featureFlags) {
9
- return function (state, dispatch) {
10
- var tr = (0, _inputRule.createHorizontalRule)(state, featureFlags, state.selection.from, state.selection.to, inputMethod);
11
- if (tr) {
12
- if (dispatch) {
13
- dispatch(tr);
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 true;
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("../analytics");
11
- var _messages = require("../insert-block/ui/ToolbarInsertBlock/messages");
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
- return (0, _keymap.default)(featureFlags);
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.messages.horizontalRule),
47
- description: formatMessage(_messages.messages.horizontalRuleDescription),
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
- return (0, _analytics.addAnalytics)(state, tr, {
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("../../analytics");
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
- return (0, _analytics.addAnalytics)(state, tr, {
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, featureFlags), list);
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);
@@ -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.35.7";
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('.');
@@ -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
- featureFlags
260
+ pluginInjectionApi
261
261
  } = this.props;
262
- return insertHorizontalRule(inputMethod, featureFlags)(state, dispatch);
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 = (inputMethod, featureFlags) => (state, dispatch) => {
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, addAnalytics, EVENT_TYPE, INPUT_METHOD } from '../analytics';
4
- import { messages } from '../insert-block/ui/ToolbarInsertBlock/messages';
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
- }) => inputRulePlugin(schema, featureFlags)
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: () => keymapPlugin(featureFlags)
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
- return addAnalytics(state, tr, {
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, addAnalytics, EVENT_TYPE, INPUT_METHOD } from '../../analytics';
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
- return addAnalytics(state, tr, {
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, featureFlags), list);
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
  }
@@ -1,5 +1,5 @@
1
1
  export const name = "@atlaskit/editor-core";
2
- export const version = "187.35.7";
2
+ export const version = "187.36.0";
3
3
  export const nextMajorVersion = () => {
4
4
  return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
5
5
  };
package/dist/esm/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
@@ -30,7 +30,6 @@ import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } f
30
30
  import { messages } from './messages';
31
31
  import { createItems } from './create-items';
32
32
  import { BlockInsertMenu } from './block-insert-menu';
33
- import { insertHorizontalRule } from '../../../rule/commands';
34
33
  import withOuterListeners from '../../../../ui/with-outer-listeners';
35
34
 
36
35
  /**
@@ -250,12 +249,13 @@ export var ToolbarInsertBlock = /*#__PURE__*/function (_React$PureComponent) {
250
249
  };
251
250
  });
252
251
  _defineProperty(_assertThisInitialized(_this), "insertHorizontalRule", function (inputMethod) {
252
+ var _pluginInjectionApi$r, _pluginInjectionApi$r2;
253
253
  var _this$props4 = _this.props,
254
254
  _this$props4$editorVi = _this$props4.editorView,
255
255
  state = _this$props4$editorVi.state,
256
256
  dispatch = _this$props4$editorVi.dispatch,
257
- featureFlags = _this$props4.featureFlags;
258
- return insertHorizontalRule(inputMethod, featureFlags)(state, dispatch);
257
+ pluginInjectionApi = _this$props4.pluginInjectionApi;
258
+ 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;
259
259
  });
260
260
  _defineProperty(_assertThisInitialized(_this), "insertExpand", function () {
261
261
  var _this$props$editorVie2 = _this.props.editorView,
@@ -1,13 +1,15 @@
1
1
  import { createHorizontalRule } from './pm-plugins/input-rule';
2
- export var insertHorizontalRule = function insertHorizontalRule(inputMethod, featureFlags) {
3
- return function (state, dispatch) {
4
- var tr = createHorizontalRule(state, featureFlags, state.selection.from, state.selection.to, inputMethod);
5
- if (tr) {
6
- if (dispatch) {
7
- dispatch(tr);
2
+ export var insertHorizontalRule = function insertHorizontalRule(featureFlags, editorAnalyticsAPI) {
3
+ return function (inputMethod) {
4
+ return function (state, dispatch) {
5
+ var tr = createHorizontalRule(state, featureFlags, state.selection.from, state.selection.to, inputMethod, editorAnalyticsAPI);
6
+ if (tr) {
7
+ if (dispatch) {
8
+ dispatch(tr);
9
+ }
10
+ return true;
8
11
  }
9
- return true;
10
- }
11
- return false;
12
+ return false;
13
+ };
12
14
  };
13
15
  };
@@ -1,12 +1,13 @@
1
1
  import React from 'react';
2
2
  import { rule } from '@atlaskit/adf-schema';
3
- import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, addAnalytics, EVENT_TYPE, INPUT_METHOD } from '../analytics';
4
- import { messages } from '../insert-block/ui/ToolbarInsertBlock/messages';
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
  var rulePlugin = function rulePlugin(_ref) {
9
- var _api$featureFlags;
10
+ var _api$featureFlags, _api$analytics;
10
11
  var api = _ref.api;
11
12
  var featureFlags = (api === null || api === void 0 ? void 0 : (_api$featureFlags = api.featureFlags) === null || _api$featureFlags === void 0 ? void 0 : _api$featureFlags.sharedState.currentState()) || {};
12
13
  return {
@@ -17,17 +18,22 @@ var rulePlugin = function rulePlugin(_ref) {
17
18
  node: rule
18
19
  }];
19
20
  },
21
+ actions: {
22
+ insertHorizontalRule: insertHorizontalRule(featureFlags, api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions)
23
+ },
20
24
  pmPlugins: function pmPlugins() {
21
25
  return [{
22
26
  name: 'ruleInputRule',
23
27
  plugin: function plugin(_ref2) {
28
+ var _api$analytics2;
24
29
  var schema = _ref2.schema;
25
- return inputRulePlugin(schema, featureFlags);
30
+ 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);
26
31
  }
27
32
  }, {
28
33
  name: 'ruleKeymap',
29
34
  plugin: function plugin() {
30
- return keymapPlugin(featureFlags);
35
+ var _api$analytics3;
36
+ return keymapPlugin(featureFlags, api === null || api === void 0 ? void 0 : (_api$analytics3 = api.analytics) === null || _api$analytics3 === void 0 ? void 0 : _api$analytics3.actions);
31
37
  }
32
38
  }];
33
39
  },
@@ -45,8 +51,9 @@ var rulePlugin = function rulePlugin(_ref) {
45
51
  return /*#__PURE__*/React.createElement(IconDivider, null);
46
52
  },
47
53
  action: function action(insert, state) {
54
+ var _api$analytics4;
48
55
  var tr = insert(state.schema.nodes.rule.createChecked());
49
- return addAnalytics(state, tr, {
56
+ api === null || api === void 0 ? void 0 : (_api$analytics4 = api.analytics) === null || _api$analytics4 === void 0 ? void 0 : _api$analytics4.actions.attachAnalyticsEvent({
50
57
  action: ACTION.INSERTED,
51
58
  actionSubject: ACTION_SUBJECT.DOCUMENT,
52
59
  actionSubjectId: ACTION_SUBJECT_ID.DIVIDER,
@@ -54,7 +61,8 @@ var rulePlugin = function rulePlugin(_ref) {
54
61
  inputMethod: INPUT_METHOD.QUICK_INSERT
55
62
  },
56
63
  eventType: EVENT_TYPE.TRACK
57
- });
64
+ })(tr);
65
+ return tr;
58
66
  }
59
67
  }];
60
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, addAnalytics, EVENT_TYPE, INPUT_METHOD } from '../../analytics';
7
- export var createHorizontalRule = function 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 var createHorizontalRule = function createHorizontalRule(state, featureFlags, start, end, inputMethod, editorAnalyticsAPI) {
8
7
  if (!state.selection.empty) {
9
8
  return null;
10
9
  }
@@ -23,7 +22,7 @@ export var createHorizontalRule = function createHorizontalRule(state, featureFl
23
22
  if (!tr) {
24
23
  tr = state.tr.replaceRange(start, end, new Slice(Fragment.from(state.schema.nodes.rule.createChecked()), 0, 0));
25
24
  }
26
- return addAnalytics(state, tr, {
25
+ editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 ? void 0 : editorAnalyticsAPI.attachAnalyticsEvent({
27
26
  action: ACTION.INSERTED,
28
27
  actionSubject: ACTION_SUBJECT.DOCUMENT,
29
28
  actionSubjectId: ACTION_SUBJECT_ID.DIVIDER,
@@ -31,21 +30,22 @@ export var createHorizontalRule = function createHorizontalRule(state, featureFl
31
30
  inputMethod: inputMethod
32
31
  },
33
32
  eventType: EVENT_TYPE.TRACK
34
- });
33
+ })(tr);
34
+ return tr;
35
35
  };
36
- var createHorizontalRuleAutoformat = function createHorizontalRuleAutoformat(state, featureFlags, start, end) {
36
+ var createHorizontalRuleAutoformat = function createHorizontalRuleAutoformat(state, featureFlags, start, end, editorAnalyticsAPI) {
37
37
  var listItem = state.schema.nodes.listItem;
38
38
  if (hasParentNodeOfType(listItem)(state.selection)) {
39
39
  return null;
40
40
  }
41
- return createHorizontalRule(state, featureFlags, start, end, INPUT_METHOD.FORMATTING);
41
+ return createHorizontalRule(state, featureFlags, start, end, INPUT_METHOD.FORMATTING, editorAnalyticsAPI);
42
42
  };
43
- export function inputRulePlugin(schema, featureFlags) {
43
+ export function inputRulePlugin(schema, featureFlags, editorAnalyticsAPI) {
44
44
  var rules = [];
45
45
  if (schema.nodes.rule) {
46
46
  // '---' and '***' for hr
47
47
  rules.push(createRule(/^(\-\-\-|\*\*\*)$/, function (state, _match, start, end) {
48
- return createHorizontalRuleAutoformat(state, featureFlags, start, end);
48
+ return createHorizontalRuleAutoformat(state, featureFlags, start, end, editorAnalyticsAPI);
49
49
  }));
50
50
 
51
51
  // '---' and '***' after shift+enter for hr
@@ -54,7 +54,7 @@ export function inputRulePlugin(schema, featureFlags) {
54
54
  if (state.doc.resolve(start).nodeAfter.type !== hardBreak) {
55
55
  return null;
56
56
  }
57
- return createHorizontalRuleAutoformat(state, featureFlags, start, end);
57
+ return createHorizontalRuleAutoformat(state, featureFlags, start, end, editorAnalyticsAPI);
58
58
  }));
59
59
  }
60
60
  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
  var list = {};
7
- bindKeymapWithCommand(insertRule.common, insertHorizontalRule(INPUT_METHOD.SHORTCUT, featureFlags), list);
7
+ bindKeymapWithCommand(insertRule.common, insertHorizontalRule(featureFlags, editorAnalyticsAPI)(INPUT_METHOD.SHORTCUT), list);
8
8
  bindKeymapWithCommand(escape.common, function () {
9
9
  return true;
10
10
  }, list);
@@ -1,5 +1,5 @@
1
1
  export var name = "@atlaskit/editor-core";
2
- export var version = "187.35.7";
2
+ export var version = "187.36.0";
3
3
  export var nextMajorVersion = function nextMajorVersion() {
4
4
  return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
5
5
  };
@@ -22,7 +22,6 @@ export { stateKey as mediaPluginKey } from './plugins/media/pm-plugins/main';
22
22
  export { textColorPluginKey } from './plugins/text-color';
23
23
  export type { TextColorPluginState } from './plugins/text-color';
24
24
  export { changeColor } from './plugins/text-color/commands/change-color';
25
- export { insertHorizontalRule } from './plugins/rule/commands';
26
25
  export type { BlockTypeState } from './plugins/block-type/pm-plugins/main';
27
26
  /**
28
27
  * @private
@@ -11,6 +11,7 @@ import type quickInsertPlugin from '../quick-insert';
11
11
  import type blockTypePlugin from '../block-type';
12
12
  import type codeBlockPlugin from '../code-block';
13
13
  import type panelPlugin from '../panel';
14
+ import type { RulePlugin } from '../rule';
14
15
  export type InsertBlockPluginDependencies = [
15
16
  FeatureFlagsPlugin,
16
17
  OptionalPlugin<typeof tablesPlugin>,
@@ -22,6 +23,7 @@ export type InsertBlockPluginDependencies = [
22
23
  OptionalPlugin<typeof mentionsPlugin>,
23
24
  OptionalPlugin<EmojiPlugin>,
24
25
  OptionalPlugin<typeof quickInsertPlugin>,
26
+ OptionalPlugin<RulePlugin>,
25
27
  OptionalPlugin<typeof codeBlockPlugin>,
26
28
  OptionalPlugin<typeof panelPlugin>
27
29
  ];
@@ -1,4 +1,3 @@
1
- import { FeatureFlags } from '@atlaskit/editor-common/types';
2
- import { Command } from '../../types';
3
- import { INPUT_METHOD } from '../analytics';
4
- export declare const insertHorizontalRule: (inputMethod: INPUT_METHOD.QUICK_INSERT | INPUT_METHOD.TOOLBAR | INPUT_METHOD.INSERT_MENU | INPUT_METHOD.FORMATTING | INPUT_METHOD.SHORTCUT, featureFlags: FeatureFlags) => Command;
1
+ import type { FeatureFlags, Command } from '@atlaskit/editor-common/types';
2
+ import type { INPUT_METHOD, EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
3
+ export declare const insertHorizontalRule: (featureFlags: FeatureFlags, editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (inputMethod: INPUT_METHOD.QUICK_INSERT | INPUT_METHOD.TOOLBAR | INPUT_METHOD.INSERT_MENU | INPUT_METHOD.FORMATTING | INPUT_METHOD.SHORTCUT) => Command;
@@ -1,7 +1,13 @@
1
- import type { NextEditorPlugin } from '@atlaskit/editor-common/types';
1
+ import type { NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
2
+ import { insertHorizontalRule } from './commands';
2
3
  import type { FeatureFlagsPlugin } from '@atlaskit/editor-plugin-feature-flags';
3
- declare const rulePlugin: NextEditorPlugin<'rule', {
4
+ import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
5
+ export type RulePlugin = NextEditorPlugin<'rule', {
4
6
  pluginConfiguration: undefined;
5
- dependencies: [FeatureFlagsPlugin];
7
+ dependencies: [FeatureFlagsPlugin, OptionalPlugin<AnalyticsPlugin>];
8
+ actions: {
9
+ insertHorizontalRule: ReturnType<typeof insertHorizontalRule>;
10
+ };
6
11
  }>;
12
+ declare const rulePlugin: RulePlugin;
7
13
  export default rulePlugin;
@@ -1,8 +1,9 @@
1
1
  import type { Schema } from '@atlaskit/editor-prosemirror/model';
2
2
  import type { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
3
3
  import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
4
- import type { FeatureFlags } from '../../../types/feature-flags';
5
- import { INPUT_METHOD } from '../../analytics';
6
- export declare const createHorizontalRule: (state: EditorState, featureFlags: FeatureFlags, start: number, end: number, inputMethod: INPUT_METHOD.QUICK_INSERT | INPUT_METHOD.TOOLBAR | INPUT_METHOD.INSERT_MENU | INPUT_METHOD.FORMATTING | INPUT_METHOD.SHORTCUT) => Transaction | null;
7
- export declare function inputRulePlugin(schema: Schema, featureFlags: FeatureFlags): SafePlugin | undefined;
4
+ import type { FeatureFlags } from '@atlaskit/editor-common/types';
5
+ import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
6
+ import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
7
+ export declare const createHorizontalRule: (state: EditorState, featureFlags: FeatureFlags, start: number, end: number, inputMethod: INPUT_METHOD.QUICK_INSERT | INPUT_METHOD.TOOLBAR | INPUT_METHOD.INSERT_MENU | INPUT_METHOD.FORMATTING | INPUT_METHOD.SHORTCUT, editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => Transaction | null;
8
+ export declare function inputRulePlugin(schema: Schema, featureFlags: FeatureFlags, editorAnalyticsAPI: EditorAnalyticsAPI | undefined): SafePlugin | undefined;
8
9
  export default inputRulePlugin;
@@ -1,4 +1,5 @@
1
1
  import type { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
+ import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
2
3
  import type { FeatureFlags } from '@atlaskit/editor-common/types';
3
- export declare function keymapPlugin(featureFlags: FeatureFlags): SafePlugin;
4
+ export declare function keymapPlugin(featureFlags: FeatureFlags, editorAnalyticsAPI: EditorAnalyticsAPI | undefined): SafePlugin;
4
5
  export default keymapPlugin;
@@ -22,7 +22,6 @@ export { stateKey as mediaPluginKey } from './plugins/media/pm-plugins/main';
22
22
  export { textColorPluginKey } from './plugins/text-color';
23
23
  export type { TextColorPluginState } from './plugins/text-color';
24
24
  export { changeColor } from './plugins/text-color/commands/change-color';
25
- export { insertHorizontalRule } from './plugins/rule/commands';
26
25
  export type { BlockTypeState } from './plugins/block-type/pm-plugins/main';
27
26
  /**
28
27
  * @private
@@ -11,6 +11,7 @@ import type quickInsertPlugin from '../quick-insert';
11
11
  import type blockTypePlugin from '../block-type';
12
12
  import type codeBlockPlugin from '../code-block';
13
13
  import type panelPlugin from '../panel';
14
+ import type { RulePlugin } from '../rule';
14
15
  export type InsertBlockPluginDependencies = [
15
16
  FeatureFlagsPlugin,
16
17
  OptionalPlugin<typeof tablesPlugin>,
@@ -22,6 +23,7 @@ export type InsertBlockPluginDependencies = [
22
23
  OptionalPlugin<typeof mentionsPlugin>,
23
24
  OptionalPlugin<EmojiPlugin>,
24
25
  OptionalPlugin<typeof quickInsertPlugin>,
26
+ OptionalPlugin<RulePlugin>,
25
27
  OptionalPlugin<typeof codeBlockPlugin>,
26
28
  OptionalPlugin<typeof panelPlugin>
27
29
  ];
@@ -1,4 +1,3 @@
1
- import { FeatureFlags } from '@atlaskit/editor-common/types';
2
- import { Command } from '../../types';
3
- import { INPUT_METHOD } from '../analytics';
4
- export declare const insertHorizontalRule: (inputMethod: INPUT_METHOD.QUICK_INSERT | INPUT_METHOD.TOOLBAR | INPUT_METHOD.INSERT_MENU | INPUT_METHOD.FORMATTING | INPUT_METHOD.SHORTCUT, featureFlags: FeatureFlags) => Command;
1
+ import type { FeatureFlags, Command } from '@atlaskit/editor-common/types';
2
+ import type { INPUT_METHOD, EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
3
+ export declare const insertHorizontalRule: (featureFlags: FeatureFlags, editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (inputMethod: INPUT_METHOD.QUICK_INSERT | INPUT_METHOD.TOOLBAR | INPUT_METHOD.INSERT_MENU | INPUT_METHOD.FORMATTING | INPUT_METHOD.SHORTCUT) => Command;
@@ -1,9 +1,16 @@
1
- import type { NextEditorPlugin } from '@atlaskit/editor-common/types';
1
+ import type { NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
2
+ import { insertHorizontalRule } from './commands';
2
3
  import type { FeatureFlagsPlugin } from '@atlaskit/editor-plugin-feature-flags';
3
- declare const rulePlugin: NextEditorPlugin<'rule', {
4
+ import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
5
+ export type RulePlugin = NextEditorPlugin<'rule', {
4
6
  pluginConfiguration: undefined;
5
7
  dependencies: [
6
- FeatureFlagsPlugin
8
+ FeatureFlagsPlugin,
9
+ OptionalPlugin<AnalyticsPlugin>
7
10
  ];
11
+ actions: {
12
+ insertHorizontalRule: ReturnType<typeof insertHorizontalRule>;
13
+ };
8
14
  }>;
15
+ declare const rulePlugin: RulePlugin;
9
16
  export default rulePlugin;
@@ -1,8 +1,9 @@
1
1
  import type { Schema } from '@atlaskit/editor-prosemirror/model';
2
2
  import type { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
3
3
  import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
4
- import type { FeatureFlags } from '../../../types/feature-flags';
5
- import { INPUT_METHOD } from '../../analytics';
6
- export declare const createHorizontalRule: (state: EditorState, featureFlags: FeatureFlags, start: number, end: number, inputMethod: INPUT_METHOD.QUICK_INSERT | INPUT_METHOD.TOOLBAR | INPUT_METHOD.INSERT_MENU | INPUT_METHOD.FORMATTING | INPUT_METHOD.SHORTCUT) => Transaction | null;
7
- export declare function inputRulePlugin(schema: Schema, featureFlags: FeatureFlags): SafePlugin | undefined;
4
+ import type { FeatureFlags } from '@atlaskit/editor-common/types';
5
+ import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
6
+ import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
7
+ export declare const createHorizontalRule: (state: EditorState, featureFlags: FeatureFlags, start: number, end: number, inputMethod: INPUT_METHOD.QUICK_INSERT | INPUT_METHOD.TOOLBAR | INPUT_METHOD.INSERT_MENU | INPUT_METHOD.FORMATTING | INPUT_METHOD.SHORTCUT, editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => Transaction | null;
8
+ export declare function inputRulePlugin(schema: Schema, featureFlags: FeatureFlags, editorAnalyticsAPI: EditorAnalyticsAPI | undefined): SafePlugin | undefined;
8
9
  export default inputRulePlugin;
@@ -1,4 +1,5 @@
1
1
  import type { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
+ import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
2
3
  import type { FeatureFlags } from '@atlaskit/editor-common/types';
3
- export declare function keymapPlugin(featureFlags: FeatureFlags): SafePlugin;
4
+ export declare function keymapPlugin(featureFlags: FeatureFlags, editorAnalyticsAPI: EditorAnalyticsAPI | undefined): SafePlugin;
4
5
  export default keymapPlugin;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-core",
3
- "version": "187.35.7",
3
+ "version": "187.36.0",
4
4
  "description": "A package contains Atlassian editor core functionality",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
package/report.api.md CHANGED
@@ -1144,17 +1144,6 @@ export const insertDate: (
1144
1144
  // @public (undocumented)
1145
1145
  export const insertExpand: Command;
1146
1146
 
1147
- // @public (undocumented)
1148
- export const insertHorizontalRule: (
1149
- inputMethod:
1150
- | INPUT_METHOD.FORMATTING
1151
- | INPUT_METHOD.INSERT_MENU
1152
- | INPUT_METHOD.QUICK_INSERT
1153
- | INPUT_METHOD.SHORTCUT
1154
- | INPUT_METHOD.TOOLBAR,
1155
- featureFlags: EditorFeatureFlags,
1156
- ) => Command;
1157
-
1158
1147
  // @public (undocumented)
1159
1148
  type InsertItemProps = {
1160
1149
  contentItem: TypeAheadItem;
@@ -1045,9 +1045,6 @@ export const insertDate: (date?: DateType, inputMethod?: InsertBlockInputMethodT
1045
1045
  // @public (undocumented)
1046
1046
  export const insertExpand: Command;
1047
1047
 
1048
- // @public (undocumented)
1049
- export const insertHorizontalRule: (inputMethod: INPUT_METHOD.FORMATTING | INPUT_METHOD.INSERT_MENU | INPUT_METHOD.QUICK_INSERT | INPUT_METHOD.SHORTCUT | INPUT_METHOD.TOOLBAR, featureFlags: EditorFeatureFlags) => Command;
1050
-
1051
1048
  // @public (undocumented)
1052
1049
  type InsertItemProps = {
1053
1050
  contentItem: TypeAheadItem;