mirror of
https://github.com/microsoft/vscode.git
synced 2025-12-24 20:26:08 +00:00
use openDocumentLink
This commit is contained in:
@@ -11,6 +11,7 @@ import { SettingsManager, getData } from './settings';
|
||||
import throttle = require('lodash.throttle');
|
||||
import morphdom from 'morphdom';
|
||||
import type { ToWebviewMessage } from '../types/previewMessaging';
|
||||
import { isOfScheme, Schemes } from '../src/util/schemes';
|
||||
|
||||
let scrollDisabledCount = 0;
|
||||
|
||||
@@ -132,9 +133,8 @@ function addImageContexts() {
|
||||
for (const img of images) {
|
||||
img.id = 'image-' + idNumber;
|
||||
idNumber += 1;
|
||||
const imageSource = img.src;
|
||||
const imgSrcAttribute = img.getAttribute('src');
|
||||
const isLocalFile = imageSource !== imgSrcAttribute;
|
||||
const imageSource = img.getAttribute('data-src');
|
||||
const isLocalFile = imageSource && !(isOfScheme(Schemes.http, imageSource) || isOfScheme(Schemes.https, imageSource));
|
||||
const webviewSection = isLocalFile ? 'localImage' : 'image';
|
||||
img.setAttribute('data-vscode-context', JSON.stringify({ webviewSection, id: img.id, 'preventDefaultContextMenuItems': true, resource: documentResource, imageSource }));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user