mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-21 00:50:13 +01:00
This commit is contained in:
parent
b2c34bd527
commit
395223d701
3 changed files with 14 additions and 10 deletions
4
app/pnpm-lock.yaml
generated
4
app/pnpm-lock.yaml
generated
|
|
@ -1906,10 +1906,10 @@ packages:
|
||||||
resolution: {integrity: sha512-m0+M53+HYMzqKxwNQZT143K7WwXEGUy9LY31l8dJphXx2P/FQod615mVbxHyqbDCG4J5bHdWm21qZ0e2DVY6CQ==}
|
resolution: {integrity: sha512-m0+M53+HYMzqKxwNQZT143K7WwXEGUy9LY31l8dJphXx2P/FQod615mVbxHyqbDCG4J5bHdWm21qZ0e2DVY6CQ==}
|
||||||
engines: {node: '>=14.0.0'}
|
engines: {node: '>=14.0.0'}
|
||||||
dependencies:
|
dependencies:
|
||||||
7zip-bin: 5.1.1
|
|
||||||
'@develar/schema-utils': 2.6.5
|
'@develar/schema-utils': 2.6.5
|
||||||
'@electron/universal': 1.2.1
|
'@electron/universal': 1.2.1
|
||||||
'@malept/flatpak-bundler': 0.4.0
|
'@malept/flatpak-bundler': 0.4.0
|
||||||
|
7zip-bin: 5.1.1
|
||||||
async-exit-hook: 2.0.1
|
async-exit-hook: 2.0.1
|
||||||
bluebird-lst: 1.0.9
|
bluebird-lst: 1.0.9
|
||||||
builder-util: 23.3.3
|
builder-util: 23.3.3
|
||||||
|
|
@ -2193,9 +2193,9 @@ packages:
|
||||||
/builder-util/23.3.3:
|
/builder-util/23.3.3:
|
||||||
resolution: {integrity: sha512-MJZlUiq2PY5hjYv9+XNaoYdsITqvLgRDoHSFg/4nzpInbNxNjLQOolL04Zsyp+hgfcbFvMC4h0KkR1CMPHLWbA==}
|
resolution: {integrity: sha512-MJZlUiq2PY5hjYv9+XNaoYdsITqvLgRDoHSFg/4nzpInbNxNjLQOolL04Zsyp+hgfcbFvMC4h0KkR1CMPHLWbA==}
|
||||||
dependencies:
|
dependencies:
|
||||||
7zip-bin: 5.1.1
|
|
||||||
'@types/debug': 4.1.7
|
'@types/debug': 4.1.7
|
||||||
'@types/fs-extra': 9.0.13
|
'@types/fs-extra': 9.0.13
|
||||||
|
7zip-bin: 5.1.1
|
||||||
app-builder-bin: 4.0.0
|
app-builder-bin: 4.0.0
|
||||||
bluebird-lst: 1.0.9
|
bluebird-lst: 1.0.9
|
||||||
builder-util-runtime: 9.0.3
|
builder-util-runtime: 9.0.3
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,7 @@ const dragSb = (protyle: IProtyle, sourceElements: Element[], targetElement: Ele
|
||||||
action: "move",
|
action: "move",
|
||||||
id: targetElement.getAttribute("data-node-id"),
|
id: targetElement.getAttribute("data-node-id"),
|
||||||
previousID: targetElement.previousElementSibling?.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 topSourceElement: Element;
|
||||||
let oldSourceParentElement = sourceElements[0].parentElement;
|
let oldSourceParentElement = sourceElements[0].parentElement;
|
||||||
|
|
@ -50,7 +50,7 @@ const dragSb = (protyle: IProtyle, sourceElements: Element[], targetElement: Ele
|
||||||
data: sbElement.outerHTML,
|
data: sbElement.outerHTML,
|
||||||
id: sbElement.getAttribute("data-node-id"),
|
id: sbElement.getAttribute("data-node-id"),
|
||||||
previousID: sbElement.previousElementSibling?.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) {
|
if (newSourceElement) {
|
||||||
sbElement.insertAdjacentElement("afterbegin", targetElement);
|
sbElement.insertAdjacentElement("afterbegin", targetElement);
|
||||||
|
|
@ -74,7 +74,7 @@ const dragSb = (protyle: IProtyle, sourceElements: Element[], targetElement: Ele
|
||||||
data: newSourceElement.outerHTML,
|
data: newSourceElement.outerHTML,
|
||||||
id: newSourceElement.getAttribute("data-node-id"),
|
id: newSourceElement.getAttribute("data-node-id"),
|
||||||
previousID: newSourceElement.previousElementSibling?.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) => {
|
sourceElements.reverse().forEach((item, index) => {
|
||||||
|
|
@ -197,7 +197,7 @@ const dragSb = (protyle: IProtyle, sourceElements: Element[], targetElement: Ele
|
||||||
data: topSourceElement.outerHTML,
|
data: topSourceElement.outerHTML,
|
||||||
id: topSourceElement.getAttribute("data-node-id"),
|
id: topSourceElement.getAttribute("data-node-id"),
|
||||||
previousID: topSourceElement.previousElementSibling?.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) {
|
if (!isSameDoc) {
|
||||||
// 打开两个相同的文档
|
// 打开两个相同的文档
|
||||||
|
|
@ -340,7 +340,7 @@ const dragSame = (protyle: IProtyle, sourceElements: Element[], targetElement: E
|
||||||
data: newSourceElement.outerHTML,
|
data: newSourceElement.outerHTML,
|
||||||
id: newSourceElement.getAttribute("data-node-id"),
|
id: newSourceElement.getAttribute("data-node-id"),
|
||||||
previousID: newSourceElement.previousElementSibling?.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) => {
|
sourceElements.reverse().forEach((item, index) => {
|
||||||
if (index === sourceElements.length - 1) {
|
if (index === sourceElements.length - 1) {
|
||||||
|
|
@ -400,7 +400,7 @@ const dragSame = (protyle: IProtyle, sourceElements: Element[], targetElement: E
|
||||||
action: "move",
|
action: "move",
|
||||||
id: item.getAttribute("data-node-id"),
|
id: item.getAttribute("data-node-id"),
|
||||||
previousID: item.previousElementSibling?.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();
|
undoOperations.reverse();
|
||||||
|
|
@ -475,7 +475,7 @@ const dragSame = (protyle: IProtyle, sourceElements: Element[], targetElement: E
|
||||||
data: topSourceElement.outerHTML,
|
data: topSourceElement.outerHTML,
|
||||||
id: topSourceElement.getAttribute("data-node-id"),
|
id: topSourceElement.getAttribute("data-node-id"),
|
||||||
previousID: topSourceElement.previousElementSibling?.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;
|
oldSourceParentElement = topSourceElement.parentElement;
|
||||||
topSourceElement.remove();
|
topSourceElement.remove();
|
||||||
|
|
@ -618,6 +618,10 @@ export const dropEvent = (protyle: IProtyle, editorElement: HTMLElement) => {
|
||||||
});
|
});
|
||||||
sourceElements.forEach(item => {
|
sourceElements.forEach(item => {
|
||||||
item.classList.remove("protyle-wysiwyg--select", "protyle-wysiwyg--hl");
|
item.classList.remove("protyle-wysiwyg--select", "protyle-wysiwyg--hl");
|
||||||
|
// 反链提及有高亮,如果拖拽到正文的话,应移除
|
||||||
|
item.querySelectorAll('[data-type="search-mark"]').forEach(markItem => {
|
||||||
|
markItem.outerHTML = markItem.innerHTML;
|
||||||
|
})
|
||||||
});
|
});
|
||||||
if (event.altKey) {
|
if (event.altKey) {
|
||||||
focusByRange(document.caretRangeFromPoint(event.clientX, event.clientY));
|
focusByRange(document.caretRangeFromPoint(event.clientX, event.clientY));
|
||||||
|
|
|
||||||
|
|
@ -707,7 +707,7 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {
|
||||||
}
|
}
|
||||||
// 行首转义符前删除 https://github.com/siyuan-note/siyuan/issues/6092
|
// 行首转义符前删除 https://github.com/siyuan-note/siyuan/issues/6092
|
||||||
if (range.startOffset === 0 &&
|
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>" &&
|
previousSibling.nodeType !== 3 && (previousSibling as HTMLElement).outerHTML === "<span>\\</span>" &&
|
||||||
!hasPreviousSibling(previousSibling)) {
|
!hasPreviousSibling(previousSibling)) {
|
||||||
range.setStartBefore(previousSibling.parentElement);
|
range.setStartBefore(previousSibling.parentElement);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue