@studiocms/html 0.1.0-beta.22
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/LICENSE +21 -0
- package/README.md +21 -0
- package/dist/components/editor.astro +154 -0
- package/dist/components/renderer.astro +25 -0
- package/dist/index.d.ts +19 -0
- package/dist/index.js +48 -0
- package/dist/lib/shared.d.ts +14 -0
- package/dist/lib/shared.js +13 -0
- package/dist/types.d.ts +62 -0
- package/dist/types.js +9 -0
- package/dist/virtual.d.ts +3 -0
- package/package.json +82 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025-present StudioCMS - withstudiocms (https://github.com/withstudiocms)
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# @studiocms/html Plugin
|
|
2
|
+
|
|
3
|
+
Add HTML support to StudioCMS
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
Add this plugin in your StudioCMS config. (`studiocms.config.mjs`)
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
import { defineStudioCMSConfig } from 'studiocms/config';
|
|
11
|
+
import htmlPlugin from '@studiocms/html';
|
|
12
|
+
|
|
13
|
+
export default defineStudioCMSConfig({
|
|
14
|
+
// other options here
|
|
15
|
+
plugins: [htmlPlugin()]
|
|
16
|
+
});
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## License
|
|
20
|
+
|
|
21
|
+
[MIT Licensed](./LICENSE).
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
---
|
|
2
|
+
import 'suneditor/dist/css/suneditor.min.css';
|
|
3
|
+
import 'codemirror/lib/codemirror.css';
|
|
4
|
+
import 'katex/dist/katex.min.css';
|
|
5
|
+
import type { PluginPageTypeEditorProps } from 'studiocms/types';
|
|
6
|
+
|
|
7
|
+
interface Props extends PluginPageTypeEditorProps {}
|
|
8
|
+
|
|
9
|
+
const { content } = Astro.props;
|
|
10
|
+
---
|
|
11
|
+
<div class="editor-container">
|
|
12
|
+
<textarea id="page-content" name="page-content">{content}</textarea>
|
|
13
|
+
</div>
|
|
14
|
+
|
|
15
|
+
<script>
|
|
16
|
+
import sunEditor from 'suneditor';
|
|
17
|
+
import plugins from 'suneditor/src/plugins';
|
|
18
|
+
import CodeMirror from 'codemirror';
|
|
19
|
+
import 'codemirror/mode/htmlmixed/htmlmixed'
|
|
20
|
+
import katex from 'katex';
|
|
21
|
+
|
|
22
|
+
const editor = sunEditor.create('page-content', {
|
|
23
|
+
display: 'block',
|
|
24
|
+
width: '100%',
|
|
25
|
+
height: '400',
|
|
26
|
+
popupDisplay: 'full',
|
|
27
|
+
charCounter: true,
|
|
28
|
+
charCounterLabel: 'Characters :',
|
|
29
|
+
placeholder: 'Start typing something...',
|
|
30
|
+
codeMirror: CodeMirror,
|
|
31
|
+
katex: katex,
|
|
32
|
+
plugins: plugins,
|
|
33
|
+
buttonList: [
|
|
34
|
+
// default
|
|
35
|
+
['undo', 'redo'],
|
|
36
|
+
['font', 'fontSize', 'formatBlock'],
|
|
37
|
+
['paragraphStyle', 'blockquote'],
|
|
38
|
+
['bold', 'underline', 'italic', 'strike', 'subscript', 'superscript'],
|
|
39
|
+
['fontColor', 'hiliteColor', 'textStyle'],
|
|
40
|
+
['removeFormat'],
|
|
41
|
+
['outdent', 'indent'],
|
|
42
|
+
['align', 'horizontalRule', 'list', 'lineHeight'],
|
|
43
|
+
['table', 'link', 'image', 'video', 'audio', 'math'],
|
|
44
|
+
// ['imageGallery'],
|
|
45
|
+
['fullScreen', 'showBlocks', 'codeView'],
|
|
46
|
+
['preview'],
|
|
47
|
+
// (min-width: 1546)
|
|
48
|
+
['%1546', [
|
|
49
|
+
['undo', 'redo'],
|
|
50
|
+
['font', 'fontSize', 'formatBlock'],
|
|
51
|
+
['paragraphStyle', 'blockquote'],
|
|
52
|
+
['bold', 'underline', 'italic', 'strike', 'subscript', 'superscript'],
|
|
53
|
+
['fontColor', 'hiliteColor', 'textStyle'],
|
|
54
|
+
['removeFormat'],
|
|
55
|
+
['outdent', 'indent'],
|
|
56
|
+
['align', 'horizontalRule', 'list', 'lineHeight'],
|
|
57
|
+
['table', 'link', 'image', 'video', 'audio', 'math'],
|
|
58
|
+
// ['imageGallery'],
|
|
59
|
+
['fullScreen', 'showBlocks', 'codeView'],
|
|
60
|
+
['-right', ':i-More Misc-default.more_vertical', 'preview']
|
|
61
|
+
]],
|
|
62
|
+
// (min-width: 1455)
|
|
63
|
+
['%1455', [
|
|
64
|
+
['undo', 'redo'],
|
|
65
|
+
['font', 'fontSize', 'formatBlock'],
|
|
66
|
+
['paragraphStyle', 'blockquote'],
|
|
67
|
+
['bold', 'underline', 'italic', 'strike', 'subscript', 'superscript'],
|
|
68
|
+
['fontColor', 'hiliteColor', 'textStyle'],
|
|
69
|
+
['removeFormat'],
|
|
70
|
+
['outdent', 'indent'],
|
|
71
|
+
['align', 'horizontalRule', 'list', 'lineHeight'],
|
|
72
|
+
['table', 'link', 'image', 'video', 'audio', 'math'],
|
|
73
|
+
// ['imageGallery'],
|
|
74
|
+
['-right', ':i-More Misc-default.more_vertical', 'fullScreen', 'showBlocks', 'codeView', 'preview']
|
|
75
|
+
]],
|
|
76
|
+
// (min-width: 1326)
|
|
77
|
+
['%1326', [
|
|
78
|
+
['undo', 'redo'],
|
|
79
|
+
['font', 'fontSize', 'formatBlock'],
|
|
80
|
+
['paragraphStyle', 'blockquote'],
|
|
81
|
+
['bold', 'underline', 'italic', 'strike', 'subscript', 'superscript'],
|
|
82
|
+
['fontColor', 'hiliteColor', 'textStyle'],
|
|
83
|
+
['removeFormat'],
|
|
84
|
+
['outdent', 'indent'],
|
|
85
|
+
['align', 'horizontalRule', 'list', 'lineHeight'],
|
|
86
|
+
['-right', ':i-More Misc-default.more_vertical', 'fullScreen', 'showBlocks', 'codeView', 'preview'],
|
|
87
|
+
['-right', ':r-More Rich-default.more_plus', 'table', 'link', 'image', 'video', 'audio', 'math']
|
|
88
|
+
]],
|
|
89
|
+
// (min-width: 1123)
|
|
90
|
+
['%1123', [
|
|
91
|
+
['undo', 'redo'],
|
|
92
|
+
[':p-More Paragraph-default.more_paragraph', 'font', 'fontSize', 'formatBlock', 'paragraphStyle', 'blockquote'],
|
|
93
|
+
['bold', 'underline', 'italic', 'strike', 'subscript', 'superscript'],
|
|
94
|
+
['fontColor', 'hiliteColor', 'textStyle'],
|
|
95
|
+
['removeFormat'],
|
|
96
|
+
['outdent', 'indent'],
|
|
97
|
+
['align', 'horizontalRule', 'list', 'lineHeight'],
|
|
98
|
+
['-right', ':i-More Misc-default.more_vertical', 'fullScreen', 'showBlocks', 'codeView', 'preview'],
|
|
99
|
+
['-right', ':r-More Rich-default.more_plus', 'table', 'link', 'image', 'video', 'audio', 'math']
|
|
100
|
+
]],
|
|
101
|
+
// (min-width: 817)
|
|
102
|
+
['%817', [
|
|
103
|
+
['undo', 'redo'],
|
|
104
|
+
[':p-More Paragraph-default.more_paragraph', 'font', 'fontSize', 'formatBlock', 'paragraphStyle', 'blockquote'],
|
|
105
|
+
['bold', 'underline', 'italic', 'strike'],
|
|
106
|
+
[':t-More Text-default.more_text', 'subscript', 'superscript', 'fontColor', 'hiliteColor', 'textStyle'],
|
|
107
|
+
['removeFormat'],
|
|
108
|
+
['outdent', 'indent'],
|
|
109
|
+
['align', 'horizontalRule', 'list', 'lineHeight'],
|
|
110
|
+
['-right', ':i-More Misc-default.more_vertical', 'fullScreen', 'showBlocks', 'codeView', 'preview'],
|
|
111
|
+
['-right', ':r-More Rich-default.more_plus', 'table', 'link', 'image', 'video', 'audio', 'math']
|
|
112
|
+
]],
|
|
113
|
+
// (min-width: 673)
|
|
114
|
+
['%673', [
|
|
115
|
+
['undo', 'redo'],
|
|
116
|
+
[':p-More Paragraph-default.more_paragraph', 'font', 'fontSize', 'formatBlock', 'paragraphStyle', 'blockquote'],
|
|
117
|
+
[':t-More Text-default.more_text', 'bold', 'underline', 'italic', 'strike', 'subscript', 'superscript', 'fontColor', 'hiliteColor', 'textStyle'],
|
|
118
|
+
['removeFormat'],
|
|
119
|
+
['outdent', 'indent'],
|
|
120
|
+
['align', 'horizontalRule', 'list', 'lineHeight'],
|
|
121
|
+
[':r-More Rich-default.more_plus', 'table', 'link', 'image', 'video', 'audio', 'math'],
|
|
122
|
+
['-right', ':i-More Misc-default.more_vertical', 'fullScreen', 'showBlocks', 'codeView', 'preview']
|
|
123
|
+
]],
|
|
124
|
+
// (min-width: 525)
|
|
125
|
+
['%525', [
|
|
126
|
+
['undo', 'redo'],
|
|
127
|
+
[':p-More Paragraph-default.more_paragraph', 'font', 'fontSize', 'formatBlock', 'paragraphStyle', 'blockquote'],
|
|
128
|
+
[':t-More Text-default.more_text', 'bold', 'underline', 'italic', 'strike', 'subscript', 'superscript', 'fontColor', 'hiliteColor', 'textStyle'],
|
|
129
|
+
['removeFormat'],
|
|
130
|
+
['outdent', 'indent'],
|
|
131
|
+
[':e-More Line-default.more_horizontal', 'align', 'horizontalRule', 'list', 'lineHeight'],
|
|
132
|
+
[':r-More Rich-default.more_plus', 'table', 'link', 'image', 'video', 'audio', 'math'],
|
|
133
|
+
['-right', ':i-More Misc-default.more_vertical', 'fullScreen', 'showBlocks', 'codeView', 'preview']
|
|
134
|
+
]],
|
|
135
|
+
// (min-width: 420)
|
|
136
|
+
['%420', [
|
|
137
|
+
['undo', 'redo'],
|
|
138
|
+
[':p-More Paragraph-default.more_paragraph', 'font', 'fontSize', 'formatBlock', 'paragraphStyle', 'blockquote'],
|
|
139
|
+
[':t-More Text-default.more_text', 'bold', 'underline', 'italic', 'strike', 'subscript', 'superscript', 'fontColor', 'hiliteColor', 'textStyle', 'removeFormat'],
|
|
140
|
+
[':e-More Line-default.more_horizontal', 'outdent', 'indent', 'align', 'horizontalRule', 'list', 'lineHeight'],
|
|
141
|
+
[':r-More Rich-default.more_plus', 'table', 'link', 'image', 'video', 'audio', 'math'],
|
|
142
|
+
['-right', ':i-More Misc-default.more_vertical', 'fullScreen', 'showBlocks', 'codeView', 'preview']
|
|
143
|
+
]]
|
|
144
|
+
],
|
|
145
|
+
});
|
|
146
|
+
|
|
147
|
+
editor.onChange = (contents, core) => {
|
|
148
|
+
console.debug("Saving new Update")
|
|
149
|
+
editor.save()
|
|
150
|
+
console.debug("Updating Content to:", contents)
|
|
151
|
+
core.context.element.originElement.innerHTML = contents;
|
|
152
|
+
console.debug('Save complete!')
|
|
153
|
+
}
|
|
154
|
+
</script>
|
|
@@ -0,0 +1,25 @@
|
|
|
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} />
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* These triple-slash directives defines dependencies to various declaration files that will be
|
|
3
|
+
* loaded when a user imports the StudioCMS plugin in their Astro configuration file. These
|
|
4
|
+
* directives must be first at the top of the file and can only be preceded by this comment.
|
|
5
|
+
*/
|
|
6
|
+
/// <reference types="./virtual.d.ts" preserve="true" />
|
|
7
|
+
import { type StudioCMSPlugin } from 'studiocms/plugins';
|
|
8
|
+
import { type HTMLSchemaOptions } from './types.js';
|
|
9
|
+
/**
|
|
10
|
+
* Creates the StudioCMS HTML plugin.
|
|
11
|
+
*
|
|
12
|
+
* This plugin integrates HTML page type support into StudioCMS, providing editor and renderer components.
|
|
13
|
+
* It resolves configuration options, sets up Astro integrations, and registers the HTML page type for rendering.
|
|
14
|
+
*
|
|
15
|
+
* @param options - Optional configuration for the HTML schema.
|
|
16
|
+
* @returns The StudioCMS plugin configuration object.
|
|
17
|
+
*/
|
|
18
|
+
export declare function studiocmsHTML(options?: HTMLSchemaOptions): StudioCMSPlugin;
|
|
19
|
+
export default studiocmsHTML;
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { createResolver } from "astro-integration-kit";
|
|
2
|
+
import { definePlugin } from "studiocms/plugins";
|
|
3
|
+
import { shared } from "./lib/shared.js";
|
|
4
|
+
import { HTMLSchema } from "./types.js";
|
|
5
|
+
function studiocmsHTML(options) {
|
|
6
|
+
const { resolve } = createResolver(import.meta.url);
|
|
7
|
+
const packageIdentifier = "@studiocms/html";
|
|
8
|
+
const parseResult = HTMLSchema.safeParse(options);
|
|
9
|
+
if (!parseResult.success) {
|
|
10
|
+
throw new Error(`Invalid HTML options: ${parseResult.error.message}`);
|
|
11
|
+
}
|
|
12
|
+
const resolvedOptions = parseResult.data;
|
|
13
|
+
return definePlugin({
|
|
14
|
+
identifier: packageIdentifier,
|
|
15
|
+
name: "StudioCMS HTML",
|
|
16
|
+
studiocmsMinimumVersion: "0.1.0-beta.21",
|
|
17
|
+
hooks: {
|
|
18
|
+
"studiocms:astro:config": ({ addIntegrations }) => {
|
|
19
|
+
addIntegrations({
|
|
20
|
+
name: packageIdentifier,
|
|
21
|
+
hooks: {
|
|
22
|
+
"astro:config:done": () => {
|
|
23
|
+
shared.htmlConfig = resolvedOptions;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
},
|
|
28
|
+
"studiocms:config:setup": ({ setRendering }) => {
|
|
29
|
+
setRendering({
|
|
30
|
+
pageTypes: [
|
|
31
|
+
// Define the HTML page type
|
|
32
|
+
{
|
|
33
|
+
identifier: "studiocms/html",
|
|
34
|
+
label: "HTML",
|
|
35
|
+
pageContentComponent: resolve("./components/editor.astro"),
|
|
36
|
+
rendererComponent: resolve("./components/renderer.astro")
|
|
37
|
+
}
|
|
38
|
+
]
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
var index_default = studiocmsHTML;
|
|
45
|
+
export {
|
|
46
|
+
index_default as default,
|
|
47
|
+
studiocmsHTML
|
|
48
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { HTMLSchemaOptions } from '../types.js';
|
|
2
|
+
export declare const symbol: symbol;
|
|
3
|
+
/**
|
|
4
|
+
* A shared object that is either retrieved from the global scope using a symbol or
|
|
5
|
+
* initialized as a new object with a `htmlConfig` property.
|
|
6
|
+
*
|
|
7
|
+
* @remarks
|
|
8
|
+
* The `@ts-ignore` comments are used to suppress TypeScript errors related to the use of
|
|
9
|
+
* the global scope and assignment within expressions. The `biome-ignore` comment is used
|
|
10
|
+
* to suppress linting errors for the same reason.
|
|
11
|
+
*/
|
|
12
|
+
export declare const shared: {
|
|
13
|
+
htmlConfig?: HTMLSchemaOptions;
|
|
14
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
const symbol = Symbol.for("@studiocms/html");
|
|
2
|
+
const shared = (
|
|
3
|
+
// @ts-ignore
|
|
4
|
+
globalThis[symbol] || // @ts-ignore
|
|
5
|
+
// biome-ignore lint/suspicious/noAssignInExpressions: This is a valid use case for assignment in expressions.
|
|
6
|
+
(globalThis[symbol] = {
|
|
7
|
+
htmlConfig: void 0
|
|
8
|
+
})
|
|
9
|
+
);
|
|
10
|
+
export {
|
|
11
|
+
shared,
|
|
12
|
+
symbol
|
|
13
|
+
};
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { z } from 'astro/zod';
|
|
2
|
+
/**
|
|
3
|
+
* Defines the schema for HTML configuration options.
|
|
4
|
+
*
|
|
5
|
+
* The schema includes an optional `sanitize` property, which is validated
|
|
6
|
+
* using the `StudioCMSSanitizeOptionsSchema`. If no value is provided,
|
|
7
|
+
* the default is an empty object.
|
|
8
|
+
*/
|
|
9
|
+
export declare const HTMLSchema: z.ZodDefault<z.ZodOptional<z.ZodObject<{
|
|
10
|
+
/** Sanitization options for HTML content. See {@link StudioCMSSanitizeOptionsSchema} for details. */
|
|
11
|
+
sanitize: z.ZodOptional<z.ZodObject<{
|
|
12
|
+
allowElements: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
13
|
+
blockElements: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
14
|
+
dropElements: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
15
|
+
allowAttributes: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString, "many">>>;
|
|
16
|
+
dropAttributes: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString, "many">>>;
|
|
17
|
+
allowComponents: z.ZodOptional<z.ZodBoolean>;
|
|
18
|
+
allowCustomElements: z.ZodOptional<z.ZodBoolean>;
|
|
19
|
+
allowComments: z.ZodOptional<z.ZodBoolean>;
|
|
20
|
+
}, "strip", z.ZodTypeAny, {
|
|
21
|
+
allowElements?: string[] | undefined;
|
|
22
|
+
blockElements?: string[] | undefined;
|
|
23
|
+
dropElements?: string[] | undefined;
|
|
24
|
+
allowAttributes?: Record<string, string[]> | undefined;
|
|
25
|
+
dropAttributes?: Record<string, string[]> | undefined;
|
|
26
|
+
allowComponents?: boolean | undefined;
|
|
27
|
+
allowCustomElements?: boolean | undefined;
|
|
28
|
+
allowComments?: boolean | undefined;
|
|
29
|
+
}, {
|
|
30
|
+
allowElements?: string[] | undefined;
|
|
31
|
+
blockElements?: string[] | undefined;
|
|
32
|
+
dropElements?: string[] | undefined;
|
|
33
|
+
allowAttributes?: Record<string, string[]> | undefined;
|
|
34
|
+
dropAttributes?: Record<string, string[]> | undefined;
|
|
35
|
+
allowComponents?: boolean | undefined;
|
|
36
|
+
allowCustomElements?: boolean | undefined;
|
|
37
|
+
allowComments?: boolean | undefined;
|
|
38
|
+
}>>;
|
|
39
|
+
}, "strip", z.ZodTypeAny, {
|
|
40
|
+
sanitize?: {
|
|
41
|
+
allowElements?: string[] | undefined;
|
|
42
|
+
blockElements?: string[] | undefined;
|
|
43
|
+
dropElements?: string[] | undefined;
|
|
44
|
+
allowAttributes?: Record<string, string[]> | undefined;
|
|
45
|
+
dropAttributes?: Record<string, string[]> | undefined;
|
|
46
|
+
allowComponents?: boolean | undefined;
|
|
47
|
+
allowCustomElements?: boolean | undefined;
|
|
48
|
+
allowComments?: boolean | undefined;
|
|
49
|
+
} | undefined;
|
|
50
|
+
}, {
|
|
51
|
+
sanitize?: {
|
|
52
|
+
allowElements?: string[] | undefined;
|
|
53
|
+
blockElements?: string[] | undefined;
|
|
54
|
+
dropElements?: string[] | undefined;
|
|
55
|
+
allowAttributes?: Record<string, string[]> | undefined;
|
|
56
|
+
dropAttributes?: Record<string, string[]> | undefined;
|
|
57
|
+
allowComponents?: boolean | undefined;
|
|
58
|
+
allowCustomElements?: boolean | undefined;
|
|
59
|
+
allowComments?: boolean | undefined;
|
|
60
|
+
} | undefined;
|
|
61
|
+
}>>>;
|
|
62
|
+
export type HTMLSchemaOptions = z.infer<typeof HTMLSchema>;
|
package/dist/types.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { z } from "astro/zod";
|
|
2
|
+
import { StudioCMSSanitizeOptionsSchema } from "studiocms/schemas";
|
|
3
|
+
const HTMLSchema = z.object({
|
|
4
|
+
/** Sanitization options for HTML content. See {@link StudioCMSSanitizeOptionsSchema} for details. */
|
|
5
|
+
sanitize: StudioCMSSanitizeOptionsSchema
|
|
6
|
+
}).optional().default({});
|
|
7
|
+
export {
|
|
8
|
+
HTMLSchema
|
|
9
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@studiocms/html",
|
|
3
|
+
"version": "0.1.0-beta.22",
|
|
4
|
+
"description": "Add HTML Support to your StudioCMS project with ease!",
|
|
5
|
+
"author": {
|
|
6
|
+
"name": "withstudiocms",
|
|
7
|
+
"url": "https://studiocms.dev"
|
|
8
|
+
},
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "git+https://github.com/withstudiocms/studiocms.git",
|
|
12
|
+
"directory": "packages/@studiocms/html"
|
|
13
|
+
},
|
|
14
|
+
"contributors": [
|
|
15
|
+
"Adammatthiesen",
|
|
16
|
+
"jdtjenkins",
|
|
17
|
+
"dreyfus92",
|
|
18
|
+
"code.spirit"
|
|
19
|
+
],
|
|
20
|
+
"license": "MIT",
|
|
21
|
+
"keywords": [
|
|
22
|
+
"astro",
|
|
23
|
+
"astrocms",
|
|
24
|
+
"astrodb",
|
|
25
|
+
"astrostudio",
|
|
26
|
+
"astro-integration",
|
|
27
|
+
"astro-studio",
|
|
28
|
+
"astro-studiocms",
|
|
29
|
+
"cms",
|
|
30
|
+
"studiocms",
|
|
31
|
+
"withastro",
|
|
32
|
+
"plugin",
|
|
33
|
+
"studiocms-plugin"
|
|
34
|
+
],
|
|
35
|
+
"homepage": "https://studiocms.dev",
|
|
36
|
+
"publishConfig": {
|
|
37
|
+
"access": "public",
|
|
38
|
+
"provenance": true
|
|
39
|
+
},
|
|
40
|
+
"sideEffects": false,
|
|
41
|
+
"files": [
|
|
42
|
+
"dist"
|
|
43
|
+
],
|
|
44
|
+
"exports": {
|
|
45
|
+
".": {
|
|
46
|
+
"types": "./dist/index.d.ts",
|
|
47
|
+
"default": "./dist/index.js"
|
|
48
|
+
},
|
|
49
|
+
"./types": {
|
|
50
|
+
"types": "./dist/types.d.ts",
|
|
51
|
+
"default": "./dist/types.js"
|
|
52
|
+
},
|
|
53
|
+
"./v/types": {
|
|
54
|
+
"types": "./dist/virtual.d.ts",
|
|
55
|
+
"default": "./dist/virtual.d.js"
|
|
56
|
+
},
|
|
57
|
+
"./editor": "./dist/components/editor.astro",
|
|
58
|
+
"./renderer": "./dist/components/renderer.astro"
|
|
59
|
+
},
|
|
60
|
+
"type": "module",
|
|
61
|
+
"dependencies": {
|
|
62
|
+
"astro-integration-kit": "^0.18",
|
|
63
|
+
"codemirror": "5.65.19",
|
|
64
|
+
"katex": "^0.16.22",
|
|
65
|
+
"suneditor": "^2.47.6"
|
|
66
|
+
},
|
|
67
|
+
"devDependencies": {
|
|
68
|
+
"@types/codemirror": "5.60.16",
|
|
69
|
+
"@types/node": "^22.0.0"
|
|
70
|
+
},
|
|
71
|
+
"peerDependencies": {
|
|
72
|
+
"astro": "^5.12.6",
|
|
73
|
+
"effect": "^3.17.3",
|
|
74
|
+
"vite": "^6.3.4",
|
|
75
|
+
"studiocms": "0.1.0-beta.22"
|
|
76
|
+
},
|
|
77
|
+
"scripts": {
|
|
78
|
+
"build": "buildkit build 'src/**/*.{ts,astro,css,json,png}'",
|
|
79
|
+
"dev": "buildkit dev 'src/**/*.{ts,astro,css,json,png}'",
|
|
80
|
+
"typecheck": "tspc -p tsconfig.tspc.json"
|
|
81
|
+
}
|
|
82
|
+
}
|