@silexlabs/silex 3.0.1-0 → 3.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.env.default +3 -2
- package/.silex.js +39 -1
- package/README.md +37 -35
- package/dist/client/client/api.d.ts +8 -1
- package/dist/client/client/assetUrl.d.ts +54 -0
- package/dist/client/client/config.d.ts +60 -1
- package/dist/client/client/events.d.ts +19 -10
- package/dist/client/client/grapesjs/PublicationManager.d.ts +6 -8
- package/dist/client/client/grapesjs/PublicationUi.d.ts +8 -10
- 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 +6 -2
- package/dist/client/client/grapesjs/internal-links.d.ts +1 -1
- package/dist/client/client/grapesjs/keymaps.d.ts +123 -0
- package/dist/client/client/grapesjs/new-page-dialog.d.ts +1 -1
- package/dist/client/client/grapesjs/page-panel.d.ts +7 -1
- package/dist/client/client/grapesjs/project-bar.d.ts +20 -0
- package/dist/client/client/grapesjs/resize-panel.d.ts +1 -0
- package/dist/client/client/grapesjs/rich-text.d.ts +4 -1
- package/dist/client/client/grapesjs/semantic.d.ts +1 -1
- package/dist/client/client/grapesjs/settings-sections.d.ts +16 -0
- package/dist/client/client/grapesjs/settings.d.ts +3 -1
- package/dist/client/client/grapesjs/storage.d.ts +1 -0
- package/dist/client/client/grapesjs/symbolDialogs.d.ts +1 -1
- package/dist/client/client/grapesjs/view-buttons.d.ts +1 -0
- package/dist/client/client/index.d.ts +5 -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 -1
- package/dist/client/constants.d.ts +3 -0
- package/dist/client/css/admin.css +1107 -411
- 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 +305 -170
- package/dist/client/js/main.js.LICENSE.txt +21 -1
- package/dist/client/page.d.ts +1 -1
- 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 +59 -35
- package/dist/plugins/client/client/events.d.ts +19 -10
- package/dist/plugins/client/client/events.js +11 -0
- package/dist/plugins/client/client/events.js.map +1 -1
- package/dist/plugins/client/plugins/client/template.js +119 -71
- package/dist/plugins/client/plugins/client/template.js.map +1 -1
- 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 +59 -35
- package/dist/plugins/client/types.js +23 -0
- package/dist/plugins/client/types.js.map +1 -1
- package/dist/plugins/server/constants.d.ts +3 -0
- package/dist/plugins/server/constants.js +28 -1
- package/dist/plugins/server/constants.js.map +1 -1
- package/dist/plugins/server/plugins/server/Cache.js +9 -5
- package/dist/plugins/server/plugins/server/Cache.js.map +1 -1
- 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 +5 -2
- package/dist/plugins/server/plugins/server/FtpConnector.js +38 -23
- package/dist/plugins/server/plugins/server/FtpConnector.js.map +1 -1
- package/dist/plugins/server/plugins/server/GitlabConnector.d.ts +63 -9
- package/dist/plugins/server/plugins/server/GitlabConnector.js +367 -91
- package/dist/plugins/server/plugins/server/GitlabConnector.js.map +1 -1
- 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/SslPlugin.js +6 -6
- package/dist/plugins/server/plugins/server/SslPlugin.js.map +1 -1
- package/dist/plugins/server/plugins/server/StaticPlugin.d.ts +8 -1
- package/dist/plugins/server/plugins/server/StaticPlugin.js +5 -31
- package/dist/plugins/server/plugins/server/StaticPlugin.js.map +1 -1
- package/dist/plugins/server/server/config.js +8 -9
- package/dist/plugins/server/server/config.js.map +1 -1
- package/dist/plugins/server/server/connectors/FsHosting.d.ts +3 -2
- package/dist/plugins/server/server/connectors/FsHosting.js +18 -7
- package/dist/plugins/server/server/connectors/FsHosting.js.map +1 -1
- package/dist/plugins/server/server/connectors/FsStorage.d.ts +3 -1
- package/dist/plugins/server/server/connectors/FsStorage.js +35 -28
- package/dist/plugins/server/server/connectors/FsStorage.js.map +1 -1
- package/dist/plugins/server/server/connectors/connectors.d.ts +7 -7
- package/dist/plugins/server/server/connectors/connectors.js +6 -7
- package/dist/plugins/server/server/connectors/connectors.js.map +1 -1
- package/dist/plugins/server/server/events.js +16 -0
- package/dist/plugins/server/server/events.js.map +1 -1
- package/dist/plugins/server/server/jobs.d.ts +6 -0
- package/dist/plugins/server/server/jobs.js +12 -8
- package/dist/plugins/server/server/jobs.js.map +1 -1
- package/dist/plugins/server/server/utils/validation.js +1 -2
- package/dist/plugins/server/server/utils/validation.js.map +1 -1
- package/dist/plugins/server/types.d.ts +59 -35
- package/dist/plugins/server/types.js +24 -1
- package/dist/plugins/server/types.js.map +1 -1
- package/dist/server/constants.js +27 -1
- package/dist/server/plugins/server/Cache.js +9 -5
- package/dist/server/server/api/api.js +1 -1
- package/dist/server/server/api/connectorApi.js +154 -25
- package/dist/server/server/api/publicationApi.js +17 -25
- package/dist/server/server/api/websiteApi.js +30 -8
- package/dist/server/server/cli.js +9 -6
- package/dist/server/server/config.js +8 -9
- package/dist/server/server/connectors/FsHosting.js +17 -7
- package/dist/server/server/connectors/FsStorage.js +34 -28
- package/dist/server/server/connectors/connectors.js +6 -7
- package/dist/server/server/express.js +4 -5
- package/dist/server/server/index.js +5 -1
- package/dist/server/server/jobs.js +11 -8
- package/dist/server/server/utils/validation.js +1 -2
- package/dist/server/types.js +13 -1
- package/package.json +56 -42
- 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 +5 -23
- package/src/css/_variables.scss +23 -20
- package/src/css/dialog.scss +27 -1
- 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 +84 -10
- package/src/css/index.scss +12 -1
- package/src/css/light.scss +7 -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/ts/client/api.ts +38 -14
- package/src/ts/client/assetUrl.test.ts +164 -0
- package/src/ts/client/assetUrl.ts +254 -0
- package/src/ts/client/config.ts +133 -5
- package/src/ts/client/events.ts +21 -9
- package/src/ts/client/grapesjs/LoginDialog.ts +4 -2
- package/src/ts/client/grapesjs/PublicationManager.ts +180 -54
- package/src/ts/client/grapesjs/PublicationUi.ts +122 -86
- 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 +11 -8
- package/{dist/plugins/client/page.js → src/ts/client/grapesjs/footer.ts} +24 -13
- package/src/ts/client/grapesjs/img.ts +147 -0
- package/src/ts/client/grapesjs/index.ts +234 -52
- package/src/ts/client/grapesjs/internal-links.test.ts +2 -1
- package/src/ts/client/grapesjs/internal-links.ts +14 -7
- package/src/ts/client/grapesjs/keymaps.ts +207 -0
- package/src/ts/client/grapesjs/new-page-dialog.ts +2 -3
- package/src/ts/client/grapesjs/page-panel.ts +92 -7
- package/src/ts/client/grapesjs/project-bar.ts +116 -72
- package/src/ts/client/grapesjs/resize-panel.ts +20 -0
- package/src/ts/client/grapesjs/rich-text.ts +21 -13
- package/src/ts/client/grapesjs/semantic.ts +3 -3
- package/src/ts/client/grapesjs/settings-sections.ts +117 -0
- package/src/ts/client/grapesjs/settings.ts +174 -96
- package/src/ts/client/grapesjs/storage.ts +98 -33
- package/src/ts/client/grapesjs/symbolDialogs.ts +3 -4
- package/src/ts/{plugins/server/AuthPlugin.ts → client/grapesjs/view-buttons.ts} +23 -19
- package/src/ts/client/index.ts +35 -16
- package/src/ts/client/publication-transformers.test.ts +207 -0
- package/src/ts/client/publication-transformers.ts +280 -0
- package/{dist/plugins/client/client/utils.js → src/ts/client/publish-custom-code-block.ts} +14 -8
- package/src/ts/client/publish-fonts.ts +36 -0
- package/src/ts/client/utils.ts +53 -1
- package/src/ts/constants.ts +31 -0
- package/src/ts/page.ts +2 -2
- package/src/ts/plugins/client/template.ts +125 -75
- package/src/ts/plugins/client/website-info.ts +84 -0
- package/src/ts/plugins/server/Cache.ts +6 -2
- package/src/ts/plugins/server/DownloadConnector.ts +146 -0
- package/src/ts/plugins/server/FtpConnector.ts +47 -21
- package/src/ts/plugins/server/GitlabConnector.ts +423 -108
- package/src/ts/plugins/server/GitlabHostingConnector.ts +215 -0
- package/src/ts/plugins/server/SslPlugin.ts +5 -5
- package/src/ts/plugins/server/StaticPlugin.ts +3 -30
- package/src/ts/server/api/connectorApi.ts +165 -28
- package/src/ts/server/api/publicationApi.ts +17 -24
- package/src/ts/server/api/websiteApi.ts +57 -14
- package/src/ts/server/cli.ts +7 -5
- package/src/ts/server/config.ts +9 -10
- package/src/ts/server/connectors/FsHosting.ts +14 -8
- package/src/ts/server/connectors/FsStorage.ts +40 -7
- package/src/ts/server/connectors/connectors.ts +8 -6
- package/src/ts/server/events.ts +17 -0
- package/src/ts/server/express.ts +2 -2
- package/src/ts/server/index.ts +6 -0
- package/src/ts/server/jobs.ts +14 -2
- package/src/ts/server/utils/BackwardCompat.ts +530 -529
- package/src/ts/types.ts +78 -34
- package/dist/plugins/client/client/utils.d.ts +0 -1
- package/dist/plugins/client/client/utils.js.map +0 -1
- package/dist/plugins/client/page.d.ts +0 -2
- package/dist/plugins/client/page.js.map +0 -1
- package/dist/plugins/client/plugins/client/publicationRenderer.d.ts +0 -2
- package/dist/plugins/client/plugins/client/publicationRenderer.js +0 -128
- package/dist/plugins/client/plugins/client/publicationRenderer.js.map +0 -1
- package/dist/plugins/server/plugins/server/AuthPlugin.d.ts +0 -1
- package/dist/plugins/server/plugins/server/AuthPlugin.js +0 -38
- package/dist/plugins/server/plugins/server/AuthPlugin.js.map +0 -1
- package/dist/plugins/server/plugins/server/HooksPlugin.d.ts +0 -7
- package/dist/plugins/server/plugins/server/HooksPlugin.js +0 -74
- package/dist/plugins/server/plugins/server/HooksPlugin.js.map +0 -1
- package/src/example-client-config.js +0 -64
- package/src/ts/plugins/client/publicationRenderer.ts +0 -128
- package/src/ts/plugins/server/HooksPlugin.ts +0 -76
|
@@ -23,6 +23,8 @@ import openImport from './openImport'
|
|
|
23
23
|
* Handle plugins, options and initialization of the editor
|
|
24
24
|
*/
|
|
25
25
|
|
|
26
|
+
const notificationContainer = document.createElement('div')
|
|
27
|
+
|
|
26
28
|
// ////////////////////
|
|
27
29
|
// Plugins
|
|
28
30
|
// ////////////////////
|
|
@@ -30,47 +32,76 @@ import blocksBasicPlugin from 'grapesjs-blocks-basic'
|
|
|
30
32
|
import styleFilterPlugin from 'grapesjs-style-filter'
|
|
31
33
|
import formPlugin from 'grapesjs-plugin-forms'
|
|
32
34
|
import codePlugin from 'grapesjs-custom-code'
|
|
35
|
+
import navbarPlugin from 'grapesjs-navbar'
|
|
33
36
|
import uiSuggestClasses from '@silexlabs/grapesjs-ui-suggest-classes'
|
|
37
|
+
import filterStyles from '@silexlabs/grapesjs-filter-styles'
|
|
34
38
|
import symbolsPlugin from '@silexlabs/grapesjs-symbols'
|
|
35
39
|
import loadingPlugin from '@silexlabs/grapesjs-loading'
|
|
36
|
-
import fontsDialogPlugin
|
|
40
|
+
import fontsDialogPlugin from '@silexlabs/grapesjs-fonts'
|
|
37
41
|
import symbolDialogsPlugin, { cmdPromptAddSymbol } from './symbolDialogs'
|
|
38
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'
|
|
39
53
|
|
|
40
54
|
import { pagePanelPlugin, cmdTogglePages, cmdAddPage } from './page-panel'
|
|
41
55
|
import { newPageDialog, cmdOpenNewPageDialog } from './new-page-dialog'
|
|
42
|
-
import { projectBarPlugin } from './project-bar'
|
|
56
|
+
import { PROJECT_BAR_PANEL_ID, projectBarPlugin } from './project-bar'
|
|
43
57
|
import { settingsDialog, cmdOpenSettings } from './settings'
|
|
44
58
|
import { blocksPlugin } from './blocks'
|
|
45
59
|
import { semanticPlugin } from './semantic'
|
|
46
|
-
import { richTextPlugin } from './rich-text'
|
|
60
|
+
import { orderedList, richTextPlugin, unorderedList } from './rich-text'
|
|
47
61
|
import { internalLinksPlugin } from './internal-links'
|
|
62
|
+
import {defaultKms, keymapsPlugin} from './keymaps'
|
|
48
63
|
import publicationManagerPlugin, { PublicationManagerOptions } from './PublicationManager'
|
|
64
|
+
import ViewButtons from './view-buttons'
|
|
49
65
|
import { storagePlugin } from './storage'
|
|
50
|
-
import { ConnectorId, WebsiteId } from '../../types'
|
|
51
66
|
import { API_PATH, API_WEBSITE_ASSETS_WRITE, API_WEBSITE_PATH } from '../../constants'
|
|
67
|
+
import { ClientConfig } from '../config'
|
|
68
|
+
import { titleCase } from '../utils'
|
|
52
69
|
|
|
53
70
|
const plugins = [
|
|
54
71
|
{name: './project-bar', value: projectBarPlugin}, // has to be before panels and dialogs
|
|
72
|
+
{name: 'grapesjs-style-bg', value: backgroundPlugin},
|
|
55
73
|
{name: './settings', value: settingsDialog},
|
|
56
74
|
{name: '@silexlabs/grapesjs-fonts', value: fontsDialogPlugin},
|
|
57
75
|
{name: './new-page-dialog', value: newPageDialog},
|
|
58
76
|
{name: './page-panel', value: pagePanelPlugin},
|
|
59
77
|
{name: 'grapesjs-blocks-basic', value: blocksBasicPlugin},
|
|
60
78
|
{name: './blocks', value: blocksPlugin},
|
|
79
|
+
{name: './view-buttons', value: ViewButtons},
|
|
61
80
|
{name: './semantic', value: semanticPlugin},
|
|
62
81
|
{name: './rich-text', value: richTextPlugin},
|
|
63
82
|
{name: 'grapesjs-style-filter', value: styleFilterPlugin},
|
|
64
83
|
{name: 'grapesjs-plugin-forms', value: formPlugin},
|
|
65
84
|
{name: 'grapesjs-custom-code', value: codePlugin},
|
|
66
85
|
{name: './internal-links', value: internalLinksPlugin},
|
|
86
|
+
{name: './keymaps', value: keymapsPlugin},
|
|
67
87
|
{name: '@silexlabs/grapesjs-ui-suggest-classes', value: uiSuggestClasses},
|
|
88
|
+
{name: '@silexlabs/grapesjs-filter-styles', value: filterStyles},
|
|
68
89
|
{name: './symbolDialogs', value: symbolDialogsPlugin},
|
|
69
90
|
{name: '@silexlabs/grapesjs-symbols', value: symbolsPlugin},
|
|
70
91
|
{name: './PublicationManager', value: publicationManagerPlugin},
|
|
71
92
|
{name: './storage', value: storagePlugin},
|
|
72
93
|
{name: './LoginDialog', value: loginDialogPlugin},
|
|
73
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}
|
|
74
105
|
]
|
|
75
106
|
// Check that all plugins are loaded correctly
|
|
76
107
|
plugins
|
|
@@ -79,13 +110,28 @@ plugins
|
|
|
79
110
|
throw new Error(`Plugin ${p.name} could not be loaded correctly (${p.value})`)
|
|
80
111
|
})
|
|
81
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
|
+
|
|
82
127
|
// ////////////////////
|
|
83
128
|
// Config
|
|
84
129
|
// ////////////////////
|
|
85
130
|
const catBasic = 'Containers'
|
|
86
131
|
const catComponents = 'Components'
|
|
87
132
|
|
|
88
|
-
export function getEditorConfig(
|
|
133
|
+
export function getEditorConfig(config: ClientConfig): EditorConfig {
|
|
134
|
+
const { websiteId, storageId, rootUrl } = config
|
|
89
135
|
return {
|
|
90
136
|
container: '#gjs',
|
|
91
137
|
height: '100%',
|
|
@@ -103,90 +149,148 @@ export function getEditorConfig(id: WebsiteId, connectorId: ConnectorId, rootUrl
|
|
|
103
149
|
},
|
|
104
150
|
|
|
105
151
|
assetManager: {
|
|
106
|
-
upload: `${rootUrl}${API_PATH}${API_WEBSITE_PATH}${API_WEBSITE_ASSETS_WRITE}/?websiteId=${
|
|
152
|
+
upload: `${rootUrl}${API_PATH}${API_WEBSITE_PATH}${API_WEBSITE_ASSETS_WRITE}/?websiteId=${websiteId}${ storageId ? `&connectorId=${storageId}` : ''}`,
|
|
107
153
|
},
|
|
108
154
|
|
|
109
155
|
storageManager: {
|
|
110
156
|
autoload: false,
|
|
111
|
-
//type: 'remote',
|
|
112
157
|
type: 'connector',
|
|
113
158
|
options: {
|
|
114
159
|
connector: {
|
|
115
|
-
id,
|
|
116
|
-
connectorId,
|
|
160
|
+
id: websiteId,
|
|
161
|
+
connectorId: storageId,
|
|
117
162
|
},
|
|
118
|
-
//remote: {
|
|
119
|
-
// urlStore: `${rootUrl}/${API_WEBSITE_WRITE}?id=${id}`,
|
|
120
|
-
// urlLoad: `${rootUrl}/${API_WEBSITE_READ}?id=${id}`,
|
|
121
|
-
//},
|
|
122
163
|
},
|
|
123
164
|
},
|
|
124
165
|
|
|
125
|
-
cssIcons: '
|
|
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
|
+
|
|
126
190
|
|
|
127
191
|
plugins: plugins.map(p => p.value),
|
|
128
192
|
|
|
129
193
|
pluginsOpts: {
|
|
130
|
-
[blocksBasicPlugin
|
|
194
|
+
[blocksBasicPlugin.toString()]: {
|
|
131
195
|
blocks: ['text', 'image', 'video', 'map'],
|
|
132
196
|
category: catBasic,
|
|
133
197
|
//flexGrid: true,
|
|
134
198
|
},
|
|
135
|
-
[projectBarPlugin
|
|
199
|
+
[projectBarPlugin.toString()]: {
|
|
136
200
|
panels: [
|
|
137
201
|
{
|
|
138
202
|
id: 'dash',
|
|
139
203
|
className: 'logo',
|
|
140
|
-
attributes: { title: '
|
|
141
|
-
|
|
142
|
-
|
|
204
|
+
attributes: { title: 'Dashboard' },
|
|
205
|
+
command: () => {
|
|
206
|
+
window.location.href = '/'
|
|
207
|
+
},
|
|
143
208
|
}, {
|
|
144
209
|
id: 'block-manager-btn',
|
|
145
210
|
className: 'block-manager-btn fa fa-fw fa-plus',
|
|
146
|
-
|
|
147
|
-
|
|
211
|
+
name: 'Blocks',
|
|
212
|
+
attributes: { title: `Blocks (${titleCase(defaultKms.kmBlocks.keys, '+')})`, containerClassName: 'block-manager-container', },
|
|
213
|
+
command: cmdToggleBlocks,
|
|
148
214
|
}, {
|
|
149
215
|
id: 'symbols-btn',
|
|
150
216
|
className: 'symbols-btn fa-regular fa-gem',
|
|
151
|
-
|
|
152
|
-
|
|
217
|
+
name: 'Symbols',
|
|
218
|
+
attributes: { title: `Symbols (${titleCase(defaultKms.kmSymbols.keys, '+')})`, containerClassName: 'symbols-list-container', },
|
|
219
|
+
command: cmdToggleSymbols,
|
|
153
220
|
buttons: [
|
|
154
221
|
{
|
|
155
222
|
id: 'symbol-create-button',
|
|
156
|
-
className: '
|
|
157
|
-
label: 'Create symbol from selection',
|
|
223
|
+
className: 'gjs-pn-btn',
|
|
158
224
|
command: cmdPromptAddSymbol,
|
|
225
|
+
text: '\u271A',
|
|
159
226
|
},
|
|
160
227
|
],
|
|
161
228
|
}, {
|
|
162
229
|
id: 'page-panel-btn',
|
|
163
230
|
className: 'page-panel-btn fa fa-fw fa-file',
|
|
164
|
-
|
|
231
|
+
name: 'Pages',
|
|
232
|
+
attributes: { title: `Pages (${titleCase(defaultKms.kmPages.keys, '+')})`, containerClassName: 'page-panel-container', },
|
|
165
233
|
command: cmdTogglePages,
|
|
166
234
|
buttons: [{
|
|
167
|
-
className: '
|
|
235
|
+
className: 'gjs-pn-btn',
|
|
168
236
|
command: cmdAddPage,
|
|
169
|
-
text: '
|
|
237
|
+
text: '\u271A',
|
|
170
238
|
}],
|
|
171
239
|
}, {
|
|
172
240
|
id: 'layer-manager-btn',
|
|
173
241
|
className: 'layer-manager-btn fa-solid fa-layer-group',
|
|
174
|
-
|
|
175
|
-
|
|
242
|
+
name: 'Layers',
|
|
243
|
+
attributes: { title: `Layers (${titleCase(defaultKms.kmLayers.keys, '+')})`, containerClassName: 'layer-manager-container', },
|
|
244
|
+
command: cmdToggleLayers,
|
|
176
245
|
}, {
|
|
177
246
|
id: 'font-dialog-btn',
|
|
178
247
|
className: 'font-manager-btn fa-solid fa-font',
|
|
179
|
-
|
|
180
|
-
|
|
248
|
+
name: 'Fonts',
|
|
249
|
+
attributes: { title: `Fonts (${titleCase(defaultKms.kmOpenFonts.keys, '+')})` },
|
|
250
|
+
command: () => {
|
|
251
|
+
editor.runCommand('open-fonts')
|
|
252
|
+
},
|
|
181
253
|
}, {
|
|
182
254
|
id: 'settings-dialog-btn',
|
|
183
255
|
className: 'page-panel-btn fa-solid fa-gears',
|
|
184
|
-
|
|
256
|
+
name: 'Settings',
|
|
257
|
+
attributes: { title: `Settings (${titleCase(defaultKms.kmOpenSettings.keys, '+')})` },
|
|
185
258
|
command: cmdOpenSettings,
|
|
186
259
|
}, {
|
|
187
260
|
id: 'spacer',
|
|
188
261
|
attributes: {},
|
|
189
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
|
+
},
|
|
190
294
|
}, {
|
|
191
295
|
id: 'logout-button',
|
|
192
296
|
className: 'page-panel-btn fa fa-fw fa-sign-out',
|
|
@@ -195,38 +299,72 @@ export function getEditorConfig(id: WebsiteId, connectorId: ConnectorId, rootUrl
|
|
|
195
299
|
},
|
|
196
300
|
],
|
|
197
301
|
},
|
|
198
|
-
[publicationManagerPlugin
|
|
302
|
+
[publicationManagerPlugin.toString()]: {
|
|
199
303
|
appendTo: 'options',
|
|
200
|
-
websiteId
|
|
304
|
+
websiteId,
|
|
201
305
|
} as PublicationManagerOptions,
|
|
202
|
-
[pagePanelPlugin
|
|
306
|
+
[pagePanelPlugin.toString()]: {
|
|
203
307
|
cmdOpenNewPageDialog,
|
|
204
308
|
cmdOpenSettings,
|
|
205
309
|
appendTo: '.page-panel-container',
|
|
206
310
|
},
|
|
207
|
-
[uiSuggestClasses
|
|
311
|
+
[uiSuggestClasses.toString()]: {
|
|
208
312
|
enableCount: false,
|
|
209
313
|
enablePerformance: false,
|
|
210
314
|
},
|
|
211
|
-
[
|
|
315
|
+
[filterStyles.toString()]: {
|
|
316
|
+
appendBefore: '.gjs-sm-sectors',
|
|
317
|
+
},
|
|
318
|
+
[internalLinksPlugin.toString()]: {
|
|
212
319
|
// FIXME: warn the user about links in error
|
|
213
|
-
onError: (errors) => console.
|
|
320
|
+
onError: (errors) => console.warn('Links errors:', errors),
|
|
321
|
+
},
|
|
322
|
+
[keymapsPlugin.toString()]: {
|
|
323
|
+
disableKeymaps: false,
|
|
214
324
|
},
|
|
215
|
-
[codePlugin
|
|
325
|
+
[codePlugin.toString()]: {
|
|
216
326
|
blockLabel: 'HTML',
|
|
217
327
|
blockCustomCode: {
|
|
218
328
|
category: catComponents,
|
|
219
|
-
}
|
|
329
|
+
},
|
|
330
|
+
codeViewOptions: {
|
|
331
|
+
autoFormat: false,
|
|
332
|
+
},
|
|
220
333
|
},
|
|
221
|
-
[symbolsPlugin
|
|
334
|
+
[symbolsPlugin.toString()]: {
|
|
222
335
|
appendTo: '.symbols-list-container',
|
|
336
|
+
emptyText: 'No symbol yet.',
|
|
337
|
+
primaryColor: PRIMARY_COLOR,
|
|
338
|
+
secondaryColor: SECONDARY_COLOR,
|
|
339
|
+
highlightColor: TERTIARY_COLOR,
|
|
223
340
|
},
|
|
224
|
-
[fontsDialogPlugin
|
|
225
|
-
api_key:
|
|
341
|
+
[fontsDialogPlugin.toString()]: {
|
|
342
|
+
api_key: config.fontsApiKey,
|
|
343
|
+
server_url: config.fontsServerUrl,
|
|
344
|
+
api_url: config.fontsApiUrl,
|
|
226
345
|
},
|
|
227
|
-
[loginDialogPlugin
|
|
228
|
-
id,
|
|
346
|
+
[loginDialogPlugin.toString()]: {
|
|
347
|
+
id: websiteId,
|
|
229
348
|
} as LoginDialogOptions,
|
|
349
|
+
[rateLimitPlugin.toString()]: {
|
|
350
|
+
time: 5000,
|
|
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
|
+
}
|
|
230
368
|
},
|
|
231
369
|
}
|
|
232
370
|
}
|
|
@@ -240,6 +378,7 @@ export async function initEditor(config: EditorConfig) {
|
|
|
240
378
|
if(editor) throw new Error('Grapesjs editor already created')
|
|
241
379
|
return new Promise<Editor>((resolve, reject) => {
|
|
242
380
|
try {
|
|
381
|
+
/* @ts-ignore */
|
|
243
382
|
editor = grapesjs.init(config)
|
|
244
383
|
} catch(e) {
|
|
245
384
|
console.error('Error initializing GrapesJs with plugins:', plugins, e)
|
|
@@ -262,17 +401,60 @@ export async function initEditor(config: EditorConfig) {
|
|
|
262
401
|
modalImportTitle: 'Import from website',
|
|
263
402
|
}))
|
|
264
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)
|
|
423
|
+
|
|
424
|
+
// Adjustments to do when the editor is ready
|
|
265
425
|
editor.on('load', () => {
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
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
|
|
270
434
|
editor.Panels.getPanel('options').buttons.remove('export-template')
|
|
435
|
+
editor.Panels.getPanel('options').buttons.remove('fullscreen')
|
|
271
436
|
|
|
437
|
+
// Render the block manager, otherwise it is empty
|
|
272
438
|
editor.BlockManager.render(null)
|
|
273
439
|
|
|
274
|
-
//
|
|
275
|
-
editor.StyleManager.addProperty('extra',{ extend: 'filter' })
|
|
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
|
+
)
|
|
276
458
|
|
|
277
459
|
// GrapesJs editor is ready
|
|
278
460
|
resolve(editor)
|
|
@@ -65,6 +65,7 @@ const page2 = {
|
|
|
65
65
|
},
|
|
66
66
|
}
|
|
67
67
|
beforeEach(() => {
|
|
68
|
+
/* @ts-ignore */
|
|
68
69
|
editor = grapesjs.init({
|
|
69
70
|
headless: true,
|
|
70
71
|
storageManager: { autoload: false },
|
|
@@ -81,7 +82,7 @@ test('init', () => {
|
|
|
81
82
|
test('rename page and rewrite links in current page', () => {
|
|
82
83
|
const page = editor.Pages.getSelected()
|
|
83
84
|
expect(page.id).toBe(pageMain.id)
|
|
84
|
-
expect(page.getName()).
|
|
85
|
+
expect(page.getName()).toBe('')
|
|
85
86
|
const newName = 'Home page'
|
|
86
87
|
const newPath = './home-page.html'
|
|
87
88
|
// Do not work: page.setName(newName)
|
|
@@ -18,8 +18,6 @@
|
|
|
18
18
|
import {html, render} from 'lit-html'
|
|
19
19
|
import {map} from 'lit-html/directives/map.js'
|
|
20
20
|
import grapesjs from 'grapesjs/dist/grapes.min.js'
|
|
21
|
-
|
|
22
|
-
import { Page } from '../../types'
|
|
23
21
|
import { getPageLink } from '../../page'
|
|
24
22
|
|
|
25
23
|
// constants
|
|
@@ -32,7 +30,7 @@ const options: grapesjs.SelectOption = [
|
|
|
32
30
|
]
|
|
33
31
|
|
|
34
32
|
// plugin code
|
|
35
|
-
export const internalLinksPlugin =
|
|
33
|
+
export const internalLinksPlugin = (editor, opts) => {
|
|
36
34
|
// update links when a page link changes
|
|
37
35
|
function onAll(cbk) {
|
|
38
36
|
editor.Pages.getAll()
|
|
@@ -58,12 +56,21 @@ export const internalLinksPlugin = grapesjs.plugins.add(pluginName, (editor, opt
|
|
|
58
56
|
// mark all links as issues
|
|
59
57
|
const issues = []
|
|
60
58
|
onAll(component => {
|
|
61
|
-
console.log(component.getAttributes().href, getPageLink(page.previous('name')), page.previous('name'))
|
|
62
59
|
if(component.getAttributes().href === getPageLink(page.previous('name'))) {
|
|
63
60
|
issues.push(component)
|
|
64
61
|
}
|
|
65
62
|
})
|
|
66
|
-
|
|
63
|
+
// Add a notification for the issues
|
|
64
|
+
if(issues.length) {
|
|
65
|
+
issues.forEach(component => {
|
|
66
|
+
editor.runCommand('notifications:add', {
|
|
67
|
+
type: 'error',
|
|
68
|
+
message: `Page ${page.previous('name')} was removed, please fix the following links:`,
|
|
69
|
+
componentId: component.getId(),
|
|
70
|
+
group: 'Broken internal links',
|
|
71
|
+
})
|
|
72
|
+
})
|
|
73
|
+
}
|
|
67
74
|
break
|
|
68
75
|
}
|
|
69
76
|
})
|
|
@@ -109,7 +116,7 @@ export const internalLinksPlugin = grapesjs.plugins.add(pluginName, (editor, opt
|
|
|
109
116
|
function getDefaultHref(type) {
|
|
110
117
|
switch(type) {
|
|
111
118
|
case 'email': return 'mailto:'
|
|
112
|
-
case 'page': return getPageLink()
|
|
119
|
+
case 'page': return getPageLink(null)
|
|
113
120
|
case 'url': return 'https://'
|
|
114
121
|
}
|
|
115
122
|
}
|
|
@@ -224,4 +231,4 @@ export const internalLinksPlugin = grapesjs.plugins.add(pluginName, (editor, opt
|
|
|
224
231
|
doRender(elInput, href)
|
|
225
232
|
},
|
|
226
233
|
})
|
|
227
|
-
}
|
|
234
|
+
}
|