@silexlabs/silex 3.0.0-alpha.96 → 3.0.0

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 (206) hide show
  1. package/.env.default +2 -1
  2. package/README.md +31 -9
  3. package/dist/client/client/api.d.ts +5 -0
  4. package/dist/client/client/assetUrl.d.ts +3 -0
  5. package/dist/client/client/config.d.ts +31 -0
  6. package/dist/client/client/events.d.ts +7 -1
  7. package/dist/client/client/grapesjs/PublicationManager.d.ts +2 -1
  8. package/dist/client/client/grapesjs/css-props.d.ts +6 -0
  9. package/dist/client/client/grapesjs/img.d.ts +6 -0
  10. package/dist/client/client/grapesjs/index.d.ts +2 -2
  11. package/dist/client/client/grapesjs/new-page-dialog.d.ts +1 -1
  12. package/dist/client/client/grapesjs/page-panel.d.ts +1 -1
  13. package/dist/client/client/grapesjs/project-bar.d.ts +16 -0
  14. package/dist/client/client/grapesjs/resize-panel.d.ts +1 -0
  15. package/dist/client/client/grapesjs/rich-text.d.ts +4 -1
  16. package/dist/client/client/grapesjs/semantic.d.ts +1 -1
  17. package/dist/client/client/grapesjs/settings-sections.d.ts +15 -0
  18. package/dist/client/client/grapesjs/settings.d.ts +3 -1
  19. package/dist/client/client/grapesjs/symbolDialogs.d.ts +1 -1
  20. package/dist/client/client/grapesjs/view-buttons.d.ts +1 -0
  21. package/dist/client/client/index.d.ts +10 -0
  22. package/dist/client/client/publication-transformers.d.ts +4 -3
  23. package/dist/client/client/publish-custom-code-block.d.ts +4 -0
  24. package/dist/client/client/publish-fonts.d.ts +4 -0
  25. package/dist/client/client/utils.d.ts +4 -0
  26. package/dist/client/constants.d.ts +1 -0
  27. package/dist/client/css/admin.css +273 -32
  28. package/dist/client/index.html +2 -1
  29. package/dist/client/js/main.js +164 -123
  30. package/dist/client/js/main.js.LICENSE.txt +15 -1
  31. package/dist/client/types.d.ts +12 -7
  32. package/dist/plugins/client/client/events.d.ts +7 -1
  33. package/dist/plugins/client/client/events.js +7 -1
  34. package/dist/plugins/client/client/events.js.map +1 -1
  35. package/dist/plugins/client/plugins/client/template.js +108 -58
  36. package/dist/plugins/client/plugins/client/template.js.map +1 -1
  37. package/dist/plugins/client/types.d.ts +12 -7
  38. package/dist/plugins/client/types.js +6 -0
  39. package/dist/plugins/client/types.js.map +1 -1
  40. package/dist/plugins/server/constants.d.ts +1 -0
  41. package/dist/plugins/server/constants.js +2 -1
  42. package/dist/plugins/server/constants.js.map +1 -1
  43. package/dist/plugins/server/plugins/server/FtpConnector.d.ts +1 -0
  44. package/dist/plugins/server/plugins/server/FtpConnector.js +12 -1
  45. package/dist/plugins/server/plugins/server/FtpConnector.js.map +1 -1
  46. package/dist/plugins/server/plugins/server/GitlabConnector.d.ts +3 -0
  47. package/dist/plugins/server/plugins/server/GitlabConnector.js +72 -35
  48. package/dist/plugins/server/plugins/server/GitlabConnector.js.map +1 -1
  49. package/dist/plugins/server/server/config.js +3 -3
  50. package/dist/plugins/server/server/config.js.map +1 -1
  51. package/dist/plugins/server/server/connectors/FsHosting.d.ts +1 -0
  52. package/dist/plugins/server/server/connectors/FsHosting.js +13 -1
  53. package/dist/plugins/server/server/connectors/FsHosting.js.map +1 -1
  54. package/dist/plugins/server/server/connectors/FsStorage.d.ts +2 -1
  55. package/dist/plugins/server/server/connectors/FsStorage.js +29 -25
  56. package/dist/plugins/server/server/connectors/FsStorage.js.map +1 -1
  57. package/dist/plugins/server/server/connectors/connectors.d.ts +1 -0
  58. package/dist/plugins/server/server/jobs.js +4 -2
  59. package/dist/plugins/server/server/jobs.js.map +1 -1
  60. package/dist/plugins/server/types.d.ts +12 -7
  61. package/dist/plugins/server/types.js +7 -1
  62. package/dist/plugins/server/types.js.map +1 -1
  63. package/dist/server/constants.js +2 -1
  64. package/dist/server/server/api/publicationApi.js +3 -5
  65. package/dist/server/server/api/websiteApi.js +26 -7
  66. package/dist/server/server/cli.js +9 -6
  67. package/dist/server/server/config.js +3 -3
  68. package/dist/server/server/connectors/FsHosting.js +13 -1
  69. package/dist/server/server/connectors/FsStorage.js +28 -25
  70. package/dist/server/server/jobs.js +4 -2
  71. package/dist/server/types.js +7 -1
  72. package/package.json +35 -31
  73. package/public/assets/favicon.ico +0 -0
  74. package/public/assets/favicon.png +0 -0
  75. package/public/assets/logo-silex-small.png +0 -0
  76. package/src/css/_variables.scss +5 -3
  77. package/src/css/dialog.scss +22 -1
  78. package/src/css/fonts.scss +31 -0
  79. package/src/css/footer.scss +1 -1
  80. package/src/css/grapesjs-plugins.scss +34 -0
  81. package/src/css/grapesjs.scss +26 -11
  82. package/src/css/index.scss +1 -0
  83. package/src/css/project-bar.scss +11 -7
  84. package/src/css/silex.scss +58 -5
  85. package/src/html/index.pug +2 -2
  86. package/src/ts/client/api.ts +14 -9
  87. package/src/ts/client/assetUrl.test.ts +145 -42
  88. package/src/ts/client/assetUrl.ts +29 -10
  89. package/src/ts/client/config.ts +85 -4
  90. package/src/ts/client/events.ts +15 -9
  91. package/src/ts/client/grapesjs/PublicationManager.ts +71 -38
  92. package/src/ts/client/grapesjs/PublicationUi.ts +13 -11
  93. package/src/ts/client/grapesjs/css-props.ts +544 -0
  94. package/src/ts/client/grapesjs/eleventy.ts +2 -5
  95. package/src/ts/client/grapesjs/footer.ts +24 -9
  96. package/src/ts/client/grapesjs/img.ts +147 -0
  97. package/src/ts/client/grapesjs/index.ts +63 -25
  98. package/src/ts/client/grapesjs/internal-links.test.ts +2 -1
  99. package/src/ts/client/grapesjs/internal-links.ts +0 -1
  100. package/src/ts/client/grapesjs/new-page-dialog.ts +2 -3
  101. package/src/ts/client/grapesjs/page-panel.ts +28 -3
  102. package/src/ts/client/grapesjs/project-bar.ts +83 -64
  103. package/src/ts/client/grapesjs/resize-panel.ts +20 -0
  104. package/src/ts/client/grapesjs/rich-text.ts +21 -13
  105. package/src/ts/client/grapesjs/semantic.ts +3 -3
  106. package/src/ts/client/grapesjs/settings-sections.ts +117 -0
  107. package/src/ts/client/grapesjs/settings.ts +120 -77
  108. package/src/ts/client/grapesjs/symbolDialogs.ts +2 -3
  109. package/src/ts/client/grapesjs/view-buttons.ts +42 -0
  110. package/src/ts/client/index.ts +13 -6
  111. package/src/ts/client/publication-transformers.test.ts +13 -5
  112. package/src/ts/client/publication-transformers.ts +60 -47
  113. package/{dist/plugins/client/client/utils.js → src/ts/client/publish-custom-code-block.ts} +14 -8
  114. package/{dist/plugins/client/page.js → src/ts/client/publish-fonts.ts} +19 -14
  115. package/src/ts/client/utils.ts +18 -0
  116. package/src/ts/constants.ts +1 -0
  117. package/src/ts/plugins/client/template.ts +112 -60
  118. package/src/ts/plugins/server/FtpConnector.ts +14 -2
  119. package/src/ts/plugins/server/GitlabConnector.ts +71 -32
  120. package/src/ts/server/api/publicationApi.ts +5 -5
  121. package/src/ts/server/api/websiteApi.ts +51 -17
  122. package/src/ts/server/cli.ts +7 -5
  123. package/src/ts/server/config.ts +4 -4
  124. package/src/ts/server/connectors/FsHosting.ts +11 -5
  125. package/src/ts/server/connectors/FsStorage.ts +33 -4
  126. package/src/ts/server/connectors/connectors.ts +1 -1
  127. package/src/ts/server/jobs.ts +4 -2
  128. package/src/ts/types.ts +10 -7
  129. package/dist/plugins/client/client/api.d.ts +0 -85
  130. package/dist/plugins/client/client/api.js +0 -114
  131. package/dist/plugins/client/client/api.js.map +0 -1
  132. package/dist/plugins/client/client/assetUrl.d.ts +0 -51
  133. package/dist/plugins/client/client/assetUrl.js +0 -224
  134. package/dist/plugins/client/client/assetUrl.js.map +0 -1
  135. package/dist/plugins/client/client/config.d.ts +0 -58
  136. package/dist/plugins/client/client/config.js +0 -90
  137. package/dist/plugins/client/client/config.js.map +0 -1
  138. package/dist/plugins/client/client/grapesjs/LoginDialog.d.ts +0 -15
  139. package/dist/plugins/client/client/grapesjs/LoginDialog.js +0 -195
  140. package/dist/plugins/client/client/grapesjs/LoginDialog.js.map +0 -1
  141. package/dist/plugins/client/client/grapesjs/PublicationManager.d.ts +0 -72
  142. package/dist/plugins/client/client/grapesjs/PublicationManager.js +0 -356
  143. package/dist/plugins/client/client/grapesjs/PublicationManager.js.map +0 -1
  144. package/dist/plugins/client/client/grapesjs/PublicationUi.d.ts +0 -62
  145. package/dist/plugins/client/client/grapesjs/PublicationUi.js +0 -336
  146. package/dist/plugins/client/client/grapesjs/PublicationUi.js.map +0 -1
  147. package/dist/plugins/client/client/grapesjs/blocks.d.ts +0 -1
  148. package/dist/plugins/client/client/grapesjs/blocks.js +0 -37
  149. package/dist/plugins/client/client/grapesjs/blocks.js.map +0 -1
  150. package/dist/plugins/client/client/grapesjs/breadcrumbs.d.ts +0 -1
  151. package/dist/plugins/client/client/grapesjs/breadcrumbs.js +0 -75
  152. package/dist/plugins/client/client/grapesjs/breadcrumbs.js.map +0 -1
  153. package/dist/plugins/client/client/grapesjs/footer.d.ts +0 -2
  154. package/dist/plugins/client/client/grapesjs/footer.js +0 -28
  155. package/dist/plugins/client/client/grapesjs/footer.js.map +0 -1
  156. package/dist/plugins/client/client/grapesjs/index.d.ts +0 -5
  157. package/dist/plugins/client/client/grapesjs/index.js +0 -313
  158. package/dist/plugins/client/client/grapesjs/index.js.map +0 -1
  159. package/dist/plugins/client/client/grapesjs/internal-links.d.ts +0 -1
  160. package/dist/plugins/client/client/grapesjs/internal-links.js +0 -219
  161. package/dist/plugins/client/client/grapesjs/internal-links.js.map +0 -1
  162. package/dist/plugins/client/client/grapesjs/new-page-dialog.d.ts +0 -2
  163. package/dist/plugins/client/client/grapesjs/new-page-dialog.js +0 -83
  164. package/dist/plugins/client/client/grapesjs/new-page-dialog.js.map +0 -1
  165. package/dist/plugins/client/client/grapesjs/openImport.d.ts +0 -9
  166. package/dist/plugins/client/client/grapesjs/openImport.js +0 -74
  167. package/dist/plugins/client/client/grapesjs/openImport.js.map +0 -1
  168. package/dist/plugins/client/client/grapesjs/page-panel.d.ts +0 -3
  169. package/dist/plugins/client/client/grapesjs/page-panel.js +0 -113
  170. package/dist/plugins/client/client/grapesjs/page-panel.js.map +0 -1
  171. package/dist/plugins/client/client/grapesjs/project-bar.d.ts +0 -1
  172. package/dist/plugins/client/client/grapesjs/project-bar.js +0 -104
  173. package/dist/plugins/client/client/grapesjs/project-bar.js.map +0 -1
  174. package/dist/plugins/client/client/grapesjs/rich-text.d.ts +0 -1
  175. package/dist/plugins/client/client/grapesjs/rich-text.js +0 -31
  176. package/dist/plugins/client/client/grapesjs/rich-text.js.map +0 -1
  177. package/dist/plugins/client/client/grapesjs/semantic.d.ts +0 -1
  178. package/dist/plugins/client/client/grapesjs/semantic.js +0 -110
  179. package/dist/plugins/client/client/grapesjs/semantic.js.map +0 -1
  180. package/dist/plugins/client/client/grapesjs/settings.d.ts +0 -2
  181. package/dist/plugins/client/client/grapesjs/settings.js +0 -198
  182. package/dist/plugins/client/client/grapesjs/settings.js.map +0 -1
  183. package/dist/plugins/client/client/grapesjs/storage.d.ts +0 -1
  184. package/dist/plugins/client/client/grapesjs/storage.js +0 -126
  185. package/dist/plugins/client/client/grapesjs/storage.js.map +0 -1
  186. package/dist/plugins/client/client/grapesjs/symbolDialogs.d.ts +0 -3
  187. package/dist/plugins/client/client/grapesjs/symbolDialogs.js +0 -36
  188. package/dist/plugins/client/client/grapesjs/symbolDialogs.js.map +0 -1
  189. package/dist/plugins/client/client/publication-transformers.d.ts +0 -41
  190. package/dist/plugins/client/client/publication-transformers.js +0 -238
  191. package/dist/plugins/client/client/publication-transformers.js.map +0 -1
  192. package/dist/plugins/client/client/utils.d.ts +0 -2
  193. package/dist/plugins/client/client/utils.js.map +0 -1
  194. package/dist/plugins/client/constants.d.ts +0 -29
  195. package/dist/plugins/client/constants.js +0 -46
  196. package/dist/plugins/client/constants.js.map +0 -1
  197. package/dist/plugins/client/page.d.ts +0 -2
  198. package/dist/plugins/client/page.js.map +0 -1
  199. package/dist/plugins/client/plugins/client/11ty.d.ts +0 -17
  200. package/dist/plugins/client/plugins/client/11ty.js +0 -86
  201. package/dist/plugins/client/plugins/client/11ty.js.map +0 -1
  202. package/dist/plugins/client/plugins/client/publicationRenderer.d.ts +0 -2
  203. package/dist/plugins/client/plugins/client/publicationRenderer.js +0 -170
  204. package/dist/plugins/client/plugins/client/publicationRenderer.js.map +0 -1
  205. package/src/ts/plugins/client/11ty.ts +0 -104
  206. package/src/ts/plugins/client/publicationRenderer.ts +0 -174
