I have few lines of HTML in my database. I want to edit the content in CKEditor. But when I open that in editor the HTML gets break down. The HTML gets rearranged.
Below is the HTML which is in database:
<span class="sec_title">
<h1><span>Web</span> Engineering</h1>
<hr>
</span>
And when I open it in CKEditor the HTML looks likes below:
<h1><span class="sec_title"><span>Web</span> Engineering</span></h1>
<hr />
Some one please help me. I tried config.allowedContent = true; but it is also not stopping the CKEditor to do the modifications.
CKEditor works with a valid HTML only and <h1> is not a valid content of <span>. Quoting CKEditor basic concepts:
CKEditor is not a tool that will let you input invalid HTML code. CKEditor abides by W3C standards so it will modify code if it is invalid.
Related
I want to get the textarea data and show in browser. I am using CKEditor with textarea. But textarea data show with html tags as output.
In the editor I write "This is textarea" but it displays as <p>This is text textarea</p> in browser.
Trying to set up configuration of ckeditor config.js file from the documentation with 'config.htmlEncodeOutput = true' and 'config.basicEntities = false'. But it doesn't work.
<textarea name="post_description" id="editor" cols="30" rows="15" class="form-control"></textarea>
You need to properly escape strings that contain HTML tags so that they are formatted by browser engine. In Laravel you can simply change where you display your content from:
{{ $text }}
to
{!! $text !!}
I'm using joomla (last version) and just added this template in tinymce :
<a href="/test" class="darkimagediv">
<img src="/images/logo2.png">
<div>
<div>
Test
</div>
</div>
</a>
It displays fine in the popup dialog just before inserting, but when I do it is inserted like that:
<p><a class="darkimagediv" href="test"> <img src="images/logo2.png" /></a></p>
<div>
<div>Test</div>
</div>
<p> </p>
Which is very bad.
I'm superuser and text filtering is off in the global configuration. I don't find any cleanup option in tinymce, so I need to find which script modify my html but I don't even know if I must search tinymce or joomla itself.
If you are pasting code Don't use a rich text editor.
The editor is doing what it is supposed to and correcting your incorrect markup. Either way, if you want to insert markup, incorrect or not, then don't use a rich text editor.
I saw previously you could edit the html portion of the sweetalert, but now that has been changed to content instead of doing raw html. Is there a way to go back to using html or another way of adding in an input. I saw in another post that it may be better to just use a modal instead.
https://github.com/sweetalert2/sweetalert2/issues/451 here is the guide with the html.
You are using SweetAlert2.
The plain HTML option still exists.
This is used as follows:
swal({
title: 'Title',
html: 'A custom <span style="color: #F8BB86">html<span> message.'
});
Javascript Sweet Alert and html link inside text
When I save my content, it changes things that I don't want to be changed. How can I make it so it would just save my content without changing anything?
Content before saving:
<a anything</a>
After save, the above example becomes:
<a a="" anything=""> </a>
I'm trying to find a config option that would make it so when I save my content, it would save it just as it is - without adding anything of its own.
This <a anything</a> is not a valid HTML and CKEditor works only with a valid HTML. So once you try to load this content into CKEditor it (or the browser) tries to fix it.
Quoting CKEditor basic concepts:
CKEditor is not a tool that will let you input invalid HTML code. CKEditor abides by W3C standards so it will modify code if it is invalid.
I'd like to ask if there is a way to disable indented format of HTML source code in CKEditor. I don't want the HTML to be formatted because I want to store it in a database and there is no need for extra characters (line breaks and spaces). I just want the raw html without spaces and lines.
for example
the HTML output in CKEditor is
<p>
test 1</p>
<p>
test 2</p>
<p>
test 3</p>
but what I need is
<p>test 1</p><p>test 2</p><p>test 3</p>
This doc at the CKEditor howto shows how you can modify the formatting of the output, so you just have to specify the rules that you want: http://docs.cksource.com/CKEditor_3.x/Howto/FCKeditor_HTML_Output