Skip to content

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

:bug: 另外如果绑定块的过程新建了行,并速度比它快就会在前面

Vanessabfbfbaea3eaa
diff --git a/app/src/protyle/hint/index.ts b/app/src/protyle/hint/index.ts
index a240e54e44..eba81fc0fc 100644
--- a/app/src/protyle/hint/index.ts
+++ b/app/src/protyle/hint/index.ts
@@ -414,6 +414,10 @@ ${genHintItemHTML(item)}
if (!cellElement) {
return;
}
+ const rowElement = hasClosestByClassName(cellElement, "av__row");
+ if (!rowElement) {
+ return;
+ }
const previousID = cellElement.dataset.blockId;
const avID = nodeElement.getAttribute("data-av-id");
let tempElement = document.createElement("div");
@@ -422,23 +426,26 @@ ${genHintItemHTML(item)}
if (value.startsWith("((newFile ") && value.endsWith(`${Lute.Caret}'))`)) {
const fileNames = value.substring(11, value.length - 4).split(`"${Constants.ZWSP}'`);
const realFileName = fileNames.length === 1 ? fileNames[0] : fileNames[1];
+ const newID = Lute.NewNodeID();
+ rowElement.dataset.id = newID;
getSavePath(protyle.path, protyle.notebookId, (pathString) => {
fetchPost("/api/filetree/createDocWithMd", {
notebook: protyle.notebookId,
path: pathPosix().join(pathString, realFileName),
parentID: protyle.block.rootID,
- markdown: ""
- }, response => {
+ markdown: "",
+ id: newID,
+ }, () => {
transaction(protyle, [{
action: "replaceAttrViewBlock",
avID,
previousID,
- nextID: response.data,
+ nextID: newID,
isDetached: false,
}], [{
action: "replaceAttrViewBlock",
avID,
- previousID: response.data,
+ previousID: newID,
nextID: previousID,
isDetached: true,
}]);
@@ -446,6 +453,7 @@ ${genHintItemHTML(item)}
});
} else {
const sourceId = tempElement.getAttribute("data-id");
+ rowElement.dataset.id = sourceId;
transaction(protyle, [{
action: "replaceAttrViewBlock",
avID,