@silexlabs/silex 3.3.1-4 → 3.3.1-5
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/README.md +27 -2
- package/dist/client/index.html +2 -2
- package/dist/client/js/main.js +214 -214
- package/dist/client/js/main.js.LICENSE.txt +1 -12
- package/dist/plugins/server/plugins/server/FtpConnector.js +53 -8
- package/dist/plugins/server/plugins/server/FtpConnector.js.map +1 -1
- package/dist/plugins/server/plugins/server/GitlabConnector.js +21 -66
- package/dist/plugins/server/plugins/server/GitlabConnector.js.map +1 -1
- package/dist/plugins/server/server/connectors/FsStorage.js +50 -4
- package/dist/plugins/server/server/connectors/FsStorage.js.map +1 -1
- package/dist/plugins/server/server/utils/websiteDataSerialization.d.ts +20 -0
- package/dist/plugins/server/server/utils/websiteDataSerialization.js +127 -0
- package/dist/plugins/server/server/utils/websiteDataSerialization.js.map +1 -0
- package/dist/server/page.js +14 -0
- package/dist/server/server/connectors/FsStorage.js +40 -4
- package/dist/server/server/utils/websiteDataSerialization.js +85 -0
- package/package.json +10 -10
- package/src/ts/client/grapesjs/PublicationUi.ts +1 -1
- package/src/ts/client/grapesjs/index.ts +9 -11
- package/src/ts/client/grapesjs/storage.ts +6 -9
- package/src/ts/client/index.ts +0 -2
- package/src/ts/plugins/server/FtpConnector.test.ts +2 -1
- package/src/ts/plugins/server/FtpConnector.ts +61 -9
- package/src/ts/plugins/server/GitlabConnector.ts +22 -80
- package/src/ts/server/connectors/FsStorage.test.ts +6 -2
- package/src/ts/server/connectors/FsStorage.ts +60 -5
- package/src/ts/server/utils/websiteDataSerialization.test.ts +59 -0
- package/src/ts/server/utils/websiteDataSerialization.ts +143 -0
- package/src/ts/client/grapesjs/dynamic-plugins.ts +0 -63
- package/src/ts/client/grapesjs/plugin-options.ts +0 -243
|
@@ -1,243 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Plugin options configuration for all GrapesJS plugins
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import { EditorConfig } from 'grapesjs'
|
|
6
|
-
import { PluginDefinition } from './dynamic-plugins'
|
|
7
|
-
import { staticPlugins, cmdPromptAddSymbol, cmdTogglePages, cmdAddPage, cmdOpenSettings, PROJECT_BAR_PANEL_ID, cmdOpenNewPageDialog } from './static-plugins'
|
|
8
|
-
import { NotificationEditor } from '@silexlabs/grapesjs-notifications'
|
|
9
|
-
import { cmdKeymapsDialog } from '@silexlabs/grapesjs-keymaps-dialog'
|
|
10
|
-
// Commands will be imported from the main index file
|
|
11
|
-
export const cmdToggleLayers = 'open-layers'
|
|
12
|
-
export const cmdToggleBlocks = 'open-blocks'
|
|
13
|
-
export const cmdToggleSymbols = 'open-symbols'
|
|
14
|
-
export const cmdToggleNotifications = 'open-notifications'
|
|
15
|
-
import { ClientConfig } from '../config'
|
|
16
|
-
import { titleCase } from '../utils'
|
|
17
|
-
import { defaultKms } from './keymaps'
|
|
18
|
-
|
|
19
|
-
// Constants
|
|
20
|
-
const PRIMARY_COLOR = '#333333'
|
|
21
|
-
const SECONDARY_COLOR = '#ddd'
|
|
22
|
-
const TERTIARY_COLOR = '#8873FE'
|
|
23
|
-
const QUATERNARY_COLOR = '#A291FF'
|
|
24
|
-
const catBasic = 'Containers'
|
|
25
|
-
const catComponents = 'Components'
|
|
26
|
-
|
|
27
|
-
// Create notification container
|
|
28
|
-
const notificationContainer = document.createElement('div')
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* Get plugin options for static plugins
|
|
32
|
-
*/
|
|
33
|
-
export function getStaticPluginOptions(config: ClientConfig) {
|
|
34
|
-
const { websiteId, storageId } = config
|
|
35
|
-
|
|
36
|
-
const projectBarPluginValue = staticPlugins.find(p => p.name === './project-bar')?.value
|
|
37
|
-
const imgPluginValue = staticPlugins.find(p => p.name === './img')?.value
|
|
38
|
-
const pagePanelPluginValue = staticPlugins.find(p => p.name === './page-panel')?.value
|
|
39
|
-
const internalLinksPluginValue = staticPlugins.find(p => p.name === './internal-links')?.value
|
|
40
|
-
const keymapsPluginValue = staticPlugins.find(p => p.name === './keymaps')?.value
|
|
41
|
-
const loginDialogPluginValue = staticPlugins.find(p => p.name === './LoginDialog')?.value
|
|
42
|
-
|
|
43
|
-
return {
|
|
44
|
-
[projectBarPluginValue?.toString()]: {
|
|
45
|
-
panels: [
|
|
46
|
-
{
|
|
47
|
-
id: 'dash',
|
|
48
|
-
className: 'logo',
|
|
49
|
-
attributes: { title: 'Dashboard' },
|
|
50
|
-
command: () => {
|
|
51
|
-
window.location.href = '/'
|
|
52
|
-
},
|
|
53
|
-
}, {
|
|
54
|
-
id: 'block-manager-btn',
|
|
55
|
-
className: 'block-manager-btn fa fa-fw fa-plus',
|
|
56
|
-
name: 'Blocks',
|
|
57
|
-
attributes: { title: `Blocks (${titleCase(defaultKms.kmBlocks.keys, '+')})`, containerClassName: 'block-manager-container', },
|
|
58
|
-
command: cmdToggleBlocks,
|
|
59
|
-
}, {
|
|
60
|
-
id: 'symbols-btn',
|
|
61
|
-
className: 'symbols-btn fa-regular fa-gem',
|
|
62
|
-
name: 'Symbols',
|
|
63
|
-
attributes: { title: `Symbols (${titleCase(defaultKms.kmSymbols.keys, '+')})`, containerClassName: 'symbols-list-container', },
|
|
64
|
-
command: cmdToggleSymbols,
|
|
65
|
-
buttons: [
|
|
66
|
-
{
|
|
67
|
-
id: 'symbol-create-button',
|
|
68
|
-
className: 'gjs-pn-btn',
|
|
69
|
-
command: cmdPromptAddSymbol,
|
|
70
|
-
text: '\u271A',
|
|
71
|
-
},
|
|
72
|
-
],
|
|
73
|
-
}, {
|
|
74
|
-
id: 'page-panel-btn',
|
|
75
|
-
className: 'page-panel-btn fa fa-fw fa-file',
|
|
76
|
-
name: 'Pages',
|
|
77
|
-
attributes: { title: `Pages (${titleCase(defaultKms.kmPages.keys, '+')})`, containerClassName: 'page-panel-container', },
|
|
78
|
-
command: cmdTogglePages,
|
|
79
|
-
buttons: [{
|
|
80
|
-
className: 'gjs-pn-btn',
|
|
81
|
-
command: cmdAddPage,
|
|
82
|
-
text: '\u271A',
|
|
83
|
-
}],
|
|
84
|
-
}, {
|
|
85
|
-
id: 'layer-manager-btn',
|
|
86
|
-
className: 'layer-manager-btn fa-solid fa-layer-group',
|
|
87
|
-
name: 'Layers',
|
|
88
|
-
attributes: { title: `Layers (${titleCase(defaultKms.kmLayers.keys, '+')})`, containerClassName: 'layer-manager-container', },
|
|
89
|
-
command: cmdToggleLayers,
|
|
90
|
-
}, {
|
|
91
|
-
id: 'font-dialog-btn',
|
|
92
|
-
className: 'font-manager-btn fa-solid fa-font',
|
|
93
|
-
name: 'Fonts',
|
|
94
|
-
attributes: { title: `Fonts (${titleCase(defaultKms.kmOpenFonts.keys, '+')})` },
|
|
95
|
-
command: () => {
|
|
96
|
-
// @ts-ignore - editor will be available at runtime
|
|
97
|
-
editor.runCommand('open-fonts')
|
|
98
|
-
},
|
|
99
|
-
}, {
|
|
100
|
-
id: 'settings-dialog-btn',
|
|
101
|
-
className: 'page-panel-btn fa-solid fa-gears',
|
|
102
|
-
name: 'Settings',
|
|
103
|
-
attributes: { title: `Settings (${titleCase(defaultKms.kmOpenSettings.keys, '+')})` },
|
|
104
|
-
command: cmdOpenSettings,
|
|
105
|
-
}, {
|
|
106
|
-
id: 'spacer',
|
|
107
|
-
attributes: {},
|
|
108
|
-
className: 'project-bar-spacer',
|
|
109
|
-
}, {
|
|
110
|
-
id: 'keymaps-btn',
|
|
111
|
-
className: 'keymaps-btn fa-solid fa-keyboard',
|
|
112
|
-
name: 'Shortcuts',
|
|
113
|
-
attributes: { title: 'Keyboard Shortcuts (Shift+H)' },
|
|
114
|
-
command: cmdKeymapsDialog,
|
|
115
|
-
}, {
|
|
116
|
-
id: 'notifications-btn',
|
|
117
|
-
className: 'notifications-btn fa-regular fa-bell',
|
|
118
|
-
name: 'Notifications',
|
|
119
|
-
attributes: { title: `Notifications (${titleCase(defaultKms.kmNotifications.keys, '+')})`, containerClassName: 'notifications-container', },
|
|
120
|
-
command: cmdToggleNotifications,
|
|
121
|
-
}, {
|
|
122
|
-
id: 'logout-btn',
|
|
123
|
-
className: 'logout-btn fa fa-fw fa-power-off',
|
|
124
|
-
name: 'Logout',
|
|
125
|
-
attributes: { title: 'Logout' },
|
|
126
|
-
command: () => {
|
|
127
|
-
// @ts-ignore - editor will be available at runtime
|
|
128
|
-
editor.runCommand('logout')
|
|
129
|
-
},
|
|
130
|
-
}],
|
|
131
|
-
},
|
|
132
|
-
...(pagePanelPluginValue && {
|
|
133
|
-
[pagePanelPluginValue.toString()]: {
|
|
134
|
-
cmdOpenNewPageDialog,
|
|
135
|
-
cmdOpenSettings,
|
|
136
|
-
appendTo: '.page-panel-container',
|
|
137
|
-
}
|
|
138
|
-
}),
|
|
139
|
-
...(internalLinksPluginValue && {
|
|
140
|
-
[internalLinksPluginValue.toString()]: {
|
|
141
|
-
// FIXME: warn the user about links in error
|
|
142
|
-
onError: (errors: any) => console.warn('Links errors:', errors),
|
|
143
|
-
}
|
|
144
|
-
}),
|
|
145
|
-
...(keymapsPluginValue && {
|
|
146
|
-
[keymapsPluginValue.toString()]: {
|
|
147
|
-
disableKeymaps: false,
|
|
148
|
-
}
|
|
149
|
-
}),
|
|
150
|
-
...(loginDialogPluginValue && {
|
|
151
|
-
[loginDialogPluginValue.toString()]: {
|
|
152
|
-
id: websiteId,
|
|
153
|
-
}
|
|
154
|
-
}),
|
|
155
|
-
...(imgPluginValue && {
|
|
156
|
-
[imgPluginValue.toString()]: {
|
|
157
|
-
replacedElements: config.replacedElements,
|
|
158
|
-
websiteId,
|
|
159
|
-
storageId,
|
|
160
|
-
}
|
|
161
|
-
}),
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
/**
|
|
166
|
-
* Get plugin options for dynamic plugins
|
|
167
|
-
*/
|
|
168
|
-
export function getDynamicPluginOptions(dynamicPlugins: PluginDefinition[], config: ClientConfig) {
|
|
169
|
-
const options: any = {}
|
|
170
|
-
|
|
171
|
-
dynamicPlugins.forEach(plugin => {
|
|
172
|
-
const pluginKey = plugin.value.toString()
|
|
173
|
-
|
|
174
|
-
switch (plugin.name) {
|
|
175
|
-
case 'grapesjs-blocks-basic':
|
|
176
|
-
options[pluginKey] = {
|
|
177
|
-
blocks: ['text', 'image', 'video', 'map'],
|
|
178
|
-
category: catBasic,
|
|
179
|
-
}
|
|
180
|
-
break
|
|
181
|
-
|
|
182
|
-
case '@silexlabs/grapesjs-fonts':
|
|
183
|
-
options[pluginKey] = {
|
|
184
|
-
api_key: (config as any).fontsApiKey || 'dummy-key-for-development',
|
|
185
|
-
server_url: (config as any).fontsServerUrl,
|
|
186
|
-
api_url: (config as any).fontsApiUrl,
|
|
187
|
-
}
|
|
188
|
-
break
|
|
189
|
-
|
|
190
|
-
case '@silexlabs/grapesjs-filter-styles':
|
|
191
|
-
options[pluginKey] = {
|
|
192
|
-
appendBefore: '.gjs-sm-sectors',
|
|
193
|
-
}
|
|
194
|
-
break
|
|
195
|
-
|
|
196
|
-
case 'grapesjs-custom-code':
|
|
197
|
-
options[pluginKey] = {
|
|
198
|
-
blockLabel: 'HTML',
|
|
199
|
-
blockCustomCode: {
|
|
200
|
-
category: catComponents,
|
|
201
|
-
},
|
|
202
|
-
codeViewOptions: {
|
|
203
|
-
autoFormat: false,
|
|
204
|
-
},
|
|
205
|
-
}
|
|
206
|
-
break
|
|
207
|
-
|
|
208
|
-
case '@silexlabs/grapesjs-symbols':
|
|
209
|
-
options[pluginKey] = {
|
|
210
|
-
appendTo: '.symbols-list-container',
|
|
211
|
-
emptyText: 'No symbol yet.',
|
|
212
|
-
primaryColor: PRIMARY_COLOR,
|
|
213
|
-
secondaryColor: SECONDARY_COLOR,
|
|
214
|
-
highlightColor: TERTIARY_COLOR,
|
|
215
|
-
}
|
|
216
|
-
break
|
|
217
|
-
|
|
218
|
-
case '@silexlabs/grapesjs-storage-rate-limit':
|
|
219
|
-
options[pluginKey] = {
|
|
220
|
-
time: 5000,
|
|
221
|
-
}
|
|
222
|
-
break
|
|
223
|
-
|
|
224
|
-
case '@silexlabs/grapesjs-notifications':
|
|
225
|
-
options[pluginKey] = {
|
|
226
|
-
container: notificationContainer,
|
|
227
|
-
reverse: true,
|
|
228
|
-
}
|
|
229
|
-
break
|
|
230
|
-
|
|
231
|
-
case '@silexlabs/grapesjs-keymaps-dialog':
|
|
232
|
-
options[pluginKey] = {
|
|
233
|
-
longPressDuration: null,
|
|
234
|
-
shortcut: 'shift+h',
|
|
235
|
-
}
|
|
236
|
-
break
|
|
237
|
-
}
|
|
238
|
-
})
|
|
239
|
-
|
|
240
|
-
return options
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
export { notificationContainer }
|