Skip to content

Commit

Permalink
Apply Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
wolfkidsounds committed Nov 29, 2024
1 parent 35c54af commit a069c18
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 16 deletions.
30 changes: 17 additions & 13 deletions assets/ts/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,24 @@ export const init = (
return
}

const editorSettings = { ...defaultSettings, ...settings };
const lang_fr = require("./lang/fr.json");
defaultI18n.setLocaleData(lang_fr);
const doInit = (): void => {
fetch('/bundles/easy-gutenberg/fetch-blocks', {headers: {accept: 'application/json'}}).then((response: Response) => response.json()).then((data): void => {
for (const [key, options] of Object.entries(data)) {
registerServerBlockType(key, options)
}

fetch('/bundles/easy-gutenberg/fetch-blocks', {
headers: {
'Accept': 'application/json'
}
}).then((response) => response.json())
.then((data) => {
for (const [key, options] of Object.entries(data)) {
registerServerBlockType(key, options);
initializeEditor(element, {...defaultSettings, ...settings})
});
};

fetch('/bundles/easygutenberg/translations/' + document.documentElement.lang + '.json', {redirect: 'manual'}).then((response: Response): void => {
if (response.ok) {
response.json().then(translation => {
defaultI18n.setLocaleData(translation.locale_data.messages)
doInit()
});
} else {
doInit()
}
initializeEditor(element, editorSettings)
})

}
4 changes: 2 additions & 2 deletions src/Resources/public/js/easy-gutenberg.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/Resources/public/js/easy-gutenberg.js.map

Large diffs are not rendered by default.

0 comments on commit a069c18

Please sign in to comment.