Skip to content

Commit

Permalink
do not save on silex load
Browse files Browse the repository at this point in the history
  • Loading branch information
lexoyo committed Aug 9, 2024
1 parent 854e503 commit 6c60d8d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
},
"dependencies": {
"@humanwhocodes/retry": "^0.3.0",
"@silexlabs/grapesjs-data-source": "^0.0.115",
"@silexlabs/grapesjs-data-source": "^0.0.117",
"dedent": "^1.5.3",
"deepmerge": "^4.3.1"
},
Expand Down
1 change: 1 addition & 0 deletions src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ export default function (config: ClientConfig, options: Partial<EleventyPluginOp
// Merge the initial config with GrapesJs config
// Returns the new config
config.grapesJsConfig = grapesJsConfig

// Add styles on the editor to override the default colors
document.head.insertAdjacentHTML('beforeend', `<style>
:root {
Expand Down
7 changes: 5 additions & 2 deletions src/client/DataSource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ export default function(config: ClientConfig, opts: EleventyPluginOptions): void
throw new Error('No DataSourceManager found, did you forget to add the DataSource plugin?')
}
if(opts.enable11ty) {
const eleventyDs = dm.add(new EleventyDataSource(), {merge: false})
// Add the 11ty data source
// Use silent: true to avoid triggering a save
const eleventyDs = dm.add(new EleventyDataSource(), {merge: false, silent: true})
// FIXME: Workaround: the added instance is not a Backbone model
eleventyDs.isConnected = eleventyDs.get('isConnected')
eleventyDs.getQuery = eleventyDs.get('getQuery')
Expand All @@ -20,7 +22,8 @@ export default function(config: ClientConfig, opts: EleventyPluginOptions): void
eleventyDs.id = eleventyDs.get('id')
eleventyDs.cid = eleventyDs.get('cid')
eleventyDs.hidden = eleventyDs.get('hidden')
eleventyDs.set('url', '')
eleventyDs.attributes.url = ''
// No, this triggers a save: eleventyDs.set('url', '')
}
})
}
Expand Down

0 comments on commit 6c60d8d

Please sign in to comment.