From 45aa8bdfaee8f4209289e67a3e213a53bc0f410a Mon Sep 17 00:00:00 2001 From: Gazook89 <58999374+Gazook89@users.noreply.github.com> Date: Wed, 21 Sep 2022 20:27:16 -0500 Subject: [PATCH 01/10] Add html node and css for Delete button --- client/homebrew/navbar/navbar.less | 25 +++++++++++++++++++++++ client/homebrew/navbar/recent.navitem.jsx | 3 ++- 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/client/homebrew/navbar/navbar.less b/client/homebrew/navbar/navbar.less index 39fbfaf5c..47d89105e 100644 --- a/client/homebrew/navbar/navbar.less +++ b/client/homebrew/navbar/navbar.less @@ -101,8 +101,33 @@ color : white; text-decoration : none; border-top : 1px solid #888; + overflow : clip; + .clear{ + display : none; + position : absolute; + top : 50%; + transform : translateY(-50%); + right : 10px; + width : 20px; + height : 20px; + background-color : #333; + box-shadow : 0px 0 5px 8px #2980b9; + border-radius : 3px; + i { + text-align : center; + font-size : 10px; + margin : 0; + height :100%; + width :100%; + } + } &:hover{ background-color : @blue; + + .clear{ + display : grid; + place-content : center; + } } .title{ display : inline-block; diff --git a/client/homebrew/navbar/recent.navitem.jsx b/client/homebrew/navbar/recent.navitem.jsx index ee24cfd5c..9cc0d5b28 100644 --- a/client/homebrew/navbar/recent.navitem.jsx +++ b/client/homebrew/navbar/recent.navitem.jsx @@ -120,13 +120,14 @@ const RecentItems = createClass({ }, renderDropdown : function(){ - if(!this.state.showDropdown) return null; + // if(!this.state.showDropdown) return null; const makeItems = (brews)=>{ return _.map(brews, (brew, i)=>{ return {brew.title || '[ no title ]'} {Moment(brew.ts).fromNow()} +
; }); }; From a7a67621a139bbce23044b8882bee363f64c0399 Mon Sep 17 00:00:00 2001 From: Gazook89 <58999374+Gazook89@users.noreply.github.com> Date: Tue, 18 Oct 2022 21:01:24 -0500 Subject: [PATCH 02/10] added removeItem() function --- client/homebrew/navbar/recent.navitem.jsx | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/client/homebrew/navbar/recent.navitem.jsx b/client/homebrew/navbar/recent.navitem.jsx index 9cc0d5b28..49085cd7e 100644 --- a/client/homebrew/navbar/recent.navitem.jsx +++ b/client/homebrew/navbar/recent.navitem.jsx @@ -119,6 +119,25 @@ const RecentItems = createClass({ }); }, + removeItem : function(url, evt){ + evt.preventDefault(); + + let edited = JSON.parse(localStorage.getItem(EDIT_KEY) || '[]'); + let viewed = JSON.parse(localStorage.getItem(VIEW_KEY) || '[]'); + + edited = edited.filter((item)=>{ return (item.url !== url);}); + viewed = viewed.filter((item)=>{ return (item.url !== url);}); + + localStorage.setItem(EDIT_KEY, JSON.stringify(edited)); + localStorage.setItem(VIEW_KEY, JSON.stringify(viewed)); + + this.setState({ + edit : edited, + view : viewed + }); + + }, + renderDropdown : function(){ // if(!this.state.showDropdown) return null; @@ -127,7 +146,7 @@ const RecentItems = createClass({ return {brew.title || '[ no title ]'} {Moment(brew.ts).fromNow()} -
+
{this.removeItem(`${brew.url}`, e);}}>
; }); }; From 23a0a89ead17df75d6fbb411cdb060759cc3fa42 Mon Sep 17 00:00:00 2001 From: Gazook89 <58999374+Gazook89@users.noreply.github.com> Date: Tue, 18 Oct 2022 21:02:44 -0500 Subject: [PATCH 03/10] autohide dropdown again --- client/homebrew/navbar/recent.navitem.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/homebrew/navbar/recent.navitem.jsx b/client/homebrew/navbar/recent.navitem.jsx index 49085cd7e..64f17ea42 100644 --- a/client/homebrew/navbar/recent.navitem.jsx +++ b/client/homebrew/navbar/recent.navitem.jsx @@ -139,7 +139,7 @@ const RecentItems = createClass({ }, renderDropdown : function(){ - // if(!this.state.showDropdown) return null; + if(!this.state.showDropdown) return null; const makeItems = (brews)=>{ return _.map(brews, (brew, i)=>{ From ffddc275c1943c8849e20e665aa783b6e22bdfaf Mon Sep 17 00:00:00 2001 From: Gazook89 <58999374+Gazook89@users.noreply.github.com> Date: Thu, 3 Nov 2022 23:38:46 -0500 Subject: [PATCH 04/10] set removeItem icon to transparent background --- client/homebrew/navbar/navbar.less | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/client/homebrew/navbar/navbar.less b/client/homebrew/navbar/navbar.less index edbb70dc3..7c7e8a163 100644 --- a/client/homebrew/navbar/navbar.less +++ b/client/homebrew/navbar/navbar.less @@ -121,12 +121,16 @@ position : absolute; top : 50%; transform : translateY(-50%); - right : 10px; + right : 0px; width : 20px; - height : 20px; + height : 100%; background-color : #333; - box-shadow : 0px 0 5px 8px #2980b9; + opacity : 70%; + // box-shadow : 0px 0 5px 8px #2980b9; border-radius : 3px; + &:hover { + opacity : 100%; + } i { text-align : center; font-size : 10px; From bda80c9984ca5607d9f5cd3814d5c479d73eeae2 Mon Sep 17 00:00:00 2001 From: Gazook89 <58999374+Gazook89@users.noreply.github.com> Date: Sun, 13 Nov 2022 11:43:55 -0600 Subject: [PATCH 05/10] remove comments --- client/homebrew/navbar/navbar.less | 1 - 1 file changed, 1 deletion(-) diff --git a/client/homebrew/navbar/navbar.less b/client/homebrew/navbar/navbar.less index 7c7e8a163..3bd6a66e1 100644 --- a/client/homebrew/navbar/navbar.less +++ b/client/homebrew/navbar/navbar.less @@ -126,7 +126,6 @@ height : 100%; background-color : #333; opacity : 70%; - // box-shadow : 0px 0 5px 8px #2980b9; border-radius : 3px; &:hover { opacity : 100%; From 3e626d91f0fdeab9efc38daaaa33fdd802f7a8b3 Mon Sep 17 00:00:00 2001 From: "G.Ambatte" Date: Mon, 14 Nov 2022 08:12:27 +1300 Subject: [PATCH 06/10] Add empty object as ogMeta default --- server/app.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/app.js b/server/app.js index 7d462cf1e..535ae2669 100644 --- a/server/app.js +++ b/server/app.js @@ -415,7 +415,7 @@ app.use(asyncHandler(async (req, res, next)=>{ enable_v3 : config.get('enable_v3'), enable_themes : config.get('enable_themes'), config : configuration, - ogMeta : req.ogMeta + ogMeta : req.ogMeta ?? {} }; const title = req.brew ? req.brew.title : ''; const page = await templateFn('homebrew', title, props) From 3e3610a204ba4592afafcb5e5eba710b1e0c445f Mon Sep 17 00:00:00 2001 From: "G.Ambatte" Date: Mon, 14 Nov 2022 08:20:46 +1300 Subject: [PATCH 07/10] Move fix to template.js --- client/template.js | 3 ++- server/app.js | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/client/template.js b/client/template.js index 13e09711c..cab4790b9 100644 --- a/client/template.js +++ b/client/template.js @@ -1,6 +1,7 @@ const template = async function(name, title='', props = {}){ const ogTags = []; - Object.entries(props.ogMeta).forEach(([key, value])=>{ + const ogMeta = props.ogMeta ?? {}; + Object.entries(ogMeta).forEach(([key, value])=>{ if(!value) return; const tag = ``; ogTags.push(tag); diff --git a/server/app.js b/server/app.js index 535ae2669..7d462cf1e 100644 --- a/server/app.js +++ b/server/app.js @@ -415,7 +415,7 @@ app.use(asyncHandler(async (req, res, next)=>{ enable_v3 : config.get('enable_v3'), enable_themes : config.get('enable_themes'), config : configuration, - ogMeta : req.ogMeta ?? {} + ogMeta : req.ogMeta }; const title = req.brew ? req.brew.title : ''; const page = await templateFn('homebrew', title, props) From fef79f4fc3232d0d9204ace2b9b1ad62ec05d9a6 Mon Sep 17 00:00:00 2001 From: Gazook89 <58999374+Gazook89@users.noreply.github.com> Date: Sun, 13 Nov 2022 22:09:50 -0600 Subject: [PATCH 08/10] remove checkboxes --- .github/ISSUE_TEMPLATE/feature_request.yml | 8 ++------ .github/ISSUE_TEMPLATE/general_issue.yml | 7 ++++--- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.yml index 05eda75b4..b87b267e6 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.yml +++ b/.github/ISSUE_TEMPLATE/feature_request.yml @@ -12,10 +12,6 @@ body: description: The best feature requests provide an explanation of the current issue and then an explanation of how it could be improved. Screenshots/images can be pasted right in as well! validations: required: true - - type: checkboxes - id: terms + - type: markdown attributes: - label: "Please confirm:" - options: - - label: I have searched the Issues tracker for any duplicate requests and found none. - required: true \ No newline at end of file + value: "Please be sure to search for any close matches to your request in the GitHub Issues tracker before opening a new request, thanks!" diff --git a/.github/ISSUE_TEMPLATE/general_issue.yml b/.github/ISSUE_TEMPLATE/general_issue.yml index 33dd5b2bc..18c19254e 100644 --- a/.github/ISSUE_TEMPLATE/general_issue.yml +++ b/.github/ISSUE_TEMPLATE/general_issue.yml @@ -4,14 +4,15 @@ body: - type: markdown attributes: value: Please include as much information as possible. - - type: checkboxes + - type: dropdown id: renderer attributes: label: Renderer description: Which renderer does this issue occur on? If you are unsure, you can check the renderer in the Properties Editor (click the "i" in the Snippet Menu bar above the editor). options: - - label: Legacy - - label: v3 + - v3 + - Legacy + - Both validations: required: true - type: dropdown From dc86f89c4ffebd7a9db24bbb590852fc3f75abc0 Mon Sep 17 00:00:00 2001 From: Trevor Buckner Date: Mon, 14 Nov 2022 09:58:48 -0500 Subject: [PATCH 09/10] Add title attribute --- client/homebrew/navbar/recent.navitem.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/homebrew/navbar/recent.navitem.jsx b/client/homebrew/navbar/recent.navitem.jsx index 64f17ea42..169c46a0e 100644 --- a/client/homebrew/navbar/recent.navitem.jsx +++ b/client/homebrew/navbar/recent.navitem.jsx @@ -146,7 +146,7 @@ const RecentItems = createClass({ return {brew.title || '[ no title ]'} {Moment(brew.ts).fromNow()} -
{this.removeItem(`${brew.url}`, e);}}>
+
{this.removeItem(`${brew.url}`, e);}}>
; }); }; From 8016f82040dc83117bc83a3530b9614fc1858077 Mon Sep 17 00:00:00 2001 From: Trevor Buckner Date: Mon, 14 Nov 2022 18:56:04 -0500 Subject: [PATCH 10/10] Tweak capture group order --- client/homebrew/editor/editor.jsx | 4 ++-- shared/naturalcrit/markdown.js | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/client/homebrew/editor/editor.jsx b/client/homebrew/editor/editor.jsx index d05d5cc0d..36995f526 100644 --- a/client/homebrew/editor/editor.jsx +++ b/client/homebrew/editor/editor.jsx @@ -139,7 +139,7 @@ const Editor = createClass({ // Highlight inline spans {{content}} if(line.includes('{{') && line.includes('}}')){ - const regex = /{{(?:(?=(:(?:"[\w,\-()#%. ]*"|[\w\-()#%.]*)|[^"':{}\s]*))\1)*|}}/g; + const regex = /{{(?=((?::(?:"[\w,\-()#%. ]*"|[\w\-()#%.]*)|[^"':{}\s]*)*))\1 *|}}/g; let match; let blockCount = 0; while ((match = regex.exec(line)) != null) { @@ -158,7 +158,7 @@ const Editor = createClass({ // Highlight block divs {{\n Content \n}} let endCh = line.length+1; - const match = line.match(/^ *{{(?:(?=(:(?:"[\w,\-()#%. ]*"|[\w\-()#%.]*)|[^"':{}\s]*))\1)* *$|^ *}}$/); + const match = line.match(/^ *{{(?=((?::(?:"[\w,\-()#%. ]*"|[\w\-()#%.]*)|[^"':{}\s]*)*))\1 *$|^ *}}$/); if(match) endCh = match.index+match[0].length; codeMirror.markText({ line: lineNumber, ch: 0 }, { line: lineNumber, ch: endCh }, { className: 'block' }); diff --git a/shared/naturalcrit/markdown.js b/shared/naturalcrit/markdown.js index 3c52e5142..8dbb1d7f9 100644 --- a/shared/naturalcrit/markdown.js +++ b/shared/naturalcrit/markdown.js @@ -32,7 +32,7 @@ const mustacheSpans = { start(src) { return src.match(/{{[^{]/)?.index; }, // Hint to Marked.js to stop and check for a match tokenizer(src, tokens) { const completeSpan = /^{{[^\n]*}}/; // Regex for the complete token - const inlineRegex = /{{(?:(?=(:(?:"[\w,\-()#%. ]*"|[\w\-()#%.]*)|[^"':{}\s]*))\1)* *|}}/g; + const inlineRegex = /{{(?=((?::(?:"[\w,\-()#%. ]*"|[\w\-()#%.]*)|[^"':{}\s]*)*))\1 *|}}/g; const match = completeSpan.exec(src); if(match) { //Find closing delimiter @@ -82,7 +82,7 @@ const mustacheDivs = { start(src) { return src.match(/\n *{{[^{]/m)?.index; }, // Hint to Marked.js to stop and check for a match tokenizer(src, tokens) { const completeBlock = /^ *{{[^\n}]* *\n.*\n *}}/s; // Regex for the complete token - const blockRegex = /^ *{{(?:(?=(:(?:"[\w,\-()#%. ]*"|[\w\-()#%.]*)|[^"':{}\s]*))\1)* *$|^ *}}$/gm; + const blockRegex = /^ *{{(?=((?::(?:"[\w,\-()#%. ]*"|[\w\-()#%.]*)|[^"':{}\s]*)*))\1 *$|^ *}}$/gm; const match = completeBlock.exec(src); if(match) { //Find closing delimiter @@ -130,7 +130,7 @@ const mustacheInjectInline = { level : 'inline', start(src) { return src.match(/ *{[^{\n]/)?.index; }, // Hint to Marked.js to stop and check for a match tokenizer(src, tokens) { - const inlineRegex = /{(?:(?=(:(?:"[\w,\-()#%. ]*"|[\w\-()#%.]*)|[^"':{}\s]*))\1)*}/g; + const inlineRegex = /^ *{(?=((?::(?:"[\w,\-()#%. ]*"|[\w\-()#%.]*)|[^"':{}\s]*)*))\1}/g; const match = inlineRegex.exec(src); if(match) { const lastToken = tokens[tokens.length - 1]; @@ -165,7 +165,7 @@ const mustacheInjectBlock = { level : 'block', start(src) { return src.match(/\n *{[^{\n]/m)?.index; }, // Hint to Marked.js to stop and check for a match tokenizer(src, tokens) { - const inlineRegex = /{(?:(?=(:(?:"[\w,\-()#%. ]*"|[\w\-()#%.]*)|[^"':{}\s]*))\1)*}/ym; + const inlineRegex = /^ *{(?=((?::(?:"[\w,\-()#%. ]*"|[\w\-()#%.]*)|[^"':{}\s]*)*))\1}/ym; const match = inlineRegex.exec(src); if(match) { const lastToken = tokens[tokens.length - 1];