1

I've been searching this for hours, i've even seen this question here, but it doesn't seem to work for me: TinyMce Allow all Html tag

I want to make it possible to write links like

<a href="www.google.com">Google</a>

directly in the editor. I'm using

valid_elements : "*[*]",

but it still does not work. What can I do?

Community
  • 1
  • 1
jonas23
  • 213
  • 3
  • 7

1 Answers1

1

I am not sure, but the setting [] does not seem to be enough. You will also have a look at the valid_children setting.

Here is what i use (be aware to set the attributes too):

    valid_elements: "@[id|class|title|style|onmouseover]," +
    "a[name|href|target|title|alt]," +
    "#p,blockquote,-ol,-ul,-li,br,img[src|height|width],-sub,-sup,-b,-i,-u," +
    "-span[data-mce-type],hr",

    valid_children: "body[p|ol|ul]" +
    ",p[a|span|b|i|u|sup|sub|img|hr|#text]" +
    ",span[p|a|b|i|u|sup|sub|img|#text]" +
    ",a[span|b|i|u|sup|sub|img|#text]" +
    ",b[span|a|i|u|sup|sub|img|#text]" +
    ",i[span|a|b|u|sup|sub|img|#text]" +
    ",sup[span|a|i|b|u|sub|img|#text]" +
    ",sub[span|a|i|b|u|sup|img|#text]" +
    ",li[span|a|b|i|u|sup|sub|img|ol|ul|#text]" +
    ",ol[li]" +
    ",ul[li]", 
Thariama
  • 50,002
  • 13
  • 138
  • 166
  • It still doesn't work for me. TinyMCE still strips the link out of my text. – jonas23 Mar 01 '12 at 19:37
  • this usually cannot be, can you set up a jsfiddle or tinymcefiddle demo? – Thariama Mar 02 '12 at 08:43
  • This is my code: http://jsfiddle.net/pSXaV/ I find this very strange too, because all the other features work fine. – jonas23 Mar 02 '12 at 09:00
  • you want to enter the html-tag by writing? – Thariama Mar 05 '12 at 09:15
  • Yes, that's exactly what I want to do. – jonas23 Mar 06 '12 at 11:17
  • this won't work because inserted "<" and ">" will be treated as entities when entered by keyboard into the editor. for your use case you should use the code plugin (provides a button labeled with 'html'). using this plugin you can do what you wish (but you modify the editor conten in a popup not the original editor) – Thariama Mar 06 '12 at 11:37