froala/TinyMCE Migration Guide/Demo/Distraction-free Editor
by pramithap
HTML
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/font-awesome/4.4.0/css/font-awesome.min.css">
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/codemirror/5.25.0/codemirror.min.css">
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/froala-editor@2.9.1/css/froala_editor.pkgd.min.css">
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/froala-editor@2.9.1/css/froala_style.css">
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/codemirror/5.25.0/codemirror.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/codemirror/5.25.0/mode/xml/xml.min.js"></script>
<script src="//cdn.jsdelivr.net/npm/froala-editor@2.9.1/js/froala_editor.pkgd.min.js"></script>
<!-- Create a tag that we will use as the editable area. -->
<!-- You can use a div tag as well. -->
<div class='demo-dfree'>
<h2 class="dfree-header mce-content-body" style="position: relative;">
Froala WYSIWYG HTML Editor
</h2>
<div class="dfree-body mce-content-body" style="position: relative;">
<p><span class="fr-img-caption fr-fir fr-dii" style="width: 383px;"><span class="fr-img-wrap"><img src="https://www.dewaweb.com/blog/wp-content/uploads/2018/08/web-developer-dewaweb.jpg" alt="Editor photo"><span class="fr-inner"><em>Web developer</em></span></span> </span>Froala Editor is a lightweight WYSIWYG HTML Editor written in Javascript that enables rich text editing capabilities for your applications.</p>
<p>Its complete <a href="/wysiwyg-editor/docs" title="Documentation">documentation</a>, specially designed <a href="#frameworks" title="Frameworks">framework plugins</a> and <a href="/wysiwyg-editor/examples" title="Examples">tons of examples</a> make it easy to integrate. We're continuously working to add in new features and take the Javascript web WYSIWYG editing capabilities beyond its current limits.</p>
<table style="width: 100%;">
<tbody>
<tr>
...
SCSS
.demo-dfree {
position: relative;
width: 690px;
box-shadow: 0px 2px 8px 0px rgba(#000, 0.2) !important;
text-align: left;
color: rgb(98, 98, 98);
font-family: Lato;
font-size: 14px;
*[contentEditable="true"]:hover {
outline: 1px solid #2276d2;
}
h1 {
color: #1976d2;
font-family: Aileron !important;
font-size: 2em;
font-weight: bold;
}
h2 {
color: #1976d2;
font-family: Aileron;
font-size: 2em;
font-weight: bold;
}
h3 {
font-size: 1.5em;
color: #403f42;
font-weight: bold;
color: inherit;
font-family: Aileron;
}
h2,
h3 {
margin-bottom: 0px;
margin-top: 0px;
line-height: 40px;
}
ul,
ol {
padding-left: 20px;
}
ul {
list-style: disc;
}
ol {
list-style: decimal;
}
a {
text-decoration: underline;
}
textarea {
display: none;
}
padding: 20px;
.dfree-header {
font-size: 2.4em;
text-align: center;
margin: 10px;
}
.dfree-body {
padding: 20px;
padding-top: 0px;
p {
margin-bottom: 10px;
}
blockquote {
margin-left: 30px;
padding-left: 10px;
margin-right: 40px;
font-style: italic;
border-left: 1px solid #696969;
}
a {
text-decoration: underline;
}
td,
tr {
border: 1px solid #696969;
}
}
}
JavaScript
$(function(){
var dfreeHeaderConfig = {
toolbarInline: true,
charCounterCount: false,
toolbarButtons: ['italic', 'underline']
};
var dfreeBodyConfig = {
toolbarInline: true,
disableRightClick: true,
pluginsEnabled: [
'link',
'lists',
'paragraphFormat',
'video',
'wordPaste',
'table',
'colors',
'image',
'quickInsert'
],
toolbarButtons: ['bold', 'italic', '|', 'paragraphFormat', '|', 'blockquote', 'insertLink'],
imageEditButtons: ['imageAlign', 'imageCaption'],
quickInsertButtons: ['table', 'image'],
wordPasteKeepFormatting: false,
pastePlain: true
};
$('.dfree-header').froalaEditor(dfreeHeaderConfig);
$('.dfree-body').froalaEditor(dfreeBodyConfig);
});