Vanessa 2025-06-08 23:16:07 +08:00
parent 66d97d25b1
commit 6e0e0254b4
7 changed files with 61 additions and 14 deletions

View file

@ -1,5 +1,8 @@
document.body.insertAdjacentHTML('afterbegin', `<svg style="position: absolute; width: 0; height: 0; overflow: hidden;" xmlns="http://www.w3.org/2000/svg">
<defs>
<symbol id="iconGallery" viewBox="0 0 32 32">
<path d="M27.8 4.2h-23.6c-1.623 0-2.95 1.327-2.95 2.95v17.7c0 1.622 1.327 2.95 2.95 2.95h23.6c1.622 0 2.95-1.328 2.95-2.95v-17.7c0-1.623-1.328-2.95-2.95-2.95zM10.1 24.85h-5.9v-17.7h5.9v17.7zM18.95 24.85h-5.9v-17.7h5.9v17.7zM27.8 24.85h-5.9v-17.7h5.9v17.7z"></path>
</symbol>
<symbol id="iconTerminal" viewBox="0 0 32 32">
<path d="M10.044 21.956c-0.447 0-0.744-0.149-1.042-0.447-0.596-0.596-0.596-1.489 0-2.084l3.424-3.424-3.424-3.424c-0.596-0.596-0.596-1.489 0-2.084s1.489-0.596 2.084 0l4.467 4.467c0.596 0.596 0.596 1.489 0 2.084l-4.467 4.467c-0.298 0.298-0.596 0.447-1.042 0.447zM21.956 21.956h-4.467c-0.893 0-1.489-0.596-1.489-1.489s0.596-1.489 1.489-1.489h4.467c0.893 0 1.489 0.596 1.489 1.489s-0.596 1.489-1.489 1.489z"></path>
<path d="M26.422 29.4h-20.844c-2.531 0-4.467-1.936-4.467-4.467v-17.867c0-2.531 1.936-4.467 4.467-4.467h20.844c2.531 0 4.467 1.936 4.467 4.467v17.867c0 2.531-1.936 4.467-4.467 4.467zM5.578 5.578c-0.893 0-1.489 0.596-1.489 1.489v17.867c0 0.893 0.596 1.489 1.489 1.489h20.844c0.893 0 1.489-0.596 1.489-1.489v-17.867c0-0.893-0.596-1.489-1.489-1.489h-20.844z"></path>

View file

@ -2,5 +2,5 @@
"name": "ant",
"author": "Vanessa",
"url": "https://github.com/Vanessa219",
"version": "1.32.0"
"version": "1.33.0"
}

View file

@ -34,6 +34,12 @@
</svg>
iconCamera
</div>
<div>
<svg>
<use xlink:href="#iconGallery"></use>
</svg>
iconGallery
</div>
<div>
<svg>
<use xlink:href="#iconTerminal"></use>

View file

@ -1,5 +1,8 @@
document.body.insertAdjacentHTML('afterbegin', `<svg style="position: absolute; width: 0; height: 0; overflow: hidden;" xmlns="http://www.w3.org/2000/svg">
<defs>
<symbol id="iconGallery" viewBox="0 0 32 32">
<path d="M27.8 4.2h-23.6c-1.623 0-2.95 1.327-2.95 2.95v17.7c0 1.622 1.327 2.95 2.95 2.95h23.6c1.622 0 2.95-1.328 2.95-2.95v-17.7c0-1.623-1.328-2.95-2.95-2.95zM10.1 24.85h-5.9v-17.7h5.9v17.7zM18.95 24.85h-5.9v-17.7h5.9v17.7zM27.8 24.85h-5.9v-17.7h5.9v17.7z"></path>
</symbol>
<symbol id="iconTerminal" viewBox="0 0 32 32">
<path d="M10.044 21.956c-0.447 0-0.744-0.149-1.042-0.447-0.596-0.596-0.596-1.489 0-2.084l3.424-3.424-3.424-3.424c-0.596-0.596-0.596-1.489 0-2.084s1.489-0.596 2.084 0l4.467 4.467c0.596 0.596 0.596 1.489 0 2.084l-4.467 4.467c-0.298 0.298-0.596 0.447-1.042 0.447zM21.956 21.956h-4.467c-0.893 0-1.489-0.596-1.489-1.489s0.596-1.489 1.489-1.489h4.467c0.893 0 1.489 0.596 1.489 1.489s-0.596 1.489-1.489 1.489z"></path>
<path d="M26.422 29.4h-20.844c-2.531 0-4.467-1.936-4.467-4.467v-17.867c0-2.531 1.936-4.467 4.467-4.467h20.844c2.531 0 4.467 1.936 4.467 4.467v17.867c0 2.531-1.936 4.467-4.467 4.467zM5.578 5.578c-0.893 0-1.489 0.596-1.489 1.489v17.867c0 0.893 0.596 1.489 1.489 1.489h20.844c0.893 0 1.489-0.596 1.489-1.489v-17.867c0-0.893-0.596-1.489-1.489-1.489h-20.844z"></path>

View file

@ -2,5 +2,5 @@
"name": "material",
"author": "Vanessa",
"url": "https://github.com/Vanessa219",
"version": "1.32.0"
"version": "1.33.0"
}

View file

@ -1,4 +1,5 @@
{
"gallery": "看板",
"newTag": "新建标签",
"pleaseWait": "请稍等片刻...",
"reconnectPrompt": "切换应用后再次进入需要一些时间恢复思源内核运行,请稍等几秒或者点击“重试”按钮",

View file

@ -346,16 +346,50 @@ export const getSwitcherHTML = (views: IAVView[], viewId: string) => {
export const addView = (protyle: IProtyle, blockElement: Element) => {
const id = Lute.NewNodeID();
const avID = blockElement.getAttribute("data-av-id");
transaction(protyle, [{
action: "addAttrViewView",
avID,
id,
blockID: blockElement.getAttribute("data-node-id")
}], [{
action: "removeAttrViewView",
avID,
id,
blockID: blockElement.getAttribute("data-node-id")
}]);
blockElement.setAttribute(Constants.CUSTOM_SY_AV_VIEW, id);
const viewElement = blockElement.querySelector(".av__views");
const addMenu = new Menu(undefined, () => {
viewElement.classList.remove("av__views--show");
});
addMenu.addItem({
icon: "iconTable",
label: window.siyuan.languages.table,
click() {
transaction(protyle, [{
action: "addAttrViewView",
avID,
id,
blockID: blockElement.getAttribute("data-node-id")
}], [{
action: "removeAttrViewView",
avID,
id,
blockID: blockElement.getAttribute("data-node-id")
}]);
blockElement.setAttribute(Constants.CUSTOM_SY_AV_VIEW, id);
}
});
addMenu.addItem({
icon: "iconGallery",
label: window.siyuan.languages.gallery,
click() {
transaction(protyle, [{
action: "addAttrViewView",
avID,
id,
blockID: blockElement.getAttribute("data-node-id")
}], [{
action: "removeAttrViewView",
avID,
id,
blockID: blockElement.getAttribute("data-node-id")
}]);
blockElement.setAttribute(Constants.CUSTOM_SY_AV_VIEW, id);
}
});
viewElement.classList.add("av__views--show");
const addRect = viewElement.querySelector('.block__icon[data-type="av-add"]')?.getBoundingClientRect();
addMenu.open({
x: addRect.left,
y: addRect.bottom + 8
});
};