@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,92 +1,153 @@
|
|
|
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 { Editor, Panel } from 'grapesjs'
|
|
1
19
|
import {html, render} from 'lit-html'
|
|
2
20
|
|
|
3
|
-
const
|
|
4
|
-
const containerPanelId = 'project-bar-container'
|
|
21
|
+
export const PROJECT_BAR_PANEL_ID = 'project-bar-panel'
|
|
22
|
+
export const containerPanelId = 'project-bar-container'
|
|
23
|
+
|
|
24
|
+
export interface PanelObject {
|
|
25
|
+
command: string | ((editor: Editor) => void)
|
|
26
|
+
text: string
|
|
27
|
+
className: string
|
|
28
|
+
name?: string
|
|
29
|
+
attributes: {
|
|
30
|
+
title?: string
|
|
31
|
+
containerClassName?: string
|
|
32
|
+
}
|
|
33
|
+
buttons?: {
|
|
34
|
+
command: string
|
|
35
|
+
text: string
|
|
36
|
+
className: string
|
|
37
|
+
}[]
|
|
38
|
+
onClick?: (editor: Editor) => void
|
|
39
|
+
}
|
|
5
40
|
|
|
6
41
|
export const projectBarPlugin = (editor, opts) => {
|
|
7
42
|
// create the panels container for all panels in grapesjs
|
|
8
43
|
const containerPanel = editor.Panels.addPanel({
|
|
9
44
|
id: containerPanelId,
|
|
10
|
-
visible
|
|
45
|
+
visible: false,
|
|
46
|
+
// resize project panel button
|
|
47
|
+
buttons: [{
|
|
48
|
+
id: 'resizeBlocks',
|
|
49
|
+
className: 'viewsOptionsProjectPanel__size-btn',
|
|
50
|
+
command: 'resize-ProjectPanel',
|
|
51
|
+
attributes: { title: 'Resize Project Panel' },
|
|
52
|
+
}],
|
|
53
|
+
})
|
|
54
|
+
// resize project panel command
|
|
55
|
+
editor.Commands.add('resize-ProjectPanel', {
|
|
56
|
+
run: (editor, sender) => {
|
|
57
|
+
document.documentElement.style.setProperty('--viewsProjectPanelWidth', '26%')
|
|
58
|
+
},
|
|
59
|
+
stop: (editor, sender) => {
|
|
60
|
+
document.documentElement.style.setProperty('--viewsProjectPanelWidth', '13%')
|
|
61
|
+
},
|
|
11
62
|
})
|
|
12
63
|
// create the project bar panel in grapesjs
|
|
13
|
-
|
|
14
|
-
id:
|
|
64
|
+
editor.Panels.addPanel({
|
|
65
|
+
id: PROJECT_BAR_PANEL_ID,
|
|
15
66
|
buttons: opts.panels,
|
|
16
|
-
visible
|
|
67
|
+
visible: true,
|
|
17
68
|
})
|
|
18
|
-
|
|
19
|
-
|
|
69
|
+
// add the panels to the container
|
|
70
|
+
opts.panels.map(panel => addButton(editor, panel))
|
|
20
71
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
72
|
+
// Handle the preview mode which behaves oddly
|
|
73
|
+
editor.on('stop:preview', () => {
|
|
74
|
+
containerPanel.set('visible', false)
|
|
75
|
+
updateSqueez(editor)
|
|
76
|
+
})
|
|
24
77
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
${ panel.buttons?.map(button => {
|
|
31
|
-
return html`
|
|
32
|
-
<div
|
|
33
|
-
class="project-bar__panel-header-button ${ button.className }"
|
|
34
|
-
@click=${e => editor.runCommand(button.command)}
|
|
35
|
-
><span>${ button.text }</span></div>
|
|
36
|
-
`
|
|
37
|
-
}) }
|
|
38
|
-
</header>
|
|
39
|
-
`, el)
|
|
40
|
-
}
|
|
78
|
+
// All other events where the canvas is resized
|
|
79
|
+
editor.on('load device:select page', () => {
|
|
80
|
+
updateSqueez(editor)
|
|
81
|
+
})
|
|
82
|
+
}
|
|
41
83
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
84
|
+
function updateSqueez(editor: Editor) {
|
|
85
|
+
const containerPanel = editor.Panels.getPanel(containerPanelId)
|
|
86
|
+
// make sure the squeez corresponds to the state (reset when change page)
|
|
87
|
+
if(containerPanel.get('visible')) document.body.classList.add('silex-squeeze-left')
|
|
88
|
+
else document.body.classList.remove('silex-squeeze-left')
|
|
89
|
+
editor.refresh()
|
|
90
|
+
}
|
|
45
91
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
92
|
+
export function addButton(editor: Editor, panel: PanelObject) {
|
|
93
|
+
const containerPanel = editor.Panels.getPanel(containerPanelId)
|
|
94
|
+
const el = document.createElement('div')
|
|
95
|
+
// create container for panel
|
|
96
|
+
if(panel.attributes.containerClassName) {
|
|
97
|
+
el.classList.add('project-bar__panel', panel.attributes.containerClassName, 'gjs-hidden')
|
|
98
|
+
// add header
|
|
99
|
+
const title = panel.name ?? panel.attributes.title
|
|
100
|
+
if(title) {
|
|
101
|
+
render(html`
|
|
102
|
+
<header class="project-bar__panel-header">
|
|
103
|
+
<h3 class="project-bar__panel-header-title">${ title }</h3>
|
|
104
|
+
${ panel.buttons?.map(button => {
|
|
105
|
+
return html`
|
|
106
|
+
<div
|
|
107
|
+
class="project-bar__panel-header-button ${ button.className }"
|
|
108
|
+
@click=${e => editor.runCommand(button.command)}
|
|
109
|
+
><span>${ button.text }</span></div>
|
|
110
|
+
`
|
|
111
|
+
}) }
|
|
112
|
+
</header>
|
|
113
|
+
`, el)
|
|
52
114
|
}
|
|
53
|
-
|
|
54
|
-
//
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
containerPanel.set('visible', true)
|
|
62
|
-
el.classList.remove('gjs-hidden')
|
|
63
|
-
editor.Canvas.getFrameEl().classList.add('silex-squeeze-left')
|
|
64
|
-
}
|
|
65
|
-
},
|
|
66
|
-
stop() {
|
|
67
|
-
if(panel.attributes.containerClassName) {
|
|
68
|
-
containerPanel.set('visible', false)
|
|
69
|
-
el.classList.add('gjs-hidden')
|
|
70
|
-
editor.Canvas.getFrameEl().classList.remove('silex-squeeze-left')
|
|
71
|
-
}
|
|
72
|
-
},
|
|
115
|
+
// temporarily attach it to the body
|
|
116
|
+
// this lets the block manager and other plugins attach to their container
|
|
117
|
+
document.body.appendChild(el)
|
|
118
|
+
// on load attach the panels to the main container
|
|
119
|
+
// this is when the main containerPanel has an element
|
|
120
|
+
editor.on('load', () => {
|
|
121
|
+
const containerPanelEl = containerPanel.view.el
|
|
122
|
+
containerPanelEl.appendChild(el)
|
|
73
123
|
})
|
|
74
|
-
})
|
|
75
|
-
function updateSqueez() {
|
|
76
|
-
const containerPanelEl = containerPanel.view.el
|
|
77
|
-
const iframe = editor.Canvas.getFrameEl()
|
|
78
|
-
iframe.classList.remove('enable-squeeze')
|
|
79
|
-
setTimeout(() => {
|
|
80
|
-
const left = iframe.getClientRects()[0]?.left
|
|
81
|
-
const right = containerPanelEl.getClientRects()[0]?.right
|
|
82
|
-
if(left < right || !right) iframe.classList.add('enable-squeeze')
|
|
83
|
-
else iframe.classList.remove('enable-squeeze')
|
|
84
|
-
}, 400) // More than the transition duration
|
|
85
|
-
// make sure the squeez corresponds to the state (reset when change page)
|
|
86
|
-
if(containerPanel.get('visible')) iframe.classList.add('silex-squeeze-left')
|
|
87
|
-
else iframe.classList.remove('silex-squeeze-left')
|
|
88
124
|
}
|
|
89
|
-
|
|
90
|
-
|
|
125
|
+
// commands for show / hide panels
|
|
126
|
+
// handle the case where command is a normal command, then let the Panel handle it
|
|
127
|
+
typeof panel.command === 'string' && editor.Commands.add(panel.command, {
|
|
128
|
+
run() {
|
|
129
|
+
if(panel.attributes.containerClassName) {
|
|
130
|
+
containerPanel.set('visible', true)
|
|
131
|
+
el.classList.remove('gjs-hidden')
|
|
132
|
+
document.body.classList.add('silex-squeeze-left')
|
|
133
|
+
editor.refresh()
|
|
134
|
+
}
|
|
135
|
+
// Call the onClick function if it exists
|
|
136
|
+
if(panel.onClick) panel.onClick(editor)
|
|
137
|
+
// Remove the dirty flag
|
|
138
|
+
el.classList.remove('project-bar__dirty')
|
|
139
|
+
},
|
|
140
|
+
stop() {
|
|
141
|
+
if(panel.attributes.containerClassName) {
|
|
142
|
+
containerPanel.set('visible', false)
|
|
143
|
+
el.classList.add('gjs-hidden')
|
|
144
|
+
document.body.classList.remove('silex-squeeze-left')
|
|
145
|
+
editor.refresh()
|
|
146
|
+
}
|
|
147
|
+
// Call the onClick function if it exists
|
|
148
|
+
if(panel.onClick) panel.onClick(editor)
|
|
149
|
+
// Remove the dirty flag
|
|
150
|
+
el.classList.remove('project-bar__dirty')
|
|
151
|
+
},
|
|
91
152
|
})
|
|
92
153
|
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export default function(editor) {
|
|
2
|
+
editor.Panels.addPanel({
|
|
3
|
+
id: 'viewsOptions',
|
|
4
|
+
buttons: [{
|
|
5
|
+
id: 'resize',
|
|
6
|
+
// icon for arrow left
|
|
7
|
+
className: 'viewsOptions__size-btn',
|
|
8
|
+
command: 'resize-panel',
|
|
9
|
+
attributes: { title: 'Resize panel' },
|
|
10
|
+
}],
|
|
11
|
+
})
|
|
12
|
+
editor.Commands.add('resize-panel', {
|
|
13
|
+
run: (editor, sender) => {
|
|
14
|
+
document.documentElement.style.setProperty('--viewsPanelWidth', '40%')
|
|
15
|
+
},
|
|
16
|
+
stop: (editor, sender) => {
|
|
17
|
+
document.documentElement.style.setProperty('--viewsPanelWidth', '20%')
|
|
18
|
+
},
|
|
19
|
+
})
|
|
20
|
+
}
|
|
@@ -1,16 +1,41 @@
|
|
|
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 { RichTextEditorAction } from 'grapesjs'
|
|
2
19
|
|
|
3
20
|
const pluginName = 'richText'
|
|
4
21
|
|
|
5
|
-
export const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}
|
|
22
|
+
export const orderedList: RichTextEditorAction = {
|
|
23
|
+
name: 'orderedList',
|
|
24
|
+
icon: '1.',
|
|
25
|
+
attributes: { title: 'Ordered List' },
|
|
26
|
+
result: rte => rte.exec('insertOrderedList'),
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export const unorderedList: RichTextEditorAction = {
|
|
30
|
+
name: 'unorderedList',
|
|
31
|
+
icon: '•',
|
|
32
|
+
//icon: '<i class="fa fa-list-ul"></i>',
|
|
33
|
+
attributes: { title: 'Unordered List' },
|
|
34
|
+
result: rte => rte.exec('insertUnorderedList'),
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export const richTextPlugin = (editor, opts) => {
|
|
38
|
+
// This doesn't work, it is now added in the editor config
|
|
39
|
+
//editor.RichTextEditor.add('orderedList', orderedList)
|
|
40
|
+
//editor.RichTextEditor.add('unorderedList', unorderedList)
|
|
41
|
+
}
|
|
@@ -1,6 +1,22 @@
|
|
|
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 {html, render} from 'lit-html'
|
|
2
19
|
import {map} from 'lit-html/directives/map.js'
|
|
3
|
-
import grapesjs from 'grapesjs/dist/grapes.min.js'
|
|
4
20
|
|
|
5
21
|
// constants
|
|
6
22
|
const pluginName = 'semantic'
|
|
@@ -31,7 +47,7 @@ const tags = [
|
|
|
31
47
|
]
|
|
32
48
|
|
|
33
49
|
// plugin code
|
|
34
|
-
export const semanticPlugin =
|
|
50
|
+
export const semanticPlugin = (editor, opts) => {
|
|
35
51
|
// Add the new trait to all component types
|
|
36
52
|
editor.DomComponents.getTypes().map(type => {
|
|
37
53
|
editor.DomComponents.addType(type.id, {
|
|
@@ -44,6 +60,7 @@ export const semanticPlugin = grapesjs.plugins.add(pluginName, (editor, opts) =>
|
|
|
44
60
|
{
|
|
45
61
|
label: 'Tag name',
|
|
46
62
|
type: 'tag-name',
|
|
63
|
+
name: 'tag-name',
|
|
47
64
|
},
|
|
48
65
|
]
|
|
49
66
|
}
|
|
@@ -94,4 +111,4 @@ export const semanticPlugin = grapesjs.plugins.add(pluginName, (editor, opts) =>
|
|
|
94
111
|
doRender(elInput, tagName)
|
|
95
112
|
},
|
|
96
113
|
})
|
|
97
|
-
}
|
|
114
|
+
}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import {live} from 'lit-html/directives/live.js'
|
|
2
|
+
import {html, TemplateResult} from 'lit-html'
|
|
3
|
+
import { WebsiteSettings } from '../../types'
|
|
4
|
+
|
|
5
|
+
// ID of the code editor wrapper
|
|
6
|
+
export const idCodeWrapper = 'settings-head-wrapper'
|
|
7
|
+
|
|
8
|
+
// Is the model a site or a page?
|
|
9
|
+
export function isSite(model: any) { return !!model.getHtml }
|
|
10
|
+
|
|
11
|
+
export interface SettingsSection {
|
|
12
|
+
id: string
|
|
13
|
+
label: string
|
|
14
|
+
render: (settings: WebsiteSettings, model: Backbone.Model) => TemplateResult
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* This is the settings dialog default sections
|
|
19
|
+
* Each section has an entry in the sidebar
|
|
20
|
+
* Each section render as part of the settings form
|
|
21
|
+
* The form is submitted to save the settings with all FormData
|
|
22
|
+
*/
|
|
23
|
+
export const defaultSections: SettingsSection[] = [{
|
|
24
|
+
id: 'general',
|
|
25
|
+
label: 'General',
|
|
26
|
+
render: (settings, model) => html`
|
|
27
|
+
<div id="settings-general" class="silex-hideable">
|
|
28
|
+
<div class="gjs-sm-sector-title">General</div>
|
|
29
|
+
<div class="silex-form__group col2">
|
|
30
|
+
<label class="silex-form__element">
|
|
31
|
+
<h3>${isSite(model) ? 'Site name' : 'Page name'}</h3>
|
|
32
|
+
<p class="silex-help">${isSite(model) ? 'The project name in the editor, for you to remember what it is about.' : 'Label of the page in the editor, and file name of the published HTML page.'}</p>
|
|
33
|
+
<input type="text" name="name" .value=${live(model.get('name') || '')}/>
|
|
34
|
+
</label>
|
|
35
|
+
<label class="silex-form__element">
|
|
36
|
+
<h3>Website language</h3>
|
|
37
|
+
<p class="silex-help">This is the default language code for this website. Example: en, fr, es...</p>
|
|
38
|
+
<input type="text" name="lang" .value=${live(settings.lang || '')}/>
|
|
39
|
+
</label>
|
|
40
|
+
</div>
|
|
41
|
+
</div>
|
|
42
|
+
`,
|
|
43
|
+
}, {
|
|
44
|
+
id: 'seo',
|
|
45
|
+
label: 'SEO',
|
|
46
|
+
render: (settings, model) => html`
|
|
47
|
+
<div id="settings-seo" class="silex-hideable silex-hidden">
|
|
48
|
+
<div class="gjs-sm-sector-title">SEO</div>
|
|
49
|
+
<div class="silex-form__group col2">
|
|
50
|
+
<label class="silex-form__element">
|
|
51
|
+
<h3>Title</h3>
|
|
52
|
+
<p class="silex-help">Title of the browser window, and title in the search engines results. It is used by search engines to find out what your site is talking about. The title should be a maximum of 70 characters long, including spaces.</p>
|
|
53
|
+
<input type="text" name="title" .value=${live(settings.title || '')}/>
|
|
54
|
+
</label>
|
|
55
|
+
<label class="silex-form__element">
|
|
56
|
+
<h3>Description</h3>
|
|
57
|
+
<p class="silex-help">Description displayed by the search engines in search results. It is used by search engines to find out what your site is talking about. It is best to keep meta descriptions between 150 and 160 characters.</p>
|
|
58
|
+
<input type="text" name="description" .value=${live(settings.description || '')}/>
|
|
59
|
+
</label>
|
|
60
|
+
<label class="silex-form__element">
|
|
61
|
+
<h3>Favicon</h3>
|
|
62
|
+
<p class="silex-help">Small image displayed in the browser's address bar and in tabs. The recommended size is 16×16 or 32×32 pixels. This can be a URL or a relative path.</p>
|
|
63
|
+
<input type="text" name="favicon" .value=${live(settings.favicon || '')}/>
|
|
64
|
+
</label>
|
|
65
|
+
</div>
|
|
66
|
+
</div>
|
|
67
|
+
`,
|
|
68
|
+
}, {
|
|
69
|
+
id: 'social',
|
|
70
|
+
label: 'Social',
|
|
71
|
+
render: (settings, model) => html`
|
|
72
|
+
<div id="settings-social" class="silex-hideable silex-hidden">
|
|
73
|
+
<div class="gjs-sm-sector-title">Social</div>
|
|
74
|
+
<div class="silex-help">
|
|
75
|
+
<p>Once your website is live, you can use these tools to test sharing: <a target="_blank" href="https://developers.facebook.com/tools/debug/">Facebook</a>,
|
|
76
|
+
<a target="_blank" href="https://cards-dev.twitter.com/validator">Twitter</a>,
|
|
77
|
+
<a target="_blank" href="https://www.linkedin.com/post-inspector/inspect/">Linkedin</a></p>
|
|
78
|
+
</div>
|
|
79
|
+
<div class="silex-form__group col2">
|
|
80
|
+
<label class="silex-form__element">
|
|
81
|
+
<h3>Title</h3>
|
|
82
|
+
<p class="silex-help">The title of your website displayed when a user shares your website on a social network.
|
|
83
|
+
Do not include any branding in this title, just eye-catching phrase, e.g. "Learn everything about fishing".
|
|
84
|
+
Title should be between 60 and 90 characters long.</p>
|
|
85
|
+
<input type="text" name="og:title" .value=${live(settings['og:title'] || '')}/>
|
|
86
|
+
</label>
|
|
87
|
+
<label class="silex-form__element">
|
|
88
|
+
<h3>Description</h3>
|
|
89
|
+
<p class="silex-help">Description displayed when a user shares your website on a social network. Make it catchy, and invite readers to visit your website too, e.g. "Sam's website about fishing, check it out!" Title should be between 60 and 90 characters long.</p>
|
|
90
|
+
<input type="text" name="og:description" .value=${live(settings['og:description'] || '')}/>
|
|
91
|
+
</label>
|
|
92
|
+
<label class="silex-form__element">
|
|
93
|
+
<h3>Image</h3>
|
|
94
|
+
<div class="silex-help">
|
|
95
|
+
<p>Thumbnail image which is displayed when your website is shared on a social network. The optimal size is 1200×627 pixels. At this size, your thumbnail will be big and stand out from the crowd. But do not exceed the 5MB size limit. If you use an image that is smaller than 400 pixels x 209 pixels, it will render as a much smaller thumbnail.</p>
|
|
96
|
+
<p>Please enter the full URL here, e.g. "http://mysite.com/path/to/image.jpg"</p>
|
|
97
|
+
</div>
|
|
98
|
+
<input type="text" name="og:image" .value=${live(settings['og:image'] || '')}/>
|
|
99
|
+
</label>
|
|
100
|
+
</div>
|
|
101
|
+
</div>
|
|
102
|
+
`,
|
|
103
|
+
}, {
|
|
104
|
+
id: 'code',
|
|
105
|
+
label: 'Code',
|
|
106
|
+
render: (settings, model) => html`
|
|
107
|
+
<div id="settings-code" class="silex-hideable silex-hidden">
|
|
108
|
+
<div class="gjs-sm-sector-title">Code</div>
|
|
109
|
+
<div class="silex-form__group">
|
|
110
|
+
<label class="silex-form__element" id="${idCodeWrapper}">
|
|
111
|
+
<h3>HTML head</h3>
|
|
112
|
+
<p class="silex-help">HTML code which will be inserted in the HEAD tag.</p>
|
|
113
|
+
</label>
|
|
114
|
+
</div>
|
|
115
|
+
</div>
|
|
116
|
+
`,
|
|
117
|
+
}]
|