mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-16 05:35:28 +01:00
This commit is contained in:
parent
8c35440a77
commit
74b4a00a2f
42 changed files with 426 additions and 270 deletions
|
|
@ -143,7 +143,12 @@ export const bindCardEvent = (options: {
|
|||
mode: 0,
|
||||
size: Constants.SIZE_GET_MAX
|
||||
}, (response) => {
|
||||
onGet(response, editor.protyle, [Constants.CB_GET_ALL, Constants.CB_GET_HTML]);
|
||||
onGet({
|
||||
data: response,
|
||||
protyle: editor.protyle,
|
||||
action: [Constants.CB_GET_ALL, Constants.CB_GET_HTML],
|
||||
app: options.app
|
||||
});
|
||||
});
|
||||
}
|
||||
(options.element.firstElementChild as HTMLElement).style.zIndex = "200";
|
||||
|
|
@ -163,6 +168,7 @@ export const bindCardEvent = (options: {
|
|||
options.blocks = treeCards.data.cards;
|
||||
if (options.blocks.length > 0) {
|
||||
nextCard({
|
||||
app: options.app,
|
||||
countElement,
|
||||
editor,
|
||||
actionElements,
|
||||
|
|
@ -336,6 +342,7 @@ export const bindCardEvent = (options: {
|
|||
if (index > 0) {
|
||||
index--;
|
||||
nextCard({
|
||||
app: options.app,
|
||||
countElement,
|
||||
editor,
|
||||
actionElements,
|
||||
|
|
@ -379,6 +386,7 @@ export const bindCardEvent = (options: {
|
|||
}
|
||||
} else {
|
||||
nextCard({
|
||||
app: options.app,
|
||||
countElement,
|
||||
editor,
|
||||
actionElements,
|
||||
|
|
@ -390,6 +398,7 @@ export const bindCardEvent = (options: {
|
|||
return;
|
||||
}
|
||||
nextCard({
|
||||
app: options.app,
|
||||
countElement,
|
||||
editor,
|
||||
actionElements,
|
||||
|
|
@ -449,6 +458,7 @@ export const openCardByData = (app: App, cardsData: {
|
|||
};
|
||||
|
||||
const nextCard = (options: {
|
||||
app: App,
|
||||
countElement: Element, editor: Protyle, actionElements: NodeListOf<Element>, index: number, blocks: ICard[]
|
||||
}) => {
|
||||
options.editor.protyle.element.classList.add("card__block--hide");
|
||||
|
|
@ -477,7 +487,12 @@ const nextCard = (options: {
|
|||
mode: 0,
|
||||
size: Constants.SIZE_GET_MAX
|
||||
}, (response) => {
|
||||
onGet(response, options.editor.protyle, [Constants.CB_GET_ALL, Constants.CB_GET_HTML]);
|
||||
onGet({
|
||||
data: response,
|
||||
protyle: options.editor.protyle,
|
||||
action: [Constants.CB_GET_ALL, Constants.CB_GET_HTML],
|
||||
app: options.app
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ export const viewCards = (app: App, deckID: string, title: string, deckType: "Tr
|
|||
if (window.siyuan.config.editor.readOnly) {
|
||||
disabledProtyle(edit.protyle);
|
||||
}
|
||||
getArticle(edit, dialog.element.querySelector(".b3-list-item--focus")?.getAttribute("data-id"));
|
||||
getArticle(app, edit, dialog.element.querySelector(".b3-list-item--focus")?.getAttribute("data-id"));
|
||||
}
|
||||
const previousElement = dialog.element.querySelector('[data-type="previous"]');
|
||||
const nextElement = dialog.element.querySelector('[data-type="next"]');
|
||||
|
|
@ -93,7 +93,7 @@ export const viewCards = (app: App, deckID: string, title: string, deckType: "Tr
|
|||
if (currentRect.top < parentRect.top || currentRect.bottom > parentRect.bottom) {
|
||||
currentElement.scrollIntoView(currentRect.top < parentRect.top);
|
||||
}
|
||||
getArticle(edit, currentElement.getAttribute("data-id"));
|
||||
getArticle(app, edit, currentElement.getAttribute("data-id"));
|
||||
currentElement.classList.add("b3-list-item--focus");
|
||||
}
|
||||
event.stopPropagation();
|
||||
|
|
@ -125,7 +125,7 @@ export const viewCards = (app: App, deckID: string, title: string, deckType: "Tr
|
|||
nextElement.nextElementSibling.nextElementSibling.textContent = `${pageIndex}/${cardsResponse.data.pageCount || 1}`;
|
||||
listElement.innerHTML = renderViewItem(cardsResponse.data.blocks, title, deckType);
|
||||
listElement.scrollTop = 0;
|
||||
getArticle(edit, dialog.element.querySelector(".b3-list-item--focus")?.getAttribute("data-id"));
|
||||
getArticle(app, edit, dialog.element.querySelector(".b3-list-item--focus")?.getAttribute("data-id"));
|
||||
});
|
||||
event.stopPropagation();
|
||||
event.preventDefault();
|
||||
|
|
@ -145,13 +145,13 @@ export const viewCards = (app: App, deckID: string, title: string, deckType: "Tr
|
|||
nextElement.nextElementSibling.nextElementSibling.textContent = `${pageIndex}/${cardsResponse.data.pageCount || 1}`;
|
||||
listElement.innerHTML = renderViewItem(cardsResponse.data.blocks, title, deckType);
|
||||
listElement.scrollTop = 0;
|
||||
getArticle(edit, dialog.element.querySelector(".b3-list-item--focus")?.getAttribute("data-id"));
|
||||
getArticle(app, edit, dialog.element.querySelector(".b3-list-item--focus")?.getAttribute("data-id"));
|
||||
});
|
||||
event.stopPropagation();
|
||||
event.preventDefault();
|
||||
break;
|
||||
} else if (type === "card-item") {
|
||||
getArticle(edit, target.getAttribute("data-id"));
|
||||
getArticle(app, edit, target.getAttribute("data-id"));
|
||||
listElement.querySelector(".b3-list-item--focus")?.classList.remove("b3-list-item--focus");
|
||||
target.classList.add("b3-list-item--focus");
|
||||
event.stopPropagation();
|
||||
|
|
@ -171,10 +171,10 @@ export const viewCards = (app: App, deckID: string, title: string, deckType: "Tr
|
|||
}
|
||||
|
||||
if (!nextElment) {
|
||||
getArticle(edit, "");
|
||||
getArticle(app, edit, "");
|
||||
listElement.innerHTML = `<div class="b3-list--empty">${window.siyuan.languages.emptyContent}</div>`;
|
||||
} else {
|
||||
getArticle(edit, nextElment.getAttribute("data-id"));
|
||||
getArticle(app, edit, nextElment.getAttribute("data-id"));
|
||||
listElement.querySelector(".b3-list-item--focus")?.classList.remove("b3-list-item--focus");
|
||||
nextElment.classList.add("b3-list-item--focus");
|
||||
target.parentElement.remove();
|
||||
|
|
@ -240,7 +240,7 @@ ${unicode2Emoji(item.ial.icon, false, "b3-list-item__graphic", true)}
|
|||
};
|
||||
|
||||
|
||||
const getArticle = (edit: Protyle, id: string) => {
|
||||
const getArticle = (app: App, edit: Protyle, id: string) => {
|
||||
if (!id) {
|
||||
edit.protyle.element.classList.add("fn__none");
|
||||
edit.protyle.element.nextElementSibling.classList.remove("fn__none");
|
||||
|
|
@ -255,6 +255,8 @@ const getArticle = (edit: Protyle, id: string) => {
|
|||
mode: 0,
|
||||
size: Constants.SIZE_GET_MAX,
|
||||
}, getResponse => {
|
||||
onGet(getResponse, edit.protyle, [Constants.CB_GET_ALL, Constants.CB_GET_HTML]);
|
||||
onGet({
|
||||
data: getResponse, protyle: edit.protyle, action: [Constants.CB_GET_ALL, Constants.CB_GET_HTML], app
|
||||
});
|
||||
});
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue