Skip to content

Instantly share code, notes, and snippets.

@vasilionjea
Created January 31, 2018 02:17
Show Gist options
  • Save vasilionjea/bd17d8ba4853f944d4325f374b520aa0 to your computer and use it in GitHub Desktop.
Save vasilionjea/bd17d8ba4853f944d4325f374b520aa0 to your computer and use it in GitHub Desktop.
New Twiddle
import Ember from 'ember';
const TOOLBAR_OPTIONS = [
['bold', 'italic', 'underline'],
[
{'list': 'ordered'},
{'list': 'bullet'},
{'script': 'sub'},
{'script': 'super'},
'link',
],
['clean']
];
export default Ember.Component.extend({
classNames: ['quill-editor'],
editor: null,
didInsertElement() {
Ember.run(() => {
const quill = new Quill('.my-editor', {
theme: 'snow',
modules: {
toolbar: TOOLBAR_OPTIONS
},
});
this.set('editor', quill);
this.get('editor').focus();
console.log( this.get('editor').getText() );
});
}
});
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Quill Editor',
});
body {
margin: 12px 16px;
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
font-size: 12pt;
}
.message-text-heading {
margin: 14px 0;
font-size: 15px;
color: #333;
}
.quill-editor .ql-toolbar.ql-snow {
border: none;
margin-top: 8px;
padding: 0;
}
.ql-toolbar.ql-snow + .ql-container.ql-snow {
border: 1px solid #bbb !important;
border-radius: 4px;
min-height: 200px;
}
.ql-toolbar.ql-snow {
margin-bottom: 8px;
}
.ql-toolbar.ql-snow .ql-formats {
margin-right: 8px !important;
}
.ql-formats {
border: 1px solid #bbb;
border-radius: 2px;
}
.ql-picker-label,
.ql-bold,
.ql-italic,
.ql-underline,
.ql-link,
.ql-list,
.ql-script,
.ql-clean {
box-sizing: border-box;
border-left: 1px solid #bbb !important;
width: 32px !important;
height: 28px !important;
padding: 4px 0px 4px 5px !important;
}
.ql-bold,
.ql-list:first-child,
.ql-clean {
border-left: none !important;
}
<link rel="stylesheet" href="https://cdn.quilljs.com/1.3.5/quill.snow.css">
<h1>{{appName}}</h1><hr><br>
<main>
<h5 class="message-text-heading">Message text</h5>
{{quill-editor}}
</main>
<article class="my-editor">
<p><strong>Quill</strong> Rich Text Editor</p>
<p><br></p>
<p>Quill is a free, open source WYSIWYG editor built for the modern web. With its modular architecture and expressive API, it is completely customizable to fit any need.</p>
<p><br></p>
<p><strong>Open Source</strong></p>
<ul>
<li>Quill is permissively licensed <sub><strong>under</strong></sub> <sup><strong>BSD</strong></sup>.</li>
<li>Use it <strong>freely</strong> in personal or <u>commercial projects</u>.</li>
</ul>
<p><br></p>
</article>
{
"version": "0.13.0",
"EmberENV": {
"FEATURES": {}
},
"options": {
"use_pods": false,
"enable-testing": false
},
"dependencies": {
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js",
"quill": "https://cdn.quilljs.com/1.3.5/quill.js",
"ember": "2.16.2",
"ember-template-compiler": "2.16.2",
"ember-testing": "2.16.2"
},
"addons": {
"ember-data": "2.16.3"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment