@silexlabs/silex 3.3.1-2 → 3.3.1-3

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@silexlabs/silex",
3
3
  "description": "Free and easy website builder for everyone.",
4
- "version": "3.3.1-2",
4
+ "version": "3.3.1-3",
5
5
  "version:backwardcompat": "3.0.0",
6
6
  "author": {
7
7
  "name": "Alex Hoyau",
@@ -105,7 +105,7 @@
105
105
  "dependencies": {
106
106
  "@fontsource/ubuntu": "^5.0.13",
107
107
  "@fortawesome/fontawesome-free": "6.6.0",
108
- "@silexlabs/grapesjs-advanced-selector": "1.2.1-1",
108
+ "@silexlabs/grapesjs-advanced-selector": "1.2.1-2",
109
109
  "@silexlabs/grapesjs-filter-styles": "1.1.0",
110
110
  "@silexlabs/grapesjs-fonts": "1.1.0",
111
111
  "@silexlabs/grapesjs-keymaps-dialog": "1.1.0",
@@ -16,6 +16,7 @@
16
16
  */
17
17
 
18
18
  import { Editor } from 'grapesjs'
19
+ import { registerSector } from './sectors'
19
20
 
20
21
  /**
21
22
  * @fileoverview Adds various css properties
@@ -120,15 +121,36 @@ export default (editor: Editor, opts) => {
120
121
  units: [ 'px', '%', 'em', 'rem', 'vh', 'vw' ],
121
122
  info: '',
122
123
  })
123
- const contentProp = editor.StyleManager.addProperty('general', {
124
+ registerSector(editor, {
125
+ id: 'content',
124
126
  name: 'Content',
125
- property: 'content',
126
- type: 'text',
127
- defaults: '',
128
- info: 'Generates content for an element.',
129
- full: true,
130
- visible: false,
131
- }, { at: 0 })
127
+ props: [{
128
+ name: 'Content',
129
+ property: 'content',
130
+ type: 'text',
131
+ defaults: '',
132
+ info: 'Generates content for an element.',
133
+ full: true,
134
+ visible: false,
135
+ }],
136
+ shouldShow: async () => {
137
+ return new Promise<boolean>((resolve, reject) => {
138
+ requestAnimationFrame(() => {
139
+ try {
140
+ const state = editor.StyleManager
141
+ .getSelected()
142
+ .get('state')
143
+ if (['before', 'after'].includes(state)) {
144
+ return resolve(true)
145
+ }
146
+ return resolve(false)
147
+ } catch(e) {
148
+ reject(e)
149
+ }
150
+ })
151
+ })
152
+ },
153
+ }, 0)
132
154
  /***************/
133
155
  /* Dimension */
134
156
  /***************/
@@ -825,16 +847,6 @@ export default (editor: Editor, opts) => {
825
847
  info: 'Aligns elements to scroll snaps.',
826
848
  }, { at: 11 })
827
849
 
828
- function refreshContentProp() {
829
- const state = editor.SelectorManager.getState()
830
- if (['before', 'after'].includes(state)) {
831
- contentProp.set('visible', true)
832
- } else {
833
- contentProp.set('visible', false)
834
- }
835
- }
836
- editor.on('selector:state component:selected component:styleUpdate style:sector:update', (state, opts) => setTimeout(() => refreshContentProp()))
837
- editor.StyleManager.getSector('general').on('change', () => refreshContentProp())
838
850
  editor.SelectorManager.states.add({name: 'before', label: 'Before'})
839
851
  editor.SelectorManager.states.add({name: 'after', label: 'After'})
840
852
  editor.SelectorManager.states.add({name: 'active', label: 'Active'})
@@ -0,0 +1,63 @@
1
+ /**
2
+ * Dynamic plugin loader for external GrapesJS plugins
3
+ * These plugins are loaded at runtime to reduce initial bundle size
4
+ */
5
+
6
+ export interface PluginDefinition {
7
+ name: string
8
+ value: any
9
+ }
10
+
11
+ /**
12
+ * Load all external plugins dynamically
13
+ */
14
+ export async function loadDynamicPlugins(): Promise<PluginDefinition[]> {
15
+ const [
16
+ blocksBasicPlugin,
17
+ styleFilterPlugin,
18
+ formPlugin,
19
+ codePlugin,
20
+ filterStyles,
21
+ symbolsPlugin,
22
+ loadingPlugin,
23
+ fontsDialogPlugin,
24
+ selectorPlugin,
25
+ rateLimitPlugin,
26
+ borderPlugin,
27
+ backgroundPlugin,
28
+ notificationsPlugin,
29
+ keymapsDialogPlugin,
30
+ ] = await Promise.all([
31
+ import('grapesjs-blocks-basic').then(m => m.default),
32
+ import('grapesjs-style-filter').then(m => m.default),
33
+ import('grapesjs-plugin-forms').then(m => m.default),
34
+ import('grapesjs-custom-code').then(m => m.default),
35
+ import('@silexlabs/grapesjs-filter-styles').then(m => m.default),
36
+ import('@silexlabs/grapesjs-symbols').then(m => m.default),
37
+ import('@silexlabs/grapesjs-loading').then(m => m.default),
38
+ import('@silexlabs/grapesjs-fonts').then(m => m.default),
39
+ import('@silexlabs/grapesjs-advanced-selector').then(m => m.default),
40
+ import('@silexlabs/grapesjs-storage-rate-limit').then(m => m.default),
41
+ import('grapesjs-style-border').then(m => m.default),
42
+ import('grapesjs-style-bg').then(m => m.default),
43
+ import('@silexlabs/grapesjs-notifications').then(m => m.default),
44
+ import('@silexlabs/grapesjs-keymaps-dialog').then(m => m.default),
45
+ ])
46
+
47
+ return [
48
+ { name: 'grapesjs-blocks-basic', value: blocksBasicPlugin },
49
+ { name: 'grapesjs-style-filter', value: styleFilterPlugin },
50
+ { name: 'grapesjs-plugin-forms', value: formPlugin },
51
+ { name: 'grapesjs-custom-code', value: codePlugin },
52
+ { name: '@silexlabs/grapesjs-filter-styles', value: filterStyles },
53
+ { name: '@silexlabs/grapesjs-symbols', value: symbolsPlugin },
54
+ { name: '@silexlabs/grapesjs-loading', value: loadingPlugin },
55
+ { name: '@silexlabs/grapesjs-fonts', value: fontsDialogPlugin },
56
+ { name: '@silexlabs/grapesjs-advanced-selector', value: selectorPlugin },
57
+ { name: '@silexlabs/grapesjs-storage-rate-limit', value: rateLimitPlugin },
58
+ { name: 'grapesjs-style-border', value: borderPlugin },
59
+ { name: 'grapesjs-style-bg', value: backgroundPlugin },
60
+ { name: '@silexlabs/grapesjs-notifications', value: notificationsPlugin },
61
+ { name: '@silexlabs/grapesjs-keymaps-dialog', value: keymapsDialogPlugin },
62
+ ]
63
+ }
@@ -14,7 +14,7 @@
14
14
  * You should have received a copy of the GNU Affero General Public License
15
15
  * along with this program. If not, see <https://www.gnu.org/licenses/>.
16
16
  */
17
- import { Editor } from 'grapesjs'
17
+ import { Component, Editor } from 'grapesjs'
18
18
  import { SectorConfig, registerSector } from './sectors'
19
19
 
20
20
  /**
@@ -22,62 +22,63 @@ import { SectorConfig, registerSector } from './sectors'
22
22
  *
23
23
  */
24
24
 
25
- export default (editor: Editor) => {
26
- const sectorConfigs: SectorConfig[] = [{
27
- name: 'Flex Item',
28
- props: [
29
- {
30
- id: 'order',
31
- name: 'Order',
32
- property: 'order',
33
- type: 'integer',
34
- defaults: 0,
35
- },
36
- {
37
- id: 'flex-grow',
38
- name: 'Flex Grow',
39
- property: 'flex-grow',
40
- type: 'integer',
41
- defaults: 0,
42
- },
43
- {
44
- id: 'flex-shrink',
45
- name: 'Flex Shrink',
46
- property: 'flex-shrink',
47
- type: 'integer',
48
- defaults: 1,
49
- },
50
- {
51
- id: 'flex-basis',
52
- name: 'Flex Basis',
53
- property: 'flex-basis',
54
- type: 'text',
55
- defaults: 'auto',
56
- },
57
- {
58
- id: 'align-self',
59
- name: 'Align Self',
60
- property: 'align-self',
61
- type: 'select',
62
- options: [
63
- { id: '', label: '' },
64
- { id: 'auto', label: 'auto' },
65
- { id: 'flex-start', label: 'flex-start' },
66
- { id: 'flex-end', label: 'flex-end' },
67
- { id: 'center', label: 'center' },
68
- { id: 'baseline', label: 'baseline' },
69
- { id: 'stretch', label: 'stretch' },
70
- ],
71
- },
72
- ],
73
- shouldShow: comp => {
74
- const parent = comp.parent()
75
- const display = parent?.getStyle()['display'] as string || ''
76
- return display.includes('flex')
77
- }
78
- }]
25
+ const FLEX_PROPS = [
26
+ 'flex-direction',
27
+ 'flex-wrap',
28
+ 'justify-content',
29
+ 'align-items',
30
+ 'align-content',
31
+ 'row-gap',
32
+ 'column-gap',
33
+ ]
34
+
35
+ const FLEX_ITEM_PROPS = [
36
+ 'flex-grow',
37
+ 'flex-shrink',
38
+ 'flex-basis',
39
+ 'order',
40
+ 'align-self',
41
+ ]
79
42
 
43
+ export default (editor: Editor) => {
80
44
  editor.on('load', () => {
81
- sectorConfigs.forEach(sectorConfig => registerSector(editor, sectorConfig, 2))
45
+ const sector = editor.StyleManager.getSector('flex')
46
+ // Add missing sectors
47
+ // FIXME: this makes grapesjs bug, all other props disappear
48
+ // FLEX_PROPS
49
+ // .concat(FLEX_ITEM_PROPS)
50
+ // .forEach(id => {
51
+ // if (!sector.getProperty(id)) {
52
+ // editor.StyleManager.addProperty('flex', {
53
+ // id,
54
+ // })
55
+ // }
56
+ // })
57
+ // Update the visibility
58
+ // This is a workaround grapesjs behavior: https://github.com/GrapesJS/grapesjs/issues/3123
59
+ sector.on('change:visible', () => applyVisibility())
60
+ editor.on('component:selected', comp => applyVisibility(comp))
61
+ function applyVisibility(comp: Component = editor.getSelected()) {
62
+ requestAnimationFrame(() => {
63
+ const computedDisplay = comp?.view?.el && getComputedStyle(comp.view.el)['display'] as string || ''
64
+ const isFlex = computedDisplay === 'flex' || computedDisplay === 'inline-flex'
65
+ const parent = comp.parent()
66
+ const parentComputedDisplay = parent?.view?.el && getComputedStyle(parent.view.el)['display'] as string || ''
67
+ const parentIsFlex = parentComputedDisplay === 'flex' || parentComputedDisplay === 'inline-flex'
68
+ if (parentIsFlex || isFlex) {
69
+ sector.set('visible', true)
70
+ }
71
+ if (parentIsFlex && isFlex) {
72
+ sector.getProperties()
73
+ .forEach(p => p.set('visible', true))
74
+ } else if (isFlex) {
75
+ sector.getProperties()
76
+ .forEach(p => p.set('visible', FLEX_PROPS.includes(p.getId())))
77
+ } else if (parentIsFlex) {
78
+ sector.getProperties()
79
+ .forEach(p => p.set('visible', FLEX_ITEM_PROPS.includes(p.getId())))
80
+ }
81
+ })
82
+ }
82
83
  })
83
84
  }
@@ -143,6 +143,7 @@ export function getEditorConfig(config: ClientConfig): EditorConfig {
143
143
  showDevices: true,
144
144
 
145
145
  //pageManager: {},
146
+ telemetry: false,
146
147
 
147
148
  layerManager: {
148
149
  appendTo: '.layer-manager-container',
@@ -25,6 +25,7 @@ import { SectorConfig, registerSector } from './sectors'
25
25
  export default (editor: Editor) => {
26
26
  const sectorConfigs: SectorConfig[] = [
27
27
  {
28
+ id: 'list',
28
29
  name: 'List',
29
30
  props: [
30
31
  {
@@ -0,0 +1,243 @@
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 }
@@ -22,16 +22,17 @@ import { Component, Editor } from 'grapesjs'
22
22
  */
23
23
 
24
24
  export type SectorConfig = {
25
+ id: string
25
26
  name: string
26
27
  props: any[]
27
- shouldShow: (comp: Component) => boolean
28
+ shouldShow: (comp: Component) => boolean | Promise<boolean>
28
29
  }
29
30
 
30
31
  export function registerSector(editor: Editor, config: SectorConfig, at?: number) {
31
32
  const sm = editor.StyleManager
32
- let sector = sm.getSector(config.name)
33
+ let sector = sm.getSector(config.id)
33
34
  if (!sector) {
34
- sector = sm.addSector(config.name, { name: config.name, open: false, visible: false }, { at })
35
+ sector = sm.addSector(config.id, { name: config.name, open: false, visible: false }, { at })
35
36
  }
36
37
 
37
38
  // Add props if not already present
@@ -42,18 +43,15 @@ export function registerSector(editor: Editor, config: SectorConfig, at?: number
42
43
  }
43
44
  })
44
45
 
45
- // Keep sector in sync with internal visibility state
46
- sector.on('change:visible', () => {
47
- const shouldBeVisible = sector.get('visible')
48
- if (shouldBeVisible !== config.shouldShow(editor.getSelected() as Component)) {
49
- sector.set('visible', !shouldBeVisible)
50
- }
51
- })
52
-
53
- editor.on('component:selected', comp => {
54
- const shouldShow = config.shouldShow(comp)
46
+ async function applyVisibility(comp: Component = editor.getSelected()) {
47
+ const shouldShow = await config.shouldShow(comp)
55
48
  if (sector.get('visible') !== shouldShow) {
56
49
  sector.set('visible', shouldShow)
50
+ // sector.getProperties()
51
+ // .forEach(p => p.set('visible', shouldShow))
57
52
  }
58
- })
53
+ }
54
+
55
+ sector.on('change:visible', () => applyVisibility())
56
+ editor.on('component:selected', comp => applyVisibility(comp))
59
57
  }
@@ -0,0 +1,75 @@
1
+ /**
2
+ * Static plugin definitions for internal GrapesJS plugins
3
+ * These are bundled with the main application
4
+ */
5
+
6
+ import symbolDialogsPlugin, { cmdPromptAddSymbol } from './symbolDialogs'
7
+ import loginDialogPlugin, { LoginDialogOptions, cmdLogout } from './LoginDialog'
8
+ import footerPlugin from './footer'
9
+ import breadcrumbsPlugin from './breadcrumbs'
10
+ import imgPlugin from './img'
11
+ import liPlugin from './li'
12
+ import flexPlugin from './flex'
13
+ import cssPropsPlugin from './css-props'
14
+ import resizePanelPlugin from './resize-panel'
15
+ import { pagePanelPlugin, cmdTogglePages, cmdAddPage } from './page-panel'
16
+ import { newPageDialog, cmdOpenNewPageDialog } from './new-page-dialog'
17
+ import { PROJECT_BAR_PANEL_ID, projectBarPlugin } from './project-bar'
18
+ import { settingsDialog, cmdOpenSettings } from './settings'
19
+ import { blocksPlugin } from './blocks'
20
+ import ViewButtons from './view-buttons'
21
+ import { semanticPlugin } from './semantic'
22
+ import { richTextPlugin } from './rich-text'
23
+ import { internalLinksPlugin } from './internal-links'
24
+ import { keymapsPlugin } from './keymaps'
25
+ import publicationManagerPlugin from './PublicationManager'
26
+ import { storagePlugin } from './storage'
27
+ import uploadProgress from './upload-progress'
28
+
29
+ export interface PluginDefinition {
30
+ name: string
31
+ value: any
32
+ }
33
+
34
+ export const staticPlugins: PluginDefinition[] = [
35
+ { name: './symbolDialogs', value: symbolDialogsPlugin },
36
+ { name: './LoginDialog', value: loginDialogPlugin },
37
+ { name: './footer', value: footerPlugin },
38
+ { name: './breadcrumbs', value: breadcrumbsPlugin },
39
+ { name: './img', value: imgPlugin },
40
+ { name: './li', value: liPlugin },
41
+ { name: './flex', value: flexPlugin },
42
+ { name: './css-props', value: cssPropsPlugin },
43
+ { name: './resize-panel', value: resizePanelPlugin },
44
+ { name: './page-panel', value: pagePanelPlugin },
45
+ { name: './new-page-dialog', value: newPageDialog },
46
+ { name: './project-bar', value: projectBarPlugin },
47
+ { name: './settings', value: settingsDialog },
48
+ { name: './blocks', value: blocksPlugin },
49
+ { name: './view-buttons', value: ViewButtons },
50
+ { name: './semantic', value: semanticPlugin },
51
+ { name: './rich-text', value: richTextPlugin },
52
+ { name: './internal-links', value: internalLinksPlugin },
53
+ { name: './keymaps', value: keymapsPlugin },
54
+ { name: './PublicationManager', value: publicationManagerPlugin },
55
+ { name: './storage', value: storagePlugin },
56
+ { name: './upload-progress', value: uploadProgress },
57
+ ]
58
+
59
+ // Validate all static plugins are loaded correctly
60
+ staticPlugins
61
+ .filter(p => typeof p.value !== 'function')
62
+ .forEach(p => {
63
+ throw new Error(`Plugin ${p.name} could not be loaded correctly (${p.value})`)
64
+ })
65
+
66
+ // Export named functions for use in plugin options
67
+ export {
68
+ cmdPromptAddSymbol,
69
+ cmdLogout,
70
+ cmdTogglePages,
71
+ cmdAddPage,
72
+ cmdOpenNewPageDialog,
73
+ PROJECT_BAR_PANEL_ID,
74
+ cmdOpenSettings,
75
+ }