lundi 22 février 2016

Ember: Integrating ember-autosave with TinyMCE and Rails API

I'm trying to implement ember-autosave but am having issues getting it implemented correctly and was hoping for some insight into what's going wrong. I am using Ember 2.3.1 and ember-autosave 1.0.0, and trying to implement it for use with the TinyMCE text editor with a Rails API backend. I'd greatly appreciate any insight or even getting pointed in the right direction.

I'm calling autosave from the show-sheet component object, but the content is not saving and I'm also not hitting the debugger that I put in the save method:

// app/components/show-sheet.js

import Ember from 'ember';
import autosave from 'ember-autosave';
export default Ember.Component.extend({
  store: Ember.inject.service(),
  sheetProxy: autosave('sheet', {
    save(sheet) {
      debugger;
      sheet.save();
    }
  })
});

It's not clear to me what exactly I've done wrong here and why I'm not able to hit the save method. (I also tried replace the last two calls of sheet with model and had the same issue - not sure if I'm naming things incorrectly). Here's the component template:

// app/templates/components/show-sheet.hbs

<div class="col-md-12">
  <h1>{{sheetProxy.title}}</h1>
</div>
<div class="text-editor-wrapper">
    <p style="color:#fff;">.</p>
    {{text-editor value=sheetProxy.content.content }}
</div>

text-editor is also a component required by TinyMCE, and that looks like this:

// app/templates/components/text-editor.hbs 

{{textarea value=value}}

This last template's syntax is required to remain the same by TinyMCE. I'm wondering if the issue I'm having is that the text area isn't being save because it is in a nested component or that TinyMCE doesn't play well with ember-autosave, or if I've done something else wrong in the setup that is preventing ember-autosave from working? Thanks so much for the help!




Aucun commentaire:

Enregistrer un commentaire