Vanessa 2025-10-16 18:18:22 +08:00
parent d7627c9e21
commit 67859fb96d

View file

@ -971,7 +971,7 @@ export class Outline extends Model {
fetchPost("/api/block/insertBlock", { fetchPost("/api/block/insertBlock", {
data: "#".repeat(this.getHeadingLevel(element)) + " ", data: "#".repeat(this.getHeadingLevel(element)) + " ",
dataType: "markdown", dataType: "markdown",
nextID: element.getAttribute("data-node-id") nextID: id
}, (response) => { }, (response) => {
openFileById({ openFileById({
app: this.app, app: this.app,
@ -987,10 +987,13 @@ export class Outline extends Model {
icon: "iconAfter", icon: "iconAfter",
label: window.siyuan.languages.insertSameLevelHeadingAfter, label: window.siyuan.languages.insertSameLevelHeadingAfter,
click: () => { click: () => {
fetchPost("/api/block/getHeadingDeleteTransaction", {
id,
}, (deleteResponse) => {
fetchPost("/api/block/insertBlock", { fetchPost("/api/block/insertBlock", {
data: "#".repeat(this.getHeadingLevel(element)) + " ", data: "#".repeat(this.getHeadingLevel(element)) + " ",
dataType: "markdown", dataType: "markdown",
previousID: element.getAttribute("data-node-id") previousID: deleteResponse.data.doOperations[deleteResponse.data.doOperations.length - 1].id
}, (response) => { }, (response) => {
openFileById({ openFileById({
app: this.app, app: this.app,
@ -998,6 +1001,7 @@ export class Outline extends Model {
action: [Constants.CB_GET_FOCUS, Constants.CB_GET_OUTLINE, Constants.CB_GET_SETID, Constants.CB_GET_CONTEXT, Constants.CB_GET_HTML] action: [Constants.CB_GET_FOCUS, Constants.CB_GET_OUTLINE, Constants.CB_GET_SETID, Constants.CB_GET_CONTEXT, Constants.CB_GET_HTML]
}); });
}); });
});
} }
}).element); }).element);
@ -1010,7 +1014,7 @@ export class Outline extends Model {
fetchPost("/api/block/prependBlock", { fetchPost("/api/block/prependBlock", {
data: "#".repeat(Math.min(this.getHeadingLevel(element) + 1, 6)) + " ", data: "#".repeat(Math.min(this.getHeadingLevel(element) + 1, 6)) + " ",
dataType: "markdown", dataType: "markdown",
parentID: element.getAttribute("data-node-id") parentID: id
}, (response) => { }, (response) => {
if (response.code === 0 && response.data && response.data.length > 0) { if (response.code === 0 && response.data && response.data.length > 0) {
openFileById({ openFileById({