mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-01-09 13:42:38 +00:00
Break up text generation for legibility
This commit is contained in:
@@ -252,7 +252,10 @@ const CodeEditor = createClass({
|
|||||||
|
|
||||||
const cursorPos = this.codeMirror.getCursor();
|
const cursorPos = this.codeMirror.getCursor();
|
||||||
|
|
||||||
const text = this.codeMirror.getValue().split('\n').slice(0, cursorPos.line).reverse().filter((line)=>{return line.slice(0, header.length) == header && line; })[0] || 'PART 1 | SECTION NAME';
|
const cmText = this.codeMirror.getValue();
|
||||||
|
const cmTextArray = cmText.split('\n').slice(0, cursorPos.line).reverse();
|
||||||
|
const cmTextArrayFilter = cmTextArray.filter((line)=>{ return line.slice(0, header.length) == header; });
|
||||||
|
const text = cmTextArrayFilter[0].slice(header.length) || 'PART 1 | SECTION NAME';
|
||||||
|
|
||||||
this.codeMirror.replaceSelection(`\n{{footnote ${text}}}\n{{pageNumber,auto}}\n\n\\page\n\n`, 'end');
|
this.codeMirror.replaceSelection(`\n{{footnote ${text}}}\n{{pageNumber,auto}}\n\n\\page\n\n`, 'end');
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user