@silexlabs/silex 3.0.0-alpha.165 → 3.0.0-alpha.166

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.0.0-alpha.165",
4
+ "version": "3.0.0-alpha.166",
5
5
  "version:backwardcompat": "3.0.0",
6
6
  "author": {
7
7
  "name": "Alex Hoyau",
@@ -19,6 +19,8 @@ import { ConnectorId, WebsiteId, WebsiteData, ConnectorUser, ConnectorType, ApiE
19
19
  import { websiteLoad, websiteSave } from '../api'
20
20
  import { cmdLogin, eventLoggedIn, eventLoggedOut, getCurrentUser, updateUser } from './LoginDialog'
21
21
  import { addTempDataToPages, addTempDataToAssetUrl, addTempDataToStyles, removeTempDataFromAssetUrl, removeTempDataFromPages, removeTempDataFromStyles } from '../assetUrl'
22
+ import { PublicationStatus } from './PublicationManager'
23
+ import { ClientEvent } from '../events'
22
24
 
23
25
  export const storagePlugin = (editor) => {
24
26
  editor.Storage.add('connector', {
@@ -57,6 +59,13 @@ export const storagePlugin = (editor) => {
57
59
  },
58
60
 
59
61
  async store(data: WebsiteData, options: { id: WebsiteId, connectorId: ConnectorId }) {
62
+ console.log('store', editor.PublicationManager.status, PublicationStatus.STATUS_PENDING)
63
+ if(editor.PublicationManager.status === PublicationStatus.STATUS_PENDING) {
64
+ console.warn('Publication is pending, saving later')
65
+ return new Promise((resolve) => {
66
+ editor.once(ClientEvent.PUBLISH_END, () => resolve(this.store(data, options)))
67
+ })
68
+ }
60
69
  try {
61
70
  if(await getCurrentUser(editor)) {
62
71
  const user = await getCurrentUser(editor)