mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-21 00:50:13 +01:00
This commit is contained in:
parent
b27460fe90
commit
6fd2ee7d7c
2 changed files with 40 additions and 0 deletions
|
|
@ -53,6 +53,7 @@
|
||||||
border-radius: var(--b3-border-radius);
|
border-radius: var(--b3-border-radius);
|
||||||
padding: 4px 8px;
|
padding: 4px 8px;
|
||||||
line-height: 26px;
|
line-height: 26px;
|
||||||
|
min-height: 26px;
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
background-color: var(--b3-theme-background);
|
background-color: var(--b3-theme-background);
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,8 @@ import {getColIconByType, showColMenu} from "./col";
|
||||||
import {Constants} from "../../../constants";
|
import {Constants} from "../../../constants";
|
||||||
import {getCalcValue} from "./cell";
|
import {getCalcValue} from "./cell";
|
||||||
import * as dayjs from "dayjs";
|
import * as dayjs from "dayjs";
|
||||||
|
import {hasClosestByAttribute} from "../../util/hasClosest";
|
||||||
|
import {Menu} from "../../../plugin/Menu";
|
||||||
|
|
||||||
export const avRender = (element: Element, cb?: () => void) => {
|
export const avRender = (element: Element, cb?: () => void) => {
|
||||||
let avElements: Element[] = [];
|
let avElements: Element[] = [];
|
||||||
|
|
@ -262,6 +264,43 @@ export const renderAVAttribute = (element: HTMLElement, id: string) => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
element.innerHTML = html;
|
element.innerHTML = html;
|
||||||
|
element.addEventListener("click", (event) => {
|
||||||
|
const target = event.target as HTMLElement
|
||||||
|
const dateElement = hasClosestByAttribute(target, "data-type", "date")
|
||||||
|
if (dateElement) {
|
||||||
|
const dateMenu = new Menu("custom-attr-av-date", () => {
|
||||||
|
|
||||||
|
})
|
||||||
|
if (dateMenu.isOpen) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
dateMenu.addItem({
|
||||||
|
iconHTML:"",
|
||||||
|
label:`<input>`
|
||||||
|
})
|
||||||
|
// <div class="b3-menu__items">
|
||||||
|
// <div>
|
||||||
|
// <input type="datetime-local" value="${value}" class="b3-text-field fn__size200"><br>
|
||||||
|
// <input type="datetime-local" value="${value2}" style="margin-top: 8px" class="b3-text-field fn__size200${hasEndDate ? "" : " fn__none"}">
|
||||||
|
// <button class="b3-menu__separator"></button>
|
||||||
|
// <button class="b3-menu__item">
|
||||||
|
// <span>${window.siyuan.languages.endDate}</span>
|
||||||
|
// <span class="fn__space fn__flex-1"></span>
|
||||||
|
// <input type="checkbox" class="b3-switch fn__flex-center"${hasEndDate ? " checked" : ""}>
|
||||||
|
// </button>
|
||||||
|
// <button class="b3-menu__separator"></button>
|
||||||
|
// <button class="b3-menu__item" data-type="clearDate">
|
||||||
|
// <svg class="b3-menu__icon"><use xlink:href="#iconTrashcan"></use></svg>
|
||||||
|
// <span class="b3-menu__label">${window.siyuan.languages.clear}</span>
|
||||||
|
// </button>
|
||||||
|
// </div>
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const mSelectElement = hasClosestByAttribute(target, "data-type", "select")||hasClosestByAttribute(target, "data-type", "mSelect")
|
||||||
|
if (mSelectElement) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
})
|
||||||
element.querySelectorAll(".b3-text-field--text").forEach((item: HTMLInputElement) => {
|
element.querySelectorAll(".b3-text-field--text").forEach((item: HTMLInputElement) => {
|
||||||
item.addEventListener("change", () => {
|
item.addEventListener("change", () => {
|
||||||
let value;
|
let value;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue