This commit is contained in:
Vanessa 2023-07-01 10:24:12 +08:00
parent 24c57bc647
commit ac61d16520
6 changed files with 105 additions and 1 deletions

View File

@ -1,5 +1,11 @@
document.body.insertAdjacentHTML('afterbegin', `<svg style="position: absolute; width: 0; height: 0; overflow: hidden;" xmlns="http://www.w3.org/2000/svg">
<defs>
<symbol id="iconNumber" viewBox="0 0 32 32">
<path d="M30.674 11.19c0.179 0 0.326-0.147 0.326-0.326v-2.446c0-0.179-0.147-0.326-0.326-0.326h-6.685v-6.766c0-0.179-0.147-0.326-0.326-0.326h-2.609c-0.179 0-0.326 0.147-0.326 0.326v6.766h-9.293v-6.766c0-0.179-0.147-0.326-0.326-0.326h-2.609c-0.179 0-0.326 0.147-0.326 0.326v6.766h-6.848c-0.179 0-0.326 0.147-0.326 0.326v2.446c0 0.179 0.147 0.326 0.326 0.326h6.848v9.62h-6.848c-0.179 0-0.326 0.147-0.326 0.326v2.446c0 0.179 0.147 0.326 0.326 0.326h6.848v6.766c0 0.179 0.147 0.326 0.326 0.326h2.609c0.179 0 0.326-0.147 0.326-0.326v-6.766h9.293v6.766c0 0.179 0.147 0.326 0.326 0.326h2.609c0.179 0 0.326-0.147 0.326-0.326v-6.766h6.685c0.179 0 0.326-0.147 0.326-0.326v-2.446c0-0.179-0.147-0.326-0.326-0.326h-6.685v-9.62h6.685zM20.728 20.81h-9.293v-9.62h9.293v9.62z"></path>
</symbol>
<symbol id="iconCalendar" viewBox="0 0 32 32">
<path d="M29.8 3.7h-6.3v-2.4c0-0.165-0.135-0.3-0.3-0.3h-2.1c-0.165 0-0.3 0.135-0.3 0.3v2.4h-9.6v-2.4c0-0.165-0.135-0.3-0.3-0.3h-2.1c-0.165 0-0.3 0.135-0.3 0.3v2.4h-6.3c-0.664 0-1.2 0.536-1.2 1.2v24.9c0 0.664 0.536 1.2 1.2 1.2h27.6c0.664 0 1.2-0.536 1.2-1.2v-24.9c0-0.664-0.536-1.2-1.2-1.2zM28.3 28.3h-24.6v-14.25h24.6v14.25zM3.7 11.5v-5.1h4.8v1.8c0 0.165 0.135 0.3 0.3 0.3h2.1c0.165 0 0.3-0.135 0.3-0.3v-1.8h9.6v1.8c0 0.165 0.135 0.3 0.3 0.3h2.1c0.165 0 0.3-0.135 0.3-0.3v-1.8h4.8v5.1h-24.6z"></path>
</symbol>
<symbol id="iconIndeterminateCheck" viewBox="0 0 32 32">
<path d="M9.1 17.2h13.8c0.165 0 0.3-0.135 0.3-0.3v-1.8c0-0.165-0.135-0.3-0.3-0.3h-13.8c-0.165 0-0.3 0.135-0.3 0.3v1.8c0 0.165 0.135 0.3 0.3 0.3z"></path>
<path d="M29.8 1h-27.6c-0.664 0-1.2 0.536-1.2 1.2v27.6c0 0.664 0.536 1.2 1.2 1.2h27.6c0.664 0 1.2-0.536 1.2-1.2v-27.6c0-0.664-0.536-1.2-1.2-1.2zM28.3 28.3h-24.6v-24.6h24.6v24.6z"></path>

View File

@ -28,6 +28,18 @@
<body>
<h2>SiYuan</h2>
<div class="fn__clear">
<div>
<svg>
<use xlink:href="#iconCalendar"></use>
</svg>
iconCalendar
</div>
<div>
<svg>
<use xlink:href="#iconNumber"></use>
</svg>
iconNumber
</div>
<div>
<svg>
<use xlink:href="#iconIndeterminateCheck"></use>

View File

@ -1,5 +1,11 @@
document.body.insertAdjacentHTML('afterbegin', `<svg style="position: absolute; width: 0; height: 0; overflow: hidden;" xmlns="http://www.w3.org/2000/svg">
<defs>
<symbol id="iconNumber" viewBox="0 0 32 32">
<path d="M31 12.25v-3.75h-7.5v-7.5h-3.75v7.5h-7.5v-7.5h-3.75v7.5h-7.5v3.75h7.5v7.5h-7.5v3.75h7.5v7.5h3.75v-7.5h7.5v7.5h3.75v-7.5h7.5v-3.75h-7.5v-7.5h7.5zM19.75 19.75h-7.5v-7.5h7.5v7.5z"></path>
</symbol>
<symbol id="iconCalendar" viewBox="0 0 32 32">
<path d="M26.5 4h-1.5v-3h-3v3h-12v-3h-3v3h-1.5c-1.665 0-2.985 1.35-2.985 3l-0.015 21c0 1.65 1.335 3 3 3h21c1.65 0 3-1.35 3-3v-21c0-1.65-1.35-3-3-3zM26.5 28h-21v-15h21v15zM26.5 10h-21v-3h21v3zM11.5 19h-3v-3h3v3zM17.5 19h-3v-3h3v3zM23.5 19h-3v-3h3v3zM11.5 25h-3v-3h3v3zM17.5 25h-3v-3h3v3zM23.5 25h-3v-3h3v3z"></path>
</symbol>
<symbol id="iconIndeterminateCheck" viewBox="0 0 32 32">
<path d="M27.667 1h-23.333c-1.833 0-3.333 1.5-3.333 3.333v23.333c0 1.833 1.5 3.333 3.333 3.333h23.333c1.833 0 3.333-1.5 3.333-3.333v-23.333c0-1.833-1.5-3.333-3.333-3.333zM27.667 27.667h-23.333v-23.333h23.333v23.333zM7.667 14.333h16.667v3.333h-16.667z"></path>
</symbol>

View File

@ -1,4 +1,8 @@
{
"number": "数字",
"date": "日期",
"select": "单选",
"multiSelect": "多选",
"commandEmpty": "暂无命令,点击前往集市下载更多插件",
"commandPanel": "命令面板",
"cloudRegionNorthAmerica": "流云(北美数据中心)",

View File

@ -34,6 +34,82 @@ export const avClick = (protyle: IProtyle, event: MouseEvent & { target: HTMLEle
}]);
}
});
menu.addItem({
icon: "iconNumber",
label: window.siyuan.languages.number,
click() {
const id = Lute.NewNodeID();
const type = "text";
transaction(protyle, [{
action: "addAttrViewCol",
name: "Text",
parentID: blockElement.getAttribute("data-av-id"),
type,
id
}], [{
action: "removeAttrViewCol",
id,
parentID: blockElement.getAttribute("data-av-id"),
}]);
}
});
menu.addItem({
icon: "iconListItem",
label: window.siyuan.languages.select,
click() {
const id = Lute.NewNodeID();
const type = "text";
transaction(protyle, [{
action: "addAttrViewCol",
name: "Text",
parentID: blockElement.getAttribute("data-av-id"),
type,
id
}], [{
action: "removeAttrViewCol",
id,
parentID: blockElement.getAttribute("data-av-id"),
}]);
}
});
menu.addItem({
icon: "iconList",
label: window.siyuan.languages.multiSelect,
click() {
const id = Lute.NewNodeID();
const type = "text";
transaction(protyle, [{
action: "addAttrViewCol",
name: "Text",
parentID: blockElement.getAttribute("data-av-id"),
type,
id
}], [{
action: "removeAttrViewCol",
id,
parentID: blockElement.getAttribute("data-av-id"),
}]);
}
});
menu.addItem({
icon: "iconCalendar",
label: window.siyuan.languages.date,
click() {
const id = Lute.NewNodeID();
const type = "text";
transaction(protyle, [{
action: "addAttrViewCol",
name: "Text",
parentID: blockElement.getAttribute("data-av-id"),
type,
id
}], [{
action: "removeAttrViewCol",
id,
parentID: blockElement.getAttribute("data-av-id"),
}]);
}
});
const addRect = addElement.getBoundingClientRect();
menu.open({
x: addRect.left,

View File

@ -8,7 +8,7 @@ export const popTextCell = (protyle: IProtyle, cellElement: HTMLElement) => {
const cellRect = cellElement.getBoundingClientRect();
let html = "";
if (type === "block" || type === "text") {
html = `<textarea style="position:absolute;left: ${cellRect.left}px;top: ${cellRect.top}px;width:${Math.max(cellRect.width, 200)}px" class="b3-text-field">${cellElement.textContent}</textarea>`;
html = `<textarea style="position:absolute;left: ${cellRect.left}px;top: ${cellRect.top}px;width:${Math.max(cellRect.width, 200)}px;height: ${cellRect.height}px" class="b3-text-field">${cellElement.textContent}</textarea>`;
}
document.body.insertAdjacentHTML("beforeend", `<div class="av__mask">
${html}