diff --git a/src/commands/Preview.ts b/src/commands/Preview.ts index 90c063e3..8dc3298f 100644 --- a/src/commands/Preview.ts +++ b/src/commands/Preview.ts @@ -1,14 +1,15 @@ import { Telemetry } from './../helpers/Telemetry'; -import { SETTING_PREVIEW_HOST, SETTING_PREVIEW_PATHNAME, CONTEXT, TelemetryEvent } from './../constants'; +import { SETTING_PREVIEW_HOST, SETTING_PREVIEW_PATHNAME, CONTEXT, TelemetryEvent, PreviewCommands } from './../constants'; import { ArticleHelper } from './../helpers/ArticleHelper'; import { join } from "path"; import { commands, env, Uri, ViewColumn, window } from "vscode"; -import { Settings } from '../helpers'; +import { Extension, Settings } from '../helpers'; import { PreviewSettings } from '../models'; import { format } from 'date-fns'; import { DateHelper } from '../helpers/DateHelper'; import { Article } from '.'; import { urlJoin } from 'url-join-ts'; +import { WebviewHelper } from '@estruyf/vscode'; export class Preview { @@ -81,59 +82,62 @@ export class Preview { const cspSource = webView.webview.cspSource; - webView.webview.html = ` - - - - - -
- -
- + + ); +}; \ No newline at end of file diff --git a/src/dashboardWebView/components/Preview/index.ts b/src/dashboardWebView/components/Preview/index.ts new file mode 100644 index 00000000..7d1d8598 --- /dev/null +++ b/src/dashboardWebView/components/Preview/index.ts @@ -0,0 +1 @@ +export * from './Preview'; diff --git a/src/dashboardWebView/index.tsx b/src/dashboardWebView/index.tsx index bc5605d3..89803e6d 100644 --- a/src/dashboardWebView/index.tsx +++ b/src/dashboardWebView/index.tsx @@ -6,6 +6,7 @@ import * as Sentry from "@sentry/react"; import { Integrations } from "@sentry/tracing"; import { SENTRY_LINK } from "../constants"; import './styles.css'; +import { Preview } from "./components/Preview"; declare const acquireVsCodeApi: () => { getState: () => T; @@ -19,6 +20,8 @@ if (elm) { const version = elm?.getAttribute("data-version"); const environment = elm?.getAttribute("data-environment"); const isProd = elm?.getAttribute("data-isProd"); + const type = elm?.getAttribute("data-type"); + const url = elm?.getAttribute("data-url"); if (isProd === "true") { Sentry.init({ @@ -31,7 +34,11 @@ if (elm) { }); } - render(, elm); + if (type === "preview") { + render(, elm); + } else { + render(, elm); + } } // Webpack HMR