mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-07-03 14:09:06 +02:00
🎨 Improve heading block copying on Android and HarmonyOS https://github.com/siyuan-note/siyuan/issues/16946
Signed-off-by: Daniel <845765@qq.com>
This commit is contained in:
@@ -1834,9 +1834,9 @@ export class Gutter {
|
||||
removeFoldAttr: nodeElement.getAttribute("fold") !== "1"
|
||||
}, (response) => {
|
||||
if (isInAndroid()) {
|
||||
window.JSAndroid.writeHTMLClipboard(protyle.lute.BlockDOM2StdMd(response.data).trimEnd(), response.data + Constants.ZWSP);
|
||||
window.JSAndroid.writeSiYuanHTMLClipboard(protyle.lute.BlockDOM2StdMd(response.data).trimEnd(), protyle.lute.BlockDOM2HTML(response.data).trimEnd(), response.data + Constants.ZWSP);
|
||||
} else if (isInHarmony()) {
|
||||
window.JSHarmony.writeHTMLClipboard(protyle.lute.BlockDOM2StdMd(response.data).trimEnd(), response.data + Constants.ZWSP);
|
||||
window.JSHarmony.writeSiYuanHTMLClipboard(protyle.lute.BlockDOM2StdMd(response.data).trimEnd(), protyle.lute.BlockDOM2HTML(response.data).trimEnd(), response.data + Constants.ZWSP);
|
||||
} else {
|
||||
writeText(response.data + Constants.ZWSP);
|
||||
}
|
||||
|
||||
@@ -157,6 +157,9 @@ export const readClipboard = async () => {
|
||||
const textObj = getTextSiyuanFromTextHTML(text.textHTML);
|
||||
text.textHTML = textObj.textHtml;
|
||||
text.siyuanHTML = textObj.textSiyuan;
|
||||
if (!text.siyuanHTML) {
|
||||
text.siyuanHTML = window.JSAndroid.readSiYuanHTMLClipboard();
|
||||
}
|
||||
return text;
|
||||
}
|
||||
if (isInHarmony()) {
|
||||
@@ -165,6 +168,9 @@ export const readClipboard = async () => {
|
||||
const textObj = getTextSiyuanFromTextHTML(text.textHTML);
|
||||
text.textHTML = textObj.textHtml;
|
||||
text.siyuanHTML = textObj.textSiyuan;
|
||||
if (!text.siyuanHTML) {
|
||||
text.siyuanHTML = window.JSHarmony.readSiYuanHTMLClipboard();
|
||||
}
|
||||
return text;
|
||||
}
|
||||
if (typeof navigator.clipboard === "undefined") {
|
||||
|
||||
Vendored
+4
@@ -243,9 +243,11 @@ interface Window {
|
||||
changeStatusBarColor(color: string, mode: number): void
|
||||
writeClipboard(text: string): void
|
||||
writeHTMLClipboard(text: string, html: string): void
|
||||
writeSiYuanHTMLClipboard(text: string, html: string, siyuanHTML: string): void
|
||||
writeImageClipboard(uri: string): void
|
||||
readClipboard(): string
|
||||
readHTMLClipboard(): string
|
||||
readSiYuanHTMLClipboard(): string
|
||||
getBlockURL(): string
|
||||
hideKeyboard(): void
|
||||
showKeyboard(): void
|
||||
@@ -261,8 +263,10 @@ interface Window {
|
||||
changeStatusBarColor(color: string, mode: number): void
|
||||
writeClipboard(text: string): void
|
||||
writeHTMLClipboard(text: string, html: string): void
|
||||
writeSiYuanHTMLClipboard(text: string, html: string, siyuanHTML: string): void
|
||||
readClipboard(): string
|
||||
readHTMLClipboard(): string
|
||||
readSiYuanHTMLClipboard(): string
|
||||
returnDesktop(): void
|
||||
print(title: string, html: string): void
|
||||
getScreenWidthPx(): number
|
||||
|
||||
Reference in New Issue
Block a user