@atlaskit/prosemirror-input-rules 3.6.4 → 3.6.6

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,19 @@
1
1
  # @atlaskit/prosemirror-input-rules
2
2
 
3
+ ## 3.6.6
4
+
5
+ ### Patch Changes
6
+
7
+ - [`289a5bde2611b`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/289a5bde2611b) -
8
+ [ux] [EDITOR-3750] fix unwanted autoformatting by limiting checks to rules with backwards matches
9
+
10
+ ## 3.6.5
11
+
12
+ ### Patch Changes
13
+
14
+ - [`55920a92e882a`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/55920a92e882a) -
15
+ tsignores added for help-center local consumpton removed
16
+
3
17
  ## 3.6.4
4
18
 
5
19
  ### Patch Changes
@@ -52,8 +52,11 @@ var createInputEventHandler = exports.createInputEventHandler = function createI
52
52
  }
53
53
  var textAfter = text + $from.parent.textBetween($from.parentOffset, Math.min($from.parent.content.size, $from.parentOffset + _constants.MAX_REGEX_MATCH), undefined, _constants.leafNodeReplacementCharacter);
54
54
  isBackwardMatch = true;
55
+ var backwardMatchRules = rules.filter(function (rule) {
56
+ return rule.allowsBackwardMatch;
57
+ });
55
58
  result = findMatchOnRules({
56
- rules: rules,
59
+ rules: backwardMatchRules,
57
60
  textToMatch: textAfter,
58
61
  from: from,
59
62
  to: to,
@@ -27,7 +27,6 @@ function createInputRulePlugin(pluginName, rules) {
27
27
  init: function init() {
28
28
  return null;
29
29
  },
30
- // @ts-ignore - Workaround for help-center local consumption
31
30
  apply: function apply(tr, prev) {
32
31
  var stored = tr.getMeta(pluginKey);
33
32
  if (stored) {
@@ -36,9 +35,7 @@ function createInputRulePlugin(pluginName, rules) {
36
35
  return tr.selectionSet || tr.docChanged ? null : prev;
37
36
  }
38
37
  },
39
- // @ts-ignore - Workaround for help-center local consumption
40
38
  appendTransaction: function appendTransaction(transactions, oldState, newState) {
41
- // @ts-ignore - Workaround for help-center local consumption
42
39
  var transactionWithInputRuleMeta = transactions.find(function (tr) {
43
40
  return tr.getMeta(pluginKey);
44
41
  });
@@ -70,7 +67,6 @@ function createInputRulePlugin(pluginName, rules) {
70
67
  return tr;
71
68
  },
72
69
  props: {
73
- // @ts-ignore - Workaround for help-center local consumption
74
70
  handleTextInput: function handleTextInput(view, from, to, text) {
75
71
  return inputEvent({
76
72
  view: view,
@@ -80,7 +76,6 @@ function createInputRulePlugin(pluginName, rules) {
80
76
  });
81
77
  },
82
78
  handleDOMEvents: {
83
- // @ts-ignore - Workaround for help-center local consumption
84
79
  blur: function blur(view) {
85
80
  if (!(options !== null && options !== void 0 && options.checkOnBlur)) {
86
81
  return false;
@@ -101,7 +96,6 @@ function createInputRulePlugin(pluginName, rules) {
101
96
  }
102
97
  return false;
103
98
  },
104
- // @ts-ignore - Workaround for help-center local consumption
105
99
  compositionend: function compositionend(view) {
106
100
  setTimeout(function () {
107
101
  var selection = view.state.selection;
@@ -43,8 +43,9 @@ export const createInputEventHandler = ({
43
43
  }
44
44
  const textAfter = text + $from.parent.textBetween($from.parentOffset, Math.min($from.parent.content.size, $from.parentOffset + MAX_REGEX_MATCH), undefined, leafNodeReplacementCharacter);
45
45
  isBackwardMatch = true;
46
+ const backwardMatchRules = rules.filter(rule => rule.allowsBackwardMatch);
46
47
  result = findMatchOnRules({
47
- rules,
48
+ rules: backwardMatchRules,
48
49
  textToMatch: textAfter,
49
50
  from,
50
51
  to,
@@ -20,7 +20,6 @@ export function createInputRulePlugin(pluginName, rules, options = {}) {
20
20
  init() {
21
21
  return null;
22
22
  },
23
- // @ts-ignore - Workaround for help-center local consumption
24
23
  apply(tr, prev) {
25
24
  const stored = tr.getMeta(pluginKey);
26
25
  if (stored) {
@@ -29,9 +28,7 @@ export function createInputRulePlugin(pluginName, rules, options = {}) {
29
28
  return tr.selectionSet || tr.docChanged ? null : prev;
30
29
  }
31
30
  },
32
- // @ts-ignore - Workaround for help-center local consumption
33
31
  appendTransaction: (transactions, oldState, newState) => {
34
- // @ts-ignore - Workaround for help-center local consumption
35
32
  const transactionWithInputRuleMeta = transactions.find(tr => tr.getMeta(pluginKey));
36
33
  const pluginState = transactionWithInputRuleMeta === null || transactionWithInputRuleMeta === void 0 ? void 0 : transactionWithInputRuleMeta.getMeta(pluginKey);
37
34
  if (!pluginState || !transactionWithInputRuleMeta) {
@@ -65,7 +62,6 @@ export function createInputRulePlugin(pluginName, rules, options = {}) {
65
62
  return tr;
66
63
  },
67
64
  props: {
68
- // @ts-ignore - Workaround for help-center local consumption
69
65
  handleTextInput(view, from, to, text) {
70
66
  return inputEvent({
71
67
  view,
@@ -75,7 +71,6 @@ export function createInputRulePlugin(pluginName, rules, options = {}) {
75
71
  });
76
72
  },
77
73
  handleDOMEvents: {
78
- // @ts-ignore - Workaround for help-center local consumption
79
74
  blur: view => {
80
75
  if (!(options !== null && options !== void 0 && options.checkOnBlur)) {
81
76
  return false;
@@ -98,7 +93,6 @@ export function createInputRulePlugin(pluginName, rules, options = {}) {
98
93
  }
99
94
  return false;
100
95
  },
101
- // @ts-ignore - Workaround for help-center local consumption
102
96
  compositionend: view => {
103
97
  setTimeout(() => {
104
98
  const selection = view.state.selection;
@@ -45,8 +45,11 @@ export var createInputEventHandler = function createInputEventHandler(_ref) {
45
45
  }
46
46
  var textAfter = text + $from.parent.textBetween($from.parentOffset, Math.min($from.parent.content.size, $from.parentOffset + MAX_REGEX_MATCH), undefined, leafNodeReplacementCharacter);
47
47
  isBackwardMatch = true;
48
+ var backwardMatchRules = rules.filter(function (rule) {
49
+ return rule.allowsBackwardMatch;
50
+ });
48
51
  result = findMatchOnRules({
49
- rules: rules,
52
+ rules: backwardMatchRules,
50
53
  textToMatch: textAfter,
51
54
  from: from,
52
55
  to: to,
@@ -21,7 +21,6 @@ export function createInputRulePlugin(pluginName, rules) {
21
21
  init: function init() {
22
22
  return null;
23
23
  },
24
- // @ts-ignore - Workaround for help-center local consumption
25
24
  apply: function apply(tr, prev) {
26
25
  var stored = tr.getMeta(pluginKey);
27
26
  if (stored) {
@@ -30,9 +29,7 @@ export function createInputRulePlugin(pluginName, rules) {
30
29
  return tr.selectionSet || tr.docChanged ? null : prev;
31
30
  }
32
31
  },
33
- // @ts-ignore - Workaround for help-center local consumption
34
32
  appendTransaction: function appendTransaction(transactions, oldState, newState) {
35
- // @ts-ignore - Workaround for help-center local consumption
36
33
  var transactionWithInputRuleMeta = transactions.find(function (tr) {
37
34
  return tr.getMeta(pluginKey);
38
35
  });
@@ -64,7 +61,6 @@ export function createInputRulePlugin(pluginName, rules) {
64
61
  return tr;
65
62
  },
66
63
  props: {
67
- // @ts-ignore - Workaround for help-center local consumption
68
64
  handleTextInput: function handleTextInput(view, from, to, text) {
69
65
  return inputEvent({
70
66
  view: view,
@@ -74,7 +70,6 @@ export function createInputRulePlugin(pluginName, rules) {
74
70
  });
75
71
  },
76
72
  handleDOMEvents: {
77
- // @ts-ignore - Workaround for help-center local consumption
78
73
  blur: function blur(view) {
79
74
  if (!(options !== null && options !== void 0 && options.checkOnBlur)) {
80
75
  return false;
@@ -95,7 +90,6 @@ export function createInputRulePlugin(pluginName, rules) {
95
90
  }
96
91
  return false;
97
92
  },
98
- // @ts-ignore - Workaround for help-center local consumption
99
93
  compositionend: function compositionend(view) {
100
94
  setTimeout(function () {
101
95
  var selection = view.state.selection;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/prosemirror-input-rules",
3
- "version": "3.6.4",
3
+ "version": "3.6.6",
4
4
  "description": "A package that contains helpers to create autoformatting rules for ProseMirror",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -29,11 +29,11 @@
29
29
  "dependencies": {
30
30
  "@atlaskit/editor-prosemirror": "7.0.0",
31
31
  "@atlaskit/prosemirror-history": "^0.2.0",
32
- "@atlaskit/tmp-editor-statsig": "^14.0.0",
32
+ "@atlaskit/tmp-editor-statsig": "^14.7.0",
33
33
  "@babel/runtime": "^7.0.0"
34
34
  },
35
35
  "devDependencies": {
36
- "@atlaskit/editor-common": "^110.36.0"
36
+ "@atlaskit/editor-common": "^110.39.0"
37
37
  },
38
38
  "techstack": {
39
39
  "@atlassian/frontend": {