Vanessa 2024-05-04 14:45:21 +08:00
parent 474a490f32
commit dc90ac1ec7
4 changed files with 8 additions and 4 deletions

View file

@ -15,12 +15,13 @@ export const addClearButton = (options: {
inputElement: HTMLInputElement,
clearCB?: () => void,
right?: number,
width?: string,
height?: number
className?: string
}) => {
options.inputElement.dataset.oldPaddingRight = options.inputElement.style.paddingRight;
options.inputElement.insertAdjacentHTML("afterend",
`<svg class="${options.className || "b3-form__icon-clear"} ariaLabel" aria-label="${window.siyuan.languages.clear}" style="${options.right ? "right: " + options.right + "px;" : ""}${options.height ? "height:" + options.height + "px" : ""}">
`<svg class="${options.className || "b3-form__icon-clear"} ariaLabel" aria-label="${window.siyuan.languages.clear}" style="${options.right ? "right: " + options.right + "px;" : ""}${options.height ? "height:" + options.height + "px;" : ""}${options.width ? "width:" + options.width : ""}">
<use xlink:href="#iconCloseRound"></use></svg>`);
const clearElement = options.inputElement.nextElementSibling;
clearElement.addEventListener("click", () => {