imio.omnia.tinymce 1.0a1__tar.gz → 1.0a2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (104) hide show
  1. {imio_omnia_tinymce-1.0a1 → imio_omnia_tinymce-1.0a2}/CHANGES.rst +7 -0
  2. {imio_omnia_tinymce-1.0a1 → imio_omnia_tinymce-1.0a2}/MANIFEST.in +1 -1
  3. {imio_omnia_tinymce-1.0a1 → imio_omnia_tinymce-1.0a2}/PKG-INFO +8 -1
  4. {imio_omnia_tinymce-1.0a1 → imio_omnia_tinymce-1.0a2}/setup.py +1 -1
  5. imio_omnia_tinymce-1.0a2/src/imio/omnia/tinymce/browser/configure.zcml +40 -0
  6. imio_omnia_tinymce-1.0a2/src/imio/omnia/tinymce/browser/resources/.env.example +13 -0
  7. imio_omnia_tinymce-1.0a2/src/imio/omnia/tinymce/browser/resources/.git +1 -0
  8. imio_omnia_tinymce-1.0a2/src/imio/omnia/tinymce/browser/resources/.gitignore +26 -0
  9. imio_omnia_tinymce-1.0a2/src/imio/omnia/tinymce/browser/resources/.gitlab-ci.yml +77 -0
  10. imio_omnia_tinymce-1.0a2/src/imio/omnia/tinymce/browser/resources/.storybook/main.js +124 -0
  11. imio_omnia_tinymce-1.0a2/src/imio/omnia/tinymce/browser/resources/.storybook/preview.js +8 -0
  12. imio_omnia_tinymce-1.0a2/src/imio/omnia/tinymce/browser/resources/CHANGELOG.md +19 -0
  13. imio_omnia_tinymce-1.0a2/src/imio/omnia/tinymce/browser/resources/CLAUDE.md +62 -0
  14. imio_omnia_tinymce-1.0a2/src/imio/omnia/tinymce/browser/resources/Makefile +28 -0
  15. imio_omnia_tinymce-1.0a2/src/imio/omnia/tinymce/browser/resources/README.md +312 -0
  16. imio_omnia_tinymce-1.0a2/src/imio/omnia/tinymce/browser/resources/dev/index.html +41 -0
  17. imio_omnia_tinymce-1.0a2/src/imio/omnia/tinymce/browser/resources/dev/vite.config.js +78 -0
  18. imio_omnia_tinymce-1.0a2/src/imio/omnia/tinymce/browser/resources/docs/images/example1.png +0 -0
  19. imio_omnia_tinymce-1.0a2/src/imio/omnia/tinymce/browser/resources/eslint.config.js +36 -0
  20. imio_omnia_tinymce-1.0a2/src/imio/omnia/tinymce/browser/resources/package-lock.json +4913 -0
  21. imio_omnia_tinymce-1.0a2/src/imio/omnia/tinymce/browser/resources/package.json +61 -0
  22. imio_omnia_tinymce-1.0a2/src/imio/omnia/tinymce/browser/resources/src/assets/ia-icon.svg +5 -0
  23. imio_omnia_tinymce-1.0a2/src/imio/omnia/tinymce/browser/resources/src/assets/omnia-icon.svg +10 -0
  24. imio_omnia_tinymce-1.0a2/src/imio/omnia/tinymce/browser/resources/src/client.js +239 -0
  25. imio_omnia_tinymce-1.0a2/src/imio/omnia/tinymce/browser/resources/src/config.js +220 -0
  26. imio_omnia_tinymce-1.0a2/src/imio/omnia/tinymce/browser/resources/src/plugin.js +143 -0
  27. imio_omnia_tinymce-1.0a2/src/imio/omnia/tinymce/browser/resources/src/shortcuts.js +92 -0
  28. imio_omnia_tinymce-1.0a2/src/imio/omnia/tinymce/browser/resources/src/ui/App.jsx +75 -0
  29. imio_omnia_tinymce-1.0a2/src/imio/omnia/tinymce/browser/resources/src/ui/FloatingPanel.jsx +375 -0
  30. imio_omnia_tinymce-1.0a2/src/imio/omnia/tinymce/browser/resources/src/ui/PanelHeader.jsx +15 -0
  31. imio_omnia_tinymce-1.0a2/src/imio/omnia/tinymce/browser/resources/src/ui/SidePanel.jsx +284 -0
  32. imio_omnia_tinymce-1.0a2/src/imio/omnia/tinymce/browser/resources/src/ui/StreamingText.jsx +143 -0
  33. imio_omnia_tinymce-1.0a2/src/imio/omnia/tinymce/browser/resources/src/ui/components.jsx +70 -0
  34. imio_omnia_tinymce-1.0a2/src/imio/omnia/tinymce/browser/resources/src/ui/mount.jsx +35 -0
  35. imio_omnia_tinymce-1.0a2/src/imio/omnia/tinymce/browser/resources/src/ui/omnia.css +35 -0
  36. imio_omnia_tinymce-1.0a2/src/imio/omnia/tinymce/browser/resources/src/utils.js +56 -0
  37. imio_omnia_tinymce-1.0a2/src/imio/omnia/tinymce/browser/resources/stories/FloatingPanel.stories.jsx +66 -0
  38. imio_omnia_tinymce-1.0a2/src/imio/omnia/tinymce/browser/resources/stories/SidePanel.stories.jsx +31 -0
  39. imio_omnia_tinymce-1.0a2/src/imio/omnia/tinymce/browser/resources/stories/StreamingText.stories.jsx +85 -0
  40. imio_omnia_tinymce-1.0a2/src/imio/omnia/tinymce/browser/resources/stories/TinyMCEEditor.stories.js +228 -0
  41. imio_omnia_tinymce-1.0a2/src/imio/omnia/tinymce/browser/resources/stories/TypingDots.stories.jsx +31 -0
  42. imio_omnia_tinymce-1.0a2/src/imio/omnia/tinymce/browser/resources/stories/mocks/editor.js +66 -0
  43. imio_omnia_tinymce-1.0a2/src/imio/omnia/tinymce/browser/resources/stories/mocks/omnia-client.js +99 -0
  44. imio_omnia_tinymce-1.0a2/src/imio/omnia/tinymce/browser/resources/stories/presets/accessibilite-reglement.html +49 -0
  45. imio_omnia_tinymce-1.0a2/src/imio/omnia/tinymce/browser/resources/stories/presets/ameliorer-communication.html +36 -0
  46. imio_omnia_tinymce-1.0a2/src/imio/omnia/tinymce/browser/resources/stories/presets/corriger-bulletin.html +186 -0
  47. imio_omnia_tinymce-1.0a2/src/imio/omnia/tinymce/browser/resources/stories/presets/long-cdld.html +12389 -0
  48. imio_omnia_tinymce-1.0a2/src/imio/omnia/tinymce/browser/resources/stories/presets/reduire-deliberation.html +87 -0
  49. imio_omnia_tinymce-1.0a2/src/imio/omnia/tinymce/browser/resources/stories/presets/traduire-guide.html +234 -0
  50. imio_omnia_tinymce-1.0a2/src/imio/omnia/tinymce/browser/resources/vite.config.js +27 -0
  51. imio_omnia_tinymce-1.0a2/src/imio/omnia/tinymce/browser/static/omnia-tinymce.css +1 -0
  52. imio_omnia_tinymce-1.0a2/src/imio/omnia/tinymce/browser/static/omnia-tinymce.js +22 -0
  53. imio_omnia_tinymce-1.0a2/src/imio/omnia/tinymce/browser/templates/omnia_config.pt +10 -0
  54. imio_omnia_tinymce-1.0a2/src/imio/omnia/tinymce/configure.zcml +46 -0
  55. imio_omnia_tinymce-1.0a2/src/imio/omnia/tinymce/locales/README.rst +37 -0
  56. imio_omnia_tinymce-1.0a2/src/imio/omnia/tinymce/locales/en/LC_MESSAGES/imio.omnia.tinymce.po +83 -0
  57. imio_omnia_tinymce-1.0a2/src/imio/omnia/tinymce/locales/fr/LC_MESSAGES/imio.omnia.tinymce.po +83 -0
  58. imio_omnia_tinymce-1.0a2/src/imio/omnia/tinymce/locales/imio.omnia.tinymce.pot +86 -0
  59. imio_omnia_tinymce-1.0a2/src/imio/omnia/tinymce/locales/update.sh +12 -0
  60. imio_omnia_tinymce-1.0a2/src/imio/omnia/tinymce/permissions.zcml +10 -0
  61. imio_omnia_tinymce-1.0a2/src/imio/omnia/tinymce/profiles/default/actions.xml +13 -0
  62. imio_omnia_tinymce-1.0a2/src/imio/omnia/tinymce/profiles/default/browserlayer.xml +7 -0
  63. imio_omnia_tinymce-1.0a2/src/imio/omnia/tinymce/profiles/default/catalog.xml +4 -0
  64. imio_omnia_tinymce-1.0a2/src/imio/omnia/tinymce/profiles/default/metadata.xml +7 -0
  65. imio_omnia_tinymce-1.0a2/src/imio/omnia/tinymce/profiles/default/registry/main.xml +36 -0
  66. imio_omnia_tinymce-1.0a2/src/imio/omnia/tinymce/profiles/default/rolemap.xml +7 -0
  67. imio_omnia_tinymce-1.0a2/src/imio/omnia/tinymce/profiles/uninstall/browserlayer.xml +7 -0
  68. imio_omnia_tinymce-1.0a2/src/imio/omnia/tinymce/tests/__init__.py +0 -0
  69. imio_omnia_tinymce-1.0a2/src/imio/omnia/tinymce/tests/robot/test_example.robot +66 -0
  70. {imio_omnia_tinymce-1.0a1 → imio_omnia_tinymce-1.0a2}/src/imio.omnia.tinymce.egg-info/PKG-INFO +8 -1
  71. imio_omnia_tinymce-1.0a2/src/imio.omnia.tinymce.egg-info/SOURCES.txt +102 -0
  72. imio_omnia_tinymce-1.0a1/src/imio.omnia.tinymce.egg-info/SOURCES.txt +0 -37
  73. {imio_omnia_tinymce-1.0a1 → imio_omnia_tinymce-1.0a2}/CONTRIBUTORS.rst +0 -0
  74. {imio_omnia_tinymce-1.0a1 → imio_omnia_tinymce-1.0a2}/DEVELOP.rst +0 -0
  75. {imio_omnia_tinymce-1.0a1 → imio_omnia_tinymce-1.0a2}/LICENSE.GPL +0 -0
  76. {imio_omnia_tinymce-1.0a1 → imio_omnia_tinymce-1.0a2}/LICENSE.rst +0 -0
  77. {imio_omnia_tinymce-1.0a1 → imio_omnia_tinymce-1.0a2}/README.rst +0 -0
  78. {imio_omnia_tinymce-1.0a1 → imio_omnia_tinymce-1.0a2}/docs/conf.py +0 -0
  79. {imio_omnia_tinymce-1.0a1 → imio_omnia_tinymce-1.0a2}/docs/index.rst +0 -0
  80. {imio_omnia_tinymce-1.0a1 → imio_omnia_tinymce-1.0a2}/docs/plans/2026-03-23-tinymce-js-bundling-design.md +0 -0
  81. {imio_omnia_tinymce-1.0a1 → imio_omnia_tinymce-1.0a2}/docs/plans/2026-03-23-tinymce-js-bundling-plan.md +0 -0
  82. {imio_omnia_tinymce-1.0a1 → imio_omnia_tinymce-1.0a2}/setup.cfg +0 -0
  83. {imio_omnia_tinymce-1.0a1 → imio_omnia_tinymce-1.0a2}/src/imio/__init__.py +0 -0
  84. {imio_omnia_tinymce-1.0a1 → imio_omnia_tinymce-1.0a2}/src/imio/omnia/__init__.py +0 -0
  85. {imio_omnia_tinymce-1.0a1 → imio_omnia_tinymce-1.0a2}/src/imio/omnia/tinymce/__init__.py +0 -0
  86. {imio_omnia_tinymce-1.0a1 → imio_omnia_tinymce-1.0a2}/src/imio/omnia/tinymce/browser/__init__.py +0 -0
  87. {imio_omnia_tinymce-1.0a1 → imio_omnia_tinymce-1.0a2}/src/imio/omnia/tinymce/browser/action.py +0 -0
  88. {imio_omnia_tinymce-1.0a1 → imio_omnia_tinymce-1.0a2}/src/imio/omnia/tinymce/browser/controlpanel.py +0 -0
  89. /imio_omnia_tinymce-1.0a1/src/imio/omnia/tinymce/locales/__init__.py → /imio_omnia_tinymce-1.0a2/src/imio/omnia/tinymce/browser/overrides/.gitkeep +0 -0
  90. {imio_omnia_tinymce-1.0a1 → imio_omnia_tinymce-1.0a2}/src/imio/omnia/tinymce/browser/viewlets.py +0 -0
  91. {imio_omnia_tinymce-1.0a1 → imio_omnia_tinymce-1.0a2}/src/imio/omnia/tinymce/interfaces.py +0 -0
  92. {imio_omnia_tinymce-1.0a1/src/imio/omnia/tinymce/tests → imio_omnia_tinymce-1.0a2/src/imio/omnia/tinymce/locales}/__init__.py +0 -0
  93. {imio_omnia_tinymce-1.0a1 → imio_omnia_tinymce-1.0a2}/src/imio/omnia/tinymce/locales/update.py +0 -0
  94. {imio_omnia_tinymce-1.0a1 → imio_omnia_tinymce-1.0a2}/src/imio/omnia/tinymce/setuphandlers.py +0 -0
  95. {imio_omnia_tinymce-1.0a1 → imio_omnia_tinymce-1.0a2}/src/imio/omnia/tinymce/testing.py +0 -0
  96. {imio_omnia_tinymce-1.0a1 → imio_omnia_tinymce-1.0a2}/src/imio/omnia/tinymce/tests/test_robot.py +0 -0
  97. {imio_omnia_tinymce-1.0a1 → imio_omnia_tinymce-1.0a2}/src/imio/omnia/tinymce/tests/test_setup.py +0 -0
  98. {imio_omnia_tinymce-1.0a1 → imio_omnia_tinymce-1.0a2}/src/imio/omnia/tinymce/tests/test_viewlet.py +0 -0
  99. {imio_omnia_tinymce-1.0a1 → imio_omnia_tinymce-1.0a2}/src/imio.omnia.tinymce.egg-info/dependency_links.txt +0 -0
  100. {imio_omnia_tinymce-1.0a1 → imio_omnia_tinymce-1.0a2}/src/imio.omnia.tinymce.egg-info/entry_points.txt +0 -0
  101. {imio_omnia_tinymce-1.0a1 → imio_omnia_tinymce-1.0a2}/src/imio.omnia.tinymce.egg-info/namespace_packages.txt +0 -0
  102. {imio_omnia_tinymce-1.0a1 → imio_omnia_tinymce-1.0a2}/src/imio.omnia.tinymce.egg-info/not-zip-safe +0 -0
  103. {imio_omnia_tinymce-1.0a1 → imio_omnia_tinymce-1.0a2}/src/imio.omnia.tinymce.egg-info/requires.txt +0 -0
  104. {imio_omnia_tinymce-1.0a1 → imio_omnia_tinymce-1.0a2}/src/imio.omnia.tinymce.egg-info/top_level.txt +0 -0
