Created
January 9, 2017 08:53
-
-
Save jbalsas/2a47884507d5506e582ec60066f85b55 to your computer and use it in GitHub Desktop.
AlloyEditor Metal Component
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
import Component from 'metal-component'; | |
import Soy from 'metal-soy'; | |
import templates from './Editor.soy'; | |
class Editor extends Component { | |
attached() { | |
AlloyEditor.editable(this.divId, {imageScaleResize: 'scale'}); | |
} | |
}; | |
Soy.register(Editor, templates); | |
export default Editor; |
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
{namespace Editor} | |
/** | |
* This renders the component's whole content. | |
* @param divId | |
* @param? contentHtml | |
*/ | |
{template .render} | |
<div id="{$divId}" contenteditable="true" data-placeholder="Write content here"> | |
{if $contentHtml} | |
{$contentHtml} | |
{/if} | |
</div> | |
{/template} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment