fix: 格式刷无法删除已有样式

This commit is contained in:
yanmao 2021-12-08 12:53:52 +08:00
parent 6270f0daba
commit b975eda3dd
1 changed files with 4 additions and 2 deletions

View File

@ -15,9 +15,11 @@ export default class extends Plugin<Options> {
const range = change.range.get();
const blocks = blockApi.getBlocks(range);
// 没有mark和inline节点的时候才对block节点移除格式
if (change.marks.length > 0) {
const marks = mark.findMarks(range);
const inlines = inline.findInlines(range);
if (marks.length > 0) {
mark.unwrap();
} else if (change.inlines.length > 0) {
} else if (inlines.length > 0) {
inline.unwrap();
} else {
const selection = range.createSelection('removeformat');