diff --git a/client/homebrew/editor/editor.jsx b/client/homebrew/editor/editor.jsx index dd93b8aaa..78dec5d85 100644 --- a/client/homebrew/editor/editor.jsx +++ b/client/homebrew/editor/editor.jsx @@ -18,10 +18,9 @@ const SNIPPETBAR_HEIGHT = 25; const Editor = createClass({ getDefaultProps : function() { return { - value : '', + brew : {}, onChange : ()=>{}, - metadata : {}, onMetadataChange : ()=>{}, showMetaButton : true, renderer : 'legacy' @@ -59,7 +58,7 @@ const Editor = createClass({ this.cursorPosition = curpos; }, handleInject : function(injectText){ - const lines = this.props.value.split('\n'); + const lines = this.props.brew.text.split('\n'); lines[this.cursorPosition.line] = splice(lines[this.cursorPosition.line], this.cursorPosition.ch, injectText); this.handleTextChange(lines.join('\n')); @@ -72,7 +71,7 @@ const Editor = createClass({ }, getCurrentPage : function(){ - const lines = this.props.value.split('\n').slice(0, this.cursorPosition.line + 1); + const lines = this.props.brew.text.split('\n').slice(0, this.cursorPosition.line + 1); return _.reduce(lines, (r, line)=>{ if(line.indexOf('\\page') !== -1) r++; return r; @@ -87,7 +86,7 @@ const Editor = createClass({ const customHighlights = codeMirror.getAllMarks(); for (let i=0;i{ + const lineNumbers = _.reduce(this.props.brew.text.split('\n'), (r, line, lineNumber)=>{ //reset custom line styles codeMirror.removeLineClass(lineNumber, 'background'); @@ -159,7 +158,7 @@ const Editor = createClass({ renderMetadataEditor : function(){ if(!this.state.showMetadataEditor) return; return ; }, @@ -169,7 +168,7 @@ const Editor = createClass({ return (
diff --git a/client/homebrew/editor/snippetbar/snippetbar.jsx b/client/homebrew/editor/snippetbar/snippetbar.jsx index 65c08c22f..c42e899d9 100644 --- a/client/homebrew/editor/snippetbar/snippetbar.jsx +++ b/client/homebrew/editor/snippetbar/snippetbar.jsx @@ -16,7 +16,7 @@ const execute = function(val, brew){ const Snippetbar = createClass({ getDefaultProps : function() { return { - brew : '', + brew : {}, onInject : ()=>{}, onToggle : ()=>{}, showmeta : false, @@ -80,7 +80,7 @@ module.exports = Snippetbar; const SnippetGroup = createClass({ getDefaultProps : function() { return { - brew : '', + brew : {}, groupName : '', icon : 'fas fa-rocket', snippets : [], diff --git a/client/homebrew/editor/snippetbar/snippets/snippets.js b/client/homebrew/editor/snippetbar/snippets/snippets.js index 8cf198857..fc7393aa9 100644 --- a/client/homebrew/editor/snippetbar/snippets/snippets.js +++ b/client/homebrew/editor/snippetbar/snippets/snippets.js @@ -41,8 +41,21 @@ module.exports = [ }, { name : 'Background Image', - icon : 'fas fa-times-circle', - gen : '' + icon : 'fas fa-tree', + gen : `` + }, + { + name : 'QR Code', + icon : 'fas fa-qrcode', + gen : (brew)=>{ + return ``; + } + }, { name : 'Page Number', diff --git a/client/homebrew/editor/snippetbar/snippets/tableOfContents.gen.js b/client/homebrew/editor/snippetbar/snippets/tableOfContents.gen.js index ca49526d4..8a03b0530 100644 --- a/client/homebrew/editor/snippetbar/snippets/tableOfContents.gen.js +++ b/client/homebrew/editor/snippetbar/snippets/tableOfContents.gen.js @@ -48,7 +48,7 @@ const getTOC = (pages)=>{ }; module.exports = function(brew){ - const pages = brew.split('\\page'); + const pages = brew.text.split('\\page'); const TOC = getTOC(pages); const markdown = _.reduce(TOC, (r, g1, idx1)=>{ r.push(`- **[${idx1 + 1} ${g1.title}](#p${g1.page})**`); @@ -69,4 +69,4 @@ module.exports = function(brew){ ##### Table Of Contents ${markdown}
\n`; -}; \ No newline at end of file +}; diff --git a/client/homebrew/editor/snippetbar/snippetsLegacy/tableOfContents.gen.js b/client/homebrew/editor/snippetbar/snippetsLegacy/tableOfContents.gen.js index ca49526d4..8a03b0530 100644 --- a/client/homebrew/editor/snippetbar/snippetsLegacy/tableOfContents.gen.js +++ b/client/homebrew/editor/snippetbar/snippetsLegacy/tableOfContents.gen.js @@ -48,7 +48,7 @@ const getTOC = (pages)=>{ }; module.exports = function(brew){ - const pages = brew.split('\\page'); + const pages = brew.text.split('\\page'); const TOC = getTOC(pages); const markdown = _.reduce(TOC, (r, g1, idx1)=>{ r.push(`- **[${idx1 + 1} ${g1.title}](#p${g1.page})**`); @@ -69,4 +69,4 @@ module.exports = function(brew){ ##### Table Of Contents ${markdown} \n`; -}; \ No newline at end of file +}; diff --git a/client/homebrew/pages/editPage/editPage.jsx b/client/homebrew/pages/editPage/editPage.jsx index 4e58e9f1c..99ba583b1 100644 --- a/client/homebrew/pages/editPage/editPage.jsx +++ b/client/homebrew/pages/editPage/editPage.jsx @@ -392,9 +392,8 @@ const EditPage = createClass({