3

I'm looking for a best practice approach to achieving a plugin in TinyMCE, to implement insertion of the HTML5 element <figure>, along one or more child <img>s, and a <figcaption>.

Whilst the HTML5 spec seems to allow for other figure types, i.e. other than <img>, that's all we're concerned with at the moment.

Ideally, the solution would be plugin based and portable.

FYI we're using TinyMCE w/ Django.

Daryl
  • 1,469
  • 5
  • 18
  • 30

2 Answers2

3

You will need to use the extended_valid_elements setting to configure your elements as valid elements and define valid children.

feeela
  • 29,399
  • 7
  • 59
  • 71
Thariama
  • 50,002
  • 13
  • 138
  • 166
  • 2
    Good answer for the moment, but would love to have something more specific. – Daryl Apr 05 '11 at 01:01
  • That is how to make sure it doesn't strip your `
    ` and `
    ` tags, but this doesn't support the actual insertion. :(
    – Kerrick May 20 '11 at 20:27
  • @Kerrick: insertion shouldn't be a problem. how do you try to insert it? – Thariama May 23 '11 at 08:25
  • I'm not quite sure how to create a button (like the B button for strong tags) that'll insert a `
    ` so my users don't have to edit the HTML source.
    – Kerrick May 24 '11 at 09:45
  • @Kerrick: have a look here: http://tinymce.moxiecode.com/wiki.php/Creating_a_plugin – Thariama May 24 '11 at 11:36
-1

Try this:

http://www.tinymce.com/forum/viewtopic.php?id=29615

It is a small modification of the image plugin so that it uses figure/figcaption when it is the case. It was never used in production, but should work.

  • 3
    Note that [link-only answers](http://meta.stackoverflow.com/tags/link-only-answers/info) are discouraged, SO answers should be the end-point of a search for a solution (vs. yet another stopover of references, which tend to get stale over time). Please consider adding a stand-alone synopsis here, keeping the link as a reference. – kleopatra Sep 01 '13 at 21:13
  • This link is dead – Jonas Lundman Oct 30 '17 at 19:59