@silexlabs/silex 3.0.0-alpha.149 → 3.0.0-alpha.151

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.
@@ -28,3 +28,4 @@ export declare const API_WEBSITE_ASSET_READ = "/assets";
28
28
  export declare const API_WEBSITE_ASSETS_WRITE = "/assets";
29
29
  export declare const API_WEBSITE_META_READ = "/meta";
30
30
  export declare const API_WEBSITE_META_WRITE = "/meta";
31
+ export declare let SILEX_VERSION: any;
@@ -16,7 +16,7 @@
16
16
  * along with this program. If not, see <https://www.gnu.org/licenses/>.
17
17
  */
18
18
  Object.defineProperty(exports, "__esModule", { value: true });
19
- exports.API_WEBSITE_META_WRITE = exports.API_WEBSITE_META_READ = exports.API_WEBSITE_ASSETS_WRITE = exports.API_WEBSITE_ASSET_READ = exports.API_WEBSITE_LIST = exports.API_WEBSITE_DUPLICATE = exports.API_WEBSITE_DELETE = exports.API_WEBSITE_CREATE = exports.API_WEBSITE_WRITE = exports.API_WEBSITE_READ = exports.API_WEBSITE_PATH = exports.API_PUBLICATION_STATUS = exports.API_PUBLICATION_PUBLISH = exports.API_PUBLICATION_PATH = exports.API_CONNECTOR_LOGIN_CALLBACK = exports.API_CONNECTOR_SETTINGS = exports.API_CONNECTOR_LOGIN = exports.API_CONNECTOR_LOGOUT = exports.API_CONNECTOR_LIST = exports.API_CONNECTOR_USER = exports.API_CONNECTOR_PATH = exports.API_PATH = exports.CLIENT_CONFIG_FILE_NAME = exports.DEFAULT_LANGUAGE = exports.DEFAULT_WEBSITE_ID = exports.WEBSITE_META_DATA_FILE = exports.WEBSITE_DATA_FILE = void 0;
19
+ exports.SILEX_VERSION = exports.API_WEBSITE_META_WRITE = exports.API_WEBSITE_META_READ = exports.API_WEBSITE_ASSETS_WRITE = exports.API_WEBSITE_ASSET_READ = exports.API_WEBSITE_LIST = exports.API_WEBSITE_DUPLICATE = exports.API_WEBSITE_DELETE = exports.API_WEBSITE_CREATE = exports.API_WEBSITE_WRITE = exports.API_WEBSITE_READ = exports.API_WEBSITE_PATH = exports.API_PUBLICATION_STATUS = exports.API_PUBLICATION_PUBLISH = exports.API_PUBLICATION_PATH = exports.API_CONNECTOR_LOGIN_CALLBACK = exports.API_CONNECTOR_SETTINGS = exports.API_CONNECTOR_LOGIN = exports.API_CONNECTOR_LOGOUT = exports.API_CONNECTOR_LIST = exports.API_CONNECTOR_USER = exports.API_CONNECTOR_PATH = exports.API_PATH = exports.CLIENT_CONFIG_FILE_NAME = exports.DEFAULT_LANGUAGE = exports.DEFAULT_WEBSITE_ID = exports.WEBSITE_META_DATA_FILE = exports.WEBSITE_DATA_FILE = void 0;
20
20
  /**
21
21
  * @fileoverview define constants for Silex client and server
22
22
  */
@@ -47,4 +47,11 @@ exports.API_WEBSITE_ASSET_READ = '/assets';
47
47
  exports.API_WEBSITE_ASSETS_WRITE = '/assets';
48
48
  exports.API_WEBSITE_META_READ = '/meta';
49
49
  exports.API_WEBSITE_META_WRITE = '/meta';
