This commit is contained in:
Vanessa 2023-03-25 11:12:06 +08:00 committed by Liang Ding
parent ea2b2d9b62
commit aacf45d6a9
No known key found for this signature in database
GPG Key ID: 136F30F901A2231D
3 changed files with 16 additions and 16 deletions

View File

@ -93,12 +93,12 @@ export const AIActions = (elements: Element[], protyle: IProtyle) => {
window.siyuan.storage[Constants.LOCAL_AI].push({
name: inputElement.value,
memo: dialog.element.querySelector("textarea").value,
})
});
setStorageVal(Constants.LOCAL_AI, window.siyuan.storage[Constants.LOCAL_AI]);
dialog.destroy();
});
}
}]
}];
window.siyuan.storage[Constants.LOCAL_AI].forEach((item: { name: string, memo: string }) => {
customMenu.push({
iconHTML: Constants.ZWSP,
@ -117,7 +117,7 @@ export const AIActions = (elements: Element[], protyle: IProtyle) => {
element.remove();
return true;
}
})
});
} else {
fetchPost("/api/ai/chatGPTWithAction", {
ids,
@ -135,7 +135,7 @@ export const AIActions = (elements: Element[], protyle: IProtyle) => {
event.stopPropagation();
});
}
})
});
});
window.siyuan.menus.menu.append(new MenuItem({
icon: "iconSparkles",

View File

@ -389,7 +389,7 @@ export class Title {
click: () => {
quickMakeCard([this.element]);
}
}]
}];
if (window.siyuan.config.flashcard.deck) {
riffCardMenu.push({
iconHTML: Constants.ZWSP,
@ -397,7 +397,7 @@ export class Title {
click: () => {
makeCard([protyle.block.rootID]);
}
})
});
}
window.siyuan.menus.menu.append(new MenuItem({
label: window.siyuan.languages.riffCard,

View File

@ -1280,7 +1280,7 @@ export class Toolbar {
}
}).forEach((item) => {
if (inputElement.value === item) {
matchInput = true
matchInput = true;
}
html += `<div class="b3-list-item">${item.replace(inputElement.value.toLowerCase(), "<b>" + inputElement.value.toLowerCase() + "</b>")}</div>`;
});
@ -1369,7 +1369,7 @@ export class Toolbar {
</div>`;
const listElement = this.subElement.querySelector(".b3-list");
const previewElement = this.subElement.firstElementChild.lastElementChild;
let previewPath = listElement.firstElementChild.getAttribute("data-value")
let previewPath = listElement.firstElementChild.getAttribute("data-value");
previewTemplate(previewPath, previewElement, protyle.block.parentID);
listElement.addEventListener("mouseover", (event) => {
const target = event.target as HTMLElement;
@ -1377,11 +1377,11 @@ export class Toolbar {
if (!hoverItemElement) {
return;
}
const currentPath = hoverItemElement.getAttribute("data-value")
const currentPath = hoverItemElement.getAttribute("data-value");
if (previewPath === currentPath) {
return;
}
previewPath = currentPath
previewPath = currentPath;
previewTemplate(previewPath, previewElement, protyle.block.parentID);
});
const inputElement = this.subElement.querySelector("input");
@ -1394,11 +1394,11 @@ export class Toolbar {
if (!isEmpty) {
const currentElement = upDownHint(listElement, event);
if (currentElement) {
const currentPath = currentElement.getAttribute("data-value")
const currentPath = currentElement.getAttribute("data-value");
if (previewPath === currentPath) {
return;
}
previewPath = currentPath
previewPath = currentPath;
previewTemplate(previewPath, previewElement, protyle.block.parentID);
}
}
@ -1425,11 +1425,11 @@ export class Toolbar {
searchHTML += `<div data-value="${item.path}" class="b3-list-item${index === 0 ? " b3-list-item--focus" : ""}">${item.content}</div>`;
});
listElement.innerHTML = searchHTML || `<li class="b3-list--empty">${window.siyuan.languages.emptyContent}</li>`;
const currentPath = response.data.blocks[0]?.path
const currentPath = response.data.blocks[0]?.path;
if (previewPath === currentPath) {
return;
}
previewPath = currentPath
previewPath = currentPath;
previewTemplate(previewPath, previewElement, protyle.block.parentID);
});
});
@ -1459,11 +1459,11 @@ export class Toolbar {
if (iconElement.parentElement.classList.contains("b3-list-item--focus")) {
const sideElement = iconElement.parentElement.previousElementSibling || iconElement.parentElement.nextElementSibling;
sideElement.classList.add("b3-list-item--focus");
const currentPath = sideElement.getAttribute("data-value")
const currentPath = sideElement.getAttribute("data-value");
if (previewPath === currentPath) {
return;
}
previewPath = currentPath
previewPath = currentPath;
previewTemplate(previewPath, previewElement, protyle.block.parentID);
}
iconElement.parentElement.remove();