Proposal [from github]: Feature Req: Link Plugins in rich text editors should display as link text, not as an icon

107 views
Skip to first unread message

Divio Developers

unread,
Feb 3, 2011, 9:29:42 AM2/3/11
to django-cms...@googlegroups.com

benzkji

unread,
Feb 4, 2011, 8:11:25 AM2/4/11
to django-cms...@googlegroups.com
BIG +1

Jonas Obrist

unread,
Feb 4, 2011, 8:52:49 AM2/4/11
to django-cms...@googlegroups.com
While I'm +1 on this, i don't see how to properly implement this...

Martin

unread,
Feb 4, 2011, 8:59:47 AM2/4/11
to django-cms...@googlegroups.com
super big +1 :)

benzkji

unread,
Feb 4, 2011, 9:09:25 AM2/4/11
to django-cms...@googlegroups.com
already thought this could be the reason why it is as it is right now ;)

Benjamin Wohlwend

unread,
Feb 4, 2011, 11:21:15 AM2/4/11
to django-cms...@googlegroups.com
On Fri, Feb 4, 2011 at 2:52 PM, Jonas Obrist <ojii...@gmail.com> wrote:
> While I'm +1 on this, i don't see how to properly implement this...

I don't know about "properly", but at least for TinyMCE it is doable.
I'll try to adapt this functionality from an old project of mine...

Jonas Obrist

unread,
Feb 4, 2011, 11:25:59 AM2/4/11
to django-cms...@googlegroups.com
Basically if we solve this, we should solve this generally, not just for the Link plugin.

Plugins should be more flexible in deciding how it want's itself being displayed within Text plugins (or any other plugins allowing embed plugins).

Jonas

Jonas Obrist

unread,
Feb 25, 2011, 5:15:30 AM2/25/11
to django-cms...@googlegroups.com
Okay I've given this some more thought, and while I have no clue if this is doable in the frontend side this is what I propose:

Instead of inserting an image with the plugin id hacked on it, we insert a 'cmsplugin' HTML tag with a 'pluginid' attribute, containing it's database ID. Inside this tag, the plugin can decide for itself how it would like to be rendered. This would look like this: https://gist.github.com/843607#file_new_cmsplugin_admin_editor.html

On save we would strip the contents inside the 'cmsplugin' tags, and instead only store the ID there: https://gist.github.com/843607#file_new_cmsplugin_database_representation.html

In the frontend it renders without the 'cmsplugin' tags at all: https://gist.github.com/843607#file_new_cmsplugin_frontend_representation.html

Now let's talk python:

When rendering the admin textarea, the 'cmsplugin' tags are scanned for their IDs. To fill those tags with the content the nested plugin wants to show in the admin, a method "CMSPluginBase.get_embed_content(self, instance, parent_instance)" gets called. parent_instance is given, so in case there's more than one plugin type that uses the tree functionality of plugins, the plugin can decide how it wants to get rendered for each plugin type.


On saving, we strip anything inside the 'cmsplugin' tags.

When displaying in frontend, we strip all the 'cmsplugin' tags completely.

For the transition period, CMSPluginBase.get_embed_content should fall back to render the image using CMSPluginBase.icon_src and CMSPluginBase.icon_alt.

Thoughts?

Jonas

Daniele Procida

unread,
Feb 25, 2011, 5:54:57 AM2/25/11
to django-cms...@googlegroups.com
On Fri, Feb 25, 2011, Jonas Obrist <ojii...@gmail.com> wrote:

>Okay I've given this some more thought, and while I have no clue if this is
>doable in the frontend side this is what I propose:
>
>Instead of inserting an image with the plugin id hacked on it, we insert a
>'cmsplugin' HTML tag with a 'pluginid' attribute, containing it's database
>ID. Inside this tag, the plugin can decide for itself how it would like to
>be rendered.

Two questions about implications:

Good: couldn't this be used for other plugins too, to show information
about them that currently we can't show in the plugin icon?

Bad: would it make dragging plugins around in the editor harder?

Daniele

Jonas Obrist

unread,
Feb 25, 2011, 6:03:30 AM2/25/11
to django-cms...@googlegroups.com
1: The point is exactly to allow plugins to show information other than an image.
2: No idea. Some JS guy has to answer that question.

Jacob Rief

unread,
Sep 3, 2013, 5:39:48 PM9/3/13
to django-cms...@googlegroups.com
Today I found a possible solution to fix it for djangocms-text-ckeditor as used for django-cms 3.0.0 beta2.
Check my PR #71
- Jacob
Reply all
Reply to author
Forward
0 new messages