Compare commits
4 Commits
f6f77107f7
...
8f74a96f38
Author | SHA1 | Date |
---|---|---|
jordi fita mas | 8f74a96f38 | |
jordi fita mas | be41b01b0c | |
jordi fita mas | f612a49434 | |
jordi fita mas | 17a86bd896 |
|
@ -1,3 +1,5 @@
|
|||
/node_modules/
|
||||
/po/*.pot
|
||||
/web/static/editor.css
|
||||
/web/static/editor.js
|
||||
/web/static/*.json
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="MarkdownSettings">
|
||||
<enabledExtensions>
|
||||
<entry key="MermaidLanguageExtension" value="false" />
|
||||
<entry key="PlantUMLLanguageExtension" value="false" />
|
||||
</enabledExtensions>
|
||||
</component>
|
||||
</project>
|
|
@ -5,6 +5,7 @@
|
|||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/web" type="java-resource" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/po/src" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
DEFAULT_DOMAIN = editor
|
||||
POT_FILE = po/$(DEFAULT_DOMAIN).pot
|
||||
LINGUAS = es
|
||||
JSON_FILES = $(patsubst %,web/static/%.json,$(LINGUAS))
|
||||
|
||||
locales: $(JSON_FILES)
|
||||
|
||||
po/%.po: $(POT_FILE)
|
||||
msgmerge --no-wrap --update --backup=off $@ $<
|
||||
|
||||
web/static/%.json: po/%.po
|
||||
npx po2json --format jed1.x $< $@
|
||||
|
||||
$(POT_FILE):
|
||||
wp i18n make-pot . $@ --ignore-domain --include=editor,po/src
|
||||
|
||||
|
||||
.PHONY: locales
|
|
@ -1,7 +1,13 @@
|
|||
module.exports = (api) => {
|
||||
api.cache(true);
|
||||
api.cache(true);
|
||||
|
||||
return {
|
||||
return {
|
||||
plugins: [
|
||||
[
|
||||
"@wordpress/babel-plugin-makepot",
|
||||
{"output": "po/editor.pot"}
|
||||
],
|
||||
],
|
||||
presets: ['@wordpress/babel-preset-default'],
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import {render} from '@wordpress/element';
|
||||
import {__, setLocaleData} from '@wordpress/i18n';
|
||||
|
||||
import './style.scss';
|
||||
import IsolatedBlockEditor, {ToolbarSlot} from '@automattic/isolated-block-editor';
|
||||
|
@ -52,16 +53,25 @@ function save() {
|
|||
fetch('/edit', requestOptions);
|
||||
}
|
||||
|
||||
render(
|
||||
<IsolatedBlockEditor
|
||||
settings={settings}
|
||||
onLoad={(parser, rawHandler) => onLoad(textarea.value, parser, rawHandler)}
|
||||
onSaveContent={(content) => saveBlocks(content, textarea)}
|
||||
onError={() => document.location.reload()}
|
||||
>
|
||||
<ToolbarSlot>
|
||||
<Button onClick={save} variant="primary">Beep!</Button>
|
||||
</ToolbarSlot>
|
||||
</IsolatedBlockEditor>,
|
||||
editor
|
||||
);
|
||||
async function load(editor) {
|
||||
const response = await fetch('/static/es.json');
|
||||
const result = await response.json();
|
||||
const localeData = result.locale_data.messages;
|
||||
localeData[""].domain = "default";
|
||||
setLocaleData(localeData, 'default');
|
||||
render(
|
||||
<IsolatedBlockEditor
|
||||
settings={settings}
|
||||
onLoad={(parser, rawHandler) => onLoad(textarea.value, parser, rawHandler)}
|
||||
onSaveContent={(content) => saveBlocks(content, textarea)}
|
||||
onError={() => document.location.reload()}
|
||||
>
|
||||
<ToolbarSlot>
|
||||
<Button onClick={save} variant="primary">{__('Beep!')}</Button>
|
||||
</ToolbarSlot>
|
||||
</IsolatedBlockEditor>,
|
||||
editor
|
||||
);
|
||||
}
|
||||
|
||||
load(editor);
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -10,7 +10,9 @@
|
|||
"@wordpress/block-library": "8.8.0",
|
||||
"@wordpress/components": "23.8.0",
|
||||
"@wordpress/edit-post": "7.8.0",
|
||||
"@wordpress/format-library": "4.8.0"
|
||||
"@wordpress/element": "5.8.0",
|
||||
"@wordpress/format-library": "4.8.0",
|
||||
"@wordpress/i18n": "4.31.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.21.4",
|
||||
|
@ -20,11 +22,11 @@
|
|||
"@emotion/styled": "^11.10.6",
|
||||
"@shopify/polyfills": "^4.0.3",
|
||||
"@wordpress/babel-preset-default": "^7.15.0",
|
||||
"@wordpress/scripts": "^26.2.0",
|
||||
"babel-loader": "^9.1.2",
|
||||
"babel-plugin-inline-json-import": "^0.3.2",
|
||||
"css-loader": "^6.7.3",
|
||||
"mini-css-extract-plugin": "^2.7.5",
|
||||
"po2json": "^0.4.5",
|
||||
"react": "^18.2.0",
|
||||
"react-dom": "^18.2.0",
|
||||
"sass-loader": "^13.2.2",
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
../../node_modules/@wordpress/a11y/src
|
|
@ -0,0 +1 @@
|
|||
../../node_modules/@wordpress/annotations/src
|
|
@ -0,0 +1 @@
|
|||
../../node_modules/@wordpress/api-fetch/src
|
|
@ -0,0 +1 @@
|
|||
../../node_modules/@wordpress/block-editor/src
|
|
@ -0,0 +1 @@
|
|||
../../node_modules/@wordpress/block-library/src
|
|
@ -0,0 +1 @@
|
|||
../../node_modules/@wordpress/blocks/src
|
|
@ -0,0 +1 @@
|
|||
../../node_modules/@wordpress/components/src
|
|
@ -0,0 +1 @@
|
|||
../../node_modules/@wordpress/core-data/src
|
|
@ -0,0 +1 @@
|
|||
../../node_modules/@wordpress/edit-post/src
|
|
@ -0,0 +1 @@
|
|||
../../node_modules/@wordpress/editor/src
|
|
@ -0,0 +1 @@
|
|||
../../node_modules/@wordpress/format-library/src
|
|
@ -0,0 +1 @@
|
|||
../../node_modules/@wordpress/interface/src
|
|
@ -0,0 +1 @@
|
|||
../../node_modules/@automattic/isolated-block-editor/src/
|
|
@ -0,0 +1 @@
|
|||
../../node_modules/@wordpress/keycodes/src
|
|
@ -0,0 +1 @@
|
|||
../../node_modules/@wordpress/list-reusable-blocks/src
|
|
@ -0,0 +1 @@
|
|||
../../node_modules/@wordpress/media-utils/src
|
|
@ -0,0 +1 @@
|
|||
../../node_modules/@wordpress/preferences/src
|
|
@ -0,0 +1 @@
|
|||
../../node_modules/@wordpress/reusable-blocks/src
|
|
@ -0,0 +1 @@
|
|||
../../node_modules/@wordpress/rich-text/src
|
|
@ -0,0 +1 @@
|
|||
../../node_modules/@wordpress/server-side-render/src
|
|
@ -0,0 +1 @@
|
|||
../../node_modules/@wordpress/widgets/src
|
Loading…
Reference in New Issue