添加占位符

This commit is contained in:
Jeffrey Chen 2024-11-24 15:48:43 +08:00
parent 03e079e187
commit 1e2aed3fe5
2 changed files with 8 additions and 12 deletions

View file

@ -71,6 +71,11 @@
background-color: transparent;
}
}
& > [data-dtype]:empty:before {
color: var(--b3-empty-color);
content: attr(placeholder);
}
}
.b3-text-field--text {
@ -78,13 +83,6 @@
min-height: 34px;
background-color: transparent;
padding: 7px 8px;
&:empty {
&:before {
color: var(--b3-empty-color);
content: attr(placeholder);
}
}
&:hover {
background-color: var(--b3-theme-background);

View file

@ -62,7 +62,7 @@ export const genAVValueHTML = (value: IAVCellValue) => {
html = `<textarea style="resize: vertical" rows="${value.text.content.split("\n").length}" class="b3-text-field b3-text-field--text fn__flex-1" placeholder="${window.siyuan.languages.empty}">${value.text.content}</textarea>`;
break;
case "number":
html = `<input value="${value.number.isNotEmpty ? value.number.content : ""}" type="number" class="b3-text-field b3-text-field--text fn__flex-1">
html = `<input value="${value.number.isNotEmpty ? value.number.content : ""}" type="number" class="b3-text-field b3-text-field--text fn__flex-1" placeholder="${window.siyuan.languages.empty}">
<span class="fn__space"></span><span class="fn__flex-center ft__on-surface b3-tooltips__w b3-tooltips" aria-label="${window.siyuan.languages.format}">${value.number.formattedContent}</span><span class="fn__space"></span>`;
break;
case "mSelect":
@ -188,10 +188,8 @@ export const renderAVAttribute = (element: HTMLElement, id: string, protyle: IPr
<span>${escapeHtml(item.key.name)}</span>
</div>
<div data-av-id="${table.avID}" data-col-id="${item.values[0].keyID}" data-block-id="${item.values[0].blockID}" data-id="${item.values[0].id}" data-type="${item.values[0].type}"
data-options="${item.key?.options ? escapeAttr(JSON.stringify(item.key.options)) : "[]"}"
class="fn__flex-1 fn__flex${["url", "text", "number", "email", "phone"].includes(item.values[0].type) ? "" : ["block", "created", "updated"].includes(item.values[0].type) ? " custom-attr__avvalue--readonly" : " custom-attr__avvalue"}">
${genAVValueHTML(item.values[0])}
</div>
data-options="${item.key?.options ? escapeAttr(JSON.stringify(item.key.options)) : "[]"}" placeholder="${window.siyuan.languages.empty}"
class="fn__flex-1 fn__flex${["url", "text", "number", "email", "phone"].includes(item.values[0].type) ? "" : ["block", "created", "updated"].includes(item.values[0].type) ? " custom-attr__avvalue--readonly" : " custom-attr__avvalue"}">${genAVValueHTML(item.values[0])}</div>
</div>`;
});
innerHTML += `<div class="fn__hr"></div>