mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2025-12-31 04:22:44 +00:00
initial fix
This commit is contained in:
@@ -13,7 +13,6 @@ const MetadataEditor = require('./metadataEditor/metadataEditor.jsx');
|
|||||||
const EDITOR_THEME_KEY = 'HOMEBREWERY-EDITOR-THEME';
|
const EDITOR_THEME_KEY = 'HOMEBREWERY-EDITOR-THEME';
|
||||||
|
|
||||||
const PAGEBREAK_REGEX_V3 = /^(?=\\page(?: *{[^\n{}]*})?$)/m;
|
const PAGEBREAK_REGEX_V3 = /^(?=\\page(?: *{[^\n{}]*})?$)/m;
|
||||||
const SNIPPETBAR_HEIGHT = 25;
|
|
||||||
const DEFAULT_STYLE_TEXT = dedent`
|
const DEFAULT_STYLE_TEXT = dedent`
|
||||||
/*=======--- Example CSS styling ---=======*/
|
/*=======--- Example CSS styling ---=======*/
|
||||||
/* Any CSS here will apply to your document! */
|
/* Any CSS here will apply to your document! */
|
||||||
@@ -65,9 +64,7 @@ const Editor = createClass({
|
|||||||
|
|
||||||
componentDidMount : function() {
|
componentDidMount : function() {
|
||||||
|
|
||||||
this.updateEditorSize();
|
|
||||||
this.highlightCustomMarkdown();
|
this.highlightCustomMarkdown();
|
||||||
window.addEventListener('resize', this.updateEditorSize);
|
|
||||||
document.getElementById('BrewRenderer').addEventListener('keydown', this.handleControlKeys);
|
document.getElementById('BrewRenderer').addEventListener('keydown', this.handleControlKeys);
|
||||||
document.addEventListener('keydown', this.handleControlKeys);
|
document.addEventListener('keydown', this.handleControlKeys);
|
||||||
|
|
||||||
@@ -82,10 +79,6 @@ const Editor = createClass({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
componentWillUnmount : function() {
|
|
||||||
window.removeEventListener('resize', this.updateEditorSize);
|
|
||||||
},
|
|
||||||
|
|
||||||
componentDidUpdate : function(prevProps, prevState, snapshot) {
|
componentDidUpdate : function(prevProps, prevState, snapshot) {
|
||||||
|
|
||||||
this.highlightCustomMarkdown();
|
this.highlightCustomMarkdown();
|
||||||
@@ -118,13 +111,6 @@ const Editor = createClass({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
updateEditorSize : function() {
|
|
||||||
if(this.codeEditor.current) {
|
|
||||||
let paneHeight = this.editor.current.parentNode.clientHeight;
|
|
||||||
paneHeight -= SNIPPETBAR_HEIGHT;
|
|
||||||
this.codeEditor.current.codeMirror.setSize(null, paneHeight);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
updateCurrentCursorPage : function(cursor) {
|
updateCurrentCursorPage : function(cursor) {
|
||||||
const lines = this.props.brew.text.split('\n').slice(1, cursor.line + 1);
|
const lines = this.props.brew.text.split('\n').slice(1, cursor.line + 1);
|
||||||
@@ -150,8 +136,7 @@ const Editor = createClass({
|
|||||||
view : newView
|
view : newView
|
||||||
}, ()=>{
|
}, ()=>{
|
||||||
this.codeEditor.current?.codeMirror.focus();
|
this.codeEditor.current?.codeMirror.focus();
|
||||||
this.updateEditorSize();
|
});
|
||||||
}); //TODO: not sure if updateeditorsize needed
|
|
||||||
},
|
},
|
||||||
|
|
||||||
highlightCustomMarkdown : function(){
|
highlightCustomMarkdown : function(){
|
||||||
|
|||||||
@@ -1,11 +1,16 @@
|
|||||||
@import 'themes/codeMirror/customEditorStyles.less';
|
@import 'themes/codeMirror/customEditorStyles.less';
|
||||||
.editor {
|
.editor {
|
||||||
|
height:100%;
|
||||||
position : relative;
|
position : relative;
|
||||||
width : 100%;
|
width : 100%;
|
||||||
container : editor / inline-size;
|
container : editor / inline-size;
|
||||||
|
|
||||||
.codeEditor {
|
.codeEditor {
|
||||||
height : 100%;
|
height : 100%;
|
||||||
|
|
||||||
|
.CodeMirror {
|
||||||
|
height:100%;
|
||||||
|
}
|
||||||
.pageLine {
|
.pageLine {
|
||||||
background : #33333328;
|
background : #33333328;
|
||||||
border-top : #333399 solid 1px;
|
border-top : #333399 solid 1px;
|
||||||
@@ -104,3 +109,11 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@container editor (width < 553px) {
|
||||||
|
|
||||||
|
.editor .codeEditor .CodeMirror {
|
||||||
|
height:calc(100% - 51px) ;
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user