From 5258e9f0e6d7957706286e90ae052bca1aabe267 Mon Sep 17 00:00:00 2001 From: Gazook89 <58999374+Gazook89@users.noreply.github.com> Date: Thu, 12 Aug 2021 22:41:34 -0500 Subject: [PATCH 001/145] Add Hotkey Ctrl/Cmd + K to create Link --- shared/naturalcrit/codeEditor/codeEditor.jsx | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/shared/naturalcrit/codeEditor/codeEditor.jsx b/shared/naturalcrit/codeEditor/codeEditor.jsx index 9707bde56..b8ecda048 100644 --- a/shared/naturalcrit/codeEditor/codeEditor.jsx +++ b/shared/naturalcrit/codeEditor/codeEditor.jsx @@ -54,7 +54,9 @@ const CodeEditor = createClass({ 'Ctrl-M' : this.makeSpan, 'Cmd-M' : this.makeSpan, 'Ctrl-/' : this.makeComment, - 'Cmd-/' : this.makeComment + 'Cmd-/' : this.makeComment, + 'Ctrl-K' : this.makeLink, + 'Cmd-K' : this.makeLink } }); @@ -99,6 +101,15 @@ const CodeEditor = createClass({ } }, + makeLink : function() { + const selection = this.codeMirror.getSelection(), t = selection.slice(0, 1) === '[' && selection.slice(-3) === ']()'; + this.codeMirror.replaceSelection(t ? selection.slice(1, -3) : `[${selection}]()`, 'around'); + if(selection.length === 0){ + const cursor = this.codeMirror.getCursor(); + this.codeMirror.setCursor({ line: cursor.line, ch: cursor.ch - 3 }); + } + }, + //=-- Externally used -==// setCursorPosition : function(line, char){ setTimeout(()=>{ From b89c10a298f1867c12ce72c686bbf8b4e8984481 Mon Sep 17 00:00:00 2001 From: Gazook89 <58999374+Gazook89@users.noreply.github.com> Date: Thu, 12 Aug 2021 22:48:42 -0500 Subject: [PATCH 002/145] Change cursor finish position Change cursor finish position --- shared/naturalcrit/codeEditor/codeEditor.jsx | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/shared/naturalcrit/codeEditor/codeEditor.jsx b/shared/naturalcrit/codeEditor/codeEditor.jsx index b8ecda048..2b8879f7c 100644 --- a/shared/naturalcrit/codeEditor/codeEditor.jsx +++ b/shared/naturalcrit/codeEditor/codeEditor.jsx @@ -104,10 +104,8 @@ const CodeEditor = createClass({ makeLink : function() { const selection = this.codeMirror.getSelection(), t = selection.slice(0, 1) === '[' && selection.slice(-3) === ']()'; this.codeMirror.replaceSelection(t ? selection.slice(1, -3) : `[${selection}]()`, 'around'); - if(selection.length === 0){ - const cursor = this.codeMirror.getCursor(); - this.codeMirror.setCursor({ line: cursor.line, ch: cursor.ch - 3 }); - } + const cursor = this.codeMirror.getCursor(); + this.codeMirror.setCursor({ line: cursor.line, ch: cursor.ch - 1 }); }, //=-- Externally used -==// From 727a58f56d285a34bb3cf6cfb622499d34667dc3 Mon Sep 17 00:00:00 2001 From: Gazook89 <58999374+Gazook89@users.noreply.github.com> Date: Fri, 13 Aug 2021 08:28:02 -0500 Subject: [PATCH 003/145] Fixed cursor finish position - tested on single words and multi word strings - tested removal of hyperlink - tested with highlighting selection from left to right, and right to left. - tested on empty strings --- shared/naturalcrit/codeEditor/codeEditor.jsx | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/shared/naturalcrit/codeEditor/codeEditor.jsx b/shared/naturalcrit/codeEditor/codeEditor.jsx index 2b8879f7c..7f0c315fe 100644 --- a/shared/naturalcrit/codeEditor/codeEditor.jsx +++ b/shared/naturalcrit/codeEditor/codeEditor.jsx @@ -103,9 +103,12 @@ const CodeEditor = createClass({ makeLink : function() { const selection = this.codeMirror.getSelection(), t = selection.slice(0, 1) === '[' && selection.slice(-3) === ']()'; - this.codeMirror.replaceSelection(t ? selection.slice(1, -3) : `[${selection}]()`, 'around'); - const cursor = this.codeMirror.getCursor(); - this.codeMirror.setCursor({ line: cursor.line, ch: cursor.ch - 1 }); + this.codeMirror.replaceSelection(t ? selection.slice(1, -3) : `[${selection}]()`); + if ((selection.slice(0, 1) !== '[' || selection.slice(-3) !== ']()') || selection.length === 0){ + const cursor = this.codeMirror.getCursor(); + console.log('hello'); + this.codeMirror.setCursor({ line: cursor.line, ch: cursor.ch - 1 }); + } }, //=-- Externally used -==// From 8c03b453b2eeabb761829329cac6c18bc80b9e59 Mon Sep 17 00:00:00 2001 From: Gazook89 <58999374+Gazook89@users.noreply.github.com> Date: Fri, 13 Aug 2021 08:31:41 -0500 Subject: [PATCH 004/145] circleCI fix --- shared/naturalcrit/codeEditor/codeEditor.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shared/naturalcrit/codeEditor/codeEditor.jsx b/shared/naturalcrit/codeEditor/codeEditor.jsx index 7f0c315fe..85214b1d1 100644 --- a/shared/naturalcrit/codeEditor/codeEditor.jsx +++ b/shared/naturalcrit/codeEditor/codeEditor.jsx @@ -104,7 +104,7 @@ const CodeEditor = createClass({ makeLink : function() { const selection = this.codeMirror.getSelection(), t = selection.slice(0, 1) === '[' && selection.slice(-3) === ']()'; this.codeMirror.replaceSelection(t ? selection.slice(1, -3) : `[${selection}]()`); - if ((selection.slice(0, 1) !== '[' || selection.slice(-3) !== ']()') || selection.length === 0){ + if((selection.slice(0, 1) !== '[' || selection.slice(-3) !== ']()') || selection.length === 0){ const cursor = this.codeMirror.getCursor(); console.log('hello'); this.codeMirror.setCursor({ line: cursor.line, ch: cursor.ch - 1 }); From ae75eb07b70858bc98fbff1ee65f055d7d27b3b0 Mon Sep 17 00:00:00 2001 From: Gazook89 <58999374+Gazook89@users.noreply.github.com> Date: Sun, 5 Sep 2021 20:33:51 -0500 Subject: [PATCH 005/145] matched functionality of link hotkey in github --- shared/naturalcrit/codeEditor/codeEditor.jsx | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/shared/naturalcrit/codeEditor/codeEditor.jsx b/shared/naturalcrit/codeEditor/codeEditor.jsx index 85214b1d1..cf08de0b3 100644 --- a/shared/naturalcrit/codeEditor/codeEditor.jsx +++ b/shared/naturalcrit/codeEditor/codeEditor.jsx @@ -102,12 +102,11 @@ const CodeEditor = createClass({ }, makeLink : function() { - const selection = this.codeMirror.getSelection(), t = selection.slice(0, 1) === '[' && selection.slice(-3) === ']()'; - this.codeMirror.replaceSelection(t ? selection.slice(1, -3) : `[${selection}]()`); - if((selection.slice(0, 1) !== '[' || selection.slice(-3) !== ']()') || selection.length === 0){ + const selection = this.codeMirror.getSelection(), t = selection.slice(0, 1) === '[' && selection.slice(-6) === '](url)'; + this.codeMirror.replaceSelection(t ? selection.slice(1, -6) : `[${selection}](url)`); + if((selection.slice(0, 1) !== '[' || selection.slice(-6) !== '](url)') || selection.length === 0){ const cursor = this.codeMirror.getCursor(); - console.log('hello'); - this.codeMirror.setCursor({ line: cursor.line, ch: cursor.ch - 1 }); + this.codeMirror.setSelection({ line: cursor.line, ch: cursor.ch - 4 }, { line: cursor.line, ch: cursor.ch - 1 }); } }, From 08c845ff006ef60ee9f8c7855f845511a525fd92 Mon Sep 17 00:00:00 2001 From: Gazook89 <58999374+Gazook89@users.noreply.github.com> Date: Mon, 6 Sep 2021 20:35:55 -0500 Subject: [PATCH 006/145] add underline hotkey and change italic hotkey to * Using `*` rather than `_` characters for italics is more inline with existing snippets. --- shared/naturalcrit/codeEditor/codeEditor.jsx | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/shared/naturalcrit/codeEditor/codeEditor.jsx b/shared/naturalcrit/codeEditor/codeEditor.jsx index 9707bde56..f32a7e130 100644 --- a/shared/naturalcrit/codeEditor/codeEditor.jsx +++ b/shared/naturalcrit/codeEditor/codeEditor.jsx @@ -51,6 +51,8 @@ const CodeEditor = createClass({ 'Cmd-B' : this.makeBold, 'Ctrl-I' : this.makeItalic, 'Cmd-I' : this.makeItalic, + 'Ctrl-U' : this.makeUnderline, + 'Cmd-U' : this.makeUnderline, 'Ctrl-M' : this.makeSpan, 'Cmd-M' : this.makeSpan, 'Ctrl-/' : this.makeComment, @@ -73,14 +75,23 @@ const CodeEditor = createClass({ }, makeItalic : function() { - const selection = this.codeMirror.getSelection(), t = selection.slice(0, 1) === '_' && selection.slice(-1) === '_'; - this.codeMirror.replaceSelection(t ? selection.slice(1, -1) : `_${selection}_`, 'around'); + const selection = this.codeMirror.getSelection(), t = selection.slice(0, 1) === '*' && selection.slice(-1) === '*'; + this.codeMirror.replaceSelection(t ? selection.slice(1, -1) : `*${selection}*`, 'around'); if(selection.length === 0){ const cursor = this.codeMirror.getCursor(); this.codeMirror.setCursor({ line: cursor.line, ch: cursor.ch - 1 }); } }, + makeUnderline : function() { + const selection = this.codeMirror.getSelection(), t = selection.slice(0, 3) === '' && selection.slice(-4) === ''; + this.codeMirror.replaceSelection(t ? selection.slice(3, -4) : `${selection}`, 'around'); + if(selection.length === 0){ + const cursor = this.codeMirror.getCursor(); + this.codeMirror.setCursor({ line: cursor.line, ch: cursor.ch - 4 }); + } + }, + makeSpan : function() { const selection = this.codeMirror.getSelection(), t = selection.slice(0, 2) === '{{' && selection.slice(-2) === '}}'; this.codeMirror.replaceSelection(t ? selection.slice(2, -2) : `{{ ${selection}}}`, 'around'); From 7dcd3356306632523c526cb4538ddfd06005dbf9 Mon Sep 17 00:00:00 2001 From: Gazook89 <58999374+Gazook89@users.noreply.github.com> Date: Mon, 6 Sep 2021 21:12:48 -0500 Subject: [PATCH 007/145] add makeDiv hotkey - V3 Curly Divs Shift-Cmd/Ctrl-M makes a curly div. --- shared/naturalcrit/codeEditor/codeEditor.jsx | 31 +++++++++++++------- 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/shared/naturalcrit/codeEditor/codeEditor.jsx b/shared/naturalcrit/codeEditor/codeEditor.jsx index f32a7e130..6858d5840 100644 --- a/shared/naturalcrit/codeEditor/codeEditor.jsx +++ b/shared/naturalcrit/codeEditor/codeEditor.jsx @@ -47,16 +47,18 @@ const CodeEditor = createClass({ indentWithTabs : true, tabSize : 2, extraKeys : { - 'Ctrl-B' : this.makeBold, - 'Cmd-B' : this.makeBold, - 'Ctrl-I' : this.makeItalic, - 'Cmd-I' : this.makeItalic, - 'Ctrl-U' : this.makeUnderline, - 'Cmd-U' : this.makeUnderline, - 'Ctrl-M' : this.makeSpan, - 'Cmd-M' : this.makeSpan, - 'Ctrl-/' : this.makeComment, - 'Cmd-/' : this.makeComment + 'Ctrl-B' : this.makeBold, + 'Cmd-B' : this.makeBold, + 'Ctrl-I' : this.makeItalic, + 'Cmd-I' : this.makeItalic, + 'Ctrl-U' : this.makeUnderline, + 'Cmd-U' : this.makeUnderline, + 'Ctrl-M' : this.makeSpan, + 'Cmd-M' : this.makeSpan, + 'Shift-Ctrl-M' : this.makeDiv, + 'Shift-Cmd-M' : this.makeDiv, + 'Ctrl-/' : this.makeComment, + 'Cmd-/' : this.makeComment } }); @@ -101,6 +103,15 @@ const CodeEditor = createClass({ } }, + makeDiv : function() { + const selection = this.codeMirror.getSelection(), t = selection.slice(0, 2) === '{{' && selection.slice(-2) === '}}'; + this.codeMirror.replaceSelection(t ? selection.slice(2, -2) : `{{\n${selection}\n}}`, 'around'); + if(selection.length === 0){ + const cursor = this.codeMirror.getCursor(); + this.codeMirror.setCursor({ line: cursor.line - 1, ch: cursor.ch }); // set to -2? if wanting to enter classes etc. if so, get rid of first \n when replacing selection + } + }, + makeComment : function() { const selection = this.codeMirror.getSelection(), t = selection.slice(0, 4) === ''; this.codeMirror.replaceSelection(t ? selection.slice(4, -3) : ``, 'around'); From 389ad1cf1778d88141935996a436dcbe8d7a6797 Mon Sep 17 00:00:00 2001 From: Gazook89 <58999374+Gazook89@users.noreply.github.com> Date: Fri, 10 Sep 2021 23:18:23 -0500 Subject: [PATCH 008/145] add hotkeys for   and empty makeNbsp, makeSpace, removeSpace --- shared/naturalcrit/codeEditor/codeEditor.jsx | 30 ++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/shared/naturalcrit/codeEditor/codeEditor.jsx b/shared/naturalcrit/codeEditor/codeEditor.jsx index 6858d5840..6d5685cd7 100644 --- a/shared/naturalcrit/codeEditor/codeEditor.jsx +++ b/shared/naturalcrit/codeEditor/codeEditor.jsx @@ -53,6 +53,12 @@ const CodeEditor = createClass({ 'Cmd-I' : this.makeItalic, 'Ctrl-U' : this.makeUnderline, 'Cmd-U' : this.makeUnderline, + 'Ctrl-.' : this.makeNbsp, + 'Cmd-.' : this.makeNbsp, + 'Shift-Ctrl-.' : this.makeSpace, + 'Shift-Cmd-.' : this.makeSpace, + 'Shift-Ctrl-,' : this.removeSpace, + 'Shift-Cmd-,' : this.removeSpace, 'Ctrl-M' : this.makeSpan, 'Cmd-M' : this.makeSpan, 'Shift-Ctrl-M' : this.makeDiv, @@ -85,6 +91,30 @@ const CodeEditor = createClass({ } }, + makeNbsp : function() { + this.codeMirror.replaceSelection(' ', 'end'); + }, + + makeSpace : function() { + const selection = this.codeMirror.getSelection(); + const t = selection.slice(0, 8) === '{{width:' && selection.slice(0 -4) === '% }}'; + if(t){ + const percent = parseInt(selection.slice(8, -4)) + 10; + this.codeMirror.replaceSelection(percent < 90 ? `{{width:${percent}% }}` : '{{width:100% }}', 'around'); + } else { + this.codeMirror.replaceSelection(`{{width:10% }}`, 'around'); + } + }, + + removeSpace : function() { + const selection = this.codeMirror.getSelection(); + const t = selection.slice(0, 8) === '{{width:' && selection.slice(0 -4) === '% }}'; + if(t){ + const percent = parseInt(selection.slice(8, -4)) - 10; + this.codeMirror.replaceSelection(percent > 10 ? `{{width:${percent}% }}` : '', 'around'); + } + }, + makeUnderline : function() { const selection = this.codeMirror.getSelection(), t = selection.slice(0, 3) === '' && selection.slice(-4) === ''; this.codeMirror.replaceSelection(t ? selection.slice(3, -4) : `${selection}`, 'around'); From bec2a7c77abca010522ea920aed1e56374c07839 Mon Sep 17 00:00:00 2001 From: Gazook89 <58999374+Gazook89@users.noreply.github.com> Date: Sat, 11 Sep 2021 00:12:58 -0500 Subject: [PATCH 009/145] add hotkeys for new \page and \column --- shared/naturalcrit/codeEditor/codeEditor.jsx | 48 ++++++++++++-------- 1 file changed, 30 insertions(+), 18 deletions(-) diff --git a/shared/naturalcrit/codeEditor/codeEditor.jsx b/shared/naturalcrit/codeEditor/codeEditor.jsx index 6d5685cd7..a810bee3a 100644 --- a/shared/naturalcrit/codeEditor/codeEditor.jsx +++ b/shared/naturalcrit/codeEditor/codeEditor.jsx @@ -47,24 +47,28 @@ const CodeEditor = createClass({ indentWithTabs : true, tabSize : 2, extraKeys : { - 'Ctrl-B' : this.makeBold, - 'Cmd-B' : this.makeBold, - 'Ctrl-I' : this.makeItalic, - 'Cmd-I' : this.makeItalic, - 'Ctrl-U' : this.makeUnderline, - 'Cmd-U' : this.makeUnderline, - 'Ctrl-.' : this.makeNbsp, - 'Cmd-.' : this.makeNbsp, - 'Shift-Ctrl-.' : this.makeSpace, - 'Shift-Cmd-.' : this.makeSpace, - 'Shift-Ctrl-,' : this.removeSpace, - 'Shift-Cmd-,' : this.removeSpace, - 'Ctrl-M' : this.makeSpan, - 'Cmd-M' : this.makeSpan, - 'Shift-Ctrl-M' : this.makeDiv, - 'Shift-Cmd-M' : this.makeDiv, - 'Ctrl-/' : this.makeComment, - 'Cmd-/' : this.makeComment + 'Ctrl-B' : this.makeBold, + 'Cmd-B' : this.makeBold, + 'Ctrl-I' : this.makeItalic, + 'Cmd-I' : this.makeItalic, + 'Ctrl-U' : this.makeUnderline, + 'Cmd-U' : this.makeUnderline, + 'Ctrl-.' : this.makeNbsp, + 'Cmd-.' : this.makeNbsp, + 'Shift-Ctrl-.' : this.makeSpace, + 'Shift-Cmd-.' : this.makeSpace, + 'Shift-Ctrl-,' : this.removeSpace, + 'Shift-Cmd-,' : this.removeSpace, + 'Shift-Ctrl-Enter' : this.newColumn, + 'Shift-Cmd-Enter' : this.newColumn, + 'Ctrl-Enter' : this.newPage, + 'Cmd-Enter' : this.newPage, + 'Ctrl-M' : this.makeSpan, + 'Cmd-M' : this.makeSpan, + 'Shift-Ctrl-M' : this.makeDiv, + 'Shift-Cmd-M' : this.makeDiv, + 'Ctrl-/' : this.makeComment, + 'Cmd-/' : this.makeComment } }); @@ -115,6 +119,14 @@ const CodeEditor = createClass({ } }, + newColumn : function() { + this.codeMirror.replaceSelection('\n\\column\n\n', 'end'); + }, + + newPage : function() { + this.codeMirror.replaceSelection('\n\\page\n\n', 'end'); + }, + makeUnderline : function() { const selection = this.codeMirror.getSelection(), t = selection.slice(0, 3) === '' && selection.slice(-4) === ''; this.codeMirror.replaceSelection(t ? selection.slice(3, -4) : `${selection}`, 'around'); From 508eee3f952776c3cfc1f3a0e68503c11acc19fa Mon Sep 17 00:00:00 2001 From: "G.Ambatte" Date: Sun, 19 Sep 2021 19:26:44 +1200 Subject: [PATCH 010/145] Initial pass at Editor Toolbar - Undo and Redo. --- client/homebrew/editor/editor.jsx | 17 +++++++++++++++++ client/homebrew/editor/editor.less | 12 ++++++++++++ shared/naturalcrit/codeEditor/codeEditor.jsx | 6 ++++++ 3 files changed, 35 insertions(+) diff --git a/client/homebrew/editor/editor.jsx b/client/homebrew/editor/editor.jsx index 20f084c28..95bb68447 100644 --- a/client/homebrew/editor/editor.jsx +++ b/client/homebrew/editor/editor.jsx @@ -1,3 +1,4 @@ +/*eslint max-lines: ["warn", {"max": 300, "skipBlankLines": true, "skipComments": true}]*/ require('./editor.less'); const React = require('react'); const createClass = require('create-react-class'); @@ -198,6 +199,21 @@ const Editor = createClass({ } }, + renderEditorToolbar : function(){ + return
+ + + + + + +
; + }, + render : function(){ this.highlightCustomMarkdown(); return ( @@ -211,6 +227,7 @@ const Editor = createClass({ renderer={this.props.renderer} /> {this.renderEditor()} + {!this.isMeta() && this.renderEditorToolbar()} ); } diff --git a/client/homebrew/editor/editor.less b/client/homebrew/editor/editor.less index cd190ea88..ec66b191c 100644 --- a/client/homebrew/editor/editor.less +++ b/client/homebrew/editor/editor.less @@ -42,4 +42,16 @@ .tooltipLeft("Jump to brew page"); } + .editorToolbar{ + position: absolute; + top: 5px; + left: 50%; + color: black; + font-size: 13px; + z-index: 9; + span { + padding: 2px 5px; + } + } + } diff --git a/shared/naturalcrit/codeEditor/codeEditor.jsx b/shared/naturalcrit/codeEditor/codeEditor.jsx index 9707bde56..5d00cc04c 100644 --- a/shared/naturalcrit/codeEditor/codeEditor.jsx +++ b/shared/naturalcrit/codeEditor/codeEditor.jsx @@ -112,6 +112,12 @@ const CodeEditor = createClass({ updateSize : function(){ this.codeMirror.refresh(); }, + redo : function(){ + this.codeMirror.redo(); + }, + undo : function(){ + this.codeMirror.undo(); + }, //----------------------// render : function(){ From ec2c74f09300bb3741d54c61c1f83333e023e3ad Mon Sep 17 00:00:00 2001 From: Rodrigo Kuerten Date: Tue, 21 Sep 2021 17:11:07 -0300 Subject: [PATCH 011/145] Created base make header functions --- shared/naturalcrit/codeEditor/codeEditor.jsx | 28 ++++++++++++++------ 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/shared/naturalcrit/codeEditor/codeEditor.jsx b/shared/naturalcrit/codeEditor/codeEditor.jsx index 9707bde56..368af3e9c 100644 --- a/shared/naturalcrit/codeEditor/codeEditor.jsx +++ b/shared/naturalcrit/codeEditor/codeEditor.jsx @@ -47,14 +47,20 @@ const CodeEditor = createClass({ indentWithTabs : true, tabSize : 2, extraKeys : { - 'Ctrl-B' : this.makeBold, - 'Cmd-B' : this.makeBold, - 'Ctrl-I' : this.makeItalic, - 'Cmd-I' : this.makeItalic, - 'Ctrl-M' : this.makeSpan, - 'Cmd-M' : this.makeSpan, - 'Ctrl-/' : this.makeComment, - 'Cmd-/' : this.makeComment + 'Ctrl-B' : this.makeBold, + 'Cmd-B' : this.makeBold, + 'Ctrl-I' : this.makeItalic, + 'Cmd-I' : this.makeItalic, + 'Ctrl-M' : this.makeSpan, + 'Cmd-M' : this.makeSpan, + 'Ctrl-/' : this.makeComment, + 'Cmd-/' : this.makeComment, + 'Shift-Ctrl-1' : ()=>this.makeHeader(1), + 'Shift-Ctrl-2' : ()=>this.makeHeader(2), + 'Shift-Ctrl-3' : ()=>this.makeHeader(3), + 'Shift-Ctrl-4' : ()=>this.makeHeader(4), + 'Shift-Ctrl-5' : ()=>this.makeHeader(5), + 'Shift-Ctrl-6' : ()=>this.makeHeader(6), } }); @@ -63,6 +69,12 @@ const CodeEditor = createClass({ this.updateSize(); }, + makeHeader : function (number) { + const selection = this.codeMirror.getSelection(); + const header = Array(number).fill('#').join(''); + this.codeMirror.replaceSelection(`${header} ${selection}`, 'around'); + }, + makeBold : function() { const selection = this.codeMirror.getSelection(), t = selection.slice(0, 2) === '**' && selection.slice(-2) === '**'; this.codeMirror.replaceSelection(t ? selection.slice(2, -2) : `**${selection}**`, 'around'); From bbad4b9e8ace3c0665adbeea209d6ddbf4b2e0c4 Mon Sep 17 00:00:00 2001 From: Rodrigo Kuerten Date: Tue, 21 Sep 2021 17:25:37 -0300 Subject: [PATCH 012/145] Removed H1 and H2 options and updated cursor after added hashtags --- shared/naturalcrit/codeEditor/codeEditor.jsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/shared/naturalcrit/codeEditor/codeEditor.jsx b/shared/naturalcrit/codeEditor/codeEditor.jsx index 368af3e9c..8b96f0d0f 100644 --- a/shared/naturalcrit/codeEditor/codeEditor.jsx +++ b/shared/naturalcrit/codeEditor/codeEditor.jsx @@ -55,8 +55,6 @@ const CodeEditor = createClass({ 'Cmd-M' : this.makeSpan, 'Ctrl-/' : this.makeComment, 'Cmd-/' : this.makeComment, - 'Shift-Ctrl-1' : ()=>this.makeHeader(1), - 'Shift-Ctrl-2' : ()=>this.makeHeader(2), 'Shift-Ctrl-3' : ()=>this.makeHeader(3), 'Shift-Ctrl-4' : ()=>this.makeHeader(4), 'Shift-Ctrl-5' : ()=>this.makeHeader(5), @@ -73,6 +71,8 @@ const CodeEditor = createClass({ const selection = this.codeMirror.getSelection(); const header = Array(number).fill('#').join(''); this.codeMirror.replaceSelection(`${header} ${selection}`, 'around'); + const cursor = this.codeMirror.getCursor(); + this.codeMirror.setCursor({ line: cursor.line, ch: cursor.ch + selection.length + number + 1 }); }, makeBold : function() { From c10bdabee0d057c3aa315cec09c9008ffa5e8c2a Mon Sep 17 00:00:00 2001 From: Rodrigo Kuerten Date: Wed, 22 Sep 2021 18:21:34 -0300 Subject: [PATCH 013/145] Added h1 and h2 & cmd version --- shared/naturalcrit/codeEditor/codeEditor.jsx | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/shared/naturalcrit/codeEditor/codeEditor.jsx b/shared/naturalcrit/codeEditor/codeEditor.jsx index 8b96f0d0f..9c506a020 100644 --- a/shared/naturalcrit/codeEditor/codeEditor.jsx +++ b/shared/naturalcrit/codeEditor/codeEditor.jsx @@ -55,10 +55,18 @@ const CodeEditor = createClass({ 'Cmd-M' : this.makeSpan, 'Ctrl-/' : this.makeComment, 'Cmd-/' : this.makeComment, + 'Shift-Ctrl-1' : ()=>this.makeHeader(1), + 'Shift-Ctrl-2' : ()=>this.makeHeader(2), 'Shift-Ctrl-3' : ()=>this.makeHeader(3), 'Shift-Ctrl-4' : ()=>this.makeHeader(4), 'Shift-Ctrl-5' : ()=>this.makeHeader(5), 'Shift-Ctrl-6' : ()=>this.makeHeader(6), + 'Shift-Cmd-1' : ()=>this.makeHeader(1), + 'Shift-Cmd-2' : ()=>this.makeHeader(2), + 'Shift-Cmd-3' : ()=>this.makeHeader(3), + 'Shift-Cmd-4' : ()=>this.makeHeader(4), + 'Shift-Cmd-5' : ()=>this.makeHeader(5), + 'Shift-Cmd-6' : ()=>this.makeHeader(6), } }); From beb3c7ec89d10ffa2838bfc2602a018a0c032789 Mon Sep 17 00:00:00 2001 From: Gazook89 <58999374+Gazook89@users.noreply.github.com> Date: Thu, 23 Sep 2021 00:22:40 -0500 Subject: [PATCH 014/145] make undo behavior work regardless of url text --- shared/naturalcrit/codeEditor/codeEditor.jsx | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/shared/naturalcrit/codeEditor/codeEditor.jsx b/shared/naturalcrit/codeEditor/codeEditor.jsx index cf08de0b3..f49cd29b1 100644 --- a/shared/naturalcrit/codeEditor/codeEditor.jsx +++ b/shared/naturalcrit/codeEditor/codeEditor.jsx @@ -102,9 +102,16 @@ const CodeEditor = createClass({ }, makeLink : function() { - const selection = this.codeMirror.getSelection(), t = selection.slice(0, 1) === '[' && selection.slice(-6) === '](url)'; - this.codeMirror.replaceSelection(t ? selection.slice(1, -6) : `[${selection}](url)`); - if((selection.slice(0, 1) !== '[' || selection.slice(-6) !== '](url)') || selection.length === 0){ + const isLink = /^\[(.*)(\]\()(.*)\)$/g; + const selection = this.codeMirror.getSelection(); + if(isLink.test(selection) == true){ + const altText = selection.slice(1, selection.lastIndexOf('](')); + const url = selection.slice(selection.lastIndexOf('](') + 2, -1); + this.codeMirror.replaceSelection(`${altText} ${url}`); + const cursor = this.codeMirror.getCursor(); + this.codeMirror.setSelection({ line: cursor.line, ch: cursor.ch - url.length }, { line: cursor.line, ch: cursor.ch }); + } else { + this.codeMirror.replaceSelection(`[${selection}](url)`); const cursor = this.codeMirror.getCursor(); this.codeMirror.setSelection({ line: cursor.line, ch: cursor.ch - 4 }, { line: cursor.line, ch: cursor.ch - 1 }); } From b3e37dd2c10612c288e4c7d87ba9ea02a886cf6b Mon Sep 17 00:00:00 2001 From: Gazook89 <58999374+Gazook89@users.noreply.github.com> Date: Thu, 23 Sep 2021 01:01:02 -0500 Subject: [PATCH 015/145] add comment about trying capture groups in future. --- shared/naturalcrit/codeEditor/codeEditor.jsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/shared/naturalcrit/codeEditor/codeEditor.jsx b/shared/naturalcrit/codeEditor/codeEditor.jsx index f49cd29b1..c39c43da2 100644 --- a/shared/naturalcrit/codeEditor/codeEditor.jsx +++ b/shared/naturalcrit/codeEditor/codeEditor.jsx @@ -105,8 +105,8 @@ const CodeEditor = createClass({ const isLink = /^\[(.*)(\]\()(.*)\)$/g; const selection = this.codeMirror.getSelection(); if(isLink.test(selection) == true){ - const altText = selection.slice(1, selection.lastIndexOf('](')); - const url = selection.slice(selection.lastIndexOf('](') + 2, -1); + const altText = selection.slice(1, selection.lastIndexOf('](')); // could likely be done better with capture groups + const url = selection.slice(selection.lastIndexOf('](') + 2, -1); // could likely be done better with capture groups this.codeMirror.replaceSelection(`${altText} ${url}`); const cursor = this.codeMirror.getCursor(); this.codeMirror.setSelection({ line: cursor.line, ch: cursor.ch - url.length }, { line: cursor.line, ch: cursor.ch }); From ba9413eae5d20d9be288fa7e41783f33e92be54a Mon Sep 17 00:00:00 2001 From: Gazook89 <58999374+Gazook89@users.noreply.github.com> Date: Mon, 27 Sep 2021 09:31:59 -0500 Subject: [PATCH 016/145] initial commit, add hotkey definitions --- shared/naturalcrit/codeEditor/codeEditor.jsx | 24 +++++++++++++------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/shared/naturalcrit/codeEditor/codeEditor.jsx b/shared/naturalcrit/codeEditor/codeEditor.jsx index 9707bde56..fe63f7565 100644 --- a/shared/naturalcrit/codeEditor/codeEditor.jsx +++ b/shared/naturalcrit/codeEditor/codeEditor.jsx @@ -47,14 +47,18 @@ const CodeEditor = createClass({ indentWithTabs : true, tabSize : 2, extraKeys : { - 'Ctrl-B' : this.makeBold, - 'Cmd-B' : this.makeBold, - 'Ctrl-I' : this.makeItalic, - 'Cmd-I' : this.makeItalic, - 'Ctrl-M' : this.makeSpan, - 'Cmd-M' : this.makeSpan, - 'Ctrl-/' : this.makeComment, - 'Cmd-/' : this.makeComment + 'Ctrl-B' : this.makeBold, + 'Cmd-B' : this.makeBold, + 'Ctrl-I' : this.makeItalic, + 'Cmd-I' : this.makeItalic, + 'Ctrl-M' : this.makeSpan, + 'Cmd-M' : this.makeSpan, + 'Ctrl-/' : this.makeComment, + 'Cmd-/' : this.makeComment, + 'Ctrl-L' : this.makeUnOrderedList, + 'Cmd-L' : this.makeUnOrderedList, + 'Shift-Ctrl-L' : this.makeOrderedList, + 'Shift-Cmd-L' : this.makeOrderedList } }); @@ -99,6 +103,10 @@ const CodeEditor = createClass({ } }, + makeUnOrderedList : function() { + const selection = this.codeMirror.getSelection() + } + //=-- Externally used -==// setCursorPosition : function(line, char){ setTimeout(()=>{ From cb0f5217fe734f11f106b3a76493d122a55ffb97 Mon Sep 17 00:00:00 2001 From: Gazook89 <58999374+Gazook89@users.noreply.github.com> Date: Mon, 27 Sep 2021 21:23:05 -0500 Subject: [PATCH 017/145] get and set selection to cover entire lines --- shared/naturalcrit/codeEditor/codeEditor.jsx | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/shared/naturalcrit/codeEditor/codeEditor.jsx b/shared/naturalcrit/codeEditor/codeEditor.jsx index fe63f7565..b641a403a 100644 --- a/shared/naturalcrit/codeEditor/codeEditor.jsx +++ b/shared/naturalcrit/codeEditor/codeEditor.jsx @@ -104,8 +104,20 @@ const CodeEditor = createClass({ }, makeUnOrderedList : function() { - const selection = this.codeMirror.getSelection() - } + const isList = /^-\s/gm; + const selectionStart = this.codeMirror.getCursor('from'); + const selectionEnd = this.codeMirror.getCursor('to'); + const selection = this.codeMirror.setSelection( + { line: selectionStart.line, ch: 0 }, + { line: selectionEnd.line, ch: this.codeMirror.getLine(selectionEnd.line).length }); + console.log(selectionStart, selectionEnd, selection); + }, + + + // ordered list: + // selection should expand to include the full line even if selection is only part of line + // regex should match "- " at beginning of selection + // regex should match "- " at beginnign of each line or maybe "\n- " //=-- Externally used -==// setCursorPosition : function(line, char){ From 41609f90ea4ddf66c1071f4acba286b864e2dded Mon Sep 17 00:00:00 2001 From: Gazook89 <58999374+Gazook89@users.noreply.github.com> Date: Mon, 27 Sep 2021 21:34:09 -0500 Subject: [PATCH 018/145] update to detect if an unordered list or not. --- shared/naturalcrit/codeEditor/codeEditor.jsx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/shared/naturalcrit/codeEditor/codeEditor.jsx b/shared/naturalcrit/codeEditor/codeEditor.jsx index b641a403a..a91fda406 100644 --- a/shared/naturalcrit/codeEditor/codeEditor.jsx +++ b/shared/naturalcrit/codeEditor/codeEditor.jsx @@ -111,6 +111,11 @@ const CodeEditor = createClass({ { line: selectionStart.line, ch: 0 }, { line: selectionEnd.line, ch: this.codeMirror.getLine(selectionEnd.line).length }); console.log(selectionStart, selectionEnd, selection); + if(isList.test(this.codeMirror.getSelection()) == true){ + console.log('is list'); + } else { + console.log('is not a list'); + } }, From 6717692187c554b12945feb3b9a95ea8ed6b91f7 Mon Sep 17 00:00:00 2001 From: Gazook89 <58999374+Gazook89@users.noreply.github.com> Date: Tue, 28 Sep 2021 11:19:02 -0500 Subject: [PATCH 019/145] finish UL creation/removal function --- shared/naturalcrit/codeEditor/codeEditor.jsx | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/shared/naturalcrit/codeEditor/codeEditor.jsx b/shared/naturalcrit/codeEditor/codeEditor.jsx index a91fda406..997143faf 100644 --- a/shared/naturalcrit/codeEditor/codeEditor.jsx +++ b/shared/naturalcrit/codeEditor/codeEditor.jsx @@ -104,17 +104,18 @@ const CodeEditor = createClass({ }, makeUnOrderedList : function() { - const isList = /^-\s/gm; const selectionStart = this.codeMirror.getCursor('from'); const selectionEnd = this.codeMirror.getCursor('to'); - const selection = this.codeMirror.setSelection( + this.codeMirror.setSelection( { line: selectionStart.line, ch: 0 }, - { line: selectionEnd.line, ch: this.codeMirror.getLine(selectionEnd.line).length }); - console.log(selectionStart, selectionEnd, selection); - if(isList.test(this.codeMirror.getSelection()) == true){ - console.log('is list'); + { line: selectionEnd.line, ch: this.codeMirror.getLine(selectionEnd.line).length } + ); + const isUL = /^-\s/gm; + const newSelection = this.codeMirror.getSelection(); + if(newSelection.match(isUL) == null){ + this.codeMirror.replaceSelection(newSelection.replace(/^/gm, '- '), 'around'); } else { - console.log('is not a list'); + this.codeMirror.replaceSelection(newSelection.replace(isUL, ''), 'around'); } }, From 63c59a223a67be9773fcc314b5abf499e385fb11 Mon Sep 17 00:00:00 2001 From: Gazook89 <58999374+Gazook89@users.noreply.github.com> Date: Tue, 28 Sep 2021 14:34:31 -0500 Subject: [PATCH 020/145] refine removal of lists regardless if UL or OL Next step after this is to get numbered lists to increase --- shared/naturalcrit/codeEditor/codeEditor.jsx | 26 +++++++++++--------- 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/shared/naturalcrit/codeEditor/codeEditor.jsx b/shared/naturalcrit/codeEditor/codeEditor.jsx index 997143faf..1ac90a124 100644 --- a/shared/naturalcrit/codeEditor/codeEditor.jsx +++ b/shared/naturalcrit/codeEditor/codeEditor.jsx @@ -55,10 +55,10 @@ const CodeEditor = createClass({ 'Cmd-M' : this.makeSpan, 'Ctrl-/' : this.makeComment, 'Cmd-/' : this.makeComment, - 'Ctrl-L' : this.makeUnOrderedList, - 'Cmd-L' : this.makeUnOrderedList, - 'Shift-Ctrl-L' : this.makeOrderedList, - 'Shift-Cmd-L' : this.makeOrderedList + 'Ctrl-L' : ()=>this.makeList('UL'), + 'Cmd-L' : ()=>this.makeList('UL'), + 'Shift-Ctrl-L' : ()=>this.makeList('OL'), + 'Shift-Cmd-L' : ()=>this.makeList('OL') } }); @@ -103,19 +103,21 @@ const CodeEditor = createClass({ } }, - makeUnOrderedList : function() { - const selectionStart = this.codeMirror.getCursor('from'); - const selectionEnd = this.codeMirror.getCursor('to'); + makeList : function(listType) { + const selectionStart = this.codeMirror.getCursor('from'), selectionEnd = this.codeMirror.getCursor('to'); this.codeMirror.setSelection( { line: selectionStart.line, ch: 0 }, { line: selectionEnd.line, ch: this.codeMirror.getLine(selectionEnd.line).length } ); - const isUL = /^-\s/gm; const newSelection = this.codeMirror.getSelection(); - if(newSelection.match(isUL) == null){ - this.codeMirror.replaceSelection(newSelection.replace(/^/gm, '- '), 'around'); - } else { - this.codeMirror.replaceSelection(newSelection.replace(isUL, ''), 'around'); + + const regex = /^\d+\.\s|^-\s/gm; + console.log(regex); + if(newSelection.match(regex) != null){ // if selection IS A LIST + this.codeMirror.replaceSelection(newSelection.replace(regex, ''), 'around'); + } else { // if selection IS NOT A LIST + listType == 'UL' ? this.codeMirror.replaceSelection(newSelection.replace(/^/gm, '- '), 'around') : + this.codeMirror.replaceSelection(newSelection.replace(/^/gm, '1. '), 'around'); } }, From 40a75b9b278e29996948374462a7afa87c95adc2 Mon Sep 17 00:00:00 2001 From: Gazook89 <58999374+Gazook89@users.noreply.github.com> Date: Tue, 28 Sep 2021 16:09:00 -0500 Subject: [PATCH 021/145] increment ordered list numbering --- shared/naturalcrit/codeEditor/codeEditor.jsx | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/shared/naturalcrit/codeEditor/codeEditor.jsx b/shared/naturalcrit/codeEditor/codeEditor.jsx index 1ac90a124..a48d451df 100644 --- a/shared/naturalcrit/codeEditor/codeEditor.jsx +++ b/shared/naturalcrit/codeEditor/codeEditor.jsx @@ -112,12 +112,16 @@ const CodeEditor = createClass({ const newSelection = this.codeMirror.getSelection(); const regex = /^\d+\.\s|^-\s/gm; - console.log(regex); if(newSelection.match(regex) != null){ // if selection IS A LIST this.codeMirror.replaceSelection(newSelection.replace(regex, ''), 'around'); } else { // if selection IS NOT A LIST - listType == 'UL' ? this.codeMirror.replaceSelection(newSelection.replace(/^/gm, '- '), 'around') : - this.codeMirror.replaceSelection(newSelection.replace(/^/gm, '1. '), 'around'); + listType == 'UL' ? this.codeMirror.replaceSelection(newSelection.replace(/^/gm, `- `), 'around') : + this.codeMirror.replaceSelection(newSelection.replace(/^/gm, (()=>{ + let n = 1; + return ()=>{ + return `${n++}. `; + }; + })()), 'around'); } }, From 3bf5d7a2dbe44846a194ee99ae85bfcca1e29832 Mon Sep 17 00:00:00 2001 From: Gazook89 <58999374+Gazook89@users.noreply.github.com> Date: Thu, 30 Sep 2021 17:59:45 -0500 Subject: [PATCH 022/145] change makeComment function to adapt to gfm or css editor --- shared/naturalcrit/codeEditor/codeEditor.jsx | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/shared/naturalcrit/codeEditor/codeEditor.jsx b/shared/naturalcrit/codeEditor/codeEditor.jsx index a810bee3a..ee318ee1d 100644 --- a/shared/naturalcrit/codeEditor/codeEditor.jsx +++ b/shared/naturalcrit/codeEditor/codeEditor.jsx @@ -155,12 +155,24 @@ const CodeEditor = createClass({ }, makeComment : function() { - const selection = this.codeMirror.getSelection(), t = selection.slice(0, 4) === ''; - this.codeMirror.replaceSelection(t ? selection.slice(4, -3) : ``, 'around'); + let regex; + let cursorPos; + let newComment; + const selection = this.codeMirror.getSelection(); + if(this.props.language === 'gfm'){ + regex = /^\s*()\s*$/gs; + cursorPos = 4; + newComment = ``; + } else { + regex = /^\s*(\/\*\s?)(.*?)(\s?\*\/)\s*$/gs; + cursorPos = 3; + newComment = `/* ${selection} */`; + } + this.codeMirror.replaceSelection(regex.test(selection) == true ? selection.replace(regex, '$2') : newComment, 'around'); if(selection.length === 0){ const cursor = this.codeMirror.getCursor(); - this.codeMirror.setCursor({ line: cursor.line, ch: cursor.ch - 4 }); - } + this.codeMirror.setCursor({ line: cursor.line, ch: cursor.ch - cursorPos }); + }; }, //=-- Externally used -==// From 09b154366055f577f302b25b50c981a3171a9934 Mon Sep 17 00:00:00 2001 From: Sean Robertson Date: Tue, 5 Oct 2021 10:50:13 +1300 Subject: [PATCH 023/145] Reduce CodeMirror codeEditor `historyEventDelay` to 250 --- shared/naturalcrit/codeEditor/codeEditor.jsx | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/shared/naturalcrit/codeEditor/codeEditor.jsx b/shared/naturalcrit/codeEditor/codeEditor.jsx index 5d00cc04c..9cf4fe0e2 100644 --- a/shared/naturalcrit/codeEditor/codeEditor.jsx +++ b/shared/naturalcrit/codeEditor/codeEditor.jsx @@ -40,13 +40,14 @@ const CodeEditor = createClass({ buildEditor : function() { this.codeMirror = CodeMirror(this.refs.editor, { - value : this.props.value, - lineNumbers : true, - lineWrapping : this.props.wrap, - mode : this.props.language, //TODO: CSS MODE DOESN'T SEEM TO LOAD PROPERLY - indentWithTabs : true, - tabSize : 2, - extraKeys : { + value : this.props.value, + lineNumbers : true, + lineWrapping : this.props.wrap, + mode : this.props.language, //TODO: CSS MODE DOESN'T SEEM TO LOAD PROPERLY + indentWithTabs : true, + tabSize : 2, + historyEventDelay : 250, + extraKeys : { 'Ctrl-B' : this.makeBold, 'Cmd-B' : this.makeBold, 'Ctrl-I' : this.makeItalic, From fbabae8793f9412dd8a11750cf16ef34ee0189c4 Mon Sep 17 00:00:00 2001 From: "G.Ambatte" Date: Tue, 5 Oct 2021 20:24:45 +1300 Subject: [PATCH 024/145] Expose CodeMirror functions in codeEditor.jsx --- shared/naturalcrit/codeEditor/codeEditor.jsx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/shared/naturalcrit/codeEditor/codeEditor.jsx b/shared/naturalcrit/codeEditor/codeEditor.jsx index 9cf4fe0e2..6fe189890 100644 --- a/shared/naturalcrit/codeEditor/codeEditor.jsx +++ b/shared/naturalcrit/codeEditor/codeEditor.jsx @@ -114,10 +114,13 @@ const CodeEditor = createClass({ this.codeMirror.refresh(); }, redo : function(){ - this.codeMirror.redo(); + return this.codeMirror.redo(); }, undo : function(){ - this.codeMirror.undo(); + return this.codeMirror.undo(); + }, + historySize : function(){ + return this.codeMirror.doc.historySize(); }, //----------------------// From 96af13b71f0ab23969a9f807497248dac4e35c77 Mon Sep 17 00:00:00 2001 From: "G.Ambatte" Date: Tue, 5 Oct 2021 20:25:24 +1300 Subject: [PATCH 025/145] Move Undo/Redo to SnippetBar --- client/homebrew/editor/editor.jsx | 29 +++++++++---------- .../homebrew/editor/snippetbar/snippetbar.jsx | 12 +++++++- .../editor/snippetbar/snippetbar.less | 10 ++++++- 3 files changed, 34 insertions(+), 17 deletions(-) diff --git a/client/homebrew/editor/editor.jsx b/client/homebrew/editor/editor.jsx index 95bb68447..82435cacb 100644 --- a/client/homebrew/editor/editor.jsx +++ b/client/homebrew/editor/editor.jsx @@ -199,19 +199,16 @@ const Editor = createClass({ } }, - renderEditorToolbar : function(){ - return
- - - - - - -
; + redo : function(){ + return this.refs.codeEditor?.redo(); + }, + + historySize : function(){ + return this.refs.codeEditor?.historySize(); + }, + + undo : function(){ + return this.refs.codeEditor?.undo(); }, render : function(){ @@ -224,10 +221,12 @@ const Editor = createClass({ onViewChange={this.handleViewChange} onInject={this.handleInject} showEditButtons={this.props.showEditButtons} - renderer={this.props.renderer} /> + renderer={this.props.renderer} + undo={this.undo} + redo={this.redo} + historySize={this.historySize} /> {this.renderEditor()} - {!this.isMeta() && this.renderEditorToolbar()} ); } diff --git a/client/homebrew/editor/snippetbar/snippetbar.jsx b/client/homebrew/editor/snippetbar/snippetbar.jsx index 9ea04695f..8f0ee9607 100644 --- a/client/homebrew/editor/snippetbar/snippetbar.jsx +++ b/client/homebrew/editor/snippetbar/snippetbar.jsx @@ -22,7 +22,9 @@ const Snippetbar = createClass({ onInject : ()=>{}, onToggle : ()=>{}, showEditButtons : true, - renderer : 'legacy' + renderer : 'legacy', + undo : ()=>{}, + redo : ()=>{} }; }, @@ -60,6 +62,14 @@ const Snippetbar = createClass({ if(!this.props.showEditButtons) return; return
+
+ +
+
+ +
this.props.onViewChange('text')}> diff --git a/client/homebrew/editor/snippetbar/snippetbar.less b/client/homebrew/editor/snippetbar/snippetbar.less index ae8962501..51e832174 100644 --- a/client/homebrew/editor/snippetbar/snippetbar.less +++ b/client/homebrew/editor/snippetbar/snippetbar.less @@ -10,7 +10,7 @@ top : 0px; right : 0px; height : @menuHeight; - width : 90px; + width : 125px; justify-content : space-between; &>div{ height : @menuHeight; @@ -30,6 +30,14 @@ &.meta{ .tooltipLeft('Properties'); } + &.undo{ + .tooltipLeft('Undo'); + font-size : 0.75em; + } + &.redo{ + .tooltipLeft('Redo'); + font-size : 0.75em; + } } } .snippetBarButton{ From 5b3953094ef892f8e61879ec1478fa97b462ae3f Mon Sep 17 00:00:00 2001 From: "G.Ambatte" Date: Mon, 18 Oct 2021 21:39:01 +1300 Subject: [PATCH 026/145] Add divider and tool active class --- client/homebrew/editor/snippetbar/snippetbar.jsx | 1 + client/homebrew/editor/snippetbar/snippetbar.less | 15 +++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/client/homebrew/editor/snippetbar/snippetbar.jsx b/client/homebrew/editor/snippetbar/snippetbar.jsx index 8f0ee9607..b4ad37eba 100644 --- a/client/homebrew/editor/snippetbar/snippetbar.jsx +++ b/client/homebrew/editor/snippetbar/snippetbar.jsx @@ -70,6 +70,7 @@ const Snippetbar = createClass({ onClick={this.props.redo} >
+
this.props.onViewChange('text')}> diff --git a/client/homebrew/editor/snippetbar/snippetbar.less b/client/homebrew/editor/snippetbar/snippetbar.less index 51e832174..371f51fda 100644 --- a/client/homebrew/editor/snippetbar/snippetbar.less +++ b/client/homebrew/editor/snippetbar/snippetbar.less @@ -33,10 +33,25 @@ &.undo{ .tooltipLeft('Undo'); font-size : 0.75em; + color : grey; + &.active{ + color : black; + } } &.redo{ .tooltipLeft('Redo'); font-size : 0.75em; + color : grey; + &.active{ + color : black; + } + } + &.divider { + background: linear-gradient(#000, #000) no-repeat center/1px 100%; + width: 5px; + &:hover{ + background-color: inherit; + } } } } From 606a3c843d839a4d3620e931fc3cb5ae516b0de1 Mon Sep 17 00:00:00 2001 From: "G.Ambatte" Date: Mon, 18 Oct 2021 22:26:34 +1300 Subject: [PATCH 027/145] Add conditional highlighting to Undo/Redo --- client/homebrew/editor/snippetbar/snippetbar.jsx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/client/homebrew/editor/snippetbar/snippetbar.jsx b/client/homebrew/editor/snippetbar/snippetbar.jsx index b4ad37eba..84888b3d0 100644 --- a/client/homebrew/editor/snippetbar/snippetbar.jsx +++ b/client/homebrew/editor/snippetbar/snippetbar.jsx @@ -24,7 +24,8 @@ const Snippetbar = createClass({ showEditButtons : true, renderer : 'legacy', undo : ()=>{}, - redo : ()=>{} + redo : ()=>{}, + historySize : ()=>{} }; }, @@ -62,11 +63,11 @@ const Snippetbar = createClass({ if(!this.props.showEditButtons) return; return
-
-
From 9bc52b412c325c69c8bfef436df12f4eb20c1185 Mon Sep 17 00:00:00 2001 From: "G.Ambatte" Date: Sun, 19 Sep 2021 19:26:44 +1200 Subject: [PATCH 028/145] Initial pass at Editor Toolbar - Undo and Redo. --- client/homebrew/editor/editor.jsx | 17 +++++++++++++++++ client/homebrew/editor/editor.less | 12 ++++++++++++ shared/naturalcrit/codeEditor/codeEditor.jsx | 6 ++++++ 3 files changed, 35 insertions(+) diff --git a/client/homebrew/editor/editor.jsx b/client/homebrew/editor/editor.jsx index 20f084c28..95bb68447 100644 --- a/client/homebrew/editor/editor.jsx +++ b/client/homebrew/editor/editor.jsx @@ -1,3 +1,4 @@ +/*eslint max-lines: ["warn", {"max": 300, "skipBlankLines": true, "skipComments": true}]*/ require('./editor.less'); const React = require('react'); const createClass = require('create-react-class'); @@ -198,6 +199,21 @@ const Editor = createClass({ } }, + renderEditorToolbar : function(){ + return
+ + + + + + +
; + }, + render : function(){ this.highlightCustomMarkdown(); return ( @@ -211,6 +227,7 @@ const Editor = createClass({ renderer={this.props.renderer} /> {this.renderEditor()} + {!this.isMeta() && this.renderEditorToolbar()}
); } diff --git a/client/homebrew/editor/editor.less b/client/homebrew/editor/editor.less index 0097ddbf6..8633e4eb3 100644 --- a/client/homebrew/editor/editor.less +++ b/client/homebrew/editor/editor.less @@ -50,4 +50,16 @@ .tooltipLeft("Jump to brew page"); } + .editorToolbar{ + position: absolute; + top: 5px; + left: 50%; + color: black; + font-size: 13px; + z-index: 9; + span { + padding: 2px 5px; + } + } + } diff --git a/shared/naturalcrit/codeEditor/codeEditor.jsx b/shared/naturalcrit/codeEditor/codeEditor.jsx index 9707bde56..5d00cc04c 100644 --- a/shared/naturalcrit/codeEditor/codeEditor.jsx +++ b/shared/naturalcrit/codeEditor/codeEditor.jsx @@ -112,6 +112,12 @@ const CodeEditor = createClass({ updateSize : function(){ this.codeMirror.refresh(); }, + redo : function(){ + this.codeMirror.redo(); + }, + undo : function(){ + this.codeMirror.undo(); + }, //----------------------// render : function(){ From bfcb29ff9c4a7de70671f02d0195782919988751 Mon Sep 17 00:00:00 2001 From: Sean Robertson Date: Tue, 5 Oct 2021 10:50:13 +1300 Subject: [PATCH 029/145] Reduce CodeMirror codeEditor `historyEventDelay` to 250 --- shared/naturalcrit/codeEditor/codeEditor.jsx | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/shared/naturalcrit/codeEditor/codeEditor.jsx b/shared/naturalcrit/codeEditor/codeEditor.jsx index 5d00cc04c..9cf4fe0e2 100644 --- a/shared/naturalcrit/codeEditor/codeEditor.jsx +++ b/shared/naturalcrit/codeEditor/codeEditor.jsx @@ -40,13 +40,14 @@ const CodeEditor = createClass({ buildEditor : function() { this.codeMirror = CodeMirror(this.refs.editor, { - value : this.props.value, - lineNumbers : true, - lineWrapping : this.props.wrap, - mode : this.props.language, //TODO: CSS MODE DOESN'T SEEM TO LOAD PROPERLY - indentWithTabs : true, - tabSize : 2, - extraKeys : { + value : this.props.value, + lineNumbers : true, + lineWrapping : this.props.wrap, + mode : this.props.language, //TODO: CSS MODE DOESN'T SEEM TO LOAD PROPERLY + indentWithTabs : true, + tabSize : 2, + historyEventDelay : 250, + extraKeys : { 'Ctrl-B' : this.makeBold, 'Cmd-B' : this.makeBold, 'Ctrl-I' : this.makeItalic, From ab2900cadf2271f0c27dfbba9890bd271601b4e6 Mon Sep 17 00:00:00 2001 From: "G.Ambatte" Date: Tue, 5 Oct 2021 20:24:45 +1300 Subject: [PATCH 030/145] Expose CodeMirror functions in codeEditor.jsx --- shared/naturalcrit/codeEditor/codeEditor.jsx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/shared/naturalcrit/codeEditor/codeEditor.jsx b/shared/naturalcrit/codeEditor/codeEditor.jsx index 9cf4fe0e2..6fe189890 100644 --- a/shared/naturalcrit/codeEditor/codeEditor.jsx +++ b/shared/naturalcrit/codeEditor/codeEditor.jsx @@ -114,10 +114,13 @@ const CodeEditor = createClass({ this.codeMirror.refresh(); }, redo : function(){ - this.codeMirror.redo(); + return this.codeMirror.redo(); }, undo : function(){ - this.codeMirror.undo(); + return this.codeMirror.undo(); + }, + historySize : function(){ + return this.codeMirror.doc.historySize(); }, //----------------------// From 9dd885e7eb793b1d94d5d091897a0fe52c809039 Mon Sep 17 00:00:00 2001 From: "G.Ambatte" Date: Tue, 5 Oct 2021 20:25:24 +1300 Subject: [PATCH 031/145] Move Undo/Redo to SnippetBar --- client/homebrew/editor/editor.jsx | 29 +++++++++---------- .../homebrew/editor/snippetbar/snippetbar.jsx | 12 +++++++- .../editor/snippetbar/snippetbar.less | 10 ++++++- 3 files changed, 34 insertions(+), 17 deletions(-) diff --git a/client/homebrew/editor/editor.jsx b/client/homebrew/editor/editor.jsx index 95bb68447..82435cacb 100644 --- a/client/homebrew/editor/editor.jsx +++ b/client/homebrew/editor/editor.jsx @@ -199,19 +199,16 @@ const Editor = createClass({ } }, - renderEditorToolbar : function(){ - return
- - - - - - -
; + redo : function(){ + return this.refs.codeEditor?.redo(); + }, + + historySize : function(){ + return this.refs.codeEditor?.historySize(); + }, + + undo : function(){ + return this.refs.codeEditor?.undo(); }, render : function(){ @@ -224,10 +221,12 @@ const Editor = createClass({ onViewChange={this.handleViewChange} onInject={this.handleInject} showEditButtons={this.props.showEditButtons} - renderer={this.props.renderer} /> + renderer={this.props.renderer} + undo={this.undo} + redo={this.redo} + historySize={this.historySize} /> {this.renderEditor()} - {!this.isMeta() && this.renderEditorToolbar()}
); } diff --git a/client/homebrew/editor/snippetbar/snippetbar.jsx b/client/homebrew/editor/snippetbar/snippetbar.jsx index 9ea04695f..8f0ee9607 100644 --- a/client/homebrew/editor/snippetbar/snippetbar.jsx +++ b/client/homebrew/editor/snippetbar/snippetbar.jsx @@ -22,7 +22,9 @@ const Snippetbar = createClass({ onInject : ()=>{}, onToggle : ()=>{}, showEditButtons : true, - renderer : 'legacy' + renderer : 'legacy', + undo : ()=>{}, + redo : ()=>{} }; }, @@ -60,6 +62,14 @@ const Snippetbar = createClass({ if(!this.props.showEditButtons) return; return
+
+ +
+
+ +
this.props.onViewChange('text')}> diff --git a/client/homebrew/editor/snippetbar/snippetbar.less b/client/homebrew/editor/snippetbar/snippetbar.less index ae8962501..51e832174 100644 --- a/client/homebrew/editor/snippetbar/snippetbar.less +++ b/client/homebrew/editor/snippetbar/snippetbar.less @@ -10,7 +10,7 @@ top : 0px; right : 0px; height : @menuHeight; - width : 90px; + width : 125px; justify-content : space-between; &>div{ height : @menuHeight; @@ -30,6 +30,14 @@ &.meta{ .tooltipLeft('Properties'); } + &.undo{ + .tooltipLeft('Undo'); + font-size : 0.75em; + } + &.redo{ + .tooltipLeft('Redo'); + font-size : 0.75em; + } } } .snippetBarButton{ From 8983960ca8db83b49ea11d11a2f3d6789be427c6 Mon Sep 17 00:00:00 2001 From: "G.Ambatte" Date: Mon, 18 Oct 2021 21:39:01 +1300 Subject: [PATCH 032/145] Add divider and tool active class --- client/homebrew/editor/snippetbar/snippetbar.jsx | 1 + client/homebrew/editor/snippetbar/snippetbar.less | 15 +++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/client/homebrew/editor/snippetbar/snippetbar.jsx b/client/homebrew/editor/snippetbar/snippetbar.jsx index 8f0ee9607..b4ad37eba 100644 --- a/client/homebrew/editor/snippetbar/snippetbar.jsx +++ b/client/homebrew/editor/snippetbar/snippetbar.jsx @@ -70,6 +70,7 @@ const Snippetbar = createClass({ onClick={this.props.redo} >
+
this.props.onViewChange('text')}> diff --git a/client/homebrew/editor/snippetbar/snippetbar.less b/client/homebrew/editor/snippetbar/snippetbar.less index 51e832174..371f51fda 100644 --- a/client/homebrew/editor/snippetbar/snippetbar.less +++ b/client/homebrew/editor/snippetbar/snippetbar.less @@ -33,10 +33,25 @@ &.undo{ .tooltipLeft('Undo'); font-size : 0.75em; + color : grey; + &.active{ + color : black; + } } &.redo{ .tooltipLeft('Redo'); font-size : 0.75em; + color : grey; + &.active{ + color : black; + } + } + &.divider { + background: linear-gradient(#000, #000) no-repeat center/1px 100%; + width: 5px; + &:hover{ + background-color: inherit; + } } } } From f33cd393006169f6379875a11bf6ab1fbaf0d52e Mon Sep 17 00:00:00 2001 From: "G.Ambatte" Date: Mon, 18 Oct 2021 22:26:34 +1300 Subject: [PATCH 033/145] Add conditional highlighting to Undo/Redo --- client/homebrew/editor/snippetbar/snippetbar.jsx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/client/homebrew/editor/snippetbar/snippetbar.jsx b/client/homebrew/editor/snippetbar/snippetbar.jsx index b4ad37eba..84888b3d0 100644 --- a/client/homebrew/editor/snippetbar/snippetbar.jsx +++ b/client/homebrew/editor/snippetbar/snippetbar.jsx @@ -24,7 +24,8 @@ const Snippetbar = createClass({ showEditButtons : true, renderer : 'legacy', undo : ()=>{}, - redo : ()=>{} + redo : ()=>{}, + historySize : ()=>{} }; }, @@ -62,11 +63,11 @@ const Snippetbar = createClass({ if(!this.props.showEditButtons) return; return
-
-
From a2a6a3d3f65710404851957bb19a9939ffa3907d Mon Sep 17 00:00:00 2001 From: "G.Ambatte" Date: Tue, 19 Oct 2021 14:39:51 +1300 Subject: [PATCH 034/145] Add limits to central divider position --- shared/naturalcrit/splitPane/splitPane.jsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/shared/naturalcrit/splitPane/splitPane.jsx b/shared/naturalcrit/splitPane/splitPane.jsx index e29c7f358..82fbbcdd9 100644 --- a/shared/naturalcrit/splitPane/splitPane.jsx +++ b/shared/naturalcrit/splitPane/splitPane.jsx @@ -4,6 +4,9 @@ const createClass = require('create-react-class'); const _ = require('lodash'); const cx = require('classnames'); +const MIN_DRAG_WIDTH_PCT = 10; // How close the divider can get to the left of the screen (as a percentage of total screen width) before stopping +const MAX_DRAG_WIDTH_PCT = 90; // How close the divider can get to the right of the screen (as a percentage of total screen width) before stopping + const SplitPane = createClass({ getDefaultProps : function() { return { @@ -40,8 +43,11 @@ const SplitPane = createClass({ }, handleMove : function(e){ if(!this.state.isDragging) return; + const minWidth = window.innerWidth * (MIN_DRAG_WIDTH_PCT / 100); + const maxWidth = window.innerWidth * (MAX_DRAG_WIDTH_PCT / 100); + const newSize = Math.min(maxWidth, Math.max(minWidth, e.pageX)); this.setState({ - size : e.pageX + size : newSize }); }, /* From 3b37cacea228d8effb44a723a18a663717f4ca26 Mon Sep 17 00:00:00 2001 From: "G.Ambatte" Date: Tue, 19 Oct 2021 15:04:53 +1300 Subject: [PATCH 035/145] Limit position to min/max window limits --- shared/naturalcrit/splitPane/splitPane.jsx | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/shared/naturalcrit/splitPane/splitPane.jsx b/shared/naturalcrit/splitPane/splitPane.jsx index 82fbbcdd9..3207623f7 100644 --- a/shared/naturalcrit/splitPane/splitPane.jsx +++ b/shared/naturalcrit/splitPane/splitPane.jsx @@ -4,9 +4,6 @@ const createClass = require('create-react-class'); const _ = require('lodash'); const cx = require('classnames'); -const MIN_DRAG_WIDTH_PCT = 10; // How close the divider can get to the left of the screen (as a percentage of total screen width) before stopping -const MAX_DRAG_WIDTH_PCT = 90; // How close the divider can get to the right of the screen (as a percentage of total screen width) before stopping - const SplitPane = createClass({ getDefaultProps : function() { return { @@ -43,8 +40,9 @@ const SplitPane = createClass({ }, handleMove : function(e){ if(!this.state.isDragging) return; - const minWidth = window.innerWidth * (MIN_DRAG_WIDTH_PCT / 100); - const maxWidth = window.innerWidth * (MAX_DRAG_WIDTH_PCT / 100); + + const minWidth = 1; + const maxWidth = window.innerWidth - 13; const newSize = Math.min(maxWidth, Math.max(minWidth, e.pageX)); this.setState({ size : newSize From 67d3c44017a171196a00aae8da9775fc18e80937 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 19 Oct 2021 03:00:46 +0000 Subject: [PATCH 036/145] Bump googleapis from 88.2.0 to 89.0.0 Bumps [googleapis](https://github.com/googleapis/google-api-nodejs-client) from 88.2.0 to 89.0.0. - [Release notes](https://github.com/googleapis/google-api-nodejs-client/releases) - [Changelog](https://github.com/googleapis/google-api-nodejs-client/blob/main/CHANGELOG.md) - [Commits](https://github.com/googleapis/google-api-nodejs-client/compare/googleapis-v88.2.0...googleapis-v89.0.0) --- updated-dependencies: - dependency-name: googleapis dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- package-lock.json | 14 +++++++------- package.json | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/package-lock.json b/package-lock.json index 28b9075c8..c2b4043f2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -24,7 +24,7 @@ "express-async-handler": "^1.1.4", "express-static-gzip": "2.1.1", "fs-extra": "10.0.0", - "googleapis": "88.2.0", + "googleapis": "89.0.0", "jwt-simple": "^0.5.6", "less": "^3.13.1", "lodash": "^4.17.21", @@ -4818,9 +4818,9 @@ } }, "node_modules/googleapis": { - "version": "88.2.0", - "resolved": "https://registry.npmjs.org/googleapis/-/googleapis-88.2.0.tgz", - "integrity": "sha512-z3iDvGVqaJ+4TZ7YulK530q5vkY0BifvAWqcu2JiUSgpnIHzsA89k005+McoaYB+lAgv7lPY2Y4OPMT6iloWRA==", + "version": "89.0.0", + "resolved": "https://registry.npmjs.org/googleapis/-/googleapis-89.0.0.tgz", + "integrity": "sha512-eH91BN+6R/Mp5uulrhKWGwKAbibfDNOIu1Oq8n12aFTiqb23/A9kVdRhituYVqhRqSWLr/kv1dpFbd6n+uN+7Q==", "dependencies": { "google-auth-library": "^7.0.2", "googleapis-common": "^5.0.2" @@ -13127,9 +13127,9 @@ } }, "googleapis": { - "version": "88.2.0", - "resolved": "https://registry.npmjs.org/googleapis/-/googleapis-88.2.0.tgz", - "integrity": "sha512-z3iDvGVqaJ+4TZ7YulK530q5vkY0BifvAWqcu2JiUSgpnIHzsA89k005+McoaYB+lAgv7lPY2Y4OPMT6iloWRA==", + "version": "89.0.0", + "resolved": "https://registry.npmjs.org/googleapis/-/googleapis-89.0.0.tgz", + "integrity": "sha512-eH91BN+6R/Mp5uulrhKWGwKAbibfDNOIu1Oq8n12aFTiqb23/A9kVdRhituYVqhRqSWLr/kv1dpFbd6n+uN+7Q==", "requires": { "google-auth-library": "^7.0.2", "googleapis-common": "^5.0.2" diff --git a/package.json b/package.json index 622c9c501..4e94301d3 100644 --- a/package.json +++ b/package.json @@ -54,7 +54,7 @@ "express-async-handler": "^1.1.4", "express-static-gzip": "2.1.1", "fs-extra": "10.0.0", - "googleapis": "88.2.0", + "googleapis": "89.0.0", "jwt-simple": "^0.5.6", "less": "^3.13.1", "lodash": "^4.17.21", From dbf60201948f6dd584b53efc5b90ad87d01fca2d Mon Sep 17 00:00:00 2001 From: "G.Ambatte" Date: Tue, 19 Oct 2021 23:19:26 +1300 Subject: [PATCH 037/145] Darken divider on hover --- shared/naturalcrit/splitPane/splitPane.less | 3 +++ 1 file changed, 3 insertions(+) diff --git a/shared/naturalcrit/splitPane/splitPane.less b/shared/naturalcrit/splitPane/splitPane.less index 0eae60f0d..0e9095193 100644 --- a/shared/naturalcrit/splitPane/splitPane.less +++ b/shared/naturalcrit/splitPane/splitPane.less @@ -28,5 +28,8 @@ color : #666; } } + &:hover{ + background-color: #999; + } } } From 63d659ff49e67c24805adae82bf40b87d4286ffd Mon Sep 17 00:00:00 2001 From: Trevor Buckner Date: Tue, 19 Oct 2021 23:49:11 -0400 Subject: [PATCH 038/145] use CodeMirror Documents Instead of re-building the whole editor box with every tab switch, we just swap in and out CodeMirror "documents". Maintains undo history, scroll position, highlight coloring, etc. --- client/homebrew/editor/editor.jsx | 52 +++++++++++++------ .../homebrew/editor/snippetbar/snippetbar.jsx | 4 +- shared/naturalcrit/codeEditor/codeEditor.jsx | 33 +++++++++--- 3 files changed, 65 insertions(+), 24 deletions(-) diff --git a/client/homebrew/editor/editor.jsx b/client/homebrew/editor/editor.jsx index 82435cacb..3794ac7c8 100644 --- a/client/homebrew/editor/editor.jsx +++ b/client/homebrew/editor/editor.jsx @@ -60,6 +60,10 @@ const Editor = createClass({ window.removeEventListener('resize', this.updateEditorSize); }, + componentDidUpdate : function() { + this.highlightCustomMarkdown(); + }, + updateEditorSize : function() { if(this.refs.codeEditor) { let paneHeight = this.refs.main.parentNode.clientHeight; @@ -177,25 +181,44 @@ const Editor = createClass({ this.refs.codeEditor?.updateSize(); }, + //Called by CodeEditor after document switch, so Snippetbar can refresh UndoHistory + rerenderParent : function (){ + this.forceUpdate(); + }, + renderEditor : function(){ if(this.isText()){ - return ; + return <> + + ; } if(this.isStyle()){ - return ; + return <> + + ; } if(this.isMeta()){ - return ; + return <> + + + ; } }, @@ -212,7 +235,6 @@ const Editor = createClass({ }, render : function(){ - this.highlightCustomMarkdown(); return (
+ historySize={this.historySize()} /> {this.renderEditor()}
diff --git a/client/homebrew/editor/snippetbar/snippetbar.jsx b/client/homebrew/editor/snippetbar/snippetbar.jsx index 84888b3d0..a294bbb26 100644 --- a/client/homebrew/editor/snippetbar/snippetbar.jsx +++ b/client/homebrew/editor/snippetbar/snippetbar.jsx @@ -63,11 +63,11 @@ const Snippetbar = createClass({ if(!this.props.showEditButtons) return; return
-
-
diff --git a/shared/naturalcrit/codeEditor/codeEditor.jsx b/shared/naturalcrit/codeEditor/codeEditor.jsx index 6fe189890..7a0b70fde 100644 --- a/shared/naturalcrit/codeEditor/codeEditor.jsx +++ b/shared/naturalcrit/codeEditor/codeEditor.jsx @@ -25,25 +25,44 @@ const CodeEditor = createClass({ }; }, + getInitialState : function() { + return { + docs : {} + }; + }, + componentDidMount : function() { this.buildEditor(); + this.codeMirror.setValue(this.props.value); + this.codeMirror.clearHistory(); }, componentDidUpdate : function(prevProps) { - if(prevProps.language !== this.props.language){ //rebuild editor when switching tabs - this.buildEditor(); - } - if(this.codeMirror && this.codeMirror.getValue() != this.props.value) { //update editor contents if brew.text is changed from outside + if(prevProps.view !== this.props.view){ //view changed; swap documents + let newDoc; + + if(!this.state.docs[this.props.view]) { + newDoc = CodeMirror.Doc(this.props.value, this.props.language); + } else { + newDoc = this.state.docs[this.props.view]; + } + + const oldDoc = { [prevProps.view]: this.codeMirror.swapDoc(newDoc) }; + + this.setState((prevState)=>({ + docs : _.merge({}, prevState.docs, oldDoc) + })); + + this.props.rerenderParent(); + } else if(this.codeMirror?.getValue() != this.props.value) { //update editor contents if brew.text is changed from outside this.codeMirror.setValue(this.props.value); } }, buildEditor : function() { this.codeMirror = CodeMirror(this.refs.editor, { - value : this.props.value, lineNumbers : true, lineWrapping : this.props.wrap, - mode : this.props.language, //TODO: CSS MODE DOESN'T SEEM TO LOAD PROPERLY indentWithTabs : true, tabSize : 2, historyEventDelay : 250, @@ -125,7 +144,7 @@ const CodeEditor = createClass({ //----------------------// render : function(){ - return
; + return
; } }); From 9515e13ce5c0b3d1e69484bca7efa68e840338a0 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 22 Oct 2021 03:01:17 +0000 Subject: [PATCH 039/145] Bump mongoose from 6.0.11 to 6.0.12 Bumps [mongoose](https://github.com/Automattic/mongoose) from 6.0.11 to 6.0.12. - [Release notes](https://github.com/Automattic/mongoose/releases) - [Changelog](https://github.com/Automattic/mongoose/blob/master/CHANGELOG.md) - [Commits](https://github.com/Automattic/mongoose/compare/6.0.11...6.0.12) --- updated-dependencies: - dependency-name: mongoose dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- package-lock.json | 42 +++++++++++++++++++++--------------------- package.json | 2 +- 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/package-lock.json b/package-lock.json index c2b4043f2..316977c20 100644 --- a/package-lock.json +++ b/package-lock.json @@ -31,7 +31,7 @@ "marked": "3.0.7", "markedLegacy": "npm:marked@^0.3.19", "moment": "^2.29.1", - "mongoose": "^6.0.11", + "mongoose": "^6.0.12", "nanoid": "3.1.30", "nconf": "^0.11.3", "prop-types": "15.7.2", @@ -1894,9 +1894,9 @@ "integrity": "sha512-rr+OQyAjxze7GgWrSaJwydHStIhHq2lvY3BOC2Mj7KnzI7XK0Uw1TOOdI9lDoajEbSWLiYgoo4f1R51erQfhPQ==" }, "node_modules/@types/node": { - "version": "16.10.3", - "resolved": "https://registry.npmjs.org/@types/node/-/node-16.10.3.tgz", - "integrity": "sha512-ho3Ruq+fFnBrZhUYI46n/bV2GjwzSkwuT4dTf0GkuNFmnb8nq4ny2z9JEVemFi6bdEJanHLlYfy9c6FN9B9McQ==" + "version": "16.11.2", + "resolved": "https://registry.npmjs.org/@types/node/-/node-16.11.2.tgz", + "integrity": "sha512-w34LtBB0OkDTs19FQHXy4Ig/TOXI4zqvXS2Kk1PAsRKZ0I+nik7LlMYxckW0tSNGtvWmzB+mrCTbuEjuB9DVsw==" }, "node_modules/@types/webidl-conversions": { "version": "6.1.1", @@ -6298,9 +6298,9 @@ } }, "node_modules/mongodb": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/mongodb/-/mongodb-4.1.2.tgz", - "integrity": "sha512-pHCKDoOy1h6mVurziJmXmTMPatYWOx8pbnyFgSgshja9Y36Q+caHUzTDY6rrIy9HCSrjnbXmx3pCtvNZHmR8xg==", + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/mongodb/-/mongodb-4.1.3.tgz", + "integrity": "sha512-lHvTqODBiSpuqjpCj48DOyYWS6Iq6ElJNUiH9HWdQtONyOfjgsKzJULipWduMGsSzaNO4nFi/kmlMFCLvjox/Q==", "dependencies": { "bson": "^4.5.2", "denque": "^2.0.1", @@ -6323,13 +6323,13 @@ } }, "node_modules/mongoose": { - "version": "6.0.11", - "resolved": "https://registry.npmjs.org/mongoose/-/mongoose-6.0.11.tgz", - "integrity": "sha512-ESLnGIZB15xpqAbtjL/wcx+NEmzewlNuST/Dp/md4eqirVGTuEeN+IhS4qr3D5GFhnQAGdadpGlTfrWj5Ggykw==", + "version": "6.0.12", + "resolved": "https://registry.npmjs.org/mongoose/-/mongoose-6.0.12.tgz", + "integrity": "sha512-BvsZk7zEEhb1AgQFLtxN9C+7qgy5edRuA3ZDDwHU+kHG/HM44vI6FdKV5m6HVdAUeCHHQTiVv+YQh8BRsToSHw==", "dependencies": { "bson": "^4.2.2", "kareem": "2.3.2", - "mongodb": "4.1.2", + "mongodb": "4.1.3", "mpath": "0.8.4", "mquery": "4.0.0", "ms": "2.1.2", @@ -10767,9 +10767,9 @@ "integrity": "sha512-rr+OQyAjxze7GgWrSaJwydHStIhHq2lvY3BOC2Mj7KnzI7XK0Uw1TOOdI9lDoajEbSWLiYgoo4f1R51erQfhPQ==" }, "@types/node": { - "version": "16.10.3", - "resolved": "https://registry.npmjs.org/@types/node/-/node-16.10.3.tgz", - "integrity": "sha512-ho3Ruq+fFnBrZhUYI46n/bV2GjwzSkwuT4dTf0GkuNFmnb8nq4ny2z9JEVemFi6bdEJanHLlYfy9c6FN9B9McQ==" + "version": "16.11.2", + "resolved": "https://registry.npmjs.org/@types/node/-/node-16.11.2.tgz", + "integrity": "sha512-w34LtBB0OkDTs19FQHXy4Ig/TOXI4zqvXS2Kk1PAsRKZ0I+nik7LlMYxckW0tSNGtvWmzB+mrCTbuEjuB9DVsw==" }, "@types/webidl-conversions": { "version": "6.1.1", @@ -14270,9 +14270,9 @@ "integrity": "sha512-kHmoybcPV8Sqy59DwNDY3Jefr64lK/by/da0ViFcuA4DH0vQg5Q6Ze5VimxkfQNSC+Mls/Kx53s7TjP1RhFEDQ==" }, "mongodb": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/mongodb/-/mongodb-4.1.2.tgz", - "integrity": "sha512-pHCKDoOy1h6mVurziJmXmTMPatYWOx8pbnyFgSgshja9Y36Q+caHUzTDY6rrIy9HCSrjnbXmx3pCtvNZHmR8xg==", + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/mongodb/-/mongodb-4.1.3.tgz", + "integrity": "sha512-lHvTqODBiSpuqjpCj48DOyYWS6Iq6ElJNUiH9HWdQtONyOfjgsKzJULipWduMGsSzaNO4nFi/kmlMFCLvjox/Q==", "requires": { "bson": "^4.5.2", "denque": "^2.0.1", @@ -14290,13 +14290,13 @@ } }, "mongoose": { - "version": "6.0.11", - "resolved": "https://registry.npmjs.org/mongoose/-/mongoose-6.0.11.tgz", - "integrity": "sha512-ESLnGIZB15xpqAbtjL/wcx+NEmzewlNuST/Dp/md4eqirVGTuEeN+IhS4qr3D5GFhnQAGdadpGlTfrWj5Ggykw==", + "version": "6.0.12", + "resolved": "https://registry.npmjs.org/mongoose/-/mongoose-6.0.12.tgz", + "integrity": "sha512-BvsZk7zEEhb1AgQFLtxN9C+7qgy5edRuA3ZDDwHU+kHG/HM44vI6FdKV5m6HVdAUeCHHQTiVv+YQh8BRsToSHw==", "requires": { "bson": "^4.2.2", "kareem": "2.3.2", - "mongodb": "4.1.2", + "mongodb": "4.1.3", "mpath": "0.8.4", "mquery": "4.0.0", "ms": "2.1.2", diff --git a/package.json b/package.json index 4e94301d3..1e172b759 100644 --- a/package.json +++ b/package.json @@ -61,7 +61,7 @@ "marked": "3.0.7", "markedLegacy": "npm:marked@^0.3.19", "moment": "^2.29.1", - "mongoose": "^6.0.11", + "mongoose": "^6.0.12", "nanoid": "3.1.30", "nconf": "^0.11.3", "prop-types": "15.7.2", From e42c346ebc74546fc04f23e049004e271db98293 Mon Sep 17 00:00:00 2001 From: "G.Ambatte" Date: Sat, 23 Oct 2021 14:21:06 +1300 Subject: [PATCH 040/145] Up Dockerfile Node version --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 4483c7766..925b1c3c4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM node:14.15 +FROM node:16.11 ENV NODE_ENV=docker From a4e0768105952edecfb784d6da5ca561b64d0a95 Mon Sep 17 00:00:00 2001 From: Trevor Buckner Date: Sun, 24 Oct 2021 16:42:39 -0400 Subject: [PATCH 041/145] Move Localstorage load to GetInitialState Prevents the extra change to the CodeMirror document which was creating a starting "undo" history point that would blank out the page. --- client/homebrew/pages/newPage/newPage.jsx | 51 +++++++++++------------ 1 file changed, 24 insertions(+), 27 deletions(-) diff --git a/client/homebrew/pages/newPage/newPage.jsx b/client/homebrew/pages/newPage/newPage.jsx index c1887a83f..3f09cac4e 100644 --- a/client/homebrew/pages/newPage/newPage.jsx +++ b/client/homebrew/pages/newPage/newPage.jsx @@ -45,47 +45,44 @@ const NewPage = createClass({ }, getInitialState : function() { + const brew = this.props.brew; + + if(typeof window !== 'undefined') { //Load from localStorage if in client browser + const brewStorage = localStorage.getItem(BREWKEY); + const styleStorage = localStorage.getItem(STYLEKEY); + const metaStorage = JSON.parse(localStorage.getItem(METAKEY)); + + if(!brew.text || !brew.style){ + brew.text = brew.text || (brewStorage ?? ''); + brew.style = brew.style || (styleStorage ?? undefined); + // brew.title = metaStorage?.title || this.state.brew.title; + // brew.description = metaStorage?.description || this.state.brew.description; + brew.renderer = metaStorage?.renderer || brew.renderer; + } + } + return { brew : { - text : this.props.brew.text || '', - style : this.props.brew.style || undefined, + text : brew.text || '', + style : brew.style || undefined, gDrive : false, - title : this.props.brew.title || '', - description : this.props.brew.description || '', - tags : this.props.brew.tags || '', + title : brew.title || '', + description : brew.description || '', + tags : brew.tags || '', published : false, authors : [], - systems : this.props.brew.systems || [], - renderer : this.props.brew.renderer || 'legacy' + systems : brew.systems || [], + renderer : brew.renderer || 'legacy' }, isSaving : false, saveGoogle : (global.account && global.account.googleId ? true : false), errors : null, - htmlErrors : Markdown.validate(this.props.brew.text) + htmlErrors : Markdown.validate(brew.text) }; }, componentDidMount : function() { - const brewStorage = localStorage.getItem(BREWKEY); - const styleStorage = localStorage.getItem(STYLEKEY); - const metaStorage = JSON.parse(localStorage.getItem(METAKEY)); - - const brew = this.state.brew; - - if(!this.state.brew.text || !this.state.brew.style){ - brew.text = this.state.brew.text || (brewStorage ?? ''); - brew.style = this.state.brew.style || (styleStorage ?? undefined); - // brew.title = metaStorage?.title || this.state.brew.title; - // brew.description = metaStorage?.description || this.state.brew.description; - brew.renderer = metaStorage?.renderer || this.state.brew.renderer; - } - - this.setState((prevState)=>({ - brew : brew, - htmlErrors : Markdown.validate(prevState.brew.text) - })); - document.addEventListener('keydown', this.handleControlKeys); }, componentWillUnmount : function() { From 47b99a24fb0c81982a6bd4b71d2513d34a73037f Mon Sep 17 00:00:00 2001 From: Trevor Buckner Date: Sun, 24 Oct 2021 16:46:46 -0400 Subject: [PATCH 042/145] Clear out unneeded style when editor is hidden in Metadata panel --- client/homebrew/editor/editor.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/homebrew/editor/editor.jsx b/client/homebrew/editor/editor.jsx index 3794ac7c8..77001435d 100644 --- a/client/homebrew/editor/editor.jsx +++ b/client/homebrew/editor/editor.jsx @@ -213,7 +213,7 @@ const Editor = createClass({ return <> Date: Sun, 24 Oct 2021 18:03:10 -0400 Subject: [PATCH 043/145] Make sure initial tab loads with language for code highlighting --- shared/naturalcrit/codeEditor/codeEditor.jsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/shared/naturalcrit/codeEditor/codeEditor.jsx b/shared/naturalcrit/codeEditor/codeEditor.jsx index 7a0b70fde..621e24f77 100644 --- a/shared/naturalcrit/codeEditor/codeEditor.jsx +++ b/shared/naturalcrit/codeEditor/codeEditor.jsx @@ -33,8 +33,8 @@ const CodeEditor = createClass({ componentDidMount : function() { this.buildEditor(); - this.codeMirror.setValue(this.props.value); - this.codeMirror.clearHistory(); + const newDoc = CodeMirror.Doc(this.props.value, this.props.language); + this.codeMirror.swapDoc(newDoc); }, componentDidUpdate : function(prevProps) { From 56054e260771462190f5e49b52ecfb3c924a1c01 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 25 Oct 2021 03:00:36 +0000 Subject: [PATCH 044/145] Bump eslint from 8.0.1 to 8.1.0 Bumps [eslint](https://github.com/eslint/eslint) from 8.0.1 to 8.1.0. - [Release notes](https://github.com/eslint/eslint/releases) - [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md) - [Commits](https://github.com/eslint/eslint/compare/v8.0.1...v8.1.0) --- updated-dependencies: - dependency-name: eslint dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- package-lock.json | 14 +++++++------- package.json | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/package-lock.json b/package-lock.json index 316977c20..8c392a87d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -45,7 +45,7 @@ "vitreum": "git+https://git@github.com/calculuschild/vitreum.git" }, "devDependencies": { - "eslint": "^8.0.1", + "eslint": "^8.1.0", "eslint-plugin-react": "^7.26.1", "pico-check": "^2.1.3" }, @@ -3828,9 +3828,9 @@ } }, "node_modules/eslint": { - "version": "8.0.1", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.0.1.tgz", - "integrity": "sha512-LsgcwZgQ72vZ+SMp4K6pAnk2yFDWL7Ti4pJaRvsZ0Hsw2h8ZjUIW38a9AFn2cZXdBMlScMFYYgsSp4ttFI/0bA==", + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.1.0.tgz", + "integrity": "sha512-JZvNneArGSUsluHWJ8g8MMs3CfIEzwaLx9KyH4tZ2i+R2/rPWzL8c0zg3rHdwYVpN/1sB9gqnjHwz9HoeJpGHw==", "dev": true, "dependencies": { "@eslint/eslintrc": "^1.0.3", @@ -12367,9 +12367,9 @@ "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=" }, "eslint": { - "version": "8.0.1", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.0.1.tgz", - "integrity": "sha512-LsgcwZgQ72vZ+SMp4K6pAnk2yFDWL7Ti4pJaRvsZ0Hsw2h8ZjUIW38a9AFn2cZXdBMlScMFYYgsSp4ttFI/0bA==", + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.1.0.tgz", + "integrity": "sha512-JZvNneArGSUsluHWJ8g8MMs3CfIEzwaLx9KyH4tZ2i+R2/rPWzL8c0zg3rHdwYVpN/1sB9gqnjHwz9HoeJpGHw==", "dev": true, "requires": { "@eslint/eslintrc": "^1.0.3", diff --git a/package.json b/package.json index 1e172b759..2d4456c39 100644 --- a/package.json +++ b/package.json @@ -75,7 +75,7 @@ "vitreum": "git+https://git@github.com/calculuschild/vitreum.git" }, "devDependencies": { - "eslint": "^8.0.1", + "eslint": "^8.1.0", "eslint-plugin-react": "^7.26.1", "pico-check": "^2.1.3" } From bf489513dc30a6aaf0803c3e81b259d87a2e53f1 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 25 Oct 2021 03:00:59 +0000 Subject: [PATCH 045/145] Bump marked from 3.0.7 to 3.0.8 Bumps [marked](https://github.com/markedjs/marked) from 3.0.7 to 3.0.8. - [Release notes](https://github.com/markedjs/marked/releases) - [Changelog](https://github.com/markedjs/marked/blob/master/release.config.js) - [Commits](https://github.com/markedjs/marked/compare/v3.0.7...v3.0.8) --- updated-dependencies: - dependency-name: marked dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- package-lock.json | 14 +++++++------- package.json | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/package-lock.json b/package-lock.json index 316977c20..01c3d5dc4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -28,7 +28,7 @@ "jwt-simple": "^0.5.6", "less": "^3.13.1", "lodash": "^4.17.21", - "marked": "3.0.7", + "marked": "3.0.8", "markedLegacy": "npm:marked@^0.3.19", "moment": "^2.29.1", "mongoose": "^6.0.12", @@ -5985,9 +5985,9 @@ } }, "node_modules/marked": { - "version": "3.0.7", - "resolved": "https://registry.npmjs.org/marked/-/marked-3.0.7.tgz", - "integrity": "sha512-ctKqbnLuNbsHbI26cfMyOlKgXGfl1orOv1AvWWDX7AkgfMOwCWvmuYc+mVLeWhQ9W6hdWVBynOs96VkcscKo0Q==", + "version": "3.0.8", + "resolved": "https://registry.npmjs.org/marked/-/marked-3.0.8.tgz", + "integrity": "sha512-0gVrAjo5m0VZSJb4rpL59K1unJAMb/hm8HRXqasD8VeC8m91ytDPMritgFSlKonfdt+rRYYpP/JfLxgIX8yoSw==", "bin": { "marked": "bin/marked" }, @@ -14018,9 +14018,9 @@ } }, "marked": { - "version": "3.0.7", - "resolved": "https://registry.npmjs.org/marked/-/marked-3.0.7.tgz", - "integrity": "sha512-ctKqbnLuNbsHbI26cfMyOlKgXGfl1orOv1AvWWDX7AkgfMOwCWvmuYc+mVLeWhQ9W6hdWVBynOs96VkcscKo0Q==" + "version": "3.0.8", + "resolved": "https://registry.npmjs.org/marked/-/marked-3.0.8.tgz", + "integrity": "sha512-0gVrAjo5m0VZSJb4rpL59K1unJAMb/hm8HRXqasD8VeC8m91ytDPMritgFSlKonfdt+rRYYpP/JfLxgIX8yoSw==" }, "markedLegacy": { "version": "npm:marked@0.3.19", diff --git a/package.json b/package.json index 1e172b759..9decebaef 100644 --- a/package.json +++ b/package.json @@ -58,7 +58,7 @@ "jwt-simple": "^0.5.6", "less": "^3.13.1", "lodash": "^4.17.21", - "marked": "3.0.7", + "marked": "3.0.8", "markedLegacy": "npm:marked@^0.3.19", "moment": "^2.29.1", "mongoose": "^6.0.12", From da2dfd373653a02ac29417213fa1736db583f0c0 Mon Sep 17 00:00:00 2001 From: "G.Ambatte" Date: Tue, 26 Oct 2021 19:15:58 +1300 Subject: [PATCH 046/145] Shift from `16.11` to `16.11-alpine` with `git` added --- Dockerfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 925b1c3c4..33adea2b8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,5 @@ -FROM node:16.11 +FROM node:16.11-alpine +RUN apk --no-cache add git ENV NODE_ENV=docker From 3ce1ea610dc57f4955801859fa87a28305502b85 Mon Sep 17 00:00:00 2001 From: "G.Ambatte" Date: Wed, 27 Oct 2021 19:51:52 +1300 Subject: [PATCH 047/145] Update `template.js` to add tags --- client/template.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/client/template.js b/client/template.js index e2e0893e3..5304ae15e 100644 --- a/client/template.js +++ b/client/template.js @@ -7,6 +7,12 @@ module.exports = async(name, title = '', props = {})=>{ + + + + + + ${title.length ? `${title} - The Homebrewery`: 'The Homebrewery - NaturalCrit'} From 20d7193fb2bb93b6d220bd49fc6087c183cf8306 Mon Sep 17 00:00:00 2001 From: "G.Ambatte" Date: Thu, 28 Oct 2021 00:29:42 +1300 Subject: [PATCH 048/145] Add `thumbnail` to metadata and saving functions --- .../editor/metadataEditor/metadataEditor.jsx | 8 +++++++- client/homebrew/pages/editPage/editPage.jsx | 3 ++- server/googleActions.js | 15 ++++++++++----- server/homebrew.model.js | 1 + 4 files changed, 20 insertions(+), 7 deletions(-) diff --git a/client/homebrew/editor/metadataEditor/metadataEditor.jsx b/client/homebrew/editor/metadataEditor/metadataEditor.jsx index c7dea871b..b4607b153 100644 --- a/client/homebrew/editor/metadataEditor/metadataEditor.jsx +++ b/client/homebrew/editor/metadataEditor/metadataEditor.jsx @@ -18,7 +18,8 @@ const MetadataEditor = createClass({ published : false, authors : [], systems : [], - renderer : 'legacy' + renderer : 'legacy', + thumbnail : '' }, onChange : ()=>{} }; @@ -161,6 +162,11 @@ const MetadataEditor = createClass({