Fixes #421
parent
0c006bb84c
commit
75aa3171ff
|
@ -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;
|
||||
|
|
|
@ -916,7 +916,11 @@ export class Editor {
|
|||
{ selector: "Blockquote", class: "sb-line-blockquote" },
|
||||
{ selector: "Task", class: "sb-line-task" },
|
||||
{ selector: "CodeBlock", class: "sb-line-code" },
|
||||
{ selector: "FencedCode", class: "sb-line-fenced-code" },
|
||||
{
|
||||
selector: "FencedCode",
|
||||
class: "sb-line-fenced-code",
|
||||
disableSpellCheck: true,
|
||||
},
|
||||
{ selector: "Comment", class: "sb-line-comment" },
|
||||
{ selector: "BulletList", class: "sb-line-ul" },
|
||||
{ selector: "OrderedList", class: "sb-line-ol" },
|
||||
|
|
Loading…
Reference in New Issue