Ember Trix Editor is an Ember addon that wraps Basecamp's Trix editor in an Ember component. Visit our demo to see it in action. (Code for our demo is located in tests/dummy/app.)
To use this component in your own Ember project, enter this command: ember install ember-trix-editor
.
The component is consistent with Ember's data-down actions-up pattern:
attachmentsDisabled
(boolean; if truthy, calls preventDefault() on the trix-file-accept event)autofocus
(boolean; if truthy, adds the HTML autofocus attribute to the trix-editor tag)editorClass
(string; space-separated list of class names that will be passed to the class attribute of the trix-editor tag)placeholder
(string; text that will show up in the editor when it's empty)value
(string; text to pre-populate the trix-editor)
trix-attachment-add
trix-attachment-remove
trix-blur
trix-change
trix-file-accept
trix-focus
trix-initialize
trix-selection-change
All actions send up a jQuery event, from which the original event and editor property can be extracted.
actions: {
handleTrixAttachmentAdd(jqEvent) {
var attachment = jqEvent.originalEvent.attachment;
if (attachment.file) {
// update file to server
// call attachment.setAttributes();
}
}
}
This is the first time Channing Allen and Lynne Tye have contributed to an open-source project! We welcome others to send bug reports, make pull requests, or give us feedback.
Special thanks to Courtland Allen for his help.
git clone
this reponpm install
bower install
ember server
- Visit your app at http://localhost:4200.
ember test
ember test --server
ember build
For more information on using ember-cli, visit http://www.ember-cli.com/.