I am using ckeditor for codeigniter project, when i try to add span tags it's getting replaced with p tag.
Is there any way to add span tag using ckeditor?
Do you have XSS filter turned on in the config file? It removes some "illegal" tags from your POST input.
Try this
Related
When I enter save html through ckeditor I miss tag from the html content. Is there any ckeditor configuration I have to do to allow html tags such as inside html content? Thanks.
You have to use the allowedContent property when instantiating ckeditor to allow specific tags, or allowedContent: true to allow everything
https://docs.ckeditor.com/ckeditor4/latest/api/CKEDITOR_config.html#cfg-allowedContent
Either using config.js, or in-page configuration for the specified textarea:
https://docs.ckeditor.com/ckeditor4/latest/guide/dev_configuration.html
In my case (I am using a Symfony ckeditor bundle) I also can set it via bundle configuration inside config.yml.
I'm using WordPress to run my website, but recently I noticed something strange with my single.php. I found that all my p tags has a default style:
<p style="font-size: 12px;line-height: 150%;"></p>
I want to style my font-size paragraph but its work only with !important value. So, How I could change this default style? I want to remove it form p tag. I searched my functions.php but I found nothing.... maybe its a default value form WordPress core files?
I know I could remove it with jquery or style it with css but the ideal solution would be to remove that extra code ""font-size: 12px;line-height: 150%;"" I really dont need it!
I saw that other wordpress theme have also a default value for p tag so it may be wordpress!!! But How I could find it and change it?
Any suggestions?
Solved... I found the code responsible for those css values.... Thanks you all for your replays... hope the best for all of you!!!
I want to remove the <a> tag that is wrapped around the <img> tag. No link, only the image show up, no <a> html tag at all. But, without remove the <a>directly in php
I tried using css a{display:none;}, but that will remove everything. Do you think is that possible to do what I ask in PHP?
See the code below.
<img src="" />
php is a server side language. Unless you are planning to pass your entire HTML code to PHP, it most likely will not achieve what you are trying to do.
On the other hand, there are several ways which you can do it in jquery. One way to do it is to call unwrap() on the img element.
$("img").unwrap();
This will remove the parent a element.
You should use jquery.unwrap
<script>
$(document).ready(function(){
$("img").each(function(){
var parent = $(this).parent();
if(parent.is("a")){ //Remove only if the parent is "a" tag
$(this).unwrap();
}
});
});
</script>
You can chain contents() into unwrap():
contents() will return all the children of , including nodes, and unwrap() can be applied to nodes.
Use : $("a").contents().unwrap();
I am using CK Editor 4.5 as text editor in my form.
I have pasted my html code including "style" tags to the editor. But when saving the data it automatically removes the style tags from the code.
I have tried to turn off Automatic Content Filtering by add this to config file
config.allowedContent = true;
But it still remove the style tags. The editor also removes the text color, text align styles added.
How can i add style tags using CK Editor.?
My apologies. Its not the issue of ckeditor.
I am using codeigniter for server scripts. It removes inline style on form submit.
I'm using Rails and met the same issue, it turns out that I'm using sanitize to render content, which will remove the inline styles.
I am using htmlpurifier to clean up user content. I am trying to remove inline style attributes like
<div style="float:left">some text</div>
I want to remove the whole style attribute.
How to do it using htmlpurifier?
You can tweak the AllowedProperties configuration by passing it an array of valid css attributes that should not be removed (white-list approach).
However, the following should remove all css attributes
$config->set('CSS.AllowedProperties', array());
See this online demo of purifying your input html