@atlaskit/editor-plugin-rule 0.1.19 → 1.1.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 CHANGED
@@ -1,5 +1,46 @@
1
1
  # @atlaskit/editor-plugin-rule
2
2
 
3
+ ## 1.1.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#72122](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/72122) [`c3186450404a`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/c3186450404a) - Breaking change:
8
+
9
+ ## WHAT?:
10
+
11
+ Removing feature flags:
12
+
13
+ - singleLayout
14
+ - newInsertionBehaviour
15
+ - interactiveExpand
16
+ - findReplace
17
+ - findReplaceMatchCase
18
+ - extendFloatingToolbar
19
+
20
+ ## WHY?:
21
+
22
+ Because the flags and props are unused/by default active. Removing them will reduce our maintenance burden
23
+
24
+ ## HOW to update your code:
25
+
26
+ - If you were using the feature flag - the behaviour is now default and you can remove the flags
27
+ - If you were not using the feature flag - the behaviour is now default.
28
+ - If you have opted out of using the feature flag - we have been careful to ensure no-one has opted out of the behaviours. If you do have an issue please reach out to #help-editor.
29
+
30
+ ### Patch Changes
31
+
32
+ - Updated dependencies
33
+
34
+ ## 1.0.0
35
+
36
+ ### Major Changes
37
+
38
+ - [#72386](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/72386) [`0c52b0be40c1`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/0c52b0be40c1) - This changeset exists to bump all editor plugins that currently don't have a major version. This is to address an issue with Jira plugin consumption.
39
+
40
+ ### Patch Changes
41
+
42
+ - Updated dependencies
43
+
3
44
  ## 0.1.19
4
45
 
5
46
  ### Patch Changes
@@ -5,10 +5,10 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.insertHorizontalRule = void 0;
7
7
  var _inputRule = require("./pm-plugins/input-rule");
8
- var insertHorizontalRule = exports.insertHorizontalRule = function insertHorizontalRule(featureFlags, editorAnalyticsAPI) {
8
+ var insertHorizontalRule = exports.insertHorizontalRule = function insertHorizontalRule(editorAnalyticsAPI) {
9
9
  return function (inputMethod) {
10
10
  return function (state, dispatch) {
11
- var tr = (0, _inputRule.createHorizontalRule)(state, featureFlags, state.selection.from, state.selection.to, inputMethod, editorAnalyticsAPI);
11
+ var tr = (0, _inputRule.createHorizontalRule)(state, state.selection.from, state.selection.to, inputMethod, editorAnalyticsAPI);
12
12
  if (tr) {
13
13
  if (dispatch) {
14
14
  dispatch(tr);
@@ -14,9 +14,8 @@ var _commands = require("./commands");
14
14
  var _inputRule = _interopRequireDefault(require("./pm-plugins/input-rule"));
15
15
  var _keymap = _interopRequireDefault(require("./pm-plugins/keymap"));
16
16
  var rulePlugin = exports.rulePlugin = function rulePlugin(_ref) {
17
- var _api$featureFlags, _api$analytics;
17
+ var _api$analytics;
18
18
  var api = _ref.api;
19
- var featureFlags = (api === null || api === void 0 || (_api$featureFlags = api.featureFlags) === null || _api$featureFlags === void 0 ? void 0 : _api$featureFlags.sharedState.currentState()) || {};
20
19
  return {
21
20
  name: 'rule',
22
21
  nodes: function nodes() {
@@ -26,7 +25,7 @@ var rulePlugin = exports.rulePlugin = function rulePlugin(_ref) {
26
25
  }];
27
26
  },
28
27
  actions: {
29
- insertHorizontalRule: (0, _commands.insertHorizontalRule)(featureFlags, api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions)
28
+ insertHorizontalRule: (0, _commands.insertHorizontalRule)(api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions)
30
29
  },
31
30
  pmPlugins: function pmPlugins() {
32
31
  return [{
@@ -34,13 +33,13 @@ var rulePlugin = exports.rulePlugin = function rulePlugin(_ref) {
34
33
  plugin: function plugin(_ref2) {
35
34
  var _api$analytics2;
36
35
  var schema = _ref2.schema;
37
- return (0, _inputRule.default)(schema, featureFlags, api === null || api === void 0 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions);
36
+ return (0, _inputRule.default)(schema, api === null || api === void 0 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions);
38
37
  }
39
38
  }, {
40
39
  name: 'ruleKeymap',
41
40
  plugin: function plugin() {
42
41
  var _api$analytics3;
43
- return (0, _keymap.default)(featureFlags, api === null || api === void 0 || (_api$analytics3 = api.analytics) === null || _api$analytics3 === void 0 ? void 0 : _api$analytics3.actions);
42
+ return (0, _keymap.default)(api === null || api === void 0 || (_api$analytics3 = api.analytics) === null || _api$analytics3 === void 0 ? void 0 : _api$analytics3.actions);
44
43
  }
45
44
  }];
46
45
  },
@@ -10,22 +10,19 @@ var _insert = require("@atlaskit/editor-common/insert");
10
10
  var _model = require("@atlaskit/editor-prosemirror/model");
11
11
  var _utils = require("@atlaskit/editor-prosemirror/utils");
12
12
  var _prosemirrorInputRules = require("@atlaskit/prosemirror-input-rules");
13
- var createHorizontalRule = exports.createHorizontalRule = function createHorizontalRule(state, featureFlags, start, end, inputMethod, editorAnalyticsAPI) {
13
+ var createHorizontalRule = exports.createHorizontalRule = function createHorizontalRule(state, start, end, inputMethod, editorAnalyticsAPI) {
14
14
  if (!state.selection.empty) {
15
15
  return null;
16
16
  }
17
17
  var tr = null;
18
18
  var rule = state.schema.nodes.rule;
19
- var newInsertionBehaviour = featureFlags.newInsertionBehaviour;
20
- if (newInsertionBehaviour) {
21
- /**
22
- * This is a workaround to get rid of the typeahead text when using quick insert
23
- * Once we insert *nothing*, we get a new transaction, so we can use the new selection
24
- * without considering the extra text after the `/` command.
25
- **/
26
- tr = state.tr.replaceWith(start, end, _model.Fragment.empty);
27
- tr = (0, _insert.safeInsert)(rule.createChecked(), tr.selection.from)(tr);
28
- }
19
+ /**
20
+ * This is a workaround to get rid of the typeahead text when using quick insert
21
+ * Once we insert *nothing*, we get a new transaction, so we can use the new selection
22
+ * without considering the extra text after the `/` command.
23
+ **/
24
+ tr = state.tr.replaceWith(start, end, _model.Fragment.empty);
25
+ tr = (0, _insert.safeInsert)(rule.createChecked(), tr.selection.from)(tr);
29
26
  if (!tr) {
30
27
  tr = state.tr.replaceRange(start, end, new _model.Slice(_model.Fragment.from(state.schema.nodes.rule.createChecked()), 0, 0));
31
28
  }
@@ -40,19 +37,19 @@ var createHorizontalRule = exports.createHorizontalRule = function createHorizon
40
37
  })(tr);
41
38
  return tr;
42
39
  };
43
- var createHorizontalRuleAutoformat = function createHorizontalRuleAutoformat(state, featureFlags, start, end, editorAnalyticsAPI) {
40
+ var createHorizontalRuleAutoformat = function createHorizontalRuleAutoformat(state, start, end, editorAnalyticsAPI) {
44
41
  var listItem = state.schema.nodes.listItem;
45
42
  if ((0, _utils.hasParentNodeOfType)(listItem)(state.selection)) {
46
43
  return null;
47
44
  }
48
- return createHorizontalRule(state, featureFlags, start, end, _analytics.INPUT_METHOD.FORMATTING, editorAnalyticsAPI);
45
+ return createHorizontalRule(state, start, end, _analytics.INPUT_METHOD.FORMATTING, editorAnalyticsAPI);
49
46
  };
50
- function inputRulePlugin(schema, featureFlags, editorAnalyticsAPI) {
47
+ function inputRulePlugin(schema, editorAnalyticsAPI) {
51
48
  var rules = [];
52
49
  if (schema.nodes.rule) {
53
50
  // '---' and '***' for hr
54
51
  rules.push((0, _prosemirrorInputRules.createRule)(/^(\-\-\-|\*\*\*)$/, function (state, _match, start, end) {
55
- return createHorizontalRuleAutoformat(state, featureFlags, start, end, editorAnalyticsAPI);
52
+ return createHorizontalRuleAutoformat(state, start, end, editorAnalyticsAPI);
56
53
  }));
57
54
 
58
55
  // '---' and '***' after shift+enter for hr
@@ -61,7 +58,7 @@ function inputRulePlugin(schema, featureFlags, editorAnalyticsAPI) {
61
58
  if (state.doc.resolve(start).nodeAfter.type !== hardBreak) {
62
59
  return null;
63
60
  }
64
- return createHorizontalRuleAutoformat(state, featureFlags, start, end, editorAnalyticsAPI);
61
+ return createHorizontalRuleAutoformat(state, start, end, editorAnalyticsAPI);
65
62
  }));
66
63
  }
67
64
  if (rules.length !== 0) {
@@ -9,9 +9,9 @@ var _analytics = require("@atlaskit/editor-common/analytics");
9
9
  var _keymaps = require("@atlaskit/editor-common/keymaps");
10
10
  var _keymap = require("@atlaskit/editor-prosemirror/keymap");
11
11
  var _commands = require("../commands");
12
- function keymapPlugin(featureFlags, editorAnalyticsAPI) {
12
+ function keymapPlugin(editorAnalyticsAPI) {
13
13
  var list = {};
14
- (0, _keymaps.bindKeymapWithCommand)(_keymaps.insertRule.common, (0, _commands.insertHorizontalRule)(featureFlags, editorAnalyticsAPI)(_analytics.INPUT_METHOD.SHORTCUT), list);
14
+ (0, _keymaps.bindKeymapWithCommand)(_keymaps.insertRule.common, (0, _commands.insertHorizontalRule)(editorAnalyticsAPI)(_analytics.INPUT_METHOD.SHORTCUT), list);
15
15
  (0, _keymaps.bindKeymapWithCommand)(_keymaps.escape.common, function () {
16
16
  return true;
17
17
  }, list);
@@ -1,6 +1,6 @@
1
1
  import { createHorizontalRule } from './pm-plugins/input-rule';
2
- export const insertHorizontalRule = (featureFlags, editorAnalyticsAPI) => inputMethod => (state, dispatch) => {
3
- const tr = createHorizontalRule(state, featureFlags, state.selection.from, state.selection.to, inputMethod, editorAnalyticsAPI);
2
+ export const insertHorizontalRule = editorAnalyticsAPI => inputMethod => (state, dispatch) => {
3
+ const tr = createHorizontalRule(state, state.selection.from, state.selection.to, inputMethod, editorAnalyticsAPI);
4
4
  if (tr) {
5
5
  if (dispatch) {
6
6
  dispatch(tr);
@@ -9,8 +9,7 @@ import keymapPlugin from './pm-plugins/keymap';
9
9
  export const rulePlugin = ({
10
10
  api
11
11
  }) => {
12
- var _api$featureFlags, _api$analytics;
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()) || {};
12
+ var _api$analytics;
14
13
  return {
15
14
  name: 'rule',
16
15
  nodes() {
@@ -20,7 +19,7 @@ export const rulePlugin = ({
20
19
  }];
21
20
  },
22
21
  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)
22
+ insertHorizontalRule: insertHorizontalRule(api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions)
24
23
  },
25
24
  pmPlugins() {
26
25
  return [{
@@ -29,13 +28,13 @@ export const rulePlugin = ({
29
28
  schema
30
29
  }) => {
31
30
  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);
31
+ return inputRulePlugin(schema, api === null || api === void 0 ? void 0 : (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions);
33
32
  }
34
33
  }, {
35
34
  name: 'ruleKeymap',
36
35
  plugin: () => {
37
36
  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);
37
+ return keymapPlugin(api === null || api === void 0 ? void 0 : (_api$analytics3 = api.analytics) === null || _api$analytics3 === void 0 ? void 0 : _api$analytics3.actions);
39
38
  }
40
39
  }];
41
40
  },
@@ -3,7 +3,7 @@ import { safeInsert } from '@atlaskit/editor-common/insert';
3
3
  import { Fragment, Slice } from '@atlaskit/editor-prosemirror/model';
4
4
  import { hasParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
5
5
  import { createPlugin, createRule, leafNodeReplacementCharacter } from '@atlaskit/prosemirror-input-rules';
6
- export const createHorizontalRule = (state, featureFlags, start, end, inputMethod, editorAnalyticsAPI) => {
6
+ export const createHorizontalRule = (state, start, end, inputMethod, editorAnalyticsAPI) => {
7
7
  if (!state.selection.empty) {
8
8
  return null;
9
9
  }
@@ -11,18 +11,13 @@ export const createHorizontalRule = (state, featureFlags, start, end, inputMetho
11
11
  const {
12
12
  rule
13
13
  } = state.schema.nodes;
14
- const {
15
- newInsertionBehaviour
16
- } = featureFlags;
17
- if (newInsertionBehaviour) {
18
- /**
19
- * This is a workaround to get rid of the typeahead text when using quick insert
20
- * Once we insert *nothing*, we get a new transaction, so we can use the new selection
21
- * without considering the extra text after the `/` command.
22
- **/
23
- tr = state.tr.replaceWith(start, end, Fragment.empty);
24
- tr = safeInsert(rule.createChecked(), tr.selection.from)(tr);
25
- }
14
+ /**
15
+ * This is a workaround to get rid of the typeahead text when using quick insert
16
+ * Once we insert *nothing*, we get a new transaction, so we can use the new selection
17
+ * without considering the extra text after the `/` command.
18
+ **/
19
+ tr = state.tr.replaceWith(start, end, Fragment.empty);
20
+ tr = safeInsert(rule.createChecked(), tr.selection.from)(tr);
26
21
  if (!tr) {
27
22
  tr = state.tr.replaceRange(start, end, new Slice(Fragment.from(state.schema.nodes.rule.createChecked()), 0, 0));
28
23
  }
@@ -37,20 +32,20 @@ export const createHorizontalRule = (state, featureFlags, start, end, inputMetho
37
32
  })(tr);
38
33
  return tr;
39
34
  };
40
- const createHorizontalRuleAutoformat = (state, featureFlags, start, end, editorAnalyticsAPI) => {
35
+ const createHorizontalRuleAutoformat = (state, start, end, editorAnalyticsAPI) => {
41
36
  const {
42
37
  listItem
43
38
  } = state.schema.nodes;
44
39
  if (hasParentNodeOfType(listItem)(state.selection)) {
45
40
  return null;
46
41
  }
47
- return createHorizontalRule(state, featureFlags, start, end, INPUT_METHOD.FORMATTING, editorAnalyticsAPI);
42
+ return createHorizontalRule(state, start, end, INPUT_METHOD.FORMATTING, editorAnalyticsAPI);
48
43
  };
49
- export function inputRulePlugin(schema, featureFlags, editorAnalyticsAPI) {
44
+ export function inputRulePlugin(schema, editorAnalyticsAPI) {
50
45
  const rules = [];
51
46
  if (schema.nodes.rule) {
52
47
  // '---' and '***' for hr
53
- rules.push(createRule(/^(\-\-\-|\*\*\*)$/, (state, _match, start, end) => createHorizontalRuleAutoformat(state, featureFlags, start, end, editorAnalyticsAPI)));
48
+ rules.push(createRule(/^(\-\-\-|\*\*\*)$/, (state, _match, start, end) => createHorizontalRuleAutoformat(state, start, end, editorAnalyticsAPI)));
54
49
 
55
50
  // '---' and '***' after shift+enter for hr
56
51
  rules.push(createRule(new RegExp(`${leafNodeReplacementCharacter}(\\-\\-\\-|\\*\\*\\*)`), (state, _match, start, end) => {
@@ -60,7 +55,7 @@ export function inputRulePlugin(schema, featureFlags, editorAnalyticsAPI) {
60
55
  if (state.doc.resolve(start).nodeAfter.type !== hardBreak) {
61
56
  return null;
62
57
  }
63
- return createHorizontalRuleAutoformat(state, featureFlags, start, end, editorAnalyticsAPI);
58
+ return createHorizontalRuleAutoformat(state, start, end, editorAnalyticsAPI);
64
59
  }));
65
60
  }
66
61
  if (rules.length !== 0) {
@@ -2,9 +2,9 @@ import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
2
2
  import { bindKeymapWithCommand, escape, insertRule } from '@atlaskit/editor-common/keymaps';
3
3
  import { keymap } from '@atlaskit/editor-prosemirror/keymap';
4
4
  import { insertHorizontalRule } from '../commands';
5
- export function keymapPlugin(featureFlags, editorAnalyticsAPI) {
5
+ export function keymapPlugin(editorAnalyticsAPI) {
6
6
  const list = {};
7
- bindKeymapWithCommand(insertRule.common, insertHorizontalRule(featureFlags, editorAnalyticsAPI)(INPUT_METHOD.SHORTCUT), list);
7
+ bindKeymapWithCommand(insertRule.common, insertHorizontalRule(editorAnalyticsAPI)(INPUT_METHOD.SHORTCUT), list);
8
8
  bindKeymapWithCommand(escape.common, () => true, list);
9
9
  return keymap(list);
10
10
  }
@@ -1,8 +1,8 @@
1
1
  import { createHorizontalRule } from './pm-plugins/input-rule';
2
- export var insertHorizontalRule = function insertHorizontalRule(featureFlags, editorAnalyticsAPI) {
2
+ export var insertHorizontalRule = function insertHorizontalRule(editorAnalyticsAPI) {
3
3
  return function (inputMethod) {
4
4
  return function (state, dispatch) {
5
- var tr = createHorizontalRule(state, featureFlags, state.selection.from, state.selection.to, inputMethod, editorAnalyticsAPI);
5
+ var tr = createHorizontalRule(state, state.selection.from, state.selection.to, inputMethod, editorAnalyticsAPI);
6
6
  if (tr) {
7
7
  if (dispatch) {
8
8
  dispatch(tr);
@@ -7,9 +7,8 @@ import { insertHorizontalRule } from './commands';
7
7
  import inputRulePlugin from './pm-plugins/input-rule';
8
8
  import keymapPlugin from './pm-plugins/keymap';
9
9
  export var rulePlugin = function rulePlugin(_ref) {
10
- var _api$featureFlags, _api$analytics;
10
+ var _api$analytics;
11
11
  var api = _ref.api;
12
- var featureFlags = (api === null || api === void 0 || (_api$featureFlags = api.featureFlags) === null || _api$featureFlags === void 0 ? void 0 : _api$featureFlags.sharedState.currentState()) || {};
13
12
  return {
14
13
  name: 'rule',
15
14
  nodes: function nodes() {
@@ -19,7 +18,7 @@ export var rulePlugin = function rulePlugin(_ref) {
19
18
  }];
20
19
  },
21
20
  actions: {
22
- insertHorizontalRule: insertHorizontalRule(featureFlags, api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions)
21
+ insertHorizontalRule: insertHorizontalRule(api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions)
23
22
  },
24
23
  pmPlugins: function pmPlugins() {
25
24
  return [{
@@ -27,13 +26,13 @@ export var rulePlugin = function rulePlugin(_ref) {
27
26
  plugin: function plugin(_ref2) {
28
27
  var _api$analytics2;
29
28
  var schema = _ref2.schema;
30
- return inputRulePlugin(schema, featureFlags, api === null || api === void 0 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions);
29
+ return inputRulePlugin(schema, api === null || api === void 0 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions);
31
30
  }
32
31
  }, {
33
32
  name: 'ruleKeymap',
34
33
  plugin: function plugin() {
35
34
  var _api$analytics3;
36
- return keymapPlugin(featureFlags, api === null || api === void 0 || (_api$analytics3 = api.analytics) === null || _api$analytics3 === void 0 ? void 0 : _api$analytics3.actions);
35
+ return keymapPlugin(api === null || api === void 0 || (_api$analytics3 = api.analytics) === null || _api$analytics3 === void 0 ? void 0 : _api$analytics3.actions);
37
36
  }
38
37
  }];
39
38
  },
@@ -3,22 +3,19 @@ import { safeInsert } from '@atlaskit/editor-common/insert';
3
3
  import { Fragment, Slice } from '@atlaskit/editor-prosemirror/model';
4
4
  import { hasParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
5
5
  import { createPlugin, createRule, leafNodeReplacementCharacter } from '@atlaskit/prosemirror-input-rules';
6
- export var createHorizontalRule = function createHorizontalRule(state, featureFlags, start, end, inputMethod, editorAnalyticsAPI) {
6
+ export var createHorizontalRule = function createHorizontalRule(state, start, end, inputMethod, editorAnalyticsAPI) {
7
7
  if (!state.selection.empty) {
8
8
  return null;
9
9
  }
10
10
  var tr = null;
11
11
  var rule = state.schema.nodes.rule;
12
- var newInsertionBehaviour = featureFlags.newInsertionBehaviour;
13
- if (newInsertionBehaviour) {
14
- /**
15
- * This is a workaround to get rid of the typeahead text when using quick insert
16
- * Once we insert *nothing*, we get a new transaction, so we can use the new selection
17
- * without considering the extra text after the `/` command.
18
- **/
19
- tr = state.tr.replaceWith(start, end, Fragment.empty);
20
- tr = safeInsert(rule.createChecked(), tr.selection.from)(tr);
21
- }
12
+ /**
13
+ * This is a workaround to get rid of the typeahead text when using quick insert
14
+ * Once we insert *nothing*, we get a new transaction, so we can use the new selection
15
+ * without considering the extra text after the `/` command.
16
+ **/
17
+ tr = state.tr.replaceWith(start, end, Fragment.empty);
18
+ tr = safeInsert(rule.createChecked(), tr.selection.from)(tr);
22
19
  if (!tr) {
23
20
  tr = state.tr.replaceRange(start, end, new Slice(Fragment.from(state.schema.nodes.rule.createChecked()), 0, 0));
24
21
  }
@@ -33,19 +30,19 @@ export var createHorizontalRule = function createHorizontalRule(state, featureFl
33
30
  })(tr);
34
31
  return tr;
35
32
  };
36
- var createHorizontalRuleAutoformat = function createHorizontalRuleAutoformat(state, featureFlags, start, end, editorAnalyticsAPI) {
33
+ var createHorizontalRuleAutoformat = function createHorizontalRuleAutoformat(state, start, end, editorAnalyticsAPI) {
37
34
  var listItem = state.schema.nodes.listItem;
38
35
  if (hasParentNodeOfType(listItem)(state.selection)) {
39
36
  return null;
40
37
  }
41
- return createHorizontalRule(state, featureFlags, start, end, INPUT_METHOD.FORMATTING, editorAnalyticsAPI);
38
+ return createHorizontalRule(state, start, end, INPUT_METHOD.FORMATTING, editorAnalyticsAPI);
42
39
  };
43
- export function inputRulePlugin(schema, featureFlags, editorAnalyticsAPI) {
40
+ export function inputRulePlugin(schema, editorAnalyticsAPI) {
44
41
  var rules = [];
45
42
  if (schema.nodes.rule) {
46
43
  // '---' and '***' for hr
47
44
  rules.push(createRule(/^(\-\-\-|\*\*\*)$/, function (state, _match, start, end) {
48
- return createHorizontalRuleAutoformat(state, featureFlags, start, end, editorAnalyticsAPI);
45
+ return createHorizontalRuleAutoformat(state, start, end, editorAnalyticsAPI);
49
46
  }));
50
47
 
51
48
  // '---' and '***' after shift+enter for hr
@@ -54,7 +51,7 @@ export function inputRulePlugin(schema, featureFlags, editorAnalyticsAPI) {
54
51
  if (state.doc.resolve(start).nodeAfter.type !== hardBreak) {
55
52
  return null;
56
53
  }
57
- return createHorizontalRuleAutoformat(state, featureFlags, start, end, editorAnalyticsAPI);
54
+ return createHorizontalRuleAutoformat(state, start, end, editorAnalyticsAPI);
58
55
  }));
59
56
  }
60
57
  if (rules.length !== 0) {
@@ -2,9 +2,9 @@ import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
2
2
  import { bindKeymapWithCommand, escape, insertRule } from '@atlaskit/editor-common/keymaps';
3
3
  import { keymap } from '@atlaskit/editor-prosemirror/keymap';
4
4
  import { insertHorizontalRule } from '../commands';
5
- export function keymapPlugin(featureFlags, editorAnalyticsAPI) {
5
+ export function keymapPlugin(editorAnalyticsAPI) {
6
6
  var list = {};
7
- bindKeymapWithCommand(insertRule.common, insertHorizontalRule(featureFlags, editorAnalyticsAPI)(INPUT_METHOD.SHORTCUT), list);
7
+ bindKeymapWithCommand(insertRule.common, insertHorizontalRule(editorAnalyticsAPI)(INPUT_METHOD.SHORTCUT), list);
8
8
  bindKeymapWithCommand(escape.common, function () {
9
9
  return true;
10
10
  }, list);
@@ -1,3 +1,3 @@
1
1
  import type { EditorAnalyticsAPI, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
2
- import type { Command, FeatureFlags } from '@atlaskit/editor-common/types';
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;
2
+ import type { Command } from '@atlaskit/editor-common/types';
3
+ export declare const insertHorizontalRule: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (inputMethod: INPUT_METHOD.QUICK_INSERT | INPUT_METHOD.TOOLBAR | INPUT_METHOD.INSERT_MENU | INPUT_METHOD.FORMATTING | INPUT_METHOD.SHORTCUT) => Command;
@@ -1,13 +1,9 @@
1
1
  import type { NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
2
2
  import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
3
- import type { FeatureFlagsPlugin } from '@atlaskit/editor-plugin-feature-flags';
4
3
  import { insertHorizontalRule } from './commands';
5
4
  export type RulePlugin = NextEditorPlugin<'rule', {
6
5
  pluginConfiguration: undefined;
7
- dependencies: [
8
- OptionalPlugin<FeatureFlagsPlugin>,
9
- OptionalPlugin<AnalyticsPlugin>
10
- ];
6
+ dependencies: [OptionalPlugin<AnalyticsPlugin>];
11
7
  actions: {
12
8
  insertHorizontalRule: ReturnType<typeof insertHorizontalRule>;
13
9
  };
@@ -1,9 +1,8 @@
1
1
  import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
2
2
  import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
3
3
  import type { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
4
- import type { FeatureFlags } from '@atlaskit/editor-common/types';
5
4
  import type { Schema } from '@atlaskit/editor-prosemirror/model';
6
5
  import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
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;
6
+ export declare const createHorizontalRule: (state: EditorState, 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;
7
+ export declare function inputRulePlugin(schema: Schema, editorAnalyticsAPI: EditorAnalyticsAPI | undefined): SafePlugin | undefined;
9
8
  export default inputRulePlugin;
@@ -1,5 +1,4 @@
1
1
  import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
2
2
  import type { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
3
- import type { FeatureFlags } from '@atlaskit/editor-common/types';
4
- export declare function keymapPlugin(featureFlags: FeatureFlags, editorAnalyticsAPI: EditorAnalyticsAPI | undefined): SafePlugin;
3
+ export declare function keymapPlugin(editorAnalyticsAPI: EditorAnalyticsAPI | undefined): SafePlugin;
5
4
  export default keymapPlugin;
@@ -1,3 +1,3 @@
1
1
  import type { EditorAnalyticsAPI, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
2
- import type { Command, FeatureFlags } from '@atlaskit/editor-common/types';
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;
2
+ import type { Command } from '@atlaskit/editor-common/types';
3
+ export declare const insertHorizontalRule: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (inputMethod: INPUT_METHOD.QUICK_INSERT | INPUT_METHOD.TOOLBAR | INPUT_METHOD.INSERT_MENU | INPUT_METHOD.FORMATTING | INPUT_METHOD.SHORTCUT) => Command;
@@ -1,11 +1,9 @@
1
1
  import type { NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
2
2
  import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
3
- import type { FeatureFlagsPlugin } from '@atlaskit/editor-plugin-feature-flags';
4
3
  import { insertHorizontalRule } from './commands';
5
4
  export type RulePlugin = NextEditorPlugin<'rule', {
6
5
  pluginConfiguration: undefined;
7
6
  dependencies: [
8
- OptionalPlugin<FeatureFlagsPlugin>,
9
7
  OptionalPlugin<AnalyticsPlugin>
10
8
  ];
11
9
  actions: {
@@ -1,9 +1,8 @@
1
1
  import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
2
2
  import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
3
3
  import type { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
4
- import type { FeatureFlags } from '@atlaskit/editor-common/types';
5
4
  import type { Schema } from '@atlaskit/editor-prosemirror/model';
6
5
  import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
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;
6
+ export declare const createHorizontalRule: (state: EditorState, 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;
7
+ export declare function inputRulePlugin(schema: Schema, editorAnalyticsAPI: EditorAnalyticsAPI | undefined): SafePlugin | undefined;
9
8
  export default inputRulePlugin;
@@ -1,5 +1,4 @@
1
1
  import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
2
2
  import type { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
3
- import type { FeatureFlags } from '@atlaskit/editor-common/types';
4
- export declare function keymapPlugin(featureFlags: FeatureFlags, editorAnalyticsAPI: EditorAnalyticsAPI | undefined): SafePlugin;
3
+ export declare function keymapPlugin(editorAnalyticsAPI: EditorAnalyticsAPI | undefined): SafePlugin;
5
4
  export default keymapPlugin;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-rule",
3
- "version": "0.1.19",
3
+ "version": "1.1.0",
4
4
  "description": "Rule plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -33,9 +33,8 @@
33
33
  },
34
34
  "dependencies": {
35
35
  "@atlaskit/adf-schema": "^35.5.1",
36
- "@atlaskit/editor-common": "^77.3.0",
37
- "@atlaskit/editor-plugin-analytics": "^0.4.0",
38
- "@atlaskit/editor-plugin-feature-flags": "^1.0.0",
36
+ "@atlaskit/editor-common": "^78.0.0",
37
+ "@atlaskit/editor-plugin-analytics": "^1.0.0",
39
38
  "@atlaskit/editor-prosemirror": "3.0.0",
40
39
  "@atlaskit/prosemirror-input-rules": "^2.4.0",
41
40
  "@babel/runtime": "^7.0.0"