Make images and other in-text plugins editable directly with tinymce or wymeditor #1240

Closed
wants to merge 3 commits into
from

Projects

None yet

5 participants

@xmedia-systems

Make images and other in-text plugins editable directly with tinymce or wymeditor by
forwarding the attributes of the placeholders (particularly class and style) to the rendering context. (Useful for example in picture.html)

xmedia-systems added some commits May 21, 2012
@xmedia-systems xmedia-systems save admin tags of in-text plugins in the context
(enables plugins to use class and style attributes set by tinymce)
25ca6e0
@xmedia-systems xmedia-systems ADDED admin-tag-attributes
MODIFIED picture template to use admin-tag's class and style
8ec3c4d
@xmedia-systems xmedia-systems renamed admin_tag to placeholder ff341a6
Collaborator
ojii commented Jun 15, 2012

not entirely sure what this does, could you elaborate a bit more what this is all about?

If you insert text-enabled plugins (especially images) tinymce an wymeditor allow to format them by changing their size or setting for example style="float:right;" or class="...". This formatting however is applied to a placeholder image tag, which is replaced on rendering by the actual output of the embedded plugin. Thus the formatting is lost and the user is wondering why his embedded image plugin is aligned right in the editor but not on the page. To solve this I propose to forward the whole placeholder tag (and for convenience its attributes in a dictionary) to the embedded plugin, which is then able to copy for example style and class (like for example in the patched cms/plugins/picture/templates/cms/plugins/picture.html)

@evildmp evildmp was assigned Jun 16, 2012
Member
digi604 commented Aug 10, 2012

Needs documentation

sorry, what would be the right place to document this?

Member
digi604 commented Aug 10, 2012

custom_plugins.rst would be the right place... i see that there is a need for writing a section for text embed-able plugins as well. Could you do that?

Ok, I'll take a look

Member
digi604 commented Oct 4, 2012

still needs docs and remerge

Contributor
kux commented May 22, 2013

@xmedia-systems
Have a look at pbs@c304042
It implements the same feature (bug fix) by using a proper html parser (avoids error prone regex magic)

@digi604
I don't think this actually needs any explicit documentation. The fact that styles set by tinymce aren't passed down to child plugins is very annoying. I would consider this a bug fix rather than a feature.

Contributor
kux commented May 22, 2013

@digi604

If this pull request got abandoned, I would happily open another (with the changeset linked in the comment above).

Member
digi604 commented May 22, 2013

@kux yes please open an other PR

Contributor
kux commented May 22, 2013

@digi604

Noticed you removed the text plugin from the cms in 28f191c

Is the new djangocms-text-ckeditor compatible with TinyMCE or WYMEditor? (I noticed the widget classes from wymeditor_widget.py and tinymce_widget.py have been removed)

@digi604 I'm sorry for not having found the time to improve the documentation but, you know, my patch is a one liner and to document text-enabled plugins would take some more lines... But I also find it annoying that this problem/bug is still present in the current release.

@kux I wouldn't say my regex solution is error prone: it always finds all attributes of a valid html tag or else it's not a tag! (and even then it doesn't throw an exception but simply finds nothing). On the other hand: don't you think a HTML-Parser is too much overhead for a simple attribute extraction? In both: performance and lines of code

@kux I also had to brood over the context name to use in plugin templates and there may be better names than my placeholder_attributes but IMHO inherited_from_parent is less clear

Member
digi604 commented May 24, 2013

@kux djangocms-text-ckeditor should be an inplace replacement for cms.plugins.text. It supports inline plugins as well... and supports drag and drop pictures into the editor.... we extract those images and convert them to picture plugins...

@kux how does the PBS version differ from this one?

Member
digi604 commented Jul 10, 2013

closing as this would need to be implemented on djangocms-text-ckeditor.

@digi604 digi604 closed this Jul 10, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment