@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.
- package/dist/tiptap-editor.mjs +5 -2
- package/package.json +1 -1
- package/src/warnings.js +10 -7
package/dist/tiptap-editor.mjs
CHANGED
|
@@ -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.
|
|
21974
|
-
|
|
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
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
|
|
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
|
-
|
|
72
|
-
|
|
73
|
-
|
|
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
|
-
}
|
|
77
|
+
});
|
|
78
|
+
if (!errorHasOffsetData) {
|
|
76
79
|
record(indexOfMatchedWord, indexOfMatchedWord + m[0].length, m[0]);
|
|
77
80
|
}
|
|
78
81
|
}
|