mirror of
https://github.com/microsoft/vscode.git
synced 2025-12-24 12:19:20 +00:00
write our own little gulp-eslint which takes the eslint from our workspace root (#230115)
This commit is contained in:
committed by
GitHub
parent
ef44e67783
commit
841d51da29
@@ -12,20 +12,20 @@ export class ActiveLineMarker {
|
||||
this._update(previous && (previous.codeElement || previous.element));
|
||||
}
|
||||
|
||||
_update(before: HTMLElement | undefined) {
|
||||
private _update(before: HTMLElement | undefined) {
|
||||
this._unmarkActiveElement(this._current);
|
||||
this._markActiveElement(before);
|
||||
this._current = before;
|
||||
}
|
||||
|
||||
_unmarkActiveElement(element: HTMLElement | undefined) {
|
||||
private _unmarkActiveElement(element: HTMLElement | undefined) {
|
||||
if (!element) {
|
||||
return;
|
||||
}
|
||||
element.classList.toggle('code-active-line', false);
|
||||
}
|
||||
|
||||
_markActiveElement(element: HTMLElement | undefined) {
|
||||
private _markActiveElement(element: HTMLElement | undefined) {
|
||||
if (!element) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -11,45 +11,45 @@ import { getStrings } from './strings';
|
||||
* Shows an alert when there is a content security policy violation.
|
||||
*/
|
||||
export class CspAlerter {
|
||||
private didShow = false;
|
||||
private didHaveCspWarning = false;
|
||||
private _didShow = false;
|
||||
private _didHaveCspWarning = false;
|
||||
|
||||
private messaging?: MessagePoster;
|
||||
private _messaging?: MessagePoster;
|
||||
|
||||
constructor(
|
||||
private readonly settingsManager: SettingsManager,
|
||||
private readonly _settingsManager: SettingsManager,
|
||||
) {
|
||||
document.addEventListener('securitypolicyviolation', () => {
|
||||
this.onCspWarning();
|
||||
this._onCspWarning();
|
||||
});
|
||||
|
||||
window.addEventListener('message', (event) => {
|
||||
if (event && event.data && event.data.name === 'vscode-did-block-svg') {
|
||||
this.onCspWarning();
|
||||
this._onCspWarning();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public setPoster(poster: MessagePoster) {
|
||||
this.messaging = poster;
|
||||
if (this.didHaveCspWarning) {
|
||||
this.showCspWarning();
|
||||
this._messaging = poster;
|
||||
if (this._didHaveCspWarning) {
|
||||
this._showCspWarning();
|
||||
}
|
||||
}
|
||||
|
||||
private onCspWarning() {
|
||||
this.didHaveCspWarning = true;
|
||||
this.showCspWarning();
|
||||
private _onCspWarning() {
|
||||
this._didHaveCspWarning = true;
|
||||
this._showCspWarning();
|
||||
}
|
||||
|
||||
private showCspWarning() {
|
||||
private _showCspWarning() {
|
||||
const strings = getStrings();
|
||||
const settings = this.settingsManager.settings;
|
||||
const settings = this._settingsManager.settings;
|
||||
|
||||
if (this.didShow || settings.disableSecurityWarnings || !this.messaging) {
|
||||
if (this._didShow || settings.disableSecurityWarnings || !this._messaging) {
|
||||
return;
|
||||
}
|
||||
this.didShow = true;
|
||||
this._didShow = true;
|
||||
|
||||
const notification = document.createElement('a');
|
||||
notification.innerText = strings.cspAlertMessageText;
|
||||
@@ -59,7 +59,7 @@ export class CspAlerter {
|
||||
notification.setAttribute('role', 'button');
|
||||
notification.setAttribute('aria-label', strings.cspAlertMessageLabel);
|
||||
notification.onclick = () => {
|
||||
this.messaging!.postMessage('showPreviewSecuritySelector', { source: settings.source });
|
||||
this._messaging!.postMessage('showPreviewSecuritySelector', { source: settings.source });
|
||||
};
|
||||
document.body.appendChild(notification);
|
||||
}
|
||||
|
||||
@@ -5,15 +5,15 @@
|
||||
import { MessagePoster } from './messaging';
|
||||
|
||||
export class StyleLoadingMonitor {
|
||||
private unloadedStyles: string[] = [];
|
||||
private finishedLoading: boolean = false;
|
||||
private _unloadedStyles: string[] = [];
|
||||
private _finishedLoading: boolean = false;
|
||||
|
||||
private poster?: MessagePoster;
|
||||
private _poster?: MessagePoster;
|
||||
|
||||
constructor() {
|
||||
const onStyleLoadError = (event: any) => {
|
||||
const source = event.target.dataset.source;
|
||||
this.unloadedStyles.push(source);
|
||||
this._unloadedStyles.push(source);
|
||||
};
|
||||
|
||||
window.addEventListener('DOMContentLoaded', () => {
|
||||
@@ -25,18 +25,18 @@ export class StyleLoadingMonitor {
|
||||
});
|
||||
|
||||
window.addEventListener('load', () => {
|
||||
if (!this.unloadedStyles.length) {
|
||||
if (!this._unloadedStyles.length) {
|
||||
return;
|
||||
}
|
||||
this.finishedLoading = true;
|
||||
this.poster?.postMessage('previewStyleLoadError', { unloadedStyles: this.unloadedStyles });
|
||||
this._finishedLoading = true;
|
||||
this._poster?.postMessage('previewStyleLoadError', { unloadedStyles: this._unloadedStyles });
|
||||
});
|
||||
}
|
||||
|
||||
public setPoster(poster: MessagePoster): void {
|
||||
this.poster = poster;
|
||||
if (this.finishedLoading) {
|
||||
poster.postMessage('previewStyleLoadError', { unloadedStyles: this.unloadedStyles });
|
||||
this._poster = poster;
|
||||
if (this._finishedLoading) {
|
||||
poster.postMessage('previewStyleLoadError', { unloadedStyles: this._unloadedStyles });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user