Text Box won't hold tags

Topics: Controls
Oct 25, 2012 at 8:17 PM

I am trying to add some Lake Quincy Media ads to my page.  I take the following steps:

 

  1. Add a Text Box
  2. Edit the Text Box.
  3. Go to the HTML Editor (as opposed to the WYSIWYG editor)
  4. I enter the following:

    <div class="lqm_ad" lqm_publisher="lqm.nickhodges.site" lqm_zone="ron" lqm_format="160x600" lqm_tags="Delphi%2CRAD%20Studio%2CTDD%2CDependency%20Injection%2CUnit%20Testing"></div>
  5. I then press the Update button.
  6. However, if I go back to the HTML input box, it is all gone.  
  7. If I add in a simple <p>Hello World</p>, that works fine.
  8. This happens on both my localhost version and the "real" version, and in Firefox and Chrome.

 

Is there something wrong with the <div> that I'm adding? Why would it refuse to accept it?

Coordinator
Oct 25, 2012 at 10:18 PM

You trying to insert empty "div" with bunch of invalid attributes, and editor "cleans" it up.

You need to tell TinyMce leave it as is, by adding all those "lqm_whatever" to valid list, as described here.

tinyMCE.init is in the admin/tinyMCE.ascx

Oct 25, 2012 at 11:05 PM

Hey, thanks for the quick reply.

I'm not having much luck.

Here is the beginning of my tinyMCD.init --

 

tinyMCE.init({ // General options extended_valid_elements : "div[align<center?justify?left?right|class|dir<ltr?rtl|id|lang|onclick" +"|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove"         +"|onmouseout|onmouseover|onmouseup|style|title|lqm_publisher|lqm_zone|lqm_format|lqm_tags]", mode: "exact", elements : "<%=txtContent.ClientID %>", theme: "advanced", plugins: "inlinepopups,fullscreen,contextmenu,emotions,table,iespell,advlink,insertcode", convert_urls: false,

But the behaviour is the same.  I did save, and even restarted the web server.

I did put &nbsp; inside the div, so the div itself stays, but all the attributes are still removed.

Grrr.

Thanks for any help.

Nick

Coordinator
Oct 26, 2012 at 5:21 AM

My mistake, widget editor called directly from TinyMCE bypassing .ascx control.

Not pretty, but you can do the same in the editors/tiny_mce_3_5_7/tiny_mce.js replacing

addValidElements(settings.extended_valid_elements);

with something like:

addValidElements("div[id|dir|class|align|style|qm_publisher|lqm_zone|lqm_format|lqm_tags]");
This works, but not sure if it breaks something else. You would need to to test or keep an eye on it when editing posts. Probably there is better way, I did not look at it too much.

Oct 27, 2012 at 3:45 PM

Hey, thanks again.

That got things working, though I appear to have lost the WYSIWYG part of tiny MCE. That's fine, though.  I'll keep working on it.  :-)

Oct 29, 2012 at 3:12 AM

Actually, now that i'm trying to get TinyMCE to actually work, I notice that this appears to be an either/or thing.  Either I get no tinyMCE or I can have the tags.

Also, I'm using BlogEngine 2.6, and so I have tinyMCE 3.4.3.1, and it appears not to work at all -- the tags are still disappearing.

Any further thoughts?

Oct 29, 2012 at 4:05 AM

I think I figured it out --

You need to do the update:

extended_valid_elements : "div[id|dir|class|align|style|qm_publisher|lqm_zone|lqm_format|lqm_tags]",

in the edit.ascx file (which apparently initializes tinyMCE) instead.

That appears to allow the tags to remain, and to get put into my page's HTML.  

Thanks.