@silexlabs/silex 3.0.0-alpha.96 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.env.default +2 -1
- package/README.md +31 -9
- package/dist/client/client/api.d.ts +5 -0
- package/dist/client/client/assetUrl.d.ts +3 -0
- package/dist/client/client/config.d.ts +31 -0
- package/dist/client/client/events.d.ts +7 -1
- package/dist/client/client/grapesjs/PublicationManager.d.ts +2 -1
- package/dist/client/client/grapesjs/css-props.d.ts +6 -0
- package/dist/client/client/grapesjs/img.d.ts +6 -0
- package/dist/client/client/grapesjs/index.d.ts +2 -2
- package/dist/client/client/grapesjs/new-page-dialog.d.ts +1 -1
- package/dist/client/client/grapesjs/page-panel.d.ts +1 -1
- package/dist/client/client/grapesjs/project-bar.d.ts +16 -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 +15 -0
- package/dist/client/client/grapesjs/settings.d.ts +3 -1
- 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 +10 -0
- package/dist/client/client/publication-transformers.d.ts +4 -3
- 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 +4 -0
- package/dist/client/constants.d.ts +1 -0
- package/dist/client/css/admin.css +273 -32
- package/dist/client/index.html +2 -1
- package/dist/client/js/main.js +164 -123
- package/dist/client/js/main.js.LICENSE.txt +15 -1
- package/dist/client/types.d.ts +12 -7
- package/dist/plugins/client/client/events.d.ts +7 -1
- package/dist/plugins/client/client/events.js +7 -1
- package/dist/plugins/client/client/events.js.map +1 -1
- package/dist/plugins/client/plugins/client/template.js +108 -58
- package/dist/plugins/client/plugins/client/template.js.map +1 -1
- package/dist/plugins/client/types.d.ts +12 -7
- package/dist/plugins/client/types.js +6 -0
- package/dist/plugins/client/types.js.map +1 -1
- package/dist/plugins/server/constants.d.ts +1 -0
- package/dist/plugins/server/constants.js +2 -1
- package/dist/plugins/server/constants.js.map +1 -1
- package/dist/plugins/server/plugins/server/FtpConnector.d.ts +1 -0
- package/dist/plugins/server/plugins/server/FtpConnector.js +12 -1
- package/dist/plugins/server/plugins/server/FtpConnector.js.map +1 -1
- package/dist/plugins/server/plugins/server/GitlabConnector.d.ts +3 -0
- package/dist/plugins/server/plugins/server/GitlabConnector.js +72 -35
- package/dist/plugins/server/plugins/server/GitlabConnector.js.map +1 -1
- package/dist/plugins/server/server/config.js +3 -3
- package/dist/plugins/server/server/config.js.map +1 -1
- package/dist/plugins/server/server/connectors/FsHosting.d.ts +1 -0
- package/dist/plugins/server/server/connectors/FsHosting.js +13 -1
- package/dist/plugins/server/server/connectors/FsHosting.js.map +1 -1
- package/dist/plugins/server/server/connectors/FsStorage.d.ts +2 -1
- package/dist/plugins/server/server/connectors/FsStorage.js +29 -25
- package/dist/plugins/server/server/connectors/FsStorage.js.map +1 -1
- package/dist/plugins/server/server/connectors/connectors.d.ts +1 -0
- package/dist/plugins/server/server/jobs.js +4 -2
- package/dist/plugins/server/server/jobs.js.map +1 -1
- package/dist/plugins/server/types.d.ts +12 -7
- package/dist/plugins/server/types.js +7 -1
- package/dist/plugins/server/types.js.map +1 -1
- package/dist/server/constants.js +2 -1
- package/dist/server/server/api/publicationApi.js +3 -5
- package/dist/server/server/api/websiteApi.js +26 -7
- package/dist/server/server/cli.js +9 -6
- package/dist/server/server/config.js +3 -3
- package/dist/server/server/connectors/FsHosting.js +13 -1
- package/dist/server/server/connectors/FsStorage.js +28 -25
- package/dist/server/server/jobs.js +4 -2
- package/dist/server/types.js +7 -1
- package/package.json +35 -31
- package/public/assets/favicon.ico +0 -0
- package/public/assets/favicon.png +0 -0
- package/public/assets/logo-silex-small.png +0 -0
- package/src/css/_variables.scss +5 -3
- package/src/css/dialog.scss +22 -1
- package/src/css/fonts.scss +31 -0
- package/src/css/footer.scss +1 -1
- package/src/css/grapesjs-plugins.scss +34 -0
- package/src/css/grapesjs.scss +26 -11
- package/src/css/index.scss +1 -0
- package/src/css/project-bar.scss +11 -7
- package/src/css/silex.scss +58 -5
- package/src/html/index.pug +2 -2
- package/src/ts/client/api.ts +14 -9
- package/src/ts/client/assetUrl.test.ts +145 -42
- package/src/ts/client/assetUrl.ts +29 -10
- package/src/ts/client/config.ts +85 -4
- package/src/ts/client/events.ts +15 -9
- package/src/ts/client/grapesjs/PublicationManager.ts +71 -38
- package/src/ts/client/grapesjs/PublicationUi.ts +13 -11
- package/src/ts/client/grapesjs/css-props.ts +544 -0
- package/src/ts/client/grapesjs/eleventy.ts +2 -5
- package/src/ts/client/grapesjs/footer.ts +24 -9
- package/src/ts/client/grapesjs/img.ts +147 -0
- package/src/ts/client/grapesjs/index.ts +63 -25
- package/src/ts/client/grapesjs/internal-links.test.ts +2 -1
- package/src/ts/client/grapesjs/internal-links.ts +0 -1
- package/src/ts/client/grapesjs/new-page-dialog.ts +2 -3
- package/src/ts/client/grapesjs/page-panel.ts +28 -3
- package/src/ts/client/grapesjs/project-bar.ts +83 -64
- 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 +120 -77
- package/src/ts/client/grapesjs/symbolDialogs.ts +2 -3
- package/src/ts/client/grapesjs/view-buttons.ts +42 -0
- package/src/ts/client/index.ts +13 -6
- package/src/ts/client/publication-transformers.test.ts +13 -5
- package/src/ts/client/publication-transformers.ts +60 -47
- package/{dist/plugins/client/client/utils.js → src/ts/client/publish-custom-code-block.ts} +14 -8
- package/{dist/plugins/client/page.js → src/ts/client/publish-fonts.ts} +19 -14
- package/src/ts/client/utils.ts +18 -0
- package/src/ts/constants.ts +1 -0
- package/src/ts/plugins/client/template.ts +112 -60
- package/src/ts/plugins/server/FtpConnector.ts +14 -2
- package/src/ts/plugins/server/GitlabConnector.ts +71 -32
- package/src/ts/server/api/publicationApi.ts +5 -5
- package/src/ts/server/api/websiteApi.ts +51 -17
- package/src/ts/server/cli.ts +7 -5
- package/src/ts/server/config.ts +4 -4
- package/src/ts/server/connectors/FsHosting.ts +11 -5
- package/src/ts/server/connectors/FsStorage.ts +33 -4
- package/src/ts/server/connectors/connectors.ts +1 -1
- package/src/ts/server/jobs.ts +4 -2
- package/src/ts/types.ts +10 -7
- package/dist/plugins/client/client/api.d.ts +0 -85
- package/dist/plugins/client/client/api.js +0 -114
- package/dist/plugins/client/client/api.js.map +0 -1
- package/dist/plugins/client/client/assetUrl.d.ts +0 -51
- package/dist/plugins/client/client/assetUrl.js +0 -224
- package/dist/plugins/client/client/assetUrl.js.map +0 -1
- package/dist/plugins/client/client/config.d.ts +0 -58
- package/dist/plugins/client/client/config.js +0 -90
- package/dist/plugins/client/client/config.js.map +0 -1
- package/dist/plugins/client/client/grapesjs/LoginDialog.d.ts +0 -15
- package/dist/plugins/client/client/grapesjs/LoginDialog.js +0 -195
- package/dist/plugins/client/client/grapesjs/LoginDialog.js.map +0 -1
- package/dist/plugins/client/client/grapesjs/PublicationManager.d.ts +0 -72
- package/dist/plugins/client/client/grapesjs/PublicationManager.js +0 -356
- package/dist/plugins/client/client/grapesjs/PublicationManager.js.map +0 -1
- package/dist/plugins/client/client/grapesjs/PublicationUi.d.ts +0 -62
- package/dist/plugins/client/client/grapesjs/PublicationUi.js +0 -336
- package/dist/plugins/client/client/grapesjs/PublicationUi.js.map +0 -1
- package/dist/plugins/client/client/grapesjs/blocks.d.ts +0 -1
- package/dist/plugins/client/client/grapesjs/blocks.js +0 -37
- package/dist/plugins/client/client/grapesjs/blocks.js.map +0 -1
- package/dist/plugins/client/client/grapesjs/breadcrumbs.d.ts +0 -1
- package/dist/plugins/client/client/grapesjs/breadcrumbs.js +0 -75
- package/dist/plugins/client/client/grapesjs/breadcrumbs.js.map +0 -1
- package/dist/plugins/client/client/grapesjs/footer.d.ts +0 -2
- package/dist/plugins/client/client/grapesjs/footer.js +0 -28
- package/dist/plugins/client/client/grapesjs/footer.js.map +0 -1
- package/dist/plugins/client/client/grapesjs/index.d.ts +0 -5
- package/dist/plugins/client/client/grapesjs/index.js +0 -313
- package/dist/plugins/client/client/grapesjs/index.js.map +0 -1
- package/dist/plugins/client/client/grapesjs/internal-links.d.ts +0 -1
- package/dist/plugins/client/client/grapesjs/internal-links.js +0 -219
- package/dist/plugins/client/client/grapesjs/internal-links.js.map +0 -1
- package/dist/plugins/client/client/grapesjs/new-page-dialog.d.ts +0 -2
- package/dist/plugins/client/client/grapesjs/new-page-dialog.js +0 -83
- package/dist/plugins/client/client/grapesjs/new-page-dialog.js.map +0 -1
- package/dist/plugins/client/client/grapesjs/openImport.d.ts +0 -9
- package/dist/plugins/client/client/grapesjs/openImport.js +0 -74
- package/dist/plugins/client/client/grapesjs/openImport.js.map +0 -1
- package/dist/plugins/client/client/grapesjs/page-panel.d.ts +0 -3
- package/dist/plugins/client/client/grapesjs/page-panel.js +0 -113
- package/dist/plugins/client/client/grapesjs/page-panel.js.map +0 -1
- package/dist/plugins/client/client/grapesjs/project-bar.d.ts +0 -1
- package/dist/plugins/client/client/grapesjs/project-bar.js +0 -104
- package/dist/plugins/client/client/grapesjs/project-bar.js.map +0 -1
- package/dist/plugins/client/client/grapesjs/rich-text.d.ts +0 -1
- package/dist/plugins/client/client/grapesjs/rich-text.js +0 -31
- package/dist/plugins/client/client/grapesjs/rich-text.js.map +0 -1
- package/dist/plugins/client/client/grapesjs/semantic.d.ts +0 -1
- package/dist/plugins/client/client/grapesjs/semantic.js +0 -110
- package/dist/plugins/client/client/grapesjs/semantic.js.map +0 -1
- package/dist/plugins/client/client/grapesjs/settings.d.ts +0 -2
- package/dist/plugins/client/client/grapesjs/settings.js +0 -198
- package/dist/plugins/client/client/grapesjs/settings.js.map +0 -1
- package/dist/plugins/client/client/grapesjs/storage.d.ts +0 -1
- package/dist/plugins/client/client/grapesjs/storage.js +0 -126
- package/dist/plugins/client/client/grapesjs/storage.js.map +0 -1
- package/dist/plugins/client/client/grapesjs/symbolDialogs.d.ts +0 -3
- package/dist/plugins/client/client/grapesjs/symbolDialogs.js +0 -36
- package/dist/plugins/client/client/grapesjs/symbolDialogs.js.map +0 -1
- package/dist/plugins/client/client/publication-transformers.d.ts +0 -41
- package/dist/plugins/client/client/publication-transformers.js +0 -238
- package/dist/plugins/client/client/publication-transformers.js.map +0 -1
- package/dist/plugins/client/client/utils.d.ts +0 -2
- package/dist/plugins/client/client/utils.js.map +0 -1
- package/dist/plugins/client/constants.d.ts +0 -29
- package/dist/plugins/client/constants.js +0 -46
- package/dist/plugins/client/constants.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/11ty.d.ts +0 -17
- package/dist/plugins/client/plugins/client/11ty.js +0 -86
- package/dist/plugins/client/plugins/client/11ty.js.map +0 -1
- package/dist/plugins/client/plugins/client/publicationRenderer.d.ts +0 -2
- package/dist/plugins/client/plugins/client/publicationRenderer.js +0 -170
- package/dist/plugins/client/plugins/client/publicationRenderer.js.map +0 -1
- package/src/ts/plugins/client/11ty.ts +0 -104
- package/src/ts/plugins/client/publicationRenderer.ts +0 -174
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
import { ClientConfig } from '../../client/config'
|
|
2
|
-
import { ClientSideFile, ClientSideFileWithContent } from '../../types'
|
|
3
|
-
|
|
4
|
-
interface PluginOptions {
|
|
5
|
-
html: {
|
|
6
|
-
url: string,
|
|
7
|
-
path: string,
|
|
8
|
-
},
|
|
9
|
-
css: {
|
|
10
|
-
url: string,
|
|
11
|
-
path: string,
|
|
12
|
-
},
|
|
13
|
-
assets: {
|
|
14
|
-
url: string,
|
|
15
|
-
path: string,
|
|
16
|
-
},
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export default (config: ClientConfig, opts: Partial<PluginOptions>) => {
|
|
20
|
-
const options = {
|
|
21
|
-
...opts,
|
|
22
|
-
html: {
|
|
23
|
-
url: '/',
|
|
24
|
-
path: './',
|
|
25
|
-
...opts.html,
|
|
26
|
-
},
|
|
27
|
-
css: {
|
|
28
|
-
url: '/css', // For the HTML links
|
|
29
|
-
path: './css', // For the file system
|
|
30
|
-
permalink: '/css', // For the frontmatter
|
|
31
|
-
...opts.css,
|
|
32
|
-
},
|
|
33
|
-
assets: {
|
|
34
|
-
url: '/',
|
|
35
|
-
path: './', // assets is already in the assets urls
|
|
36
|
-
...opts.assets,
|
|
37
|
-
},
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
config.addPublicationTransformers({
|
|
41
|
-
transformPermalink: (path, type) => {
|
|
42
|
-
switch (type) {
|
|
43
|
-
case 'html':
|
|
44
|
-
console.log('Silex: transform path for 11ty', path, options.html.url + path)
|
|
45
|
-
return options.html.url + path
|
|
46
|
-
case 'css':
|
|
47
|
-
console.log('Silex: transform path for 11ty', path, options.css.url + path.replace(/\.css$/, '.css.liquid'))
|
|
48
|
-
return options.css.url + path
|
|
49
|
-
.replace(/^\/css/, '')
|
|
50
|
-
.replace(/\.css.liquid$/, '.css')
|
|
51
|
-
case 'asset':
|
|
52
|
-
console.log('Silex: transform path for 11ty', path, options.assets.url + path)
|
|
53
|
-
return options.assets.url + path
|
|
54
|
-
}
|
|
55
|
-
throw new Error(`Unknown file type ${type}`)
|
|
56
|
-
},
|
|
57
|
-
transformPath: (path, type) => {
|
|
58
|
-
switch (type) {
|
|
59
|
-
case 'html':
|
|
60
|
-
return options.html.path + path
|
|
61
|
-
case 'css':
|
|
62
|
-
const res = options.css.path + path
|
|
63
|
-
// Remove default path
|
|
64
|
-
.replace(/^\/css/, '')
|
|
65
|
-
// Change extension
|
|
66
|
-
.replace(/\.css$/, '.css.liquid')
|
|
67
|
-
return res
|
|
68
|
-
case 'asset':
|
|
69
|
-
return options.assets.path + path
|
|
70
|
-
// Remove default path
|
|
71
|
-
.replace(/^\/assets/, '')
|
|
72
|
-
}
|
|
73
|
-
throw new Error(`Unknown file type ${type}`)
|
|
74
|
-
},
|
|
75
|
-
transformFile: (file: ClientSideFile) => {
|
|
76
|
-
const fileWithContent = file as ClientSideFileWithContent
|
|
77
|
-
switch (file.type) {
|
|
78
|
-
case 'html':
|
|
79
|
-
return {
|
|
80
|
-
...file,
|
|
81
|
-
//path: options.html.path + fileWithContent.path,
|
|
82
|
-
//content: `---\npermalink: ${options.html.url}${fileWithContent.path}\n---\n${fileWithContent.content}`
|
|
83
|
-
}
|
|
84
|
-
case 'css':
|
|
85
|
-
const path = fileWithContent.path
|
|
86
|
-
// Remove extension added in transformPath (options.css.path)
|
|
87
|
-
.replace(new RegExp(`^${options.css.path}`), '')
|
|
88
|
-
// Remove path added in transformPath (options.css.path)
|
|
89
|
-
.replace(/\.css\.liquid$/, '.css')
|
|
90
|
-
return {
|
|
91
|
-
...file,
|
|
92
|
-
//path: options.css.path + fileWithContent.path.replace(/\.css$/, '.css.liquid'),
|
|
93
|
-
content: `---\npermalink: ${options.css.permalink}${path}\n---\n${fileWithContent.content}`
|
|
94
|
-
}
|
|
95
|
-
case 'asset':
|
|
96
|
-
return {
|
|
97
|
-
...file,
|
|
98
|
-
//path: options.assets.path + fileWithContent.path,
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
throw new Error(`Unknown file type ${file.type}`)
|
|
102
|
-
},
|
|
103
|
-
})
|
|
104
|
-
}
|
|
@@ -1,174 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Silex website builder, free/libre no-code tool for makers.
|
|
3
|
-
* Copyright (c) 2023 lexoyo and Silex Labs foundation
|
|
4
|
-
*
|
|
5
|
-
* This program is free software: you can redistribute it and/or modify
|
|
6
|
-
* it under the terms of the GNU Affero General Public License as published by
|
|
7
|
-
* the Free Software Foundation, either version 3 of the License, or any later version.
|
|
8
|
-
*
|
|
9
|
-
* This program is distributed in the hope that it will be useful,
|
|
10
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
11
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
12
|
-
* GNU Affero General Public License for more details.
|
|
13
|
-
*
|
|
14
|
-
* You should have received a copy of the GNU Affero General Public License
|
|
15
|
-
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
16
|
-
*/
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* @deprecated
|
|
20
|
-
* This plugin is deprecated. Use the publication renderer plugin instead.
|
|
21
|
-
*/
|
|
22
|
-
console.warn('This plugin is deprecated. Use the publication renderer plugin instead.')
|
|
23
|
-
throw 'This plugin is deprecated. Use the publication renderer plugin instead.'
|
|
24
|
-
|
|
25
|
-
/* Usage:
|
|
26
|
-
import publicationRenderer from 'https://unpkg.com/@silexlabs/silex@latest/dist/plugins/client/plugins/client/publicationRenderer'
|
|
27
|
-
await config.addPlugin(publicationRenderer, {
|
|
28
|
-
css: {
|
|
29
|
-
frontMatter: true,
|
|
30
|
-
ext: '.css.liquid',
|
|
31
|
-
path: '../../../pages'
|
|
32
|
-
},
|
|
33
|
-
html: {
|
|
34
|
-
frontMatter: false,
|
|
35
|
-
path: '../../../_includes'
|
|
36
|
-
},
|
|
37
|
-
assets: {
|
|
38
|
-
path: '../../../',
|
|
39
|
-
url: '/',
|
|
40
|
-
},
|
|
41
|
-
})
|
|
42
|
-
*/
|
|
43
|
-
|
|
44
|
-
import { getPageSlug } from '../../page.js'
|
|
45
|
-
import { ClientSideFile } from '../../types.js'
|
|
46
|
-
import { onAll } from '../../client/utils.js'
|
|
47
|
-
import { ClientEvent } from '../../client/events.js'
|
|
48
|
-
import { Page } from 'grapesjs'
|
|
49
|
-
|
|
50
|
-
export default (config, opts: any = {}) => {
|
|
51
|
-
const options = {
|
|
52
|
-
autoHomePage: false,
|
|
53
|
-
...opts,
|
|
54
|
-
html: {
|
|
55
|
-
frontMatter: false,
|
|
56
|
-
ext: '.html',
|
|
57
|
-
url: '/',
|
|
58
|
-
path: './',
|
|
59
|
-
...opts.html,
|
|
60
|
-
},
|
|
61
|
-
css: {
|
|
62
|
-
frontMatter: false,
|
|
63
|
-
ext: '.css',
|
|
64
|
-
url: '/css',
|
|
65
|
-
path: './css',
|
|
66
|
-
...opts.css,
|
|
67
|
-
},
|
|
68
|
-
assets: {
|
|
69
|
-
url: '/',
|
|
70
|
-
path: './',
|
|
71
|
-
...opts.assets,
|
|
72
|
-
},
|
|
73
|
-
}
|
|
74
|
-
config.on(ClientEvent.STARTUP_END, ({ editor }) => {
|
|
75
|
-
editor.on(ClientEvent.PUBLISH_START, () => {
|
|
76
|
-
// Update assets URL to display outside the editor
|
|
77
|
-
const assetsFolderUrl = options.assets.url
|
|
78
|
-
if (assetsFolderUrl) {
|
|
79
|
-
// Concat the paths, handles the trailing and leading slashes
|
|
80
|
-
const publishedUrl = path => `${assetsFolderUrl.replace(/\/+$/, '')}/${path.replace(/^\/+/, '')}`
|
|
81
|
-
// New URLs for assets, according to site config
|
|
82
|
-
onAll(editor, c => {
|
|
83
|
-
// Attributes
|
|
84
|
-
if (c.get('type') === 'image') {
|
|
85
|
-
const src = c.get('src')
|
|
86
|
-
c.set('tmp-src', src)
|
|
87
|
-
c.set('src', publishedUrl(src))
|
|
88
|
-
}
|
|
89
|
-
//// Inline styles
|
|
90
|
-
//// This is handled by the editor.Css.getAll loop
|
|
91
|
-
//const bgUrl = c.getStyle()['background-image']?.match(/url\('(.*)'\)/)?.pop()
|
|
92
|
-
//if(bgUrl) {
|
|
93
|
-
// c.set('tmp-bg-url', bgUrl)
|
|
94
|
-
// c.setStyle({
|
|
95
|
-
// ...c.getStyle(),
|
|
96
|
-
// 'background-image': `url('${publishedUrl(bgUrl)}')`,
|
|
97
|
-
// })
|
|
98
|
-
//}
|
|
99
|
-
})
|
|
100
|
-
editor.Css.getAll()
|
|
101
|
-
.forEach(c => {
|
|
102
|
-
const bgUrl = c.getStyle()['background-image']?.match(/url\('(.*)'\)/)?.pop()
|
|
103
|
-
if (bgUrl) {
|
|
104
|
-
c.setStyle({
|
|
105
|
-
...c.getStyle(),
|
|
106
|
-
'background-image': `url('${publishedUrl(bgUrl)}')`,
|
|
107
|
-
})
|
|
108
|
-
c.set('tmp-bg-url-css' as any, bgUrl)
|
|
109
|
-
}
|
|
110
|
-
})
|
|
111
|
-
}
|
|
112
|
-
editor.Pages.getAll().forEach(page => {
|
|
113
|
-
if (page.get('type') === 'main' && options?.autoHomePage) {
|
|
114
|
-
page.set('slug', 'index')
|
|
115
|
-
} else {
|
|
116
|
-
page.set('slug', getPageSlug(page.get('name') || page.get('type')))
|
|
117
|
-
}
|
|
118
|
-
})
|
|
119
|
-
})
|
|
120
|
-
editor.on(ClientEvent.PUBLISH_END, () => {
|
|
121
|
-
const assetsFolderUrl = options.assets.url
|
|
122
|
-
// Reset asset URLs
|
|
123
|
-
if (assetsFolderUrl) {
|
|
124
|
-
onAll(editor, c => {
|
|
125
|
-
if (c.get('type') === 'image' && c.has('tmp-src')) {
|
|
126
|
-
c.set('src', c.get('tmp-src'))
|
|
127
|
-
c.set('tmp-src')
|
|
128
|
-
}
|
|
129
|
-
//// This is handled by the editor.Css.getAll loop
|
|
130
|
-
//if(c.getStyle()['background-image'] && c.has('tmp-bg-url')) {
|
|
131
|
-
// c.setStyle({
|
|
132
|
-
// ...c.getStyle(),
|
|
133
|
-
// 'background-image': `url('${c.get('tmp-bg-url')}')`,
|
|
134
|
-
// })
|
|
135
|
-
// c.set('tmp-bg-url')
|
|
136
|
-
//}
|
|
137
|
-
})
|
|
138
|
-
editor.Css.getAll()
|
|
139
|
-
.forEach(c => {
|
|
140
|
-
if (c.has('tmp-bg-url-css' as any)) {
|
|
141
|
-
c.setStyle({
|
|
142
|
-
...c.getStyle(),
|
|
143
|
-
'background-image': `url('${c.get('tmp-bg-url-css' as any)}')`,
|
|
144
|
-
})
|
|
145
|
-
c.set('tmp-bg-url-css' as any)
|
|
146
|
-
}
|
|
147
|
-
})
|
|
148
|
-
}
|
|
149
|
-
})
|
|
150
|
-
//editor.on(ClientEvent.PUBLISH_DATA, data => {
|
|
151
|
-
// data.pages.forEach((page: Page, idx) => {
|
|
152
|
-
// const file = data.files[idx] as ClientSideFile
|
|
153
|
-
// console.log('Silex: publication renderer: page', page, file)
|
|
154
|
-
// // CSS
|
|
155
|
-
// if(file.type === 'css') {
|
|
156
|
-
// file.cssPath = file.cssPath.replace(/\.css$/, options.css.ext)
|
|
157
|
-
// file.cssPath = options.css.path + file.cssPath
|
|
158
|
-
// if (options.css.frontMatter) {
|
|
159
|
-
// file.css = `---\npermalink: ${options.css.url}/${page.slug}.css\n---\n${file.css}`
|
|
160
|
-
// }
|
|
161
|
-
// // HTML
|
|
162
|
-
// file.htmlPath = file.htmlPath.replace(/\.html$/, options.html.ext)
|
|
163
|
-
// file.htmlPath = options.html.path + file.htmlPath
|
|
164
|
-
// if (options.html.frontMatter) {
|
|
165
|
-
// file.html = `---\npermalink: ${options.html.url}/${page.slug}.html\n---\n${file.html}`
|
|
166
|
-
// }
|
|
167
|
-
// })
|
|
168
|
-
// data.assets.forEach((asset, idx) => {
|
|
169
|
-
// asset.path = options.assets.path + asset.src
|
|
170
|
-
// // The rest is handled by the editor.Css.getAll loop
|
|
171
|
-
// })
|
|
172
|
-
//})
|
|
173
|
-
})
|
|
174
|
-
}
|