@mirus/tiptap-editor 2.1.2 → 2.1.4

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.length && y.offset >= 0 && (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.4",
4
4
  "description": "custom setup for the tiptap editor",
5
5
  "repository": "https://github.com/mirusresearch/tiptap-editor",
6
6
  "bugs": {
package/src/App.vue CHANGED
@@ -27,7 +27,7 @@ export default {
27
27
  value: 'red',
28
28
  message: 'did you mean...',
29
29
  options: ['read', 'reed'], // optional
30
- offset: 55, // identifies which instance of the word is problematic
30
+ offset: 54, // identifies which instance of the word is problematic
31
31
  length: 3, // length of the word
32
32
  },
33
33
  {
@@ -40,7 +40,7 @@ export default {
40
40
  isWord: false,
41
41
  message: 'you sure you wanted a tag?',
42
42
  overrideClass: 'underline-blue', // optional
43
- offset: 10,
43
+ offset: 9,
44
44
  length: 8,
45
45
  },
46
46
  {
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.length && word.offset >= 0) {
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
  }