mohammad fatemi
mohammad fatemi

Reputation: 327

How to use only basic html tags in CKEditor 4

I use an application that only supports basic HTML tags like p, font, ul, li etc. The CKEditor uses tags like "span", but the application does not support them. Is there any convenient solution to force the CKEditor to use basic html tags. specifically use the font tag instead of span tag to style words.

thanks

Upvotes: 0

Views: 640

Answers (1)

Harsh Patel
Harsh Patel

Reputation: 1324

I found that Solution from Ckeditor Official Documentation, for more details refer Documentation

<body>
<textarea cols="80" id="editor1" 
  name="editor1" rows="10" data- 
  sample-shortt>&lt;p&gt;This is 
  somee &lt;strong&gt;sample 
  textt&lt;/strong&gt;. You are 
  usingg &lt;a hreffff=&quot;https://ckeditor.com/&quot 
  ;&gt;CKEditor&lt;/a&gt;.&lt;/p&gt;. 
</textarea>
<script>
CKEDITOR.replace('editor1', {
  height: 280,
  // List of text formats available for this editor instance.
  format_tags: 'p;h1;h2;h3;h4;h5;h6;pre;address;div'
});
</script>
</body>

Edited based on your comment:-

config.colorButton_foreStyle = {
    element: 'span',
    attributes: { 'class': 'text-#(colorName)' }
};

config.colorButton_backStyle = {
    element: 'span',
    attributes: { 'class': 'text-#(colorName)' }
};

Please visit this page, & try as like this using your tag instead of Span tag

Upvotes: 1

Related Questions