mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-01-01 15:12:40 +00:00
@@ -43,10 +43,8 @@ const CodeEditor = createClass({
|
|||||||
const newDoc = CodeMirror.Doc(this.props.value, this.props.language);
|
const newDoc = CodeMirror.Doc(this.props.value, this.props.language);
|
||||||
this.codeMirror.swapDoc(newDoc);
|
this.codeMirror.swapDoc(newDoc);
|
||||||
},
|
},
|
||||||
getSnapshotBeforeUpdate : function() {
|
|
||||||
return _.uniq(this.codeMirror.getAllMarks().filter((mark)=>mark.__isFold).map((mark)=>mark.find().from));
|
componentDidUpdate : function(prevProps) {
|
||||||
},
|
|
||||||
componentDidUpdate : function(prevProps, prevState, snapshot) {
|
|
||||||
if(prevProps.view !== this.props.view){ //view changed; swap documents
|
if(prevProps.view !== this.props.view){ //view changed; swap documents
|
||||||
let newDoc;
|
let newDoc;
|
||||||
|
|
||||||
@@ -66,12 +64,6 @@ const CodeEditor = createClass({
|
|||||||
} else if(this.codeMirror?.getValue() != this.props.value) { //update editor contents if brew.text is changed from outside
|
} else if(this.codeMirror?.getValue() != this.props.value) { //update editor contents if brew.text is changed from outside
|
||||||
this.codeMirror.setValue(this.props.value);
|
this.codeMirror.setValue(this.props.value);
|
||||||
}
|
}
|
||||||
|
|
||||||
setTimeout(()=>{
|
|
||||||
snapshot.forEach((fold)=>{
|
|
||||||
this.codeMirror.foldCode(fold, { scanUp: false }, 'fold');
|
|
||||||
});
|
|
||||||
}, 0);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
buildEditor : function() {
|
buildEditor : function() {
|
||||||
|
|||||||
Reference in New Issue
Block a user