update:过滤粘贴过程中 disableMark 中的mark节点
This commit is contained in:
parent
69ef914587
commit
aaa0332049
|
@ -43,6 +43,7 @@ export default class Paste {
|
||||||
const { inline } = this.engine;
|
const { inline } = this.engine;
|
||||||
const nodeApi = this.engine.node;
|
const nodeApi = this.engine.node;
|
||||||
const markApi = this.engine.mark;
|
const markApi = this.engine.mark;
|
||||||
|
const blockApi = this.engine.block;
|
||||||
|
|
||||||
$(fragment).traverse((node) => {
|
$(fragment).traverse((node) => {
|
||||||
let parent = node.parent();
|
let parent = node.parent();
|
||||||
|
@ -408,6 +409,21 @@ export default class Paste {
|
||||||
node = nodeClone;
|
node = nodeClone;
|
||||||
nodeParent = node.parent();
|
nodeParent = node.parent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (node.length > 0 && nodeApi.isMark(node, this.schema)) {
|
||||||
|
const block = blockApi.closest(node);
|
||||||
|
if (!block.equal(node)) {
|
||||||
|
const markPlugin = markApi.findPlugin(node);
|
||||||
|
const blockPlugin = blockApi.findPlugin(block);
|
||||||
|
if (
|
||||||
|
markPlugin &&
|
||||||
|
blockPlugin?.disableMark?.includes(markPlugin.name)
|
||||||
|
) {
|
||||||
|
nodeApi.unwrap(node);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
// mark 相同的嵌套
|
// mark 相同的嵌套
|
||||||
nodeParent = parent;
|
nodeParent = parent;
|
||||||
while (
|
while (
|
||||||
|
|
Loading…
Reference in New Issue