@eclipse-docks/core 0.7.125 → 0.7.126
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/index.js +3 -3
- package/dist/api/services.d.ts +1 -0
- package/dist/api/services.d.ts.map +1 -1
- package/dist/{api-CTU-FxEv.js → api-B3RXoez_.js} +3 -4
- package/dist/api-B3RXoez_.js.map +1 -0
- package/dist/components/release-history.d.ts.map +1 -1
- package/dist/core/markdown-html.d.ts +4 -0
- package/dist/core/markdown-html.d.ts.map +1 -0
- package/dist/index.js +3 -3
- package/dist/parts/index.js +1 -1
- package/dist/{parts-BRaXx8PD.js → parts-CsoNFVTw.js} +15 -3
- package/dist/parts-CsoNFVTw.js.map +1 -0
- package/package.json +2 -1
- package/src/api/services.ts +1 -0
- package/src/components/release-history.ts +2 -4
- package/src/core/markdown-html.ts +11 -0
- package/src/parts/dialog-content.ts +2 -2
- package/dist/api-CTU-FxEv.js.map +0 -1
- package/dist/parts-BRaXx8PD.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eclipse-docks/core",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.126",
|
|
4
4
|
"description": "Eclipse Docks platform core: registries, services, parts, widgets, and API",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "EPL-2.0",
|
|
@@ -77,6 +77,7 @@
|
|
|
77
77
|
"test:coverage": "vitest run --coverage"
|
|
78
78
|
},
|
|
79
79
|
"dependencies": {
|
|
80
|
+
"dompurify": "^3.2.7",
|
|
80
81
|
"@awesome.me/webawesome": "^3.12.0",
|
|
81
82
|
"@fortawesome/fontawesome-free": "^7.2.0",
|
|
82
83
|
"@fortawesome/fontawesome-svg-core": "^7.2.0",
|
package/src/api/services.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { html, css } from "lit";
|
|
2
2
|
import { customElement, state } from "lit/decorators.js";
|
|
3
3
|
import { unsafeHTML } from "lit/directives/unsafe-html.js";
|
|
4
|
-
import { marked } from "marked";
|
|
5
4
|
import { DocksPart } from "../parts/part";
|
|
6
5
|
import { appLoaderService, type ReleaseEntry } from "../core/apploader";
|
|
6
|
+
import { parseMarkdownHtml } from "../core/markdown-html";
|
|
7
7
|
import { createLogger } from "../core/logger";
|
|
8
8
|
|
|
9
9
|
const logger = createLogger("ReleaseHistory");
|
|
@@ -112,9 +112,7 @@ export class DocksReleaseHistory extends DocksPart {
|
|
|
112
112
|
const showUpdateHint = !isCurrent && isNewerThan(release.tag_name, this.appVersion);
|
|
113
113
|
const atOldest = this.currentReleaseIndex === this.releases.length - 1;
|
|
114
114
|
const atNewest = this.currentReleaseIndex === 0;
|
|
115
|
-
const bodyHtml = release.body
|
|
116
|
-
? (marked.parse(release.body, { async: false }) as string)
|
|
117
|
-
: "";
|
|
115
|
+
const bodyHtml = release.body ? parseMarkdownHtml(release.body) : "";
|
|
118
116
|
|
|
119
117
|
return html`
|
|
120
118
|
<div class="release-panel">
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import DOMPurify from 'dompurify';
|
|
2
|
+
import { marked, type MarkedOptions } from 'marked';
|
|
3
|
+
|
|
4
|
+
export function sanitizeHtml(html: string): string {
|
|
5
|
+
return DOMPurify.sanitize(html);
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export function parseMarkdownHtml(markdown: string, options?: MarkedOptions): string {
|
|
9
|
+
const html = marked.parse(markdown, { async: false, ...options }) as string;
|
|
10
|
+
return sanitizeHtml(html);
|
|
11
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { html, TemplateResult, css } from "lit";
|
|
2
2
|
import { unsafeHTML } from "lit/directives/unsafe-html.js";
|
|
3
|
-
import {
|
|
3
|
+
import { parseMarkdownHtml } from "../core/markdown-html";
|
|
4
4
|
import { DocksElement } from "./element";
|
|
5
5
|
|
|
6
6
|
export abstract class DocksDialogContent extends DocksElement {
|
|
@@ -22,7 +22,7 @@ export abstract class DocksDialogContent extends DocksElement {
|
|
|
22
22
|
|
|
23
23
|
protected renderMessage(message: string, markdown: boolean = false): TemplateResult {
|
|
24
24
|
if (markdown) {
|
|
25
|
-
const htmlContent =
|
|
25
|
+
const htmlContent = parseMarkdownHtml(message);
|
|
26
26
|
return html`<div class="dialog-message" style="white-space: normal;">${unsafeHTML(htmlContent)}</div>`;
|
|
27
27
|
}
|
|
28
28
|
return html`<div class="dialog-message" style="white-space: pre-line;">${message}</div>`;
|