mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-22 17:40:13 +01:00
🚨
This commit is contained in:
parent
1c4718fcb9
commit
67f095c522
7 changed files with 26 additions and 26 deletions
|
|
@ -81,7 +81,7 @@ const editDialog = (customName: string, customMemo: string) => {
|
|||
dialog.destroy();
|
||||
});
|
||||
nameElement.focus();
|
||||
}
|
||||
};
|
||||
|
||||
const customDialog = (protyle: IProtyle, ids: string[], elements: Element[]) => {
|
||||
const dialog = new Dialog({
|
||||
|
|
@ -134,7 +134,7 @@ const customDialog = (protyle: IProtyle, ids: string[], elements: Element[]) =>
|
|||
dialog.destroy();
|
||||
});
|
||||
nameElement.focus();
|
||||
}
|
||||
};
|
||||
|
||||
const filterAI = (element: HTMLElement, inputElement: HTMLInputElement) => {
|
||||
element.querySelectorAll(".b3-list-item").forEach(item => {
|
||||
|
|
@ -143,17 +143,17 @@ const filterAI = (element: HTMLElement, inputElement: HTMLInputElement) => {
|
|||
} else {
|
||||
item.classList.add("fn__none");
|
||||
}
|
||||
})
|
||||
element.querySelectorAll('.b3-menu__separator').forEach(item => {
|
||||
});
|
||||
element.querySelectorAll(".b3-menu__separator").forEach(item => {
|
||||
if (inputElement.value) {
|
||||
item.classList.add("fn__none");
|
||||
} else {
|
||||
item.classList.remove("fn__none");
|
||||
}
|
||||
})
|
||||
});
|
||||
element.querySelector(".b3-list-item--focus").classList.remove("b3-list-item--focus");
|
||||
element.querySelector(".b3-list-item:not(.fn__none)").classList.add("b3-list-item--focus");
|
||||
}
|
||||
};
|
||||
|
||||
export const AIActions = (elements: Element[], protyle: IProtyle) => {
|
||||
window.siyuan.menus.menu.remove();
|
||||
|
|
@ -164,7 +164,7 @@ export const AIActions = (elements: Element[], protyle: IProtyle) => {
|
|||
const menu = new Menu("ai", () => {
|
||||
focusByRange(protyle.toolbar.range);
|
||||
});
|
||||
let customHTML = ""
|
||||
let customHTML = "";
|
||||
window.siyuan.storage[Constants.LOCAL_AI].forEach((item: { name: string, memo: string }) => {
|
||||
customHTML += `<div data-action="${item.memo || item.name}" class="b3-list-item b3-list-item--narrow ariaLabel" aria-label="${escapeAriaLabel(item.memo)}">
|
||||
<span class="b3-list-item__text">${escapeHtml(item.name)}</span>
|
||||
|
|
@ -258,7 +258,7 @@ export const AIActions = (elements: Element[], protyle: IProtyle) => {
|
|||
});
|
||||
inputElement.addEventListener("compositionend", () => {
|
||||
filterAI(element, inputElement);
|
||||
})
|
||||
});
|
||||
inputElement.addEventListener("input", (event: KeyboardEvent) => {
|
||||
if (event.isComposing) {
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -160,12 +160,12 @@ export const ai = {
|
|||
</div>`;
|
||||
},
|
||||
bindEvent: () => {
|
||||
const togglePassword = ai.element.querySelector('.b3-form__icona-icon[data-action="togglePassword"]')
|
||||
const togglePassword = ai.element.querySelector('.b3-form__icona-icon[data-action="togglePassword"]');
|
||||
togglePassword.addEventListener("click", () => {
|
||||
const isEye = togglePassword.firstElementChild.getAttribute("xlink:href") === "#iconEye";
|
||||
togglePassword.firstElementChild.setAttribute("xlink:href", isEye ? "#iconEyeoff" : "#iconEye");
|
||||
togglePassword.previousElementSibling.setAttribute("type", isEye ? "text" : "password");
|
||||
})
|
||||
});
|
||||
ai.element.querySelectorAll("input, select").forEach((item) => {
|
||||
item.addEventListener("change", () => {
|
||||
fetchPost("/api/setting/setAI", {
|
||||
|
|
|
|||
|
|
@ -140,9 +140,9 @@ export const setFilter = async (options: {
|
|||
contents: [newValue],
|
||||
},
|
||||
type: "rollup"
|
||||
}
|
||||
};
|
||||
} else {
|
||||
newFilter.value = newValue
|
||||
newFilter.value = newValue;
|
||||
}
|
||||
let isSame = false;
|
||||
options.data.view.filters.find((filter, index) => {
|
||||
|
|
@ -225,7 +225,7 @@ export const setFilter = async (options: {
|
|||
type: filterValue.type
|
||||
};
|
||||
} else {
|
||||
filterValue = item.value.rollup.contents[0]
|
||||
filterValue = item.value.rollup.contents[0];
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -366,10 +366,10 @@ export const openMenuPanel = (options: {
|
|||
}
|
||||
targetElement.classList.remove("dragover__bottom", "dragover__top");
|
||||
const blockIDs: string[] = [];
|
||||
const contents: IAVCellValue[] = []
|
||||
const contents: IAVCellValue[] = [];
|
||||
targetElement.parentElement.querySelectorAll(".fn__grab").forEach(item => {
|
||||
const dateElement = item.nextElementSibling as HTMLElement
|
||||
blockIDs.push(dateElement.dataset.id)
|
||||
const dateElement = item.nextElementSibling as HTMLElement;
|
||||
blockIDs.push(dateElement.dataset.id);
|
||||
contents.push({
|
||||
isDetached: !dateElement.style.color,
|
||||
type: "block",
|
||||
|
|
@ -377,8 +377,8 @@ export const openMenuPanel = (options: {
|
|||
content: dateElement.textContent,
|
||||
id: dateElement.dataset.id
|
||||
}
|
||||
})
|
||||
})
|
||||
});
|
||||
});
|
||||
updateCellsValue(options.protyle, options.blockElement as HTMLElement, {
|
||||
blockIDs,
|
||||
contents,
|
||||
|
|
|
|||
|
|
@ -237,11 +237,11 @@ const filterItem = (menuElement: Element, cellElement: HTMLElement, keyword: str
|
|||
const cells = response.data.rows.values as IAVCellValue[] || [];
|
||||
let html = "";
|
||||
let selectHTML = "";
|
||||
const hasIds: string[] = []
|
||||
const hasIds: string[] = [];
|
||||
cellElement.querySelectorAll("span").forEach((item) => {
|
||||
hasIds.push(item.dataset.id);
|
||||
selectHTML += `<button data-id="${item.dataset.id}" data-type="setRelationCell" class="b3-menu__item${item.textContent.indexOf(keyword) > -1 ? "" : " fn__none"}" draggable="true">${genSelectItemHTML("selected", item.dataset.id, !item.classList.contains("av__celltext--ref"), item.textContent || "Untitled")}</button>`;
|
||||
})
|
||||
});
|
||||
cells.forEach((item) => {
|
||||
if (!hasIds.includes(item.block.id)) {
|
||||
html += genSelectItemHTML("unselect", item.block.id, item.isDetached, item.block.content || "Untitled");
|
||||
|
|
@ -267,11 +267,11 @@ export const bindRelationEvent = (options: {
|
|||
const cells = response.data.rows.values as IAVCellValue[] || [];
|
||||
let html = "";
|
||||
let selectHTML = "";
|
||||
const hasIds: string[] = []
|
||||
const hasIds: string[] = [];
|
||||
options.cellElements[0].querySelectorAll("span").forEach((item) => {
|
||||
hasIds.push(item.dataset.id);
|
||||
selectHTML += `<button data-id="${item.dataset.id}" data-type="setRelationCell" class="b3-menu__item" draggable="true">${genSelectItemHTML("selected", item.dataset.id, !item.classList.contains("av__celltext--ref"), item.textContent || "Untitled")}</button>`;
|
||||
})
|
||||
});
|
||||
cells.forEach((item) => {
|
||||
if (!hasIds.includes(item.block.id)) {
|
||||
html += genSelectItemHTML("unselect", item.block.id, item.isDetached, item.block.content || "Untitled");
|
||||
|
|
|
|||
|
|
@ -79,10 +79,10 @@ export const avRender = (element: Element, protyle: IProtyle, cb?: () => void, v
|
|||
if (!hasFilter) {
|
||||
data.filters.find(filterItem => {
|
||||
if (filterItem.value.type === item.type && item.id === filterItem.column) {
|
||||
hasFilter = true
|
||||
return true
|
||||
hasFilter = true;
|
||||
return true;
|
||||
}
|
||||
})
|
||||
});
|
||||
}
|
||||
if (!item.hidden) {
|
||||
if (item.pin) {
|
||||
|
|
|
|||
|
|
@ -1412,7 +1412,7 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {
|
|||
if (selectsElement.length === 0) {
|
||||
selectsElement = [nodeElement];
|
||||
}
|
||||
AIActions(selectsElement, protyle)
|
||||
AIActions(selectsElement, protyle);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue