Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Oli Long 2 posts 22 karma points
    Sep 21, 2009 @ 13:40
    Oli Long
    0

    Tinymce adding in <p> </p> tags before and after inline macros

    Hi, I'm running V4.0.1 of Umbraco and when inserting macros into the HTML editor empty parapraphs are being inserted before and after the macro code such as below:

    Macro inserted > Update > Save and publish (this also happens when you just click Update and reopen the HTML editor without saving)

    <div class="umbMacroHolder" title="This is rendered content from macro" umbpageid="1676" umbversionid="90a0747f-dafe-4f7d-88e3-e366c823e641" onresizestart="return false;" ismacro="true" umb_macroalias="EventsList"><!-- startUmbMacro --><span>This macro does not provides rendering in WYSIWYG editor</span><!-- endUmbMacro --></div>

    Reopen HTML editor

    <p> </p>
    <div class="umbMacroHolder" title="This is rendered content from macro" umbpageid="1676" umbversionid="90a0747f-dafe-4f7d-88e3-e366c823e641" onresizestart="return false;" ismacro="true" umb_macroalias="EventsList"><!-- startUmbMacro --><span>This macro does not provides rendering in WYSIWYG editor</span><!-- endUmbMacro --></div>
    <p> </p>

    I've had to edit the tinyMceConfig.config file to stop Tinymce ripping out empty table cells, and I've had a look in there and can't see anything obvious in there which would disable it. I have also looked on the Tinymce forum but with no luck.

    Also, Tinymce is also wrapping img tags within parapraphs, if anyone knows how to stop this happening automatically that would be great to know.

    Does anyone have any insight into how to stop Tinymce from doing these particular <p> cleanups?

    Many thanks in advance,

    Oliver.

  • Ismail Mayat 4511 posts 10090 karma points MVP 2x admin c-trib
    Sep 22, 2009 @ 11:41
    Ismail Mayat
    0

    Oli,

    You could do a quick jquery cheat on the front end and remove blank p tags something like

    $('p:empty').remove();

    or use an http handler to remove empty p's i do something similar on the compliance filter see here in the code i do remove blank p tags.

    Both solutions do not get to the root of the problem but will fix the output.

    Regards

    Ismail

  • Oli Long 2 posts 22 karma points
    Sep 23, 2009 @ 16:32
    Oli Long
    0

    Thanks for your reply Ismail,

    I do love how easy jQuery makes things for us! While it would work I don't really like the thought of using jquery to strip out content in this case.

    If it comes down to it I'll create a new specific template for this particular page, but this is not ideal as I don't want to create too many individual templates when the differences aren't huge.

    Hopefully someone around knows why this is happening!

    Cheers, Oli

  • Stefan Arngrimsson 36 posts 59 karma points
    Dec 09, 2010 @ 14:56
    Stefan Arngrimsson
    0

    It would be better if this empty paragraph is not inserted, is there no way to prevent this happening?

     

    Regards,

    Stefan

  • Kim Andersen 1447 posts 2196 karma points MVP
    Dec 09, 2010 @ 15:04
    Kim Andersen
    0

    Hi Stefan.

    I haven't tried using this, but maybe you can try out this package: Remove Empty Paragraph Tags from Tiny MCE

    /Kim A

  • Stefan Arngrimsson 36 posts 59 karma points
    Dec 09, 2010 @ 15:07
    Stefan Arngrimsson
    0

    Thanks a lot, I'll go with the jquery solution to begin with.

     

  • Kim Andersen 1447 posts 2196 karma points MVP
    Dec 09, 2010 @ 15:16
    Kim Andersen
    0

    That's your choice :)

    If you want to, you can vote up the issue on Codeplex right here.

    /Kim A

  • Stefan Arngrimsson 36 posts 59 karma points
    Dec 09, 2010 @ 15:19
    Stefan Arngrimsson
    0

    Thanks, this gets my vote :)

  • Gordon Saxby 1444 posts 1855 karma points
    Feb 03, 2011 @ 14:23
    Gordon Saxby
    0

    I still have a problem with this in 4.6.1 - but the codeplex entry says "closed"!?

    I have the situation where I want to add a macro inline inside a paragraph, I then want the output of the macro to stay inline.

    However, the text before the macro is terminated with a </p> and then the macro and the remaining text follows - obviously this is really screwing up the display of the content!! Is there a fix / workaround for this?

  • Rik Helsen 670 posts 873 karma points
    Feb 03, 2011 @ 15:03
    Rik Helsen
    0

    The package works fine for me in 4.5.2:   Remove Empty Paragraph Tags from Tiny MCE

     

    haven't tested 4.6.1

  • Gordon Saxby 1444 posts 1855 karma points
    Feb 03, 2011 @ 15:56
    Gordon Saxby
    0

    Thanks Rik but the problem isn't empty paragraphs, rather the fact that inserting a macro inside (inline) a paragraph causes that paragraph to be terminated before the macro. This means that I cannot get content via a macro and insert it into an existing paragraph ... It always appears as a new paragraph.

  • Rik Helsen 670 posts 873 karma points
    Feb 04, 2011 @ 14:17
    Rik Helsen
    0

    don't know a nice solution but this could help: put the text that should appear before/after in the same <p> tags as parameters to your macro, and output them inside the macro (xslt or ascx)

  • Gordon Saxby 1444 posts 1855 karma points
    Feb 04, 2011 @ 15:01
    Gordon Saxby
    0

    I can see that it a potential solution, but not really for an "end user" who will be phased enough by inserting a macro! ;-)

    For now, I have suggested a page format that suits (hides?) this shortcoming - basically, have the Macro contents appear on a line by itself.

Please Sign in or register to post replies

Write your reply to:

Draft