mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-22 09:30:14 +01:00
This commit is contained in:
parent
648d00e587
commit
c8177c262e
4 changed files with 12 additions and 8 deletions
|
|
@ -15,14 +15,14 @@ export const openByMobile = (uri: string) => {
|
|||
}
|
||||
};
|
||||
|
||||
export const readText = async () => {
|
||||
export const readText = () => {
|
||||
if ("android" === window.siyuan.config.system.container && window.JSAndroid) {
|
||||
return window.JSAndroid.readClipboard();
|
||||
}
|
||||
return navigator.clipboard.readText();
|
||||
};
|
||||
|
||||
export const writeText = async (text: string) => {
|
||||
export const writeText = (text: string) => {
|
||||
let range: Range;
|
||||
if (getSelection().rangeCount > 0) {
|
||||
range = getSelection().getRangeAt(0).cloneRange();
|
||||
|
|
@ -37,7 +37,6 @@ export const writeText = async (text: string) => {
|
|||
window.webkit.messageHandlers.setClipboard.postMessage(text);
|
||||
return;
|
||||
}
|
||||
|
||||
navigator.clipboard.writeText(text);
|
||||
} catch (e) {
|
||||
if (window.siyuan.config.system.container === "ios" && window.webkit?.messageHandlers) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue