mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-05-20 11:00:52 +08:00
🚨
This commit is contained in:
parent
ea2b2d9b62
commit
aacf45d6a9
@ -93,12 +93,12 @@ export const AIActions = (elements: Element[], protyle: IProtyle) => {
|
|||||||
window.siyuan.storage[Constants.LOCAL_AI].push({
|
window.siyuan.storage[Constants.LOCAL_AI].push({
|
||||||
name: inputElement.value,
|
name: inputElement.value,
|
||||||
memo: dialog.element.querySelector("textarea").value,
|
memo: dialog.element.querySelector("textarea").value,
|
||||||
})
|
});
|
||||||
setStorageVal(Constants.LOCAL_AI, window.siyuan.storage[Constants.LOCAL_AI]);
|
setStorageVal(Constants.LOCAL_AI, window.siyuan.storage[Constants.LOCAL_AI]);
|
||||||
dialog.destroy();
|
dialog.destroy();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}]
|
}];
|
||||||
window.siyuan.storage[Constants.LOCAL_AI].forEach((item: { name: string, memo: string }) => {
|
window.siyuan.storage[Constants.LOCAL_AI].forEach((item: { name: string, memo: string }) => {
|
||||||
customMenu.push({
|
customMenu.push({
|
||||||
iconHTML: Constants.ZWSP,
|
iconHTML: Constants.ZWSP,
|
||||||
@ -117,7 +117,7 @@ export const AIActions = (elements: Element[], protyle: IProtyle) => {
|
|||||||
element.remove();
|
element.remove();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
} else {
|
} else {
|
||||||
fetchPost("/api/ai/chatGPTWithAction", {
|
fetchPost("/api/ai/chatGPTWithAction", {
|
||||||
ids,
|
ids,
|
||||||
@ -135,7 +135,7 @@ export const AIActions = (elements: Element[], protyle: IProtyle) => {
|
|||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
});
|
});
|
||||||
window.siyuan.menus.menu.append(new MenuItem({
|
window.siyuan.menus.menu.append(new MenuItem({
|
||||||
icon: "iconSparkles",
|
icon: "iconSparkles",
|
||||||
|
@ -389,7 +389,7 @@ export class Title {
|
|||||||
click: () => {
|
click: () => {
|
||||||
quickMakeCard([this.element]);
|
quickMakeCard([this.element]);
|
||||||
}
|
}
|
||||||
}]
|
}];
|
||||||
if (window.siyuan.config.flashcard.deck) {
|
if (window.siyuan.config.flashcard.deck) {
|
||||||
riffCardMenu.push({
|
riffCardMenu.push({
|
||||||
iconHTML: Constants.ZWSP,
|
iconHTML: Constants.ZWSP,
|
||||||
@ -397,7 +397,7 @@ export class Title {
|
|||||||
click: () => {
|
click: () => {
|
||||||
makeCard([protyle.block.rootID]);
|
makeCard([protyle.block.rootID]);
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
window.siyuan.menus.menu.append(new MenuItem({
|
window.siyuan.menus.menu.append(new MenuItem({
|
||||||
label: window.siyuan.languages.riffCard,
|
label: window.siyuan.languages.riffCard,
|
||||||
|
@ -1280,7 +1280,7 @@ export class Toolbar {
|
|||||||
}
|
}
|
||||||
}).forEach((item) => {
|
}).forEach((item) => {
|
||||||
if (inputElement.value === 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>`;
|
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>`;
|
</div>`;
|
||||||
const listElement = this.subElement.querySelector(".b3-list");
|
const listElement = this.subElement.querySelector(".b3-list");
|
||||||
const previewElement = this.subElement.firstElementChild.lastElementChild;
|
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);
|
previewTemplate(previewPath, previewElement, protyle.block.parentID);
|
||||||
listElement.addEventListener("mouseover", (event) => {
|
listElement.addEventListener("mouseover", (event) => {
|
||||||
const target = event.target as HTMLElement;
|
const target = event.target as HTMLElement;
|
||||||
@ -1377,11 +1377,11 @@ export class Toolbar {
|
|||||||
if (!hoverItemElement) {
|
if (!hoverItemElement) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const currentPath = hoverItemElement.getAttribute("data-value")
|
const currentPath = hoverItemElement.getAttribute("data-value");
|
||||||
if (previewPath === currentPath) {
|
if (previewPath === currentPath) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
previewPath = currentPath
|
previewPath = currentPath;
|
||||||
previewTemplate(previewPath, previewElement, protyle.block.parentID);
|
previewTemplate(previewPath, previewElement, protyle.block.parentID);
|
||||||
});
|
});
|
||||||
const inputElement = this.subElement.querySelector("input");
|
const inputElement = this.subElement.querySelector("input");
|
||||||
@ -1394,11 +1394,11 @@ export class Toolbar {
|
|||||||
if (!isEmpty) {
|
if (!isEmpty) {
|
||||||
const currentElement = upDownHint(listElement, event);
|
const currentElement = upDownHint(listElement, event);
|
||||||
if (currentElement) {
|
if (currentElement) {
|
||||||
const currentPath = currentElement.getAttribute("data-value")
|
const currentPath = currentElement.getAttribute("data-value");
|
||||||
if (previewPath === currentPath) {
|
if (previewPath === currentPath) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
previewPath = currentPath
|
previewPath = currentPath;
|
||||||
previewTemplate(previewPath, previewElement, protyle.block.parentID);
|
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>`;
|
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>`;
|
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) {
|
if (previewPath === currentPath) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
previewPath = currentPath
|
previewPath = currentPath;
|
||||||
previewTemplate(previewPath, previewElement, protyle.block.parentID);
|
previewTemplate(previewPath, previewElement, protyle.block.parentID);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -1459,11 +1459,11 @@ export class Toolbar {
|
|||||||
if (iconElement.parentElement.classList.contains("b3-list-item--focus")) {
|
if (iconElement.parentElement.classList.contains("b3-list-item--focus")) {
|
||||||
const sideElement = iconElement.parentElement.previousElementSibling || iconElement.parentElement.nextElementSibling;
|
const sideElement = iconElement.parentElement.previousElementSibling || iconElement.parentElement.nextElementSibling;
|
||||||
sideElement.classList.add("b3-list-item--focus");
|
sideElement.classList.add("b3-list-item--focus");
|
||||||
const currentPath = sideElement.getAttribute("data-value")
|
const currentPath = sideElement.getAttribute("data-value");
|
||||||
if (previewPath === currentPath) {
|
if (previewPath === currentPath) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
previewPath = currentPath
|
previewPath = currentPath;
|
||||||
previewTemplate(previewPath, previewElement, protyle.block.parentID);
|
previewTemplate(previewPath, previewElement, protyle.block.parentID);
|
||||||
}
|
}
|
||||||
iconElement.parentElement.remove();
|
iconElement.parentElement.remove();
|
||||||
|
Loading…
Reference in New Issue
Block a user