open image

This commit is contained in:
notoriousmango
2024-11-26 19:53:31 +09:00
parent 6b2777169d
commit 0b243279cc
7 changed files with 64 additions and 2 deletions

View File

@@ -132,7 +132,11 @@ function addImageContexts() {
for (const img of images) {
img.id = 'image-' + idNumber;
idNumber += 1;
img.setAttribute('data-vscode-context', JSON.stringify({ webviewSection: 'image', id: img.id, 'preventDefaultContextMenuItems': true, resource: documentResource }));
const imageSource = img.src;
const imgSrcAttribute = img.getAttribute('src');
const isLocalFile = imageSource !== imgSrcAttribute;
const webviewSection = isLocalFile ? 'localImage' : 'image';
img.setAttribute('data-vscode-context', JSON.stringify({ webviewSection, id: img.id, 'preventDefaultContextMenuItems': true, resource: documentResource, imageSource }));
}
}