Skip to content

Instantly share code, notes, and snippets.

@jbalsas
Created January 9, 2017 08:53
Show Gist options
  • Save jbalsas/2a47884507d5506e582ec60066f85b55 to your computer and use it in GitHub Desktop.
Save jbalsas/2a47884507d5506e582ec60066f85b55 to your computer and use it in GitHub Desktop.
AlloyEditor Metal Component
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;
{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