@silexlabs/silex 3.0.1-alpha.0 → 3.0.2
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/.env.default +20 -0
- package/.silex.js +67 -8
- package/LICENSE +661 -203
- package/README.md +37 -35
- package/dist/client/client/api.d.ts +90 -0
- package/dist/client/client/assetUrl.d.ts +54 -0
- package/dist/client/client/config.d.ts +102 -0
- package/dist/client/client/events.d.ts +23 -0
- package/dist/client/client/expose.d.ts +8 -0
- package/dist/client/client/grapesjs/LoginDialog.d.ts +15 -0
- package/dist/client/client/grapesjs/PublicationManager.d.ts +73 -0
- package/dist/client/client/grapesjs/PublicationUi.d.ts +59 -0
- package/dist/client/client/grapesjs/blocks.d.ts +1 -0
- package/dist/client/client/grapesjs/breadcrumbs.d.ts +1 -0
- package/dist/client/client/grapesjs/css-props.d.ts +6 -0
- package/dist/client/client/grapesjs/footer.d.ts +2 -0
- package/dist/client/client/grapesjs/img.d.ts +6 -0
- package/dist/client/client/grapesjs/index.d.ts +9 -0
- package/dist/client/client/grapesjs/internal-links.d.ts +1 -0
- package/dist/client/client/grapesjs/keymaps.d.ts +123 -0
- package/dist/client/client/grapesjs/new-page-dialog.d.ts +2 -0
- package/dist/client/client/grapesjs/openImport.d.ts +9 -0
- package/dist/client/client/grapesjs/page-panel.d.ts +9 -0
- package/dist/client/client/grapesjs/project-bar.d.ts +21 -0
- package/dist/client/client/grapesjs/resize-panel.d.ts +1 -0
- package/dist/client/client/grapesjs/rich-text.d.ts +4 -0
- package/dist/client/client/grapesjs/semantic.d.ts +1 -0
- package/dist/client/client/grapesjs/settings-sections.d.ts +16 -0
- package/dist/client/client/grapesjs/settings.d.ts +4 -0
- package/dist/client/client/grapesjs/storage.d.ts +2 -0
- package/dist/client/client/grapesjs/symbolDialogs.d.ts +3 -0
- package/dist/client/client/grapesjs/view-buttons.d.ts +1 -0
- package/dist/client/client/index.d.ts +10 -0
- package/dist/client/client/publication-transformers.d.ts +42 -0
- package/dist/client/client/publish-custom-code-block.d.ts +4 -0
- package/dist/client/client/publish-fonts.d.ts +4 -0
- package/dist/client/client/utils.d.ts +22 -0
- package/dist/client/constants.d.ts +32 -0
- package/dist/client/css/admin.css +1114 -328
- package/dist/client/css/admin.css.map +1 -0
- package/dist/client/grapesjs-filter-styles/dist/index.d.ts +4 -0
- package/dist/client/grapesjs-fonts/dist/index.d.ts +4 -0
- package/dist/client/grapesjs-fonts/src/commands.d.ts +3 -0
- package/dist/client/grapesjs-fonts/src/fonts.d.ts +4 -0
- package/dist/client/grapesjs-storage-rate-limit/dist/index.d.ts +4 -0
- package/dist/client/grapesjs-ui-suggest-classes/dist/index.d.ts +4 -0
- package/dist/client/index.html +3 -2
- package/dist/client/js/main.js +356 -131
- package/dist/client/js/main.js.LICENSE.txt +15 -1
- package/dist/client/page.d.ts +2 -0
- package/dist/client/silex-lib/src/ts/client/api.d.ts +90 -0
- package/dist/client/silex-lib/src/ts/client/assetUrl.d.ts +54 -0
- package/dist/client/silex-lib/src/ts/client/config.d.ts +102 -0
- package/dist/client/silex-lib/src/ts/client/events.d.ts +23 -0
- package/dist/client/silex-lib/src/ts/client/expose.d.ts +8 -0
- package/dist/client/silex-lib/src/ts/client/grapesjs/LoginDialog.d.ts +15 -0
- package/dist/client/silex-lib/src/ts/client/grapesjs/PublicationManager.d.ts +73 -0
- package/dist/client/silex-lib/src/ts/client/grapesjs/PublicationUi.d.ts +59 -0
- package/dist/client/silex-lib/src/ts/client/grapesjs/blocks.d.ts +1 -0
- package/dist/client/silex-lib/src/ts/client/grapesjs/breadcrumbs.d.ts +1 -0
- package/dist/client/silex-lib/src/ts/client/grapesjs/css-props.d.ts +6 -0
- package/dist/client/silex-lib/src/ts/client/grapesjs/footer.d.ts +2 -0
- package/dist/client/silex-lib/src/ts/client/grapesjs/img.d.ts +6 -0
- package/dist/client/silex-lib/src/ts/client/grapesjs/index.d.ts +9 -0
- package/dist/client/silex-lib/src/ts/client/grapesjs/internal-links.d.ts +1 -0
- package/dist/client/silex-lib/src/ts/client/grapesjs/keymaps.d.ts +123 -0
- package/dist/client/silex-lib/src/ts/client/grapesjs/new-page-dialog.d.ts +2 -0
- package/dist/client/silex-lib/src/ts/client/grapesjs/openImport.d.ts +9 -0
- package/dist/client/silex-lib/src/ts/client/grapesjs/page-panel.d.ts +9 -0
- package/dist/client/silex-lib/src/ts/client/grapesjs/project-bar.d.ts +21 -0
- package/dist/client/silex-lib/src/ts/client/grapesjs/resize-panel.d.ts +1 -0
- package/dist/client/silex-lib/src/ts/client/grapesjs/rich-text.d.ts +4 -0
- package/dist/client/silex-lib/src/ts/client/grapesjs/semantic.d.ts +1 -0
- package/dist/client/silex-lib/src/ts/client/grapesjs/settings-sections.d.ts +16 -0
- package/dist/client/silex-lib/src/ts/client/grapesjs/settings.d.ts +4 -0
- package/dist/client/silex-lib/src/ts/client/grapesjs/storage.d.ts +2 -0
- package/dist/client/silex-lib/src/ts/client/grapesjs/symbolDialogs.d.ts +3 -0
- package/dist/client/silex-lib/src/ts/client/grapesjs/view-buttons.d.ts +1 -0
- package/dist/client/silex-lib/src/ts/client/index.d.ts +10 -0
- package/dist/client/silex-lib/src/ts/client/publication-transformers.d.ts +42 -0
- package/dist/client/silex-lib/src/ts/client/publish-custom-code-block.d.ts +4 -0
- package/dist/client/silex-lib/src/ts/client/publish-fonts.d.ts +4 -0
- package/dist/client/silex-lib/src/ts/client/utils.d.ts +22 -0
- package/dist/client/silex-lib/src/ts/constants.d.ts +32 -0
- package/dist/client/silex-lib/src/ts/page.d.ts +2 -0
- package/dist/client/silex-lib/src/ts/types.d.ts +339 -0
- package/dist/client/types.d.ts +339 -0
- package/dist/plugins/client/client/events.d.ts +23 -0
- package/dist/plugins/client/client/events.js +43 -0
- package/dist/plugins/client/client/events.js.map +1 -0
- package/dist/plugins/client/plugins/client/template.d.ts +2 -0
- package/dist/plugins/client/plugins/client/template.js +234 -0
- package/dist/plugins/client/plugins/client/template.js.map +1 -0
- package/dist/plugins/client/plugins/client/website-info.d.ts +1 -0
- package/dist/plugins/client/plugins/client/website-info.js +72 -0
- package/dist/plugins/client/plugins/client/website-info.js.map +1 -0
- package/dist/plugins/client/types.d.ts +339 -0
- package/dist/plugins/client/types.js +80 -0
- package/dist/plugins/client/types.js.map +1 -0
- package/dist/plugins/server/constants.d.ts +32 -0
- package/dist/plugins/server/constants.js +76 -0
- package/dist/plugins/server/constants.js.map +1 -0
- package/dist/plugins/server/plugins/server/Cache.d.ts +2 -0
- package/dist/plugins/server/plugins/server/Cache.js +36 -0
- package/dist/plugins/server/plugins/server/Cache.js.map +1 -0
- package/dist/plugins/server/plugins/server/DownloadConnector.d.ts +29 -0
- package/dist/plugins/server/plugins/server/DownloadConnector.js +127 -0
- package/dist/plugins/server/plugins/server/DownloadConnector.js.map +1 -0
- package/dist/plugins/server/plugins/server/FtpConnector.d.ts +86 -0
- package/dist/plugins/server/plugins/server/FtpConnector.js +536 -0
- package/dist/plugins/server/plugins/server/FtpConnector.js.map +1 -0
- package/dist/plugins/server/plugins/server/GitlabConnector.d.ts +135 -0
- package/dist/plugins/server/plugins/server/GitlabConnector.js +649 -0
- package/dist/plugins/server/plugins/server/GitlabConnector.js.map +1 -0
- package/dist/plugins/server/plugins/server/GitlabHostingConnector.d.ts +16 -0
- package/dist/plugins/server/plugins/server/GitlabHostingConnector.js +209 -0
- package/dist/plugins/server/plugins/server/GitlabHostingConnector.js.map +1 -0
- package/dist/plugins/server/plugins/server/PublicationOptimizer.d.ts +0 -0
- package/dist/plugins/server/plugins/server/PublicationOptimizer.js +14 -0
- package/dist/plugins/server/plugins/server/PublicationOptimizer.js.map +1 -0
- package/dist/plugins/server/plugins/server/SslPlugin.d.ts +1 -0
- package/dist/plugins/server/plugins/server/SslPlugin.js +86 -0
- package/dist/plugins/server/plugins/server/SslPlugin.js.map +1 -0
- package/dist/plugins/server/plugins/server/StaticPlugin.d.ts +8 -0
- package/dist/plugins/server/plugins/server/StaticPlugin.js +45 -0
- package/dist/plugins/server/plugins/server/StaticPlugin.js.map +1 -0
- package/dist/plugins/server/server/config.d.ts +59 -0
- package/dist/plugins/server/server/config.js +181 -0
- package/dist/plugins/server/server/config.js.map +1 -0
- package/dist/plugins/server/server/connectors/FsHosting.d.ts +14 -0
- package/dist/plugins/server/server/connectors/FsHosting.js +66 -0
- package/dist/plugins/server/server/connectors/FsHosting.js.map +1 -0
- package/dist/plugins/server/server/connectors/FsStorage.d.ts +44 -0
- package/dist/plugins/server/server/connectors/FsStorage.js +261 -0
- package/dist/plugins/server/server/connectors/FsStorage.js.map +1 -0
- package/dist/plugins/server/server/connectors/connectors.d.ts +86 -0
- package/dist/plugins/server/server/connectors/connectors.js +126 -0
- package/dist/plugins/server/server/connectors/connectors.js.map +1 -0
- package/dist/plugins/server/server/events.d.ts +26 -0
- package/dist/plugins/server/server/events.js +31 -0
- package/dist/plugins/server/server/events.js.map +1 -0
- package/dist/plugins/server/server/jobs.d.ts +12 -0
- package/dist/plugins/server/server/jobs.js +79 -0
- package/dist/plugins/server/server/jobs.js.map +1 -0
- package/dist/plugins/server/server/utils/validation.d.ts +7 -0
- package/dist/plugins/server/server/utils/validation.js +37 -0
- package/dist/plugins/server/server/utils/validation.js.map +1 -0
- package/dist/plugins/server/types.d.ts +339 -0
- package/dist/plugins/server/types.js +84 -0
- package/dist/plugins/server/types.js.map +1 -0
- package/dist/server/constants.js +55 -0
- package/dist/server/plugins/server/Cache.js +19 -0
- package/dist/server/server/api/api.js +20 -0
- package/dist/server/server/api/connectorApi.js +334 -0
- package/dist/server/server/api/publicationApi.js +106 -0
- package/dist/server/server/api/websiteApi.js +315 -0
- package/dist/server/server/cli.js +71 -0
- package/dist/server/server/config.js +120 -0
- package/dist/server/server/connectors/FsHosting.js +47 -0
- package/dist/server/server/connectors/FsStorage.js +228 -0
- package/dist/server/server/connectors/connectors.js +88 -0
- package/dist/server/server/events.js +14 -0
- package/dist/server/server/expose.js +27 -0
- package/dist/server/server/express.js +46 -0
- package/dist/server/server/index.js +92 -0
- package/dist/server/server/jobs.js +50 -0
- package/dist/server/server/utils/validation.js +14 -0
- package/dist/server/types.js +40 -0
- package/package.json +99 -49
- package/public/assets/download.png +0 -0
- package/public/assets/favicon.ico +0 -0
- package/public/assets/favicon.png +0 -0
- package/public/assets/ftp.png +0 -0
- package/public/assets/gitlab.png +0 -0
- package/public/assets/gitlab2.png +0 -0
- package/public/assets/laptop.png +0 -0
- package/public/assets/logo-silex-small.png +0 -0
- package/public/silex.js +22 -23
- package/src/css/_variables.scss +24 -20
- package/src/css/dialog.scss +35 -2
- package/src/css/fonts.scss +31 -0
- package/src/css/footer.scss +12 -0
- package/src/css/grapesjs-light.scss +180 -0
- package/src/css/grapesjs-plugins.scss +227 -0
- package/src/css/grapesjs.scss +159 -1
- package/src/css/index.scss +12 -1
- package/src/css/light.scss +7 -0
- package/src/css/loader.scss +2 -0
- package/src/css/project-bar.scss +32 -16
- package/src/css/silex.scss +79 -5
- package/src/css/website-info.scss +14 -0
- package/src/html/index.pug +3 -3
- package/src/html/templates/includes.pug +0 -1
- package/src/ts/client/api.ts +156 -0
- package/src/ts/client/assetUrl.test.ts +164 -0
- package/src/ts/client/assetUrl.ts +254 -0
- package/src/ts/client/config.ts +175 -13
- package/src/ts/client/events.ts +43 -0
- package/src/ts/client/expose.ts +27 -1
- package/src/ts/client/grapesjs/LoginDialog.ts +204 -0
- package/src/ts/client/grapesjs/PublicationManager.ts +433 -0
- package/src/ts/client/grapesjs/PublicationUi.ts +366 -0
- package/src/ts/client/grapesjs/blocks.ts +17 -0
- package/src/ts/client/grapesjs/breadcrumbs.ts +79 -0
- package/src/ts/client/grapesjs/css-props.ts +910 -0
- package/src/ts/client/grapesjs/eleventy.ts +30 -7
- package/src/ts/client/grapesjs/footer.ts +42 -0
- package/src/ts/client/grapesjs/img.ts +147 -0
- package/src/ts/client/grapesjs/index.ts +311 -122
- package/src/ts/client/grapesjs/internal-links.test.ts +19 -1
- package/src/ts/client/grapesjs/internal-links.ts +31 -7
- package/src/ts/client/grapesjs/keymaps.ts +207 -0
- package/src/ts/client/grapesjs/new-page-dialog.ts +19 -3
- package/src/ts/client/grapesjs/openImport.ts +22 -0
- package/src/ts/client/grapesjs/page-panel.ts +109 -7
- package/src/ts/client/grapesjs/project-bar.ts +133 -72
- package/src/ts/client/grapesjs/resize-panel.ts +20 -0
- package/src/ts/client/grapesjs/rich-text.ts +38 -13
- package/src/ts/client/grapesjs/semantic.ts +20 -3
- package/src/ts/client/grapesjs/settings-sections.ts +117 -0
- package/src/ts/client/grapesjs/settings.ts +191 -96
- package/src/ts/client/grapesjs/storage.ts +187 -0
- package/src/ts/client/grapesjs/symbolDialogs.ts +21 -5
- package/src/ts/client/grapesjs/view-buttons.ts +42 -0
- package/src/ts/client/index.ts +80 -21
- package/src/ts/client/publication-transformers.test.ts +207 -0
- package/src/ts/client/publication-transformers.ts +280 -0
- package/src/ts/client/publish-custom-code-block.ts +31 -0
- package/src/ts/client/publish-fonts.ts +36 -0
- package/src/ts/client/utils.ts +70 -1
- package/src/ts/constants.ts +78 -0
- package/src/ts/externs.ts +17 -0
- package/src/ts/page.ts +20 -3
- package/src/ts/plugins/client/template.ts +246 -0
- package/src/ts/plugins/client/website-info.ts +84 -0
- package/src/ts/plugins/server/Cache.ts +32 -0
- package/src/ts/plugins/server/DownloadConnector.ts +146 -0
- package/src/ts/plugins/server/FtpConnector.test.ts +82 -0
- package/src/ts/plugins/server/FtpConnector.ts +621 -0
- package/src/ts/plugins/server/GitlabConnector.ts +749 -0
- package/src/ts/plugins/server/GitlabHostingConnector.ts +215 -0
- package/src/ts/plugins/server/PublicationOptimizer.ts +14 -0
- package/src/ts/plugins/server/SslPlugin.ts +84 -0
- package/src/ts/plugins/server/StaticPlugin.ts +45 -0
- package/src/ts/server/api/api.ts +19 -0
- package/src/ts/server/api/connectorApi.ts +464 -0
- package/src/ts/server/api/publicationApi.ts +159 -0
- package/src/ts/server/api/websiteApi.ts +462 -0
- package/src/ts/server/cli.ts +48 -14
- package/src/ts/server/config.ts +158 -60
- package/src/ts/server/connectors/FsHosting.ts +66 -0
- package/src/ts/server/connectors/FsStorage.test.ts +51 -0
- package/src/ts/server/connectors/FsStorage.ts +290 -0
- package/src/ts/server/connectors/connectors.ts +203 -0
- package/src/ts/server/events.ts +37 -0
- package/src/ts/server/expose.ts +19 -0
- package/src/ts/server/express.ts +57 -5
- package/src/ts/server/index.ts +80 -19
- package/src/ts/server/jobs.test.ts +75 -0
- package/src/ts/server/jobs.ts +89 -0
- package/src/ts/server/utils/BackwardCompat.ts +546 -528
- package/src/ts/server/utils/validation.ts +34 -0
- package/src/ts/types.ts +295 -85
- package/.dockerignore +0 -5
- package/.editorconfig +0 -14
- package/.eslintrc.json +0 -43
- package/.github/FUNDING.yml +0 -13
- package/.github/workflows/docker-hub-publish.yml +0 -36
- package/.github/workflows/npm-publish.yml +0 -19
- package/.github/workflows/test.yml +0 -26
- package/.nvmrc +0 -1
- package/.silex/default/.silex.data.json +0 -1
- package/CODE_OF_CONDUCT.md +0 -128
- package/CONTRIBUTING.md +0 -131
- package/Dockerfile +0 -15
- package/directus.silex.js +0 -7
- package/dist/constants.js +0 -4
- package/dist/events.js +0 -5
- package/dist/page.js +0 -15
- package/dist/server/cli.js +0 -43
- package/dist/server/config.js +0 -70
- package/dist/server/express.js +0 -18
- package/dist/server/index.js +0 -58
- package/dist/types.js +0 -34
- package/jest.config.js +0 -10
- package/logos/logo_by_ceubri/silex-icon-2018@200px.png +0 -0
- package/logos/logo_by_ceubri/silex-icon-2018@4x.png +0 -0
- package/logos/logo_by_ceubri/silex-logo-2018-white-transp.pdf +0 -0
- package/logos/logo_by_ceubri/silex-logo-2018-white.jpg +0 -0
- package/logos/logo_by_ceubri/silex-logo-2018-white.pdf +0 -0
- package/logos/logo_by_ceubri/silex-logo-2018-white.png +0 -0
- package/logos/logo_by_ceubri/silex-logo-2018-white@0.5x.png +0 -0
- package/logos/logo_by_ceubri/silex-logo-2018-white@0.75x.png +0 -0
- package/logos/logo_by_ceubri/silex-logo-2018-white@4x.jpg +0 -0
- package/logos/logo_by_ceubri/silex-logo-2018-white@4x.png +0 -0
- package/logos/logo_by_ceubri/silex-logo-2018.ai +5 -2521
- package/logos/logo_by_ceubri/silex-logo-2018.jpg +0 -0
- package/logos/logo_by_ceubri/silex-logo-2018.pdf +0 -0
- package/logos/logo_by_ceubri/silex-logo-2018.png +0 -0
- package/logos/logo_by_ceubri/silex-logo-2018@0.5x.png +0 -0
- package/logos/logo_by_ceubri/silex-logo-2018@0.75x.png +0 -0
- package/logos/logo_by_ceubri/silex-logo-2018@4x.jpg +0 -0
- package/logos/logo_by_ceubri/silex-logo-2018@4x.png +0 -0
- package/logos/silexlabs.png +0 -0
- package/src/example-client-config.js +0 -47
- package/src/plugins/AuthPlugin.js +0 -21
- package/src/plugins/Cache.js +0 -11
- package/src/plugins/DefaultBackend.js +0 -149
- package/src/plugins/ExpressPlugin.js +0 -39
- package/src/plugins/HooksPlugin.js +0 -58
- package/src/plugins/PublishPlugin.js +0 -69
- package/src/plugins/SslPlugin.js +0 -66
- package/src/plugins/StaticPlugin.js +0 -48
- package/src/plugins/WebsitePlugin.js +0 -207
- package/src/ts/client/grapesjs/publish.ts +0 -386
- package/src/ts/client/grapesjs/template.ts +0 -166
- package/src/ts/events.ts +0 -2
- package/tsconfig-server-debug.json +0 -19
- package/tsconfig-server-release.json +0 -19
- package/tsconfig.jest.json +0 -9
- package/tsconfig.json +0 -26
- package/webpack.config.js +0 -28
- package/webpack.debug.config.js +0 -8
|
@@ -1,4 +1,21 @@
|
|
|
1
|
-
|
|
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
|
+
import grapesjs, { Editor, EditorConfig } from 'grapesjs'
|
|
2
19
|
import openImport from './openImport'
|
|
3
20
|
|
|
4
21
|
/**
|
|
@@ -6,6 +23,8 @@ import openImport from './openImport'
|
|
|
6
23
|
* Handle plugins, options and initialization of the editor
|
|
7
24
|
*/
|
|
8
25
|
|
|
26
|
+
const notificationContainer = document.createElement('div')
|
|
27
|
+
|
|
9
28
|
// ////////////////////
|
|
10
29
|
// Plugins
|
|
11
30
|
// ////////////////////
|
|
@@ -13,60 +32,106 @@ import blocksBasicPlugin from 'grapesjs-blocks-basic'
|
|
|
13
32
|
import styleFilterPlugin from 'grapesjs-style-filter'
|
|
14
33
|
import formPlugin from 'grapesjs-plugin-forms'
|
|
15
34
|
import codePlugin from 'grapesjs-custom-code'
|
|
35
|
+
import navbarPlugin from 'grapesjs-navbar'
|
|
16
36
|
import uiSuggestClasses from '@silexlabs/grapesjs-ui-suggest-classes'
|
|
17
|
-
import
|
|
37
|
+
import filterStyles from '@silexlabs/grapesjs-filter-styles'
|
|
38
|
+
import symbolsPlugin from '@silexlabs/grapesjs-symbols'
|
|
18
39
|
import loadingPlugin from '@silexlabs/grapesjs-loading'
|
|
19
|
-
import fontsDialogPlugin
|
|
40
|
+
import fontsDialogPlugin from '@silexlabs/grapesjs-fonts'
|
|
20
41
|
import symbolDialogsPlugin, { cmdPromptAddSymbol } from './symbolDialogs'
|
|
42
|
+
import loginDialogPlugin, { LoginDialogOptions, cmdLogout } from './LoginDialog'
|
|
43
|
+
import footerPlugin from './footer'
|
|
44
|
+
import breadcrumbsPlugin from './breadcrumbs'
|
|
45
|
+
import imgPlugin from './img'
|
|
46
|
+
import cssPropsPlugin from './css-props'
|
|
47
|
+
import rateLimitPlugin from '@silexlabs/grapesjs-storage-rate-limit'
|
|
48
|
+
import borderPugin from 'grapesjs-style-border'
|
|
49
|
+
import backgroundPlugin from 'grapesjs-style-bg'
|
|
50
|
+
import resizePanelPlugin from './resize-panel'
|
|
51
|
+
import notificationsPlugin, { NotificationEditor } from '@silexlabs/grapesjs-notifications'
|
|
52
|
+
import keymapsDialogPlugin, { cmdKeymapsDialog, defaultOptions as keymapsDialogOpts } from '@silexlabs/grapesjs-keymaps-dialog'
|
|
21
53
|
|
|
22
54
|
import { pagePanelPlugin, cmdTogglePages, cmdAddPage } from './page-panel'
|
|
23
55
|
import { newPageDialog, cmdOpenNewPageDialog } from './new-page-dialog'
|
|
24
|
-
import { projectBarPlugin } from './project-bar'
|
|
56
|
+
import { PROJECT_BAR_PANEL_ID, projectBarPlugin } from './project-bar'
|
|
25
57
|
import { settingsDialog, cmdOpenSettings } from './settings'
|
|
26
58
|
import { blocksPlugin } from './blocks'
|
|
27
59
|
import { semanticPlugin } from './semantic'
|
|
28
|
-
import { richTextPlugin } from './rich-text'
|
|
60
|
+
import { orderedList, richTextPlugin, unorderedList } from './rich-text'
|
|
29
61
|
import { internalLinksPlugin } from './internal-links'
|
|
30
|
-
import {
|
|
31
|
-
import {
|
|
32
|
-
import
|
|
62
|
+
import {defaultKms, keymapsPlugin} from './keymaps'
|
|
63
|
+
import publicationManagerPlugin, { PublicationManagerOptions } from './PublicationManager'
|
|
64
|
+
import ViewButtons from './view-buttons'
|
|
65
|
+
import { storagePlugin } from './storage'
|
|
66
|
+
import { API_PATH, API_WEBSITE_ASSETS_WRITE, API_WEBSITE_PATH } from '../../constants'
|
|
67
|
+
import { ClientConfig } from '../config'
|
|
68
|
+
import { titleCase } from '../utils'
|
|
33
69
|
|
|
34
70
|
const plugins = [
|
|
35
|
-
{name: './
|
|
36
|
-
{name: '
|
|
71
|
+
{name: './project-bar', value: projectBarPlugin}, // has to be before panels and dialogs
|
|
72
|
+
{name: 'grapesjs-style-bg', value: backgroundPlugin},
|
|
73
|
+
{name: './settings', value: settingsDialog},
|
|
37
74
|
{name: '@silexlabs/grapesjs-fonts', value: fontsDialogPlugin},
|
|
38
|
-
{name: './
|
|
39
|
-
{name: './
|
|
75
|
+
{name: './new-page-dialog', value: newPageDialog},
|
|
76
|
+
{name: './page-panel', value: pagePanelPlugin},
|
|
40
77
|
{name: 'grapesjs-blocks-basic', value: blocksBasicPlugin},
|
|
41
|
-
{name: './
|
|
42
|
-
{name: './
|
|
43
|
-
{name: './
|
|
78
|
+
{name: './blocks', value: blocksPlugin},
|
|
79
|
+
{name: './view-buttons', value: ViewButtons},
|
|
80
|
+
{name: './semantic', value: semanticPlugin},
|
|
81
|
+
{name: './rich-text', value: richTextPlugin},
|
|
44
82
|
{name: 'grapesjs-style-filter', value: styleFilterPlugin},
|
|
45
83
|
{name: 'grapesjs-plugin-forms', value: formPlugin},
|
|
46
84
|
{name: 'grapesjs-custom-code', value: codePlugin},
|
|
47
|
-
{name: './
|
|
85
|
+
{name: './internal-links', value: internalLinksPlugin},
|
|
86
|
+
{name: './keymaps', value: keymapsPlugin},
|
|
48
87
|
{name: '@silexlabs/grapesjs-ui-suggest-classes', value: uiSuggestClasses},
|
|
49
|
-
{name: '
|
|
88
|
+
{name: '@silexlabs/grapesjs-filter-styles', value: filterStyles},
|
|
89
|
+
{name: './symbolDialogs', value: symbolDialogsPlugin},
|
|
50
90
|
{name: '@silexlabs/grapesjs-symbols', value: symbolsPlugin},
|
|
51
|
-
{name: './
|
|
52
|
-
{name: './
|
|
53
|
-
{name: './
|
|
91
|
+
{name: './PublicationManager', value: publicationManagerPlugin},
|
|
92
|
+
{name: './storage', value: storagePlugin},
|
|
93
|
+
{name: './LoginDialog', value: loginDialogPlugin},
|
|
54
94
|
{name: '@silexlabs/grapesjs-loading', value: loadingPlugin},
|
|
95
|
+
{name: './breadcrumbs', value: breadcrumbsPlugin},
|
|
96
|
+
{name: './img', value: imgPlugin},
|
|
97
|
+
{name: './css-props', value: cssPropsPlugin},
|
|
98
|
+
{name: './footer', value: footerPlugin},
|
|
99
|
+
{name: '@silexlabs/grapesjs-storage-rate-limit', value: rateLimitPlugin},
|
|
100
|
+
{name: 'grapesjs-style-border', value: borderPugin},
|
|
101
|
+
{name: './resize-panel', value: resizePanelPlugin},
|
|
102
|
+
{name: '@silexlabs/grapesjs-notifications', value: notificationsPlugin},
|
|
103
|
+
{name: '@silexlabs/grapesjs-keymaps-dialog', value: keymapsDialogPlugin},
|
|
104
|
+
{name: 'grapesjs-navbar', value:navbarPlugin}
|
|
55
105
|
]
|
|
56
106
|
// Check that all plugins are loaded correctly
|
|
57
107
|
plugins
|
|
58
|
-
.filter(p =>
|
|
108
|
+
.filter(p => typeof p.value !== 'function')
|
|
59
109
|
.forEach(p => {
|
|
60
|
-
throw new Error(`Plugin ${p.name} could not be loaded correctly`)
|
|
110
|
+
throw new Error(`Plugin ${p.name} could not be loaded correctly (${p.value})`)
|
|
61
111
|
})
|
|
62
112
|
|
|
113
|
+
// Constants
|
|
114
|
+
const PRIMARY_COLOR = '#333333'
|
|
115
|
+
const SECONDARY_COLOR = '#ddd'
|
|
116
|
+
const TERTIARY_COLOR = '#8873FE'
|
|
117
|
+
const QUATERNARY_COLOR = '#A291FF'
|
|
118
|
+
const DARKER_PRIMARY_COLOR = '#363636'
|
|
119
|
+
const LIGHTER_PRIMARY_COLOR = '#575757'
|
|
120
|
+
|
|
121
|
+
// Commands
|
|
122
|
+
export const cmdToggleLayers = 'open-layers'
|
|
123
|
+
export const cmdToggleBlocks = 'open-blocks'
|
|
124
|
+
export const cmdToggleSymbols = 'open-symbols'
|
|
125
|
+
export const cmdToggleNotifications = 'open-notifications'
|
|
126
|
+
|
|
63
127
|
// ////////////////////
|
|
64
128
|
// Config
|
|
65
129
|
// ////////////////////
|
|
66
130
|
const catBasic = 'Containers'
|
|
67
131
|
const catComponents = 'Components'
|
|
68
132
|
|
|
69
|
-
export function getEditorConfig(
|
|
133
|
+
export function getEditorConfig(config: ClientConfig): EditorConfig {
|
|
134
|
+
const { websiteId, storageId, rootUrl } = config
|
|
70
135
|
return {
|
|
71
136
|
container: '#gjs',
|
|
72
137
|
height: '100%',
|
|
@@ -84,121 +149,222 @@ export function getEditorConfig(id: string, rootUrl: string) {
|
|
|
84
149
|
},
|
|
85
150
|
|
|
86
151
|
assetManager: {
|
|
87
|
-
upload: `${rootUrl}
|
|
152
|
+
upload: `${rootUrl}${API_PATH}${API_WEBSITE_PATH}${API_WEBSITE_ASSETS_WRITE}/?websiteId=${websiteId}${ storageId ? `&connectorId=${storageId}` : ''}`,
|
|
88
153
|
},
|
|
89
154
|
|
|
90
155
|
storageManager: {
|
|
91
|
-
autoload:
|
|
92
|
-
type: '
|
|
156
|
+
autoload: false,
|
|
157
|
+
type: 'connector',
|
|
93
158
|
options: {
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
159
|
+
connector: {
|
|
160
|
+
id: websiteId,
|
|
161
|
+
connectorId: storageId,
|
|
97
162
|
},
|
|
98
163
|
},
|
|
99
164
|
},
|
|
100
165
|
|
|
166
|
+
cssIcons: './css/all.min.css',
|
|
167
|
+
canvasCss: `
|
|
168
|
+
:root {
|
|
169
|
+
--primaryColor: ${PRIMARY_COLOR};
|
|
170
|
+
--secondaryColor: ${SECONDARY_COLOR};
|
|
171
|
+
--tertiaryColor: ${TERTIARY_COLOR};
|
|
172
|
+
--quaternaryColor: ${QUATERNARY_COLOR};
|
|
173
|
+
--darkerPrimaryColor: ${DARKER_PRIMARY_COLOR};
|
|
174
|
+
--lighterPrimaryColor: ${LIGHTER_PRIMARY_COLOR};
|
|
175
|
+
}
|
|
176
|
+
.gjs-frame-selected {
|
|
177
|
+
box-shadow: 0 0 0 2px rgba(255, 0, 0, 0.5) !important; // Change to red border
|
|
178
|
+
}
|
|
179
|
+
.gjs-selected {
|
|
180
|
+
outline: 2px solid var(--tertiaryColor) !important;
|
|
181
|
+
outline-offset: -2px;
|
|
182
|
+
}
|
|
183
|
+
`,
|
|
184
|
+
|
|
185
|
+
richTextEditor: {
|
|
186
|
+
// @ts-ignore
|
|
187
|
+
actions: ['bold', 'italic', 'underline', 'strikethrough', 'link', 'wrap', orderedList, unorderedList],
|
|
188
|
+
},
|
|
189
|
+
|
|
190
|
+
|
|
101
191
|
plugins: plugins.map(p => p.value),
|
|
102
192
|
|
|
103
193
|
pluginsOpts: {
|
|
104
|
-
[blocksBasicPlugin
|
|
194
|
+
[blocksBasicPlugin.toString()]: {
|
|
105
195
|
blocks: ['text', 'image', 'video', 'map'],
|
|
106
196
|
category: catBasic,
|
|
107
197
|
//flexGrid: true,
|
|
108
198
|
},
|
|
109
|
-
[projectBarPlugin
|
|
199
|
+
[projectBarPlugin.toString()]: {
|
|
110
200
|
panels: [
|
|
111
201
|
{
|
|
112
202
|
id: 'dash',
|
|
113
203
|
className: 'logo',
|
|
114
|
-
attributes: { title: '
|
|
115
|
-
|
|
116
|
-
|
|
204
|
+
attributes: { title: 'Dashboard' },
|
|
205
|
+
command: () => {
|
|
206
|
+
window.location.href = '/'
|
|
207
|
+
},
|
|
117
208
|
}, {
|
|
118
209
|
id: 'block-manager-btn',
|
|
119
210
|
className: 'block-manager-btn fa fa-fw fa-plus',
|
|
120
|
-
|
|
121
|
-
|
|
211
|
+
name: 'Blocks',
|
|
212
|
+
attributes: { title: `Blocks (${titleCase(defaultKms.kmBlocks.keys, '+')})`, containerClassName: 'block-manager-container', },
|
|
213
|
+
command: cmdToggleBlocks,
|
|
122
214
|
}, {
|
|
123
215
|
id: 'symbols-btn',
|
|
124
|
-
className: 'symbols-btn fa
|
|
125
|
-
|
|
126
|
-
|
|
216
|
+
className: 'symbols-btn fa-regular fa-gem',
|
|
217
|
+
name: 'Symbols',
|
|
218
|
+
attributes: { title: `Symbols (${titleCase(defaultKms.kmSymbols.keys, '+')})`, containerClassName: 'symbols-list-container', },
|
|
219
|
+
command: cmdToggleSymbols,
|
|
127
220
|
buttons: [
|
|
128
221
|
{
|
|
129
222
|
id: 'symbol-create-button',
|
|
130
|
-
className: '
|
|
131
|
-
label: 'Create symbol from selection',
|
|
223
|
+
className: 'gjs-pn-btn',
|
|
132
224
|
command: cmdPromptAddSymbol,
|
|
225
|
+
text: '\u271A',
|
|
133
226
|
},
|
|
134
227
|
],
|
|
135
228
|
}, {
|
|
136
229
|
id: 'page-panel-btn',
|
|
137
230
|
className: 'page-panel-btn fa fa-fw fa-file',
|
|
138
|
-
|
|
231
|
+
name: 'Pages',
|
|
232
|
+
attributes: { title: `Pages (${titleCase(defaultKms.kmPages.keys, '+')})`, containerClassName: 'page-panel-container', },
|
|
139
233
|
command: cmdTogglePages,
|
|
140
234
|
buttons: [{
|
|
141
|
-
className: '
|
|
235
|
+
className: 'gjs-pn-btn',
|
|
142
236
|
command: cmdAddPage,
|
|
143
|
-
text: '
|
|
237
|
+
text: '\u271A',
|
|
144
238
|
}],
|
|
145
239
|
}, {
|
|
146
240
|
id: 'layer-manager-btn',
|
|
147
|
-
className: 'layer-manager-btn fa
|
|
148
|
-
|
|
149
|
-
|
|
241
|
+
className: 'layer-manager-btn fa-solid fa-layer-group',
|
|
242
|
+
name: 'Layers',
|
|
243
|
+
attributes: { title: `Layers (${titleCase(defaultKms.kmLayers.keys, '+')})`, containerClassName: 'layer-manager-container', },
|
|
244
|
+
command: cmdToggleLayers,
|
|
150
245
|
}, {
|
|
151
246
|
id: 'font-dialog-btn',
|
|
152
|
-
className: 'font-manager-btn fa
|
|
153
|
-
|
|
154
|
-
|
|
247
|
+
className: 'font-manager-btn fa-solid fa-font',
|
|
248
|
+
name: 'Fonts',
|
|
249
|
+
attributes: { title: `Fonts (${titleCase(defaultKms.kmOpenFonts.keys, '+')})` },
|
|
250
|
+
command: () => {
|
|
251
|
+
editor.runCommand('open-fonts')
|
|
252
|
+
},
|
|
155
253
|
}, {
|
|
156
254
|
id: 'settings-dialog-btn',
|
|
157
|
-
className: 'page-panel-btn fa
|
|
158
|
-
|
|
255
|
+
className: 'page-panel-btn fa-solid fa-gears',
|
|
256
|
+
name: 'Settings',
|
|
257
|
+
attributes: { title: `Settings (${titleCase(defaultKms.kmOpenSettings.keys, '+')})` },
|
|
159
258
|
command: cmdOpenSettings,
|
|
160
259
|
}, {
|
|
161
260
|
id: 'spacer',
|
|
162
261
|
attributes: {},
|
|
163
262
|
className: 'project-bar-spacer',
|
|
263
|
+
}, {
|
|
264
|
+
id: 'keymaps-btn',
|
|
265
|
+
className: 'keymaps-btn fa-solid fa-keyboard',
|
|
266
|
+
name: 'Shortcuts',
|
|
267
|
+
attributes: { title: 'Keyboard Shortcuts (Shift+H)' },
|
|
268
|
+
command: cmdKeymapsDialog,
|
|
269
|
+
}, {
|
|
270
|
+
id: 'notifications-btn',
|
|
271
|
+
className: 'notifications-btn fa-regular fa-bell',
|
|
272
|
+
name: 'Notifications',
|
|
273
|
+
attributes: { title: `Notifications (${titleCase(defaultKms.kmNotifications.keys, '+')})`, containerClassName: 'notifications-container', },
|
|
274
|
+
command: cmdToggleNotifications,
|
|
275
|
+
buttons: [{
|
|
276
|
+
className: 'gjs-pn-btn',
|
|
277
|
+
command: 'notifications:clear',
|
|
278
|
+
text: '\u2716',
|
|
279
|
+
}],
|
|
280
|
+
}, {
|
|
281
|
+
id: 'dash2',
|
|
282
|
+
className: 'fa-solid fa-house',
|
|
283
|
+
attributes: { title: 'Dashboard' },
|
|
284
|
+
command: () => {
|
|
285
|
+
window.location.href = '/'
|
|
286
|
+
},
|
|
287
|
+
}, {
|
|
288
|
+
id: 'help',
|
|
289
|
+
className: 'fa fa-fw fa-question-circle',
|
|
290
|
+
attributes: { title: 'Documentation' },
|
|
291
|
+
command: () => {
|
|
292
|
+
window.open('https://docs.silex.me/', '_blank')
|
|
293
|
+
},
|
|
164
294
|
}, {
|
|
165
295
|
id: 'logout-button',
|
|
166
296
|
className: 'page-panel-btn fa fa-fw fa-sign-out',
|
|
167
297
|
attributes: { title: 'Sign out' },
|
|
168
|
-
command:
|
|
298
|
+
command: cmdLogout,
|
|
169
299
|
},
|
|
170
300
|
],
|
|
171
301
|
},
|
|
172
|
-
[
|
|
302
|
+
[publicationManagerPlugin.toString()]: {
|
|
173
303
|
appendTo: 'options',
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
[pagePanelPlugin as any]: {
|
|
304
|
+
websiteId,
|
|
305
|
+
} as PublicationManagerOptions,
|
|
306
|
+
[pagePanelPlugin.toString()]: {
|
|
178
307
|
cmdOpenNewPageDialog,
|
|
179
308
|
cmdOpenSettings,
|
|
180
309
|
appendTo: '.page-panel-container',
|
|
181
310
|
},
|
|
182
|
-
[uiSuggestClasses
|
|
311
|
+
[uiSuggestClasses.toString()]: {
|
|
183
312
|
enableCount: false,
|
|
184
313
|
enablePerformance: false,
|
|
185
314
|
},
|
|
186
|
-
[
|
|
315
|
+
[filterStyles.toString()]: {
|
|
316
|
+
appendBefore: '.gjs-sm-sectors',
|
|
317
|
+
},
|
|
318
|
+
[internalLinksPlugin.toString()]: {
|
|
187
319
|
// FIXME: warn the user about links in error
|
|
188
|
-
onError: (errors) => console.
|
|
320
|
+
onError: (errors) => console.warn('Links errors:', errors),
|
|
189
321
|
},
|
|
190
|
-
[
|
|
322
|
+
[keymapsPlugin.toString()]: {
|
|
323
|
+
disableKeymaps: false,
|
|
324
|
+
},
|
|
325
|
+
[codePlugin.toString()]: {
|
|
191
326
|
blockLabel: 'HTML',
|
|
192
327
|
blockCustomCode: {
|
|
193
328
|
category: catComponents,
|
|
194
|
-
}
|
|
329
|
+
},
|
|
330
|
+
codeViewOptions: {
|
|
331
|
+
autoFormat: false,
|
|
332
|
+
},
|
|
195
333
|
},
|
|
196
|
-
[symbolsPlugin
|
|
334
|
+
[symbolsPlugin.toString()]: {
|
|
197
335
|
appendTo: '.symbols-list-container',
|
|
336
|
+
emptyText: 'No symbol yet.',
|
|
337
|
+
primaryColor: PRIMARY_COLOR,
|
|
338
|
+
secondaryColor: SECONDARY_COLOR,
|
|
339
|
+
highlightColor: TERTIARY_COLOR,
|
|
340
|
+
},
|
|
341
|
+
[fontsDialogPlugin.toString()]: {
|
|
342
|
+
api_key: config.fontsApiKey,
|
|
343
|
+
server_url: config.fontsServerUrl,
|
|
344
|
+
api_url: config.fontsApiUrl,
|
|
198
345
|
},
|
|
199
|
-
[
|
|
200
|
-
|
|
346
|
+
[loginDialogPlugin.toString()]: {
|
|
347
|
+
id: websiteId,
|
|
348
|
+
} as LoginDialogOptions,
|
|
349
|
+
[rateLimitPlugin.toString()]: {
|
|
350
|
+
time: 5000,
|
|
201
351
|
},
|
|
352
|
+
[imgPlugin.toString()]: {
|
|
353
|
+
replacedElements: config.replacedElements,
|
|
354
|
+
},
|
|
355
|
+
[notificationsPlugin.toString()]: {
|
|
356
|
+
container: notificationContainer,
|
|
357
|
+
reverse: true,
|
|
358
|
+
},
|
|
359
|
+
[keymapsDialogPlugin.toString()]: {
|
|
360
|
+
longPressDuration: null,
|
|
361
|
+
shortcut: 'shift+h',
|
|
362
|
+
},
|
|
363
|
+
[navbarPlugin.toString()]:{
|
|
364
|
+
block:{
|
|
365
|
+
category: 'Components'
|
|
366
|
+
}
|
|
367
|
+
}
|
|
202
368
|
},
|
|
203
369
|
}
|
|
204
370
|
}
|
|
@@ -206,69 +372,92 @@ export function getEditorConfig(id: string, rootUrl: string) {
|
|
|
206
372
|
// ////////////////////
|
|
207
373
|
// Initialize editor
|
|
208
374
|
// ////////////////////
|
|
209
|
-
// Expose grapes for plugins
|
|
210
|
-
// window['grapesjs'] = grapesjs
|
|
211
|
-
|
|
212
375
|
// Keep a ref to the editor singleton
|
|
213
|
-
let editor
|
|
214
|
-
|
|
215
|
-
export function initEditor(config, grapesJsPlugins) {
|
|
376
|
+
let editor: Editor
|
|
377
|
+
export async function initEditor(config: EditorConfig) {
|
|
216
378
|
if(editor) throw new Error('Grapesjs editor already created')
|
|
379
|
+
return new Promise<Editor>((resolve, reject) => {
|
|
380
|
+
try {
|
|
381
|
+
/* @ts-ignore */
|
|
382
|
+
editor = grapesjs.init(config)
|
|
383
|
+
} catch(e) {
|
|
384
|
+
console.error('Error initializing GrapesJs with plugins:', plugins, e)
|
|
385
|
+
reject(e)
|
|
386
|
+
}
|
|
217
387
|
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
388
|
+
// customize the editor
|
|
389
|
+
['text']
|
|
390
|
+
.forEach(id => editor.Blocks.get(id)?.set('category', 'Basics'))
|
|
391
|
+
;['image', 'video']
|
|
392
|
+
.forEach(id => editor.Blocks.get(id)?.set('category', 'Media'))
|
|
393
|
+
;['map']
|
|
394
|
+
.forEach(id => editor.Blocks.get(id)?.set('category', 'Components'))
|
|
395
|
+
editor.Blocks.render([])
|
|
396
|
+
|
|
397
|
+
editor.Commands.add('gjs-open-import-webpage', openImport(editor, {
|
|
398
|
+
modalImportLabel: '',
|
|
399
|
+
modalImportContent: 'Paste a web page HTML code here.',
|
|
400
|
+
modalImportButton: 'Import',
|
|
401
|
+
modalImportTitle: 'Import from website',
|
|
402
|
+
}))
|
|
403
|
+
|
|
404
|
+
// Detect loading errors
|
|
405
|
+
// Display a useful notification
|
|
406
|
+
const typeConfig = {
|
|
407
|
+
view: {
|
|
408
|
+
onRender({editor, el, model}) {
|
|
409
|
+
const src = model.getAttributes().src
|
|
410
|
+
el.addEventListener('error', () => {
|
|
411
|
+
editor.runCommand('notifications:add', {
|
|
412
|
+
type: 'error',
|
|
413
|
+
group: 'Image loading error',
|
|
414
|
+
message: `Error loading image: ${src}`,
|
|
415
|
+
componentId: model.getId(),
|
|
416
|
+
})
|
|
417
|
+
})
|
|
418
|
+
},
|
|
419
|
+
},
|
|
420
|
+
}
|
|
421
|
+
editor.DomComponents.addType('image', typeConfig)
|
|
422
|
+
editor.DomComponents.addType('iframe', typeConfig)
|
|
225
423
|
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
modalImportLabel: '',
|
|
237
|
-
modalImportContent: 'Paste a web page HTML code here.',
|
|
238
|
-
modalImportButton: 'Import',
|
|
239
|
-
modalImportTitle: 'Import from website',
|
|
240
|
-
}))
|
|
241
|
-
|
|
242
|
-
editor.on('load', () => {
|
|
243
|
-
// // move the options panel to the sidebar
|
|
244
|
-
// const optionsEl = editor.Panels.getPanel('options').view.el
|
|
245
|
-
// editor.Panels.getPanel('project-bar-panel').view.el
|
|
246
|
-
// .appendChild(options)
|
|
247
|
-
// options.style.width = 0
|
|
248
|
-
// options.style.position = 'static'
|
|
249
|
-
// remove blocks and layers buttons from the properties
|
|
250
|
-
setTimeout(() => {
|
|
251
|
-
editor.Panels.getPanel('views').buttons.remove('open-blocks')
|
|
252
|
-
editor.Panels.getPanel('views').buttons.remove('open-layers')
|
|
253
|
-
editor.Panels.getPanel('views').view.el.firstChild.style.justifyContent = 'initial' // align left
|
|
424
|
+
// Adjustments to do when the editor is ready
|
|
425
|
+
editor.on('load', () => {
|
|
426
|
+
const views = editor.Panels.getPanel('views')
|
|
427
|
+
|
|
428
|
+
// Remove blocks and layers buttons from the properties
|
|
429
|
+
// This is because in Silex they are on the left
|
|
430
|
+
views.buttons.remove(cmdToggleBlocks)
|
|
431
|
+
views.buttons.remove(cmdToggleLayers)
|
|
432
|
+
|
|
433
|
+
// Remove useless buttons
|
|
254
434
|
editor.Panels.getPanel('options').buttons.remove('export-template')
|
|
255
|
-
|
|
435
|
+
editor.Panels.getPanel('options').buttons.remove('fullscreen')
|
|
256
436
|
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
})
|
|
437
|
+
// Render the block manager, otherwise it is empty
|
|
438
|
+
editor.BlockManager.render(null)
|
|
260
439
|
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
440
|
+
// Use the style filter plugin
|
|
441
|
+
editor.StyleManager.addProperty('extra', { extend: 'filter' })
|
|
442
|
+
|
|
443
|
+
// Add a class to the Style Manager's sticky top section
|
|
444
|
+
editor.SelectorManager.selectorTags.el.parentElement.classList.add('top-style-section')
|
|
445
|
+
|
|
446
|
+
// Add the notifications container
|
|
447
|
+
document.body.querySelector('.notifications-container')?.appendChild(notificationContainer)
|
|
448
|
+
// Mark the button as dirty when there are notifications
|
|
449
|
+
// TODO: move this in the notifications plugin options
|
|
450
|
+
editor.on(
|
|
451
|
+
'notifications:changed',
|
|
452
|
+
() => {
|
|
453
|
+
const notificationButton = editor.Panels.getPanel(PROJECT_BAR_PANEL_ID).view?.el.querySelector('.notifications-btn')
|
|
454
|
+
;(editor as NotificationEditor)
|
|
455
|
+
.NotificationManager['length'] ? notificationButton?.classList.add('project-bar__dirty') : notificationButton?.classList.remove('project-bar__dirty')
|
|
456
|
+
}
|
|
457
|
+
)
|
|
458
|
+
|
|
459
|
+
// GrapesJs editor is ready
|
|
460
|
+
resolve(editor)
|
|
272
461
|
})
|
|
273
462
|
})
|
|
274
463
|
}
|
|
@@ -1,3 +1,20 @@
|
|
|
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
|
+
|
|
1
18
|
import { internalLinksPlugin } from './internal-links'
|
|
2
19
|
import { expect, test, beforeEach } from '@jest/globals'
|
|
3
20
|
import grapesjs from 'grapesjs'
|
|
@@ -48,6 +65,7 @@ const page2 = {
|
|
|
48
65
|
},
|
|
49
66
|
}
|
|
50
67
|
beforeEach(() => {
|
|
68
|
+
/* @ts-ignore */
|
|
51
69
|
editor = grapesjs.init({
|
|
52
70
|
headless: true,
|
|
53
71
|
storageManager: { autoload: false },
|
|
@@ -64,7 +82,7 @@ test('init', () => {
|
|
|
64
82
|
test('rename page and rewrite links in current page', () => {
|
|
65
83
|
const page = editor.Pages.getSelected()
|
|
66
84
|
expect(page.id).toBe(pageMain.id)
|
|
67
|
-
expect(page.getName()).
|
|
85
|
+
expect(page.getName()).toBe('')
|
|
68
86
|
const newName = 'Home page'
|
|
69
87
|
const newPath = './home-page.html'
|
|
70
88
|
// Do not work: page.setName(newName)
|