Static text portlet, Plone 4, plone.app.widgets 1.x

For Plone 4 sites using plone.app.widgets 1.x, the static text portlet is broken in number of ways (TinyMCE configuration, etc). I can fix this by modifying plone.portlet.static to play nice with newer-than-supported plone.app.portlets versions, but this seems to have side effects on other portlets.

I tried plone.app.portlets 3.0.2, plone.app.widgets 1.x HEAD plus plone.portlet.static HEAD with modifications [1] to use z3c.form based static portlet, with success. But this has the side effect of breaking other portlets, like Navigation, etc. I get the sense that there's not a version of plone.app.portlets beyond 2.5.4 that actually works with Plone 4, which leaves me stuck.

I need to know if it is a fools errand to try and backport z3c.form-based portlets to Plone 4? My goal is to not have a zero sum game between using plone.app.widgets and static text portlets in Plone 4. Thoughts? Should I just try to JBOT the broken formlib-based portlet instead?

Sean

[1] My experimental modifications to plone.portlet.static to make the text field work like the way TinyMCE would work in a Dexterity content form, of course predicated on possibility that there is a z3c.form-based plone.app.portlets that will actually work in Plone 4 at all https://github.com/upiq/plone.portlet.static/commit/96187aea0a161c023a2e5c3f720494210387c9a1

I should clarify, what matters is getting AutoExtensibleForm-based portlet as the means to use a configured widget (via directive). I could, I suppose, try adding an updateWidgets() to the non-autoform based portlet forms in plone.portlet.static to allow me to continue to use plone.app.portlets 2.5.x?

I also ran into this problem (TinyMCE not loading in Static Text portlet on Plone 4.3), and created a fork with a fix. It's available at http://dist.sixfeetup.com/public/ as plone.portlet.static version 3.0.1.1

For the record, I had submitted this fix as a PR, but a different PR was accepted instead (the code for it was simpler), and that became version 3.0.2. I have not tested that version, but I suspect 3.0.1.1 will work for you.

Thanks for linking to this, here is my initial assessment of the situation:

(1) Your fix should work, but only if plone.app.contenttypes is installed (cannot import RichTextFieldWidget without). I'm just trying to use widgets 1.x without p.a.contenttypes. This could be modified to work around (conditional import and redefinition of RichTextFieldWidget factory function is simple enough).

(2) @thet's fix here does not accomplish the same thing as your fork, it only preserves status-quo functionality for Plone 4 (but widget configuration will not work). Things that are broken without the configuration that plone.app.widgets.dx.RichTextWidget is providing include: browsing links, browsing images, any button, plugin, or style configuration. What one gets here is a stock TinyMCE 4 that breaks in subtle ways.

(3) Upload through TinyMCE from static portlet is broken AFAICT no matter what (though I have not tested all permutations).

I think I may try to experiment building on what you put together here:

... I am hoping that a minor change here might allow me to use your fork without installing plone.app.contenttypes (so that plone.app.widgets 1.x will expose the factory for the widget). OTOH, I might just expose the widget factory in plone.app.widgets 1.x regardless of plone.app.contenttypes installation status.

I will update this thread once I come to some kind of workable conclusion.

Sean

I have not yet created a pull request for plone.app.widgets 1.x branch, as I am working through a laundry list of fixes, but this commit on my fork will make's @cdw9's plone.portlet.static fork work nicely on Plone 4 sites using plone.app.widgets, but not plone.app.contenttypes:

https://github.com/upiq/plone.app.widgets/commit/d13d74e6817eac0335fa97c7e8888fd9fac3c8dc

1 Like

@cdw9: with this commit to my fork of plone.app.widgets 1.x, TinyMCE now plays nice with your plone.portlet.static fork for uploads and link browsing root for the static text portlet:

https://github.com/upiq/plone.app.widgets/commit/7feaa070b93256d8f3028b619dc31c0215afbaf9

I am going to aim to submit pull request for 1.x branch of plone.app.widgets sometime later this week.

@cdw9 @thet: I have made an attempt (still on forks, no PRs yet) to harmonize plone.portlet.static and plone.app.widgets based on work you both have done thus far -- here are my attempts:

https://github.com/upiq/plone.portlet.static/commit/1b580dad81721e9c99be4dd36a767d312aa1ce07

https://github.com/upiq/plone.app.widgets/commit/d13d74e6817eac0335fa97c7e8888fd9fac3c8dc

https://github.com/upiq/plone.app.widgets/commit/7feaa070b93256d8f3028b619dc31c0215afbaf9

The result of these, collectively, are the following improvements:

  • TinyMCE pattern is configured consistently with other uses on site.
  • No need to port the formhelpers from newer plone.app.portlets, I just mixed in AutoExtensibleForm (though I did need to use conditional imports for this).
  • Folder context for links is not assignment manager, but folder content.
  • Upload context is likelwise adjusted, and uploads through TinyMCE in static text portlet now work.

I may submit pull request(s) as soon as tomorrow, but I'm still working on some other fixes in plone.app.widgets 1.x branch.

Sean