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
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
from plone.app.robotframework.testing import REMOTE_LIBRARY_BUNDLE_FIXTURE
|
|
3
|
+
from plone.app.testing import (
|
|
4
|
+
applyProfile,
|
|
5
|
+
FunctionalTesting,
|
|
6
|
+
IntegrationTesting,
|
|
7
|
+
PloneSandboxLayer,
|
|
8
|
+
)
|
|
9
|
+
from plone.testing import z2
|
|
10
|
+
|
|
11
|
+
import imio.omnia.tinymce
|
|
12
|
+
from imio.omnia.core.testing import IMIO_OMNIA_CORE_FIXTURE
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class ImioOmniaTinyMCELayer(PloneSandboxLayer):
|
|
16
|
+
|
|
17
|
+
defaultBases = (IMIO_OMNIA_CORE_FIXTURE,)
|
|
18
|
+
|
|
19
|
+
def setUpZope(self, app, configurationContext):
|
|
20
|
+
self.loadZCML(package=imio.omnia.tinymce)
|
|
21
|
+
|
|
22
|
+
def setUpPloneSite(self, portal):
|
|
23
|
+
applyProfile(portal, 'imio.omnia.tinymce:default')
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
IMIO_OMNIA_TINYMCE_FIXTURE = ImioOmniaTinyMCELayer()
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
IMIO_OMNIA_TINYMCE_INTEGRATION_TESTING = IntegrationTesting(
|
|
30
|
+
bases=(IMIO_OMNIA_TINYMCE_FIXTURE,),
|
|
31
|
+
name='ImioOmniaTinyMCELayer:IntegrationTesting',
|
|
32
|
+
)
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
IMIO_OMNIA_TINYMCE_FUNCTIONAL_TESTING = FunctionalTesting(
|
|
36
|
+
bases=(IMIO_OMNIA_TINYMCE_FIXTURE,),
|
|
37
|
+
name='ImioOmniaTinyMCELayer:FunctionalTesting',
|
|
38
|
+
)
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
IMIO_OMNIA_TINYMCE_ACCEPTANCE_TESTING = FunctionalTesting(
|
|
42
|
+
bases=(
|
|
43
|
+
IMIO_OMNIA_TINYMCE_FIXTURE,
|
|
44
|
+
REMOTE_LIBRARY_BUNDLE_FIXTURE,
|
|
45
|
+
z2.ZSERVER_FIXTURE,
|
|
46
|
+
),
|
|
47
|
+
name='ImioOmniaTinyMCELayer:AcceptanceTesting',
|
|
48
|
+
)
|
|
File without changes
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# ============================================================================
|
|
2
|
+
# EXAMPLE ROBOT TESTS
|
|
3
|
+
# ============================================================================
|
|
4
|
+
#
|
|
5
|
+
# Run this robot test stand-alone:
|
|
6
|
+
#
|
|
7
|
+
# $ bin/test -s imio.omnia.classification -t test_example.robot --all
|
|
8
|
+
#
|
|
9
|
+
# Run this robot test with robot server (which is faster):
|
|
10
|
+
#
|
|
11
|
+
# 1) Start robot server:
|
|
12
|
+
#
|
|
13
|
+
# $ bin/robot-server --reload-path src imio.omnia.classification.testing.COLLECTIVE_AI_CLASSIFICATION_ACCEPTANCE_TESTING
|
|
14
|
+
#
|
|
15
|
+
# 2) Run robot tests:
|
|
16
|
+
#
|
|
17
|
+
# $ bin/robot src/collective/ai/classification/tests/robot/test_example.robot
|
|
18
|
+
#
|
|
19
|
+
# See the http://docs.plone.org for further details (search for robot
|
|
20
|
+
# framework).
|
|
21
|
+
#
|
|
22
|
+
# ============================================================================
|
|
23
|
+
|
|
24
|
+
*** Settings *****************************************************************
|
|
25
|
+
|
|
26
|
+
Resource plone/app/robotframework/selenium.robot
|
|
27
|
+
Resource plone/app/robotframework/keywords.robot
|
|
28
|
+
|
|
29
|
+
Library Remote ${PLONE_URL}/RobotRemote
|
|
30
|
+
|
|
31
|
+
Test Setup Open test browser
|
|
32
|
+
Test Teardown Close all browsers
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
*** Test Cases ***************************************************************
|
|
36
|
+
|
|
37
|
+
Scenario: As a member I want to be able to log into the website
|
|
38
|
+
[Documentation] Example of a BDD-style (Behavior-driven development) test.
|
|
39
|
+
Given a login form
|
|
40
|
+
When I enter valid credentials
|
|
41
|
+
Then I am logged in
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
*** Keywords *****************************************************************
|
|
45
|
+
|
|
46
|
+
# --- Given ------------------------------------------------------------------
|
|
47
|
+
|
|
48
|
+
a login form
|
|
49
|
+
Go To ${PLONE_URL}/login_form
|
|
50
|
+
Wait until page contains Login Name
|
|
51
|
+
Wait until page contains Password
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
# --- WHEN -------------------------------------------------------------------
|
|
55
|
+
|
|
56
|
+
I enter valid credentials
|
|
57
|
+
Input Text __ac_name admin
|
|
58
|
+
Input Text __ac_password secret
|
|
59
|
+
Click Button Log in
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
# --- THEN -------------------------------------------------------------------
|
|
63
|
+
|
|
64
|
+
I am logged in
|
|
65
|
+
Wait until page contains You are now logged in
|
|
66
|
+
Page should contain You are now logged in
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
from imio.omnia.tinymce.testing import IMIO_OMNIA_TINYMCE_ACCEPTANCE_TESTING
|
|
3
|
+
from plone.app.testing import ROBOT_TEST_LEVEL
|
|
4
|
+
from plone.testing import layered
|
|
5
|
+
|
|
6
|
+
import os
|
|
7
|
+
import robotsuite
|
|
8
|
+
import unittest
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def test_suite():
|
|
12
|
+
suite = unittest.TestSuite()
|
|
13
|
+
current_dir = os.path.abspath(os.path.dirname(__file__))
|
|
14
|
+
robot_dir = os.path.join(current_dir, 'robot')
|
|
15
|
+
robot_tests = [
|
|
16
|
+
os.path.join('robot', doc) for doc in os.listdir(robot_dir)
|
|
17
|
+
if doc.endswith('.robot') and doc.startswith('test_')
|
|
18
|
+
]
|
|
19
|
+
for robot_test in robot_tests:
|
|
20
|
+
robottestsuite = robotsuite.RobotTestSuite(robot_test)
|
|
21
|
+
robottestsuite.level = ROBOT_TEST_LEVEL
|
|
22
|
+
suite.addTests([
|
|
23
|
+
layered(
|
|
24
|
+
robottestsuite,
|
|
25
|
+
layer=IMIO_OMNIA_TINYMCE_ACCEPTANCE_TESTING,
|
|
26
|
+
),
|
|
27
|
+
])
|
|
28
|
+
return suite
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
"""Setup tests for this package."""
|
|
3
|
+
from plone import api
|
|
4
|
+
from plone.app.testing import setRoles
|
|
5
|
+
from plone.app.testing import TEST_USER_ID
|
|
6
|
+
from imio.omnia.tinymce.testing import IMIO_OMNIA_TINYMCE_INTEGRATION_TESTING
|
|
7
|
+
|
|
8
|
+
import unittest
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
try:
|
|
12
|
+
from Products.CMFPlone.utils import get_installer
|
|
13
|
+
except ImportError:
|
|
14
|
+
get_installer = None
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class TestSetup(unittest.TestCase):
|
|
18
|
+
"""Test that imio.omnia.tinymce is properly installed."""
|
|
19
|
+
|
|
20
|
+
layer = IMIO_OMNIA_TINYMCE_INTEGRATION_TESTING
|
|
21
|
+
|
|
22
|
+
def setUp(self):
|
|
23
|
+
"""Custom shared utility setup for tests."""
|
|
24
|
+
self.portal = self.layer['portal']
|
|
25
|
+
if get_installer:
|
|
26
|
+
self.installer = get_installer(self.portal, self.layer['request'])
|
|
27
|
+
else:
|
|
28
|
+
self.installer = api.portal.get_tool('portal_quickinstaller')
|
|
29
|
+
|
|
30
|
+
def test_product_installed(self):
|
|
31
|
+
"""Test if imio.omnia.tinymce is installed."""
|
|
32
|
+
self.assertTrue(self.installer.is_product_installed(
|
|
33
|
+
'imio.omnia.tinymce'))
|
|
34
|
+
|
|
35
|
+
def test_browserlayer(self):
|
|
36
|
+
"""Test that IImioOmniaTinyMCELayer is registered."""
|
|
37
|
+
from imio.omnia.tinymce.interfaces import IImioOmniaTinyMCELayer
|
|
38
|
+
from plone.browserlayer import utils
|
|
39
|
+
self.assertIn(
|
|
40
|
+
IImioOmniaTinyMCELayer,
|
|
41
|
+
utils.registered_layers())
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
class TestUninstall(unittest.TestCase):
|
|
45
|
+
|
|
46
|
+
layer = IMIO_OMNIA_TINYMCE_INTEGRATION_TESTING
|
|
47
|
+
|
|
48
|
+
def setUp(self):
|
|
49
|
+
self.portal = self.layer['portal']
|
|
50
|
+
if get_installer:
|
|
51
|
+
self.installer = get_installer(self.portal, self.layer['request'])
|
|
52
|
+
else:
|
|
53
|
+
self.installer = api.portal.get_tool('portal_quickinstaller')
|
|
54
|
+
roles_before = api.user.get_roles(TEST_USER_ID)
|
|
55
|
+
setRoles(self.portal, TEST_USER_ID, ['Manager'])
|
|
56
|
+
self.installer.uninstall_product('imio.omnia.tinymce')
|
|
57
|
+
setRoles(self.portal, TEST_USER_ID, roles_before)
|
|
58
|
+
|
|
59
|
+
def test_product_uninstalled(self):
|
|
60
|
+
"""Test if imio.omnia.tinymce is cleanly uninstalled."""
|
|
61
|
+
self.assertFalse(self.installer.is_product_installed(
|
|
62
|
+
'imio.omnia.tinymce'))
|
|
63
|
+
|
|
64
|
+
def test_browserlayer_removed(self):
|
|
65
|
+
"""Test that IImioOmniaTinyMCELayer is removed."""
|
|
66
|
+
from imio.omnia.tinymce.interfaces import IImioOmniaTinyMCELayer
|
|
67
|
+
from plone.browserlayer import utils
|
|
68
|
+
self.assertNotIn(IImioOmniaTinyMCELayer, utils.registered_layers())
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
"""Tests for TinyMCE config viewlet generation."""
|
|
3
|
+
import json
|
|
4
|
+
import unittest
|
|
5
|
+
from unittest.mock import patch
|
|
6
|
+
|
|
7
|
+
from plone import api
|
|
8
|
+
from plone.app.testing import setRoles
|
|
9
|
+
from plone.app.testing import TEST_USER_ID
|
|
10
|
+
|
|
11
|
+
from imio.omnia.tinymce.testing import IMIO_OMNIA_TINYMCE_INTEGRATION_TESTING
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class TestOmniaConfigViewlet(unittest.TestCase):
|
|
15
|
+
layer = IMIO_OMNIA_TINYMCE_INTEGRATION_TESTING
|
|
16
|
+
|
|
17
|
+
PREFIX = "imio.omnia.tinymce.browser.controlpanel.IOmniaTinyMCESettings"
|
|
18
|
+
|
|
19
|
+
def setUp(self):
|
|
20
|
+
self.portal = self.layer["portal"]
|
|
21
|
+
self.request = self.layer["request"]
|
|
22
|
+
setRoles(self.portal, TEST_USER_ID, ["Manager"])
|
|
23
|
+
|
|
24
|
+
def _make_viewlet(self):
|
|
25
|
+
from imio.omnia.tinymce.browser.viewlets import OmniaConfigViewlet
|
|
26
|
+
|
|
27
|
+
return OmniaConfigViewlet(self.portal, self.request, None, None)
|
|
28
|
+
|
|
29
|
+
@patch("imio.omnia.tinymce.browser.viewlets.createToken")
|
|
30
|
+
def test_get_config_uses_defaults(self, mock_token):
|
|
31
|
+
mock_token.return_value = "csrf-token"
|
|
32
|
+
|
|
33
|
+
config = self._make_viewlet().get_config()
|
|
34
|
+
|
|
35
|
+
self.assertEqual(
|
|
36
|
+
config["omnia_base_url"], f"{self.portal.absolute_url()}/@@omnia-api"
|
|
37
|
+
)
|
|
38
|
+
self.assertEqual(config["omnia_auth_token"], "csrf-token")
|
|
39
|
+
self.assertEqual(
|
|
40
|
+
config["omnia_enabled_features"],
|
|
41
|
+
[
|
|
42
|
+
"expand-text",
|
|
43
|
+
"improve-text",
|
|
44
|
+
"reduce-text",
|
|
45
|
+
"correct-text",
|
|
46
|
+
"make-accessible",
|
|
47
|
+
"translate-text",
|
|
48
|
+
],
|
|
49
|
+
)
|
|
50
|
+
self.assertTrue(config["omnia_toolbar"])
|
|
51
|
+
self.assertTrue(config["omnia_context_menu"])
|
|
52
|
+
self.assertTrue(config["omnia_shortcuts"])
|
|
53
|
+
self.assertEqual(
|
|
54
|
+
config["omnia_translate_languages"], ["fr", "nl", "de", "en"]
|
|
55
|
+
)
|
|
56
|
+
self.assertEqual(config["omnia_default_translate_language"], "fr")
|
|
57
|
+
self.assertEqual(config["omnia_floating_panel_mode"], "inline")
|
|
58
|
+
self.assertEqual(config["omnia_floating_panel_width"], 500)
|
|
59
|
+
|
|
60
|
+
@patch("imio.omnia.tinymce.browser.viewlets.createToken")
|
|
61
|
+
def test_get_config_preserves_custom_registry_values(self, mock_token):
|
|
62
|
+
mock_token.return_value = "csrf-token"
|
|
63
|
+
api.portal.set_registry_record(
|
|
64
|
+
f"{self.PREFIX}.enabled_features", ("generate", "translate-text")
|
|
65
|
+
)
|
|
66
|
+
api.portal.set_registry_record(f"{self.PREFIX}.show_toolbar", False)
|
|
67
|
+
api.portal.set_registry_record(f"{self.PREFIX}.show_context_menu", False)
|
|
68
|
+
api.portal.set_registry_record(f"{self.PREFIX}.enable_shortcuts", False)
|
|
69
|
+
api.portal.set_registry_record(
|
|
70
|
+
f"{self.PREFIX}.translate_languages", ("en", "es")
|
|
71
|
+
)
|
|
72
|
+
api.portal.set_registry_record(
|
|
73
|
+
f"{self.PREFIX}.default_translate_language", "es"
|
|
74
|
+
)
|
|
75
|
+
api.portal.set_registry_record(f"{self.PREFIX}.floating_panel_mode", "blur")
|
|
76
|
+
api.portal.set_registry_record(
|
|
77
|
+
f"{self.PREFIX}.floating_panel_width", "full"
|
|
78
|
+
)
|
|
79
|
+
|
|
80
|
+
config = self._make_viewlet().get_config()
|
|
81
|
+
|
|
82
|
+
self.assertEqual(
|
|
83
|
+
config["omnia_enabled_features"], ["generate", "translate-text"]
|
|
84
|
+
)
|
|
85
|
+
self.assertFalse(config["omnia_toolbar"])
|
|
86
|
+
self.assertFalse(config["omnia_context_menu"])
|
|
87
|
+
self.assertFalse(config["omnia_shortcuts"])
|
|
88
|
+
self.assertEqual(config["omnia_translate_languages"], ["en", "es"])
|
|
89
|
+
self.assertEqual(config["omnia_default_translate_language"], "es")
|
|
90
|
+
self.assertEqual(config["omnia_floating_panel_mode"], "blur")
|
|
91
|
+
self.assertEqual(config["omnia_floating_panel_width"], "full")
|
|
92
|
+
|
|
93
|
+
@patch("imio.omnia.tinymce.browser.viewlets.createToken")
|
|
94
|
+
def test_config_json_serializes_config(self, mock_token):
|
|
95
|
+
mock_token.return_value = "csrf-token"
|
|
96
|
+
|
|
97
|
+
payload = self._make_viewlet().config_json()
|
|
98
|
+
|
|
99
|
+
self.assertEqual(json.loads(payload)["omnia_auth_token"], "csrf-token")
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import sys, types, os;p = os.path.join(sys._getframe(1).f_locals['sitedir'], *('imio',));importlib = __import__('importlib.util');__import__('importlib.machinery');m = sys.modules.setdefault('imio', importlib.util.module_from_spec(importlib.machinery.PathFinder.find_spec('imio', [os.path.dirname(p)])));m = m or sys.modules.setdefault('imio', types.ModuleType('imio'));mp = (m or []) and m.__dict__.setdefault('__path__',[]);(p not in mp) and mp.append(p)
|
|
2
|
+
import sys, types, os;p = os.path.join(sys._getframe(1).f_locals['sitedir'], *('imio', 'omnia'));importlib = __import__('importlib.util');__import__('importlib.machinery');m = sys.modules.setdefault('imio.omnia', importlib.util.module_from_spec(importlib.machinery.PathFinder.find_spec('imio.omnia', [os.path.dirname(p)])));m = m or sys.modules.setdefault('imio.omnia', types.ModuleType('imio.omnia'));mp = (m or []) and m.__dict__.setdefault('__path__',[]);(p not in mp) and mp.append(p);m and setattr(sys.modules['imio'], 'omnia', m)
|
|
@@ -0,0 +1,294 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: imio.omnia.tinymce
|
|
3
|
+
Version: 1.0
|
|
4
|
+
Summary: TinyMCE plugin integrating iMio's Omnia AI API for Plone
|
|
5
|
+
Home-page: https://gitlab.imio.be/imio/imio.omnia.tinymce
|
|
6
|
+
Author: Antoine Duchêne
|
|
7
|
+
Author-email: antoine.duchene@imio.be
|
|
8
|
+
License: GPL version 2
|
|
9
|
+
Keywords: Python Plone CMS TinyMCE AI Omnia
|
|
10
|
+
Classifier: Environment :: Web Environment
|
|
11
|
+
Classifier: Framework :: Plone
|
|
12
|
+
Classifier: Framework :: Plone :: Addon
|
|
13
|
+
Classifier: Framework :: Plone :: 6.1
|
|
14
|
+
Classifier: Programming Language :: Python
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
16
|
+
Classifier: Operating System :: OS Independent
|
|
17
|
+
Classifier: License :: OSI Approved :: GNU General Public License v2 (GPLv2)
|
|
18
|
+
Requires-Python: >=3.12
|
|
19
|
+
License-File: LICENSE.GPL
|
|
20
|
+
License-File: LICENSE.rst
|
|
21
|
+
Requires-Dist: setuptools
|
|
22
|
+
Requires-Dist: z3c.jbot
|
|
23
|
+
Requires-Dist: plone.api>=1.8.4
|
|
24
|
+
Requires-Dist: plone.app.dexterity
|
|
25
|
+
Requires-Dist: imio.omnia.core
|
|
26
|
+
Provides-Extra: test
|
|
27
|
+
Requires-Dist: plone.app.testing; extra == "test"
|
|
28
|
+
Requires-Dist: plone.testing>=5.0.0; extra == "test"
|
|
29
|
+
Requires-Dist: plone.app.contenttypes; extra == "test"
|
|
30
|
+
Requires-Dist: plone.app.robotframework[debug]; extra == "test"
|
|
31
|
+
Dynamic: author
|
|
32
|
+
Dynamic: author-email
|
|
33
|
+
Dynamic: classifier
|
|
34
|
+
Dynamic: description
|
|
35
|
+
Dynamic: home-page
|
|
36
|
+
Dynamic: keywords
|
|
37
|
+
Dynamic: license
|
|
38
|
+
Dynamic: license-file
|
|
39
|
+
Dynamic: provides-extra
|
|
40
|
+
Dynamic: requires-dist
|
|
41
|
+
Dynamic: requires-python
|
|
42
|
+
Dynamic: summary
|
|
43
|
+
|
|
44
|
+
===================
|
|
45
|
+
imio.omnia.tinymce
|
|
46
|
+
===================
|
|
47
|
+
|
|
48
|
+
AI-powered text actions inside the Plone 6 TinyMCE editor, part of the
|
|
49
|
+
`Omnia <https://gitlab.imio.be/imio/imio.omnia>`_ suite by iMio.
|
|
50
|
+
|
|
51
|
+
This package adds a TinyMCE plugin that lets editors expand, improve, reduce,
|
|
52
|
+
correct, translate or make text accessible — all without leaving the rich-text
|
|
53
|
+
editor. It relies on ``imio.omnia.core`` for API connectivity and the shared
|
|
54
|
+
Omnia control panel.
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
Features
|
|
58
|
+
========
|
|
59
|
+
|
|
60
|
+
The plugin ships seven AI actions, each available from the toolbar button, the
|
|
61
|
+
right-click context menu, and a keyboard shortcut chord
|
|
62
|
+
(``Alt+O`` then an action key):
|
|
63
|
+
|
|
64
|
+
==================== ==== ===========================================================
|
|
65
|
+
Action Key Description
|
|
66
|
+
==================== ==== ===========================================================
|
|
67
|
+
Expand text d Make the selected text longer
|
|
68
|
+
Improve text a Enhance style and quality
|
|
69
|
+
Reduce text r Shorten the selected text
|
|
70
|
+
Correct text c Fix spelling and grammar
|
|
71
|
+
Make accessible x Simplify for WCAG / easy-read compliance
|
|
72
|
+
Translate text t Translate to a target language
|
|
73
|
+
Generate (*) g Create new content from a free-text prompt (side panel)
|
|
74
|
+
==================== ==== ===========================================================
|
|
75
|
+
|
|
76
|
+
(*) The *generate* action is disabled by default — it is not yet exposed by
|
|
77
|
+
the upstream API.
|
|
78
|
+
|
|
79
|
+
Text transformation actions open a **floating panel** near the selection (or
|
|
80
|
+
centred with a blur overlay, depending on the chosen mode). The *generate*
|
|
81
|
+
action opens a **side panel** with prompt input and a history carousel.
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
Installation
|
|
85
|
+
============
|
|
86
|
+
|
|
87
|
+
Add the egg to your buildout::
|
|
88
|
+
|
|
89
|
+
[buildout]
|
|
90
|
+
|
|
91
|
+
...
|
|
92
|
+
|
|
93
|
+
eggs =
|
|
94
|
+
imio.omnia.tinymce
|
|
95
|
+
|
|
96
|
+
Then run ``bin/buildout``.
|
|
97
|
+
|
|
98
|
+
The package is auto-included in Plone via ``z3c.autoinclude.plugin``, so no
|
|
99
|
+
ZCML slug is needed.
|
|
100
|
+
|
|
101
|
+
``imio.omnia.core`` must be installed first. Declare the GenericSetup
|
|
102
|
+
dependency in your profile's ``metadata.xml`` if you build on top of this
|
|
103
|
+
package::
|
|
104
|
+
|
|
105
|
+
<?xml version="1.0"?>
|
|
106
|
+
<metadata>
|
|
107
|
+
<version>1000</version>
|
|
108
|
+
<dependencies>
|
|
109
|
+
<dependency>profile-imio.omnia.tinymce:default</dependency>
|
|
110
|
+
</dependencies>
|
|
111
|
+
</metadata>
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
Configuration
|
|
115
|
+
=============
|
|
116
|
+
|
|
117
|
+
All settings are editable from the **TinyMCE** tab of the Omnia control panel
|
|
118
|
+
(Site Setup > Omnia > ``@@omnia-tinymce-settings``).
|
|
119
|
+
|
|
120
|
+
Registry settings
|
|
121
|
+
-----------------
|
|
122
|
+
|
|
123
|
+
Stored under the prefix ``imio.omnia.tinymce.browser.controlpanel.IOmniaTinyMCESettings``:
|
|
124
|
+
|
|
125
|
+
============================== =====================================================================================
|
|
126
|
+
Field Purpose
|
|
127
|
+
============================== =====================================================================================
|
|
128
|
+
``enabled_features`` Tuple of active actions (default: all except *generate*)
|
|
129
|
+
``show_toolbar`` Display the Omnia toolbar button (default: ``True``)
|
|
130
|
+
``show_context_menu`` Display entries in the context menu (default: ``True``)
|
|
131
|
+
``enable_shortcuts`` Enable keyboard shortcuts (default: ``True``)
|
|
132
|
+
``translate_languages`` Available translation language codes (default: fr, nl, de, en; all options: fr, nl,
|
|
133
|
+
de, en, es, it)
|
|
134
|
+
``default_translate_language`` Default target language (default: ``fr``)
|
|
135
|
+
``floating_panel_mode`` ``inline`` (near selection) or ``blur`` (centred overlay)
|
|
136
|
+
``floating_panel_width`` Width in pixels (e.g. ``500``) or ``full``
|
|
137
|
+
============================== =====================================================================================
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
How it works
|
|
141
|
+
============
|
|
142
|
+
|
|
143
|
+
Plugin loading
|
|
144
|
+
--------------
|
|
145
|
+
|
|
146
|
+
The TinyMCE plugin is registered via three Plone registry records set by the
|
|
147
|
+
default GenericSetup profile:
|
|
148
|
+
|
|
149
|
+
- ``plone.custom_plugins`` — registers the ``omnia`` plugin JS
|
|
150
|
+
(``++plone++imio.omnia.tinymce/omnia-tinymce.js``).
|
|
151
|
+
- ``plone.custom_buttons`` — adds the ``omnia`` button to the TinyMCE toolbar.
|
|
152
|
+
- ``plone.bundles/omnia-tinymce`` — loads the scoped CSS bundle globally.
|
|
153
|
+
|
|
154
|
+
Config bridge (viewlet)
|
|
155
|
+
-----------------------
|
|
156
|
+
|
|
157
|
+
An ``OmniaConfigViewlet`` registered in ``plone.htmlhead`` renders a
|
|
158
|
+
``<script>`` tag that monkey-patches ``tinymce.init()`` to inject ``omnia_*``
|
|
159
|
+
options read from the Plone registry. This bridges:
|
|
160
|
+
|
|
161
|
+
- Settings from ``IOmniaCoreSettings`` — base URL, application ID,
|
|
162
|
+
municipality ID.
|
|
163
|
+
- Settings from ``IOmniaTinyMCESettings`` — enabled features, UI mode,
|
|
164
|
+
shortcuts, translation languages, panel dimensions.
|
|
165
|
+
- An ``omnia_auth_token`` — a Plone CSRF authenticator token required by the
|
|
166
|
+
``@@omnia-api`` proxy for every POST request.
|
|
167
|
+
|
|
168
|
+
API requests go through the ``@@omnia-api`` proxy view provided by
|
|
169
|
+
``imio.omnia.core``, so no API credentials are exposed to the browser. By
|
|
170
|
+
default, callers must have the
|
|
171
|
+
``imio.omnia.core: Access Omnia API proxy`` permission, which
|
|
172
|
+
``imio.omnia.core`` grants to ``Authenticated`` users.
|
|
173
|
+
|
|
174
|
+
Uninstall
|
|
175
|
+
---------
|
|
176
|
+
|
|
177
|
+
The uninstall handler removes the ``omnia`` entries from
|
|
178
|
+
``plone.custom_plugins`` and ``plone.custom_buttons``, and disables the CSS
|
|
179
|
+
bundle.
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
Frontend development
|
|
183
|
+
====================
|
|
184
|
+
|
|
185
|
+
The TinyMCE plugin source lives in ``browser/resources/`` as a **git
|
|
186
|
+
submodule** (``ia/omnia-tinymce``). Built artifacts are committed to
|
|
187
|
+
``browser/static/``.
|
|
188
|
+
|
|
189
|
+
Rebuild after JS changes::
|
|
190
|
+
|
|
191
|
+
make build-js # npm ci + vite build + copy to static/
|
|
192
|
+
make clean-js # remove built artifacts
|
|
193
|
+
|
|
194
|
+
Run the Storybook dev environment::
|
|
195
|
+
|
|
196
|
+
make dev # Storybook on http://localhost:6006
|
|
197
|
+
|
|
198
|
+
The frontend stack uses **Vite** (library mode), **Preact**, **Tailwind CSS
|
|
199
|
+
v4** (``om:`` prefix, scoped to ``[data-omnia]``), and **Motion** for drag /
|
|
200
|
+
resize.
|
|
201
|
+
|
|
202
|
+
|
|
203
|
+
Translations
|
|
204
|
+
============
|
|
205
|
+
|
|
206
|
+
This product has been translated into:
|
|
207
|
+
|
|
208
|
+
- English
|
|
209
|
+
- French
|
|
210
|
+
|
|
211
|
+
|
|
212
|
+
Authors
|
|
213
|
+
=======
|
|
214
|
+
|
|
215
|
+
- `iMio, SCRL <https://imio.be>`_
|
|
216
|
+
- Antoine Duchene
|
|
217
|
+
|
|
218
|
+
|
|
219
|
+
License
|
|
220
|
+
=======
|
|
221
|
+
|
|
222
|
+
The project is licensed under the GPLv2.
|
|
223
|
+
|
|
224
|
+
|
|
225
|
+
Contributors
|
|
226
|
+
============
|
|
227
|
+
|
|
228
|
+
- Antoine Duchêne, antoine.duchene@imio.be
|
|
229
|
+
|
|
230
|
+
|
|
231
|
+
Changelog
|
|
232
|
+
=========
|
|
233
|
+
|
|
234
|
+
|
|
235
|
+
1.0 (2026-08-03)
|
|
236
|
+
----------------
|
|
237
|
+
|
|
238
|
+
- Build the JS bundle from the published `@imiobe/omnia-tinymce` npm package (pinned to 0.3.0) instead of the git submodule sources.
|
|
239
|
+
[thomlamb]
|
|
240
|
+
|
|
241
|
+
|
|
242
|
+
1.0a4 (2026-04-03)
|
|
243
|
+
------------------
|
|
244
|
+
|
|
245
|
+
- Update the JS bundle.
|
|
246
|
+
[aduchene]
|
|
247
|
+
|
|
248
|
+
|
|
249
|
+
1.0a3 (2026-04-03)
|
|
250
|
+
------------------
|
|
251
|
+
|
|
252
|
+
- Load imio.omnia.core ZCML.
|
|
253
|
+
[aduchene]
|
|
254
|
+
|
|
255
|
+
|
|
256
|
+
1.0a2 (2026-04-03)
|
|
257
|
+
------------------
|
|
258
|
+
|
|
259
|
+
- Re-release because ZCML files were lacking.
|
|
260
|
+
[aduchene]
|
|
261
|
+
|
|
262
|
+
|
|
263
|
+
1.0a1 (2026-04-03)
|
|
264
|
+
------------------
|
|
265
|
+
|
|
266
|
+
- Initial release.
|
|
267
|
+
[duchenean]
|
|
268
|
+
- Added TinyMCE AI plugin with 7 text actions: generate, expand, improve,
|
|
269
|
+
reduce, correct, translate, and make accessible.
|
|
270
|
+
[duchenean]
|
|
271
|
+
- Added toolbar button, context menu entry, and keyboard shortcuts for
|
|
272
|
+
triggering AI actions on selected text.
|
|
273
|
+
[duchenean]
|
|
274
|
+
- Added floating panel with two display modes: ``inline`` (near selection)
|
|
275
|
+
and ``blur`` (centred with overlay), with configurable width.
|
|
276
|
+
[duchenean]
|
|
277
|
+
- Added translation support with 6 languages (fr, nl, de, en, es, it) and
|
|
278
|
+
configurable default target language.
|
|
279
|
+
[duchenean]
|
|
280
|
+
- Added control panel tab (``@@omnia-tinymce-settings``) in the shared
|
|
281
|
+
Omnia settings UI: per-feature enable/disable, toolbar/context menu/shortcut
|
|
282
|
+
toggles, translation languages, and panel display settings.
|
|
283
|
+
[duchenean]
|
|
284
|
+
- Added viewlet config bridge injecting Omnia settings into TinyMCE init
|
|
285
|
+
via monkey-patched ``tinymce.init``.
|
|
286
|
+
[duchenean]
|
|
287
|
+
- Added TinyMCE plugin registration via ``plone.custom_plugins`` and CSS
|
|
288
|
+
bundle via ``plone.bundles/omnia-tinymce`` with Tailwind CSS scoped to
|
|
289
|
+
``[data-omnia]``.
|
|
290
|
+
[duchenean]
|
|
291
|
+
- Added clean uninstall removing plugin registrations and CSS bundle.
|
|
292
|
+
[duchenean]
|
|
293
|
+
- Added i18n support (en, fr).
|
|
294
|
+
[duchenean]
|