mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-06 16:58:49 +01:00
This commit is contained in:
parent
b3d453b27e
commit
4bf4c1228c
1 changed files with 19 additions and 13 deletions
|
|
@ -77,7 +77,7 @@ export class Bookmark extends Model {
|
|||
element: this.element.lastElementChild as HTMLElement,
|
||||
data: null,
|
||||
click(element: HTMLElement) {
|
||||
const id = element.getAttribute("data-node-id");
|
||||
const id = element.getAttribute("data-node-id");
|
||||
fetchPost("/api/block/checkBlockFold", {id}, (foldResponse) => {
|
||||
openFileById({
|
||||
id,
|
||||
|
|
@ -88,7 +88,8 @@ export class Bookmark extends Model {
|
|||
},
|
||||
rightClick: (element: HTMLElement, event: MouseEvent) => {
|
||||
window.siyuan.menus.menu.remove();
|
||||
if (!element.getAttribute("data-node-id")) {
|
||||
const id = element.getAttribute("data-node-id")
|
||||
if (!id) {
|
||||
window.siyuan.menus.menu.append(new MenuItem({
|
||||
label: window.siyuan.languages.rename,
|
||||
click: () => {
|
||||
|
|
@ -123,13 +124,14 @@ export class Bookmark extends Model {
|
|||
});
|
||||
}
|
||||
}).element);
|
||||
} else {
|
||||
window.siyuan.menus.menu.append(new MenuItem({
|
||||
icon: "iconTrashcan",
|
||||
label: window.siyuan.languages.remove,
|
||||
click: () => {
|
||||
confirmDialog(window.siyuan.languages.delete, `${window.siyuan.languages.confirmDelete} <b>${escapeHtml(element.parentElement.previousElementSibling.querySelector(".b3-list-item__text").textContent)}</b>?`, () => {
|
||||
const id = element.getAttribute("data-node-id");
|
||||
}
|
||||
window.siyuan.menus.menu.append(new MenuItem({
|
||||
icon: "iconTrashcan",
|
||||
label: window.siyuan.languages.remove,
|
||||
click: () => {
|
||||
const bookmark = (id ? element.parentElement.previousElementSibling : element).querySelector(".b3-list-item__text").textContent
|
||||
confirmDialog(window.siyuan.languages.delete, `${window.siyuan.languages.confirmDelete} <b>${escapeHtml(bookmark)}</b>?`, () => {
|
||||
if (id) {
|
||||
fetchPost("/api/attr/setBlockAttrs", {id, attrs: {bookmark: ""}}, () => {
|
||||
this.update();
|
||||
});
|
||||
|
|
@ -140,10 +142,14 @@ export class Bookmark extends Model {
|
|||
bookmarkElement.remove();
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
}).element);
|
||||
}
|
||||
} else {
|
||||
fetchPost("/api/bookmark/removeBookmark", {bookmark}, () => {
|
||||
this.update();
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}).element);
|
||||
window.siyuan.menus.menu.popup({x: event.clientX, y: event.clientY});
|
||||
},
|
||||
ctrlClick(element: HTMLElement) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue