@studiocms/wysiwyg 0.1.0-beta.27 → 0.1.0-beta.29
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/components/render.d.ts +15 -0
- package/dist/components/render.js +11 -0
- package/dist/index.js +1 -1
- package/dist/lib/shared.js +1 -2
- package/package.json +5 -5
- package/dist/components/Render.astro +0 -24
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
declare const renderer: {
|
|
2
|
+
name: string;
|
|
3
|
+
renderer: (content: string) => Promise<string>;
|
|
4
|
+
sanitizeOpts: {
|
|
5
|
+
allowElements?: string[] | undefined;
|
|
6
|
+
blockElements?: string[] | undefined;
|
|
7
|
+
dropElements?: string[] | undefined;
|
|
8
|
+
allowAttributes?: Record<string, string[]> | undefined;
|
|
9
|
+
dropAttributes?: Record<string, string[]> | undefined;
|
|
10
|
+
allowComponents?: boolean | undefined;
|
|
11
|
+
allowCustomElements?: boolean | undefined;
|
|
12
|
+
allowComments?: boolean | undefined;
|
|
13
|
+
} | undefined;
|
|
14
|
+
};
|
|
15
|
+
export default renderer;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { preRenderer } from "../lib/prerender.js";
|
|
2
|
+
import { shared } from "../lib/shared.js";
|
|
3
|
+
const renderer = {
|
|
4
|
+
name: "@studiocms/wysiwyg",
|
|
5
|
+
renderer: preRenderer,
|
|
6
|
+
sanitizeOpts: shared?.sanitize
|
|
7
|
+
};
|
|
8
|
+
var render_default = renderer;
|
|
9
|
+
export {
|
|
10
|
+
render_default as default
|
|
11
|
+
};
|
package/dist/index.js
CHANGED
|
@@ -55,7 +55,7 @@ function wysiwyg(opts) {
|
|
|
55
55
|
{
|
|
56
56
|
identifier: "studiocms/wysiwyg",
|
|
57
57
|
label: "WYSIWYG",
|
|
58
|
-
rendererComponent: resolve("./components/
|
|
58
|
+
rendererComponent: resolve("./components/render.js"),
|
|
59
59
|
pageContentComponent: resolve("./components/Editor.astro")
|
|
60
60
|
}
|
|
61
61
|
]
|
package/dist/lib/shared.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
const shared = globalThis.studiocmsWYSIWYG ||
|
|
2
|
-
(globalThis.studiocmsWYSIWYG = {
|
|
1
|
+
const shared = globalThis.studiocmsWYSIWYG || (globalThis.studiocmsWYSIWYG = {
|
|
3
2
|
sanitize: void 0
|
|
4
3
|
});
|
|
5
4
|
export {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@studiocms/wysiwyg",
|
|
3
|
-
"version": "0.1.0-beta.
|
|
3
|
+
"version": "0.1.0-beta.29",
|
|
4
4
|
"description": "Add A WYSIWYG Editor to your StudioCMS project with ease!",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "withstudiocms",
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
},
|
|
58
58
|
"type": "module",
|
|
59
59
|
"dependencies": {
|
|
60
|
-
"astro-integration-kit": "^0.19.
|
|
60
|
+
"astro-integration-kit": "^0.19.1",
|
|
61
61
|
"deepmerge-ts": "^7.1.5",
|
|
62
62
|
"grapesjs": "^0.22.13",
|
|
63
63
|
"tui-image-editor": "^3.15.3"
|
|
@@ -66,11 +66,11 @@
|
|
|
66
66
|
"@types/node": "^22.0.0"
|
|
67
67
|
},
|
|
68
68
|
"peerDependencies": {
|
|
69
|
-
"@studiocms/ui": "^1.0.0-beta.
|
|
69
|
+
"@studiocms/ui": "^1.0.0-beta.4",
|
|
70
70
|
"astro": "^5.12.9",
|
|
71
71
|
"vite": "^6.3.4",
|
|
72
|
-
"@withstudiocms/component-registry": "0.1.0-beta.
|
|
73
|
-
"studiocms": "0.1.0-beta.
|
|
72
|
+
"@withstudiocms/component-registry": "0.1.0-beta.5",
|
|
73
|
+
"studiocms": "0.1.0-beta.29"
|
|
74
74
|
},
|
|
75
75
|
"scripts": {
|
|
76
76
|
"build": "buildkit build 'src/**/*.{ts,astro,css,js}'",
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
import { createRenderer } from 'studiocms:component-registry/runtime';
|
|
3
|
-
import type { PluginPageTypeRendererProps } from 'studiocms/types';
|
|
4
|
-
import { preRenderer } from '../lib/prerender.js';
|
|
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?.sanitize, preRenderer);
|
|
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
|
-
<Fragment set:html={renderedContent} />
|