Skip to content

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

:art: copy asset https://github.com/siyuan-note/siyuan/issues/8383

Vanessa2d2f80cff147
diff --git a/app/src/config/image.ts b/app/src/config/image.ts
index 93ac63cf1b..67cf9c5f9a 100644
--- a/app/src/config/image.ts
+++ b/app/src/config/image.ts
@@ -7,6 +7,7 @@ import {fetchPost} from "../util/fetch";
import {getAllModels} from "../layout/getAll";
import {openBy} from "../editor/util";
import {renderAssetsPreview} from "../asset/renderAssets";
+import {writeText} from "../protyle/util/compatibility";
export const image = {
element: undefined as Element,
@@ -87,6 +88,8 @@ export const image = {
event.preventDefault();
event.stopPropagation();
break;
+ } else if (type === "copy") {
+ writeText(target.parentElement.querySelector(".b3-list-item__text").textContent.trim());
} else if (type === "open") {
/// #if !BROWSER
openBy(target.parentElement.getAttribute("data-path"), "folder");
@@ -139,16 +142,23 @@ export const image = {
<svg><use xlink:href="#iconFolder"></use></svg>
</span>`;
}
- const boxClearHTML = `<span data-type="clear" class="b3-tooltips b3-tooltips__w b3-list-item__action" aria-label="${window.siyuan.languages.delete}">
+ let boxClearHTML = ""
+ if (action) {
+ boxClearHTML = `<span data-type="clear" class="b3-tooltips b3-tooltips__w b3-list-item__action" aria-label="${window.siyuan.languages.delete}">
<svg><use xlink:href="#iconTrashcan"></use></svg>
</span>`;
+ } else {
+ boxClearHTML = `<span data-type="copy" class="b3-tooltips b3-tooltips__w b3-list-item__action" aria-label="${window.siyuan.languages.copy}">
+ <svg><use xlink:href="#iconCopy"></use></svg>
+</span>`;
+ }
data.forEach((item) => {
const idx = item.indexOf("assets/");
const dataPath = item.substr(idx);
html += `<li data-path="${dataPath}" class="b3-list-item b3-list-item--hide-action">
<span class="b3-list-item__text">${escapeHtml(item)}</span>
${boxOpenHTML}
- ${action ? boxClearHTML : ""}
+ ${boxClearHTML}
</li>`;
});
element.innerHTML = html || `<li class="b3-list--empty">${window.siyuan.languages.emptyContent}</li>`;