diff --git a/client/homebrew/editPage/editPage.jsx b/client/homebrew/editPage/editPage.jsx index 16029ba..ec6e96e 100644 --- a/client/homebrew/editPage/editPage.jsx +++ b/client/homebrew/editPage/editPage.jsx @@ -6,6 +6,8 @@ var Statusbar = require('../statusbar/statusbar.jsx'); var PHB = require('../phb/phb.jsx'); var Editor = require('../editor/editor.jsx'); +var FullClassGen = require('../editor/snippets/fullclass.gen.js'); + var request = require("superagent"); var EditPage = React.createClass({ @@ -36,6 +38,12 @@ var EditPage = React.createClass({ if(!self.state.pending) return; return "You have unsaved changes!"; } + + if(this.state.text === ""){ + this.setState({ + text : FullClassGen() + }) + } }, handleTextChange : function(text){ diff --git a/client/homebrew/editor/editor.jsx b/client/homebrew/editor/editor.jsx index 79727d7..6857a21 100644 --- a/client/homebrew/editor/editor.jsx +++ b/client/homebrew/editor/editor.jsx @@ -1,69 +1,8 @@ var React = require('react'); var _ = require('lodash'); var cx = require('classnames'); +var SnippetIcons = require('./snippets/snippets.js'); -var Snippets = require('./snippets.js'); - - -var Icons = [ - { - icon : 'fa-book', - snippet : Snippets.intro, - tooltip : 'Intro' - }, - { - icon : 'fa-magic', - snippet : Snippets.spell, - tooltip : 'Spell' - }, - { - icon : 'fa-bookmark', - snippet : Snippets.classFeatures, - tooltip : 'Class Intro' - }, - { - icon : 'fa-trophy', - snippet : Snippets.destroyUndead, - tooltip : 'Class Feature' - }, - { - icon : 'fa-sticky-note', - snippet : Snippets.note, - tooltip : 'Note' - }, - { - icon : 'fa-bug', - snippet : Snippets.statBlock, - tooltip : 'Monster Stat Block' - }, - { - icon : 'fa-table', - snippet : Snippets.classTable, - tooltip : "Class Table" - }, - { - icon : 'fa-columns', - snippet : "```\n```\n\n", - tooltip : "Column Break" - }, - { - icon : 'fa-file-text', - snippet : "\\pagen\n\n", - tooltip : "New Page" - }, - { - icon : 'fa-arrows-v', - snippet : "
\n\n", - tooltip : "Vertical Spacing" - }, - { - icon : 'fa-image', - snippet : "", - tooltip : "Insert Image" - } - - -] var Editor = React.createClass({ getDefaultProps: function() { @@ -81,15 +20,15 @@ var Editor = React.createClass({ this.props.onChange(e.target.value); }, - iconClick : function(snippet){ + iconClick : function(snippetFn){ var curPos = this.refs.textarea.selectionStart; this.props.onChange(this.props.text.slice(0, curPos) + - snippet + + snippetFn() + this.props.text.slice(curPos + 1)); }, renderTemplateIcons : function(){ - return _.map(Icons, (t) => { + return _.map(SnippetIcons, (t) => { return
@@ -104,7 +43,6 @@ var Editor = React.createClass({
{this.renderTemplateIcons()} -