imio.omnia.tinymce 1.0__py3-none-any.whl
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.
- imio/omnia/tinymce/__init__.py +6 -0
- imio/omnia/tinymce/browser/__init__.py +0 -0
- imio/omnia/tinymce/browser/action.py +6 -0
- imio/omnia/tinymce/browser/configure.zcml +40 -0
- imio/omnia/tinymce/browser/controlpanel.py +93 -0
- imio/omnia/tinymce/browser/npm/package-lock.json +125 -0
- imio/omnia/tinymce/browser/npm/package.json +8 -0
- imio/omnia/tinymce/browser/overrides/.gitkeep +0 -0
- imio/omnia/tinymce/browser/resources/.env.example +13 -0
- imio/omnia/tinymce/browser/resources/.git +1 -0
- imio/omnia/tinymce/browser/resources/.gitignore +26 -0
- imio/omnia/tinymce/browser/resources/.gitlab-ci.yml +77 -0
- imio/omnia/tinymce/browser/resources/.storybook/main.js +124 -0
- imio/omnia/tinymce/browser/resources/.storybook/preview.js +8 -0
- imio/omnia/tinymce/browser/resources/CHANGELOG.md +19 -0
- imio/omnia/tinymce/browser/resources/CLAUDE.md +62 -0
- imio/omnia/tinymce/browser/resources/Makefile +28 -0
- imio/omnia/tinymce/browser/resources/README.md +327 -0
- imio/omnia/tinymce/browser/resources/dev/index.html +41 -0
- imio/omnia/tinymce/browser/resources/dev/vite.config.js +78 -0
- imio/omnia/tinymce/browser/resources/docs/images/example1.png +0 -0
- imio/omnia/tinymce/browser/resources/eslint.config.js +36 -0
- imio/omnia/tinymce/browser/resources/package-lock.json +4913 -0
- imio/omnia/tinymce/browser/resources/package.json +61 -0
- imio/omnia/tinymce/browser/resources/src/assets/ia-icon.svg +5 -0
- imio/omnia/tinymce/browser/resources/src/assets/omnia-icon.svg +10 -0
- imio/omnia/tinymce/browser/resources/src/client.js +239 -0
- imio/omnia/tinymce/browser/resources/src/config.js +220 -0
- imio/omnia/tinymce/browser/resources/src/plugin.js +158 -0
- imio/omnia/tinymce/browser/resources/src/shortcuts.js +92 -0
- imio/omnia/tinymce/browser/resources/src/ui/App.jsx +75 -0
- imio/omnia/tinymce/browser/resources/src/ui/FloatingPanel.jsx +375 -0
- imio/omnia/tinymce/browser/resources/src/ui/PanelHeader.jsx +15 -0
- imio/omnia/tinymce/browser/resources/src/ui/SidePanel.jsx +284 -0
- imio/omnia/tinymce/browser/resources/src/ui/StreamingText.jsx +143 -0
- imio/omnia/tinymce/browser/resources/src/ui/components.jsx +70 -0
- imio/omnia/tinymce/browser/resources/src/ui/mount.jsx +35 -0
- imio/omnia/tinymce/browser/resources/src/ui/omnia.css +35 -0
- imio/omnia/tinymce/browser/resources/src/utils.js +56 -0
- imio/omnia/tinymce/browser/resources/stories/FloatingPanel.stories.jsx +66 -0
- imio/omnia/tinymce/browser/resources/stories/SidePanel.stories.jsx +31 -0
- imio/omnia/tinymce/browser/resources/stories/StreamingText.stories.jsx +85 -0
- imio/omnia/tinymce/browser/resources/stories/TinyMCEEditor.stories.js +228 -0
- imio/omnia/tinymce/browser/resources/stories/TypingDots.stories.jsx +31 -0
- imio/omnia/tinymce/browser/resources/stories/mocks/editor.js +66 -0
- imio/omnia/tinymce/browser/resources/stories/mocks/omnia-client.js +99 -0
- imio/omnia/tinymce/browser/resources/stories/presets/accessibilite-reglement.html +49 -0
- imio/omnia/tinymce/browser/resources/stories/presets/ameliorer-communication.html +36 -0
- imio/omnia/tinymce/browser/resources/stories/presets/corriger-bulletin.html +186 -0
- imio/omnia/tinymce/browser/resources/stories/presets/long-cdld.html +12389 -0
- imio/omnia/tinymce/browser/resources/stories/presets/reduire-deliberation.html +87 -0
- imio/omnia/tinymce/browser/resources/stories/presets/traduire-guide.html +234 -0
- imio/omnia/tinymce/browser/resources/vite.config.js +27 -0
- imio/omnia/tinymce/browser/static/omnia-tinymce.css +1 -0
- imio/omnia/tinymce/browser/static/omnia-tinymce.js +22 -0
- imio/omnia/tinymce/browser/templates/omnia_config.pt +10 -0
- imio/omnia/tinymce/browser/viewlets.py +57 -0
- imio/omnia/tinymce/configure.zcml +42 -0
- imio/omnia/tinymce/interfaces.py +7 -0
- imio/omnia/tinymce/locales/README.rst +37 -0
- imio/omnia/tinymce/locales/__init__.py +0 -0
- imio/omnia/tinymce/locales/en/LC_MESSAGES/imio.omnia.tinymce.po +83 -0
- imio/omnia/tinymce/locales/fr/LC_MESSAGES/imio.omnia.tinymce.po +83 -0
- imio/omnia/tinymce/locales/imio.omnia.tinymce.pot +86 -0
- imio/omnia/tinymce/locales/update.py +74 -0
- imio/omnia/tinymce/locales/update.sh +12 -0
- imio/omnia/tinymce/permissions.zcml +10 -0
- imio/omnia/tinymce/profiles/default/actions.xml +13 -0
- imio/omnia/tinymce/profiles/default/browserlayer.xml +7 -0
- imio/omnia/tinymce/profiles/default/catalog.xml +4 -0
- imio/omnia/tinymce/profiles/default/metadata.xml +7 -0
- imio/omnia/tinymce/profiles/default/registry/main.xml +35 -0
- imio/omnia/tinymce/profiles/default/rolemap.xml +7 -0
- imio/omnia/tinymce/profiles/uninstall/browserlayer.xml +7 -0
- imio/omnia/tinymce/setuphandlers.py +45 -0
- imio/omnia/tinymce/testing.py +48 -0
- imio/omnia/tinymce/tests/__init__.py +0 -0
- imio/omnia/tinymce/tests/robot/test_example.robot +66 -0
- imio/omnia/tinymce/tests/test_robot.py +28 -0
- imio/omnia/tinymce/tests/test_setup.py +68 -0
- imio/omnia/tinymce/tests/test_viewlet.py +99 -0
- imio.omnia.tinymce-1.0-py3.12-nspkg.pth +2 -0
- imio_omnia_tinymce-1.0.dist-info/METADATA +294 -0
- imio_omnia_tinymce-1.0.dist-info/RECORD +90 -0
- imio_omnia_tinymce-1.0.dist-info/WHEEL +5 -0
- imio_omnia_tinymce-1.0.dist-info/entry_points.txt +5 -0
- imio_omnia_tinymce-1.0.dist-info/licenses/LICENSE.GPL +339 -0
- imio_omnia_tinymce-1.0.dist-info/licenses/LICENSE.rst +15 -0
- imio_omnia_tinymce-1.0.dist-info/namespace_packages.txt +2 -0
- imio_omnia_tinymce-1.0.dist-info/top_level.txt +1 -0
|
File without changes
|
|
@@ -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,93 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
from collective.z3cform.datagridfield.blockdatagridfield import BlockDataGridFieldFactory
|
|
3
|
+
from imio.omnia.core.browser.controlpanel import OmniaCoreControlPanelFormWrapper
|
|
4
|
+
from imio.omnia.tinymce import _
|
|
5
|
+
from plone.app.registry.browser.controlpanel import RegistryEditForm
|
|
6
|
+
from plone.autoform import directives
|
|
7
|
+
from plone.z3cform import layout
|
|
8
|
+
from zope import schema
|
|
9
|
+
from zope.interface import Interface
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class IOmniaTinyMCESettings(Interface):
|
|
13
|
+
directives.widget(omnia_endpoints=BlockDataGridFieldFactory)
|
|
14
|
+
|
|
15
|
+
enabled_features = schema.Tuple(
|
|
16
|
+
title=_("Enabled features"),
|
|
17
|
+
description=_("Restrict to a subset of features. Leave empty for all features except generate."),
|
|
18
|
+
value_type=schema.Choice(
|
|
19
|
+
values=[
|
|
20
|
+
"generate",
|
|
21
|
+
"expand-text",
|
|
22
|
+
"improve-text",
|
|
23
|
+
"reduce-text",
|
|
24
|
+
"correct-text",
|
|
25
|
+
"make-accessible",
|
|
26
|
+
"translate-text",
|
|
27
|
+
],
|
|
28
|
+
),
|
|
29
|
+
required=False,
|
|
30
|
+
missing_value=(),
|
|
31
|
+
default=("expand-text", "improve-text", "reduce-text", "correct-text", "make-accessible", "translate-text"),
|
|
32
|
+
)
|
|
33
|
+
show_toolbar = schema.Bool(
|
|
34
|
+
title=_("Show toolbar button"),
|
|
35
|
+
required=False,
|
|
36
|
+
default=True,
|
|
37
|
+
)
|
|
38
|
+
show_context_menu = schema.Bool(
|
|
39
|
+
title=_("Show context menu"),
|
|
40
|
+
required=False,
|
|
41
|
+
default=True,
|
|
42
|
+
)
|
|
43
|
+
enable_shortcuts = schema.Bool(
|
|
44
|
+
title=_("Enable keyboard shortcuts"),
|
|
45
|
+
required=False,
|
|
46
|
+
default=True,
|
|
47
|
+
)
|
|
48
|
+
|
|
49
|
+
translate_languages = schema.Tuple(
|
|
50
|
+
title=_("Translation languages"),
|
|
51
|
+
description=_("Language codes available for translation."),
|
|
52
|
+
value_type=schema.Choice(
|
|
53
|
+
values=[
|
|
54
|
+
"fr",
|
|
55
|
+
"nl",
|
|
56
|
+
"de",
|
|
57
|
+
"en",
|
|
58
|
+
"es",
|
|
59
|
+
"it"
|
|
60
|
+
],
|
|
61
|
+
),
|
|
62
|
+
required=False,
|
|
63
|
+
missing_value=(),
|
|
64
|
+
default=("fr", "nl", "de", "en"),
|
|
65
|
+
)
|
|
66
|
+
default_translate_language = schema.TextLine(
|
|
67
|
+
title=_("Default translation language"),
|
|
68
|
+
required=False,
|
|
69
|
+
default="fr",
|
|
70
|
+
)
|
|
71
|
+
|
|
72
|
+
floating_panel_mode = schema.Choice(
|
|
73
|
+
title=_("Floating panel mode"),
|
|
74
|
+
description=_("Display mode: inline near selection or centred with blur overlay."),
|
|
75
|
+
values=["inline", "blur"],
|
|
76
|
+
required=False,
|
|
77
|
+
default="inline",
|
|
78
|
+
)
|
|
79
|
+
|
|
80
|
+
floating_panel_width = schema.TextLine(
|
|
81
|
+
title=_("Floating panel width"),
|
|
82
|
+
description=_("Width in pixels (e.g. 500) or 'full' for full viewport width."),
|
|
83
|
+
required=False,
|
|
84
|
+
default="500",
|
|
85
|
+
)
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
class OmniaTinyMCEControlPanelForm(RegistryEditForm):
|
|
89
|
+
label = _("TinyMCE Omnia settings")
|
|
90
|
+
schema = IOmniaTinyMCESettings
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
OmniaTinyMCEControlPanelView = layout.wrap_form(OmniaTinyMCEControlPanelForm, OmniaCoreControlPanelFormWrapper)
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "imio-omnia-tinymce-vendor",
|
|
3
|
+
"lockfileVersion": 3,
|
|
4
|
+
"requires": true,
|
|
5
|
+
"packages": {
|
|
6
|
+
"": {
|
|
7
|
+
"name": "imio-omnia-tinymce-vendor",
|
|
8
|
+
"dependencies": {
|
|
9
|
+
"@imiobe/omnia-tinymce": "0.3.1"
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
"node_modules/@imiobe/omnia-tinymce": {
|
|
13
|
+
"version": "0.3.1",
|
|
14
|
+
"resolved": "https://registry.npmjs.org/@imiobe/omnia-tinymce/-/omnia-tinymce-0.3.1.tgz",
|
|
15
|
+
"integrity": "sha512-8UsPmtIOSmmqMazw8oH2MaiEwvk9It9EomUOqnq2GATXB24drL2/m6VoXMv51uuvRTsG9xJLUQro6lVvnXlDUw==",
|
|
16
|
+
"license": "SEE LICENSE IN LICENSE",
|
|
17
|
+
"dependencies": {
|
|
18
|
+
"motion": "^12.36.0",
|
|
19
|
+
"preact": "^10.29.0"
|
|
20
|
+
},
|
|
21
|
+
"peerDependencies": {
|
|
22
|
+
"tinymce": ">=6.0.0"
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
"node_modules/framer-motion": {
|
|
26
|
+
"version": "12.43.0",
|
|
27
|
+
"resolved": "https://registry.npmjs.org/framer-motion/-/framer-motion-12.43.0.tgz",
|
|
28
|
+
"integrity": "sha512-1eaL3RvR/kAlbG7UYcpMptEyzPoENO0c6w7ZnB3/hh2vSAz/6uGAFn6fdoqTBguNstf3MsFhJHsD/0DHiclG+g==",
|
|
29
|
+
"license": "MIT",
|
|
30
|
+
"dependencies": {
|
|
31
|
+
"motion-dom": "^12.43.0",
|
|
32
|
+
"motion-utils": "^12.39.0",
|
|
33
|
+
"tslib": "^2.4.0"
|
|
34
|
+
},
|
|
35
|
+
"peerDependencies": {
|
|
36
|
+
"@emotion/is-prop-valid": "*",
|
|
37
|
+
"react": "^18.0.0 || ^19.0.0",
|
|
38
|
+
"react-dom": "^18.0.0 || ^19.0.0"
|
|
39
|
+
},
|
|
40
|
+
"peerDependenciesMeta": {
|
|
41
|
+
"@emotion/is-prop-valid": {
|
|
42
|
+
"optional": true
|
|
43
|
+
},
|
|
44
|
+
"react": {
|
|
45
|
+
"optional": true
|
|
46
|
+
},
|
|
47
|
+
"react-dom": {
|
|
48
|
+
"optional": true
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
"node_modules/motion": {
|
|
53
|
+
"version": "12.43.0",
|
|
54
|
+
"resolved": "https://registry.npmjs.org/motion/-/motion-12.43.0.tgz",
|
|
55
|
+
"integrity": "sha512-BQgQbSa9Hn3/mtbib0MK53y6JSANa+YKUKlaYnWzAVDH424RYQ5LVpV3pNiWH00BA2z4ojsSdMzqT7g2FQwjuQ==",
|
|
56
|
+
"license": "MIT",
|
|
57
|
+
"dependencies": {
|
|
58
|
+
"framer-motion": "^12.43.0",
|
|
59
|
+
"tslib": "^2.4.0"
|
|
60
|
+
},
|
|
61
|
+
"peerDependencies": {
|
|
62
|
+
"@emotion/is-prop-valid": "*",
|
|
63
|
+
"react": "^18.0.0 || ^19.0.0",
|
|
64
|
+
"react-dom": "^18.0.0 || ^19.0.0"
|
|
65
|
+
},
|
|
66
|
+
"peerDependenciesMeta": {
|
|
67
|
+
"@emotion/is-prop-valid": {
|
|
68
|
+
"optional": true
|
|
69
|
+
},
|
|
70
|
+
"react": {
|
|
71
|
+
"optional": true
|
|
72
|
+
},
|
|
73
|
+
"react-dom": {
|
|
74
|
+
"optional": true
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
"node_modules/motion-dom": {
|
|
79
|
+
"version": "12.43.0",
|
|
80
|
+
"resolved": "https://registry.npmjs.org/motion-dom/-/motion-dom-12.43.0.tgz",
|
|
81
|
+
"integrity": "sha512-azKON4d9S65PEoFUiQTMTgPheEmzf2QngdRc50AKfJp9Q9mmcBVw22c8eMq9k8kxOFHdL7+WZY7N/5F/lwiDag==",
|
|
82
|
+
"license": "MIT",
|
|
83
|
+
"dependencies": {
|
|
84
|
+
"motion-utils": "^12.39.0"
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
"node_modules/motion-utils": {
|
|
88
|
+
"version": "12.39.0",
|
|
89
|
+
"resolved": "https://registry.npmjs.org/motion-utils/-/motion-utils-12.39.0.tgz",
|
|
90
|
+
"integrity": "sha512-8nadJAJjTtqRkmRF36FoJTrywK9nnFmnPwnSMyxaOCU7GDjN9RTMJIxx9De8ErM+vpPhMccr/6fo5WciyQLnMQ==",
|
|
91
|
+
"license": "MIT"
|
|
92
|
+
},
|
|
93
|
+
"node_modules/preact": {
|
|
94
|
+
"version": "10.29.7",
|
|
95
|
+
"resolved": "https://registry.npmjs.org/preact/-/preact-10.29.7.tgz",
|
|
96
|
+
"integrity": "sha512-DCHYrK/B10yUD3ZjLfhZ3WIE/9Vf9VFUODcRE2dRomTYDpJk6z6L9wecSfhfE6M9ZTHUdyQkoC46arIDhEV84Q==",
|
|
97
|
+
"license": "MIT",
|
|
98
|
+
"funding": {
|
|
99
|
+
"type": "opencollective",
|
|
100
|
+
"url": "https://opencollective.com/preact"
|
|
101
|
+
},
|
|
102
|
+
"peerDependencies": {
|
|
103
|
+
"preact-render-to-string": ">=5"
|
|
104
|
+
},
|
|
105
|
+
"peerDependenciesMeta": {
|
|
106
|
+
"preact-render-to-string": {
|
|
107
|
+
"optional": true
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
"node_modules/tinymce": {
|
|
112
|
+
"version": "8.8.2",
|
|
113
|
+
"resolved": "https://registry.npmjs.org/tinymce/-/tinymce-8.8.2.tgz",
|
|
114
|
+
"integrity": "sha512-wcUGaaAf4XFrQtbZtClbDN/QCqklXLlPt3+7UWliEoosuhnTOJUkXwf7Fzlq7agPnwkKKp1e4JGOhx3O1gWH3g==",
|
|
115
|
+
"license": "SEE LICENSE IN license.md",
|
|
116
|
+
"peer": true
|
|
117
|
+
},
|
|
118
|
+
"node_modules/tslib": {
|
|
119
|
+
"version": "2.8.1",
|
|
120
|
+
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz",
|
|
121
|
+
"integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==",
|
|
122
|
+
"license": "0BSD"
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
File without changes
|
|
@@ -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,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
|