Skip to content

Instantly share code, notes, and snippets.

@michael
Created July 17, 2015 18:05
Show Gist options
  • Save michael/68510151be867219d264 to your computer and use it in GitHub Desktop.
Save michael/68510151be867219d264 to your computer and use it in GitHub Desktop.
class Toolbar extends React.Component {
render() {
return $$("div", { className: "toolbar"},
$$(TextToolComponent, { tool: 'text', title: 'Switch text'}),
$$(ToolComponent, { tool: 'emphasis', classNames: ['button', 'tool']}, "Emphasis"),
$$(ToolComponent, { tool: 'strong', classNames: ['button', 'tool']}, "Strong")
);
}
}
$(function() {
React.render(
$$(HtmlEditor, {
content: htmlContent,
toolbar: Toolbar,
enabledTools: ["strong", "emphasis"],
onContentChanged: function(doc, change) {
console.log('document changed', change);
console.log('new content', doc.toHtml());
}
}),
document.getElementById('editor_container')
);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment