CKEditor , how to disable HTML indented format - ckeditor

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

Related

Escape Html entities ignoring html tags - in Ruby

BACKGROUND: I am saving some html in database. That contains html tags and html entities.
Problem:
I need to escape HTML entities e.g < or > without escaping HTML tags e.g <p> or </p> or <h1> or <br/> etc. I need solution for escaping HTML entities without escaping HTML tags.
I have used the following code but that escapes HTML tags too.
escaped_msg = CGI.escape_html '<p><some message here></p>'
I want to get:
<p><some message here></p>
I don't want to escape any HTML tags e.g <p> or </p> etc

Prevent TinyMce in Joomla to modify inserted html code

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.

how to remove everything after specific text with xpath

I am trying to setup a Telegram Instant View for a website.
i have something like this code and want to remove everything after "remove from here" text
<p> sample text <p> test</p> remove from here <p>test text</p> </p>
how can i access every text/nodes after this specific text ("remove from here") and remove them?
Update:
i want to have this result:
<p> sample text <p> test</p> remove from here</p>
how can i access every text/nodes after this specific text
You can use following-sibling::* from XPath to access the nodes on the same level after the one you selected.
Then use #remove function from the Instant View DSL:
$selected_node: //*[self::text() and normalize-space()="remove from here"]
#remove: $selected_node/following-sibling::*
You may want to be more specific with the $selected_node. Depending on your needs, you may want to add predicates to remove only certain types of the following siblings, for example: following-sibling::*[self::node() or self::text()].

Laravel 5.2 + Unicode

when I use a single view file with uni-code in it, it shows the the content correctly but when I make a layout and extends with it from another page it doesn't show the uni-code character it shows ????
#extends('layouts/custom_layout.blade')
Check what encoding is used in your other view. Convert it to UTF-8 and it will work fine.
To avoid encoding related problems, use popular IDEs or text editors like Sublime Text or Notepad++ for editing files.
In custom_layout.blade.php file:
````
<div class="container">
<div class="content">
<div class="title">Laravel 5</div>
गृह
</div>
</div>
````
In home.blade.php file:
#extends('custom_layout')
And off course I have used meta tag charset="utf-8" in head tag.
My friend I had the same problem with the unicode characters it turns out that the IDE was causing the problem , I use Jetbrains PHPStorm. I edited the file with sublime and it turns alright.

CKEditor HTML Autocorrection Issue

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.

Resources