@studiocms/wysiwyg 0.1.0-experimental.5 → 0.1.1

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.
Files changed (164) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +7 -28
  3. package/dist/common/gjs-blocks.d.ts +4 -0
  4. package/dist/common/gjs-blocks.js +27 -0
  5. package/dist/common/gjs-componentRegistry.d.ts +31 -0
  6. package/dist/common/gjs-componentRegistry.js +59 -0
  7. package/dist/common/gjs-editor-settings.d.ts +23 -0
  8. package/dist/common/gjs-editor-settings.js +357 -0
  9. package/dist/common/gjs-editor-utils.d.ts +165 -0
  10. package/dist/common/gjs-editor-utils.js +217 -0
  11. package/dist/common/grapesBlocks/blocks/basics.d.ts +4 -0
  12. package/dist/common/grapesBlocks/blocks/basics.js +279 -0
  13. package/dist/common/grapesBlocks/blocks/extras.d.ts +4 -0
  14. package/dist/common/grapesBlocks/blocks/extras.js +63 -0
  15. package/dist/common/grapesBlocks/blocks/forms.d.ts +4 -0
  16. package/dist/{wysiwyg/editorPlugins/forms/blocks.js → common/grapesBlocks/blocks/forms.js} +15 -14
  17. package/dist/common/grapesBlocks/blocks/index.d.ts +5 -0
  18. package/dist/common/grapesBlocks/blocks/index.js +23 -0
  19. package/dist/common/grapesBlocks/blocks/tabs.d.ts +4 -0
  20. package/dist/{wysiwyg/editorPlugins/tabs/blocks.js → common/grapesBlocks/blocks/tabs.js} +9 -8
  21. package/dist/common/grapesBlocks/commands/clear.d.ts +4 -0
  22. package/dist/common/grapesBlocks/commands/clear.js +21 -0
  23. package/dist/common/grapesBlocks/commands/customCodeCommands.d.ts +4 -0
  24. package/dist/{wysiwyg/editorPlugins/code/commands.js → common/grapesBlocks/commands/customCodeCommands.js} +11 -9
  25. package/dist/common/grapesBlocks/commands/deviceCommands.js +23 -0
  26. package/dist/common/grapesBlocks/commands/index.d.ts +5 -0
  27. package/dist/common/grapesBlocks/commands/index.js +40 -0
  28. package/dist/common/grapesBlocks/commands/openImport.d.ts +4 -0
  29. package/dist/common/grapesBlocks/commands/openImport.js +71 -0
  30. package/dist/common/grapesBlocks/components/countdown.d.ts +12 -0
  31. package/dist/common/grapesBlocks/components/countdown.js +147 -0
  32. package/dist/common/grapesBlocks/components/customCode.d.ts +4 -0
  33. package/dist/{wysiwyg/editorPlugins/code/components.js → common/grapesBlocks/components/customCode.js} +16 -15
  34. package/dist/common/grapesBlocks/components/forms.d.ts +3 -0
  35. package/dist/{wysiwyg/editorPlugins/forms/components.js → common/grapesBlocks/components/forms.js} +30 -36
  36. package/dist/common/grapesBlocks/components/index.d.ts +5 -0
  37. package/dist/common/grapesBlocks/components/index.js +23 -0
  38. package/dist/common/grapesBlocks/components/tabLoader.d.ts +4 -0
  39. package/dist/{wysiwyg/editorPlugins/tabs/components/index.js → common/grapesBlocks/components/tabLoader.js} +7 -7
  40. package/dist/{wysiwyg/editorPlugins/tabs/components → common/grapesBlocks/components/tabs}/Tab.d.ts +1 -1
  41. package/dist/{wysiwyg/editorPlugins/tabs/components → common/grapesBlocks/components/tabs}/Tab.js +2 -2
  42. package/dist/{wysiwyg/editorPlugins/tabs/components → common/grapesBlocks/components/tabs}/TabContainer.d.ts +1 -1
  43. package/dist/{wysiwyg/editorPlugins/tabs/components → common/grapesBlocks/components/tabs}/TabContent.d.ts +1 -1
  44. package/dist/{wysiwyg/editorPlugins/tabs/components → common/grapesBlocks/components/tabs}/TabContents.d.ts +1 -1
  45. package/dist/{wysiwyg/editorPlugins/tabs/components → common/grapesBlocks/components/tabs}/Tabs.d.ts +1 -1
  46. package/dist/{wysiwyg/editorPlugins/tabs/components → common/grapesBlocks/components/tabs}/Tabs.js +8 -8
  47. package/dist/common/grapesBlocks/components/tooltip.d.ts +4 -0
  48. package/dist/{wysiwyg/editorPlugins → common/grapesBlocks/components}/tooltip.js +15 -87
  49. package/dist/common/grapesBlocks/components/typed.d.ts +9 -0
  50. package/dist/{wysiwyg/editorPlugins/typed/components.js → common/grapesBlocks/components/typed.js} +7 -7
  51. package/dist/common/grapesBlocks/consts.d.ts +25 -0
  52. package/dist/common/grapesBlocks/consts.js +245 -0
  53. package/dist/common/grapesBlocks/i18n/index.d.ts +3 -0
  54. package/dist/common/grapesBlocks/i18n/index.js +19 -0
  55. package/dist/common/grapesBlocks/panels/index.d.ts +4 -0
  56. package/dist/common/grapesBlocks/panels/index.js +171 -0
  57. package/dist/{wysiwyg/editorPlugins → common/grapesBlocks}/rte/colorPicker.d.ts +9 -0
  58. package/dist/{wysiwyg/editorPlugins → common/grapesBlocks}/rte/colorPicker.js +16 -2
  59. package/dist/{wysiwyg/editorPlugins → common/grapesBlocks}/rte/index.d.ts +3 -3
  60. package/dist/{wysiwyg/editorPlugins → common/grapesBlocks}/rte/index.js +18 -12
  61. package/dist/common/grapesBlocks/selectors/index.d.ts +4 -0
  62. package/dist/common/grapesBlocks/selectors/index.js +9 -0
  63. package/dist/common/grapesBlocks/selectors/tooltip.d.ts +4 -0
  64. package/dist/common/grapesBlocks/selectors/tooltip.js +15 -0
  65. package/dist/common/grapesBlocks/traits/formTraits.d.ts +3 -0
  66. package/dist/{wysiwyg/editorPlugins/forms/traits.js → common/grapesBlocks/traits/formTraits.js} +12 -8
  67. package/dist/common/grapesBlocks/traits/index.d.ts +4 -0
  68. package/dist/common/grapesBlocks/traits/index.js +15 -0
  69. package/dist/common/grapesBlocks/traits/typedTraits.d.ts +3 -0
  70. package/dist/common/grapesBlocks/traits/typedTraits.js +24 -0
  71. package/dist/{wysiwyg/editorPlugins/tuiImageEditor.d.ts → common/grapesBlocks/tuiImageEditor/index.d.ts} +2 -2
  72. package/dist/{wysiwyg/editorPlugins/tuiImageEditor.js → common/grapesBlocks/tuiImageEditor/index.js} +6 -7
  73. package/dist/common/grapesBlocks/types.d.ts +446 -0
  74. package/dist/components/Editor.astro +153 -0
  75. package/dist/components/render.d.ts +15 -0
  76. package/dist/components/render.js +11 -0
  77. package/dist/consts.d.ts +31 -0
  78. package/dist/consts.js +15 -0
  79. package/dist/index.d.ts +39 -0
  80. package/dist/index.js +71 -0
  81. package/dist/lib/db.d.ts +83 -0
  82. package/dist/lib/db.js +50 -0
  83. package/dist/lib/prerender.d.ts +10 -0
  84. package/dist/lib/prerender.js +22 -0
  85. package/dist/{wysiwyg → lib}/shared.d.ts +3 -6
  86. package/dist/lib/shared.js +6 -0
  87. package/dist/{utils.d.ts → lib/utils.d.ts} +1 -1
  88. package/dist/lib/utils.js +10 -0
  89. package/dist/routes/grapes.css.d.ts +7 -0
  90. package/dist/routes/grapes.css.js +13 -0
  91. package/dist/routes/partial.astro +44 -0
  92. package/dist/routes/store.d.ts +1 -0
  93. package/dist/routes/store.js +121 -0
  94. package/dist/schema.d.ts +60 -0
  95. package/dist/schema.js +24 -0
  96. package/dist/styles/editor.css +150 -0
  97. package/dist/styles/grapes.css +71 -0
  98. package/dist/types.d.ts +66 -0
  99. package/dist/types.js +9 -0
  100. package/package.json +30 -28
  101. package/dist/common/prepareRender.d.ts +0 -11
  102. package/dist/common/prepareRender.js +0 -24
  103. package/dist/studio/components/Render.astro +0 -11
  104. package/dist/studio/components/StudioSDKEditor.astro +0 -334
  105. package/dist/studio/index.d.ts +0 -38
  106. package/dist/studio/index.js +0 -58
  107. package/dist/studio/routes/partial.astro +0 -27
  108. package/dist/studio/shared.d.ts +0 -17
  109. package/dist/studio/shared.js +0 -7
  110. package/dist/studio/utils.d.ts +0 -105
  111. package/dist/studio/utils.js +0 -244
  112. package/dist/studio/virtual.d.ts +0 -114
  113. package/dist/utils.js +0 -15
  114. package/dist/wysiwyg/components/Editor.astro +0 -765
  115. package/dist/wysiwyg/components/Render.astro +0 -11
  116. package/dist/wysiwyg/editorPlugins/blocks/blocks.d.ts +0 -3
  117. package/dist/wysiwyg/editorPlugins/blocks/blocks.js +0 -239
  118. package/dist/wysiwyg/editorPlugins/blocks/index.d.ts +0 -80
  119. package/dist/wysiwyg/editorPlugins/blocks/index.js +0 -26
  120. package/dist/wysiwyg/editorPlugins/code/blocks.d.ts +0 -4
  121. package/dist/wysiwyg/editorPlugins/code/blocks.js +0 -20
  122. package/dist/wysiwyg/editorPlugins/code/commands.d.ts +0 -4
  123. package/dist/wysiwyg/editorPlugins/code/components.d.ts +0 -4
  124. package/dist/wysiwyg/editorPlugins/code/index.d.ts +0 -47
  125. package/dist/wysiwyg/editorPlugins/code/index.js +0 -28
  126. package/dist/wysiwyg/editorPlugins/code/utils.d.ts +0 -3
  127. package/dist/wysiwyg/editorPlugins/code/utils.js +0 -8
  128. package/dist/wysiwyg/editorPlugins/countdown.d.ts +0 -86
  129. package/dist/wysiwyg/editorPlugins/countdown.js +0 -163
  130. package/dist/wysiwyg/editorPlugins/forms/blocks.d.ts +0 -3
  131. package/dist/wysiwyg/editorPlugins/forms/components.d.ts +0 -11
  132. package/dist/wysiwyg/editorPlugins/forms/index.d.ts +0 -21
  133. package/dist/wysiwyg/editorPlugins/forms/index.js +0 -18
  134. package/dist/wysiwyg/editorPlugins/forms/traits.d.ts +0 -2
  135. package/dist/wysiwyg/editorPlugins/index.d.ts +0 -9
  136. package/dist/wysiwyg/editorPlugins/index.js +0 -20
  137. package/dist/wysiwyg/editorPlugins/rte/styles.css +0 -63
  138. package/dist/wysiwyg/editorPlugins/tabs/blocks.d.ts +0 -3
  139. package/dist/wysiwyg/editorPlugins/tabs/components/index.d.ts +0 -4
  140. package/dist/wysiwyg/editorPlugins/tabs/index.d.ts +0 -5
  141. package/dist/wysiwyg/editorPlugins/tabs/index.js +0 -15
  142. package/dist/wysiwyg/editorPlugins/tabs/options.d.ts +0 -5
  143. package/dist/wysiwyg/editorPlugins/tabs/options.js +0 -80
  144. package/dist/wysiwyg/editorPlugins/tabs/types.d.ts +0 -81
  145. package/dist/wysiwyg/editorPlugins/tooltip.d.ts +0 -68
  146. package/dist/wysiwyg/editorPlugins/typed/blocks.d.ts +0 -4
  147. package/dist/wysiwyg/editorPlugins/typed/blocks.js +0 -15
  148. package/dist/wysiwyg/editorPlugins/typed/components.d.ts +0 -9
  149. package/dist/wysiwyg/editorPlugins/typed/index.d.ts +0 -35
  150. package/dist/wysiwyg/editorPlugins/typed/index.js +0 -18
  151. package/dist/wysiwyg/editorPlugins/typed/traits.js +0 -18
  152. package/dist/wysiwyg/editorPlugins/typed/utils.d.ts +0 -2
  153. package/dist/wysiwyg/editorPlugins/typed/utils.js +0 -6
  154. package/dist/wysiwyg/index.d.ts +0 -20
  155. package/dist/wysiwyg/index.js +0 -47
  156. package/dist/wysiwyg/routes/partial.astro +0 -27
  157. package/dist/wysiwyg/shared.js +0 -7
  158. package/dist/wysiwyg/styles/main.css +0 -52
  159. package/dist/wysiwyg/virtual.d.ts +0 -3
  160. /package/dist/{wysiwyg/editorPlugins/typed/traits.d.ts → common/grapesBlocks/commands/deviceCommands.d.ts} +0 -0
  161. /package/dist/{wysiwyg/editorPlugins/tabs/components → common/grapesBlocks/components/tabs}/TabContainer.js +0 -0
  162. /package/dist/{wysiwyg/editorPlugins/tabs/components → common/grapesBlocks/components/tabs}/TabContent.js +0 -0
  163. /package/dist/{wysiwyg/editorPlugins/tabs/components → common/grapesBlocks/components/tabs}/TabContents.js +0 -0
  164. /package/dist/{wysiwyg/editorPlugins/tabs → common/grapesBlocks}/types.js +0 -0
