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?
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!
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?
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.
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)
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.
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
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
It would be better if this empty paragraph is not inserted, is there no way to prevent this happening?
Regards,
Stefan
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
Thanks a lot, I'll go with the jquery solution to begin with.
That's your choice :)
If you want to, you can vote up the issue on Codeplex right here.
/Kim A
Thanks, this gets my vote :)
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?
The package works fine for me in 4.5.2: Remove Empty Paragraph Tags from Tiny MCE
haven't tested 4.6.1
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.
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)
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.
is working on a reply...