mirror of
https://github.com/fastmail/Squire.git
synced 2025-01-03 05:00:13 -05:00
parent
34952705f2
commit
aa29157969
1 changed files with 13 additions and 1 deletions
|
@ -2060,7 +2060,7 @@ class Squire {
|
||||||
return this;
|
return this;
|
||||||
// Break blockquote
|
// Break blockquote
|
||||||
} else if (getNearest(block, root, 'BLOCKQUOTE')) {
|
} else if (getNearest(block, root, 'BLOCKQUOTE')) {
|
||||||
this.removeQuote(range);
|
this.replaceWithBlankLine(range);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2521,6 +2521,18 @@ class Squire {
|
||||||
}
|
}
|
||||||
|
|
||||||
removeQuote(range?: Range): Squire {
|
removeQuote(range?: Range): Squire {
|
||||||
|
this.modifyBlocks((frag) => {
|
||||||
|
Array.from(frag.querySelectorAll('blockquote')).forEach(
|
||||||
|
(el: Node) => {
|
||||||
|
replaceWith(el, empty(el));
|
||||||
|
},
|
||||||
|
);
|
||||||
|
return frag;
|
||||||
|
}, range);
|
||||||
|
return this.focus();
|
||||||
|
}
|
||||||
|
|
||||||
|
replaceWithBlankLine(range?: Range): Squire {
|
||||||
this.modifyBlocks(
|
this.modifyBlocks(
|
||||||
(/* frag */) =>
|
(/* frag */) =>
|
||||||
this.createDefaultBlock([
|
this.createDefaultBlock([
|
||||||
|
|
Loading…
Reference in a new issue