0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2025-12-24 16:22:44 +00:00

Merge branch 'master' into preservePREColons

This commit is contained in:
David Bolack
2024-08-21 21:21:06 -05:00
4 changed files with 28 additions and 11 deletions

View File

@@ -59,6 +59,8 @@ const Editor = createClass({
this.updateEditorSize();
this.highlightCustomMarkdown();
window.addEventListener('resize', this.updateEditorSize);
document.getElementById('BrewRenderer').addEventListener('keydown', this.handleControlKeys);
document.addEventListener('keydown', this.handleControlKeys);
const editorTheme = window.localStorage.getItem(EDITOR_THEME_KEY);
if(editorTheme) {
@@ -82,6 +84,20 @@ const Editor = createClass({
};
},
handleControlKeys : function(e){
if(!(e.ctrlKey || e.metaKey)) return;
console.log(e);
const LEFTARROW_KEY = 37;
const RIGHTARROW_KEY = 39;
if (e.shiftKey && (e.keyCode == RIGHTARROW_KEY)) this.brewJump();
if (e.shiftKey && (e.keyCode == LEFTARROW_KEY)) this.sourceJump();
if ((e.keyCode == LEFTARROW_KEY) || (e.keyCode == RIGHTARROW_KEY)) {
e.stopPropagation();
e.preventDefault();
}
},
updateEditorSize : function() {
if(this.codeEditor.current) {
let paneHeight = this.editor.current.parentNode.clientHeight;
@@ -119,6 +135,7 @@ const Editor = createClass({
const codeMirror = this.codeEditor.current.codeMirror;
codeMirror.operation(()=>{ // Batch CodeMirror styling
//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();

17
package-lock.json generated
View File

@@ -14,7 +14,7 @@
"@babel/plugin-transform-runtime": "^7.24.7",
"@babel/preset-env": "^7.25.3",
"@babel/preset-react": "^7.24.7",
"@googleapis/drive": "^8.11.1",
"@googleapis/drive": "^8.13.0",
"body-parser": "^1.20.2",
"classnames": "^2.5.1",
"codemirror": "^5.65.6",
@@ -38,7 +38,7 @@
"marked-smartypants-lite": "^1.0.2",
"markedLegacy": "npm:marked@^0.3.19",
"moment": "^2.30.1",
"mongoose": "^8.5.2",
"mongoose": "^8.5.3",
"nanoid": "3.3.4",
"nconf": "^0.12.1",
"react": "^18.3.1",
@@ -2080,9 +2080,9 @@
}
},
"node_modules/@googleapis/drive": {
"version": "8.11.1",
"resolved": "https://registry.npmjs.org/@googleapis/drive/-/drive-8.11.1.tgz",
"integrity": "sha512-tkkjD7/CjypS6esQ/YhP3kEh86F4pEKa3YgvNMCI4Jg/eZzhBTvLQw+TqEfT/C/BoCF6jw2sgBoJQ9h8Qm2oIg==",
"version": "8.13.0",
"resolved": "https://registry.npmjs.org/@googleapis/drive/-/drive-8.13.0.tgz",
"integrity": "sha512-xpXzZeYtNNFLy1m2D5A8/QR2bngpjLPEvO5KZUW4Dlwi/SBHYNTjVm37IQagtQg6QUJlFb4lVLewenUdZZB1rA==",
"dependencies": {
"googleapis-common": "^7.0.0"
},
@@ -10831,10 +10831,9 @@
}
},
"node_modules/mongoose": {
"version": "8.5.2",
"resolved": "https://registry.npmjs.org/mongoose/-/mongoose-8.5.2.tgz",
"integrity": "sha512-GZB4rHMdYfGatV+23IpCrqFbyCOjCNOHXgWbirr92KRwTEncBrtW3kgU9vmpKjsGf7nMmnAy06SwWUv1vhDkSg==",
"license": "MIT",
"version": "8.5.3",
"resolved": "https://registry.npmjs.org/mongoose/-/mongoose-8.5.3.tgz",
"integrity": "sha512-OubSDbsAclDFGHjV82MsKyIGQWFc42Ot1l+0dhRS6U9xODM7rm/ES/WpOQd8Ds9j0Mx8QzxZtrSCnBh6o9wUqw==",
"dependencies": {
"bson": "^6.7.0",
"kareem": "2.6.3",

View File

@@ -87,7 +87,7 @@
"@babel/plugin-transform-runtime": "^7.24.7",
"@babel/preset-env": "^7.25.3",
"@babel/preset-react": "^7.24.7",
"@googleapis/drive": "^8.11.1",
"@googleapis/drive": "^8.13.0",
"body-parser": "^1.20.2",
"classnames": "^2.5.1",
"codemirror": "^5.65.6",
@@ -111,7 +111,7 @@
"marked-smartypants-lite": "^1.0.2",
"markedLegacy": "npm:marked@^0.3.19",
"moment": "^2.30.1",
"mongoose": "^8.5.2",
"mongoose": "^8.5.3",
"nanoid": "3.3.4",
"nconf": "^0.12.1",
"react": "^18.3.1",

View File

@@ -35,6 +35,7 @@ const printCurrentBrew = ()=>{
};
const fetchThemeBundle = async (obj, renderer, theme)=>{
if(!renderer || !theme) return;
const res = await request
.get(`/api/theme/${renderer}/${theme}`)
.catch((err)=>{