mirror of https://github.com/fantasticit/think.git
tiptap: just return text for list node
This commit is contained in:
parent
a9f3de8ff0
commit
de824badee
|
@ -67,17 +67,26 @@ export const Clipboard = Extension.create<IClipboardOptions>({
|
||||||
const json = slice.content.toJSON();
|
const json = slice.content.toJSON();
|
||||||
const isSelectAll = slice.openStart === slice.openEnd && slice.openEnd === 0;
|
const isSelectAll = slice.openStart === slice.openEnd && slice.openEnd === 0;
|
||||||
|
|
||||||
|
if (Array.isArray(json) && !isSelectAll) {
|
||||||
|
const type = json[0].type;
|
||||||
|
|
||||||
|
// 列表项返回文字内容
|
||||||
|
if (['bulletList', 'orderedList', 'taskList'].includes(type)) {
|
||||||
|
return slice.content.textBetween(0, slice.content.size, '\n\n');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (typeof json === 'object' || isSelectAll) {
|
if (typeof json === 'object' || isSelectAll) {
|
||||||
return extensionThis.options.prosemirrorToMarkdown({
|
return extensionThis.options.prosemirrorToMarkdown({
|
||||||
content: slice.content,
|
content: slice.content,
|
||||||
});
|
});
|
||||||
} else {
|
}
|
||||||
|
|
||||||
const isText = isPureText(json) && !isSelectAll;
|
const isText = isPureText(json) && !isSelectAll;
|
||||||
|
|
||||||
if (isText) {
|
if (isText) {
|
||||||
return slice.content.textBetween(0, slice.content.size, '\n\n');
|
return slice.content.textBetween(0, slice.content.size, '\n\n');
|
||||||
}
|
}
|
||||||
|
|
||||||
const doc = slice.content;
|
const doc = slice.content;
|
||||||
|
|
||||||
if (!doc) {
|
if (!doc) {
|
||||||
|
@ -88,7 +97,6 @@ export const Clipboard = Extension.create<IClipboardOptions>({
|
||||||
content: doc,
|
content: doc,
|
||||||
});
|
});
|
||||||
return content;
|
return content;
|
||||||
}
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
|
|
Loading…
Reference in New Issue