Skip to content

Commit

Permalink
Restore imageScales / image_scales in patterns settings.
Browse files Browse the repository at this point in the history
Otherwise the new code with picture variants is only used when you have the right mockup branch,
and mockup running, and the resource registries setup to use it,
or the mockup changes should have landed in plone.staticresources already.

Note that the breakage is not too bad though:
if imageScales is not in the patterns settings and you still have TinyMCE from old staticresources,
then TinyMCE will still work.  It will just use an internal copy of the imageScales,
which for example is missing the new greater and huge scales.
With the current commit, we support both old and new TinyMCE, as long as we think this is needed.
  • Loading branch information
mauritsvanrees committed Jun 9, 2022
1 parent 28d1ea6 commit 40be913
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions Products/CMFPlone/patterns/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,16 @@ def mark_special_links(self):
}
return result

@property
def image_scales(self):
# Keep image_scales at least until https://github.com/plone/mockup/pull/1156
# is merged and plone.staticresources is updated.
factory = getUtility(IVocabularyFactory, "plone.app.vocabularies.ImagesScales")
vocabulary = factory(self.context)
ret = [{"title": translate(it.title), "value": it.value} for it in vocabulary]
ret = sorted(ret, key=lambda it: it["title"])
return json.dumps(ret)

@property
def picture_variants(self):
registry = getUtility(IRegistry)
Expand Down Expand Up @@ -140,6 +150,9 @@ def tinymce(self):
configuration = {
"base_url": self.context.absolute_url(),
"imageTypes": image_types,
# Keep imageScales at least until https://github.com/plone/mockup/pull/1156
# is merged and plone.staticresources is updated.
"imageScales": self.image_scales,
"pictureVariants": self.picture_variants,
"imageCaptioningEnabled": self.image_captioning,
"linkAttribute": "UID",
Expand Down

0 comments on commit 40be913

Please sign in to comment.