diff --git a/client/homebrew/editor/editor.jsx b/client/homebrew/editor/editor.jsx index 35da6e3bb..3822c0b99 100644 --- a/client/homebrew/editor/editor.jsx +++ b/client/homebrew/editor/editor.jsx @@ -105,14 +105,12 @@ const Editor = createClass({ highlightCustomMarkdown : function(){ if(!this.refs.codeEditor) return; if(this.state.view === 'text') { - console.log('change'); const codeMirror = this.refs.codeEditor.codeMirror; //reset custom text styles const customHighlights = codeMirror.getAllMarks().filter((mark)=>!mark.__isFold); //Don't undo code folding for (let i=customHighlights.length - 1;i>=0;i--) customHighlights[i].clear(); - let editorPageCount = 2; // start page count from page 2 _.forEach(this.props.brew.text.split('\n'), (line, lineNumber)=>{ @@ -121,36 +119,23 @@ const Editor = createClass({ codeMirror.removeLineClass(lineNumber, 'background'); codeMirror.removeLineClass(lineNumber, 'text'); - // Legacy Codemirror styling - if(this.props.renderer == 'legacy') { - if(line.includes('\\page')){ - // add back the original class 'background' but also add the new class '.pageline' - codeMirror.addLineClass(lineNumber, 'background', 'pageLine'); - const pageCountElement = Object.assign(document.createElement('span'), { - className : 'editor-page-count', - textContent : editorPageCount - }); - codeMirror.setBookmark({ line: lineNumber, ch: line.length }, pageCountElement); + // Styling for \page breaks + if((this.props.renderer == 'legacy' && line.includes('\\page')) || + (this.props.renderer == 'V3' && line.match(/^\\page$/))) { - editorPageCount += 1; - }; + // add back the original class 'background' but also add the new class '.pageline' + codeMirror.addLineClass(lineNumber, 'background', 'pageLine'); + const pageCountElement = Object.assign(document.createElement('span'), { + className : 'editor-page-count', + textContent : editorPageCount + }); + codeMirror.setBookmark({ line: lineNumber, ch: line.length }, pageCountElement); - } + editorPageCount += 1; + }; // New Codemirror styling for V3 renderer if(this.props.renderer == 'V3') { - if(line.match(/^\\page$/)){ - // add back the original class 'background' but also add the new class '.pageline' - codeMirror.addLineClass(lineNumber, 'background', 'pageLine'); - const pageCountElement = Object.assign(document.createElement('span'), { - className : 'editor-page-count', - textContent : editorPageCount - }); - codeMirror.setBookmark({ line: lineNumber, ch: line.length }, pageCountElement); - - editorPageCount += 1; - } - if(line.match(/^\\column$/)){ codeMirror.addLineClass(lineNumber, 'text', 'columnSplit'); } diff --git a/client/homebrew/editor/editor.less b/client/homebrew/editor/editor.less index ffdcdd856..810ee1710 100644 --- a/client/homebrew/editor/editor.less +++ b/client/homebrew/editor/editor.less @@ -11,7 +11,7 @@ } .editor-page-count{ color : grey; - float: right; + float : right; } .columnSplit{ font-style : italic;