mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-21 00:50:13 +01:00
This commit is contained in:
parent
cbcc8141a8
commit
3f21eda746
5 changed files with 82 additions and 5 deletions
|
|
@ -1,12 +1,12 @@
|
|||
const update = (inputElement: HTMLInputElement, clearElement: Element, right: number) => {
|
||||
if (inputElement.value === "") {
|
||||
clearElement.classList.add("fn__none");
|
||||
if (right) {
|
||||
inputElement.style.paddingRight = "";
|
||||
if (typeof right === "number") {
|
||||
inputElement.style.paddingRight = inputElement.dataset.oldPaddingRight;
|
||||
}
|
||||
} else {
|
||||
clearElement.classList.remove("fn__none");
|
||||
if (right) {
|
||||
if (typeof right === "number") {
|
||||
inputElement.style.setProperty("padding-right", `${right * 2 + clearElement.clientWidth}px`, "important");
|
||||
}
|
||||
}
|
||||
|
|
@ -18,6 +18,7 @@ export const addClearButton = (options: {
|
|||
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" : ""}">
|
||||
<use xlink:href="#iconCloseRound"></use></svg>`);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue