Metadata-Version: 2.4
Name: imio.omnia.tinymce
Version: 2.0
Summary: TinyMCE plugin integrating iMio's Omnia AI API for Plone
Home-page: https://github.com/IMIO/imio.omnia.tinymce
Author: Antoine Duchêne
Author-email: antoine.duchene@imio.be
License-Expression: GPL-2.0-only
Project-URL: Source, https://github.com/IMIO/imio.omnia.tinymce
Project-URL: Tracker, https://github.com/IMIO/imio.omnia.tinymce/issues
Keywords: Python Plone CMS TinyMCE AI Omnia
Classifier: Development Status :: 5 - Production/Stable
Classifier: Environment :: Web Environment
Classifier: Framework :: Plone
Classifier: Framework :: Plone :: Addon
Classifier: Framework :: Plone :: 6.2
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Operating System :: OS Independent
Requires-Python: >=3.12
License-File: LICENSE.GPL
License-File: LICENSE.rst
Requires-Dist: z3c.jbot
Requires-Dist: plone.api>=1.8.4
Requires-Dist: imio.omnia.core
Requires-Dist: collective.z3cform.datagridfield
Requires-Dist: plone.app.layout
Requires-Dist: plone.app.registry
Requires-Dist: plone.autoform
Requires-Dist: plone.protect
Requires-Dist: plone.registry
Requires-Dist: plone.z3cform
Requires-Dist: Products.CMFPlone
Requires-Dist: Products.GenericSetup
Requires-Dist: Zope
Provides-Extra: test
Requires-Dist: plone.app.testing; extra == "test"
Requires-Dist: plone.testing>=5.0.0; extra == "test"
Requires-Dist: plone.app.robotframework[debug]; extra == "test"
Requires-Dist: plone.browserlayer; extra == "test"
Requires-Dist: robotsuite; extra == "test"
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: home-page
Dynamic: keywords
Dynamic: license-file
Dynamic: license-expression
Dynamic: project-url
Dynamic: provides-extra
Dynamic: requires-dist
Dynamic: requires-python
Dynamic: summary

===================
imio.omnia.tinymce
===================

AI-powered text actions inside the Plone 6 TinyMCE editor, part of the
`Omnia <https://gitlab.imio.be/imio/imio.omnia>`_ suite by iMio.

This package adds a TinyMCE plugin that lets editors expand, improve, reduce,
correct, translate or make text accessible — all without leaving the rich-text
editor. It relies on ``imio.omnia.core`` for API connectivity and the shared
Omnia control panel.


Features
========

The plugin ships seven AI actions, each available from the toolbar button, the
right-click context menu, and a keyboard shortcut chord
(``Alt+O`` then an action key):

====================  ====  ===========================================================
Action                Key   Description
====================  ====  ===========================================================
Expand text           d     Make the selected text longer
Improve text          a     Enhance style and quality
Reduce text           r     Shorten the selected text
Correct text          c     Fix spelling and grammar
Structure text        s     Fix headings and turn enumerations into lists (accessibility)
Simplify text         l     Short sentences, one idea per sentence (easier to read)
Translate text        t     Translate to a target language
Generate (*)          g     Create new content from a free-text prompt (side panel)
====================  ====  ===========================================================

(*) The *generate* action is disabled by default — it is not yet exposed by
the upstream API.

Text transformation actions open a **floating panel** near the selection (or
centred with a blur overlay, depending on the chosen mode). The *generate*
action opens a **side panel** with prompt input and a history carousel.


Installation
============

Add the egg to your buildout::

    [buildout]

    ...

    eggs =
        imio.omnia.tinymce

Then run ``bin/buildout``.

The package is auto-included in Plone via ``z3c.autoinclude.plugin``, so no
ZCML slug is needed.

``imio.omnia.core`` must be installed first. Declare the GenericSetup
dependency in your profile's ``metadata.xml`` if you build on top of this
package::

    <?xml version="1.0"?>
    <metadata>
      <version>1000</version>
      <dependencies>
        <dependency>profile-imio.omnia.tinymce:default</dependency>
      </dependencies>
    </metadata>


Configuration
=============

All settings are editable from the **TinyMCE** tab of the Omnia control panel
(Site Setup > Omnia > ``@@omnia-tinymce-settings``).

Registry settings
-----------------

Stored under the prefix ``imio.omnia.tinymce.browser.controlpanel.IOmniaTinyMCESettings``:

==============================  =====================================================================================
Field                           Purpose
==============================  =====================================================================================
``enabled_features``            Tuple of active actions (default: all except *generate*)
``show_toolbar``                Display the Omnia toolbar button (default: ``True``)
``show_context_menu``           Display entries in the context menu (default: ``True``)
``enable_shortcuts``            Enable keyboard shortcuts (default: ``True``)
``translate_languages``         Available translation language codes (default: fr, nl, de, en; all options: fr, nl,
                                de, en, es, it)
``default_translate_language``  Default target language (default: ``fr``)
``floating_panel_mode``         ``inline`` (near selection) or ``blur`` (centred overlay)
``floating_panel_width``        Width in pixels (e.g. ``500``) or ``full``
==============================  =====================================================================================


How it works
============

Plugin loading
--------------

The TinyMCE plugin is registered via three Plone registry records set by the
default GenericSetup profile:

- ``plone.custom_plugins`` — registers the ``omnia`` plugin JS
  (``++plone++imio.omnia.tinymce/omnia-tinymce.js``).
- ``plone.custom_buttons`` — adds the ``omnia`` button to the TinyMCE toolbar.
- ``plone.bundles/omnia-tinymce`` — loads the scoped CSS bundle globally.

Config bridge (viewlet)
-----------------------

An ``OmniaConfigViewlet`` registered in ``plone.htmlhead`` renders a
``<script>`` tag that monkey-patches ``tinymce.init()`` to inject ``omnia_*``
options read from the Plone registry. This bridges:

- Settings from ``IOmniaCoreSettings`` — base URL, application ID,
  municipality ID.
- Settings from ``IOmniaTinyMCESettings`` — enabled features, UI mode,
  shortcuts, translation languages, panel dimensions.
- An ``omnia_auth_token`` — a Plone CSRF authenticator token required by the
  ``@@omnia-api`` proxy for every POST request.

API requests go through the ``@@omnia-api`` proxy view provided by
``imio.omnia.core``, so no API credentials are exposed to the browser. By
default, callers must have the
``imio.omnia.core: Access Omnia API proxy`` permission, which
``imio.omnia.core`` grants to ``Authenticated`` users.

Uninstall
---------

The uninstall handler removes the ``omnia`` entries from
``plone.custom_plugins`` and ``plone.custom_buttons``, and disables the CSS
bundle.


Frontend development
====================

The TinyMCE plugin is developed in its own project (``ia/omnia-tinymce`` on
iMio's GitLab) and published as the npm package ``@imiobe/omnia-tinymce``.
``browser/npm/package.json`` pins the version used here. Its built files are
copied to ``browser/static/``, which is committed::

    make update-js         # npm install + copy dist/ to static/
    make clean-js          # remove built artifacts

To use a newer version, change it in ``browser/npm/package.json``, run
``make update-js``, then commit ``package.json``, ``package-lock.json`` and
the two files in ``static/``.


Translations
============

This product has been translated into:

- English
- French


Authors
=======

- `iMio, SCRL <https://imio.be>`_
- Antoine Duchene


License
=======

The project is licensed under the GPLv2.


Contributors
============

- Antoine Duchêne, antoine.duchene@imio.be


Changelog
=========


2.0 (2026-12-01)
----------------

- Document the plone.meta tox environments in ``DEVELOP.rst``.
  [boulch]

- Fix the example robot test, which tox now runs (``zope-testrunner --all``):
  open the browser in a 1280 x 1024 window, so the login form's button is
  visible and clickable. Ignore the robot test outputs in git.
  [boulch]

- Support Python 3.13 and 3.14: add their classifiers and test Plone 6.2 on
  them.
  [boulch]

- Drop Plone 6.1: the package supports Plone 6.2 and later. Remove the 6.1
  classifier, ``test_plone61.cfg``, ``requirements_plone61.txt`` and
  ``constraints_plone61.txt``. ``requirements.txt`` takes the content of
  ``requirements-6.2.txt``.
  [boulch]

- Declare the packages the code imports in ``setup.py``. Remove
  ``plone.app.dexterity`` and the ``plone.app.contenttypes`` test
  requirement, which the package does not use.
  [boulch]

- Apply the plone.meta pre-commit hooks (pyupgrade, isort, black, zpretty).
  Remove two unused imports.
  [boulch]

- Configure the package with plone.meta: generated ``tox.ini``, pre-commit
  hooks, ``pyproject.toml`` and GitHub Actions workflows. The generated
  ``test-matrix.yml`` (Plone 6.2, Python 3.12) replaces the
  ``plone-package-test-gha.yml`` workflow. Add the Development Status
  classifier, declare the license as ``GPL-2.0-only`` and point the project
  URLs to GitHub.
  [boulch]

- OIA-30: Replace the ``make-accessible`` feature with ``structure-text``
  (« Structurer pour l'accessibilité ») and ``simplify-text``
  (« Faciliter la lecture »). An upgrade step replaces ``make-accessible``
  in the enabled features of existing sites.
  [thomlamb]

- Bump the bundled ``@imiobe/omnia-tinymce`` npm package to 0.4.1.
  [thomlamb]

- Remove the unused ``browser/resources`` git submodule (``ia/omnia-tinymce``).
  The JS bundle comes from the npm package since 1.0, and the submodule's
  private SSH URL broke ``git submodule update`` in buildouts and CI.
  [thomlamb]

- Use native namespace packages (PEP 420). Remove the ``pkg_resources``
  namespace declarations. Use ``importlib.resources`` in ``update_locale``.
  Add the Plone 6.2 classifier.
  [boulch]

- Add ``test_plone62.cfg``, ``requirements-6.2.txt`` and a GitHub Actions
  workflow that runs the tests on Plone 6.2.
  [boulch]

- Format the code with black.
  [boulch]


1.1 (2026-11-16)
----------------

- DELIBE-344: Render the ``omnia-tinymce-config`` viewlet only for users who can use
  the ``@@omnia-api`` proxy. Anonymous pages no longer show the proxy URL and a CSRF token.
  [aduchene]


1.0 (2026-08-03)
----------------

- Build the JS bundle from the published `@imiobe/omnia-tinymce` npm package (pinned to 0.3.0) instead of the git submodule sources.
  [thomlamb]


1.0a4 (2026-04-03)
------------------

- Update the JS bundle.
  [aduchene]


1.0a3 (2026-04-03)
------------------

- Load imio.omnia.core ZCML.
  [aduchene]


1.0a2 (2026-04-03)
------------------

- Re-release because ZCML files were lacking.
  [aduchene]


1.0a1 (2026-04-03)
------------------

- Initial release.
  [duchenean]
- Added TinyMCE AI plugin with 7 text actions: generate, expand, improve,
  reduce, correct, translate, and make accessible.
  [duchenean]
- Added toolbar button, context menu entry, and keyboard shortcuts for
  triggering AI actions on selected text.
  [duchenean]
- Added floating panel with two display modes: ``inline`` (near selection)
  and ``blur`` (centred with overlay), with configurable width.
  [duchenean]
- Added translation support with 6 languages (fr, nl, de, en, es, it) and
  configurable default target language.
  [duchenean]
- Added control panel tab (``@@omnia-tinymce-settings``) in the shared
  Omnia settings UI: per-feature enable/disable, toolbar/context menu/shortcut
  toggles, translation languages, and panel display settings.
  [duchenean]
- Added viewlet config bridge injecting Omnia settings into TinyMCE init
  via monkey-patched ``tinymce.init``.
  [duchenean]
- Added TinyMCE plugin registration via ``plone.custom_plugins`` and CSS
  bundle via ``plone.bundles/omnia-tinymce`` with Tailwind CSS scoped to
  ``[data-omnia]``.
  [duchenean]
- Added clean uninstall removing plugin registrations and CSS bundle.
  [duchenean]
- Added i18n support (en, fr).
  [duchenean]
