0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2026-01-04 14:42:40 +00:00

WOrking snippet editor - menu population regression

This commit is contained in:
David Bolack
2024-11-03 11:14:31 -06:00
parent 4f240bf110
commit b9b3d284cf
6 changed files with 61 additions and 27 deletions

View File

@@ -61,7 +61,6 @@ const EditPage = createClass({
currentEditorCursorPageNum : 1,
currentBrewRendererPageNum : 1,
displayLockMessage : this.props.brew.lock || false,
snippetsBundle : {},
themeBundle : {}
};
},
@@ -143,6 +142,19 @@ const EditPage = createClass({
}), ()=>{if(this.state.autoSave) this.trySave();});
},
handleSnipChange : function(snippet){
console.log('Snip Change!');
//If there are errors, run the validator on every change to give quick feedback
let htmlErrors = this.state.htmlErrors;
if(htmlErrors.length) htmlErrors = Markdown.validate(snippet);
this.setState((prevState)=>({
brew : { ...prevState.brew, snippets: snippet },
isPending : true,
htmlErrors : htmlErrors,
}), ()=>{if(this.state.autoSave) this.trySave();});
},
handleStyleChange : function(style){
this.setState((prevState)=>({
brew : { ...prevState.brew, style: style },
@@ -438,11 +450,12 @@ const EditPage = createClass({
onTextChange={this.handleTextChange}
onStyleChange={this.handleStyleChange}
onMetaChange={this.handleMetaChange}
onSnipChange={this.handleSnipChange}
reportError={this.errorReported}
renderer={this.state.brew.renderer}
userThemes={this.props.userThemes}
snippets={this.props.snippets}
snippetBundle={this.state.themeBundle.snippets}
themeBundle={this.state.themeBundle}
updateBrew={this.updateBrew}
onCursorPageChange={this.handleEditorCursorPageChange}
onViewPageChange={this.handleEditorViewPageChange}