mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-17 15:10:12 +01:00
This commit is contained in:
parent
31190aaa93
commit
a316785f70
6 changed files with 43 additions and 4 deletions
|
|
@ -183,12 +183,21 @@
|
||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
[data-type="block-ref"] {
|
[data-type="block-ref"],
|
||||||
|
[data-type="a"] {
|
||||||
display: none;
|
display: none;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
right: 5px;
|
right: 5px;
|
||||||
font-size: 10px;
|
font-size: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&:hover [data-type="a"] {
|
||||||
|
display: block;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
border-bottom: 0 !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
&__cellheader {
|
&__cellheader {
|
||||||
|
|
@ -206,6 +215,10 @@
|
||||||
.b3-chip {
|
.b3-chip {
|
||||||
margin: 1px 2px;
|
margin: 1px 2px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&--url {
|
||||||
|
text-decoration: underline var(--b3-border-color);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
&__firstcol {
|
&__firstcol {
|
||||||
|
|
|
||||||
|
|
@ -94,5 +94,23 @@ export const addCol = (protyle: IProtyle, blockElement: HTMLElement) => {
|
||||||
}]);
|
}]);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
menu.addItem({
|
||||||
|
icon: "iconLink",
|
||||||
|
label: window.siyuan.languages.link,
|
||||||
|
click() {
|
||||||
|
const id = Lute.NewNodeID();
|
||||||
|
transaction(protyle, [{
|
||||||
|
action: "addAttrViewCol",
|
||||||
|
name: "Link",
|
||||||
|
avID,
|
||||||
|
type: "url",
|
||||||
|
id
|
||||||
|
}], [{
|
||||||
|
action: "removeAttrViewCol",
|
||||||
|
id,
|
||||||
|
avID,
|
||||||
|
}]);
|
||||||
|
}
|
||||||
|
});
|
||||||
return menu;
|
return menu;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -343,7 +343,7 @@ export const popTextCell = (protyle: IProtyle, cellElements: HTMLElement[]) => {
|
||||||
let html = "";
|
let html = "";
|
||||||
const style = `style="position:absolute;left: ${cellRect.left}px;top: ${cellRect.top}px;width:${Math.max(cellRect.width, 200)}px;height: ${cellRect.height}px"`;
|
const style = `style="position:absolute;left: ${cellRect.left}px;top: ${cellRect.top}px;width:${Math.max(cellRect.width, 200)}px;height: ${cellRect.height}px"`;
|
||||||
const blockElement = hasClosestBlock(cellElements[0]);
|
const blockElement = hasClosestBlock(cellElements[0]);
|
||||||
if (type === "block" || type === "text") {
|
if (["block", "text", "url"].includes(type)) {
|
||||||
html = `<textarea ${style} class="b3-text-field">${cellElements[0].firstElementChild.textContent}</textarea>`;
|
html = `<textarea ${style} class="b3-text-field">${cellElements[0].firstElementChild.textContent}</textarea>`;
|
||||||
} else if (type === "number") {
|
} else if (type === "number") {
|
||||||
html = `<input type="number" value="${cellElements[0].textContent}" ${style} class="b3-text-field">`;
|
html = `<input type="number" value="${cellElements[0].textContent}" ${style} class="b3-text-field">`;
|
||||||
|
|
|
||||||
|
|
@ -217,6 +217,8 @@ export const getColIconByType = (type: TAVCol) => {
|
||||||
return "iconList";
|
return "iconList";
|
||||||
case "date":
|
case "date":
|
||||||
return "iconCalendar";
|
return "iconCalendar";
|
||||||
|
case "url":
|
||||||
|
return "iconLink";
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ export const getDefaultOperatorByType = (type: TAVCol) => {
|
||||||
if (type === "number" || type === "select") {
|
if (type === "number" || type === "select") {
|
||||||
return "=";
|
return "=";
|
||||||
}
|
}
|
||||||
if (type === "text" || type === "mSelect") {
|
if (type === "text" || type === "mSelect" || type === "url") {
|
||||||
return "Contains";
|
return "Contains";
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
@ -132,6 +132,7 @@ export const setFilter = (options: {
|
||||||
});
|
});
|
||||||
switch (colData.type) {
|
switch (colData.type) {
|
||||||
case "text":
|
case "text":
|
||||||
|
case "url":
|
||||||
selectHTML = `<option ${"=" === options.filter.operator ? "selected" : ""} value="=">${window.siyuan.languages.filterOperatorIs}</option>
|
selectHTML = `<option ${"=" === options.filter.operator ? "selected" : ""} value="=">${window.siyuan.languages.filterOperatorIs}</option>
|
||||||
<option ${"!=" === options.filter.operator ? "selected" : ""} value="!=">${window.siyuan.languages.filterOperatorIsNot}</option>
|
<option ${"!=" === options.filter.operator ? "selected" : ""} value="!=">${window.siyuan.languages.filterOperatorIsNot}</option>
|
||||||
<option ${"Contains" === options.filter.operator ? "selected" : ""} value="Contains">${window.siyuan.languages.filterOperatorContains}</option>
|
<option ${"Contains" === options.filter.operator ? "selected" : ""} value="Contains">${window.siyuan.languages.filterOperatorContains}</option>
|
||||||
|
|
@ -205,7 +206,7 @@ export const setFilter = (options: {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
} else if (colData.type === "text") {
|
} else if (colData.type === "text" || colData.type === "url") {
|
||||||
menu.addItem({
|
menu.addItem({
|
||||||
iconHTML: "",
|
iconHTML: "",
|
||||||
label: `<input style="margin: 4px 0" value="${options.filter.value?.text.content || ""}" class="b3-text-field fn__size200">`
|
label: `<input style="margin: 4px 0" value="${options.filter.value?.text.content || ""}" class="b3-text-field fn__size200">`
|
||||||
|
|
|
||||||
|
|
@ -61,6 +61,11 @@ style="width: ${column.width || "200px"}">${getCalcValue(column) || '<svg><use x
|
||||||
let text = "";
|
let text = "";
|
||||||
if (cell.valueType === "text") {
|
if (cell.valueType === "text") {
|
||||||
text = `<span class="av__celltext">${cell.value?.text.content || ""}</span>`;
|
text = `<span class="av__celltext">${cell.value?.text.content || ""}</span>`;
|
||||||
|
} else if (cell.valueType === "url") {
|
||||||
|
text = `<span class="av__celltext av__celltext--url">${cell.value?.url.content || ""}</span>`;
|
||||||
|
if (cell.value?.url.content) {
|
||||||
|
text += `<span class="b3-chip b3-chip--info b3-chip--small" data-type="a" data-href="${cell.value.url.content}">${window.siyuan.languages.openBy}</span>`;
|
||||||
|
}
|
||||||
} else if (cell.valueType === "block") {
|
} else if (cell.valueType === "block") {
|
||||||
text = `<span class="av__celltext">${cell.value?.block.content || ""}</span>`;
|
text = `<span class="av__celltext">${cell.value?.block.content || ""}</span>`;
|
||||||
if (cell.value?.block.id) {
|
if (cell.value?.block.id) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue