Skip to content

Commit 67859fb

Browse files
committed
🎨 #16121 2
1 parent d7627c9 commit 67859fb

File tree

1 file changed

+16
-12
lines changed

1 file changed

+16
-12
lines changed

app/src/layout/dock/Outline.ts

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ export class Outline extends Model {
200200
rightClick: (element: HTMLElement, event: MouseEvent) => {
201201
this.showContextMenu(element, event);
202202
},
203-
toggleClick:(liElement) => {
203+
toggleClick: (liElement) => {
204204
if (!liElement.nextElementSibling) {
205205
return;
206206
}
@@ -971,7 +971,7 @@ export class Outline extends Model {
971971
fetchPost("/api/block/insertBlock", {
972972
data: "#".repeat(this.getHeadingLevel(element)) + " ",
973973
dataType: "markdown",
974-
nextID: element.getAttribute("data-node-id")
974+
nextID: id
975975
}, (response) => {
976976
openFileById({
977977
app: this.app,
@@ -987,15 +987,19 @@ export class Outline extends Model {
987987
icon: "iconAfter",
988988
label: window.siyuan.languages.insertSameLevelHeadingAfter,
989989
click: () => {
990-
fetchPost("/api/block/insertBlock", {
991-
data: "#".repeat(this.getHeadingLevel(element)) + " ",
992-
dataType: "markdown",
993-
previousID: element.getAttribute("data-node-id")
994-
}, (response) => {
995-
openFileById({
996-
app: this.app,
997-
id: response.data[0].doOperations[0].id,
998-
action: [Constants.CB_GET_FOCUS, Constants.CB_GET_OUTLINE, Constants.CB_GET_SETID, Constants.CB_GET_CONTEXT, Constants.CB_GET_HTML]
990+
fetchPost("/api/block/getHeadingDeleteTransaction", {
991+
id,
992+
}, (deleteResponse) => {
993+
fetchPost("/api/block/insertBlock", {
994+
data: "#".repeat(this.getHeadingLevel(element)) + " ",
995+
dataType: "markdown",
996+
previousID: deleteResponse.data.doOperations[deleteResponse.data.doOperations.length - 1].id
997+
}, (response) => {
998+
openFileById({
999+
app: this.app,
1000+
id: response.data[0].doOperations[0].id,
1001+
action: [Constants.CB_GET_FOCUS, Constants.CB_GET_OUTLINE, Constants.CB_GET_SETID, Constants.CB_GET_CONTEXT, Constants.CB_GET_HTML]
1002+
});
9991003
});
10001004
});
10011005
}
@@ -1010,7 +1014,7 @@ export class Outline extends Model {
10101014
fetchPost("/api/block/prependBlock", {
10111015
data: "#".repeat(Math.min(this.getHeadingLevel(element) + 1, 6)) + " ",
10121016
dataType: "markdown",
1013-
parentID: element.getAttribute("data-node-id")
1017+
parentID: id
10141018
}, (response) => {
10151019
if (response.code === 0 && response.data && response.data.length > 0) {
10161020
openFileById({

0 commit comments

Comments
 (0)