@studiocms/wysiwyg 0.1.0-beta.24
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 +20 -0
- package/dist/common/componentRegistry.d.ts +31 -0
- package/dist/common/componentRegistry.js +59 -0
- package/dist/common/editor-settings.d.ts +23 -0
- package/dist/common/editor-settings.js +357 -0
- package/dist/common/editor-utils.d.ts +165 -0
- package/dist/common/editor-utils.js +217 -0
- package/dist/common/grapesBlocks/blocks/basics.d.ts +4 -0
- package/dist/common/grapesBlocks/blocks/basics.js +279 -0
- package/dist/common/grapesBlocks/blocks/extras.d.ts +4 -0
- package/dist/common/grapesBlocks/blocks/extras.js +63 -0
- package/dist/common/grapesBlocks/blocks/forms.d.ts +4 -0
- package/dist/common/grapesBlocks/blocks/forms.js +94 -0
- package/dist/common/grapesBlocks/blocks/index.d.ts +5 -0
- package/dist/common/grapesBlocks/blocks/index.js +23 -0
- package/dist/common/grapesBlocks/blocks/tabs.d.ts +4 -0
- package/dist/common/grapesBlocks/blocks/tabs.js +20 -0
- package/dist/common/grapesBlocks/commands/clear.d.ts +4 -0
- package/dist/common/grapesBlocks/commands/clear.js +21 -0
- package/dist/common/grapesBlocks/commands/customCodeCommands.d.ts +4 -0
- package/dist/common/grapesBlocks/commands/customCodeCommands.js +111 -0
- package/dist/common/grapesBlocks/commands/deviceCommands.d.ts +3 -0
- package/dist/common/grapesBlocks/commands/deviceCommands.js +23 -0
- package/dist/common/grapesBlocks/commands/index.d.ts +5 -0
- package/dist/common/grapesBlocks/commands/index.js +40 -0
- package/dist/common/grapesBlocks/commands/openImport.d.ts +4 -0
- package/dist/common/grapesBlocks/commands/openImport.js +71 -0
- package/dist/common/grapesBlocks/components/countdown.d.ts +12 -0
- package/dist/common/grapesBlocks/components/countdown.js +148 -0
- package/dist/common/grapesBlocks/components/customCode.d.ts +4 -0
- package/dist/common/grapesBlocks/components/customCode.js +89 -0
- package/dist/common/grapesBlocks/components/forms.d.ts +3 -0
- package/dist/common/grapesBlocks/components/forms.js +278 -0
- package/dist/common/grapesBlocks/components/index.d.ts +5 -0
- package/dist/common/grapesBlocks/components/index.js +23 -0
- package/dist/common/grapesBlocks/components/tabLoader.d.ts +4 -0
- package/dist/common/grapesBlocks/components/tabLoader.js +29 -0
- package/dist/common/grapesBlocks/components/tabs/Tab.d.ts +10 -0
- package/dist/common/grapesBlocks/components/tabs/Tab.js +100 -0
- package/dist/common/grapesBlocks/components/tabs/TabContainer.d.ts +5 -0
- package/dist/common/grapesBlocks/components/tabs/TabContainer.js +23 -0
- package/dist/common/grapesBlocks/components/tabs/TabContent.d.ts +5 -0
- package/dist/common/grapesBlocks/components/tabs/TabContent.js +23 -0
- package/dist/common/grapesBlocks/components/tabs/TabContents.d.ts +4 -0
- package/dist/common/grapesBlocks/components/tabs/TabContents.js +19 -0
- package/dist/common/grapesBlocks/components/tabs/Tabs.d.ts +4 -0
- package/dist/common/grapesBlocks/components/tabs/Tabs.js +169 -0
- package/dist/common/grapesBlocks/components/tooltip.d.ts +4 -0
- package/dist/common/grapesBlocks/components/tooltip.js +246 -0
- package/dist/common/grapesBlocks/components/typed.d.ts +9 -0
- package/dist/common/grapesBlocks/components/typed.js +109 -0
- package/dist/common/grapesBlocks/consts.d.ts +25 -0
- package/dist/common/grapesBlocks/consts.js +245 -0
- package/dist/common/grapesBlocks/i18n/index.d.ts +3 -0
- package/dist/common/grapesBlocks/i18n/index.js +19 -0
- package/dist/common/grapesBlocks/index.d.ts +4 -0
- package/dist/common/grapesBlocks/index.js +27 -0
- package/dist/common/grapesBlocks/panels/index.d.ts +4 -0
- package/dist/common/grapesBlocks/panels/index.js +171 -0
- package/dist/common/grapesBlocks/rte/colorPicker.d.ts +104 -0
- package/dist/common/grapesBlocks/rte/colorPicker.js +199 -0
- package/dist/common/grapesBlocks/rte/index.d.ts +48 -0
- package/dist/common/grapesBlocks/rte/index.js +375 -0
- package/dist/common/grapesBlocks/selectors/index.d.ts +4 -0
- package/dist/common/grapesBlocks/selectors/index.js +9 -0
- package/dist/common/grapesBlocks/selectors/tooltip.d.ts +4 -0
- package/dist/common/grapesBlocks/selectors/tooltip.js +15 -0
- package/dist/common/grapesBlocks/traits/formTraits.d.ts +3 -0
- package/dist/common/grapesBlocks/traits/formTraits.js +51 -0
- package/dist/common/grapesBlocks/traits/index.d.ts +4 -0
- package/dist/common/grapesBlocks/traits/index.js +15 -0
- package/dist/common/grapesBlocks/traits/typedTraits.d.ts +3 -0
- package/dist/common/grapesBlocks/traits/typedTraits.js +24 -0
- package/dist/common/grapesBlocks/tuiImageEditor/index.d.ts +86 -0
- package/dist/common/grapesBlocks/tuiImageEditor/index.js +203 -0
- package/dist/common/grapesBlocks/types.d.ts +446 -0
- package/dist/common/grapesBlocks/types.js +0 -0
- package/dist/components/Editor.astro +147 -0
- package/dist/components/Render.astro +24 -0
- package/dist/consts.d.ts +31 -0
- package/dist/consts.js +15 -0
- package/dist/index.d.ts +29 -0
- package/dist/index.js +65 -0
- package/dist/lib/db.d.ts +104 -0
- package/dist/lib/db.js +50 -0
- package/dist/lib/prerender.d.ts +10 -0
- package/dist/lib/prerender.js +22 -0
- package/dist/lib/shared.d.ts +14 -0
- package/dist/lib/shared.js +7 -0
- package/dist/lib/utils.d.ts +16 -0
- package/dist/lib/utils.js +10 -0
- package/dist/routes/grapes.css.d.ts +7 -0
- package/dist/routes/grapes.css.js +13 -0
- package/dist/routes/partial.astro +44 -0
- package/dist/routes/store.d.ts +32 -0
- package/dist/routes/store.js +100 -0
- package/dist/schema.d.ts +60 -0
- package/dist/schema.js +24 -0
- package/dist/styles/editor.css +150 -0
- package/dist/styles/grapes.css +71 -0
- package/dist/types.d.ts +66 -0
- package/dist/types.js +9 -0
- package/package.json +78 -0
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
import { toast } from "@studiocms/ui/components/Toast/toast.js";
|
|
2
|
+
import { CSRF_HEADER_NAME, STORE_ENDPOINT_PATH } from "../consts.js";
|
|
3
|
+
import { firstUpperCase, parse } from "../lib/utils.js";
|
|
4
|
+
const generateHTML = async (editor) => {
|
|
5
|
+
const page = editor.Pages.getMain();
|
|
6
|
+
const component = page.getMainComponent();
|
|
7
|
+
const htmlData = component.toHTML({ tag: "div" });
|
|
8
|
+
const styles = editor.getCss({ component })?.replaceAll("body", "div");
|
|
9
|
+
const html = `${htmlData}${styles ? `<style>${styles}</style>` : ""}`;
|
|
10
|
+
return html;
|
|
11
|
+
};
|
|
12
|
+
const updateSaveIndicator = (editor) => {
|
|
13
|
+
const saveIndicator = document.querySelector(".save-indicator");
|
|
14
|
+
if (saveIndicator && editor.getDirtyCount() === 0) {
|
|
15
|
+
saveIndicator.classList.remove("dirty");
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
const StudioCMSDbStorageAdapter = (editor, opts) => {
|
|
19
|
+
editor.Storage.add("db", {
|
|
20
|
+
async load() {
|
|
21
|
+
const urlToFetch = new URL(STORE_ENDPOINT_PATH, window.location.origin);
|
|
22
|
+
urlToFetch.searchParams.set("projectId", opts.projectId);
|
|
23
|
+
const toastProps = {
|
|
24
|
+
title: "WYSIWYG: Error loading page",
|
|
25
|
+
description: "There was an error loading your page. Fallback data loaded...",
|
|
26
|
+
type: "warning",
|
|
27
|
+
duration: 3e3
|
|
28
|
+
};
|
|
29
|
+
try {
|
|
30
|
+
const data = await fetch(urlToFetch, {
|
|
31
|
+
method: "GET",
|
|
32
|
+
credentials: "same-origin",
|
|
33
|
+
headers: {
|
|
34
|
+
Accept: "application/json",
|
|
35
|
+
"Content-Type": "application/json",
|
|
36
|
+
[CSRF_HEADER_NAME]: opts.csrfToken
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
if (!data.ok) {
|
|
40
|
+
toast(toastProps);
|
|
41
|
+
return opts.projectData;
|
|
42
|
+
}
|
|
43
|
+
const json = await data.json();
|
|
44
|
+
const responseData = json?.data;
|
|
45
|
+
if (!responseData) {
|
|
46
|
+
toast(toastProps);
|
|
47
|
+
return opts.projectData;
|
|
48
|
+
}
|
|
49
|
+
return responseData;
|
|
50
|
+
} catch (error) {
|
|
51
|
+
console.error("Error loading project data:", error);
|
|
52
|
+
toast(toastProps);
|
|
53
|
+
return opts.projectData;
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
async store(data) {
|
|
57
|
+
const urlToFetch = new URL(STORE_ENDPOINT_PATH, window.location.origin);
|
|
58
|
+
const projectData = {
|
|
59
|
+
...data,
|
|
60
|
+
__STUDIOCMS_HTML: await generateHTML(editor)
|
|
61
|
+
};
|
|
62
|
+
const toastProps = {
|
|
63
|
+
title: "WYSIWYG: Error saving page",
|
|
64
|
+
description: "There was an error saving your changes. Only saving fallback data...",
|
|
65
|
+
type: "danger",
|
|
66
|
+
duration: 3e3
|
|
67
|
+
};
|
|
68
|
+
try {
|
|
69
|
+
const response = await fetch(urlToFetch, {
|
|
70
|
+
method: "POST",
|
|
71
|
+
credentials: "same-origin",
|
|
72
|
+
body: JSON.stringify({ projectId: opts.projectId, data: projectData }),
|
|
73
|
+
headers: {
|
|
74
|
+
"Content-Type": "application/json",
|
|
75
|
+
[CSRF_HEADER_NAME]: opts.csrfToken
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
if (!response.ok) {
|
|
79
|
+
toast(toastProps);
|
|
80
|
+
opts.pageContent.innerText = JSON.stringify(projectData);
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
opts.pageContent.innerText = JSON.stringify(projectData);
|
|
84
|
+
updateSaveIndicator(editor);
|
|
85
|
+
} catch (error) {
|
|
86
|
+
console.error("Error saving project data:", error);
|
|
87
|
+
toast(toastProps);
|
|
88
|
+
opts.pageContent.innerText = JSON.stringify(projectData);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
};
|
|
93
|
+
function traitReducer(acc, trait) {
|
|
94
|
+
if (!trait.name) return acc;
|
|
95
|
+
let value = trait.default;
|
|
96
|
+
if (trait.type === "number") {
|
|
97
|
+
value = Number(trait.value !== "" ? trait.value : trait.default);
|
|
98
|
+
} else {
|
|
99
|
+
value = trait.value !== "" ? trait.value : trait.default;
|
|
100
|
+
}
|
|
101
|
+
acc[trait.name] = value;
|
|
102
|
+
return acc;
|
|
103
|
+
}
|
|
104
|
+
const getTraitData = (model) => {
|
|
105
|
+
const traitData = model.traits.toJSON();
|
|
106
|
+
const propsData = traitData.reduce(traitReducer, {});
|
|
107
|
+
return propsData;
|
|
108
|
+
};
|
|
109
|
+
const getSlotData = (model) => {
|
|
110
|
+
const children = model.components().toArray();
|
|
111
|
+
let slotData;
|
|
112
|
+
if (children.length > 0) {
|
|
113
|
+
slotData = children.map((child) => child.toHTML()).join("");
|
|
114
|
+
}
|
|
115
|
+
return slotData;
|
|
116
|
+
};
|
|
117
|
+
const traitTypeFilter = (type) => {
|
|
118
|
+
switch (type) {
|
|
119
|
+
case "number":
|
|
120
|
+
return "number";
|
|
121
|
+
default:
|
|
122
|
+
return "text";
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
const traitMapFn = (prop) => ({
|
|
126
|
+
type: traitTypeFilter(prop.type),
|
|
127
|
+
name: prop.name,
|
|
128
|
+
default: prop.defaultValue
|
|
129
|
+
});
|
|
130
|
+
const partialRequestBuilder = (model) => {
|
|
131
|
+
return {
|
|
132
|
+
method: "POST",
|
|
133
|
+
headers: {
|
|
134
|
+
"Content-Type": "application/json"
|
|
135
|
+
},
|
|
136
|
+
body: JSON.stringify({
|
|
137
|
+
componentKey: model.tagName,
|
|
138
|
+
props: getTraitData(model),
|
|
139
|
+
slot: getSlotData(model)
|
|
140
|
+
})
|
|
141
|
+
};
|
|
142
|
+
};
|
|
143
|
+
function getEditorElmData(document2, selectors) {
|
|
144
|
+
const container = document2.querySelector(selectors.container);
|
|
145
|
+
if (!container) {
|
|
146
|
+
throw new Error("GrapesJS container not found. Ensure the HTML structure is correct.");
|
|
147
|
+
}
|
|
148
|
+
const pageContent = document2.querySelector(
|
|
149
|
+
selectors.pageContent
|
|
150
|
+
);
|
|
151
|
+
if (!pageContent) {
|
|
152
|
+
throw new Error("Page content textarea not found. Ensure the HTML structure is correct.");
|
|
153
|
+
}
|
|
154
|
+
const componentRegistry = parse(
|
|
155
|
+
container.dataset.componentRegistry || "[]"
|
|
156
|
+
);
|
|
157
|
+
const projectId = container.dataset.pageId || "";
|
|
158
|
+
const csrfToken = container.dataset.wysiwygCsrfToken || "";
|
|
159
|
+
const fallbackPages = {
|
|
160
|
+
pages: [{ name: "page" }]
|
|
161
|
+
};
|
|
162
|
+
const projectData = parse(pageContent.innerText || JSON.stringify(fallbackPages));
|
|
163
|
+
return {
|
|
164
|
+
astroComponentsOpts: { componentRegistry },
|
|
165
|
+
StudioCMSDbStorageAdapterOpts: {
|
|
166
|
+
projectId,
|
|
167
|
+
projectData,
|
|
168
|
+
pageContent,
|
|
169
|
+
csrfToken
|
|
170
|
+
}
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
const commonBlockProps = {
|
|
174
|
+
category: "Astro Components",
|
|
175
|
+
select: true,
|
|
176
|
+
activate: true,
|
|
177
|
+
attributes: { class: "gjs-fonts gjs-f-b1" },
|
|
178
|
+
media: '<svg xmlns="http://www.w3.org/2000/svg" style="width:48px;height:48px" viewBox="0 0 24 24"><path fill="currentColor" d="M9.24 19.035c-.901-.826-1.164-2.561-.789-3.819c.65.793 1.552 1.044 2.486 1.186c1.44.218 2.856.137 4.195-.524c.153-.076.295-.177.462-.278c.126.365.159.734.115 1.11c-.107.915-.56 1.622-1.283 2.158c-.289.215-.594.406-.892.608c-.916.622-1.164 1.35-.82 2.41l.034.114a2.4 2.4 0 0 1-1.07-.918a2.6 2.6 0 0 1-.412-1.401c-.003-.248-.003-.497-.036-.74c-.081-.595-.36-.86-.883-.876a1.034 1.034 0 0 0-1.075.843q-.013.058-.033.126M4.1 15.007s2.666-1.303 5.34-1.303l2.016-6.26c.075-.304.296-.51.544-.51c.25 0 .47.206.545.51l2.016 6.26c3.167 0 5.34 1.303 5.34 1.303L15.363 2.602c-.13-.366-.35-.602-.645-.602H9.283c-.296 0-.506.236-.645.602c-.01.024-4.538 12.405-4.538 12.405"/></svg>'
|
|
179
|
+
};
|
|
180
|
+
function buildBlockProps(name) {
|
|
181
|
+
switch (name) {
|
|
182
|
+
case "cms-img": {
|
|
183
|
+
return {
|
|
184
|
+
...commonBlockProps,
|
|
185
|
+
id: name,
|
|
186
|
+
label: `${firstUpperCase(name)}`,
|
|
187
|
+
content: {
|
|
188
|
+
style: { color: "black" },
|
|
189
|
+
type: "image"
|
|
190
|
+
}
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
default: {
|
|
194
|
+
return {
|
|
195
|
+
...commonBlockProps,
|
|
196
|
+
id: name,
|
|
197
|
+
label: `${firstUpperCase(name)}`,
|
|
198
|
+
content: {
|
|
199
|
+
type: name,
|
|
200
|
+
tagName: name
|
|
201
|
+
}
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
export {
|
|
207
|
+
StudioCMSDbStorageAdapter,
|
|
208
|
+
buildBlockProps,
|
|
209
|
+
generateHTML,
|
|
210
|
+
getEditorElmData,
|
|
211
|
+
getSlotData,
|
|
212
|
+
getTraitData,
|
|
213
|
+
partialRequestBuilder,
|
|
214
|
+
traitMapFn,
|
|
215
|
+
traitReducer,
|
|
216
|
+
traitTypeFilter
|
|
217
|
+
};
|
|
@@ -0,0 +1,279 @@
|
|
|
1
|
+
import { AddBlocks } from "./index.js";
|
|
2
|
+
var basics_default = (editor, opts) => {
|
|
3
|
+
const addBlock = AddBlocks(editor, opts);
|
|
4
|
+
const { stylePrefix, flexGrid, rowHeight, addBasicStyle } = opts;
|
|
5
|
+
const clsRow = `${stylePrefix}row`;
|
|
6
|
+
const clsCell = `${stylePrefix}cell`;
|
|
7
|
+
const styleRow = flexGrid ? `
|
|
8
|
+
.${clsRow} {
|
|
9
|
+
display: flex;
|
|
10
|
+
justify-content: flex-start;
|
|
11
|
+
align-items: stretch;
|
|
12
|
+
flex-wrap: nowrap;
|
|
13
|
+
padding: 10px;
|
|
14
|
+
}
|
|
15
|
+
@media (max-width: 768px) {
|
|
16
|
+
.${clsRow} {
|
|
17
|
+
flex-wrap: wrap;
|
|
18
|
+
}
|
|
19
|
+
}` : `
|
|
20
|
+
.${clsRow} {
|
|
21
|
+
display: table;
|
|
22
|
+
padding: 10px;
|
|
23
|
+
width: 100%;
|
|
24
|
+
}
|
|
25
|
+
@media (max-width: 768px) {
|
|
26
|
+
.${stylePrefix}cell, .${stylePrefix}cell30, .${stylePrefix}cell70 {
|
|
27
|
+
width: 100%;
|
|
28
|
+
display: block;
|
|
29
|
+
}
|
|
30
|
+
}`;
|
|
31
|
+
const styleClm = flexGrid ? `
|
|
32
|
+
.${clsCell} {
|
|
33
|
+
min-height: ${rowHeight}px;
|
|
34
|
+
flex-grow: 1;
|
|
35
|
+
flex-basis: 100%;
|
|
36
|
+
}` : `
|
|
37
|
+
.${clsCell} {
|
|
38
|
+
width: 8%;
|
|
39
|
+
display: table-cell;
|
|
40
|
+
height: ${rowHeight}px;
|
|
41
|
+
}`;
|
|
42
|
+
const styleClm30 = `
|
|
43
|
+
.${stylePrefix}cell30 {
|
|
44
|
+
width: 30%;
|
|
45
|
+
}`;
|
|
46
|
+
const styleClm70 = `
|
|
47
|
+
.${stylePrefix}cell70 {
|
|
48
|
+
width: 70%;
|
|
49
|
+
}`;
|
|
50
|
+
const step = 0.2;
|
|
51
|
+
const minDim = 1;
|
|
52
|
+
const currentUnit = 1;
|
|
53
|
+
const resizerBtm = {
|
|
54
|
+
tl: 0,
|
|
55
|
+
tc: 0,
|
|
56
|
+
tr: 0,
|
|
57
|
+
cl: 0,
|
|
58
|
+
cr: 0,
|
|
59
|
+
bl: 0,
|
|
60
|
+
br: 0,
|
|
61
|
+
minDim
|
|
62
|
+
};
|
|
63
|
+
const resizerRight = {
|
|
64
|
+
...resizerBtm,
|
|
65
|
+
cr: 1,
|
|
66
|
+
bc: 0,
|
|
67
|
+
currentUnit,
|
|
68
|
+
minDim,
|
|
69
|
+
step
|
|
70
|
+
};
|
|
71
|
+
if (flexGrid) {
|
|
72
|
+
resizerRight.keyWidth = "flex-basis";
|
|
73
|
+
}
|
|
74
|
+
const rowAttr = {
|
|
75
|
+
class: clsRow,
|
|
76
|
+
"data-gjs-droppable": `.${clsCell}`,
|
|
77
|
+
"data-gjs-resizable": resizerBtm,
|
|
78
|
+
"data-gjs-name": "Row"
|
|
79
|
+
};
|
|
80
|
+
const colAttr = {
|
|
81
|
+
class: clsCell,
|
|
82
|
+
"data-gjs-draggable": `.${clsRow}`,
|
|
83
|
+
"data-gjs-resizable": resizerRight,
|
|
84
|
+
"data-gjs-name": "Cell"
|
|
85
|
+
};
|
|
86
|
+
if (flexGrid) {
|
|
87
|
+
colAttr["data-gjs-unstylable"] = ["width"];
|
|
88
|
+
colAttr["data-gjs-stylable-require"] = ["flex-basis"];
|
|
89
|
+
}
|
|
90
|
+
const privateCls = [`.${clsRow}`, `.${clsCell}`];
|
|
91
|
+
editor.on(
|
|
92
|
+
"selector:add",
|
|
93
|
+
(selector) => privateCls.indexOf(selector.getFullName()) >= 0 && selector.set("private", 1)
|
|
94
|
+
);
|
|
95
|
+
const attrsToString = (attrs) => {
|
|
96
|
+
const result = [];
|
|
97
|
+
for (const key in attrs) {
|
|
98
|
+
let value = attrs[key];
|
|
99
|
+
const toParse = Array.isArray(value) || value instanceof Object;
|
|
100
|
+
value = toParse ? JSON.stringify(value) : value;
|
|
101
|
+
result.push(`${key}=${toParse ? `'${value}'` : `"${value}"`}`);
|
|
102
|
+
}
|
|
103
|
+
return result.length ? ` ${result.join(" ")}` : "";
|
|
104
|
+
};
|
|
105
|
+
const attrsRow = attrsToString(rowAttr);
|
|
106
|
+
const attrsCell = attrsToString(colAttr);
|
|
107
|
+
const category = "Basic";
|
|
108
|
+
const commonBasicBlockProps = {
|
|
109
|
+
category,
|
|
110
|
+
select: true
|
|
111
|
+
};
|
|
112
|
+
addBlock("link-block", {
|
|
113
|
+
category,
|
|
114
|
+
label: "Link Block",
|
|
115
|
+
media: `<svg viewBox="0 0 24 24">
|
|
116
|
+
<path fill="currentColor" d="M3.9,12C3.9,10.29 5.29,8.9 7,8.9H11V7H7A5,5 0 0,0 2,12A5,5 0 0,0 7,17H11V15.1H7C5.29,15.1 3.9,13.71 3.9,12M8,13H16V11H8V13M17,7H13V8.9H17C18.71,8.9 20.1,10.29 20.1,12C20.1,13.71 18.71,15.1 17,15.1H13V17H17A5,5 0 0,0 22,12A5,5 0 0,0 17,7Z"></path>
|
|
117
|
+
</svg>`,
|
|
118
|
+
content: {
|
|
119
|
+
type: "link",
|
|
120
|
+
editable: false,
|
|
121
|
+
droppable: true,
|
|
122
|
+
style: {
|
|
123
|
+
display: "inline-block",
|
|
124
|
+
padding: "5px",
|
|
125
|
+
"min-height": "50px",
|
|
126
|
+
"min-width": "50px"
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
addBlock("quote", {
|
|
131
|
+
category,
|
|
132
|
+
label: "Quote",
|
|
133
|
+
media: `<svg viewBox="0 0 24 24">
|
|
134
|
+
<path fill="currentColor" d="M14,17H17L19,13V7H13V13H16M6,17H9L11,13V7H5V13H8L6,17Z" />
|
|
135
|
+
</svg>`,
|
|
136
|
+
content: `<blockquote class="quote">
|
|
137
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore ipsum dolor sit
|
|
138
|
+
</blockquote>`
|
|
139
|
+
});
|
|
140
|
+
addBlock("text-basic", {
|
|
141
|
+
category,
|
|
142
|
+
label: "Text section",
|
|
143
|
+
media: `<svg viewBox="0 0 24 24">
|
|
144
|
+
<path fill="currentColor" d="M21,6V8H3V6H21M3,18H12V16H3V18M3,13H21V11H3V13Z" />
|
|
145
|
+
</svg>`,
|
|
146
|
+
content: `<section class="bdg-sect">
|
|
147
|
+
<h1 class="heading">Insert title here</h1>
|
|
148
|
+
<p class="paragraph">Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua</p>
|
|
149
|
+
</section>`
|
|
150
|
+
});
|
|
151
|
+
addBlock("column1", {
|
|
152
|
+
...commonBasicBlockProps,
|
|
153
|
+
label: opts.labelColumn1,
|
|
154
|
+
media: `<svg viewBox="0 0 24 24">
|
|
155
|
+
<path fill="currentColor" d="M2 20h20V4H2v16Zm-1 0V4a1 1 0 0 1 1-1h20a1 1 0 0 1 1 1v16a1 1 0 0 1-1 1H2a1 1 0 0 1-1-1Z"/>
|
|
156
|
+
</svg>`,
|
|
157
|
+
content: `<div ${attrsRow}>
|
|
158
|
+
<div ${attrsCell}></div>
|
|
159
|
+
</div>
|
|
160
|
+
${addBasicStyle ? `<style>
|
|
161
|
+
${styleRow}
|
|
162
|
+
${styleClm}
|
|
163
|
+
</style>` : ""}`
|
|
164
|
+
});
|
|
165
|
+
addBlock("column2", {
|
|
166
|
+
...commonBasicBlockProps,
|
|
167
|
+
label: opts.labelColumn2,
|
|
168
|
+
media: `<svg viewBox="0 0 23 24">
|
|
169
|
+
<path fill="currentColor" d="M2 20h8V4H2v16Zm-1 0V4a1 1 0 0 1 1-1h8a1 1 0 0 1 1 1v16a1 1 0 0 1-1 1H2a1 1 0 0 1-1-1ZM13 20h8V4h-8v16Zm-1 0V4a1 1 0 0 1 1-1h8a1 1 0 0 1 1 1v16a1 1 0 0 1-1 1h-8a1 1 0 0 1-1-1Z"/>
|
|
170
|
+
</svg>`,
|
|
171
|
+
content: `<div ${attrsRow}>
|
|
172
|
+
<div ${attrsCell}></div>
|
|
173
|
+
<div ${attrsCell}></div>
|
|
174
|
+
</div>
|
|
175
|
+
${addBasicStyle ? `<style>
|
|
176
|
+
${styleRow}
|
|
177
|
+
${styleClm}
|
|
178
|
+
</style>` : ""}`
|
|
179
|
+
});
|
|
180
|
+
addBlock("column3", {
|
|
181
|
+
...commonBasicBlockProps,
|
|
182
|
+
label: opts.labelColumn3,
|
|
183
|
+
media: `<svg viewBox="0 0 23 24">
|
|
184
|
+
<path fill="currentColor" d="M2 20h4V4H2v16Zm-1 0V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v16a1 1 0 0 1-1 1H2a1 1 0 0 1-1-1ZM17 20h4V4h-4v16Zm-1 0V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v16a1 1 0 0 1-1 1h-4a1 1 0 0 1-1-1ZM9.5 20h4V4h-4v16Zm-1 0V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v16a1 1 0 0 1-1 1h-4a1 1 0 0 1-1-1Z"/>
|
|
185
|
+
</svg>`,
|
|
186
|
+
content: `<div ${attrsRow}>
|
|
187
|
+
<div ${attrsCell}></div>
|
|
188
|
+
<div ${attrsCell}></div>
|
|
189
|
+
<div ${attrsCell}></div>
|
|
190
|
+
</div>
|
|
191
|
+
${addBasicStyle ? `<style>
|
|
192
|
+
${styleRow}
|
|
193
|
+
${styleClm}
|
|
194
|
+
</style>` : ""}`
|
|
195
|
+
});
|
|
196
|
+
addBlock("column3-7", {
|
|
197
|
+
...commonBasicBlockProps,
|
|
198
|
+
label: opts.labelColumn37,
|
|
199
|
+
media: `<svg viewBox="0 0 24 24">
|
|
200
|
+
<path fill="currentColor" d="M2 20h5V4H2v16Zm-1 0V4a1 1 0 0 1 1-1h5a1 1 0 0 1 1 1v16a1 1 0 0 1-1 1H2a1 1 0 0 1-1-1ZM10 20h12V4H10v16Zm-1 0V4a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v16a1 1 0 0 1-1 1H10a1 1 0 0 1-1-1Z"/>
|
|
201
|
+
</svg>`,
|
|
202
|
+
content: `<div ${attrsRow}>
|
|
203
|
+
<div ${attrsCell} style='${flexGrid ? "flex-basis" : "width"}: 30%;'></div>
|
|
204
|
+
<div ${attrsCell} style='${flexGrid ? "flex-basis" : "width"}: 70%;'></div>
|
|
205
|
+
</div>
|
|
206
|
+
${addBasicStyle ? `<style>
|
|
207
|
+
${styleRow}
|
|
208
|
+
${styleClm}
|
|
209
|
+
${styleClm30}
|
|
210
|
+
${styleClm70}
|
|
211
|
+
</style>` : ""}`
|
|
212
|
+
});
|
|
213
|
+
addBlock("text", {
|
|
214
|
+
...commonBasicBlockProps,
|
|
215
|
+
activate: true,
|
|
216
|
+
label: opts.labelText,
|
|
217
|
+
media: `<svg viewBox="0 0 24 24">
|
|
218
|
+
<path fill="currentColor" d="M18.5,4L19.66,8.35L18.7,8.61C18.25,7.74 17.79,6.87 17.26,6.43C16.73,6 16.11,6 15.5,6H13V16.5C13,17 13,17.5 13.33,17.75C13.67,18 14.33,18 15,18V19H9V18C9.67,18 10.33,18 10.67,17.75C11,17.5 11,17 11,16.5V6H8.5C7.89,6 7.27,6 6.74,6.43C6.21,6.87 5.75,7.74 5.3,8.61L4.34,8.35L5.5,4H18.5Z" />
|
|
219
|
+
</svg>`,
|
|
220
|
+
content: {
|
|
221
|
+
type: "text",
|
|
222
|
+
content: "Insert your text here",
|
|
223
|
+
style: { padding: "10px" }
|
|
224
|
+
}
|
|
225
|
+
});
|
|
226
|
+
addBlock("link", {
|
|
227
|
+
...commonBasicBlockProps,
|
|
228
|
+
label: opts.labelLink,
|
|
229
|
+
media: `<svg viewBox="0 0 24 24">
|
|
230
|
+
<path fill="currentColor" d="M3.9,12C3.9,10.29 5.29,8.9 7,8.9H11V7H7A5,5 0 0,0 2,12A5,5 0 0,0 7,17H11V15.1H7C5.29,15.1 3.9,13.71 3.9,12M8,13H16V11H8V13M17,7H13V8.9H17C18.71,8.9 20.1,10.29 20.1,12C20.1,13.71 18.71,15.1 17,15.1H13V17H17A5,5 0 0,0 22,12A5,5 0 0,0 17,7Z" />
|
|
231
|
+
</svg>`,
|
|
232
|
+
content: {
|
|
233
|
+
type: "link",
|
|
234
|
+
content: "Link",
|
|
235
|
+
style: { color: "#d983a6" }
|
|
236
|
+
}
|
|
237
|
+
});
|
|
238
|
+
addBlock("image", {
|
|
239
|
+
...commonBasicBlockProps,
|
|
240
|
+
activate: true,
|
|
241
|
+
label: opts.labelImage,
|
|
242
|
+
media: `<svg viewBox="0 0 24 24">
|
|
243
|
+
<path fill="currentColor" d="M21,3H3C2,3 1,4 1,5V19A2,2 0 0,0 3,21H21C22,21 23,20 23,19V5C23,4 22,3 21,3M5,17L8.5,12.5L11,15.5L14.5,11L19,17H5Z" />
|
|
244
|
+
</svg>`,
|
|
245
|
+
content: {
|
|
246
|
+
style: { color: "black" },
|
|
247
|
+
type: "image"
|
|
248
|
+
}
|
|
249
|
+
});
|
|
250
|
+
addBlock("video", {
|
|
251
|
+
...commonBasicBlockProps,
|
|
252
|
+
label: opts.labelVideo,
|
|
253
|
+
media: `<svg viewBox="0 0 24 24">
|
|
254
|
+
<path fill="currentColor" d="M10,15L15.19,12L10,9V15M21.56,7.17C21.69,7.64 21.78,8.27 21.84,9.07C21.91,9.87 21.94,10.56 21.94,11.16L22,12C22,14.19 21.84,15.8 21.56,16.83C21.31,17.73 20.73,18.31 19.83,18.56C19.36,18.69 18.5,18.78 17.18,18.84C15.88,18.91 14.69,18.94 13.59,18.94L12,19C7.81,19 5.2,18.84 4.17,18.56C3.27,18.31 2.69,17.73 2.44,16.83C2.31,16.36 2.22,15.73 2.16,14.93C2.09,14.13 2.06,13.44 2.06,12.84L2,12C2,9.81 2.16,8.2 2.44,7.17C2.69,6.27 3.27,5.69 4.17,5.44C4.64,5.31 5.5,5.22 6.82,5.16C8.12,5.09 9.31,5.06 10.41,5.06L12,5C16.19,5 18.8,5.16 19.83,5.44C20.73,5.69 21.31,6.27 21.56,7.17Z" />
|
|
255
|
+
</svg>`,
|
|
256
|
+
content: {
|
|
257
|
+
type: "video",
|
|
258
|
+
src: "img/video2.webm",
|
|
259
|
+
style: {
|
|
260
|
+
height: "350px",
|
|
261
|
+
width: "615px"
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
});
|
|
265
|
+
addBlock("map", {
|
|
266
|
+
...commonBasicBlockProps,
|
|
267
|
+
label: opts.labelMap,
|
|
268
|
+
media: `<svg viewBox="0 0 24 24">
|
|
269
|
+
<path fill="currentColor" d="M20.5,3L20.34,3.03L15,5.1L9,3L3.36,4.9C3.15,4.97 3,5.15 3,5.38V20.5A0.5,0.5 0 0,0 3.5,21L3.66,20.97L9,18.9L15,21L20.64,19.1C20.85,19.03 21,18.85 21,18.62V3.5A0.5,0.5 0 0,0 20.5,3M10,5.47L14,6.87V18.53L10,17.13V5.47M5,6.46L8,5.45V17.15L5,18.31V6.46M19,17.54L16,18.55V6.86L19,5.7V17.54Z" />
|
|
270
|
+
</svg>`,
|
|
271
|
+
content: {
|
|
272
|
+
type: "map",
|
|
273
|
+
style: { height: "350px" }
|
|
274
|
+
}
|
|
275
|
+
});
|
|
276
|
+
};
|
|
277
|
+
export {
|
|
278
|
+
basics_default as default
|
|
279
|
+
};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { typeCustomCode, typedId } from "../consts.js";
|
|
2
|
+
import { AddBlocks } from "./index.js";
|
|
3
|
+
var extras_default = (editor, opts) => {
|
|
4
|
+
const addBlock = AddBlocks(editor, opts);
|
|
5
|
+
const extrasCategory = "Extra";
|
|
6
|
+
const sharedExtraBlockProps = {
|
|
7
|
+
select: true,
|
|
8
|
+
category: extrasCategory
|
|
9
|
+
};
|
|
10
|
+
const { id: tooltipId, labelTooltip, blockTooltip } = opts.tooltip;
|
|
11
|
+
if (blockTooltip) {
|
|
12
|
+
addBlock(tooltipId, {
|
|
13
|
+
label: labelTooltip,
|
|
14
|
+
content: { type: tooltipId },
|
|
15
|
+
media: `<svg viewBox="0 0 24 24">
|
|
16
|
+
<path d="M4 2h16c1.1 0 2 .9 2 2v12c0 1.1-.9 2-2 2h-4l-4 4-4-4H4c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2m0 2v12h4.83L12 19.17 15.17 16H20V4H4z"></path>
|
|
17
|
+
</svg>`,
|
|
18
|
+
...sharedExtraBlockProps,
|
|
19
|
+
...blockTooltip
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
addBlock(typedId, {
|
|
23
|
+
label: "Typed",
|
|
24
|
+
media: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 300 300"><path d="M212.3 44l2.3 49.6h-6A60 60 0 00204 75c-3.2-6-7.5-10.5-12.9-13.3a44.9 44.9 0 00-21.1-4.3h-29.8V219c0 13 1.4 21 4.2 24.3 4 4.4 10 6.6 18.2 6.6h7.4v5.7H80.2V250h7.5c9 0 15.3-2.7 19-8.2 2.4-3.3 3.5-10.9 3.5-22.7V57.3H84.8a71 71 0 00-21.1 2.2 29 29 0 00-13.9 11.3 46.1 46.1 0 00-6.9 22.8H37L39.5 44h172.8zM245 22h18v256h-18z"/></svg>',
|
|
25
|
+
content: { type: typedId },
|
|
26
|
+
...sharedExtraBlockProps,
|
|
27
|
+
...opts.typed.block
|
|
28
|
+
});
|
|
29
|
+
const {
|
|
30
|
+
block: countdownBlock,
|
|
31
|
+
id: countdownId,
|
|
32
|
+
label: countdownLabel
|
|
33
|
+
} = opts.countdown;
|
|
34
|
+
if (countdownBlock) {
|
|
35
|
+
addBlock(countdownId, {
|
|
36
|
+
media: `<svg viewBox="0 0 24 24">
|
|
37
|
+
<path fill="currentColor" d="M12 20C16.4 20 20 16.4 20 12S16.4 4 12 4 4 7.6 4 12 7.6 20 12 20M12 2C17.5 2 22 6.5 22 12S17.5 22 12 22C6.5 22 2 17.5 2 12C2 6.5 6.5 2 12 2M17 11.5V13H11V7H12.5V11.5H17Z" />
|
|
38
|
+
</svg>`,
|
|
39
|
+
label: countdownLabel,
|
|
40
|
+
content: { type: countdownId },
|
|
41
|
+
...sharedExtraBlockProps,
|
|
42
|
+
...countdownBlock
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
const { blockCustomCode } = opts.customCode;
|
|
46
|
+
if (blockCustomCode) {
|
|
47
|
+
addBlock(typeCustomCode, {
|
|
48
|
+
label: "Custom Code",
|
|
49
|
+
media: `
|
|
50
|
+
<svg viewBox="0 0 24 24">
|
|
51
|
+
<path d="M14.6 16.6l4.6-4.6-4.6-4.6L16 6l6 6-6 6-1.4-1.4m-5.2 0L4.8 12l4.6-4.6L8 6l-6 6 6 6 1.4-1.4z"></path>
|
|
52
|
+
</svg>
|
|
53
|
+
`,
|
|
54
|
+
activate: true,
|
|
55
|
+
...sharedExtraBlockProps,
|
|
56
|
+
content: { type: typeCustomCode },
|
|
57
|
+
...blockCustomCode
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
export {
|
|
62
|
+
extras_default as default
|
|
63
|
+
};
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import {
|
|
2
|
+
typeButton,
|
|
3
|
+
typeCheckbox,
|
|
4
|
+
typeForm,
|
|
5
|
+
typeInput,
|
|
6
|
+
typeLabel,
|
|
7
|
+
typeRadio,
|
|
8
|
+
typeSelect,
|
|
9
|
+
typeTextarea
|
|
10
|
+
} from "../consts.js";
|
|
11
|
+
import { AddBlocks } from "./index.js";
|
|
12
|
+
var forms_default = (editor, opts) => {
|
|
13
|
+
const addBlock = AddBlocks(editor, opts);
|
|
14
|
+
const formsCategory = "Forms";
|
|
15
|
+
addBlock(typeForm, {
|
|
16
|
+
label: "Form",
|
|
17
|
+
category: formsCategory,
|
|
18
|
+
media: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M22 5.5c0-.3-.5-.5-1.3-.5H3.4c-.8 0-1.3.2-1.3.5v3c0 .3.5.5 1.3.5h17.4c.8 0 1.3-.2 1.3-.5v-3zM21 8H3V6h18v2zM22 10.5c0-.3-.5-.5-1.3-.5H3.4c-.8 0-1.3.2-1.3.5v3c0 .3.5.5 1.3.5h17.4c.8 0 1.3-.2 1.3-.5v-3zM21 13H3v-2h18v2z"/><rect width="10" height="3" x="2" y="15" rx=".5"/></svg>',
|
|
19
|
+
content: {
|
|
20
|
+
type: typeForm,
|
|
21
|
+
components: [
|
|
22
|
+
{
|
|
23
|
+
components: [{ type: typeLabel, components: "Name" }, { type: typeInput }]
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
components: [
|
|
27
|
+
{ type: typeLabel, components: "Email" },
|
|
28
|
+
{ type: typeInput, attributes: { type: "email" } }
|
|
29
|
+
]
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
components: [
|
|
33
|
+
{ type: typeLabel, components: "Gender" },
|
|
34
|
+
{ type: typeCheckbox, attributes: { value: "M" } },
|
|
35
|
+
{ type: typeLabel, components: "M" },
|
|
36
|
+
{ type: typeCheckbox, attributes: { value: "F" } },
|
|
37
|
+
{ type: typeLabel, components: "F" }
|
|
38
|
+
]
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
components: [{ type: typeLabel, components: "Message" }, { type: typeTextarea }]
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
components: [{ type: typeButton }]
|
|
45
|
+
}
|
|
46
|
+
]
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
addBlock(typeInput, {
|
|
50
|
+
label: "Input",
|
|
51
|
+
category: formsCategory,
|
|
52
|
+
media: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M22 9c0-.6-.5-1-1.3-1H3.4C2.5 8 2 8.4 2 9v6c0 .6.5 1 1.3 1h17.4c.8 0 1.3-.4 1.3-1V9zm-1 6H3V9h18v6z"/><path d="M4 10h1v4H4z"/></svg>',
|
|
53
|
+
content: { type: typeInput }
|
|
54
|
+
});
|
|
55
|
+
addBlock(typeTextarea, {
|
|
56
|
+
label: "Textarea",
|
|
57
|
+
category: formsCategory,
|
|
58
|
+
media: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M22 7.5c0-.9-.5-1.5-1.3-1.5H3.4C2.5 6 2 6.6 2 7.5v9c0 .9.5 1.5 1.3 1.5h17.4c.8 0 1.3-.6 1.3-1.5v-9zM21 17H3V7h18v10z"/><path d="M4 8h1v4H4zM19 7h1v10h-1zM20 8h1v1h-1zM20 15h1v1h-1z"/></svg>',
|
|
59
|
+
content: { type: typeTextarea }
|
|
60
|
+
});
|
|
61
|
+
addBlock(typeSelect, {
|
|
62
|
+
label: "Select",
|
|
63
|
+
category: formsCategory,
|
|
64
|
+
media: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M22 9c0-.6-.5-1-1.3-1H3.4C2.5 8 2 8.4 2 9v6c0 .6.5 1 1.3 1h17.4c.8 0 1.3-.4 1.3-1V9zm-1 6H3V9h18v6z"/><path d="M18.5 13l1.5-2h-3zM4 11.5h11v1H4z"/></svg>',
|
|
65
|
+
content: { type: typeSelect }
|
|
66
|
+
});
|
|
67
|
+
addBlock(typeButton, {
|
|
68
|
+
label: "Button",
|
|
69
|
+
category: formsCategory,
|
|
70
|
+
media: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M22 9c0-.6-.5-1-1.3-1H3.4C2.5 8 2 8.4 2 9v6c0 .6.5 1 1.3 1h17.4c.8 0 1.3-.4 1.3-1V9zm-1 6H3V9h18v6z"/><path d="M4 11.5h16v1H4z"/></svg>',
|
|
71
|
+
content: { type: typeButton }
|
|
72
|
+
});
|
|
73
|
+
addBlock(typeLabel, {
|
|
74
|
+
label: "Label",
|
|
75
|
+
category: formsCategory,
|
|
76
|
+
media: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M22 11.9c0-.6-.5-.9-1.3-.9H3.4c-.8 0-1.3.3-1.3.9V17c0 .5.5.9 1.3.9h17.4c.8 0 1.3-.4 1.3-.9V12zM21 17H3v-5h18v5z"/><rect width="14" height="5" x="2" y="5" rx=".5"/><path d="M4 13h1v3H4z"/></svg>',
|
|
77
|
+
content: { type: typeLabel }
|
|
78
|
+
});
|
|
79
|
+
addBlock(typeCheckbox, {
|
|
80
|
+
label: "Checkbox",
|
|
81
|
+
category: formsCategory,
|
|
82
|
+
media: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M10 17l-5-5 1.41-1.42L10 14.17l7.59-7.59L19 8m0-5H5c-1.11 0-2 .89-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5a2 2 0 0 0-2-2z"></path></svg>',
|
|
83
|
+
content: { type: typeCheckbox }
|
|
84
|
+
});
|
|
85
|
+
addBlock(typeRadio, {
|
|
86
|
+
label: "Radio",
|
|
87
|
+
category: formsCategory,
|
|
88
|
+
media: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8m0-18C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 5c-2.76 0-5 2.24-5 5s2.24 5 5 5 5-2.24 5-5-2.24-5-5-5z"></path></svg>',
|
|
89
|
+
content: { type: typeRadio }
|
|
90
|
+
});
|
|
91
|
+
};
|
|
92
|
+
export {
|
|
93
|
+
forms_default as default
|
|
94
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { BlockProperties, Editor } from 'grapesjs';
|
|
2
|
+
import type { RequiredGrapesBlocksOptions } from '../types.js';
|
|
3
|
+
export declare const AddBlocks: (editor: Editor, opts: RequiredGrapesBlocksOptions) => (id: string, def: BlockProperties) => void;
|
|
4
|
+
export declare function loadBlocks(editor: Editor, opts: RequiredGrapesBlocksOptions): void;
|
|
5
|
+
export default loadBlocks;
|