This commit is contained in:
Zef Hemel
2023-07-02 13:41:40 +02:00
parent 0c006bb84c
commit 75aa3171ff
2 changed files with 11 additions and 1 deletions
+6
View File
@@ -5,6 +5,7 @@ interface WrapElement {
selector: string;
class: string;
nesting?: boolean;
disableSpellCheck?: boolean;
}
export function lineWrapper(wrapElements: WrapElement[]) {
@@ -15,6 +16,10 @@ export function lineWrapper(wrapElements: WrapElement[]) {
syntaxTree(state).iterate({
enter: ({ type, from, to }) => {
for (const wrapElement of wrapElements) {
const spellCheckAttributes = wrapElement.disableSpellCheck
? { attributes: { spellcheck: "false" } }
: {};
if (type.name == wrapElement.selector) {
if (wrapElement.nesting) {
elementStack.push(type.name);
@@ -29,6 +34,7 @@ export function lineWrapper(wrapElements: WrapElement[]) {
widgets.push(
Decoration.line({
class: cls,
...spellCheckAttributes,
}).range(doc.lineAt(idx).from),
);
idx += line.length + 1;