Skip to content

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

:art: https://github.com/siyuan-note/siyuan/issues/16100

Vanessae7758534706c
diff --git a/app/src/protyle/toolbar/index.ts b/app/src/protyle/toolbar/index.ts
index 9e77676ee5..406f217939 100644
--- a/app/src/protyle/toolbar/index.ts
+++ b/app/src/protyle/toolbar/index.ts
@@ -1291,7 +1291,7 @@ export class Toolbar {
`<b>${match}</b>`
);
};
-
+
inputElement.addEventListener("input", (event) => {
const value = inputElement.value.trim();
let matchLanguages;
@@ -1658,7 +1658,7 @@ ${item.name}
<button class="keyboard__action" data-action="select"><svg><use xlink:href="#iconSelect"></use></svg></button>`;
}
if (hasCopy || !protyle.disabled) {
- html += "<button class=\"keyboard__action\" data-action=\"more\"><svg><use xlink:href=\"#iconMore\"></use></svg></button>";
+ html += '<button class="keyboard__action" data-action="more"><svg><use xlink:href="#iconMore"></use></svg></button>';
}
this.subElement.innerHTML = `<div class="fn__flex">${html}</div>`;
this.subElement.lastElementChild.addEventListener("click", async (event) => {
diff --git a/app/src/protyle/util/compatibility.ts b/app/src/protyle/util/compatibility.ts
index c1bd8e015d..8c8967311f 100644
--- a/app/src/protyle/util/compatibility.ts
+++ b/app/src/protyle/util/compatibility.ts
@@ -126,6 +126,22 @@ export const getLocalFiles = async () => {
export const readClipboard = async () => {
const text: IClipboardData = {textPlain: "", textHTML: "", siyuanHTML: ""};
+ if (isInAndroid()) {
+ text.textPlain = window.JSAndroid.readClipboard();
+ text.textHTML = window.JSAndroid.readHTMLClipboard();
+ const textObj = getTextSiyuanFromTextHTML(text.textHTML);
+ text.textHTML = textObj.textHtml;
+ text.siyuanHTML = textObj.textSiyuan;
+ return text;
+ }
+ if (isInHarmony()) {
+ text.textPlain = window.JSHarmony.readClipboard();
+ text.textHTML = window.JSHarmony.readHTMLClipboard();
+ const textObj = getTextSiyuanFromTextHTML(text.textHTML);
+ text.textHTML = textObj.textHtml;
+ text.siyuanHTML = textObj.textSiyuan;
+ return text;
+ }
try {
const clipboardContents = await navigator.clipboard.read().catch(() => {
alert(window.siyuan.languages.clipboardPermissionDenied);
@@ -157,19 +173,6 @@ export const readClipboard = async () => {
/// #endif
return text;
} catch (e) {
- if (isInAndroid()) {
- text.textPlain = window.JSAndroid.readClipboard();
- text.textHTML = window.JSAndroid.readHTMLClipboard();
- const textObj = getTextSiyuanFromTextHTML(text.textHTML);
- text.textHTML = textObj.textHtml;
- text.siyuanHTML = textObj.textSiyuan;
- } else if (isInHarmony()) {
- text.textPlain = window.JSHarmony.readClipboard();
- text.textHTML = window.JSHarmony.readHTMLClipboard();
- const textObj = getTextSiyuanFromTextHTML(text.textHTML);
- text.textHTML = textObj.textHtml;
- text.siyuanHTML = textObj.textSiyuan;
- }
return text;
}
};
@@ -298,7 +301,7 @@ export const getScreenWidth = () => {
return window.JSHarmony.getScreenWidthPx();
}
return window.outerWidth;
-}
+};
export const isWindows = () => {
return navigator.platform.toUpperCase().indexOf("WIN") > -1;
@@ -532,7 +535,7 @@ export const initFocusFix = () => {
const fixFocusAfterDialog = () => {
ipcRenderer.send("siyuan-focus-fix");
};
- window.alert = function(message: string) {
+ window.alert = function (message: string) {
try {
const result = originalAlert.call(this, message);
fixFocusAfterDialog();
@@ -543,7 +546,7 @@ export const initFocusFix = () => {
return undefined;
}
};
- window.confirm = function(message: string) {
+ window.confirm = function (message: string) {
try {
const result = originalConfirm.call(this, message);
fixFocusAfterDialog();
@@ -555,4 +558,4 @@ export const initFocusFix = () => {
}
};
};
-/// #endif
\ No newline at end of file
+/// #endif