This commit is contained in:
Vanessa 2022-11-13 21:55:41 +08:00
parent 51fe9b1a99
commit 5b8958d0df
2 changed files with 11 additions and 4 deletions

View file

@ -16,7 +16,8 @@ export class InlineMemo extends ToolbarItem {
return;
}
const memoElement = hasClosestByAttribute(range.startContainer, "data-type", "inline-memo");
if (memoElement) {
if (memoElement && memoElement.textContent === range.toString()) {
// https://github.com/siyuan-note/siyuan/issues/6569
protyle.toolbar.showRender(protyle, memoElement);
return;
}

View file

@ -544,12 +544,18 @@ export class Toolbar {
currentNewNode.style.fontSize === nextNewNode.style.fontSize &&
currentNewNode.style.backgroundColor === nextNewNode.style.backgroundColor) {
// 合并相同的 node
if (currentNewNode.getAttribute("data-type").indexOf("inline-math") > -1) {
const currentType = currentNewNode.getAttribute("data-type")
if (currentType.indexOf("inline-math") > -1) {
// 数学公式合并 data-content https://github.com/siyuan-note/siyuan/issues/6028
nextNewNode.setAttribute("data-content", currentNewNode.getAttribute("data-content") + nextNewNode.getAttribute("data-content"));
} else if (currentNewNode.getAttribute("data-type").indexOf("block-ref") === -1) {
// 引用不合并内容 https://ld246.com/article/1664454663564
} else if (currentType.indexOf("block-ref") === -1) {
// 引用不合并内容 https://ld246.com/article/1664454663564
nextNewNode.innerHTML = currentNewNode.innerHTML + nextNewNode.innerHTML;
// 如果为备注时,合并备注内容
if (currentType.indexOf("inline-memo") > -1) {
nextNewNode.setAttribute("data-inline-memo-content", (currentNewNode.getAttribute("data-inline-memo-content") || "") +
(nextNewNode.getAttribute("data-inline-memo-content") || ""));
}
}
newNodes.splice(i, 1);
i--;