@@ -2,6 +2,13 @@ Changelog
2
2
  =========
3
3
 
4
4
 
5
+ 1.0a2 (2026-04-03)
6
+ ------------------
7
+
8
+ - Re-release because ZCML files were lacking.
9
+ [aduchene]
10
+
11
+
5
12
  1.0a1 (2026-04-03)
6
13
  ------------------
7
14
 
@@ -1,4 +1,4 @@
1
- graft src/imio.omnia
1
+ graft src/imio
2
2
  graft docs
3
3
  include *.rst
4
4
  exclude tox.ini
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: imio.omnia.tinymce
3
- Version: 1.0a1
3
+ Version: 1.0a2
4
4
  Summary: TinyMCE plugin integrating iMio's Omnia AI API for Plone
5
5
  Home-page: https://gitlab.imio.be/imio/imio.omnia.tinymce
6
6
  Author: Antoine Duchêne
@@ -232,6 +232,13 @@ Changelog
232
232
  =========
233
233
 
234
234
 
235
+ 1.0a2 (2026-04-03)
236
+ ------------------
237
+
238
+ - Re-release because ZCML files were lacking.
239
+ [aduchene]
240
+
241
+
235
242
  1.0a1 (2026-04-03)
236
243
  ------------------
237
244
 
@@ -14,7 +14,7 @@ long_description = '\n\n'.join([
14
14
 
15
15
  setup(
16
16
  name='imio.omnia.tinymce',
17
- version='1.0a1',
17
+ version='1.0a2',
18
18
  description="TinyMCE plugin integrating iMio's Omnia AI API for Plone",
19
19
  long_description=long_description,
20
20
  # Get more from https://pypi.org/classifiers/
@@ -0,0 +1,40 @@
1
+ <configure
2
+ xmlns="http://namespaces.zope.org/zope"
3
+ xmlns:browser="http://namespaces.zope.org/browser"
4
+ xmlns:plone="http://namespaces.plone.org/plone"
5
+ i18n_domain="imio.omnia.tinymce">
6
+
7
+ <!-- Set overrides folder for Just-a-Bunch-Of-Templates product -->
8
+ <include package="z3c.jbot" file="meta.zcml"/>
9
+ <browser:jbot
10
+ directory="overrides"
11
+ layer="imio.omnia.tinymce.interfaces.IImioOmniaTinyMCELayer"
12
+ />
13
+
14
+ <!-- Publish static files -->
15
+ <plone:static
16
+ name="imio.omnia.tinymce"
17
+ type="plone"
18
+ directory="static"
19
+ />
20
+
21
+ <browser:page
22
+ name="omnia-tinymce-settings"
23
+ for="Products.CMFPlone.interfaces.IPloneSiteRoot"
24
+ class=".controlpanel.OmniaTinyMCEControlPanelView"
25
+ permission="cmf.ManagePortal"
26
+ layer="imio.omnia.tinymce.interfaces.IImioOmniaTinyMCELayer"
27
+ />
28
+
29
+ <!-- Viewlet: inject omnia_* config into TinyMCE init -->
30
+ <browser:viewlet
31
+ name="omnia-tinymce-config"
32
+ for="*"
33
+ manager="plone.app.layout.viewlets.interfaces.IHtmlHead"
34
+ class=".viewlets.OmniaConfigViewlet"
35
+ template="templates/omnia_config.pt"
36
+ permission="zope2.View"
37
+ layer="imio.omnia.tinymce.interfaces.IImioOmniaTinyMCELayer"
38
+ />
39
+
40
+ </configure>
@@ -0,0 +1,13 @@
1
+ # Copy this file to .env and fill in your values.
2
+ # These are exposed to the Storybook "Omnia API" story only.
3
+
4
+ # Base URL of the Omnia API (e.g. https://www.example.be/path/to/api).
5
+ # When set to a full https:// URL, Storybook automatically proxies requests
6
+ # through the dev server to avoid CORS issues.
7
+ VITE_OMNIA_BASE_URL=
8
+
9
+ # x-imio-application header value
10
+ VITE_OMNIA_APPLICATION=
11
+
12
+ # x-imio-municipality header value
13
+ VITE_OMNIA_MUNICIPALITY=
@@ -0,0 +1 @@
1
+ gitdir: ../../../../../../.git/modules/src/imio/omnia/tinymce/browser/resources
@@ -0,0 +1,26 @@
1
+ # Dependencies
2
+ node_modules/
3
+
4
+ # Build output
5
+ dist/
6
+ storybook-static/
7
+ *.tgz
8
+
9
+ # Environment
10
+ .env
11
+ .env.*
12
+ !.env.example
13
+
14
+ # Editors / IDEs
15
+ .idea/
16
+ .vscode/
17
+ *.swp
18
+ *.swo
19
+ *~
20
+
21
+ # OS
22
+ .DS_Store
23
+ Thumbs.db
24
+
25
+ # Claude Code
26
+ .claude/
@@ -0,0 +1,77 @@
1
+ stages:
2
+ - validate
3
+ - build
4
+ - publish
5
+
6
+ default:
7
+ image: node:22-alpine
8
+ tags:
9
+ - kubernetes
10
+ before_script:
11
+ - npm ci --prefer-offline
12
+ cache:
13
+ key: ${CI_COMMIT_REF_SLUG}
14
+ paths:
15
+ - node_modules/
16
+ policy: pull-push
17
+
18
+ lint:
19
+ stage: validate
20
+ script:
21
+ - npx eslint .
22
+
23
+ build:
24
+ stage: build
25
+ script:
26
+ - npm run build
27
+ artifacts:
28
+ paths:
29
+ - dist/
30
+ expire_in: 1 week
31
+
32
+ check-bundle-size:
33
+ stage: build
34
+ needs:
35
+ - build
36
+ before_script: []
37
+ script:
38
+ - |
39
+ MAX_JS_SIZE=524288 # 512 KB
40
+ MAX_CSS_SIZE=51200 # 50 KB
41
+
42
+ js_size=$(stat -c%s dist/omnia-tinymce.js)
43
+ css_size=$(stat -c%s dist/omnia-tinymce.css)
44
+
45
+ echo "JS (ESM): $(( js_size / 1024 )) KB / $(( MAX_JS_SIZE / 1024 )) KB"
46
+ echo "CSS: $(( css_size / 1024 )) KB / $(( MAX_CSS_SIZE / 1024 )) KB"
47
+
48
+ failed=0
49
+ if [ "$js_size" -gt "$MAX_JS_SIZE" ]; then
50
+ echo "FAIL: JS bundle exceeds ${MAX_JS_SIZE} bytes"
51
+ failed=1
52
+ fi
53
+ if [ "$css_size" -gt "$MAX_CSS_SIZE" ]; then
54
+ echo "FAIL: CSS bundle exceeds ${MAX_CSS_SIZE} bytes"
55
+ failed=1
56
+ fi
57
+ exit $failed
58
+
59
+ build-storybook:
60
+ stage: build
61
+ script:
62
+ - npm run build-storybook
63
+ artifacts:
64
+ paths:
65
+ - storybook-static/
66
+ expire_in: 1 week
67
+
68
+ publish:
69
+ stage: publish
70
+ script:
71
+ - echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > .npmrc
72
+ - npm pkg set version="${CI_COMMIT_TAG#v}"
73
+ - npm publish --access public
74
+ needs:
75
+ - build
76
+ rules:
77
+ - if: $CI_COMMIT_TAG =~ /^v\d+\.\d+\.\d+/
@@ -0,0 +1,124 @@
1
+ /** @type { import('storybook').StorybookConfig } */
2
+ const config = {
3
+ stories: ['../stories/**/*.stories.@(js|jsx)'],
4
+ framework: {
5
+ name: '@storybook/html-vite',
6
+ options: {},
7
+ },
8
+ staticDirs: [{ from: '../node_modules/tinymce', to: '/tinymce' }],
9
+ async viteFinal(config) {
10
+ config.plugins = [...(config.plugins ?? []), mockApiPlugin()];
11
+
12
+ // If VITE_OMNIA_BASE_URL is a full URL, proxy it to avoid CORS in the Live API story.
13
+ const apiTarget = process.env.VITE_OMNIA_BASE_URL;
14
+ if (apiTarget?.startsWith('http')) {
15
+ const { origin, pathname } = new URL(apiTarget);
16
+ config.server ??= {};
17
+ config.server.proxy ??= {};
18
+ config.server.proxy['/omnia-proxy'] = {
19
+ target: origin,
20
+ changeOrigin: true,
21
+ rewrite: (path) => {
22
+ const rewritten = path.replace(/^\/omnia-proxy/, pathname);
23
+ console.log(`[omnia-proxy] ${path} → ${origin}${rewritten}`);
24
+ return rewritten;
25
+ },
26
+ };
27
+ // Point the client to the local proxy path instead of the remote URL.
28
+ config.define ??= {};
29
+ config.define['import.meta.env.VITE_OMNIA_BASE_URL'] = JSON.stringify('/omnia-proxy');
30
+ }
31
+
32
+ return config;
33
+ },
34
+ };
35
+
36
+ export default config;
37
+
38
+ function mockApiPlugin() {
39
+ return {
40
+ name: 'omnia-mock-api',
41
+ configureServer(server) {
42
+ function sendSSE(res, text, delay = 40) {
43
+ res.writeHead(200, {
44
+ 'Content-Type': 'text/event-stream',
45
+ 'Cache-Control': 'no-cache',
46
+ Connection: 'keep-alive',
47
+ });
48
+ const words = text.split(' ');
49
+ let i = 0;
50
+ const interval = setInterval(() => {
51
+ if (i >= words.length) {
52
+ res.write('data: [DONE]\n\n');
53
+ res.end();
54
+ clearInterval(interval);
55
+ return;
56
+ }
57
+ const chunk = (i > 0 ? ' ' : '') + words[i];
58
+ res.write(`data: ${JSON.stringify({ chunk })}\n\n`);
59
+ i++;
60
+ }, delay);
61
+ res.on('close', () => clearInterval(interval));
62
+ }
63
+
64
+ function readBody(req) {
65
+ return new Promise((resolve) => {
66
+ let body = '';
67
+ req.on('data', (c) => (body += c));
68
+ req.on('end', () => {
69
+ try { resolve(JSON.parse(body)); } catch { resolve({}); }
70
+ });
71
+ });
72
+ }
73
+
74
+ server.middlewares.use('/api/generate', async (req, res) => {
75
+ const body = await readBody(req);
76
+ sendSSE(res, `Voici le contenu généré pour : "${body.prompt || ''}". Ce texte a été produit par le serveur mock Omnia.`);
77
+ });
78
+ // Non-streaming agents endpoints
79
+ const MOCK_DELAY = 1800;
80
+
81
+ function sleep(ms) {
82
+ return new Promise((resolve) => setTimeout(resolve, ms));
83
+ }
84
+
85
+ function sendJSON(res, result) {
86
+ const payload = JSON.stringify({ result });
87
+ res.writeHead(200, { 'Content-Type': 'application/json', 'Content-Length': Buffer.byteLength(payload) });
88
+ res.end(payload);
89
+ }
90
+
91
+ server.middlewares.use('/api/v1/agents/expand-text', async (req, res) => {
92
+ const body = await readBody(req);
93
+ await sleep(MOCK_DELAY);
94
+ sendJSON(res, `${body.input || ''} [Texte développé — version plus détaillée et enrichie du contenu original.]`);
95
+ });
96
+ server.middlewares.use('/api/v1/agents/improve-text', async (req, res) => {
97
+ const body = await readBody(req);
98
+ await sleep(MOCK_DELAY);
99
+ sendJSON(res, `[Texte amélioré] ${body.input || ''}`);
100
+ });
101
+ server.middlewares.use('/api/v1/agents/reduce-text', async (req, res) => {
102
+ const body = await readBody(req);
103
+ await sleep(MOCK_DELAY);
104
+ const words = (body.input || '').split(' ').slice(0, 20).join(' ');
105
+ sendJSON(res, `${words}… [Texte réduit]`);
106
+ });
107
+ server.middlewares.use('/api/v1/agents/correct-text', async (req, res) => {
108
+ const body = await readBody(req);
109
+ await sleep(MOCK_DELAY);
110
+ sendJSON(res, `[Texte corrigé] ${body.input || ''}`);
111
+ });
112
+ server.middlewares.use('/api/v1/agents/make-accessible', async (req, res) => {
113
+ const body = await readBody(req);
114
+ await sleep(MOCK_DELAY);
115
+ sendJSON(res, `[Texte accessible WCAG] ${body.input || ''}`);
116
+ });
117
+ server.middlewares.use('/api/v1/agents/translate-text', async (req, res) => {
118
+ const body = await readBody(req);
119
+ await sleep(MOCK_DELAY);
120
+ sendJSON(res, `[Traduit en ${body.target_language || 'fr'}] ${body.input || ''}`);
121
+ });
122
+ },
123
+ };
124
+ }
@@ -0,0 +1,8 @@
1
+ /** @type { import('storybook').Preview } */
2
+ const preview = {
3
+ parameters: {
4
+ layout: 'centered',
5
+ },
6
+ };
7
+
8
+ export default preview;
@@ -0,0 +1,19 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/).
7
+
8
+ ## [Unreleased]
9
+
10
+ Initial release.
11
+
12
+ ### Added
13
+ - TinyMCE plugin with Omnia AI API integration
14
+ - Content manipulation: expand, improve, reduce, correct, accessibility, translate
15
+ - FloatingPanel for inline text transformations
16
+ - SidePanel for content generation
17
+ - SSE streaming with animated text output
18
+ - Keyboard shortcuts (Alt+prefix chord system)
19
+ - Storybook stories and integration test page
@@ -0,0 +1,62 @@
1
+ # omnia-tinymce
2
+
3
+ TinyMCE plugin that integrates iMio's Omnia AI API for intelligent content manipulation (expansion, improvement, reduction, correction, accessibility, translation). Content generation (SidePanel) is implemented in the UI but not yet available server-side — it is disabled by default.
4
+
5
+ Published as `@imiobe/omnia-tinymce` on npm.
6
+
7
+ ## Commands
8
+
9
+ - `make dev` / `npm run dev` — Start Storybook dev server on port 6006
10
+ - `make build` / `npm run build` — Build library to `dist/` (ES + UMD + CSS)
11
+ - `make build-storybook` / `npm run build-storybook` — Build static Storybook site
12
+ - `make dev-integration` / `npm run dev:integration` — Run integration test page with mock API on port 5173
13
+ - `make clean` — Remove `dist/` and `storybook-static/`
14
+ - `make publish` — Build and publish to npm
15
+
16
+ No linting or test runner is configured.
17
+
18
+ ## Architecture
19
+
20
+ - **Entry point:** `src/plugin.js` — TinyMCE plugin registration, menu/toolbar setup
21
+ - **Client:** `src/client.js` — HTTP client with SSE streaming for the Omnia API
22
+ - **Config:** `src/config.js` — Feature definitions, option registration and validation
23
+ - **Shortcuts:** `src/shortcuts.js` — Keyboard shortcut binding (Alt+prefix chord system)
24
+ - **UI:** `src/ui/` — Preact components (FloatingPanel, SidePanel, StreamingText, TypingDots, etc.)
25
+ - **Stories:** `stories/` — Storybook stories with mock editor and client
26
+ - **Dev page:** `dev/` — Integration test page with mock API middleware
27
+ - **Docs:** `docs/images/` — Screenshots used in the README
28
+
29
+ The plugin builds as a library (UMD + ESM) via Vite. TinyMCE is a peer dependency (not bundled).
30
+
31
+ ## Stack
32
+
33
+ - **Preact** for UI (functional components + hooks, aliased from React)
34
+ - **Vite** for builds (library mode) and dev server
35
+ - **Tailwind CSS v4** with `om:` prefix to scope styles and avoid host page conflicts
36
+ - **Motion** (Framer Motion) for animations
37
+ - **Storybook 10** (HTML framework) for component development
38
+
39
+ ## Workflow
40
+
41
+ - When modifying a UI component, always update its corresponding Storybook stories in `stories/` to cover new props/modes.
42
+ - When adding or changing a TinyMCE option (`omnia_*`), also update the TinyMCE integration story (`stories/TinyMCEEditor.stories.js`): add the argType, pass it in `createEditor`, and set a default in `MockAPI.args`.
43
+ - Prefer Storybook **controls** (argTypes) over creating separate stories for each variant. Only create new stories when explicitly asked or for brand new components.
44
+ - The `generate` feature is disabled by default (`DEFAULT_ENABLED_FEATURES` in `src/config.js`) but should stay enabled in all Storybook stories for development.
45
+
46
+ ## Code conventions
47
+
48
+ - Vanilla JS for business logic; JSX (Preact) for UI components only
49
+ - All Tailwind classes use the `om:` prefix (e.g. `om:flex`, `om:text-sm`)
50
+ - CSS scoped to `[data-omnia]` elements — no Tailwind preflight to avoid polluting the host
51
+ - Streaming responses use `async function*` generators
52
+ - Non-streaming agent responses show a `TypingDots` loader
53
+ - Root UI component (`App`) exposes imperative methods via `useImperativeHandle`
54
+ - Feature labels and UI text are in French
55
+ - Supported languages: fr, nl, de, en, es, it
56
+
57
+ ## Environment
58
+
59
+ Copy `.env.example` to `.env` for Storybook "Omnia API" story. Variables:
60
+ - `VITE_OMNIA_BASE_URL` — Omnia API base URL
61
+ - `VITE_OMNIA_APPLICATION` — x-imio-application header
62
+ - `VITE_OMNIA_MUNICIPALITY` — x-imio-municipality header
@@ -0,0 +1,28 @@
1
+ .PHONY: install dev dev-integration build build-storybook clean publish lint lint-fix
2
+
3
+ install:
4
+ npm install
5
+
6
+ dev:
7
+ npm run dev
8
+
9
+ dev-integration:
10
+ npm run dev:integration
11
+
12
+ build:
13
+ npm run build
14
+
15
+ build-storybook:
16
+ npm run build-storybook
17
+
18
+ lint:
19
+ npm run lint
20
+
21
+ lint-fix:
22
+ npm run lint:fix
23
+
24
+ clean:
25
+ rm -rf dist storybook-static
26
+
27
+ publish: clean build
28
+ npm publish --access public