Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: i18m, demo assets, control dependencies #363

Merged
merged 3 commits into from
Oct 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
135 changes: 120 additions & 15 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 18 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,16 @@
"name": "formeo",
"version": "2.1.4",
"type": "module",
"main": "dist/formeo.min.js",
"main": "dist/formeo.cjs.js",
"module": "dist/formeo.es.js",
"unpkg": "dist/formeo.umd.js",
"exports": {
".": {
"import": "./dist/formeo.es.js",
"require": "./dist/formeo.cjs.js",
"default": "./dist/formeo.umd.js"
}
},
"files": [
"dist/*",
"demo/**/*"
Expand Down Expand Up @@ -55,10 +64,9 @@
"scripts": {
"dev": "vite",
"preview": "vite preview",
"analyze": "webpack --mode production -p --progress --config tools/webpack.config --analyze",
"build": "npm-run-all -p build:icons build:formeo build:demo",
"build:formeo": "vite build --mode lib",
"build:formeo:watch": "npm run build:formeo -- --watch",
"build:lib": "vite build --config vite.config.lib.mjs",
"build": "npm-run-all -p build:icons build:demo",
"prebuild": "npm run build:lib",
"build:demo": "vite build --mode demo",
"build:demo:watch": "vite build --mode demo --watch",
"build:icons": "node ./tools/generate-sprite",
Expand All @@ -68,6 +76,7 @@
"test:ci": "yarn test --coverage",
"start": "npm-run-all build:icons dev",
"semantic-release": "semantic-release --ci --debug",
"copy:lang": "node ./tools/copy-directory.mjs ./node_modules/formeo-i18n/dist/lang ./src/demo/assets/lang",
"travis-deploy-once": "travis-deploy-once --pro",
"prepush": "yarn test",
"defaults": "webpack-defaults"
Expand All @@ -88,12 +97,13 @@
"vite": "^5.4.8",
"vite-plugin-banner": "^0.8.0",
"vite-plugin-compression": "^0.5.1",
"vite-plugin-html": "^3.2.2"
"vite-plugin-html": "^3.2.2",
"vite-plugin-static-copy": "^2.0.0"
},
"dependencies": {
"formeo-i18n": "^2.1.3",
"@draggable/formeo-languages": "^3.1.3",
"@draggable/i18n": "^1.0.7",
"lodash": "^4.17.21",
"mi18n": "^1.0.2",
"sortablejs": "^1.15.3"
},
"release": {
Expand Down
6 changes: 1 addition & 5 deletions src/demo/js/events.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,7 @@ export const editorEvents = editor => {
editor.i18n.setLang(value)
}
controlFilter.addEventListener('input', onChangeFilterInput)
if (formeoLocale) {
localeSelect.value = JSON.parse(formeoLocale)
} else {
localeSelect.value = 'en-US'
}
localeSelect.value = formeoLocale || 'en-US'

localeSelect.addEventListener('change', onChangeLocale, false)
}
18 changes: 17 additions & 1 deletion src/demo/js/options/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const renderContainer = '.render-form'
export const editorOptions = {
editorContainer,
i18n: {
location: `./assets/lang`,
location: './assets/lang',
},
actions: {
// save: formData => null, // do something on save action
Expand All @@ -32,4 +32,20 @@ export const editorOptions = {
export const renderOptions = {
renderContainer,
external,
elements: {
tinymce: {
dependencies: { js: 'cdnjs.cloudflare.com/ajax/libs/tinymce/4.9.11/tinymce.min.js' },
action: {
onRender: elem => {
if (elem.id) {
const selector = `#${elem.id}`
window.tinymce.remove(selector)
window.tinymce.init({
selector: selector,
})
}
},
},
},
},
}
2 changes: 1 addition & 1 deletion src/lib/js/common/actions.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import i18n from 'mi18n'
import i18n from '@draggable/i18n'
import { SESSION_FORMDATA_KEY, CONDITION_TEMPLATE } from '../constants.js'
import { identity, sessionStorage } from './utils/index.mjs'
import events from './events.js'
Expand Down
Loading