mirror of
https://github.com/Nystik-gh/ignis.git
synced 2026-06-17 04:35:53 +00:00
minor refactor, cleanup
This commit is contained in:
@@ -1,35 +1,29 @@
|
||||
// Shim for remote.clipboard
|
||||
// Obsidian uses: readText, writeText, readImage, writeImage, readHTML, writeHTML
|
||||
|
||||
export const clipboardShim = {
|
||||
readText() {
|
||||
// navigator.clipboard.readText() is async; return empty for sync calls
|
||||
// TODO: maintain a local mirror updated via async reads
|
||||
return '';
|
||||
return "";
|
||||
},
|
||||
|
||||
writeText(text) {
|
||||
navigator.clipboard.writeText(text).catch((e) => {
|
||||
console.warn('[shim:clipboard] writeText failed:', e);
|
||||
console.warn("[shim:clipboard] writeText failed:", e);
|
||||
});
|
||||
},
|
||||
|
||||
readHTML() {
|
||||
return '';
|
||||
return "";
|
||||
},
|
||||
|
||||
writeHTML(html) {
|
||||
// TODO: use clipboard API with text/html mime type
|
||||
console.log('[shim:clipboard] writeHTML (stub)');
|
||||
console.log("[shim:clipboard] writeHTML (stub)");
|
||||
},
|
||||
|
||||
readImage() {
|
||||
// TODO: implement if needed
|
||||
return { isEmpty: () => true, toPNG: () => new Uint8Array(0) };
|
||||
},
|
||||
|
||||
writeImage(image) {
|
||||
console.log('[shim:clipboard] writeImage (stub)');
|
||||
console.log("[shim:clipboard] writeImage (stub)");
|
||||
},
|
||||
|
||||
has(format) {
|
||||
@@ -37,10 +31,10 @@ export const clipboardShim = {
|
||||
},
|
||||
|
||||
read(format) {
|
||||
return '';
|
||||
return "";
|
||||
},
|
||||
|
||||
clear() {
|
||||
navigator.clipboard.writeText('').catch(() => {});
|
||||
navigator.clipboard.writeText("").catch(() => {});
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user