custom functionality inside hippopicker plugin for CKEditor ( Hippo X)

37 views
Skip to first unread message

Pi

unread,
Oct 9, 2015, 10:31:42 AM10/9/15
to Hippo Community
Hi,

I am working on this feature, where I would like to add an alt="" to any images picked and inserted, without alt tag, in rich text field of a doctype using ckeditor. Any help or suggestions how it can be accomplished?


Thanks,
Pi

Mathijs den Burger

unread,
Oct 9, 2015, 11:02:18 AM10/9/15
to hippo-c...@googlegroups.com
Hi Pi,

You would have to write a custom CKEditor plugin that monitors the 'insertElement' event, and adds an ALT attribute whenever the element is an image and does not have an ALT attribute yet.

Adding a custom CKEditor plugin to Hippo CMS is described at [1]. The plugin code would then be something like:

  editor.on('insertElement', function (event) {
    var insertedElement = event.data;
    if (insertedElement.getName() === 'img') {
      console.log("TODO: add alt attribute");
    }
  });

The CKEditor API is described at http://docs.ckeditor.com/#!/api

hth,
Mathijs



--
Hippo Community Group: The place for all discussions and announcements about Hippo CMS (and HST, repository etc. etc.)
 
To post to this group, send email to hippo-c...@googlegroups.com
RSS: https://groups.google.com/group/hippo-community/feed/rss_v2_0_msgs.xml?num=50
---
You received this message because you are subscribed to the Google Groups "Hippo Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hippo-communi...@googlegroups.com.
Visit this group at http://groups.google.com/group/hippo-community.
For more options, visit https://groups.google.com/d/optout.

William Borg Barthet

unread,
Oct 9, 2015, 11:03:16 AM10/9/15
to hippo-c...@googlegroups.com

--
Hippo Community Group: The place for all discussions and announcements about Hippo CMS (and HST, repository etc. etc.)
 
To post to this group, send email to hippo-c...@googlegroups.com
RSS: https://groups.google.com/group/hippo-community/feed/rss_v2_0_msgs.xml?num=50
---
You received this message because you are subscribed to the Google Groups "Hippo Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hippo-communi...@googlegroups.com.
Visit this group at http://groups.google.com/group/hippo-community.
For more options, visit https://groups.google.com/d/optout.



--
Amsterdam - Oosteinde 11, 1017 WT Amsterdam
Boston - 71 Summer Street, Boston, MA 02110

 
US +1 877 414 4776 (toll free)
Europe +31(0)20 522 4466
www.onehippo.com

Piyush Mohan

unread,
Oct 9, 2015, 2:21:22 PM10/9/15
to Hippo Community
THanks Mathijs and William,

Being a back end dev guy, I went with William's approach and it was a super quick solution :)

Pi
Reply all
Reply to author
Forward
0 new messages