How to use @theia/mini-browser - 2 common examples

To help you get started, we’ve selected a few @theia/mini-browser examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github eclipse-theia / theia / packages / preview / src / browser / preview-link-normalizer.ts View on Github external
normalizeLink(documentUri: URI, link: string): string {
        try {
            if (!this.urlScheme.test(link)) {
                const location = documentUri.parent.resolve(link).path.toString();
                return new MiniBrowserEndpoint().getRestUrl().resolve(location).toString();
            }
        } catch {
            // ignore
        }
        return link;
    }
}
github eclipse-theia / theia / packages / plugin-ext / src / main / browser / webview / webview.ts View on Github external
protected init(): void {
        this.node.tabIndex = 0;
        this.id = WebviewWidget.FACTORY_ID + ':' + this.identifier.id;
        this.title.closable = true;
        this.addClass(WebviewWidget.Styles.WEBVIEW);

        this.toDispose.push(this.onMessageEmitter);

        this.transparentOverlay = document.createElement('div');
        this.transparentOverlay.classList.add(MiniBrowserContentStyle.TRANSPARENT_OVERLAY);
        this.transparentOverlay.style.display = 'none';
        this.node.appendChild(this.transparentOverlay);

        this.toDispose.push(this.mouseTracker.onMousedown(() => {
            if (this.element.style.display !== 'none') {
                this.transparentOverlay.style.display = 'block';
            }
        }));
        this.toDispose.push(this.mouseTracker.onMouseup(() => {
            if (this.element.style.display !== 'none') {
                this.transparentOverlay.style.display = 'none';
            }
        }));

        const element = document.createElement('iframe');
        element.className = 'webview';