@studiocms/html 0.1.0-beta.26 → 0.1.0-beta.28
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/README.md +2 -0
- package/dist/components/render.d.ts +23 -0
- package/dist/components/render.js +9 -0
- package/dist/index.js +1 -1
- package/dist/lib/shared.d.ts +1 -1
- package/dist/lib/shared.js +2 -3
- package/dist/virtual.d.ts +1 -1
- package/package.json +11 -7
- package/dist/components/renderer.astro +0 -25
package/README.md
CHANGED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The HTML renderer configuration for StudioCMS.
|
|
3
|
+
*
|
|
4
|
+
* This renderer is responsible for handling HTML content within StudioCMS,
|
|
5
|
+
* utilizing shared configuration options for sanitization and rendering.
|
|
6
|
+
*
|
|
7
|
+
* (StudioCMS can technically already render HTML out of the box,
|
|
8
|
+
* but will error without any renderer configured for HTML content types.)
|
|
9
|
+
*/
|
|
10
|
+
declare const renderer: {
|
|
11
|
+
name: string;
|
|
12
|
+
sanitizeOpts: {
|
|
13
|
+
allowElements?: string[] | undefined;
|
|
14
|
+
blockElements?: string[] | undefined;
|
|
15
|
+
dropElements?: string[] | undefined;
|
|
16
|
+
allowAttributes?: Record<string, string[]> | undefined;
|
|
17
|
+
dropAttributes?: Record<string, string[]> | undefined;
|
|
18
|
+
allowComponents?: boolean | undefined;
|
|
19
|
+
allowCustomElements?: boolean | undefined;
|
|
20
|
+
allowComments?: boolean | undefined;
|
|
21
|
+
} | undefined;
|
|
22
|
+
};
|
|
23
|
+
export default renderer;
|
package/dist/index.js
CHANGED
|
@@ -33,7 +33,7 @@ function studiocmsHTML(options) {
|
|
|
33
33
|
identifier: "studiocms/html",
|
|
34
34
|
label: "HTML",
|
|
35
35
|
pageContentComponent: resolve("./components/editor.astro"),
|
|
36
|
-
rendererComponent: resolve("./components/
|
|
36
|
+
rendererComponent: resolve("./components/render.js")
|
|
37
37
|
}
|
|
38
38
|
]
|
|
39
39
|
});
|
package/dist/lib/shared.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ export declare const symbol: symbol;
|
|
|
5
5
|
* initialized as a new object with a `htmlConfig` property.
|
|
6
6
|
*
|
|
7
7
|
* @remarks
|
|
8
|
-
* The `@ts-
|
|
8
|
+
* The `@ts-expect-error` comments are used to suppress TypeScript errors related to the use of
|
|
9
9
|
* the global scope and assignment within expressions. The `biome-ignore` comment is used
|
|
10
10
|
* to suppress linting errors for the same reason.
|
|
11
11
|
*/
|
package/dist/lib/shared.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
const symbol = Symbol.for("@studiocms/html");
|
|
2
2
|
const shared = (
|
|
3
|
-
// @ts-
|
|
4
|
-
globalThis[symbol] || // @ts-
|
|
5
|
-
// biome-ignore lint/suspicious/noAssignInExpressions: This is a valid use case for assignment in expressions.
|
|
3
|
+
// @ts-expect-error
|
|
4
|
+
globalThis[symbol] || // @ts-expect-error
|
|
6
5
|
(globalThis[symbol] = {
|
|
7
6
|
htmlConfig: void 0
|
|
8
7
|
})
|
package/dist/virtual.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@studiocms/html",
|
|
3
|
-
"version": "0.1.0-beta.
|
|
3
|
+
"version": "0.1.0-beta.28",
|
|
4
4
|
"description": "Add HTML Support to your StudioCMS project with ease!",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "withstudiocms",
|
|
@@ -53,14 +53,17 @@
|
|
|
53
53
|
"default": "./dist/virtual.d.js"
|
|
54
54
|
},
|
|
55
55
|
"./editor": "./dist/components/editor.astro",
|
|
56
|
-
"./renderer":
|
|
56
|
+
"./renderer": {
|
|
57
|
+
"types": "./dist/components/render.d.ts",
|
|
58
|
+
"default": "./dist/components/render.js"
|
|
59
|
+
}
|
|
57
60
|
},
|
|
58
61
|
"type": "module",
|
|
59
62
|
"dependencies": {
|
|
60
|
-
"astro-integration-kit": "^0.19.
|
|
63
|
+
"astro-integration-kit": "^0.19.1",
|
|
61
64
|
"codemirror": "5.65.19",
|
|
62
|
-
"katex": "^0.16.
|
|
63
|
-
"suneditor": "^2.47.
|
|
65
|
+
"katex": "^0.16.25",
|
|
66
|
+
"suneditor": "^2.47.8"
|
|
64
67
|
},
|
|
65
68
|
"devDependencies": {
|
|
66
69
|
"@types/codemirror": "5.60.16",
|
|
@@ -68,13 +71,14 @@
|
|
|
68
71
|
},
|
|
69
72
|
"peerDependencies": {
|
|
70
73
|
"astro": "^5.12.9",
|
|
71
|
-
"effect": "^3.
|
|
74
|
+
"effect": "^3.18.4",
|
|
72
75
|
"vite": "^6.3.4",
|
|
73
|
-
"studiocms": "0.1.0-beta.
|
|
76
|
+
"studiocms": "0.1.0-beta.28"
|
|
74
77
|
},
|
|
75
78
|
"scripts": {
|
|
76
79
|
"build": "buildkit build 'src/**/*.{ts,astro,css,json,png,d.ts}'",
|
|
77
80
|
"dev": "buildkit dev 'src/**/*.{ts,astro,css,json,png,d.ts}'",
|
|
81
|
+
"test": "vitest",
|
|
78
82
|
"typecheck": "tspc -p tsconfig.tspc.json"
|
|
79
83
|
}
|
|
80
84
|
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
import { createRenderer } from 'studiocms:component-registry/runtime';
|
|
3
|
-
import type { SSRResult } from 'astro';
|
|
4
|
-
import type { PluginPageTypeRendererProps } from 'studiocms/types';
|
|
5
|
-
import { shared } from '../lib/shared.js';
|
|
6
|
-
|
|
7
|
-
// @ts-expect-error - $$result is a global variable injected by Astro during compilation and not a editor-known variable
|
|
8
|
-
const ssrResult: SSRResult = $$result;
|
|
9
|
-
|
|
10
|
-
// Define render function
|
|
11
|
-
const render = await createRenderer(ssrResult, shared.htmlConfig?.sanitize);
|
|
12
|
-
|
|
13
|
-
interface Props extends PluginPageTypeRendererProps {}
|
|
14
|
-
|
|
15
|
-
// Get default content
|
|
16
|
-
const { defaultContent } = Astro.props.data;
|
|
17
|
-
|
|
18
|
-
// Get content to render
|
|
19
|
-
const contentToRender = defaultContent?.content || '<h1>Error: No content found</h1>';
|
|
20
|
-
|
|
21
|
-
// Render content
|
|
22
|
-
const renderedContent = await render(contentToRender);
|
|
23
|
-
---
|
|
24
|
-
|
|
25
|
-
<Fragment set:html={renderedContent} />
|