Image Captions from Plone 5.1

Hi.

We know that in the version 5.1.x of plone the subtitles of images is not available in TinyMCE.

My team and I have set ourselves the goal of solving this problem with the intention of releasing a new version of plone 5.1.x

We do not see as a possible option to move to plone 5.2.2 which is the version that enables this functionality again.

Solutions that DIazo intervenes are discarded.

We will take this as the baseline: https://github.com/plone/mockup/pull/911

We know that the solution involves 3 libraries

The first problem we see is how to do this update for static resources because in the version we have (5.1.x) this does not exist.

From there we can go forward.

Any help / suggestion is welcome.

We have to do this before this version is out of support.

Version Overview

Plone 5.1.6 (5116)
CMF 2.2.13
Zope 2.13.29

1 Like

In Plone 5.1, the content of the plone.staticresources package were in Products.CMFPlone/static. See the readme.

Note that you would need a PR for plone.app.upgrade too.

cc @thet as he may know if image caption support in 5.1 is feasible, being the original author of those PRs for 5.2.

Hi.
Ok, I got it on the list

I have also read this https://plone.org/download/release-schedule and I know that the time to do it, for version 5.1.6, is short.

I have replicated @thet's solution for Plone version 5.1.6

For this moment I have added the necessary code to enable the text box of the image caption and that it be shown in the publication.

My question now is what do I need for this to be officially released in a Plone version?

Files I have modified

CMFPlone
plone-logged-in-compiled.js
controlpanel.py

@thet or someone else could you help me, what are the steps to follow to be able to put this in a new version?

Note: It is my first time in something like this

Cheers

1 Like

Hello

I've already made my branches on my github based on

Cmfplone 5.16
mockup 2.7.8
plone.app.upgrade 2.0.28

I have a question for plone.app.upgrade

How can I test the upgradeSteps, before sending the PR?

@uroboro tnx for caring about this issue!
to test an upgrade step manually:

  • install a plone site without your changes in place
  • then switch to the branches with your changes and run the upgrade step
  • see if everything is working as expected.

for an software test see this PR: https://github.com/plone/plone.app.upgrade/pull/229/files

Thanks for the reply @thet
To which branch should i send the changes? @mauritsvanrees
Whereas it is a fix for Plone version 5.1.6.

Look here for which branches are used in 5.1. For plone.app.upgrade it would be master, and it would need to be in the v51 folder and zcml.

1 Like

I have made these pull requests.




1 Like

@thet Can you help me, a revision is needed here.

I would really appreciate it.

The framework team voted against merging the related PRs into Plone 5.1, as there were too many possibly risky changes needed, which is not wise for a Plone release branch which is in maintenance/bugfix-only mode. Sorry if anyone, including me, gave the impression that it could maybe be included.

Going forward, if you really can't go to Plone 5.2 yet, I wonder how you could benefit from your work on 5.1 anyway. Something like this:

  • For plone.outputfilters, instead of your branch, you could use the master branch or the latest release, as Johannes suggested recently
  • You would need to allow figcaption, which you could add manually in the filter control panel.
  • In CMFPlone you would need the new IImagingSchema.image_captioning field, as you did in your PR 3099.
  • That new field would need an upgrade step to reload the IImagingSchema interface, which could be done in a registry.xml in the code of your project.
  • You did mockup changes, which you compiled into Products/CMFPlone/static/plone-logged-in-compiled.js. Those changes would be needed.

So maybe this could work for you:

  • Use plone.outputfilters 4.0.1.
  • Create an internal release of your Products.CMFPlone branch from PR 3099.
  • Create an internal release of your plone.app.upgrade branch. That seems to be missing an upgrade step to reload the IImageSchema, and add the figcaption, but otherwise seems okay.

I have not tried this. But hopefully this helps you, and means your time was not wasted.

1 Like

@mauritsvanrees @uroboro
Also sorry from my side about the late canceling of this PR. I'll close it then but keep the branch for mockup alive.

Additions to @mauritsvanrees outline above:

Yes, use plone.outputfilters master branch. (Typo: was plone.staticresources before)

Regarding the CMFPlone branch - this should not be needed. A registry entry like the following should be sufficient, as plone.outputfilters doesn't query the registry by interface but just by name (See: https://github.com/plone/plone.outputfilters/blob/7b2c5b1b4697c4d45b7eb2a01a07ca4666e30afa/plone/outputfilters/filters/resolveuid_and_caption.py#L58 ):

  <record name="plone.image_captioning">
    <value>True</value>
  </record>  

For the mockup changes - you could try to install plone.staticresources in Plone 5.1. It might fail but there are chances that it works. (I'm currently testing this and will let you know).
Update: no it doesn't. plone.staticresources has conflicting configuration options with Products.CMFPlone.

If not, let your project depend on the branch of mockup you're using and provide a custom plone-logged-in bundle. I do this for another project like so:

Provide a resource directory like so:

  <plone:static
      directory="resources"
      name="my.site"
      type="plone"
  />

A custom bundle resource with all the requirejs definitions you want to include:

  <records
      prefix="plone.resources/plone-logged-in"
      interface="Products.CMFPlone.interfaces.IResourceRegistry">
    <value key="js">++plone++my.site/plone-logged-in.js</value>
    <value key="css">
      <element>++plone++my.site/plone-logged-in.less</element>
    </value>
  </records>

A custom plone-logged-in bundle:

  <records prefix="plone.bundles/plone-logged-in" interface="Products.CMFPlone.interfaces.IBundleRegistry">
    <value key="last_compilation">2020-06-01 20:16:00</value>
    <value key="jscompilation">++plone++my.site/plone-logged-in-compiled.min.js</value>
    <value key="csscompilation">++plone++my.site/plone-logged-in-compiled.min.css</value>
    <value key="develop_javascript">False</value>
    <value key="develop_css">False</value>
    <value key="merge_with">logged-in</value>
    <value key="depends">plone</value>
    <value key="resources">
      <element>plone-logged-in</element>
    </value>
    <value key="enabled">True</value>
    <value key="expression">python: member is not None</value>
    <value key="stub_js_modules">
      <element>backbone</element>
      [...]
    </value>
  </records>

Then you can run ./plone-compile-resources -b plone-logged-in and your bundle will be written to the directory which was defined for my.site.

Note: you have to create the files for ++plone++my.site/plone-logged-in-compiled.min.js and ++plone++my.site/plone-logged-in-compiled.min.css even if they are empty otherwise plone-compile-resources will fail.

@thet @mauritsvanrees Thanks for the reply.

I think this is a bug, because this functionality was always available until version 5.1.x. and this code could helped fix that.

And taking a look at version 5.2 it seems that there are a couple of complications with this too (TinyMCE) List of TinyMCE defects in Plone 5.2 / call for fixing issues and participation

We wanted to have this for this version available because we have third party packages that have not been migrated to python 3

I respect your decision.
And I appreciate your latest helpful comments.

2 Likes

Plone Foundation Code of Conduct