mirror of
https://github.com/zadam/trilium.git
synced 2025-06-06 18:08:33 +02:00
fix "copy image to clipboard" button
This commit is contained in:
parent
30249a353e
commit
77a89d85c8
@ -5,6 +5,7 @@ import infoService from "./info.js";
|
|||||||
import server from "./server.js";
|
import server from "./server.js";
|
||||||
|
|
||||||
const $component = $('#note-detail-image');
|
const $component = $('#note-detail-image');
|
||||||
|
const $imageWrapper = $('#note-detail-image-wrapper');
|
||||||
const $imageView = $('#note-detail-image-view');
|
const $imageView = $('#note-detail-image-view');
|
||||||
|
|
||||||
const $imageDownloadButton = $("#image-download");
|
const $imageDownloadButton = $("#image-download");
|
||||||
@ -39,10 +40,10 @@ function selectImage(element) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$copyToClipboardButton.click(() => {
|
$copyToClipboardButton.click(() => {
|
||||||
$component.attr('contenteditable','true');
|
$imageWrapper.attr('contenteditable','true');
|
||||||
|
|
||||||
try {
|
try {
|
||||||
selectImage($component.get(0));
|
selectImage($imageWrapper.get(0));
|
||||||
|
|
||||||
const success = document.execCommand('copy');
|
const success = document.execCommand('copy');
|
||||||
|
|
||||||
@ -55,7 +56,7 @@ $copyToClipboardButton.click(() => {
|
|||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
window.getSelection().removeAllRanges();
|
window.getSelection().removeAllRanges();
|
||||||
$component.removeAttr('contenteditable');
|
$imageWrapper.removeAttr('contenteditable');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -22,5 +22,7 @@
|
|||||||
|
|
||||||
<br/><br/>
|
<br/><br/>
|
||||||
|
|
||||||
|
<div id="note-detail-image-wrapper">
|
||||||
<img id="note-detail-image-view" />
|
<img id="note-detail-image-view" />
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
Loading…
x
Reference in New Issue
Block a user