50
+ try {
51
+ exports.SILEX_VERSION = SILEX_VERSION_ENV;
52
+ }
53
+ catch (e) {
54
+ // fallback to default value
55
+ exports.SILEX_VERSION = exports.SILEX_VERSION || '3.0.0';
56
+ }
50
57
  //# sourceMappingURL=constants.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/ts/constants.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;;AAEH;;GAEG;AAEU,QAAA,iBAAiB,GAAG,cAAc,CAAA;AAClC,QAAA,sBAAsB,GAAG,WAAW,CAAA;AAEpC,QAAA,kBAAkB,GAAG,SAAS,CAAA;AAC9B,QAAA,gBAAgB,GAAG,IAAI,CAAA;AACvB,QAAA,uBAAuB,GAAG,UAAU,CAAA;AAEpC,QAAA,QAAQ,GAAG,MAAM,CAAA;AAEjB,QAAA,kBAAkB,GAAG,YAAY,CAAA;AACjC,QAAA,kBAAkB,GAAG,OAAO,CAAA;AAC5B,QAAA,kBAAkB,GAAG,GAAG,CAAA;AACxB,QAAA,oBAAoB,GAAG,SAAS,CAAA;AAChC,QAAA,mBAAmB,GAAG,QAAQ,CAAA;AAC9B,QAAA,sBAAsB,GAAG,WAAW,CAAA;AACpC,QAAA,4BAA4B,GAAG,iBAAiB,CAAA;AAEhD,QAAA,oBAAoB,GAAG,cAAc,CAAA;AACrC,QAAA,uBAAuB,GAAG,GAAG,CAAA;AAC7B,QAAA,sBAAsB,GAAG,qBAAqB,CAAA;AAE9C,QAAA,gBAAgB,GAAG,UAAU,CAAA;AAC7B,QAAA,gBAAgB,GAAG,GAAG,CAAA;AACtB,QAAA,iBAAiB,GAAG,GAAG,CAAA;AACvB,QAAA,kBAAkB,GAAG,GAAG,CAAA;AACxB,QAAA,kBAAkB,GAAG,GAAG,CAAA;AACxB,QAAA,qBAAqB,GAAG,YAAY,CAAA;AACpC,QAAA,gBAAgB,GAAG,GAAG,CAAA;AACtB,QAAA,sBAAsB,GAAG,SAAS,CAAA;AAClC,QAAA,wBAAwB,GAAG,SAAS,CAAA;AACpC,QAAA,qBAAqB,GAAG,OAAO,CAAA;AAC/B,QAAA,sBAAsB,GAAG,OAAO,CAAA"}
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/ts/constants.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;;AAEH;;GAEG;AAEU,QAAA,iBAAiB,GAAG,cAAc,CAAA;AAClC,QAAA,sBAAsB,GAAG,WAAW,CAAA;AAEpC,QAAA,kBAAkB,GAAG,SAAS,CAAA;AAC9B,QAAA,gBAAgB,GAAG,IAAI,CAAA;AACvB,QAAA,uBAAuB,GAAG,UAAU,CAAA;AAEpC,QAAA,QAAQ,GAAG,MAAM,CAAA;AAEjB,QAAA,kBAAkB,GAAG,YAAY,CAAA;AACjC,QAAA,kBAAkB,GAAG,OAAO,CAAA;AAC5B,QAAA,kBAAkB,GAAG,GAAG,CAAA;AACxB,QAAA,oBAAoB,GAAG,SAAS,CAAA;AAChC,QAAA,mBAAmB,GAAG,QAAQ,CAAA;AAC9B,QAAA,sBAAsB,GAAG,WAAW,CAAA;AACpC,QAAA,4BAA4B,GAAG,iBAAiB,CAAA;AAEhD,QAAA,oBAAoB,GAAG,cAAc,CAAA;AACrC,QAAA,uBAAuB,GAAG,GAAG,CAAA;AAC7B,QAAA,sBAAsB,GAAG,qBAAqB,CAAA;AAE9C,QAAA,gBAAgB,GAAG,UAAU,CAAA;AAC7B,QAAA,gBAAgB,GAAG,GAAG,CAAA;AACtB,QAAA,iBAAiB,GAAG,GAAG,CAAA;AACvB,QAAA,kBAAkB,GAAG,GAAG,CAAA;AACxB,QAAA,kBAAkB,GAAG,GAAG,CAAA;AACxB,QAAA,qBAAqB,GAAG,YAAY,CAAA;AACpC,QAAA,gBAAgB,GAAG,GAAG,CAAA;AACtB,QAAA,sBAAsB,GAAG,SAAS,CAAA;AAClC,QAAA,wBAAwB,GAAG,SAAS,CAAA;AACpC,QAAA,qBAAqB,GAAG,OAAO,CAAA;AAC/B,QAAA,sBAAsB,GAAG,OAAO,CAAA;AAO7C,IAAI;IAAE,qBAAa,GAAG,iBAAiB,CAAA;CAAE;AAAC,OAAO,CAAC,EAAE;IAClD,4BAA4B;IAC5B,qBAAa,GAAG,qBAAa,IAAI,OAAO,CAAA;CACzC"}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.API_WEBSITE_META_WRITE = exports.API_WEBSITE_META_READ = exports.API_WEBSITE_ASSETS_WRITE = exports.API_WEBSITE_ASSET_READ = exports.API_WEBSITE_LIST = exports.API_WEBSITE_DUPLICATE = exports.API_WEBSITE_DELETE = exports.API_WEBSITE_CREATE = exports.API_WEBSITE_WRITE = exports.API_WEBSITE_READ = exports.API_WEBSITE_PATH = exports.API_PUBLICATION_STATUS = exports.API_PUBLICATION_PUBLISH = exports.API_PUBLICATION_PATH = exports.API_CONNECTOR_LOGIN_CALLBACK = exports.API_CONNECTOR_SETTINGS = exports.API_CONNECTOR_LOGIN = exports.API_CONNECTOR_LOGOUT = exports.API_CONNECTOR_LIST = exports.API_CONNECTOR_USER = exports.API_CONNECTOR_PATH = exports.API_PATH = exports.CLIENT_CONFIG_FILE_NAME = exports.DEFAULT_LANGUAGE = exports.DEFAULT_WEBSITE_ID = exports.WEBSITE_META_DATA_FILE = exports.WEBSITE_DATA_FILE = void 0;
3
+ exports.SILEX_VERSION = exports.API_WEBSITE_META_WRITE = exports.API_WEBSITE_META_READ = exports.API_WEBSITE_ASSETS_WRITE = exports.API_WEBSITE_ASSET_READ = exports.API_WEBSITE_LIST = exports.API_WEBSITE_DUPLICATE = exports.API_WEBSITE_DELETE = exports.API_WEBSITE_CREATE = exports.API_WEBSITE_WRITE = exports.API_WEBSITE_READ = exports.API_WEBSITE_PATH = exports.API_PUBLICATION_STATUS = exports.API_PUBLICATION_PUBLISH = exports.API_PUBLICATION_PATH = exports.API_CONNECTOR_LOGIN_CALLBACK = exports.API_CONNECTOR_SETTINGS = exports.API_CONNECTOR_LOGIN = exports.API_CONNECTOR_LOGOUT = exports.API_CONNECTOR_LIST = exports.API_CONNECTOR_USER = exports.API_CONNECTOR_PATH = exports.API_PATH = exports.CLIENT_CONFIG_FILE_NAME = exports.DEFAULT_LANGUAGE = exports.DEFAULT_WEBSITE_ID = exports.WEBSITE_META_DATA_FILE = exports.WEBSITE_DATA_FILE = void 0;
4
4
  exports.WEBSITE_DATA_FILE = 'website.json';
