Skip to content

Commit

Permalink
tinymce pat settings from image_scales to image_srcsets
Browse files Browse the repository at this point in the history
  • Loading branch information
MrTango committed May 17, 2022
1 parent ecdb958 commit 5909d9f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
13 changes: 6 additions & 7 deletions Products/CMFPlone/patterns/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from plone.registry.interfaces import IRegistry
from plone.uuid.interfaces import IUUID
from Products.CMFCore.interfaces._content import IFolderish
from plone.base.interfaces import IImagingSchema
from plone.base.interfaces import ILinkSchema
from plone.base.interfaces import IPatternsSettings
from plone.base.interfaces import IPloneSiteRoot
Expand Down Expand Up @@ -71,12 +72,10 @@ def mark_special_links(self):
return result

@property
def image_scales(self):
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)
def image_srcsets(self):
registry = getUtility(IRegistry)
settings = registry.forInterface(IImagingSchema, prefix="plone", check=False)
return settings.image_srcsets

def tinymce(self):
"""
Expand Down Expand Up @@ -129,7 +128,7 @@ def tinymce(self):
configuration = {
"base_url": self.context.absolute_url(),
"imageTypes": image_types,
"imageScales": self.image_scales,
"imageSrcsets": self.image_srcsets,
"linkAttribute": "UID",
# This is for loading the languages on tinymce
"loadingBaseUrl": "{}/++plone++static/components/tinymce-builded/"
Expand Down
1 change: 1 addition & 0 deletions news/3477.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add image srcset's configuration to TinyMCE pattern settings [MrTango]

0 comments on commit 5909d9f

Please sign in to comment.