Compare commits

..

No commits in common. "bc83e37cdd28ae3366fe4c32b97366ad55fb1fe9" and "d207efd6dc44e0af1cf98f5e88a5d8be8b3f08dc" have entirely different histories.

9 changed files with 54 additions and 4337 deletions

4
.gitmodules vendored
View File

@ -1,7 +1,3 @@
[submodule "demo"]
path = demo
url = https://github.com/GrapesJS/grapesjs
branch = gh-pages
[submodule "grapesjs"]
path = grapesjs
url = https://github.com/GrapesJS/grapesjs

View File

@ -1,16 +1,18 @@
FROM node:20-alpine
# Workdir
RUN mkdir /usr/lib/json-server
#RUN chown 33:33 /usr/lib/json-server
WORKDIR /usr/lib/json-server
RUN mkdir /usr/local/app
RUN chown 33:33 /usr/local/app
WORKDIR /usr/local/app
ADD entrypoint.sh /usr/local/bin
# Install modules
RUN npm install -g json-server
ADD entrypoint.sh /usr/local/bin
#USER 33
USER 33
# Cant kill with ctrl+c
#ENTRYPOINT ["/usr/local/bin/json-server", "db.json"]
ENTRYPOINT ["entrypoint.sh"]
CMD ["json-server", "-H", "0.0.0.0", "/usr/lib/json-server/db.json"]
CMD ["json-server", "-H", "0.0.0.0", "db.json"]

View File

@ -1,9 +1,3 @@
#!/bin/sh
if [ ! -f db.json ] ; then
touch db.json
fi
if [ ! -s db.json ] ; then
echo '{"projects": [ {"id": 1, "data": {"assets": [], "styles": [], "pages": []} } ]}' > db.json
fi
"$@"

3
css/main.css Normal file
View File

@ -0,0 +1,3 @@
.red {
color: #f24b4b;
}

2875
db.json

File diff suppressed because it is too large Load Diff

1
demo

@ -1 +0,0 @@
Subproject commit cb3f311e10fe182301048ffc28ccd9b20b0435ab

@ -1 +1 @@
Subproject commit 8893dbe2e79972e5c34806e71075d2e94a4a9e3e
Subproject commit f8b66a1d7e28b6c156cb7d6c61d2951872e9675f

1451
index.html

File diff suppressed because it is too large Load Diff

33
js/main.js Normal file
View File

@ -0,0 +1,33 @@
import fr from "../grapesjs/src/i18n/locale/fr.js";
//const projectID = window.location.hash.substr(1);
const projectID = 1;
if (projectID == '' || isNaN(projectID)) {
alert("LID de projet est invalide. Cette application ne va pas fonctionner.");
} else {
const projectEndpoint = `/projects/${projectID}`;
var editor = grapesjs.init({
container : '#gjs',
components: '<div class="red">Le chargement du projet est en cours. Si ce message ne disparait pas, le chargement a sans doutes échoué…</div>',
i18n: {
locale: 'fr', // default locale
detectLocale: false, // by default, the editor will detect the language
//localeFallback: 'en', // default fallback
messages: {fr},
},
storageManager: {
type: 'remote',
stepsBeforeSave: 1,
autosave: true,
options: {
remote: {
urlLoad: projectEndpoint,
urlStore: projectEndpoint,
fetchOptions: opts => (opts.method === 'POST' ? { method: 'PATCH' } : {}),
onStore: data => ({ id: projectID, data }),
onLoad: result => result.data,
}
}
}
});
}