5
5
  exports.WEBSITE_META_DATA_FILE = 'meta.json';
6
6
  exports.DEFAULT_WEBSITE_ID = 'default';
@@ -28,3 +28,9 @@ exports.API_WEBSITE_ASSET_READ = '/assets';
28
28
  exports.API_WEBSITE_ASSETS_WRITE = '/assets';
29
29
  exports.API_WEBSITE_META_READ = '/meta';
30
30
  exports.API_WEBSITE_META_WRITE = '/meta';
31
+ try {
32
+ exports.SILEX_VERSION = SILEX_VERSION_ENV;
33
+ }
34
+ catch (e) {
35
+ exports.SILEX_VERSION = exports.SILEX_VERSION || '3.0.0';
36
+ }
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.0.0-alpha.149",
4
+ "version": "3.0.0-alpha.151",
5
5
  "version:backwardcompat": "3.0.0",
6
6
  "author": {
7
7
  "name": "Alex Hoyau",
@@ -104,7 +104,7 @@
104
104
  "@fontsource/ubuntu": "^5.0.12",
105
105
  "@fortawesome/fontawesome-free": "6.5.1",
106
106
  "@silexlabs/grapesjs-filter-styles": "^1.0.0",
107
- "@silexlabs/grapesjs-fonts": "^1.0.16",
107
+ "@silexlabs/grapesjs-fonts": "^1.0.18",
108
108
  "@silexlabs/grapesjs-loading": "1.0.9",
109
109
  "@silexlabs/grapesjs-storage-rate-limit": "^1.0.8",
110
110
  "@silexlabs/grapesjs-symbols": "1.0.39",
@@ -127,7 +127,7 @@
127
127
  "express-force-ssl": "0.3.2",
128
128
  "formidable": "3.5.1",
129
129
  "fs-extra": "^11.2.0",
130
- "grapesjs": "0.21.7",
130
+ "grapesjs": "^0.21.10",
131
131
  "grapesjs-blocks-basic": "1.0.2",
132
132
  "grapesjs-custom-code": "1.0.2",
133
133
  "grapesjs-plugin-forms": "2.0.6",
@@ -103,6 +103,20 @@ export class ClientConfig extends Config {
103
103
  */
104
104
  clientConfigUrl = `${this.rootUrl}/${CLIENT_CONFIG_FILE_NAME}`
105
105
 
106
+ /**
107
+ * Google fonts API key, see this doc to get an API key: https://developers.google.com/fonts/docs/developer_api#APIKey
108
+ * @default Test key for local dev
109
+ */
110
+ fontsApiKey = 'AIzaSyAdJTYSLPlKz4w5Iqyy-JAF2o8uQKd1FKc'
111
+
112
+ /**
113
+ * Google fonts server or a free privacy-friendly drop-in replacement for Google Fonts or a proxy server to speed up the load and protect privacy
114
+ * @see https://github.com/coollabsio/fonts
115
+ * @see https://fontlay.com/
116
+ * @default Google Fonts
117
+ */
118
+ fontsServerUrl = 'https://www.googleapis.com'
119
+
106
120
  /**
107
121
  * Init GrapesJS config which depend on the config file properties
108
122
  */
@@ -28,7 +28,7 @@ export default (editor: Editor, opts) => {
28
28
  property: 'min-width',
29
29
  type: 'integer',
30
30
  units: ['px', '%', 'em'],
31
- default: 'auto',
31
+ default: '',
32
32
  fixedValues: ['inherit', 'initial', 'unset', 'none', 'max-content', 'min-content', 'fit-content'],
33
33
  }, { at: 2 })
34
34
  editor.StyleManager.addProperty('dimension', {
@@ -36,7 +36,7 @@ export default (editor: Editor, opts) => {
36
36
  property: 'max-height',
37
37
  type: 'integer',
38
38
  units: ['px', '%', 'em'],
39
- default: 'auto',
39
+ default: '',
40
40
  fixedValues: ['inherit', 'initial', 'unset', 'none', 'max-content', 'min-content', 'fit-content'],
41
41
  }, { at: 5 })
42
42
  editor.StyleManager.addProperty('dimension', {
@@ -81,15 +81,17 @@ export default (editor: Editor, opts) => {
81
81
  max: 10000,
82
82
  units: [],
83
83
  info: 'Stacking order of the element',
84
- default: 'auto',
84
+ default: '',
85
85
  fixedValues: ['auto', 'unset', 'initial', 'inherit', 'revert'],
86
86
  }, { at: 1 })
87
87
  editor.StyleManager.addProperty('extra', {
88
88
  name: 'Pointer events',
89
89
  property: 'pointer-events',
90
90
  type: 'select',
91
- defaults: 'auto',
91
+ defaults: '',
92
92
  options: [
93
+ /* @ts-ignore */
94
+ { value: '', name: '' },
93
95
  /* @ts-ignore */
94
96
  { value: 'auto', name: 'auto' },
95
97
  /* @ts-ignore */
@@ -117,8 +119,10 @@ export default (editor: Editor, opts) => {
117
119
  name: 'Cursor',
118
120
  property: 'cursor',
119
121
  type: 'select',
120
- defaults: 'auto',
122
+ defaults: '',
121
123
  options: [
124
+ /* @ts-ignore */
125
+ { value: '', name: '' },
122
126
  /* @ts-ignore */
123
127
  { value: 'auto', name: 'auto' },
124
128
  /* @ts-ignore */
@@ -200,7 +204,7 @@ export default (editor: Editor, opts) => {
200
204
  type: 'integer',
201
205
  units: [],
202
206
  info: 'The column-count CSS property breaks an element\'s content into the specified number of columns.',
203
- default: 'auto',
207
+ default: '',
204
208
  fixedValues: ['auto', 'inherit', 'initial', 'revert', 'unset'],
205
209
  min: 1,
206
210
  }, { at: 4 })
@@ -210,7 +214,7 @@ export default (editor: Editor, opts) => {
210
214
  type: 'integer',
211
215
  units: ['px', '%', 'em'],
212
216
  info: 'The column-width CSS property suggests an optimal column width. This is not a absolute value but a mere hint. Browser will adjust the width of the element automatically.',
213
- default: 'auto',
217
+ default: '',
214
218
  fixedValues: ['auto', 'inherit', 'initial', 'revert', 'unset'],
215
219
  }, { at: 5 })
216
220
  editor.StyleManager.addProperty('extra', {
@@ -219,7 +223,7 @@ export default (editor: Editor, opts) => {
219
223
  type: 'integer',
220
224
  units: ['px', '%', 'em'],
221
225
  info: 'The column-gap CSS property sets the size of the gap (gutter) between an element\'s columns.',
222
- default: 'normal',
226
+ default: '',
223
227
  fixedValues: ['normal', 'inherit', 'initial', 'revert', 'unset'],
224
228
  }, { at: 5 })
225
229
  editor.StyleManager.addProperty('extra', {
@@ -232,14 +236,16 @@ export default (editor: Editor, opts) => {
232
236
  type: 'integer',
233
237
  units: ['px', '%', 'em'],
234
238
  info: 'The column-rule-width CSS property sets the width of the line drawn between columns in a multi-column layout.',
235
- default: 'medium',
239
+ default: '',
236
240
  fixedValues: ['medium', 'thin', 'thick', 'inherit', 'initial', 'revert', 'unset'],
237
241
  }, {
238
242
  name: 'Column rule style',
239
243
  property: 'column-rule-style',
240
244
  type: 'select',
241
- defaults: 'none',
245
+ defaults: '',
242
246
  options: [
247
+ /* @ts-ignore */
248
+ { value: '', name: '' },
243
249
  /* @ts-ignore */
244
250
  { value: 'none', name: 'none' },
245
251
  /* @ts-ignore */
@@ -268,7 +274,7 @@ export default (editor: Editor, opts) => {
268
274
  name: 'Column rule color',
269
275
  property: 'column-rule-color',
270
276
  type: 'color',
271
- defaults: 'none',
277
+ defaults: '',
272
278
  info: 'The column-rule-color CSS property sets the color of the line drawn between columns in a multi-column layout.',
273
279
  }],
274
280
  }, { at: 6 })
@@ -276,8 +282,10 @@ export default (editor: Editor, opts) => {
276
282
  name: 'Column span',
277
283
  property: 'column-span',
278
284
  type: 'select',
279
- defaults: 'none',
285
+ defaults: '',
280
286
  options: [
287
+ /* @ts-ignore */
288
+ { value: '', name: '' },
281
289
  /* @ts-ignore */
282
290
  { value: 'none', name: 'none' },
283
291
  /* @ts-ignore */
@@ -296,14 +304,16 @@ export default (editor: Editor, opts) => {
296
304
  type: 'integer',
297
305
  units: ['px', '%', 'em'],
298
306
  info: 'The outline-width CSS property sets the thickness of an element\'s outline. An outline is a line that is drawn around an element, outside the border.',
299
- default: 'medium',
307
+ default: '',
300
308
  fixedValues: ['medium', 'thin', 'thick', 'inherit', 'initial', 'revert', 'unset'],
301
309
  }, {
302
310
  name: 'Outline style',
303
311
  property: 'outline-style',
304
312
  type: 'select',
305
- defaults: 'none',
313
+ defaults: '',
306
314
  options: [
315
+ /* @ts-ignore */
316
+ { value: '', name: '' },
307
317
  /* @ts-ignore */
308
318
  { value: 'none', name: 'none' },
309
319
  /* @ts-ignore */
@@ -330,7 +340,7 @@ export default (editor: Editor, opts) => {
330
340
  name: 'Outline color',
331
341
  property: 'outline-color',
332
342
  type: 'color',
333
- defaults: 'none',
343
+ defaults: '',
334
344
  info: 'The outline-color CSS property sets the color of an element\'s outline.',
335
345
  }],
336
346
  }, { at: 8 })
@@ -338,8 +348,10 @@ export default (editor: Editor, opts) => {
338
348
  name: 'Word break',
339
349
  property: 'word-break',
340
350
  type: 'select',
341
- defaults: 'normal',
351
+ defaults: '',
342
352
  options: [
353
+ /* @ts-ignore */
354
+ { value: '', name: '' },
343
355
  /* @ts-ignore */
344
356
  { value: 'normal', name: 'normal' },
345
357
  /* @ts-ignore */
@@ -355,7 +367,7 @@ export default (editor: Editor, opts) => {
355
367
  name: 'Word wrap',
356
368
  property: 'word-wrap',
357
369
  type: 'radio',
358
- defaults: 'normal',
370
+ defaults: '',
359
371
  options: [
360
372
  /* @ts-ignore */
361
373
  { value: 'normal', name: 'normal' },
@@ -368,8 +380,10 @@ export default (editor: Editor, opts) => {
368
380
  name: 'White space',
369
381
  property: 'white-space',
370
382
  type: 'select',
371
- defaults: 'normal',
383
+ defaults: '',
372
384
  options: [
385
+ /* @ts-ignore */
386
+ { value: '', name: '' },
373
387
  /* @ts-ignore */
374
388
  { value: 'normal', name: 'normal' },
375
389
  /* @ts-ignore */
@@ -393,9 +407,11 @@ export default (editor: Editor, opts) => {
393
407
  name: 'Text decoration line',
394
408
  property: 'text-decoration-line',
395
409
  type: 'select',
396
- defaults: 'none',
410
+ defaults: '',
397
411
  fixedValues: ['auto', 'inherit', 'initial', 'revert', 'unset'],
398
412
  options: [
413
+ /* @ts-ignore */
414
+ { value: '', name: '' },
399
415
  /* @ts-ignore */
400
416
  { value: 'none', name: 'none' },
401
417
  /* @ts-ignore */
@@ -412,8 +428,10 @@ export default (editor: Editor, opts) => {
412
428
  name: 'Text decoration style',
413
429
  property: 'text-decoration-style',
414
430
  type: 'select',
415
- defaults: 'solid',
431
+ defaults: '',
416
432
  options: [
433
+ /* @ts-ignore */
434
+ { value: '', name: '' },
417
435
  /* @ts-ignore */
418
436
  { value: 'solid', name: 'solid' },
419
437
  /* @ts-ignore */
@@ -430,7 +448,7 @@ export default (editor: Editor, opts) => {
430
448
  name: 'Text decoration color',
431
449
  property: 'text-decoration-color',
432
450
  type: 'color',
433
- defaults: 'initial',
451
+ defaults: '',
434
452
  fixedValues: ['inherit', 'initial', 'revert', 'unset'],
435
453
  info: 'The text-decoration-color CSS property sets the color of decorations added to text by text-decoration-line.',
436
454
  }, {
@@ -439,7 +457,7 @@ export default (editor: Editor, opts) => {
439
457
  type: 'integer',
440
458
  units: ['px', '%', 'em'],
441
459
  info: 'The text-decoration-thickness CSS property sets the stroke thickness of the decoration line that is used on text in an element, such as a line-through, underline, or overline.',
442
- default: 'auto',
460
+ default: '',
443
461
  fixedValues: ['auto', 'inherit', 'initial', 'revert', 'unset'],
444
462
  }],
445
463
  }, { at: 10 })
@@ -448,8 +466,10 @@ export default (editor: Editor, opts) => {
448
466
 
449
467
  property: 'text-transform',
450
468
  type: 'select',
451
- defaults: 'none',
469
+ defaults: '',
452
470
  options: [
471
+ /* @ts-ignore */
472
+ { value: '', name: '' },
453
473
  /* @ts-ignore */
454
474
  { value: 'none', name: 'none' },
455
475
  /* @ts-ignore */
@@ -465,8 +485,10 @@ export default (editor: Editor, opts) => {
465
485
  name: 'Text overflow',
466
486
  property: 'text-overflow',
467
487
  type: 'select',
468
- defaults: 'clip',
488
+ defaults: '',
469
489
  options: [
490
+ /* @ts-ignore */
491
+ { value: '', name: '' },
470
492
  /* @ts-ignore */
471
493
  { value: 'clip', name: 'clip' },
472
494
  /* @ts-ignore */
@@ -474,13 +496,37 @@ export default (editor: Editor, opts) => {
474
496
  ],
475
497
  info: 'The text-overflow CSS property sets how hidden overflow content is signaled to users. It can be clipped, display an ellipsis (\'…\', U+2026 HORIZONTAL ELLIPSIS) or a Web author-defined string. It covers the two long-hand properties text-overflow-clip and text-overflow-string.',
476
498
  }, { at: 12 })
477
-
499
+ /** remove default module et add custom one */
500
+ editor.StyleManager.removeProperty('general', 'display')
501
+ editor.StyleManager.addProperty('general', {
502
+ name: 'Display',
503
+ property: 'display',
504
+ type: 'select',
505
+ defaults: '',
506
+ options: [
507
+ /* @ts-ignore */
508
+ { value: '', name: '' },
509
+ /* @ts-ignore */
510
+ { value: 'block', name: 'block' },
511
+ /* @ts-ignore */
512
+ { value: 'inline', name: 'inline' },
513
+ /* @ts-ignore */
514
+ { value: 'inline-block', name: 'inline-block' },
515
+ /* @ts-ignore */
516
+ { value: 'flex', name: 'flex' },
517
+ /* @ts-ignore */
518
+ { value: 'none', name: 'none' },
519
+ ],
520
+ info: '',
521
+ }, { at: 0 })
478
522
  editor.StyleManager.addProperty('general', {
479
523
  name: 'Visibility',
480
524
  property: 'visibility',
481
525
  type: 'select',
482
- defaults: 'visible',
526
+ defaults: '',
483
527
  options: [
528
+ /* @ts-ignore */
529
+ { value: '', name: '' },
484
530
  /* @ts-ignore */
485
531
  { value: 'visible', name: 'visible' },
486
532
  /* @ts-ignore */
@@ -496,7 +542,7 @@ export default (editor: Editor, opts) => {
496
542
  name: 'Content',
497
543
  property: 'content',
498
544
  type: 'text',
499
- defaults: 'none',
545
+ defaults: '',
500
546
  info: 'The content CSS property replaces an element with a generated value. Objects inserted using the content property are anonymous replaced elements.',
501
547
  full: true,
502
548
  visible: false,
@@ -296,7 +296,8 @@ export function getEditorConfig(config: ClientConfig): EditorConfig {
296
296
  highlightColor: TERTIARY_COLOR,
297
297
  },
298
298
  [fontsDialogPlugin.toString()]: {
299
- api_key: 'AIzaSyAdJTYSLPlKz4w5Iqyy-JAF2o8uQKd1FKc',
299
+ api_key: config.fontsApiKey,
300
+ server_url: config.fontsServerUrl,
300
301
  },
301
302
  [loginDialogPlugin.toString()]: {
302
303
  id: websiteId,
@@ -24,6 +24,7 @@ import {defaultSections, idCodeWrapper, isSite} from './settings-sections'
24
24
 
25
25
  import { WebsiteSettings } from '../../types'
26
26
  import { ClientEvent } from '../events'
27
+ import { SILEX_VERSION } from '../../constants'
27
28
 
28
29
  const sectionsSite = [...defaultSections]
29
30
  const sectionsPage = [...defaultSections]
@@ -31,21 +32,11 @@ const sectionsPage = [...defaultSections]
31
32
  const el = document.createElement('div')
32
33
  let modal
33
34
 
34
- // Get version from webpack (see plugin in webpack.config.js)
35
- declare const VERSION: string
36
-
37
35
  export const cmdOpenSettings = 'open-settings'
38
36
 
39
- let version = 'v3'
40
37
  let headEditor = null
41
38
  export const settingsDialog = (editor, opts) => {
42
- // Display Silex version from package.json
43
- try {
44
- version = VERSION
45
- } catch (error) {
46
- // Cannot get version from webpack (see plugin in webpack.config.js)
47
- }
48
- console.info('Silex version:', version)
39
+ console.info('Silex version:', SILEX_VERSION)
49
40
  editor.Commands.add(cmdOpenSettings, {
50
41
  run: (_, sender, {page}) => {
51
42
  modal = editor.Modal.open({
@@ -87,9 +78,7 @@ export const settingsDialog = (editor, opts) => {
87
78
  const model = editor.getModel()
88
79
  model.set('settings', data.settings || {})
89
80
  model.set('name', data.name)
90
- })
91
- // On chrome this is needed to apply the head content to the DOM
92
- editor.on('storage:end:load', () => {
81
+ // On chrome this is needed to apply the head content to the DOM
93
82
  setTimeout(() => {
94
83
  updateDom(editor)
95
84
  })
@@ -190,7 +179,7 @@ function displaySettings(editor, config, model = editor.getModel()) {
190
179
  </main>
191
180
  </section>
192
181
  <footer>
193
- <p class="silex-version">Silex ${version}</p>
182
+ <p class="silex-version">Silex ${SILEX_VERSION}</p>
194
183
  <input class="silex-button" type="button" @click=${e => editor.stopCommand(cmdOpenSettings)} value="Cancel">
195
184
  <input class="silex-button" type="submit" value="Apply">
196
185
  </footer>
@@ -237,13 +226,15 @@ function getHeadContainer(doc, className) {
237
226
  }
238
227
  function updateDom(editor) {
239
228
  const doc = editor.Canvas.getDocument()
240
- if(doc) {
229
+ const settings = editor.getModel().get('settings')
230
+ const pageSettings = editor.Pages.getSelected().get('settings')
231
+ if(doc && settings) {
241
232
  // Site head
242
233
  getHeadContainer(doc, 'site-head')
243
- .innerHTML = editor.getModel().get('settings').head || ''
234
+ .innerHTML = settings.head || ''
244
235
  // Pages head
245
236
  getHeadContainer(doc, 'page-head')
246
- .innerHTML = editor.Pages.getSelected().get('settings')?.head || ''
237
+ .innerHTML = pageSettings?.head || ''
247
238
  } else {
248
239
  // No document??
249
240
  }
@@ -10,7 +10,7 @@ import {
10
10
  transformBgImage
11
11
  } from './publication-transformers'
12
12
  import { ClientConfig } from './config'
13
- import grapesjs, { Component, Editor, ObjectStrings, Page } from 'grapesjs'
13
+ import grapesjs, { Component, Editor, StyleProps, Page } from 'grapesjs'
14
14
  import { ClientSideFile, ClientSideFileType, PublicationData } from '../types'
15
15
 
16
16
  describe('publication-transformers', () => {
@@ -87,12 +87,12 @@ describe('publication-transformers', () => {
87
87
  it('should transform styles', () => {
88
88
  const transformCssRule = transformer.renderCssRule as Mock
89
89
  transformCssRule.mockImplementation((rule: any) => {
90
- return { color: 'test'+rule.color } as ObjectStrings
90
+ return { color: 'test'+rule.color } as StyleProps
91
91
  })
92
92
  renderCssRules(editor)
93
93
  const css = editor.getCss()
94
94
  expect(transformCssRule).toBeCalledTimes(2)
95
- const results = transformCssRule.mock.results.map(r => r.value as ObjectStrings)
95
+ const results = transformCssRule.mock.results.map(r => r.value as StyleProps)
96
96
  const parent = results.find(c => c.color === 'testred')
97
97
  expect(parent).not.toBeUndefined()
98
98
  const child = results.find(c => c.color === 'testblue')
@@ -103,7 +103,7 @@ describe('publication-transformers', () => {
103
103
 
104
104
  it('should reset transformed styles', () => {
105
105
  const renderCssRule = transformer.renderCssRule as Mock
106
- const returned = {color: 'test'} as ObjectStrings
106
+ const returned = {color: 'test'} as StyleProps
107
107
  renderCssRule.mockReturnValue(returned)
108
108
  renderCssRules(editor)
109
109
  resetRenderCssRules(editor)
@@ -15,8 +15,8 @@
15
15
  * along with this program. If not, see <https://www.gnu.org/licenses/>.
16
16
  */
17
17
 
18
- import { Component, CssRule, Editor, ObjectStrings, Page } from 'grapesjs'
19
- import { ClientSideFile, ClientSideFileType, ClientSideFileWithPermalink, Initiator, PublicationData } from '../types'
18
+ import { Component, CssRule, StyleProps, Editor } from 'grapesjs'
19
+ import { ClientSideFile, ClientSideFileType, Initiator, PublicationData } from '../types'
20
20
  import { onAll } from './utils'
21
21
 
22
22
  /**
@@ -43,7 +43,7 @@ export interface PublicationTransformer {
43
43
  // Temporarily override how components render at publication by grapesjs
44
44
  renderComponent?(component: Component, toHtml: () => string): string | undefined
45
45
  // Temporarily override how styles render at publication by grapesjs
46
- renderCssRule?(rule: CssRule, initialRule: () => ObjectStrings): ObjectStrings | undefined
46
+ renderCssRule?(rule: CssRule, initialRule: () => StyleProps): StyleProps | undefined
47
47
  // Transform files after they are rendered and before they are published
48
48
  transformFile?(file: ClientSideFile): ClientSideFile
49
49
  // Define files URLs
@@ -58,7 +58,7 @@ export const publicationTransformerDefault: PublicationTransformer = {
58
58
  return toHtml()
59
59
  },
60
60
  // Override how styles render at publication by grapesjs
61
- renderCssRule(rule: CssRule, initialRule: () => ObjectStrings): ObjectStrings | undefined {
61
+ renderCssRule(rule: CssRule, initialRule: () => StyleProps): StyleProps | undefined {
62
62
  return initialRule()
63
63
  },
64
64
  // Define where files are published
@@ -181,20 +181,24 @@ export function renderCssRules(editor: Editor) {
181
181
  })
182
182
  }
183
183
 
184
+ function doTransformPermalink(editor: Editor, cssValue: string): string {
185
+ return cssValue.replace(/url\(([^)]+)\)/g, (match, url) => {
186
+ // Support URLs with or without quotes
187
+ const cleanUrl = url.replace(/['"]/g, '')
188
+ // Transform URLs
189
+ const newUrl = transformPermalink(editor, cleanUrl, ClientSideFileType.ASSET, Initiator.CSS)
190
+ // Return the new URL with url keyword
191
+ return `url(${newUrl})`
192
+ })
193
+ }
194
+
184
195
  /**
185
196
  * Transform background image url according to the transformed path of assets
186
197
  */
187
- export function transformBgImage(editor: Editor, style: ObjectStrings): ObjectStrings {
198
+ export function transformBgImage(editor: Editor, style: StyleProps): StyleProps {
188
199
  const cssValue = style['background-image']
189
200
  if (cssValue) {
190
- const newCssValue = cssValue.replace(/url\(([^)]+)\)/g, (match, url) => {
191
- // Support URLs with or without quotes
192
- const cleanUrl = url.replace(/['"]/g, '')
193
- // Transform URLs
194
- const newUrl = transformPermalink(editor, cleanUrl, ClientSideFileType.ASSET, Initiator.CSS)
195
- // Return the new URL with url keyword
196
- return `url(${newUrl})`
197
- })
201
+ const newCssValue = typeof cssValue === 'string' ? doTransformPermalink(editor, cssValue) : cssValue.map(value => doTransformPermalink(editor, value))
198
202
  return {
199
203
  ...style,
200
204
  'background-image': newCssValue,
@@ -51,3 +51,13 @@ export const API_WEBSITE_ASSET_READ = '/assets'
51
51
  export const API_WEBSITE_ASSETS_WRITE = '/assets'
52
52
  export const API_WEBSITE_META_READ = '/meta'
53
53
  export const API_WEBSITE_META_WRITE = '/meta'
54
+
55
+ // Env vars (build time)
56
+ // Get env vars from webpack
57
+ // @see webpack.config.js
58
+ declare const SILEX_VERSION_ENV: string
59
+ export let SILEX_VERSION
60
+ try { SILEX_VERSION = SILEX_VERSION_ENV } catch (e) {
61
+ // fallback to default value
62
+ SILEX_VERSION = SILEX_VERSION || '3.0.0'
63
+ }
@@ -1 +0,0 @@
1
- export default function (config: any, opts?: {}): Promise<void>;
@@ -1,40 +0,0 @@
1
- "use strict";
2
- /*
3
- * Silex website builder, free/libre no-code tool for makers.
4
- * Copyright (c) 2023 lexoyo and Silex Labs foundation
5
- *
6
- * This program is free software: you can redistribute it and/or modify
7
- * it under the terms of the GNU Affero General Public License as published by
8
- * the Free Software Foundation, either version 3 of the License, or any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU Affero General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU Affero General Public License
16
- * along with this program. If not, see <https://www.gnu.org/licenses/>.
17
- */
18
- Object.defineProperty(exports, "__esModule", { value: true });
19
- // import express from 'express'
20
- // import { Directus } from '@directus/sdk'
21
- async function default_1(config, opts = {}) {
22
- // config.on('silex:startup:start', ({app}) => {
23
- // const router = express.Router()
24
- // router.post(['/publish', '/website', '/assets'], async function(req, res, next) {
25
- // try {
26
- // const token = req.body.token || opts.directusToken
27
- // const directus = new Directus(opts.directusUrl)
28
- // directus.storage.auth_token = token
29
- // const me = await directus.users.me.read()
30
- // next()
31
- // } catch(err) {
32
- // console.error('Publish failed in auth module. Did you provide a directus token?', err.message)
33
- // res.status(403).json({ message: err.message })
34
- // }
35
- // })
36
- // app.use(router)
37
- // })
38
- }
39
- exports.default = default_1;
40
- //# sourceMappingURL=AuthPlugin.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"AuthPlugin.js","sourceRoot":"","sources":["../../../../../src/ts/plugins/server/AuthPlugin.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;AAEH,gCAAgC;AAChC,2CAA2C;AAE5B,KAAK,oBAAU,MAAM,EAAE,IAAI,GAAG,EAAE;IAC/C,iDAAiD;IACjD,qCAAqC;IACrC,uFAAuF;IACvF,aAAa;IACb,4DAA4D;IAC5D,yDAAyD;IACzD,6CAA6C;IAC7C,mDAAmD;IACnD,gBAAgB;IAChB,sBAAsB;IACtB,wGAAwG;IACxG,wDAAwD;IACxD,SAAS;IACT,QAAQ;IACR,qBAAqB;IACrB,MAAM;AACN,CAAC;AAjBD,4BAiBC"}