@@ -1,9 +0,0 @@
1
- /**
2
- * @fileoverview Import feature
3
- * Let the user import HTML code when she creates a new page
4
- *
5
- */
6
- export default function openImport(editor: any, config: any): {
7
- run(_: any): void;
8
- stop(): void;
9
- };
@@ -1,74 +0,0 @@
1
- /*
2
- * Silex website builder, free/libre no-code tool for makers.
3
- * Copyright (c) 2023 lexoyo and Silex Labs foundation
4
- *
5
- * This program is free software: you can redistribute it and/or modify
6
- * it under the terms of the GNU Affero General Public License as published by
7
- * the Free Software Foundation, either version 3 of the License, or any later version.
8
- *
9
- * This program is distributed in the hope that it will be useful,
10
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
- * GNU Affero General Public License for more details.
13
- *
14
- * You should have received a copy of the GNU Affero General Public License
15
- * along with this program. If not, see <https://www.gnu.org/licenses/>.
16
- */
17
- /**
18
- * @fileoverview Import feature
19
- * Let the user import HTML code when she creates a new page
20
- *
21
- */
22
- // from https://github.com/artf/grapesjs-preset-webpage/blob/3e5a9e12998c9a32b6f1199953084163678e6c17/src/commands/openImport.js
23
- export default function openImport(editor, config) {
24
- const pfx = editor.getConfig('stylePrefix');
25
- const modal = editor.Modal;
26
- const codeViewer = editor.CodeManager.getViewer('CodeMirror').clone();
27
- const container = document.createElement('div');
28
- const importLabel = config.modalImportLabel;
29
- const importCnt = config.modalImportContent;
30
- let viewerEditor = codeViewer.editor;
31
- // Init import button
32
- const btnImp = document.createElement('button');
33
- btnImp.type = 'button';
34
- btnImp.innerHTML = config.modalImportButton;
35
- btnImp.className = `${pfx}btn-prim ${pfx}btn-import`;
36
- btnImp.onclick = e => {
37
- editor.setComponents(viewerEditor.getValue().trim());
38
- modal.close();
39
- };
40
- // Init code viewer
41
- codeViewer.set({ ...{
42
- codeName: 'htmlmixed',
43
- theme: 'hopscotch',
44
- readOnly: 0
45
- }, ...config.importViewerOptions });
46
- return {
47
- run(_) {
48
- if (!viewerEditor) {
49
- const txtarea = document.createElement('textarea');
50
- if (importLabel) {
51
- const labelEl = document.createElement('div');
52
- labelEl.className = `${pfx}import-label`;
53
- labelEl.innerHTML = importLabel;
54
- container.appendChild(labelEl);
55
- }
56
- container.appendChild(txtarea);
57
- container.appendChild(btnImp);
58
- codeViewer.init(txtarea);
59
- viewerEditor = codeViewer.editor;
60
- }
61
- modal.setTitle(config.modalImportTitle);
62
- modal.setContent(container);
63
- const cnt = typeof importCnt === 'function' ? importCnt(editor) : importCnt;
64
- codeViewer.setContent(cnt || '');
65
- modal.open().getModel()
66
- .once('change:open', () => editor.stopCommand(this.id));
67
- viewerEditor.refresh();
68
- },
69
- stop() {
70
- modal.close();
71
- }
72
- };
73
- }
74
- //# sourceMappingURL=openImport.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"openImport.js","sourceRoot":"","sources":["../../../../../src/ts/client/grapesjs/openImport.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH;;;;GAIG;AACH,gIAAgI;AAChI,MAAM,CAAC,OAAO,UAAU,UAAU,CAAC,MAAM,EAAE,MAAM;IAC/C,MAAM,GAAG,GAAG,MAAM,CAAC,SAAS,CAAC,aAAa,CAAC,CAAA;IAC3C,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAA;IAC1B,MAAM,UAAU,GAAG,MAAM,CAAC,WAAW,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC,KAAK,EAAE,CAAA;IACrE,MAAM,SAAS,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAA;IAC/C,MAAM,WAAW,GAAG,MAAM,CAAC,gBAAgB,CAAA;IAC3C,MAAM,SAAS,GAAG,MAAM,CA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,YAAY,GAAG,UAAU,CAAC,MAAM,CAAA;aACjC;YAED,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAA;YACvC,KAAK,CAAC,UAAU,CAAC,SAAS,CAAC,CAAA;YAC3B,MAAM,GAAG,GAAG,OAAO,SAAS,KAAK,UAAU,CAAC,CAAC,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,SAAS,CAAA;YAC3E,UAAU,CAAC,UAAU,CAAC,GAAG,IAAI,EAAE,CAAC,CAAA;YAChC,KAAK,CAAC,IAAI,EAAE,CAAC,QAAQ,EAAE;iBACpB,IAAI,CAAC,aAAa,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAA;YACzD,YAAY,CAAC,OAAO,EAAE,CAAA;QACxB,CAAC;QAED,IAAI;YACF,KAAK,CAAC,KAAK,EAAE,CAAA;QACf,CAAC;KACF,CAAA;AACH,CAAC"}
@@ -1,3 +0,0 @@
1
- export declare const cmdTogglePages = "pages:open-panel";
2
- export declare const cmdAddPage = "pages:add";
3
- export declare const pagePanelPlugin: any;
@@ -1,113 +0,0 @@
1
- /*
2
- * Silex website builder, free/libre no-code tool for makers.
3
- * Copyright (c) 2023 lexoyo and Silex Labs foundation
4
- *
5
- * This program is free software: you can redistribute it and/or modify
6
- * it under the terms of the GNU Affero General Public License as published by
7
- * the Free Software Foundation, either version 3 of the License, or any later version.
8
- *
9
- * This program is distributed in the hope that it will be useful,
10
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
- * GNU Affero General Public License for more details.
13
- *
14
- * You should have received a copy of the GNU Affero General Public License
15
- * along with this program. If not, see <https://www.gnu.org/licenses/>.
16
- */
17
- import * as grapesjs from 'grapesjs/dist/grapes.min.js';
18
- import { html, render } from 'lit-html';
19
- const pluginName = 'page-panel';
20
- let open;
21
- export const cmdTogglePages = 'pages:open-panel';
22
- export const cmdAddPage = 'pages:add';
23
- function selectPage(editor, page) {
24
- editor.Pages.select(page);
25
- }
26
- function addPage(editor, config) {
27
- const pages = editor.Pages.getAll();
28
- let idx = 1;
29
- const newPageName = config.newPageName || 'New page';
30
- let pageName = newPageName;
31
- while (pages.find(p => p.getName() === pageName)) {
32
- pageName = `${newPageName} ${idx++}`;
33
- }
34
- const page = editor.Pages.add({ name: pageName });
35
- editor.runCommand(config.cmdOpenNewPageDialog, { page });
36
- }
37
- function removePage(editor, page) {
38
- if (editor.Pages.getAll().length === 1) {
39
- console.error('can not delete the only page');
40
- }
41
- else {
42
- const isMain = page.get('type') === 'main';
43
- const isSelected = editor.Pages.getSelected() === page;
44
- editor.Pages.remove(page.id);
45
- const firstPage = editor.Pages.getAll()[0];
46
- if (isMain)
47
- firstPage.set('type', 'main');
48
- if (isSelected)
49
- selectPage(editor, firstPage);
50
- }
51
- }
52
- function settingsPage(editor, config, page) {
53
- editor.runCommand(config.cmdOpenSettings, { page });
54
- }
55
- function renderPages(editor, config) {
56
- const pages = editor.Pages.getAll();
57
- const selected = editor.Pages.getSelected();
58
- const getPageFromEvent = (e) => {
59
- const el = e.target.hasAttribute('data-page-id') ? e.target : e.target.parentNode;
60
- e.stopPropagation();
61
- return editor.Pages.get(el.getAttribute('data-page-id'));
62
- };
63
- return html `<section class="pages">
64
- <main class="pages__main ${pages.length === 1 ? 'pages__single-page' : ''}">
65
- <div class="pages__list">
66
- ${pages.map(page => {
67
- const name = page.getName() || page.attributes.type;
68
- // keep the same structure as the layers panel
69
- return html `
70
- <div class="pages__page ${selected === page ? 'pages__page-selected' : ''}" data-page-id=${page.id} @click=${e => selectPage(editor, getPageFromEvent(e))}>
71
- <div class="pages__page-name">
72
- ${name}
73
- </div>
74
- <i class="pages__icon pages__remove-btn fa fa-trash" @click=${e => removePage(editor, getPageFromEvent(e))}></i>
75
- <i class="pages__icon fa fa-cog" @click=${e => settingsPage(editor, config, getPageFromEvent(e))}></i>
76
- </div>
77
- </div>
78
- `;
79
- })}
80
- </div>
81
- ${pages.length ? '' : html `<div class="flex-row">
82
- No page yet.
83
- </div>
84
- `}
85
- </main></section>`;
86
- }
87
- export const pagePanelPlugin = grapesjs.plugins.add(pluginName, (editor, opts) => {
88
- // create wrapper
89
- const el = document.createElement('div');
90
- el.classList.add('pages__wrapper');
91
- // update
92
- const doRender = () => render(renderPages(editor, opts), el);
93
- editor.on('page', () => {
94
- doRender();
95
- });
96
- editor.on('load', () => {
97
- open = false;
98
- document.querySelector(opts.appendTo)
99
- .appendChild(el);
100
- doRender();
101
- // click anywhere close it
102
- // const close = (event) => {
103
- // if(open) {
104
- // editor.stopCommand(cmdTogglePages)
105
- // //event.preventDefault()
106
- // }
107
- // }
108
- // document.addEventListener('mousedown', close)
109
- // add command to add pages
110
- editor.Commands.add(cmdAddPage, () => addPage(editor, opts));
111
- });
112
- });
113
- //# sourceMappingURL=page-panel.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"page-panel.js","sourceRoot":"","sources":["../../../../../src/ts/client/grapesjs/page-panel.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,QAAQ,MAAM,6BAA6B,CAAA;AACvD,OAAO,EAAC,IAAI,EAAE,MAAM,EAAC,MAAM,UAAU,CAAA;AAErC,MAAM,UAAU,GAAG,YAAY,CAAA;AAC/B,IAAI,IAAI,CAAA;AAER,MAAM,CAAC,MAAM,cAAc,GAAG,kBAAkB,CAAA;AAChD,MAAM,CAAC,MAAM,UAAU,GAAG,WAAW,CAAA;AAErC,SAAS,UAAU,CAAC,MAAM,EAAE,IAAI;IAC9B,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;AAC3B,CAAC;AACD,SAAS,OAAO,CAAC,MAAM,EAAE,MAAM;IAC7B,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,MAAM,EAAE,CAAA;IACnC,IAAI,GA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
- export declare const projectBarPlugin: (editor: any, opts: any) => void;
@@ -1,104 +0,0 @@
1
- /*
2
- * Silex website builder, free/libre no-code tool for makers.
3
- * Copyright (c) 2023 lexoyo and Silex Labs foundation
4
- *
5
- * This program is free software: you can redistribute it and/or modify
6
- * it under the terms of the GNU Affero General Public License as published by
7
- * the Free Software Foundation, either version 3 of the License, or any later version.
8
- *
9
- * This program is distributed in the hope that it will be useful,
10
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
- * GNU Affero General Public License for more details.
13
- *
14
- * You should have received a copy of the GNU Affero General Public License
15
- * along with this program. If not, see <https://www.gnu.org/licenses/>.
16
- */
17
- import { html, render } from 'lit-html';
18
- const panelId = 'project-bar-panel';
19
- const containerPanelId = 'project-bar-container';
20
- export const projectBarPlugin = (editor, opts) => {
21
- // create the panels container for all panels in grapesjs
22
- const containerPanel = editor.Panels.addPanel({
23
- id: containerPanelId,
24
- visible: false,
25
- });
26
- // create the project bar panel in grapesjs
27
- editor.Panels.addPanel({
28
- id: panelId,
29
- buttons: opts.panels,
30
- visible: true,
31
- });
32
- const panelsEl = opts.panels.map(panel => {
33
- const el = document.createElement('div');
34
- // create container for panel
35
- if (panel.attributes.containerClassName) {
36
- el.classList.add('project-bar__panel', panel.attributes.containerClassName, 'gjs-hidden');
37
- // add header
38
- if (panel.attributes.title) {
39
- render(html `
40
- <header class="project-bar__panel-header">
41
- <h3 class="project-bar__panel-header-title">${panel.attributes.title}</h3>
42
- ${panel.buttons?.map(button => {
43
- return html `
44
- <div
45
- class="project-bar__panel-header-button ${button.className}"
46
- @click=${e => editor.runCommand(button.command)}
47
- ><span>${button.text}</span></div>
48
- `;
49
- })}
50
- </header>
51
- `, el);
52
- }
53
- // temporarily attach it to the body
54
- // this lets the block manager and other plugins attach to their container
55
- document.body.appendChild(el);
56
- // on load attach the panels to the main container
57
- // this is when the main containerPanel has an element
58
- editor.on('load', () => {
59
- const containerPanelEl = containerPanel.view.el;
60
- containerPanelEl.appendChild(el);
61
- });
62
- }
63
- // commands for show / hide panels
64
- // handle the case where command is a normal command, then let the Panel handle it
65
- typeof panel.command === 'string' && editor.Commands.add(panel.command, {
66
- run() {
67
- if (panel.attributes.containerClassName) {
68
- containerPanel.set('visible', true);
69
- el.classList.remove('gjs-hidden');
70
- editor.Canvas.getFrameEl().classList.add('silex-squeeze-left');
71
- }
72
- },
73
- stop() {
74
- if (panel.attributes.containerClassName) {
75
- containerPanel.set('visible', false);
76
- el.classList.add('gjs-hidden');
77
- editor.Canvas.getFrameEl().classList.remove('silex-squeeze-left');
78
- }
79
- },
80
- });
81
- });
82
- function updateSqueez() {
83
- const containerPanelEl = containerPanel.view.el;
84
- const iframe = editor.Canvas.getFrameEl();
85
- iframe.classList.remove('enable-squeeze');
86
- setTimeout(() => {
87
- const left = iframe.getClientRects()[0]?.left;
88
- const right = containerPanelEl.getClientRects()[0]?.right;
89
- if (left < right || !right)
90
- iframe.classList.add('enable-squeeze');
91
- else
92
- iframe.classList.remove('enable-squeeze');
93
- }, 400); // More than the transition duration
94
- // make sure the squeez corresponds to the state (reset when change page)
95
- if (containerPanel.get('visible'))
96
- iframe.classList.add('silex-squeeze-left');
97
- else
98
- iframe.classList.remove('silex-squeeze-left');
99
- }
100
- editor.on('load device:select page', () => {
101
- updateSqueez();
102
- });
103
- };
104
- //# sourceMappingURL=project-bar.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"project-bar.js","sourceRoot":"","sources":["../../../../../src/ts/client/grapesjs/project-bar.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAC,IAAI,EAAE,MAAM,EAAC,MAAM,UAAU,CAAA;AAErC,MAAM,OAAO,GAAG,mBAAmB,CAAA;AACnC,MAAM,gBAAgB,GAAG,uBAAuB,CAAA;AAEhD,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,MAAM,EAAE,IAAI,EAAE,EAAE;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AC7C,MAAM,KAAK,GAAG,gBAAgB,CAAC,cAAc,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,CAAA;YACzD,IAAG,IAAI,GAAG,KAAK,IAAI,CAAC,KAAK;gBAAE,MAAM,CAAC,SAAS,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAA;;gBAC5D,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAA;QAChD,CAAC,EAAE,GAAG,CAAC,CAAA,CAAC,oCAAoC;QAC5C,yEAAyE;QACzE,IAAG,cAAc,CAAC,GAAG,CAAC,SAAS,CAAC;YAAE,MAAM,CAAC,SAAS,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAA;;YACvE,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,oBAAoB,CAAC,CAAA;IACpD,CAAC;IACD,MAAM,CAAC,EAAE,CAAC,yBAAyB,EAAE,GAAG,EAAE;QACxC,YAAY,EAAE,CAAA;IAChB,CAAC,CAAC,CAAA;AACJ,CAAC,CAAA"}
@@ -1 +0,0 @@
1
- export declare const richTextPlugin: any;
@@ -1,31 +0,0 @@
1
- /*
2
- * Silex website builder, free/libre no-code tool for makers.
3
- * Copyright (c) 2023 lexoyo and Silex Labs foundation
4
- *
5
- * This program is free software: you can redistribute it and/or modify
6
- * it under the terms of the GNU Affero General Public License as published by
7
- * the Free Software Foundation, either version 3 of the License, or any later version.
8
- *
9
- * This program is distributed in the hope that it will be useful,
10
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
- * GNU Affero General Public License for more details.
13
- *
14
- * You should have received a copy of the GNU Affero General Public License
15
- * along with this program. If not, see <https://www.gnu.org/licenses/>.
16
- */
17
- import * as grapesjs from 'grapesjs/dist/grapes.min.js';
18
- const pluginName = 'richText';
19
- export const richTextPlugin = grapesjs.plugins.add(pluginName, (editor, opts) => {
20
- editor.RichTextEditor.add('orderedList', {
21
- icon: '1.',
22
- attributes: { title: 'Ordered List' },
23
- result: rte => rte.exec('insertOrderedList'),
24
- });
25
- editor.RichTextEditor.add('unorderedList', {
26
- icon: '<i class="fa fa-list-ul"></i>',
27
- attributes: { title: 'Unordered List' },
28
- result: rte => rte.exec('insertUnorderedList'),
29
- });
30
- });
31
- //# sourceMappingURL=rich-text.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"rich-text.js","sourceRoot":"","sources":["../../../../../src/ts/client/grapesjs/rich-text.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,QAAQ,MAAM,6BAA6B,CAAA;AAEvD,MAAM,UAAU,GAAG,UAAU,CAAA;AAE7B,MAAM,CAAC,MAAM,cAAc,GAAG,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE,CAAC,MAAM,EAAE,IAAI,EAAE,EAAE;IAC9E,MAAM,CAAC,cAAc,CAAC,GAAG,CAAC,aAAa,EAAE;QACvC,IAAI,EAAE,IAAI;QACV,UAAU,EAAE,EAAC,KAAK,EAAE,cAAc,EAAC;QACnC,MAAM,EAAE,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,mBAAmB,CAAC;KAC7C,CAAC,CAAA;IACF,MAAM,CAAC,cAAc,CAAC,GAAG,CAAC,eAAe,EAAE;QACzC,IAAI,EAAE,+BAA+B;QACrC,UAAU,EAAE,EAAC,KAAK,EAAE,gBAAgB,EAAC;QACrC,MAAM,EAAE,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,qBAAqB,CAAC;KAC/C,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
@@ -1 +0,0 @@
1
- export declare const semanticPlugin: any;
@@ -1,110 +0,0 @@
1
- /*
2
- * Silex website builder, free/libre no-code tool for makers.
3
- * Copyright (c) 2023 lexoyo and Silex Labs foundation
4
- *
5
- * This program is free software: you can redistribute it and/or modify
6
- * it under the terms of the GNU Affero General Public License as published by
7
- * the Free Software Foundation, either version 3 of the License, or any later version.
8
- *
9
- * This program is distributed in the hope that it will be useful,
10
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
- * GNU Affero General Public License for more details.
13
- *
14
- * You should have received a copy of the GNU Affero General Public License
15
- * along with this program. If not, see <https://www.gnu.org/licenses/>.
16
- */
17
- import { html, render } from 'lit-html';
18
- import { map } from 'lit-html/directives/map.js';
19
- import grapesjs from 'grapesjs/dist/grapes.min.js';
20
- // constants
21
- const pluginName = 'semantic';
22
- const tags = [
23
- 'DIV',
24
- 'P',
25
- 'H1',
26
- 'H2',
27
- 'H3',
28
- 'H4',
29
- 'H5',
30
- 'H6',
31
- 'SPAN',
32
- 'MAIN',
33
- 'ASIDE',
34
- 'SECTION',
35
- 'ADDRESS',
36
- 'ARTICLE',
37
- 'BUTTON',
38
- 'NAV',
39
- 'HEADER',
40
- 'FOOTER',
41
- 'DETAILS',
42
- 'SUMMARY',
43
- 'PRE',
44
- 'BLOCKQUOTE',
45
- ];
46
- // plugin code
47
- export const semanticPlugin = grapesjs.plugins.add(pluginName, (editor, opts) => {
48
- // Add the new trait to all component types
49
- editor.DomComponents.getTypes().map(type => {
50
- editor.DomComponents.addType(type.id, {
51
- model: {
52
- defaults: {
53
- traits: [
54
- // Keep the type original traits
55
- ...editor.DomComponents.getType(type.id).model.prototype.defaults.traits,
56
- // Add the new trait
57
- {
58
- label: 'Tag name',
59
- type: 'tag-name',
60
- },
61
- ]
62
- }
63
- }
64
- });
65
- });
66
- function doRender(el, tagName) {
67
- const tagsWithCurrent = tags.includes(tagName.toUpperCase()) ? tags : tags.concat(tagName.toUpperCase());
68
- render(html `
69
- <label for="semantic__select" class="gjs-one-bg silex-label">Type</label>
70
- <select id="semantic__select" @change=${event => doRender(el, event.target.value)}>
71
- ${map(tagsWithCurrent, tag => html `
72
- <option value="${tag}" ?selected=${tagName.toUpperCase() === tag}>${tag}</option>
73
- `)}
74
- </select>
75
- `, el);
76
- }
77
- function doRenderCurrent(el) {
78
- doRender(el, editor.getSelected()?.get('tagName') || '');
79
- }
80
- // Add semantic traits
81
- // inspired by https://github.com/olivmonnier/grapesjs-plugin-header/blob/master/src/components.js
82
- editor.TraitManager.addType('tag-name', {
83
- createInput({ trait }) {
84
- // Create a new element container and add some content
85
- const el = document.createElement('div');
86
- // update the UI when a page is added/renamed/removed
87
- editor.on('page', () => doRenderCurrent(el));
88
- doRenderCurrent(el);
89
- // this will be the element passed to onEvent and onUpdate
90
- return el;
91
- },
92
- // Update the component based on UI changes
93
- // `elInput` is the result HTMLElement you get from `createInput`
94
- onEvent({ elInput, component, event }) {
95
- const value = elInput.querySelector('#semantic__select').value;
96
- if (component.get('tagName').toUpperCase() === value.toUpperCase()) {
97
- // Already done
98
- }
99
- else {
100
- component.set('tagName', value);
101
- }
102
- },
103
- // Update UI on the component change
104
- onUpdate({ elInput, component }) {
105
- const tagName = component.get('tagName');
106
- doRender(elInput, tagName);
107
- },
108
- });
109
- });
110
- //# sourceMappingURL=semantic.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"semantic.js","sourceRoot":"","sources":["../../../../../src/ts/client/grapesjs/semantic.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAC,IAAI,EAAE,MAAM,EAAC,MAAM,UAAU,CAAA;AACrC,OAAO,EAAC,GAAG,EAAC,MAAM,4BAA4B,CAAA;AAC9C,OAAO,QAAQ,MAAM,6BAA6B,CAAA;AAElD,YAAY;AACZ,MAAM,UAAU,GAAG,UAAU,CAAA;AAE7B,MAAM,IAAI,GAAG;IACX,KAAK;IACL,GAAG;IACH,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,MAAM;IACN,MAAM;IACN,OAAO;IACP,SAAS;IACT,SAAS;IACT,SAAS;IACT,QAAQ;IACR,KAAK;IACL,QAAQ;IACR,Q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