This commit is contained in:
Vanessa 2022-10-10 10:57:39 +08:00
parent b2c34bd527
commit 395223d701
3 changed files with 14 additions and 10 deletions

4
app/pnpm-lock.yaml generated
View file

@ -1906,10 +1906,10 @@ packages:
resolution: {integrity: sha512-m0+M53+HYMzqKxwNQZT143K7WwXEGUy9LY31l8dJphXx2P/FQod615mVbxHyqbDCG4J5bHdWm21qZ0e2DVY6CQ==}
engines: {node: '>=14.0.0'}
dependencies:
7zip-bin: 5.1.1
'@develar/schema-utils': 2.6.5
'@electron/universal': 1.2.1
'@malept/flatpak-bundler': 0.4.0
7zip-bin: 5.1.1
async-exit-hook: 2.0.1
bluebird-lst: 1.0.9
builder-util: 23.3.3
@ -2193,9 +2193,9 @@ packages:
/builder-util/23.3.3:
resolution: {integrity: sha512-MJZlUiq2PY5hjYv9+XNaoYdsITqvLgRDoHSFg/4nzpInbNxNjLQOolL04Zsyp+hgfcbFvMC4h0KkR1CMPHLWbA==}
dependencies:
7zip-bin: 5.1.1
'@types/debug': 4.1.7
'@types/fs-extra': 9.0.13
7zip-bin: 5.1.1
app-builder-bin: 4.0.0
bluebird-lst: 1.0.9
builder-util-runtime: 9.0.3

View file

@ -39,7 +39,7 @@ const dragSb = (protyle: IProtyle, sourceElements: Element[], targetElement: Ele
action: "move",
id: targetElement.getAttribute("data-node-id"),
previousID: targetElement.previousElementSibling?.getAttribute("data-node-id"),
parentID: targetElement.parentElement?.getAttribute("data-node-id") || protyle.block.parentID
parentID: targetElement.parentElement?.getAttribute("data-node-id") || protyle.block.parentID || protyle.block.rootID
}];
let topSourceElement: Element;
let oldSourceParentElement = sourceElements[0].parentElement;
@ -50,7 +50,7 @@ const dragSb = (protyle: IProtyle, sourceElements: Element[], targetElement: Ele
data: sbElement.outerHTML,
id: sbElement.getAttribute("data-node-id"),
previousID: sbElement.previousElementSibling?.getAttribute("data-node-id"),
parentID: sbElement.parentElement.getAttribute("data-node-id") || protyle.block.parentID
parentID: sbElement.parentElement.getAttribute("data-node-id") || protyle.block.parentID || protyle.block.rootID
}];
if (newSourceElement) {
sbElement.insertAdjacentElement("afterbegin", targetElement);
@ -74,7 +74,7 @@ const dragSb = (protyle: IProtyle, sourceElements: Element[], targetElement: Ele
data: newSourceElement.outerHTML,
id: newSourceElement.getAttribute("data-node-id"),
previousID: newSourceElement.previousElementSibling?.getAttribute("data-node-id"),
parentID: newSourceElement.parentElement?.getAttribute("data-node-id") || protyle.block.parentID
parentID: newSourceElement.parentElement?.getAttribute("data-node-id") || protyle.block.parentID || protyle.block.rootID
});
}
sourceElements.reverse().forEach((item, index) => {
@ -197,7 +197,7 @@ const dragSb = (protyle: IProtyle, sourceElements: Element[], targetElement: Ele
data: topSourceElement.outerHTML,
id: topSourceElement.getAttribute("data-node-id"),
previousID: topSourceElement.previousElementSibling?.getAttribute("data-node-id"),
parentID: topSourceElement.parentElement?.getAttribute("data-node-id") || protyle.block.parentID
parentID: topSourceElement.parentElement?.getAttribute("data-node-id") || protyle.block.parentID || protyle.block.rootID
});
if (!isSameDoc) {
// 打开两个相同的文档
@ -340,7 +340,7 @@ const dragSame = (protyle: IProtyle, sourceElements: Element[], targetElement: E
data: newSourceElement.outerHTML,
id: newSourceElement.getAttribute("data-node-id"),
previousID: newSourceElement.previousElementSibling?.getAttribute("data-node-id"),
parentID: newSourceElement.parentElement?.getAttribute("data-node-id") || protyle.block.parentID
parentID: newSourceElement.parentElement?.getAttribute("data-node-id") || protyle.block.parentID || protyle.block.rootID
});
sourceElements.reverse().forEach((item, index) => {
if (index === sourceElements.length - 1) {
@ -400,7 +400,7 @@ const dragSame = (protyle: IProtyle, sourceElements: Element[], targetElement: E
action: "move",
id: item.getAttribute("data-node-id"),
previousID: item.previousElementSibling?.getAttribute("data-node-id"),
parentID: item.parentElement?.getAttribute("data-node-id") || protyle.block.parentID
parentID: item.parentElement?.getAttribute("data-node-id") || protyle.block.parentID || protyle.block.rootID
});
});
undoOperations.reverse();
@ -475,7 +475,7 @@ const dragSame = (protyle: IProtyle, sourceElements: Element[], targetElement: E
data: topSourceElement.outerHTML,
id: topSourceElement.getAttribute("data-node-id"),
previousID: topSourceElement.previousElementSibling?.getAttribute("data-node-id"),
parentID: topSourceElement.parentElement?.getAttribute("data-node-id") || protyle.block.parentID
parentID: topSourceElement.parentElement?.getAttribute("data-node-id") || protyle.block.parentID || protyle.block.rootID
});
oldSourceParentElement = topSourceElement.parentElement;
topSourceElement.remove();
@ -618,6 +618,10 @@ export const dropEvent = (protyle: IProtyle, editorElement: HTMLElement) => {
});
sourceElements.forEach(item => {
item.classList.remove("protyle-wysiwyg--select", "protyle-wysiwyg--hl");
// 反链提及有高亮,如果拖拽到正文的话,应移除
item.querySelectorAll('[data-type="search-mark"]').forEach(markItem => {
markItem.outerHTML = markItem.innerHTML;
})
});
if (event.altKey) {
focusByRange(document.caretRangeFromPoint(event.clientX, event.clientY));

View file

@ -707,7 +707,7 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {
}
// 行首转义符前删除 https://github.com/siyuan-note/siyuan/issues/6092
if (range.startOffset === 0 &&
previousSibling && previousSibling.parentElement.getAttribute("data-type").indexOf("backslash") > -1 &&
previousSibling && previousSibling.parentElement.getAttribute("data-type")?.indexOf("backslash") > -1 &&
previousSibling.nodeType !== 3 && (previousSibling as HTMLElement).outerHTML === "<span>\\</span>" &&
!hasPreviousSibling(previousSibling)) {
range.setStartBefore(previousSibling.parentElement);