mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-05-15 00:21:00 +08:00
This commit is contained in:
parent
b833087cb6
commit
b709c84585
@ -48,7 +48,7 @@ export const genAVValueHTML = (value: IAVCellValue) => {
|
||||
<a href="tel:${value.phone.content}" target="_blank" aria-label="${window.siyuan.languages.openBy}" class="block__icon block__icon--show fn__flex-center b3-tooltips__w b3-tooltips"><svg><use xlink:href="#iconPhone"></use></svg></a>`;
|
||||
break;
|
||||
case "template":
|
||||
html = `<input value="${value.template.content}" class="b3-text-field b3-text-field--text fn__flex-1">`;
|
||||
html = `<div class="fn__flex-1">${value.template.content}</div>`;
|
||||
break;
|
||||
case "email":
|
||||
html = `<input value="${value.email.content}" class="b3-text-field b3-text-field--text fn__flex-1">
|
||||
@ -120,7 +120,7 @@ class="fn__flex-1 fn__flex${["url", "text", "number", "email", "phone", "templat
|
||||
element.querySelectorAll(".b3-text-field--text").forEach((item: HTMLInputElement) => {
|
||||
item.addEventListener("change", () => {
|
||||
let value;
|
||||
if (["url", "text", "email", "phone", "template"].includes(item.parentElement.dataset.type)) {
|
||||
if (["url", "text", "email", "phone"].includes(item.parentElement.dataset.type)) {
|
||||
value = {
|
||||
[item.parentElement.dataset.type]: {
|
||||
content: item.value
|
||||
|
@ -85,7 +85,7 @@ export const genCellValue = (colType: TAVCol, value: string | any) => {
|
||||
}
|
||||
};
|
||||
}
|
||||
} else if (["text", "block", "url", "phone", "email", "template"].includes(colType)) {
|
||||
} else if (["text", "block", "url", "phone", "email"].includes(colType)) {
|
||||
cellValue = {
|
||||
type: colType,
|
||||
[colType]: {
|
||||
@ -344,6 +344,9 @@ export const popTextCell = (protyle: IProtyle, cellElements: HTMLElement[], type
|
||||
if (!type) {
|
||||
type = cellElements[0].parentElement.parentElement.firstElementChild.querySelector(`[data-col-id="${cellElements[0].getAttribute("data-col-id")}"]`).getAttribute("data-dtype") as TAVCol;
|
||||
}
|
||||
if (type === "template") {
|
||||
return;
|
||||
}
|
||||
if (type === "block" && (cellElements.length > 1 || !cellElements[0].getAttribute("data-detached"))) {
|
||||
return;
|
||||
}
|
||||
@ -353,9 +356,7 @@ export const popTextCell = (protyle: IProtyle, cellElements: HTMLElement[], type
|
||||
const blockElement = hasClosestBlock(cellElements[0]);
|
||||
if (["text", "url", "email", "phone", "block"].includes(type)) {
|
||||
html = `<textarea ${style} class="b3-text-field">${cellElements[0].firstElementChild.textContent}</textarea>`;
|
||||
} else if (type === "template") {
|
||||
html = `<textarea ${style} class="b3-text-field">${cellElements[0].firstElementChild.getAttribute("data-content")}</textarea>`;
|
||||
}else if (type === "number") {
|
||||
} else if (type === "number") {
|
||||
html = `<input type="number" value="${cellElements[0].firstElementChild.getAttribute("data-content")}" ${style} class="b3-text-field">`;
|
||||
} else if (["select", "mSelect"].includes(type) && blockElement) {
|
||||
openMenuPanel({protyle, blockElement, type: "select", cellElements});
|
||||
|
@ -62,10 +62,8 @@ style="width: ${column.width || "200px"}">${getCalcValue(column) || '<svg><use x
|
||||
return;
|
||||
}
|
||||
let text = "";
|
||||
if (cell.valueType === "text") {
|
||||
text = `<span class="av__celltext">${cell.value?.text.content || ""}</span>`;
|
||||
} else if (cell.valueType === "template") {
|
||||
text = `<span class="av__celltext" data-content="${cell.value?.template.content || ""}">${cell.value?.template.renderedContent || ""}</span>`;
|
||||
if (["text", "template"].includes(cell.valueType)) {
|
||||
text = `<span class="av__celltext">${cell.value ? cell.value[cell.valueType as "text"].content : ""}</span>`;
|
||||
} else if (["url", "email", "phone"].includes(cell.valueType)) {
|
||||
const urlContent = cell.value ? cell.value[cell.valueType as "url"].content : "";
|
||||
// https://github.com/siyuan-note/siyuan/issues/9291
|
||||
|
1
app/src/types/index.d.ts
vendored
1
app/src/types/index.d.ts
vendored
@ -1075,7 +1075,6 @@ interface IAVCellValue {
|
||||
}
|
||||
template?: {
|
||||
content: string
|
||||
renderedContent?:string
|
||||
}
|
||||
date?: IAVCellDateValue
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user