@@ -1,11 +0,0 @@
1
- ---
2
- import type { PluginPageTypeRendererProps } from 'studiocms/types';
3
- import { prepareRender } from '../../common/prepareRender.js';
4
- import { shared } from '../shared.js';
5
-
6
- interface Props extends PluginPageTypeRendererProps {}
7
-
8
- // @ts-expect-error - $$result is a global variable injected by Astro during compilation and not a editor-known variable
9
- const data = await prepareRender($$result, Astro.props.data, shared?.sanitize);
10
- ---
11
- <Fragment set:html={data} />
@@ -1,3 +0,0 @@
1
- import type { Editor } from 'grapesjs';
2
- import type { PluginOptions } from './index.js';
3
- export default function (editor: Editor, opts: Required<PluginOptions>): void;
@@ -1,239 +0,0 @@
1
- function blocks_default(editor, opts) {
2
- const bm = editor.BlockManager;
3
- const { category, blocks, stylePrefix, flexGrid, rowHeight, addBasicStyle } = opts;
4
- const clsRow = `${stylePrefix}row`;
5
- const clsCell = `${stylePrefix}cell`;
6
- const styleRow = flexGrid ? `
7
- .${clsRow} {
8
- display: flex;
9
- justify-content: flex-start;
10
- align-items: stretch;
11
- flex-wrap: nowrap;
12
- padding: 10px;
13
- }
14
- @media (max-width: 768px) {
15
- .${clsRow} {
16
- flex-wrap: wrap;
17
- }
18
- }` : `
19
- .${clsRow} {
20
- display: table;
21
- padding: 10px;
22
- width: 100%;
23
- }
24
- @media (max-width: 768px) {
25
- .${stylePrefix}cell, .${stylePrefix}cell30, .${stylePrefix}cell70 {
26
- width: 100%;
27
- display: block;
28
- }
29
- }`;
30
- const styleClm = flexGrid ? `
31
- .${clsCell} {
32
- min-height: ${rowHeight}px;
33
- flex-grow: 1;
34
- flex-basis: 100%;
35
- }` : `
36
- .${clsCell} {
37
- width: 8%;
38
- display: table-cell;
39
- height: ${rowHeight}px;
40
- }`;
41
- const styleClm30 = `
42
- .${stylePrefix}cell30 {
43
- width: 30%;
44
- }`;
45
- const styleClm70 = `
46
- .${stylePrefix}cell70 {
47
- width: 70%;
48
- }`;
49
- const step = 0.2;
50
- const minDim = 1;
51
- const currentUnit = 1;
52
- const resizerBtm = {
53
- tl: 0,
54
- tc: 0,
55
- tr: 0,
56
- cl: 0,
57
- cr: 0,
58
- bl: 0,
59
- br: 0,
60
- minDim
61
- };
62
- const resizerRight = {
63
- ...resizerBtm,
64
- cr: 1,
65
- bc: 0,
66
- currentUnit,
67
- minDim,
68
- step
69
- };
70
- if (flexGrid) {
71
- resizerRight.keyWidth = "flex-basis";
72
- }
73
- const rowAttr = {
74
- class: clsRow,
75
- "data-gjs-droppable": `.${clsCell}`,
76
- "data-gjs-resizable": resizerBtm,
77
- "data-gjs-name": "Row"
78
- };
79
- const colAttr = {
80
- class: clsCell,
81
- "data-gjs-draggable": `.${clsRow}`,
82
- "data-gjs-resizable": resizerRight,
83
- "data-gjs-name": "Cell"
84
- };
85
- if (flexGrid) {
86
- colAttr["data-gjs-unstylable"] = ["width"];
87
- colAttr["data-gjs-stylable-require"] = ["flex-basis"];
88
- }
89
- const privateCls = [`.${clsRow}`, `.${clsCell}`];
90
- editor.on(
91
- "selector:add",
92
- (selector) => privateCls.indexOf(selector.getFullName()) >= 0 && selector.set("private", 1)
93
- );
94
- const attrsToString = (attrs) => {
95
- const result = [];
96
- for (const key in attrs) {
97
- let value = attrs[key];
98
- const toParse = Array.isArray(value) || value instanceof Object;
99
- value = toParse ? JSON.stringify(value) : value;
100
- result.push(`${key}=${toParse ? `'${value}'` : `'${value}'`}`);
101
- }
102
- return result.length ? ` ${result.join(" ")}` : "";
103
- };
104
- const toAdd = (name) => blocks.indexOf(name) >= 0;
105
- const attrsRow = attrsToString(rowAttr);
106
- const attrsCell = attrsToString(colAttr);
107
- const commonBlockProps = {
108
- category,
109
- select: true
110
- };
111
- toAdd("column1") && bm.add("column1", {
112
- ...commonBlockProps,
113
- label: opts.labelColumn1,
114
- media: `<svg viewBox="0 0 24 24">
115
- <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"/>
116
- </svg>`,
117
- content: `<div ${attrsRow}>
118
- <div ${attrsCell}></div>
119
- </div>
120
- ${addBasicStyle ? `<style>
121
- ${styleRow}
122
- ${styleClm}
123
- </style>` : ""}`
124
- });
125
- toAdd("column2") && bm.add("column2", {
126
- ...commonBlockProps,
127
- label: opts.labelColumn2,
128
- media: `<svg viewBox="0 0 23 24">
129
- <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"/>
130
- </svg>`,
131
- content: `<div ${attrsRow}>
132
- <div ${attrsCell}></div>
133
- <div ${attrsCell}></div>
134
- </div>
135
- ${addBasicStyle ? `<style>
136
- ${styleRow}
137
- ${styleClm}
138
- </style>` : ""}`
139
- });
140
- toAdd("column3") && bm.add("column3", {
141
- ...commonBlockProps,
142
- label: opts.labelColumn3,
143
- media: `<svg viewBox="0 0 23 24">
144
- <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"/>
145
- </svg>`,
146
- content: `<div ${attrsRow}>
147
- <div ${attrsCell}></div>
148
- <div ${attrsCell}></div>
149
- <div ${attrsCell}></div>
150
- </div>
151
- ${addBasicStyle ? `<style>
152
- ${styleRow}
153
- ${styleClm}
154
- </style>` : ""}`
155
- });
156
- toAdd("column3-7") && bm.add("column3-7", {
157
- ...commonBlockProps,
158
- label: opts.labelColumn37,
159
- media: `<svg viewBox="0 0 24 24">
160
- <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"/>
161
- </svg>`,
162
- content: `<div ${attrsRow}>
163
- <div ${attrsCell} style='${flexGrid ? "flex-basis" : "width"}: 30%;'></div>
164
- <div ${attrsCell} style='${flexGrid ? "flex-basis" : "width"}: 70%;'></div>
165
- </div>
166
- ${addBasicStyle ? `<style>
167
- ${styleRow}
168
- ${styleClm}
169
- ${styleClm30}
170
- ${styleClm70}
171
- </style>` : ""}`
172
- });
173
- toAdd("text") && bm.add("text", {
174
- ...commonBlockProps,
175
- activate: true,
176
- label: opts.labelText,
177
- media: `<svg viewBox="0 0 24 24">
178
- <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" />
179
- </svg>`,
180
- content: {
181
- type: "text",
182
- content: "Insert your text here",
183
- style: { padding: "10px" }
184
- }
185
- });
186
- toAdd("link") && bm.add("link", {
187
- ...commonBlockProps,
188
- label: opts.labelLink,
189
- media: `<svg viewBox="0 0 24 24">
190
- <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" />
191
- </svg>`,
192
- content: {
193
- type: "link",
194
- content: "Link",
195
- style: { color: "#d983a6" }
196
- }
197
- });
198
- toAdd("image") && bm.add("image", {
199
- ...commonBlockProps,
200
- activate: true,
201
- label: opts.labelImage,
202
- media: `<svg viewBox="0 0 24 24">
203
- <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" />
204
- </svg>`,
205
- content: {
206
- style: { color: "black" },
207
- type: "image"
208
- }
209
- });
210
- toAdd("video") && bm.add("video", {
211
- ...commonBlockProps,
212
- label: opts.labelVideo,
213
- media: `<svg viewBox="0 0 24 24">
214
- <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" />
215
- </svg>`,
216
- content: {
217
- type: "video",
218
- src: "img/video2.webm",
219
- style: {
220
- height: "350px",
221
- width: "615px"
222
- }
223
- }
224
- });
225
- toAdd("map") && bm.add("map", {
226
- ...commonBlockProps,
227
- label: opts.labelMap,
228
- media: `<svg viewBox="0 0 24 24">
229
- <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" />
230
- </svg>`,
231
- content: {
232
- type: "map",
233
- style: { height: "350px" }
234
- }
235
- });
236
- }
237
- export {
238
- blocks_default as default
239
- };
@@ -1,80 +0,0 @@
1
- import type { Plugin } from 'grapesjs';
2
- export type PluginOptions = {
3
- /**
4
- * Which blocks to add.
5
- * @default ['column1', 'column2', 'column3', 'column3-7', 'text', 'link', 'image', 'video', 'map']
6
- */
7
- blocks?: string[];
8
- /**
9
- * Make use of flexbox for the grid
10
- * @default false
11
- */
12
- flexGrid?: boolean;
13
- /**
14
- * Classes prefix
15
- * @default 'gjs-'
16
- */
17
- stylePrefix?: string;
18
- /**
19
- * Use basic CSS for blocks
20
- * @default true
21
- */
22
- addBasicStyle?: boolean;
23
- /**
24
- * Blocks category name
25
- * @default 'Basic'
26
- */
27
- category?: string;
28
- /**
29
- * 1 Column label
30
- * @default '1 Column'
31
- */
32
- labelColumn1?: string;
33
- /**
34
- * 2 Columns label
35
- * @default '2 Columns'
36
- */
37
- labelColumn2?: string;
38
- /**
39
- * 3 Columns label
40
- * @default '3 Columns'
41
- */
42
- labelColumn3?: string;
43
- /**
44
- * 3/7 Columns label
45
- * @default '2 Columns 3/7'
46
- */
47
- labelColumn37?: string;
48
- /**
49
- * Text label
50
- * @default 'Text'
51
- */
52
- labelText?: string;
53
- /**
54
- * Link label
55
- * @default 'Link'
56
- */
57
- labelLink?: string;
58
- /**
59
- * Image label
60
- * @default 'Image'
61
- */
62
- labelImage?: string;
63
- /**
64
- * Video label
65
- * @default 'Video'
66
- */
67
- labelVideo?: string;
68
- /**
69
- * Map label
70
- * @default 'Map'
71
- */
72
- labelMap?: string;
73
- /**
74
- * Initial row height
75
- * @default 75
76
- */
77
- rowHeight?: number;
78
- };
79
- declare const plugin: Plugin<PluginOptions>;
80
- export default plugin;
@@ -1,26 +0,0 @@
1
- import loadBlocks from "./blocks.js";
2
- const plugin = (editor, opts = {}) => {
3
- const config = {
4
- blocks: ["column1", "column2", "column3", "column3-7", "text", "link", "image", "video", "map"],
5
- flexGrid: false,
6
- stylePrefix: "gjs-",
7
- addBasicStyle: true,
8
- category: "Basic",
9
- labelColumn1: "1 Column",
10
- labelColumn2: "2 Columns",
11
- labelColumn3: "3 Columns",
12
- labelColumn37: "2 Columns 3/7",
13
- labelText: "Text",
14
- labelLink: "Link",
15
- labelImage: "Image",
16
- labelVideo: "Video",
17
- labelMap: "Map",
18
- rowHeight: 75,
19
- ...opts
20
- };
21
- loadBlocks(editor, config);
22
- };
23
- var blocks_default = plugin;
24
- export {
25
- blocks_default as default
26
- };
@@ -1,4 +0,0 @@
1
- import type { Editor } from 'grapesjs';
2
- import type { PluginOptions } from './index.js';
3
- declare const _default: (editor: Editor, { blockCustomCode }?: PluginOptions) => void;
4
- export default _default;
@@ -1,20 +0,0 @@
1
- import { typeCustomCode } from "./utils.js";
2
- var blocks_default = (editor, { blockCustomCode } = {}) => {
3
- const { Blocks } = editor;
4
- blockCustomCode && Blocks.add(typeCustomCode, {
5
- label: "Custom Code",
6
- media: `
7
- <svg viewBox="0 0 24 24">
8
- <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>
9
- </svg>
10
- `,
11
- category: "Extra",
12
- activate: true,
13
- select: true,
14
- content: { type: typeCustomCode },
15
- ...blockCustomCode
16
- });
17
- };
18
- export {
19
- blocks_default as default
20
- };
@@ -1,4 +0,0 @@
1
- import type { Editor } from 'grapesjs';
2
- import type { PluginOptions } from './index.js';
3
- declare const _default: (editor: Editor, opts?: PluginOptions) => void;
4
- export default _default;
@@ -1,4 +0,0 @@
1
- import type { Editor } from 'grapesjs';
2
- import type { PluginOptions } from './index.js';
3
- declare const _default: (editor: Editor, opts?: PluginOptions) => void;
4
- export default _default;
@@ -1,47 +0,0 @@
1
- import type { BlockProperties, ComponentDefinition, Plugin } from 'grapesjs';
2
- export type PluginOptions = {
3
- /**
4
- * Object to extend the default custom code block. Pass a falsy value to avoid adding the block
5
- * @example
6
- * { label: 'Custom Code', category: 'Extra', ... }
7
- */
8
- blockCustomCode?: Partial<BlockProperties>;
9
- /**
10
- * Object to extend the default custom code properties.
11
- * @example
12
- * { name: 'Custom Code', droppable: false, ... }
13
- */
14
- propsCustomCode?: ComponentDefinition;
15
- /**
16
- * Object to extend the default component's toolbar button for the code. Pass a falsy value to avoid adding the button
17
- * @example
18
- * { label: '</>', attributes: { title: 'Open custom code' } }
19
- */
20
- toolbarBtnCustomCode?: Record<string, any>;
21
- /**
22
- * Content to show when the custom code contains `<script>`
23
- */
24
- placeholderScript?: string;
25
- /**
26
- * Title for the custom code modal
27
- * @default 'Insert your code'
28
- */
29
- modalTitle?: string;
30
- /**
31
- * Additional options for the code viewer.
32
- * @example
33
- * { theme: 'hopscotch', readOnly: 0 }
34
- */
35
- codeViewOptions?: Record<string, any>;
36
- /**
37
- * Label for the default save button
38
- * @default 'Save'
39
- */
40
- buttonLabel?: string;
41
- /**
42
- * Object to extend the default custom code command.
43
- */
44
- commandCustomCode?: Record<string, any>;
45
- };
46
- declare const plugin: Plugin<PluginOptions>;
47
- export default plugin;
@@ -1,28 +0,0 @@
1
- import loadBlocks from "./blocks.js";
2
- import loadCommands from "./commands.js";
3
- import loadComponents from "./components.js";
4
- const plugin = (editor, opts = {}) => {
5
- const options = {
6
- blockCustomCode: {},
7
- propsCustomCode: {},
8
- toolbarBtnCustomCode: {},
9
- placeholderScript: `<div style="pointer-events: none; padding: 10px;">
10
- <svg viewBox="0 0 24 24" style="height: 30px; vertical-align: middle;">
11
- <path d="M13 14h-2v-4h2m0 8h-2v-2h2M1 21h22L12 2 1 21z"></path>
12
- </svg>
13
- Custom code with <i>&lt;script&gt;</i> can't be rendered on the canvas
14
- </div>`,
15
- modalTitle: "Insert your code",
16
- codeViewOptions: {},
17
- buttonLabel: "Save",
18
- commandCustomCode: {},
19
- ...opts
20
- };
21
- loadComponents(editor, options);
22
- loadBlocks(editor, options);
23
- loadCommands(editor, options);
24
- };
25
- var code_default = plugin;
26
- export {
27
- code_default as default
28
- };
@@ -1,3 +0,0 @@
1
- export declare const keyCustomCode = "custom-code-plugin__code";
2
- export declare const typeCustomCode = "custom-code";
3
- export declare const commandNameCustomCode = "custom-code:open-modal";
@@ -1,8 +0,0 @@
1
- const keyCustomCode = "custom-code-plugin__code";
2
- const typeCustomCode = "custom-code";
3
- const commandNameCustomCode = "custom-code:open-modal";
4
- export {
5
- commandNameCustomCode,
6
- keyCustomCode,
7
- typeCustomCode
8
- };
@@ -1,86 +0,0 @@
1
- import type { BlockProperties, ComponentDefinition, Plugin } from 'grapesjs';
2
- export type PluginOptions = {
3
- /**
4
- * The ID used to create the block and component
5
- * @default 'countdown'
6
- */
7
- id?: string;
8
- /**
9
- * The label used for the block and the component.
10
- * @default 'Countdown'
11
- */
12
- label?: string;
13
- /**
14
- * Object to extend the default block. Pass a falsy value to avoid adding the block.
15
- * @example
16
- * { label: 'Countdown', category: 'Extra', ... }
17
- */
18
- block?: Partial<BlockProperties>;
19
- /**
20
- * Object to extend the default component properties.
21
- * @example
22
- * { name: 'Countdown', droppable: false, ... }
23
- */
24
- props?: ComponentDefinition;
25
- /**
26
- * Custom CSS styles for the component. This will replace the default one.
27
- * @default ''
28
- */
29
- style?: string;
30
- /**
31
- * Additional CSS styles for the component. These will be appended to the default one.
32
- * @default ''
33
- */
34
- styleAdditional?: string;
35
- /**
36
- * Default start time.
37
- * @default ''
38
- * @example '2018-01-25 00:00'
39
- */
40
- startTime?: string;
41
- /**
42
- * Text to show when the countdown is ended.
43
- * @default 'EXPIRED'
44
- */
45
- endText?: string;
46
- /**
47
- * Date input type, eg. `date`, `datetime-local`
48
- * @default 'date'
49
- */
50
- dateInputType?: string;
51
- /**
52
- * Days label text used in component.
53
- * @default 'days'
54
- */
55
- labelDays?: string;
56
- /**
57
- * Hours label text used in component.
58
- * @default 'hours'
59
- */
60
- labelHours?: string;
61
- /**
62
- * Minutes label text used in component.
63
- * @default 'minutes'
64
- */
65
- labelMinutes?: string;
66
- /**
67
- * Seconds label text used in component.
68
- * @default 'seconds'
69
- */
70
- labelSeconds?: string;
71
- /**
72
- * Countdown component class prefix.
73
- * @default 'countdown'
74
- */
75
- classPrefix?: string;
76
- };
77
- type TElement = HTMLElement & {
78
- __gjsCountdownInterval: NodeJS.Timer;
79
- };
80
- declare global {
81
- interface Window {
82
- __gjsCountdownIntervals: TElement[];
83
- }
84
- }
85
- declare const plugin: Plugin<PluginOptions>;
86
- export default plugin;