Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:tada: https://github.com/siyuan-note/siyuan/issues/10414

Vanessa6e0e0254b4af
diff --git a/app/appearance/icons/ant/icon.js b/app/appearance/icons/ant/icon.js
index 4e9088be82..4453571fe8 100644
--- a/app/appearance/icons/ant/icon.js
+++ b/app/appearance/icons/ant/icon.js
@@ -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>
diff --git a/app/appearance/icons/ant/icon.json b/app/appearance/icons/ant/icon.json
index 669816a924..6e5dceed1b 100644
--- a/app/appearance/icons/ant/icon.json
+++ b/app/appearance/icons/ant/icon.json
@@ -2,5 +2,5 @@
"name": "ant",
"author": "Vanessa",
"url": "https://github.com/Vanessa219",
- "version": "1.32.0"
+ "version": "1.33.0"
}
diff --git a/app/appearance/icons/index.html b/app/appearance/icons/index.html
index 51a1cd6f18..90bbac711b 100644
--- a/app/appearance/icons/index.html
+++ b/app/appearance/icons/index.html
@@ -34,6 +34,12 @@
</svg>
iconCamera
</div>
+ <div>
+ <svg>
+ <use xlink:href="#iconGallery"></use>
+ </svg>
+ iconGallery
+ </div>
<div>
<svg>
<use xlink:href="#iconTerminal"></use>
diff --git a/app/appearance/icons/material/icon.js b/app/appearance/icons/material/icon.js
index b61d9860f3..5b426af25a 100644
--- a/app/appearance/icons/material/icon.js
+++ b/app/appearance/icons/material/icon.js
@@ -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>
diff --git a/app/appearance/icons/material/icon.json b/app/appearance/icons/material/icon.json
index d0bbda16bd..9c3960a259 100644
--- a/app/appearance/icons/material/icon.json
+++ b/app/appearance/icons/material/icon.json
@@ -2,5 +2,5 @@
"name": "material",
"author": "Vanessa",
"url": "https://github.com/Vanessa219",
- "version": "1.32.0"
+ "version": "1.33.0"
}
diff --git a/app/appearance/langs/zh_CN.json b/app/appearance/langs/zh_CN.json
index 78fecc86d2..3a44c2817e 100644
--- a/app/appearance/langs/zh_CN.json
+++ b/app/appearance/langs/zh_CN.json
@@ -1,4 +1,5 @@
{
+ "gallery": "看板",
"newTag": "新建标签",
"pleaseWait": "请稍等片刻...",
"reconnectPrompt": "切换应用后再次进入需要一些时间恢复思源内核运行,请稍等几秒或者点击“重试”按钮",
diff --git a/app/src/protyle/render/av/view.ts b/app/src/protyle/render/av/view.ts
index 386523919b..d452aa1102 100644
--- a/app/src/protyle/render/av/view.ts
+++ b/app/src/protyle/render/av/view.ts
@@ -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
+ });
};