mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-22 17:40:13 +01:00
This commit is contained in:
parent
cd50f25af7
commit
8a8f9f9dd4
2 changed files with 7 additions and 1 deletions
|
|
@ -11,6 +11,7 @@ import {MenuItem} from "./Menu";
|
||||||
import {App} from "../index";
|
import {App} from "../index";
|
||||||
import {exportByMobile, isInAndroid, updateHotkeyTip} from "../protyle/util/compatibility";
|
import {exportByMobile, isInAndroid, updateHotkeyTip} from "../protyle/util/compatibility";
|
||||||
import {checkFold} from "../util/noRelyPCFunction";
|
import {checkFold} from "../util/noRelyPCFunction";
|
||||||
|
import {showMessage} from "../dialog/message";
|
||||||
|
|
||||||
export const exportAsset = (src: string) => {
|
export const exportAsset = (src: string) => {
|
||||||
return {
|
return {
|
||||||
|
|
@ -174,6 +175,7 @@ export const openEditorTab = (app: App, ids: string[], notebookId?: string, path
|
||||||
|
|
||||||
export const copyPNGByLink = (link: string) => {
|
export const copyPNGByLink = (link: string) => {
|
||||||
if (isInAndroid()) {
|
if (isInAndroid()) {
|
||||||
|
showMessage(link);
|
||||||
window.JSAndroid.writeImageClipboard(link);
|
window.JSAndroid.writeImageClipboard(link);
|
||||||
} else {
|
} else {
|
||||||
const canvas = document.createElement("canvas");
|
const canvas = document.createElement("canvas");
|
||||||
|
|
|
||||||
|
|
@ -1530,7 +1530,7 @@ ${item.name}
|
||||||
let html = "";
|
let html = "";
|
||||||
const hasCopy = range.toString() !== "" || (range.cloneContents().childNodes[0] as HTMLElement)?.classList?.contains("emoji");
|
const hasCopy = range.toString() !== "" || (range.cloneContents().childNodes[0] as HTMLElement)?.classList?.contains("emoji");
|
||||||
if (hasCopy) {
|
if (hasCopy) {
|
||||||
html += "<button class=\"keyboard__action\" data-action=\"copy\"><svg><use xlink:href=\"#iconCopy\"></use></svg></button>";
|
html += '<button class="keyboard__action" data-action="copy"><svg><use xlink:href="#iconCopy"></use></svg></button>';
|
||||||
if (!protyle.disabled) {
|
if (!protyle.disabled) {
|
||||||
html += `<button class="keyboard__action" data-action="cut"><svg><use xlink:href="#iconCut"></use></svg></button>
|
html += `<button class="keyboard__action" data-action="cut"><svg><use xlink:href="#iconCut"></use></svg></button>
|
||||||
<button class="keyboard__action" data-action="delete"><svg><use xlink:href="#iconTrashcan"></use></svg></button>`;
|
<button class="keyboard__action" data-action="delete"><svg><use xlink:href="#iconTrashcan"></use></svg></button>`;
|
||||||
|
|
@ -1570,9 +1570,13 @@ ${item.name}
|
||||||
} else if (action === "paste") {
|
} else if (action === "paste") {
|
||||||
if (document.queryCommandSupported("paste")) {
|
if (document.queryCommandSupported("paste")) {
|
||||||
document.execCommand("paste");
|
document.execCommand("paste");
|
||||||
|
showMessage("document paste");
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
const text = await readClipboard();
|
const text = await readClipboard();
|
||||||
|
showMessage("clipboard textHTML" + text.textHTML);
|
||||||
|
showMessage("clipboard textPlain" + text.textPlain);
|
||||||
|
showMessage("clipboard files" + text.files.length);
|
||||||
paste(protyle, Object.assign(text, {target: nodeElement as HTMLElement}));
|
paste(protyle, Object.assign(text, {target: nodeElement as HTMLElement}));
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log(e);
|
console.log(e);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue