Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:art: fix https://github.com/siyuan-note/siyuan/issues/6025

Vanessa8593485fc866
diff --git a/app/src/protyle/wysiwyg/index.ts b/app/src/protyle/wysiwyg/index.ts
index 7a4441b215..0a49d1cf35 100644
--- a/app/src/protyle/wysiwyg/index.ts
+++ b/app/src/protyle/wysiwyg/index.ts
@@ -1014,6 +1014,24 @@ export class WYSIWYG {
tempElement.append(range.startContainer.parentElement);
} else if (selectImgElement) {
tempElement.append(selectImgElement);
+ } else if (range.startContainer.nodeType === 3 && range.startContainer.parentElement.tagName === "SPAN" &&
+ range.startContainer.parentElement.isSameNode(range.endContainer.parentElement)) {
+ // 剪切粗体等字体中的一部分
+ const spanElement = range.startContainer.parentElement
+ const attributes = spanElement.attributes;
+ const newSpanElement = document.createElement("span");
+ for (let i = 0; i < attributes.length; i++) {
+ newSpanElement.setAttribute(attributes[i].name, attributes[i].value);
+ }
+ if (spanElement.getAttribute("data-type").indexOf("block-ref") > -1 &&
+ spanElement.getAttribute("data-subtype") === "d") {
+ // 引用被剪切后需变为静态锚文本
+ newSpanElement.setAttribute("data-subtype", "s");
+ spanElement.setAttribute("data-subtype", "s");
+ }
+ newSpanElement.textContent = range.toString();
+ range.deleteContents();
+ tempElement.append(newSpanElement);
} else {
if (range.cloneContents().querySelectorAll("td, th").length > 0) {
// 表格内多格子 cut https://github.com/siyuan-note/insider/issues/564