Skip to content

nickgeerts/ember-trix-editor-rails

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ember-trix-editor-rails

This is a Ember-Rails package of Ember Trix Editor by [Lynne Tye] (https://github.com/lynnetye).

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.)

The component is consistent with Ember's data-down actions-up pattern:

"Data down" to {{trix-editor}}

  • 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)

"Actions up" from {{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();
    }
  }
}

About

Trix Editor addon for Ember Rails

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages