@mirus/tiptap-editor 2.1.2 → 2.1.3

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.
@@ -21970,8 +21970,11 @@ function Cw(t, e, n, r, i) {
21970
21970
  if (f.isText) {
21971
21971
  let d;
21972
21972
  for (; d = a.exec(f.text); ) {
21973
- const h = o.find((v) => v.value === d[0]), m = p + d.index;
21974
- h.offset && h.length ? m - 1 == h.offset && u(m, m + d[0].length, d[0]) : u(m, m + d[0].length, d[0]);
21973
+ const h = o.filter((y) => y.value === d[0]), m = p + d.index;
21974
+ let v = !1;
21975
+ h.forEach((y) => {
21976
+ y.offset && y.length && (v = !0, m - 1 === y.offset && u(m, m + d[0].length, d[0]));
21977
+ }), v || u(m, m + d[0].length, d[0]);
21975
21978
  }
21976
21979
  }
21977
21980
  }), { highlights: l, on: c };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mirus/tiptap-editor",
3
- "version": "2.1.2",
3
+ "version": "2.1.3",
4
4
  "description": "custom setup for the tiptap editor",
5
5
  "repository": "https://github.com/mirusresearch/tiptap-editor",
6
6
  "bugs": {
package/src/warnings.js CHANGED
@@ -64,15 +64,18 @@ function lint(doc, position, prev, getErrorWords, getInitialCharacterCount) {
64
64
  // Scan text nodes for bad words
65
65
  let m;
66
66
  while ((m = badWordsRegex.exec(node.text))) {
67
- const originalErrorWord = words.find((word) => word.value === m[0]);
68
-
69
- // highlight specific instance if the error has offset data
67
+ const matchingErrorWords = words.filter((word) => word.value === m[0]);
70
68
  const indexOfMatchedWord = pos + m.index;
71
- if (originalErrorWord.offset && originalErrorWord.length) {
72
- if (indexOfMatchedWord - 1 == originalErrorWord.offset) {
73
- record(indexOfMatchedWord, indexOfMatchedWord + m[0].length, m[0]);
69
+ let errorHasOffsetData = false;
70
+ matchingErrorWords.forEach((word) => {
71
+ if (word.offset && word.length) {
72
+ errorHasOffsetData = true;
73
+ if (indexOfMatchedWord - 1 === word.offset) {
74
+ record(indexOfMatchedWord, indexOfMatchedWord + m[0].length, m[0]);
75
+ }
74
76
  }
75
- } else {
77
+ });
78
+ if (!errorHasOffsetData) {
76
79
  record(indexOfMatchedWord, indexOfMatchedWord + m[0].length, m[0]);
77
80
  }
78
81
  }