From f31fe6cbf0d1204932bc14c361c497d75ce4bcc6 Mon Sep 17 00:00:00 2001 From: "G.Ambatte" Date: Sun, 25 Jul 2021 16:54:24 +1200 Subject: [PATCH 01/30] Prepend 'CLONE:- ' to title of cloned brew --- server.js | 1 + 1 file changed, 1 insertion(+) diff --git a/server.js b/server.js index 45e073065..3b9ff6b04 100644 --- a/server.js +++ b/server.js @@ -170,6 +170,7 @@ app.get('/edit/:id', asyncHandler(async (req, res, next)=>{ //New Page app.get('/new/:id', asyncHandler(async (req, res, next)=>{ const brew = await getBrewFromId(req.params.id, 'share'); + brew.title = `CLONE:- ${brew.title}`; req.brew = brew; return next(); })); From c6d0a2e2add5b0ff89ae51572b179e8459df275c Mon Sep 17 00:00:00 2001 From: "G.Ambatte" Date: Mon, 26 Jul 2021 09:55:04 +1200 Subject: [PATCH 02/30] Make WelcomeText and ChangeLogText conditional --- server.js | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/server.js b/server.js index 45e073065..32576e4f6 100644 --- a/server.js +++ b/server.js @@ -105,6 +105,18 @@ app.get('/robots.txt', (req, res)=>{ return res.sendFile(`${__dirname}/robots.txt`); }); +//Home page +app.get('/', async (req, res, next)=>{ + req.welcomeText = welcomeText; + return next(); +}); + +//Changelog page +app.get('/changelog', async (req, res, next)=>{ + req.changelogText = changelogText; + return next(); +}); + //Source page app.get('/source/:id', asyncHandler(async (req, res)=>{ const brew = await getBrewFromId(req.params.id, 'raw'); @@ -204,8 +216,8 @@ app.use((req, res)=>{ const props = { version : require('./package.json').version, url : req.originalUrl, - welcomeText : welcomeText, - changelog : changelogText, + welcomeText : req.welcomeText, + changelog : req.changelogText, brew : req.brew, brews : req.brews, googleBrews : req.googleBrews, From 41e1ed7bd1b6c5b056aca8bcc356880eeefbf595 Mon Sep 17 00:00:00 2001 From: "G.Ambatte" Date: Mon, 26 Jul 2021 10:29:31 +1200 Subject: [PATCH 03/30] Fix issue with undefined Style tab data --- client/homebrew/brewRenderer/brewRenderer.jsx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/client/homebrew/brewRenderer/brewRenderer.jsx b/client/homebrew/brewRenderer/brewRenderer.jsx index 440db1ce3..6401001ed 100644 --- a/client/homebrew/brewRenderer/brewRenderer.jsx +++ b/client/homebrew/brewRenderer/brewRenderer.jsx @@ -122,6 +122,11 @@ const BrewRenderer = createClass({ ; }, + renderStyle : function() { + if(!this.props.style) return; + return
${this.props.style} ` }} />; + }, + renderPage : function(pageText, index){ if(this.props.renderer == 'legacy') return
; @@ -189,7 +194,9 @@ const BrewRenderer = createClass({
{/* Apply CSS from Style tab */} -
${this.props.style} ` }} /> + {this.state.isMounted + ? this.renderStyle() + : null} {/* Render pages from Markdown tab */} {this.state.isMounted From 7fa1e16b5a4129295497725b4d4adcab37724658 Mon Sep 17 00:00:00 2001 From: "G.Ambatte" Date: Wed, 28 Jul 2021 17:51:35 +1200 Subject: [PATCH 04/30] Create minimal Changelog brew --- client/homebrew/homebrew.jsx | 2 +- client/homebrew/pages/homePage/homePage.jsx | 2 -- server.js | 6 +++++- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/client/homebrew/homebrew.jsx b/client/homebrew/homebrew.jsx index 94131b1dd..164369083 100644 --- a/client/homebrew/homebrew.jsx +++ b/client/homebrew/homebrew.jsx @@ -48,7 +48,7 @@ const Homebrew = createClass({ }/> } /> } /> - }/> + }/> }/>
diff --git a/client/homebrew/pages/homePage/homePage.jsx b/client/homebrew/pages/homePage/homePage.jsx index d1e749482..6349883f2 100644 --- a/client/homebrew/pages/homePage/homePage.jsx +++ b/client/homebrew/pages/homePage/homePage.jsx @@ -28,8 +28,6 @@ const HomePage = createClass({ welcomeText : '', ver : '0.0.0' }; - - }, getInitialState : function() { return { diff --git a/server.js b/server.js index 32576e4f6..a508a6e42 100644 --- a/server.js +++ b/server.js @@ -113,7 +113,11 @@ app.get('/', async (req, res, next)=>{ //Changelog page app.get('/changelog', async (req, res, next)=>{ - req.changelogText = changelogText; + const brew = { + title : 'Changelog', + text : changelogText + }; + req.brew = brew; return next(); }); From 0818a3485a5025b0784876469ee9aecb3be9809f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 29 Jul 2021 03:00:58 +0000 Subject: [PATCH 05/30] Bump mongoose from 5.13.3 to 5.13.4 Bumps [mongoose](https://github.com/Automattic/mongoose) from 5.13.3 to 5.13.4. - [Release notes](https://github.com/Automattic/mongoose/releases) - [Changelog](https://github.com/Automattic/mongoose/blob/master/History.md) - [Commits](https://github.com/Automattic/mongoose/compare/5.13.3...5.13.4) --- updated-dependencies: - dependency-name: mongoose dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- package-lock.json | 16 +++++++++------- package.json | 2 +- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/package-lock.json b/package-lock.json index 140fd0a27..31e336cb7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -30,7 +30,7 @@ "marked": "2.1.3", "markedLegacy": "npm:marked@^0.3.19", "moment": "^2.29.1", - "mongoose": "^5.13.3", + "mongoose": "^5.13.4", "nanoid": "3.1.23", "nconf": "^0.11.3", "prop-types": "15.7.2", @@ -6376,9 +6376,9 @@ } }, "node_modules/mongoose": { - "version": "5.13.3", - "resolved": "https://registry.npmjs.org/mongoose/-/mongoose-5.13.3.tgz", - "integrity": "sha512-q+zX6kqHAvwxf5speMWhq6qF4vdj+x6/kfD5RSKdZKNm52yGmaUygN+zgrtQjBZPFEzG0B3vF6GP0PoAGadE+w==", + "version": "5.13.4", + "resolved": "https://registry.npmjs.org/mongoose/-/mongoose-5.13.4.tgz", + "integrity": "sha512-D1yVHAOa+G8iQZsC/nNzZe+CI1FCYu6Qk384s1vSyaSfKCu/alKeyL78BA73SsxeRKT9zmswSIueLbGBURjrKg==", "dependencies": { "@types/mongodb": "^3.5.27", "@types/node": "14.x || 15.x", @@ -6389,6 +6389,7 @@ "mpath": "0.8.3", "mquery": "3.2.5", "ms": "2.1.2", + "optional-require": "1.0.x", "regexp-clone": "1.0.0", "safe-buffer": "5.2.1", "sift": "13.5.2", @@ -14455,9 +14456,9 @@ } }, "mongoose": { - "version": "5.13.3", - "resolved": "https://registry.npmjs.org/mongoose/-/mongoose-5.13.3.tgz", - "integrity": "sha512-q+zX6kqHAvwxf5speMWhq6qF4vdj+x6/kfD5RSKdZKNm52yGmaUygN+zgrtQjBZPFEzG0B3vF6GP0PoAGadE+w==", + "version": "5.13.4", + "resolved": "https://registry.npmjs.org/mongoose/-/mongoose-5.13.4.tgz", + "integrity": "sha512-D1yVHAOa+G8iQZsC/nNzZe+CI1FCYu6Qk384s1vSyaSfKCu/alKeyL78BA73SsxeRKT9zmswSIueLbGBURjrKg==", "requires": { "@types/mongodb": "^3.5.27", "@types/node": "14.x || 15.x", @@ -14468,6 +14469,7 @@ "mpath": "0.8.3", "mquery": "3.2.5", "ms": "2.1.2", + "optional-require": "1.0.x", "regexp-clone": "1.0.0", "safe-buffer": "5.2.1", "sift": "13.5.2", diff --git a/package.json b/package.json index e31d91cea..a363b6db8 100644 --- a/package.json +++ b/package.json @@ -61,7 +61,7 @@ "marked": "2.1.3", "markedLegacy": "npm:marked@^0.3.19", "moment": "^2.29.1", - "mongoose": "^5.13.3", + "mongoose": "^5.13.4", "nanoid": "3.1.23", "nconf": "^0.11.3", "prop-types": "15.7.2", From fdfea3661422940d728d2463729101d3917f6e08 Mon Sep 17 00:00:00 2001 From: "G.Ambatte" Date: Thu, 29 Jul 2021 19:00:26 +1200 Subject: [PATCH 06/30] Shift HomePage to use a minimal brew --- client/homebrew/homebrew.jsx | 8 ++++---- client/homebrew/pages/homePage/homePage.jsx | 12 +++++------- server.js | 6 +++++- 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/client/homebrew/homebrew.jsx b/client/homebrew/homebrew.jsx index 164369083..118c21e91 100644 --- a/client/homebrew/homebrew.jsx +++ b/client/homebrew/homebrew.jsx @@ -44,12 +44,12 @@ const Homebrew = createClass({ }/> }/> }/> - }/> + }/> }/> - } /> - } /> + }/> + }/> }/> - }/> + }/>
diff --git a/client/homebrew/pages/homePage/homePage.jsx b/client/homebrew/pages/homePage/homePage.jsx index 6349883f2..c89f6c95b 100644 --- a/client/homebrew/pages/homePage/homePage.jsx +++ b/client/homebrew/pages/homePage/homePage.jsx @@ -23,17 +23,15 @@ const HomePage = createClass({ getDefaultProps : function() { return { brew : { - text : '' + text : '', + welcomeText : '' }, - welcomeText : '', - ver : '0.0.0' + ver : '0.0.0' }; }, getInitialState : function() { return { - brew : { - text : this.props.welcomeText - } + brew : this.props.brew }; }, handleSave : function(){ @@ -87,7 +85,7 @@ const HomePage = createClass({
-
+
Save current
diff --git a/server.js b/server.js index a508a6e42..6d3006016 100644 --- a/server.js +++ b/server.js @@ -107,7 +107,11 @@ app.get('/robots.txt', (req, res)=>{ //Home page app.get('/', async (req, res, next)=>{ - req.welcomeText = welcomeText; + const brew = { + text : welcomeText, + welcomeText : welcomeText + }; + req.brew = brew; return next(); }); From 85fa73b9bf03cba012447935e8a072b19c9f0d41 Mon Sep 17 00:00:00 2001 From: "G.Ambatte" Date: Thu, 29 Jul 2021 19:02:48 +1200 Subject: [PATCH 07/30] Remove welcomText+changelogText from default props --- server.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/server.js b/server.js index 6d3006016..88019de4b 100644 --- a/server.js +++ b/server.js @@ -224,8 +224,6 @@ app.use((req, res)=>{ const props = { version : require('./package.json').version, url : req.originalUrl, - welcomeText : req.welcomeText, - changelog : req.changelogText, brew : req.brew, brews : req.brews, googleBrews : req.googleBrews, From cac5aa2475f6c0a9c45f23a6b1d373af6c092f31 Mon Sep 17 00:00:00 2001 From: "G.Ambatte" Date: Thu, 29 Jul 2021 19:23:27 +1200 Subject: [PATCH 08/30] Combine renderStyle and renderPages logic --- client/homebrew/brewRenderer/brewRenderer.jsx | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/client/homebrew/brewRenderer/brewRenderer.jsx b/client/homebrew/brewRenderer/brewRenderer.jsx index 6401001ed..78ea3d6c2 100644 --- a/client/homebrew/brewRenderer/brewRenderer.jsx +++ b/client/homebrew/brewRenderer/brewRenderer.jsx @@ -193,14 +193,13 @@ const BrewRenderer = createClass({
- {/* Apply CSS from Style tab */} + {/* Apply CSS and render pages from Markdown tab */} {this.state.isMounted - ? this.renderStyle() - : null} - - {/* Render pages from Markdown tab */} - {this.state.isMounted - ? this.renderPages() + ? + <> + {this.renderStyle()} + {this.renderPages()} + : null}
From 577a434e17d6dc3e08279f398547eb2ea0aab0ac Mon Sep 17 00:00:00 2001 From: "G.Ambatte" Date: Thu, 29 Jul 2021 19:24:36 +1200 Subject: [PATCH 09/30] Slight change to `isMounted` logic --- client/homebrew/brewRenderer/brewRenderer.jsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/client/homebrew/brewRenderer/brewRenderer.jsx b/client/homebrew/brewRenderer/brewRenderer.jsx index 78ea3d6c2..d80ac0f64 100644 --- a/client/homebrew/brewRenderer/brewRenderer.jsx +++ b/client/homebrew/brewRenderer/brewRenderer.jsx @@ -195,12 +195,12 @@ const BrewRenderer = createClass({
{/* Apply CSS and render pages from Markdown tab */} {this.state.isMounted - ? + && <> {this.renderStyle()} {this.renderPages()} - : null} + }
From db3bec9e2bb3067006b43dec6a99527a5e007d55 Mon Sep 17 00:00:00 2001 From: "G.Ambatte" Date: Thu, 29 Jul 2021 21:05:55 +1200 Subject: [PATCH 10/30] Combine `setState` calls in `componentDidMount` --- client/homebrew/pages/newPage/newPage.jsx | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/client/homebrew/pages/newPage/newPage.jsx b/client/homebrew/pages/newPage/newPage.jsx index d29a858a2..76cab5292 100644 --- a/client/homebrew/pages/newPage/newPage.jsx +++ b/client/homebrew/pages/newPage/newPage.jsx @@ -26,6 +26,7 @@ const NewPage = createClass({ return { brew : { text : '', + style : undefined, shareId : null, editId : null, createdAt : null, @@ -46,6 +47,7 @@ const NewPage = createClass({ return { brew : { text : this.props.brew.text || '', + style : this.props.brew.style || undefined, gDrive : false, title : this.props.brew.title || '', description : this.props.brew.description || '', @@ -67,16 +69,15 @@ const NewPage = createClass({ const brewStorage = localStorage.getItem(BREWKEY); const styleStorage = localStorage.getItem(STYLEKEY); + const brew = this.state.brew; + if(!this.props.brew.text || !this.props.brew.style){ - this.setState({ - brew : { - text : this.props.brew.text || (brewStorage ?? ''), - style : this.props.brew.style || (styleStorage ?? undefined) - } - }); + brew.text = this.props.brew.text || (brewStorage ?? ''); + brew.style = this.props.brew.style || (styleStorage ?? undefined); } this.setState((prevState)=>({ + brew : brew, htmlErrors : Markdown.validate(prevState.brew.text) })); From 0c0ba0b6ca1cba76387cb76785239daad5784fe5 Mon Sep 17 00:00:00 2001 From: Gazook89 <58999374+Gazook89@users.noreply.github.com> Date: Thu, 29 Jul 2021 11:26:41 -0500 Subject: [PATCH 11/30] Update metadataEditor.less - Fix Publish button and following small text so there is no overlap - set `nowrap` on checkbox inputs/labels so that the labels do not wrap to the next line from their input. - set min-width on values so that text boxes shrink to the same width; and can flex to any larger size. --- .../editor/metadataEditor/metadataEditor.less | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/client/homebrew/editor/metadataEditor/metadataEditor.less b/client/homebrew/editor/metadataEditor/metadataEditor.less index c3141f0d4..9d4e9534d 100644 --- a/client/homebrew/editor/metadataEditor/metadataEditor.less +++ b/client/homebrew/editor/metadataEditor/metadataEditor.less @@ -18,10 +18,11 @@ font-weight : 800; line-height : 1.8em; text-transform : uppercase; - flex-grow : 0; + flex : 0 0 auto; } &>.value{ - flex-grow : 1; + flex : 1 1 auto; + min-width : 200px; } } .description.field textarea.value{ @@ -38,6 +39,8 @@ font-size : 0.7em; font-weight : 800; user-select : none; + white-space : nowrap; + display : inline-block; } input{ vertical-align : middle; @@ -47,6 +50,9 @@ .publish.field .value{ position : relative; margin-bottom: 15px; + button{ + width:100%; + } button.publish{ .button(@blueLight); } @@ -76,4 +82,4 @@ font-size: 0.8em; line-height : 1.5em; } -} \ No newline at end of file +} From c4c5e21ce07a3191938809a6acbfe5164026027a Mon Sep 17 00:00:00 2001 From: Gazook89 <58999374+Gazook89@users.noreply.github.com> Date: Thu, 29 Jul 2021 12:28:02 -0500 Subject: [PATCH 12/30] Vertically center button labels Set labels as inline-flex containers and vertically align children to center. --- client/homebrew/editor/metadataEditor/metadataEditor.less | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/client/homebrew/editor/metadataEditor/metadataEditor.less b/client/homebrew/editor/metadataEditor/metadataEditor.less index 9d4e9534d..a58df14cd 100644 --- a/client/homebrew/editor/metadataEditor/metadataEditor.less +++ b/client/homebrew/editor/metadataEditor/metadataEditor.less @@ -40,11 +40,13 @@ font-weight : 800; user-select : none; white-space : nowrap; - display : inline-block; + display : inline-flex; + align-items : center; } input{ vertical-align : middle; cursor : pointer; + margin : 3px; } } .publish.field .value{ From 6b61bb05c087cacdc00a8223b74f454bedb8ea5b Mon Sep 17 00:00:00 2001 From: Trevor Buckner Date: Fri, 30 Jul 2021 01:27:05 -0400 Subject: [PATCH 13/30] Update markdown.js - Fix "start" function for Divs and BlockInject, which were being generated mid-line (must start only after a newline) - Fix Divs consuming part of Spans above them. - Add % and # as valid characters for inline-styles --- shared/naturalcrit/markdown.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/shared/naturalcrit/markdown.js b/shared/naturalcrit/markdown.js index 580ba5b5a..83828f967 100644 --- a/shared/naturalcrit/markdown.js +++ b/shared/naturalcrit/markdown.js @@ -31,7 +31,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,\-(). ]*"|[^"'{}\s])*\s*|}}/g; + const inlineRegex = /{{(?:="[\w,\-()#%. ]*"|[^"'{}\s])*\s*|}}/g; const match = completeSpan.exec(src); if(match) { //Find closing delimiter @@ -74,10 +74,10 @@ const mustacheSpans = { const mustacheDivs = { name : 'mustacheDivs', level : 'block', - start(src) { return src.match(/^ *{{[^{]/m)?.index; }, // Hint to Marked.js to stop and check for a match + 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 *}}/s; // Regex for the complete token - const blockRegex = /^ *{{(?:="[\w,\-(). ]*"|[^"'{}\s])*$|^ *}}$/gm; + const completeBlock = /^ *{{[^\s}]*\n.*\n *}}/s; // Regex for the complete token + const blockRegex = /^ *{{(?:="[\w,\-()#%. ]*"|[^"'{}\s])*$|^ *}}$/gm; const match = completeBlock.exec(src); if(match) { //Find closing delimiter @@ -121,7 +121,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,\-(). ]*"|[^"'{}\s])*)}/g; + const inlineRegex = /^ *{((?:="[\w,\-()#%. ]*"|[^"'{}\s])*)}/g; const match = inlineRegex.exec(src); if(match) { const lastToken = tokens[tokens.length - 1]; @@ -154,9 +154,9 @@ const mustacheInjectBlock = { extensions : [{ name : 'mustacheInjectBlock', level : 'block', - start(src) { return src.match(/^ *{[^{\n]/m)?.index; }, // Hint to Marked.js to stop and check for a match + 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,\-(). ]*"|[^"'{}\s])*)}/ym; + const inlineRegex = /^ *{((?:="[\w,\-()#%. ]*"|[^"'{}\s])*)}/ym; const match = inlineRegex.exec(src); if(match) { const lastToken = tokens[tokens.length - 1]; From 9be71a5159d0baf00b59fcad23ff9d55df7aff2e Mon Sep 17 00:00:00 2001 From: Trevor Buckner Date: Fri, 30 Jul 2021 02:08:08 -0400 Subject: [PATCH 14/30] Mustache syntax now uses : instead of =. Single words don't need quotes --- shared/naturalcrit/markdown.js | 16 +++++++++------- themes/5ePhb.style.less | 2 +- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/shared/naturalcrit/markdown.js b/shared/naturalcrit/markdown.js index 83828f967..d54adce00 100644 --- a/shared/naturalcrit/markdown.js +++ b/shared/naturalcrit/markdown.js @@ -31,7 +31,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,\-()#%. ]*"|[^"'{}\s])*\s*|}}/g; + const inlineRegex = /{{(?::(?:"[\w,\-()#%. ]*"|[\w\,\-()#%.]*)|[^"'{}\s])*\s*|}}/g; const match = completeSpan.exec(src); if(match) { //Find closing delimiter @@ -77,7 +77,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 = /^ *{{[^\s}]*\n.*\n *}}/s; // Regex for the complete token - const blockRegex = /^ *{{(?:="[\w,\-()#%. ]*"|[^"'{}\s])*$|^ *}}$/gm; + const blockRegex = /^ *{{(?::(?:"[\w,\-()#%. ]*"|[\w\,\-()#%.]*)|[^"'{}\s])*$|^ *}}$/gm; const match = completeBlock.exec(src); if(match) { //Find closing delimiter @@ -121,7 +121,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,\-()#%. ]*"|[^"'{}\s])*)}/g; + const inlineRegex = /^ *{((?::(?:"[\w,\-()#%. ]*"|[\w\,\-()#%.]*)|[^"'{}\s])*)}/g; const match = inlineRegex.exec(src); if(match) { const lastToken = tokens[tokens.length - 1]; @@ -156,7 +156,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,\-()#%. ]*"|[^"'{}\s])*)}/ym; + const inlineRegex = /^ *{((?::(?:"[\w,\-()#%. ]*"|[\w\,\-()#%.]*)|[^"'{}\s])*)}/ym; const match = inlineRegex.exec(src); if(match) { const lastToken = tokens[tokens.length - 1]; @@ -313,13 +313,15 @@ const tagRegex = new RegExp(`(${ }).join('|')})`, 'g'); const processStyleTags = (string)=>{ - const tags = string.match(/(?:[^, "=]+|="[^"]*")+/g); + //split tags up. quotes can only occur right after colons. + //TODO: can we simplify to just split on commas? + const tags = string.match(/(?:[^, ":]+|:(?:"[^"]*"|))+/g); if(!tags) return '"'; const id = _.remove(tags, (tag)=>tag.startsWith('#')).map((tag)=>tag.slice(1))[0]; - const classes = _.remove(tags, (tag)=>!tag.includes('"')); - const styles = tags.map((tag)=>tag.replace(/="(.*)"/g, ':$1;')); + const classes = _.remove(tags, (tag)=>!tag.includes(':')); + const styles = tags.map((tag)=>tag.replace(/:"?([^"]*)"?/g, ':$1;')); return `${classes.join(' ')}" ${id ? `id="${id}"` : ''} ${styles.length ? `style="${styles.join(' ')}"` : ''}`; }; diff --git a/themes/5ePhb.style.less b/themes/5ePhb.style.less index a1395554d..ac8fff139 100644 --- a/themes/5ePhb.style.less +++ b/themes/5ePhb.style.less @@ -602,7 +602,7 @@ body { break-inside : avoid; -webkit-transform : translateZ(0); //Prevents shadows from breaking across columns } - .inline { + .inline-block { display : inline-block; text-indent : initial; } From 98915e158de6465adfd5a0e978760ba78069a25d Mon Sep 17 00:00:00 2001 From: Trevor Buckner Date: Fri, 30 Jul 2021 02:11:26 -0400 Subject: [PATCH 15/30] Fix editor highlighting --- client/homebrew/editor/editor.jsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/client/homebrew/editor/editor.jsx b/client/homebrew/editor/editor.jsx index 12cb0aa37..91865ef4a 100644 --- a/client/homebrew/editor/editor.jsx +++ b/client/homebrew/editor/editor.jsx @@ -131,7 +131,7 @@ const Editor = createClass({ // Highlight inline spans {{content}} if(line.includes('{{') && line.includes('}}')){ - const regex = /{{(?:="[\w,\-. ]*"|[^"'\s])*\s*|}}/g; + const regex = /{{(?::(?:"[\w,\-()#%. ]*"|[\w\,\-()#%.]*)|[^"'{}\s])*\s*|}}/g; let match; let blockCount = 0; while ((match = regex.exec(line)) != null) { @@ -150,7 +150,7 @@ const Editor = createClass({ // Highlight block divs {{\n Content \n}} let endCh = line.length+1; - const match = line.match(/^ *{{(?:="[\w,\-. ]*"|[^"'\s])*$|^ *}}$/); + const match = line.match(/^ *{{(?::(?:"[\w,\-()#%. ]*"|[\w\,\-()#%.]*)|[^"'{}\s])*$|^ *}}$/); if(match) endCh = match.index+match[0].length; codeMirror.markText({ line: lineNumber, ch: 0 }, { line: lineNumber, ch: endCh }, { className: 'block' }); From 5b039b82a3c5f892f4e6dd9429d2746d321daadc Mon Sep 17 00:00:00 2001 From: Trevor Buckner Date: Fri, 30 Jul 2021 12:31:30 -0400 Subject: [PATCH 16/30] Update snippets --- client/homebrew/editor/editor.jsx | 2 +- .../editor/snippetbar/snippets/snippets.js | 15 +++++++-------- shared/naturalcrit/markdown.js | 4 ++-- 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/client/homebrew/editor/editor.jsx b/client/homebrew/editor/editor.jsx index 91865ef4a..ebfd74060 100644 --- a/client/homebrew/editor/editor.jsx +++ b/client/homebrew/editor/editor.jsx @@ -150,7 +150,7 @@ const Editor = createClass({ // Highlight block divs {{\n Content \n}} let endCh = line.length+1; - const match = line.match(/^ *{{(?::(?:"[\w,\-()#%. ]*"|[\w\,\-()#%.]*)|[^"'{}\s])*$|^ *}}$/); + const match = line.match(/^ *{{(?::(?:"[\w,\-()#%. ]*"|[\w\,\-()#%.]*)|[^"'{}\s])* *$|^ *}}$/); if(match) endCh = match.index+match[0].length; codeMirror.markText({ line: lineNumber, ch: 0 }, { line: lineNumber, ch: endCh }, { className: 'block' }); diff --git a/client/homebrew/editor/snippetbar/snippets/snippets.js b/client/homebrew/editor/snippetbar/snippets/snippets.js index 9abedcf28..e61289b6b 100644 --- a/client/homebrew/editor/snippetbar/snippets/snippets.js +++ b/client/homebrew/editor/snippetbar/snippets/snippets.js @@ -33,7 +33,7 @@ module.exports = [ { name : 'Horizontal Spacing', icon : 'fas fa-arrows-alt-h', - gen : ' {{width="100px"}} ' + gen : ' {{width:100px}} ' }, { name : 'Wide Block', @@ -51,23 +51,22 @@ module.exports = [ name : 'Image', icon : 'fas fa-image', gen : dedent` - ![cat warrior](https://s-media-cache-ak0.pinimg.com/736x/4a/81/79/4a8179462cfdf39054a418efd4cb743e.jpg) {width="325px"} + ![cat warrior](https://s-media-cache-ak0.pinimg.com/736x/4a/81/79/4a8179462cfdf39054a418efd4cb743e.jpg) {width:325px} Credit: Kyounghwan Kim` }, { name : 'Background Image', icon : 'fas fa-tree', - gen : `![homebrew mug](http://i.imgur.com/hMna6G0.png) {position="absolute",top="50px",right="30px",width="280px"}` + gen : `![homebrew mug](http://i.imgur.com/hMna6G0.png) {position:absolute,top:50px,right:30px,width:280px}` }, { name : 'QR Code', icon : 'fas fa-qrcode', gen : (brew)=>{ - return ``; + `&size=100x100) {width:100px;mix-blend-mode:multiply}`; } }, @@ -257,7 +256,7 @@ module.exports = [ gen : function(){ return dedent` ##### Typical Difficulty Classes - {{column-count="2" + {{column-count:2 | Task Difficulty | DC | |:----------------|:--:| | Very easy | 5 | diff --git a/shared/naturalcrit/markdown.js b/shared/naturalcrit/markdown.js index d54adce00..1d360751b 100644 --- a/shared/naturalcrit/markdown.js +++ b/shared/naturalcrit/markdown.js @@ -76,8 +76,8 @@ const mustacheDivs = { level : 'block', start(src) { return src.match(/\n *{{[^{]/m)?.index; }, // Hint to Marked.js to stop and check for a match tokenizer(src, tokens) { - const completeBlock = /^ *{{[^\s}]*\n.*\n *}}/s; // Regex for the complete token - const blockRegex = /^ *{{(?::(?:"[\w,\-()#%. ]*"|[\w\,\-()#%.]*)|[^"'{}\s])*$|^ *}}$/gm; + const completeBlock = /^ *{{[^\s}]* *\n.*\n *}}/s; // Regex for the complete token + const blockRegex = /^ *{{(?::(?:"[\w,\-()#%. ]*"|[\w\,\-()#%.]*)|[^"'{}\s])* *$|^ *}}$/gm; const match = completeBlock.exec(src); if(match) { //Find closing delimiter From ebd28f41a2f2eb35ba6ba3e85e9f7b65e6458758 Mon Sep 17 00:00:00 2001 From: Trevor Buckner Date: Fri, 30 Jul 2021 17:29:36 -0400 Subject: [PATCH 17/30] replace :- with just - --- server.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server.js b/server.js index 3b9ff6b04..f16418828 100644 --- a/server.js +++ b/server.js @@ -170,7 +170,7 @@ app.get('/edit/:id', asyncHandler(async (req, res, next)=>{ //New Page app.get('/new/:id', asyncHandler(async (req, res, next)=>{ const brew = await getBrewFromId(req.params.id, 'share'); - brew.title = `CLONE:- ${brew.title}`; + brew.title = `CLONE - ${brew.title}`; req.brew = brew; return next(); })); From 99d2f6d48d71707945a1bcb86e42fa6b91e8c58c Mon Sep 17 00:00:00 2001 From: Trevor Buckner Date: Fri, 30 Jul 2021 17:47:11 -0400 Subject: [PATCH 18/30] avoid sending two copies of welcome text in the same brew --- client/homebrew/pages/homePage/homePage.jsx | 8 ++++---- server.js | 3 +-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/client/homebrew/pages/homePage/homePage.jsx b/client/homebrew/pages/homePage/homePage.jsx index c89f6c95b..b8ee5634b 100644 --- a/client/homebrew/pages/homePage/homePage.jsx +++ b/client/homebrew/pages/homePage/homePage.jsx @@ -23,15 +23,15 @@ const HomePage = createClass({ getDefaultProps : function() { return { brew : { - text : '', - welcomeText : '' + text : '', }, ver : '0.0.0' }; }, getInitialState : function() { return { - brew : this.props.brew + brew : this.props.brew, + welcomeText : this.props.brew.text }; }, handleSave : function(){ @@ -85,7 +85,7 @@ const HomePage = createClass({ -
+
Save current
diff --git a/server.js b/server.js index 88019de4b..648a08cd1 100644 --- a/server.js +++ b/server.js @@ -108,8 +108,7 @@ app.get('/robots.txt', (req, res)=>{ //Home page app.get('/', async (req, res, next)=>{ const brew = { - text : welcomeText, - welcomeText : welcomeText + text : welcomeText }; req.brew = brew; return next(); From 33abe05737f8d31be421be42599cea81de98d5d6 Mon Sep 17 00:00:00 2001 From: Gazook89 <58999374+Gazook89@users.noreply.github.com> Date: Thu, 29 Jul 2021 17:47:29 -0500 Subject: [PATCH 19/30] Create userPage3D.css --- client/homebrew/pages/userPage/userPage3D.css | 80 +++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 client/homebrew/pages/userPage/userPage3D.css diff --git a/client/homebrew/pages/userPage/userPage3D.css b/client/homebrew/pages/userPage/userPage3D.css new file mode 100644 index 000000000..f7809d868 --- /dev/null +++ b/client/homebrew/pages/userPage/userPage3D.css @@ -0,0 +1,80 @@ + +.phb { + background:transparent; + width:100%; +} + +.phb > div > h1 { + color:white; + background:linear-gradient(150deg, red, orange); + margin:10px; + border-radius:5px; + border:1px outset black; + filter:drop-shadow(3px 3px 8px black); + padding:10px; + font-family:codebold; + font-size: .705cm; +} + +.phb > div:nth-child(2) > h1 { + background:linear-gradient(150deg, blue, purple); +} + +.phb > div { + display: flex; + flex-wrap: wrap; + justify-content:center; + padding:20px; + gap:15px; + border:6px solid #333333; + border-radius:10px; + margin-bottom:20px; +} + +.phb div:first-child h1 { + flex: 1 0 100%; + margin:0 0 10px 0; +} + +.phb div:nth-child(2) h1 { + flex: 1 0 100%; +} + +.phb .brewItem { + background:linear-gradient(150deg, red, orange); + flex: 1 1 content; + margin:unset; + height: 150px; + border:1px outset black; + filter:drop-shadow(3px 3px 8px black); + color:white; + display:flex; + flex-direction:column; +} + +.phb div:nth-child(2) .brewItem { + background:linear-gradient(150deg, blue, purple); +} + +.phb .brewItem h2 { + font-family:CodeBold; + color:white; + /* width:max(90%,300px); */ + flex:0 0 auto; +} + +.phb .brewItem .description { + /* width:clamp(200px,100%,300px); */ + flex:1 1 auto; +} + +.phb .brewItem .info { + all:unset; + /* width:clamp(200px,100%,300px); */ + flex:0 0 20px; + opacity:30% +} + +.phb .brewItem:hover .info { + opacity:unset; +} From cb74c0d38948a2a3245f9e1374be903909bd5e7f Mon Sep 17 00:00:00 2001 From: Gazook89 <58999374+Gazook89@users.noreply.github.com> Date: Thu, 29 Jul 2021 17:59:55 -0500 Subject: [PATCH 20/30] Update userPage3D.css --- client/homebrew/pages/userPage/userPage3D.css | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/client/homebrew/pages/userPage/userPage3D.css b/client/homebrew/pages/userPage/userPage3D.css index f7809d868..291c9fe70 100644 --- a/client/homebrew/pages/userPage/userPage3D.css +++ b/client/homebrew/pages/userPage/userPage3D.css @@ -26,9 +26,6 @@ justify-content:center; padding:20px; gap:15px; - border:6px solid #333333; - border-radius:10px; - margin-bottom:20px; } .phb div:first-child h1 { @@ -52,6 +49,10 @@ flex-direction:column; } +.phb .brewItem:active { + transform:scale(.99); +} + .phb div:nth-child(2) .brewItem { background:linear-gradient(150deg, blue, purple); } From 56975f93756e1d1ba656b1d3bacd3b2c41352fa7 Mon Sep 17 00:00:00 2001 From: Gazook89 <58999374+Gazook89@users.noreply.github.com> Date: Thu, 29 Jul 2021 19:15:09 -0500 Subject: [PATCH 21/30] Delete userPage3D.css --- client/homebrew/pages/userPage/userPage3D.css | 81 ------------------- 1 file changed, 81 deletions(-) delete mode 100644 client/homebrew/pages/userPage/userPage3D.css diff --git a/client/homebrew/pages/userPage/userPage3D.css b/client/homebrew/pages/userPage/userPage3D.css deleted file mode 100644 index 291c9fe70..000000000 --- a/client/homebrew/pages/userPage/userPage3D.css +++ /dev/null @@ -1,81 +0,0 @@ - -.phb { - background:transparent; - width:100%; -} - -.phb > div > h1 { - color:white; - background:linear-gradient(150deg, red, orange); - margin:10px; - border-radius:5px; - border:1px outset black; - filter:drop-shadow(3px 3px 8px black); - padding:10px; - font-family:codebold; - font-size: .705cm; -} - -.phb > div:nth-child(2) > h1 { - background:linear-gradient(150deg, blue, purple); -} - -.phb > div { - display: flex; - flex-wrap: wrap; - justify-content:center; - padding:20px; - gap:15px; -} - -.phb div:first-child h1 { - flex: 1 0 100%; - margin:0 0 10px 0; -} - -.phb div:nth-child(2) h1 { - flex: 1 0 100%; -} - -.phb .brewItem { - background:linear-gradient(150deg, red, orange); - flex: 1 1 content; - margin:unset; - height: 150px; - border:1px outset black; - filter:drop-shadow(3px 3px 8px black); - color:white; - display:flex; - flex-direction:column; -} - -.phb .brewItem:active { - transform:scale(.99); -} - -.phb div:nth-child(2) .brewItem { - background:linear-gradient(150deg, blue, purple); -} - -.phb .brewItem h2 { - font-family:CodeBold; - color:white; - /* width:max(90%,300px); */ - flex:0 0 auto; -} - -.phb .brewItem .description { - /* width:clamp(200px,100%,300px); */ - flex:1 1 auto; -} - -.phb .brewItem .info { - all:unset; - /* width:clamp(200px,100%,300px); */ - flex:0 0 20px; - opacity:30% -} - -.phb .brewItem:hover .info { - opacity:unset; -} From fdb294bad96072bebb00dbb0250031f2baf63ed3 Mon Sep 17 00:00:00 2001 From: Gazook89 <58999374+Gazook89@users.noreply.github.com> Date: Thu, 29 Jul 2021 20:36:58 -0500 Subject: [PATCH 22/30] Update to v3 moustache syntax - Added moustache syntax - replaced class `wide` with `full` so that new styling is applied, including adding a "spell slots per spell level" header for only full class tables. - included a quick-change css variable to the snippet to control row color. **can be updated to use hex code or whichever is preferred for the snippet** --- .../homebrew/editor/snippetbar/snippets/classtable.gen.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/client/homebrew/editor/snippetbar/snippets/classtable.gen.js b/client/homebrew/editor/snippetbar/snippets/classtable.gen.js index 867aa625e..c375c1fa7 100644 --- a/client/homebrew/editor/snippetbar/snippets/classtable.gen.js +++ b/client/homebrew/editor/snippetbar/snippets/classtable.gen.js @@ -70,7 +70,7 @@ module.exports = { let cantrips = 3; let spells = 1; let slots = 2; - return `
\n##### The ${classname}\n` + + return `{{classTable,full,--row-color="rgba(250,0,0,.2)"\n##### The ${classname}\n` + `| Level | Proficiency Bonus | Features | Cantrips Known | Spells Known | 1st | 2nd | 3rd | 4th | 5th | 6th | 7th | 8th | 9th |\n`+ `|:---:|:---:|:---|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|\n${ _.map(levels, function(levelName, level){ @@ -88,14 +88,14 @@ module.exports = { slots += _.random(0, 2); return `| ${res} |`; - }).join('\n')}\n
\n\n`; + }).join('\n')}\n}}\n\n`; }, half : function(){ const classname = _.sample(classnames); let featureScore = 1; - return `
\n##### The ${classname}\n` + + return `{{classTable,--row-color="rgba(250,0,0,.2)"\n##### The ${classname}\n` + `| Level | Proficiency Bonus | Features | ${_.sample(features)}|\n` + `|:---:|:---:|:---|:---:|\n${ _.map(levels, function(levelName, level){ @@ -109,6 +109,6 @@ module.exports = { featureScore += _.random(0, 1); return `| ${res} |`; - }).join('\n')}\n
\n\n`; + }).join('\n')}\n}}\n\n`; } }; From 3c2feeb2aa6aad0cff3bc2eeb155e1d752013e73 Mon Sep 17 00:00:00 2001 From: Gazook89 <58999374+Gazook89@users.noreply.github.com> Date: Thu, 29 Jul 2021 20:52:23 -0500 Subject: [PATCH 23/30] Update css for classTables v3 - add "- spell slots per spell level -" header to full class tables - add rules for `.classTables.full` which is similar to `wide` but adds the previously mentioned header as well. - add css variable `--row-color` so the odd row colors can be set in the inline moustache syntax easily. --- themes/5ePhb.style.less | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/themes/5ePhb.style.less b/themes/5ePhb.style.less index ac8fff139..1112ab769 100644 --- a/themes/5ePhb.style.less +++ b/themes/5ePhb.style.less @@ -526,7 +526,25 @@ body { h5{ margin-bottom : 10px; } + &.full{ + column-span : all; + --row-color : ; + &:after{ + content : '— Spell Slots per Spell Level —'; + font-weight : bold; + font-family : ScalySans; + position : absolute; + top : 20px; + right : 43px; + } + } + tbody tr:nth-child(odd) { + background : var(--row-color); + } } + + + //***************************** // * TABLE OF CONTENTS // *****************************/ From f469a7e36038fdcdc00ac292b5c27153db00a02b Mon Sep 17 00:00:00 2001 From: Gazook89 <58999374+Gazook89@users.noreply.github.com> Date: Thu, 29 Jul 2021 21:42:14 -0500 Subject: [PATCH 24/30] Update page number snippet in snippet.js --- client/homebrew/editor/snippetbar/snippets/snippets.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/client/homebrew/editor/snippetbar/snippets/snippets.js b/client/homebrew/editor/snippetbar/snippets/snippets.js index e61289b6b..2ac8c7ea0 100644 --- a/client/homebrew/editor/snippetbar/snippets/snippets.js +++ b/client/homebrew/editor/snippetbar/snippets/snippets.js @@ -73,12 +73,12 @@ module.exports = [ { name : 'Page Number', icon : 'fas fa-bookmark', - gen : '{{pageNumber\n1\n}}\n{{footnote\nPART 1 | FANCINESS\n}}\n\n' + gen : '{{pageNumber 1}}\n{{footnote PART 1 | SECTION NAME}}\n\n' }, { name : 'Auto-incrementing Page Number', icon : 'fas fa-sort-numeric-down', - gen : '{{pageNumber,auto\n}}\n\n' + gen : '{{pageNumber,auto}}\n{{footnote PART 1 | SECTION NAME}}\n\n' }, { name : 'Link to page', From ce73e9293d98e1fe977a8dc8e0b2968cec26b428 Mon Sep 17 00:00:00 2001 From: Trevor Buckner Date: Fri, 30 Jul 2021 20:33:24 -0400 Subject: [PATCH 25/30] Revert "Update to v3 moustache syntax" This reverts commit fdb294bad96072bebb00dbb0250031f2baf63ed3. --- .../homebrew/editor/snippetbar/snippets/classtable.gen.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/client/homebrew/editor/snippetbar/snippets/classtable.gen.js b/client/homebrew/editor/snippetbar/snippets/classtable.gen.js index c375c1fa7..867aa625e 100644 --- a/client/homebrew/editor/snippetbar/snippets/classtable.gen.js +++ b/client/homebrew/editor/snippetbar/snippets/classtable.gen.js @@ -70,7 +70,7 @@ module.exports = { let cantrips = 3; let spells = 1; let slots = 2; - return `{{classTable,full,--row-color="rgba(250,0,0,.2)"\n##### The ${classname}\n` + + return `
\n##### The ${classname}\n` + `| Level | Proficiency Bonus | Features | Cantrips Known | Spells Known | 1st | 2nd | 3rd | 4th | 5th | 6th | 7th | 8th | 9th |\n`+ `|:---:|:---:|:---|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|\n${ _.map(levels, function(levelName, level){ @@ -88,14 +88,14 @@ module.exports = { slots += _.random(0, 2); return `| ${res} |`; - }).join('\n')}\n}}\n\n`; + }).join('\n')}\n
\n\n`; }, half : function(){ const classname = _.sample(classnames); let featureScore = 1; - return `{{classTable,--row-color="rgba(250,0,0,.2)"\n##### The ${classname}\n` + + return `
\n##### The ${classname}\n` + `| Level | Proficiency Bonus | Features | ${_.sample(features)}|\n` + `|:---:|:---:|:---|:---:|\n${ _.map(levels, function(levelName, level){ @@ -109,6 +109,6 @@ module.exports = { featureScore += _.random(0, 1); return `| ${res} |`; - }).join('\n')}\n}}\n\n`; + }).join('\n')}\n
\n\n`; } }; From 2a40f05e90e3b40881ef55fb78852bb8891a3c30 Mon Sep 17 00:00:00 2001 From: Trevor Buckner Date: Fri, 30 Jul 2021 20:33:34 -0400 Subject: [PATCH 26/30] Revert "Update css for classTables v3" This reverts commit 3c2feeb2aa6aad0cff3bc2eeb155e1d752013e73. --- themes/5ePhb.style.less | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/themes/5ePhb.style.less b/themes/5ePhb.style.less index 1112ab769..ac8fff139 100644 --- a/themes/5ePhb.style.less +++ b/themes/5ePhb.style.less @@ -526,25 +526,7 @@ body { h5{ margin-bottom : 10px; } - &.full{ - column-span : all; - --row-color : ; - &:after{ - content : '— Spell Slots per Spell Level —'; - font-weight : bold; - font-family : ScalySans; - position : absolute; - top : 20px; - right : 43px; - } - } - tbody tr:nth-child(odd) { - background : var(--row-color); - } } - - - //***************************** // * TABLE OF CONTENTS // *****************************/ From 8a03062e3ddd98f8532934cd3a1945d1e0c26cea Mon Sep 17 00:00:00 2001 From: Trevor Buckner Date: Fri, 30 Jul 2021 22:32:17 -0400 Subject: [PATCH 27/30] Fix indent and vertical spacing --- themes/5ePhb.style.less | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/themes/5ePhb.style.less b/themes/5ePhb.style.less index ac8fff139..a5a3b6aa5 100644 --- a/themes/5ePhb.style.less +++ b/themes/5ePhb.style.less @@ -385,13 +385,14 @@ body { } } .pageNumber{ - position : absolute; - right : 2px; - bottom : 22px; - width : 50px; - font-size : 0.9em; - color : #c9ad6a; - text-align : center; + position : absolute; + right : 2px; + bottom : 22px; + width : 50px; + font-size : 0.9em; + color : #c9ad6a; + text-align : center; + text-indent : 0; &.auto::after { content : counter(phb-page-numbers); } @@ -605,6 +606,7 @@ body { .inline-block { display : inline-block; text-indent : initial; + line-height : 1.3em; } div { column-gap : 0.5cm; //Default spacing if a div uses multicolumns From 213ef9d94b625b05e4fb6192122c2deb30c4ec01 Mon Sep 17 00:00:00 2001 From: Trevor Buckner Date: Fri, 30 Jul 2021 22:44:00 -0400 Subject: [PATCH 28/30] Fix cursor getting stuck on divider in Meta panel view --- 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 ebfd74060..d43ae7c61 100644 --- a/client/homebrew/editor/editor.jsx +++ b/client/homebrew/editor/editor.jsx @@ -170,7 +170,7 @@ const Editor = createClass({ //Called when there are changes to the editor's dimensions update : function(){ - this.refs.codeEditor.updateSize(); + this.refs.codeEditor?.updateSize(); }, renderEditor : function(){ From 3cb50bc7fcdb71843dc37cac1b481198d859d0bb Mon Sep 17 00:00:00 2001 From: Trevor Buckner Date: Fri, 30 Jul 2021 23:30:34 -0400 Subject: [PATCH 29/30] up version to 2.13.2 --- changelog.md | 33 ++++++++++++++++++++++----------- package-lock.json | 4 ++-- package.json | 2 +- 3 files changed, 25 insertions(+), 14 deletions(-) diff --git a/changelog.md b/changelog.md index 1cd0cd028..ea0cb7993 100644 --- a/changelog.md +++ b/changelog.md @@ -6,6 +6,19 @@ h5 { # changelog +### Friday, 30/07/2021 - v2.13.2 + +- Background work to allow new themes in the future +- Fixed cursor getting stuck when resizing divider bar + +##### G-Ambatte : +- Fix Style tab not copying when Cloned To New +- Basic brew sorting on User page +- Reduced data sent on each request from server + +##### Gazook89 : +- Cleaned up styling on menus + ### Saturday, 28/6/2021 - v2.13.1 - Fixed the issue with new brews not saving! @@ -44,6 +57,9 @@ myStyle {color: black} ##### G-Ambatte : - Snippet to remove drop caps (fancy first letter after title) +``` +``` + ### Saturday, 13/3/2021 - v2.11.0 - Many background things for upcoming v3. Get pumped. @@ -87,6 +103,8 @@ myStyle {color: black} - Fixed issue with users unable to create new brews - Fixing brews being lost when loaded via back button +\page + ### Wednesday, 07/10/2020 - v2.10.0 - Google Drive integration -- Sign in with your Google account to link it with your Homebrewery profile. A new button in the Edit page will let you transfer your file to your personal Google Drive storage, and Google will keep a backup of each version! No more lost work surprises! @@ -100,13 +118,6 @@ myStyle {color: black} ### Wednesday, 20/05/2020 - v2.9.0 - Major refactoring of site backend to work with updated dependencies for security (should be invisible to users) - - - - - -\page - ### Wednesday, 11/03/2020 - v2.8.2 - Fixed delete button removing everyone's copy for brews with multiple authors - Compressed homebrew text in database @@ -180,6 +191,8 @@ myStyle {color: black} - Added a hover tooltip to fully read the brew description - Made the brew items take up only 25% allowing you to view more per row. +\page + ### Wednesday, 23/11/2016 - v2.5.0 - Metadata can now be added to brews - Added a metadata editor onto the edit and new pages @@ -195,8 +208,6 @@ myStyle {color: black} - You can now print from a new page without saving - Added the ability to use ctrl+p and ctrl+s to print and save respectively. -\page - ### Monday, 07/11/2016 - Added final touches to the html validator and updating the rest of the branch - If anyone finds issues with the new HTML validator, please let me know. I hope this will bring a more consistent feel to Homebrewery rendering. @@ -253,6 +264,8 @@ myStyle {color: black} ### Wednesday, 25/05/2016 -v2.0.5 - The class table generators have the proper ability score improvement progression. +\page + ### Tuesday, 24/05/2016 - v2.0.4 - Fixed extra wide monster stat blocks sometimes only being one column - The class table generators now follow the proper progression from the PHB (thakns u/IrishBandit) @@ -263,8 +276,6 @@ myStyle {color: black} - Bumped up the allowed entity size for extra-large brew (Thanks for reporting it dickboner93) - Added a little error box when a save fails with a custom link to reporting the issue on github. -\page - ### Saturday, 14/05/2016 - v2.0.0 (finally!) I've been working on v2 for a *very* long time. I want to thank you guys for being paitent. diff --git a/package-lock.json b/package-lock.json index 31e336cb7..4cb47f5c0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,11 +1,11 @@ { "name": "homebrewery", - "version": "2.13.1", + "version": "2.13.2", "lockfileVersion": 2, "requires": true, "packages": { "": { - "version": "2.13.1", + "version": "2.13.2", "hasInstallScript": true, "license": "MIT", "dependencies": { diff --git a/package.json b/package.json index a363b6db8..b002c1965 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "homebrewery", "description": "Create authentic looking D&D homebrews using only markdown", - "version": "2.13.1", + "version": "2.13.2", "engines": { "node": "14.15.x" }, From 4d087f4aa929fc2d1ee5da5103dbb3c6363e7421 Mon Sep 17 00:00:00 2001 From: Trevor Buckner Date: Sun, 1 Aug 2021 00:20:58 -0400 Subject: [PATCH 30/30] Fix spaces not working in mustache divs / spans --- shared/naturalcrit/markdown.js | 34 +++++++++++++++++++++------------- 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/shared/naturalcrit/markdown.js b/shared/naturalcrit/markdown.js index 1d360751b..9ae71214a 100644 --- a/shared/naturalcrit/markdown.js +++ b/shared/naturalcrit/markdown.js @@ -37,24 +37,28 @@ const mustacheSpans = { //Find closing delimiter let blockCount = 0; let tags = ''; - let endIndex = 0; + let endTags = 0; + let endToken = 0; let delim; while (delim = inlineRegex.exec(match[0])) { + if(!tags) { + tags = ` ${processStyleTags(delim[0].substring(2))}`; + endTags = delim[0].length; + } if(delim[0].startsWith('{{')) { - tags = tags || ` ${processStyleTags(delim[0].substring(2))}`; blockCount++; } else if(delim[0] == '}}' && blockCount !== 0) { blockCount--; if(blockCount == 0) { - endIndex = inlineRegex.lastIndex; + endToken = inlineRegex.lastIndex; break; } } } - if(endIndex) { - const raw = src.slice(0, endIndex); - const text = raw.slice((raw.indexOf(' ')+1) || -2, -2); + if(endToken) { + const raw = src.slice(0, endToken); + const text = raw.slice(endTags || -2, -2); return { // Token to generate type : 'mustacheSpans', // Should match "name" above @@ -76,31 +80,35 @@ const mustacheDivs = { level : 'block', start(src) { return src.match(/\n *{{[^{]/m)?.index; }, // Hint to Marked.js to stop and check for a match tokenizer(src, tokens) { - const completeBlock = /^ *{{[^\s}]* *\n.*\n *}}/s; // Regex for the complete token + const completeBlock = /^ *{{[^\n}]* *\n.*\n *}}/s; // Regex for the complete token const blockRegex = /^ *{{(?::(?:"[\w,\-()#%. ]*"|[\w\,\-()#%.]*)|[^"'{}\s])* *$|^ *}}$/gm; const match = completeBlock.exec(src); if(match) { //Find closing delimiter let blockCount = 0; let tags = ''; - let endIndex = 0; + let endTags = 0; + let endToken = 0; let delim; while (delim = blockRegex.exec(match[0])?.[0].trim()) { + if(!tags) { + tags = ` ${processStyleTags(delim.substring(2))}`; + endTags = delim.length; + } if(delim.startsWith('{{')) { - tags = tags || ` ${processStyleTags(delim.substring(2))}`; blockCount++; } else if(delim == '}}' && blockCount !== 0) { blockCount--; if(blockCount == 0) { - endIndex = blockRegex.lastIndex; + endToken = blockRegex.lastIndex; break; } } } - if(endIndex) { - const raw = src.slice(0, endIndex); - const text = raw.slice((raw.indexOf('\n')+1) || -2, -2); + if(endToken) { + const raw = src.slice(0, endToken); + const text = raw.slice(endTags || -2, -2); return { // Token to generate type : 'mustacheDivs', // Should match "name" above raw : raw, // Text to consume from the source