JSFiddle - React, Tailwind, and code Playground
by Khanh Le
HTML
<script src="https://cdn.ckeditor.com/4.6.2/standard-all/ckeditor.js"></script>
<script src="https://code.jquery.com/jquery-2.2.4.min.js"></script>
<span class="editor">Span Editor - paste make editor split</span><br />
<span class="editor">Small Editor - paste make editor split</span>
<p class="editor">P Editor - paste ok</p>
<div class="editor">DIV Editor paste ok</div>
CSS
[contenteditable="true"] {
border: solid 1px #aaa;
padding: 20px;
display: block;
}
JavaScript
CKEDITOR.disableAutoInline = true;
CKEDITOR.dtd.$editable.span = 1;
CKEDITOR.dtd.$editable.smal = 1;
(function($){
console.log($('.editor'))
$('.editor').each(function(){
$(this).attr('contenteditable', 'true');
CKEDITOR.inline( this, {
// Allow some non-standard markup that we used in the introduction.
extraAllowedContent: 'a(documentation);abbr[title];code',
removePlugins: 'stylescombo',
extraPlugins: 'sourcedialog',
// Show toolbar on startup (optional).
startupFocus: true
} );
})
})(jQuery)