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