-
Notifications
You must be signed in to change notification settings - Fork 152
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update cards to be in format expected by dom renderer
This is based on the changes to mobiledoc-dom-renderer in bustle/mobiledoc-dom-renderer#18 This allows rendering, but the cards themselves don't render yet because ember-mobiledoc-editor doesn't use the updates to mobiledoc-kit from #238 wip refs #236
- Loading branch information
Showing
7 changed files
with
91 additions
and
89 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,28 @@ | ||
import Ember from 'ember'; | ||
import { cardsHash } from '../mobiledoc-cards/index'; | ||
import { cards } from '../mobiledoc-cards/index'; | ||
import Renderer from 'ember-mobiledoc-dom-renderer'; | ||
|
||
let { computed, run } = Ember; | ||
|
||
let renderer = new Renderer({cards}); | ||
|
||
export default Ember.Component.extend({ | ||
domRenderer: computed(function(){ | ||
return new Renderer(); | ||
}), | ||
didRender() { | ||
let domRenderer = this.get('domRenderer'); | ||
let mobiledoc = this.get('mobiledoc'); | ||
if (!mobiledoc) { | ||
return; | ||
} | ||
|
||
run(() => { | ||
let target = this.$(); | ||
target.empty(); | ||
if (mobiledoc) { | ||
domRenderer.render(mobiledoc, target[0], cardsHash); | ||
if (this._teardownRender) { | ||
this._teardownRender(); | ||
this._teardownRender = null; | ||
} | ||
|
||
let target = this.$(); | ||
let { result, teardown } = renderer.render(mobiledoc); | ||
target.append(result); | ||
this._teardownRender = teardown; | ||
}); | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters