Fix formatting inside selection not being removed

Regression introduced in #2017 while fixing another bug.

Closes #2072
This commit is contained in:
Damien Elmes 2022-12-03 21:41:54 +10:00
parent 509e0a9811
commit 1a444f30e9

View File

@ -359,7 +359,13 @@ export class Surrounder<T = unknown> {
return false;
}
const isSurrounded = isSurroundedInner(
// This is confusing: when nothing is selected, we only
// include currently-active buttons, as otherwise inactive
// buttons get toggled on. But when something is selected,
// we include everything, since we want to remove formatting
// that may be in part of the selection, but not at the start/end.
const isSurrounded = !range.collapsed || isSurroundedInner(
range,
base,
boolMatcher(format),