Skip to content

Commit

Permalink
添加占位符
Browse files Browse the repository at this point in the history
  • Loading branch information
TCOTC committed Nov 24, 2024
1 parent 03e079e commit 1e2aed3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 12 deletions.
12 changes: 5 additions & 7 deletions app/src/assets/scss/business/_custom.scss
Original file line number Diff line number Diff line change
Expand Up @@ -71,20 +71,18 @@
background-color: transparent;
}
}

& > [data-dtype]:empty:before {
color: var(--b3-empty-color);
content: attr(placeholder);
}
}

.b3-text-field--text {
transition: var(--b3-transition);
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);
Expand Down
8 changes: 3 additions & 5 deletions app/src/protyle/render/av/blockAttr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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":
Expand Down Expand Up @@ -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>
Expand Down

0 comments on commit 1e2aed3

Please sign in to comment.