From 13944d3a7601d2fde433339551171e76e9376a78 Mon Sep 17 00:00:00 2001 From: Victor Losada Hernandez Date: Sat, 15 Apr 2023 21:41:44 +0200 Subject: [PATCH 001/123] Log out question removed --- faq.md | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/faq.md b/faq.md index 1889b09e4..223a7c13d 100644 --- a/faq.md +++ b/faq.md @@ -62,16 +62,13 @@ pre { ``` # FAQ -{{wide Updated Oct. 11, 2021}} +{{wide Updated Apr. 15, 2023}} ### The site is down for me! Anyone else? You can check the site status here: [Everyone or Just Me](https://downforeveryoneorjustme.com/homebrewery.naturalcrit.com) -### How do I log out? - -Go to https://homebrewery.naturalcrit.com/login, and hit the "*logout*" link. ### Why am I getting an error when trying to save, and my account is linked to Google? From 40afdf18d6282dab3db149e065d469f5bf45224d Mon Sep 17 00:00:00 2001 From: Victor Losada Hernandez Date: Sat, 15 Apr 2023 22:01:00 +0200 Subject: [PATCH 002/123] editor width bug q removed --- faq.md | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/faq.md b/faq.md index 223a7c13d..72e6a7d1f 100644 --- a/faq.md +++ b/faq.md @@ -117,26 +117,6 @@ The fonts used were originally created for use with the English language, though ### Whenever I click on the "Get PDF" button, instead of getting a download, it opens Print Preview in another tab. Yes, this is by design. In the print preview, select "Save as PDF" as the Destination, and then click "Save". There will be a normal download dialog where you can save your brew as a PDF. -### The preview window is suddenly gone, I can only see the editor side of the Homebrewery (or the other way around). - -1. Press `CTRL`+`SHIFT`+`i` (or right-click and select "Inspect") while in the Homebrewery. - -2. Expand... -``` - - `body` - - `main` - - `div class="homebrew"` - - `div class="editPage page"` - - `div class="content"` - - `div class="splitPane"` -``` - -There you will find 3 divs: `div class="pane" [...]`, `div class="divider" [...]`, and `div class="pane" [...]`. - -The `class="pane"` looks similar to this: `div class="pane" data-reactid="36" style="flex: 0 0 auto; width: 925px;"`. - -Change whatever stands behind width: to something smaller than your display width. - ### I have white borders on the bottom/sides of the print preview. The Homebrewery paper size and your print paper size do not match. From 2d4a3ec910b94aaeb663ec50f9883acfab669e99 Mon Sep 17 00:00:00 2001 From: Victor Losada Hernandez Date: Sat, 22 Apr 2023 15:30:22 +0200 Subject: [PATCH 003/123] landing page update --- client/homebrew/pages/homePage/welcome_msg.md | 65 ++++++++++--------- 1 file changed, 35 insertions(+), 30 deletions(-) diff --git a/client/homebrew/pages/homePage/welcome_msg.md b/client/homebrew/pages/homePage/welcome_msg.md index 3332dfc39..f8721c5cb 100644 --- a/client/homebrew/pages/homePage/welcome_msg.md +++ b/client/homebrew/pages/homePage/welcome_msg.md @@ -6,7 +6,6 @@ padding-bottom : 1.1cm; } ``` - # The Homebrewery *V3* Welcome traveler from an antique land. Please sit and tell us of what you have seen. The unheard of monsters, who slither and bite. Tell us of the wondrous items and and artifacts you have found, their mysteries yet to be unlocked. Of the vexing vocations and surprising skills you have seen. @@ -18,7 +17,7 @@ The Homebrewery makes the creation and sharing of authentic looking Fifth-Editio ### Editing and Sharing When you create your own homebrew, you will be given a *edit url* and a *share url*. -Any changes you make while on the *edit url* will be automatically saved to the database within a few seconds. Anyone with the edit url will be able to make edits to your homebrew, so be careful about who you share it with. +Any changes you make while on the *edit url* will be automatically saved to the database within a few seconds. No one can edit your brew even if you share the edit link, unless you add them as an author via the {{fa,fa-info-circle}} **Properties** tab. Anyone with the *share url* will be able to access a read-only version of your homebrew. @@ -48,57 +47,62 @@ If you want to save ink or have a monochrome printer, add the **PRINT → {{fas, \column -## New in V3.0.0 -We've implemented an extended Markdown-like syntax for block and span elements, plus a few other changes, eliminating the need for HTML tags like `div` and `span` in most cases. No raw HTML tags should be needed in a brew (*but can still be used if you insist*). +## V3 vs Legacy +The Homebrewery has two renderers: Legacy and V3. The V3 renderer is recommended and will receive updates, while the Legacy renderer will not. Legacy mode is still available for older brews and veteran users, but won't be updated. +: +V3 uses curly brackets instead of HTML tags, though HTML tags can still be used. Converting between Legacy and V3 may require tweaking the document. However, all legacy brews will still render normally. Both renderers can be accessed via the {{fa,fa-info-circle}} **Properties** button on your brew at any time. -Much of the syntax and styling has changed in V3, so converting a Legacy brew to V3 (or vice-versa) will require tweaking your document. *However*, all brews made prior to the release of v3.0.0 will still render normally, and you may switch between the "Legacy" brew renderer and the newer "V3" renderer via the {{fa,fa-info-circle}} **Properties** button on your brew at any time. - -Scroll down to the next page for a brief summary of the changes and new features available in V3! +Scroll down to the next page for a brief summary of the changes and features available in V3! #### New Things All The Time! Check out the latest updates in the full changelog [here](/changelog). ### Helping out -Like this tool? Want to buy me a beer? [Head here](https://www.patreon.com/Naturalcrit) to help me keep the servers running. +Like this tool? Want to buy us a beer? [Head here](https://www.patreon.com/Naturalcrit) to help us keep the servers running. -This tool will **always** be free, never have ads, and I will never offer any "premium" features or whatever. +This tool will **always** be free, never have ads, and we will never offer any "premium" features or whatever. ### Bugs, Issues, Suggestions? -Take a quick look at our [Frequently Asked Questions page](/faq) to see if your question has a handy answer. - -Need help getting started or just the right look for your brew? Head to [r/Homebrewery](https://www.reddit.com/r/homebrewery/submit?selftext=true&title=%5BIssue%5D%20Describe%20Your%20Issue%20Here) and let us know! - -Have an idea to make The Homebrewery better? Or did you find something that wasn't quite right? Check out the [GitHub Repo](https://github.com/naturalcrit/homebrewery/) to report technical issues. +- Check the [Frequently Asked Questions](/faq) page first for quick answers. +- Get help or the right look for your brew by posting on [r/Homebrewery](https://www.reddit.com/r/homebrewery/submit?selftext=true&title=%5BIssue%5D%20Describe%20Your%20Issue%20Here) or joining the [Discord Of Many Things](https://discord.gg/by3deKx). +- Report technical issues or provide feedback on the [GitHub Repo](https://github.com/naturalcrit/homebrewery/). ### Legal Junk The Homebrewery is licensed using the [MIT License](https://github.com/naturalcrit/homebrewery/blob/master/license). Which means you are free to use The Homebrewery codebase any way that you want, except for claiming that you made it yourself. If you wish to sell or in some way gain profit for what's created on this site, it's your responsibility to ensure you have the proper licenses/rights for any images or resources used. - -#### Crediting Me -If you'd like to credit me in your brew, I'd be flattered! Just reference that you made it with The Homebrewery. +#### Crediting Us +If you'd like to credit us in your brew, we'd be flattered! Just reference that you made it with The Homebrewery. ### More Homebrew Resources -Discord of Many Things Logo -If you are looking for more 5e Homebrew resources check out [r/UnearthedArcana](https://www.reddit.com/r/UnearthedArcana/) and their list of useful resources [here](https://www.reddit.com/r/UnearthedArcana/wiki/resources). The Discord of Many Things is another great resource to connect with fellow homebrewers for help and feedback. +[![Discord](/assets/discordOfManyThings.svg){width:50px,float:right,padding-left:10px}](https://discord.gg/by3deKx) + +If you are looking for more 5e Homebrew resources check out [r/UnearthedArcana](https://www.reddit.com/r/UnearthedArcana/) and their list of useful resources [here](https://www.reddit.com/r/UnearthedArcana/wiki/resources). The [Discord Of Many Things](https://discord.gg/by3deKx) is another great resource to connect with fellow homebrewers for help and feedback. + {{position:absolute;top:20px;right:20px;width:auto - - - - +[![Discord](/assets/discord.png){height:30px}](https://discord.gg/by3deKx) +[![Github](/assets/github.png){height:30px}](https://github.com/naturalcrit/homebrewery) +[![Patreon](/assets/patreon.png){height:30px}](https://patreon.com/NaturalCrit) +[![Reddit](/assets/reddit.png){height:30px}](https://www.reddit.com/r/homebrewery/) }} \page + + + + + + + ## Markdown+ The Homebrewery aims to make homebrewing as simple as possible, providing a live editor with Markdown syntax that is more human-readable and faster to write with than raw HTML. -In version 3.0.0, with a goal of adding maximum flexibility without users resorting to complex HTML to accomplish simple tasks, Homebrewery provides an extended verision of Markdown with additional syntax. -**You can enable V3 via the {{fa,fa-info-circle}} Properties button!** +From version 3.0.0, with a goal of adding maximum flexibility without users resorting to complex HTML to accomplish simple tasks, Homebrewery provides an extended verision of Markdown with additional syntax. ### Curly Brackets -The biggest change in V3 is the replacement of `` and `
` with `{{ }}` for a cleaner custom formatting. Inline spans and block elements can be created and given ID's and Classes, as well as css properties, each of which are comma separated with no spaces. Use double quotes if a value requires spaces. Spans and Blocks start the same: +Markdown is a simplified version of HTML, as such there are equivalences like the replacement of `` and `
` with `{{ }}` for a cleaner custom formatting. Inline spans and block elements can be created and given ID's and Classes, as well as css properties, each of which are comma separated with no spaces. Use double quotes if a value requires spaces. Spans and Blocks start the same: #### Span My favorite author is {{pen,#author,color:orange,font-family:"trebuchet ms" Brandon Sanderson}}. The orange text has a class of `pen`, an id of `author`, is colored orange, and given a new font. The first space outside of quotes marks the beginning of the content. @@ -126,16 +130,17 @@ A blank line can be achieved with a run of one or more `:` alone on a line. More :: + Much nicer than `




` ### Definition Lists **Example** :: V3 uses HTML *definition lists* to create "lists" with hanging indents. + + ### Column Breaks Column and page breaks with `\column` and `\page`. -\column - ### Tables Tables now allow column & row spanning between cells. This is included in some updated snippets, but a simplified example is given below. @@ -163,13 +168,13 @@ Using *Curly Injection* you can assign an id, classes, or inline CSS properties ![alt-text](https://s-media-cache-ak0.pinimg.com/736x/4a/81/79/4a8179462cfdf39054a418efd4cb743e.jpg) {width:100px,border:"2px solid",border-radius:10px} -\* *When using Imgur-hosted images, use the "direct link", which can be found when you click into your image in the Imgur interace.* +\* *When using Imgur-hosted images, use the "direct link", which can be found when you click into your image in the Imgur interface.* ## Snippets Homebrewery comes with a series of *code snippets* found at the top of the editor pane that make it easy to create brews as quickly as possible. Just set your cursor where you want the code to appear in the editor pane, choose a snippet, and make the adjustments you need. ## Style Editor Panel -{{fa,fa-paint-brush}} Technically released prior to v3 but still new to many users, check out the new **Style Editor** located on the right side of the Snippet bar. This editor accepts CSS for styling without requiring `` }} />; + const renderStyle = ()=>{ + if(!props.style) return; + const cleanStyle = sanitizeScriptTags(props.style); + //return
@layer styleTab {\n${sanitizeScriptTags(props.style)}\n} ` }} />; return
${cleanStyle} ` }} />; - }, + }; - renderPage : function(pageText, index){ - let cleanPageText = this.sanitizeScriptTags(pageText); - if(this.props.renderer == 'legacy') - return
; - else { + const renderPage = (pageText, index)=>{ + console.log(`renderPage ${index}`); + let cleanPageText = sanitizeScriptTags(pageText); + if(props.renderer == 'legacy') { + const html = MarkdownLegacy.render(cleanPageText); + return ; + } else { cleanPageText += `\n\n \n\\column\n `; //Artificial column break at page end to emulate column-fill:auto (until `wide` is used, when column-fill:balance will reappear) const html = Markdown.render(cleanPageText); - return ( - - ); + return ; } - }, + }; - renderPages : function(){ - if(this.state.usePPR){ - _.forEach(this.state.pages, (page, index)=>{ - if((this.shouldRender(page, index) || !this.renderedPages[index]) && typeof window !== 'undefined'){ - this.renderedPages[index] = this.renderPage(page, index); // Render any page not yet rendered, but only re-render those in PPR range - } - }); - return this.renderedPages; - } - if(this.props.errors && this.props.errors.length) return this.lastRender; - this.lastRender = _.map(this.state.pages, (page, index)=>{ - if(typeof window !== 'undefined') { - return this.renderPage(page, index); - } else { - return this.renderDummyPage(index); + const renderPages = ()=>{ + if(props.errors && props.errors.length) + return renderedPages; + + _.forEach(rawPages, (page, index)=>{ + if((shouldRender(page, index) || !renderedPages[index]) && typeof window !== 'undefined'){ + renderedPages[index] = renderPage(page, index); // Render any page not yet rendered, but only re-render those in PPR range } }); - return this.lastRender; - }, + return renderedPages; + }; - frameDidMount : function(){ //This triggers when iFrame finishes internal "componentDidMount" + const frameDidMount = ()=>{ //This triggers when iFrame finishes internal "componentDidMount" setTimeout(()=>{ //We still see a flicker where the style isn't applied yet, so wait 100ms before showing iFrame - this.updateSize(); - window.addEventListener('resize', this.updateSize); - this.renderPages(); //Make sure page is renderable before showing - this.setState({ + updateSize(); + window.addEventListener('resize', updateSize); + renderPages(); //Make sure page is renderable before showing + setState((prevState)=>({ + ...prevState, isMounted : true, visibility : 'visible' - }); + })); }, 100); - }, + }; - emitClick : function(){ - // console.log('iFrame clicked'); + const emitClick = ()=>{ // Allow clicks inside iFrame to interact with dropdowns, etc. from outside if(!window || !document) return; document.dispatchEvent(new MouseEvent('click')); - }, + }; - render : function(){ - //render in iFrame so broken code doesn't crash the site. - //Also render dummy page while iframe is mounting. - const rendererPath = this.props.renderer == 'V3' ? 'V3' : 'Legacy'; - const themePath = this.props.theme ?? '5ePHB'; - const baseThemePath = Themes[rendererPath][themePath].baseTheme; - return ( - - {!this.state.isMounted - ?
-
- {this.renderDummyPage(1)} -
+ const rendererPath = props.renderer == 'V3' ? 'V3' : 'Legacy'; + const themePath = props.theme ?? '5ePHB'; + const baseThemePath = Themes[rendererPath][themePath].baseTheme; + + return ( + <> + {/*render dummy page while iFrame is mounting.*/} + {!state.isMounted + ?
+
+ {renderDummyPage(1)}
- : null} +
+ : null} - {this.emitClick();}} - > -
+ {/*render in iFrame so broken code doesn't crash the site.*/} + {emitClick();}} + > +
- -
- - -
- - {baseThemePath && - - } - - {/* Apply CSS from Style tab and render pages from Markdown tab */} - {this.state.isMounted - && - <> - {this.renderStyle()} -
- {this.renderPages()} -
- - } + +
+ +
- - {this.renderPageInfo()} - {this.renderPPRmsg()} - - ); - } -}); + + {baseThemePath && + + } + + + {/* Apply CSS from Style tab and render pages from Markdown tab */} + {state.isMounted + && + <> + {renderStyle()} +
+ {renderPages()} +
+ + } +
+ + {renderPageInfo()} + + ); +}; module.exports = BrewRenderer; diff --git a/themes/Legacy/5ePHB/style.less b/themes/Legacy/5ePHB/style.less index fa7539f16..51b5ddfbb 100644 --- a/themes/Legacy/5ePHB/style.less +++ b/themes/Legacy/5ePHB/style.less @@ -40,7 +40,7 @@ body { -webkit-column-gap : 1cm; -moz-column-gap : 1cm; } -.phb{ +.phb,.page{ .useColumns(); counter-increment : phb-page-numbers; position : relative; @@ -59,6 +59,9 @@ body { page-break-before : always; page-break-after : always; contain : size; +} + +.phb{ //***************************** // * BASE // *****************************/ From 159d5a35b28326bd36bb946de7d3fe4b4cb2f358 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 4 Dec 2023 03:09:15 +0000 Subject: [PATCH 114/123] Bump eslint from 8.53.0 to 8.55.0 Bumps [eslint](https://github.com/eslint/eslint) from 8.53.0 to 8.55.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.53.0...v8.55.0) --- updated-dependencies: - dependency-name: eslint dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- package-lock.json | 24 ++++++++++++------------ package.json | 2 +- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/package-lock.json b/package-lock.json index 8c0a24184..37e1ccc41 100644 --- a/package-lock.json +++ b/package-lock.json @@ -47,7 +47,7 @@ "vitreum": "git+https://git@github.com/calculuschild/vitreum.git" }, "devDependencies": { - "eslint": "^8.53.0", + "eslint": "^8.55.0", "eslint-plugin-jest": "^27.6.0", "eslint-plugin-react": "^7.33.2", "jest": "^29.7.0", @@ -1907,9 +1907,9 @@ } }, "node_modules/@eslint/eslintrc": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-2.1.3.tgz", - "integrity": "sha512-yZzuIG+jnVu6hNSzFEN07e8BxF3uAzYtQb6uDkaYZLo6oYZDCq454c5kB8zxnzfCYyP4MIuyBn10L0DqwujTmA==", + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-2.1.4.tgz", + "integrity": "sha512-269Z39MS6wVJtsoUl10L60WdkhJVdPG24Q4eZTH3nnF6lpvSShEK3wQjDX9JRWAUPvPh7COouPpU9IrqaZFvtQ==", "dev": true, "dependencies": { "ajv": "^6.12.4", @@ -1957,9 +1957,9 @@ } }, "node_modules/@eslint/js": { - "version": "8.53.0", - "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.53.0.tgz", - "integrity": "sha512-Kn7K8dx/5U6+cT1yEhpX1w4PCSg0M+XyRILPgvwcEBjerFWCwQj5sbr3/VmxqV0JGHCBCzyd6LxypEuehypY1w==", + "version": "8.55.0", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.55.0.tgz", + "integrity": "sha512-qQfo2mxH5yVom1kacMtZZJFVdW+E70mqHMJvVg6WTLo+VBuQJ4TojZlfWBjK0ve5BdEeNAVxOsl/nvNMpJOaJA==", "dev": true, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" @@ -5587,15 +5587,15 @@ } }, "node_modules/eslint": { - "version": "8.53.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.53.0.tgz", - "integrity": "sha512-N4VuiPjXDUa4xVeV/GC/RV3hQW9Nw+Y463lkWaKKXKYMvmRiRDAtfpuPFLN+E1/6ZhyR8J2ig+eVREnYgUsiag==", + "version": "8.55.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.55.0.tgz", + "integrity": "sha512-iyUUAM0PCKj5QpwGfmCAG9XXbZCWsqP/eWAWrG/W0umvjuLRBECwSFdt+rCntju0xEH7teIABPwXpahftIaTdA==", "dev": true, "dependencies": { "@eslint-community/eslint-utils": "^4.2.0", "@eslint-community/regexpp": "^4.6.1", - "@eslint/eslintrc": "^2.1.3", - "@eslint/js": "8.53.0", + "@eslint/eslintrc": "^2.1.4", + "@eslint/js": "8.55.0", "@humanwhocodes/config-array": "^0.11.13", "@humanwhocodes/module-importer": "^1.0.1", "@nodelib/fs.walk": "^1.2.8", diff --git a/package.json b/package.json index ded912053..ca4cb153e 100644 --- a/package.json +++ b/package.json @@ -116,7 +116,7 @@ "vitreum": "git+https://git@github.com/calculuschild/vitreum.git" }, "devDependencies": { - "eslint": "^8.53.0", + "eslint": "^8.55.0", "eslint-plugin-jest": "^27.6.0", "eslint-plugin-react": "^7.33.2", "jest": "^29.7.0", From 71f1aed22730cb2df9a594878682c42bca4ecdda Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 4 Dec 2023 03:09:30 +0000 Subject: [PATCH 115/123] Bump react-router-dom from 6.18.0 to 6.20.1 Bumps [react-router-dom](https://github.com/remix-run/react-router/tree/HEAD/packages/react-router-dom) from 6.18.0 to 6.20.1. - [Release notes](https://github.com/remix-run/react-router/releases) - [Changelog](https://github.com/remix-run/react-router/blob/main/packages/react-router-dom/CHANGELOG.md) - [Commits](https://github.com/remix-run/react-router/commits/react-router-dom@6.20.1/packages/react-router-dom) --- updated-dependencies: - dependency-name: react-router-dom dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- package-lock.json | 26 +++++++++++++------------- package.json | 2 +- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/package-lock.json b/package-lock.json index 8c0a24184..a8a13ce35 100644 --- a/package-lock.json +++ b/package-lock.json @@ -41,7 +41,7 @@ "react": "^18.2.0", "react-dom": "^18.2.0", "react-frame-component": "^4.1.3", - "react-router-dom": "6.18.0", + "react-router-dom": "6.20.1", "sanitize-filename": "1.6.3", "superagent": "^8.1.2", "vitreum": "git+https://git@github.com/calculuschild/vitreum.git" @@ -2837,9 +2837,9 @@ } }, "node_modules/@remix-run/router": { - "version": "1.11.0", - "resolved": "https://registry.npmjs.org/@remix-run/router/-/router-1.11.0.tgz", - "integrity": "sha512-BHdhcWgeiudl91HvVa2wxqZjSHbheSgIiDvxrF1VjFzBzpTtuDPkOdOi3Iqvc08kXtFkLjhbS+ML9aM8mJS+wQ==", + "version": "1.13.1", + "resolved": "https://registry.npmjs.org/@remix-run/router/-/router-1.13.1.tgz", + "integrity": "sha512-so+DHzZKsoOcoXrILB4rqDkMDy7NLMErRdOxvzvOKb507YINKUP4Di+shbTZDhSE/pBZ+vr7XGIpcOO0VLSA+Q==", "engines": { "node": ">=14.0.0" } @@ -11873,11 +11873,11 @@ "dev": true }, "node_modules/react-router": { - "version": "6.18.0", - "resolved": "https://registry.npmjs.org/react-router/-/react-router-6.18.0.tgz", - "integrity": "sha512-vk2y7Dsy8wI02eRRaRmOs9g2o+aE72YCx5q9VasT1N9v+lrdB79tIqrjMfByHiY5+6aYkH2rUa5X839nwWGPDg==", + "version": "6.20.1", + "resolved": "https://registry.npmjs.org/react-router/-/react-router-6.20.1.tgz", + "integrity": "sha512-ccvLrB4QeT5DlaxSFFYi/KR8UMQ4fcD8zBcR71Zp1kaYTC5oJKYAp1cbavzGrogwxca+ubjkd7XjFZKBW8CxPA==", "dependencies": { - "@remix-run/router": "1.11.0" + "@remix-run/router": "1.13.1" }, "engines": { "node": ">=14.0.0" @@ -11887,12 +11887,12 @@ } }, "node_modules/react-router-dom": { - "version": "6.18.0", - "resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-6.18.0.tgz", - "integrity": "sha512-Ubrue4+Ercc/BoDkFQfc6og5zRQ4A8YxSO3Knsne+eRbZ+IepAsK249XBH/XaFuOYOYr3L3r13CXTLvYt5JDjw==", + "version": "6.20.1", + "resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-6.20.1.tgz", + "integrity": "sha512-npzfPWcxfQN35psS7rJgi/EW0Gx6EsNjfdJSAk73U/HqMEJZ2k/8puxfwHFgDQhBGmS3+sjnGbMdMSV45axPQw==", "dependencies": { - "@remix-run/router": "1.11.0", - "react-router": "6.18.0" + "@remix-run/router": "1.13.1", + "react-router": "6.20.1" }, "engines": { "node": ">=14.0.0" diff --git a/package.json b/package.json index ded912053..0bd21a587 100644 --- a/package.json +++ b/package.json @@ -110,7 +110,7 @@ "react": "^18.2.0", "react-dom": "^18.2.0", "react-frame-component": "^4.1.3", - "react-router-dom": "6.18.0", + "react-router-dom": "6.20.1", "sanitize-filename": "1.6.3", "superagent": "^8.1.2", "vitreum": "git+https://git@github.com/calculuschild/vitreum.git" From 39e33da2d1ebde20d8e72258bc2c64e4fd3732d8 Mon Sep 17 00:00:00 2001 From: Trevor Buckner Date: Mon, 4 Dec 2023 14:46:51 -0500 Subject: [PATCH 116/123] Cleanup --- client/homebrew/brewRenderer/brewRenderer.jsx | 5 ++--- themes/Legacy/5ePHB/style.less | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/client/homebrew/brewRenderer/brewRenderer.jsx b/client/homebrew/brewRenderer/brewRenderer.jsx index 796c35127..fde91fc68 100644 --- a/client/homebrew/brewRenderer/brewRenderer.jsx +++ b/client/homebrew/brewRenderer/brewRenderer.jsx @@ -88,7 +88,7 @@ const BrewRenderer = (props)=>{ })); }; - const shouldRender = (pageText, index)=>{ + const shouldRender = (index)=>{ if(!state.isMounted) return false; if(Math.abs(index - state.viewablePageNumber) <= 3) @@ -128,7 +128,6 @@ const BrewRenderer = (props)=>{ }; const renderPage = (pageText, index)=>{ - console.log(`renderPage ${index}`); let cleanPageText = sanitizeScriptTags(pageText); if(props.renderer == 'legacy') { const html = MarkdownLegacy.render(cleanPageText); @@ -145,7 +144,7 @@ const BrewRenderer = (props)=>{ return renderedPages; _.forEach(rawPages, (page, index)=>{ - if((shouldRender(page, index) || !renderedPages[index]) && typeof window !== 'undefined'){ + if((shouldRender(index) || !renderedPages[index]) && typeof window !== 'undefined'){ renderedPages[index] = renderPage(page, index); // Render any page not yet rendered, but only re-render those in PPR range } }); diff --git a/themes/Legacy/5ePHB/style.less b/themes/Legacy/5ePHB/style.less index 51b5ddfbb..89b5dd1e9 100644 --- a/themes/Legacy/5ePHB/style.less +++ b/themes/Legacy/5ePHB/style.less @@ -40,7 +40,7 @@ body { -webkit-column-gap : 1cm; -moz-column-gap : 1cm; } -.phb,.page{ +.phb{ .useColumns(); counter-increment : phb-page-numbers; position : relative; From 202b27596648289f8ca80fc57f9c827dea33529e Mon Sep 17 00:00:00 2001 From: Trevor Buckner Date: Mon, 4 Dec 2023 17:07:20 -0500 Subject: [PATCH 117/123] Tweak legacy style so V3 pages offscreen keep size --- themes/Legacy/5ePHB/style.less | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/themes/Legacy/5ePHB/style.less b/themes/Legacy/5ePHB/style.less index 89b5dd1e9..09eb2eec7 100644 --- a/themes/Legacy/5ePHB/style.less +++ b/themes/Legacy/5ePHB/style.less @@ -40,7 +40,7 @@ body { -webkit-column-gap : 1cm; -moz-column-gap : 1cm; } -.phb{ +.phb, .page{ .useColumns(); counter-increment : phb-page-numbers; position : relative; From 4ec5f73aed561156000ef68def217489ace13a69 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 4 Dec 2023 22:09:59 +0000 Subject: [PATCH 118/123] Bump @babel/plugin-transform-runtime from 7.23.3 to 7.23.4 Bumps [@babel/plugin-transform-runtime](https://github.com/babel/babel/tree/HEAD/packages/babel-plugin-transform-runtime) from 7.23.3 to 7.23.4. - [Release notes](https://github.com/babel/babel/releases) - [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md) - [Commits](https://github.com/babel/babel/commits/v7.23.4/packages/babel-plugin-transform-runtime) --- updated-dependencies: - dependency-name: "@babel/plugin-transform-runtime" dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- package-lock.json | 8 ++++---- package.json | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index 3f920ba46..7b52fc50b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,7 +11,7 @@ "license": "MIT", "dependencies": { "@babel/core": "^7.23.5", - "@babel/plugin-transform-runtime": "^7.23.3", + "@babel/plugin-transform-runtime": "^7.23.4", "@babel/preset-env": "^7.23.5", "@babel/preset-react": "^7.23.3", "@googleapis/drive": "^8.4.0", @@ -1455,9 +1455,9 @@ } }, "node_modules/@babel/plugin-transform-runtime": { - "version": "7.23.3", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-runtime/-/plugin-transform-runtime-7.23.3.tgz", - "integrity": "sha512-XcQ3X58CKBdBnnZpPaQjgVMePsXtSZzHoku70q9tUAQp02ggPQNM04BF3RvlW1GSM/McbSOQAzEK4MXbS7/JFg==", + "version": "7.23.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-runtime/-/plugin-transform-runtime-7.23.4.tgz", + "integrity": "sha512-ITwqpb6V4btwUG0YJR82o2QvmWrLgDnx/p2A3CTPYGaRgULkDiC0DRA2C4jlRB9uXGUEfaSS/IGHfVW+ohzYDw==", "dependencies": { "@babel/helper-module-imports": "^7.22.15", "@babel/helper-plugin-utils": "^7.22.5", diff --git a/package.json b/package.json index a8b5d25ec..65b2d7157 100644 --- a/package.json +++ b/package.json @@ -80,7 +80,7 @@ }, "dependencies": { "@babel/core": "^7.23.5", - "@babel/plugin-transform-runtime": "^7.23.3", + "@babel/plugin-transform-runtime": "^7.23.4", "@babel/preset-env": "^7.23.5", "@babel/preset-react": "^7.23.3", "@googleapis/drive": "^8.4.0", From bf30cadb68f1edaac323c43e681c2da96d2ea292 Mon Sep 17 00:00:00 2001 From: Trevor Buckner Date: Mon, 4 Dec 2023 21:13:26 -0500 Subject: [PATCH 119/123] Add default page size to brewRenderer.less Add default brew page size to brewRenderer.less, so all pages have a fallback size when switching between themes and renderers. Avoids losing the scroll position on a page caused by out-of-view pages losing their size, especially on long brews where recalculating page layout can take a half second. --- .../homebrew/brewRenderer/brewRenderer.less | 30 +++++++++---------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/client/homebrew/brewRenderer/brewRenderer.less b/client/homebrew/brewRenderer/brewRenderer.less index bde91c92e..65ae1beda 100644 --- a/client/homebrew/brewRenderer/brewRenderer.less +++ b/client/homebrew/brewRenderer/brewRenderer.less @@ -1,46 +1,44 @@ @import (multiple, less) 'shared/naturalcrit/styles/reset.less'; -.brewRenderer{ +.brewRenderer { will-change : transform; overflow-y : scroll; - .pages{ + .pages { margin : 30px 0px; - &>.page{ + & > .page { + width : 215.9mm; + height : 279.4mm; margin-right : auto; margin-bottom : 30px; margin-left : auto; - box-shadow : 1px 4px 14px #000; + box-shadow : 1px 4px 14px #000000; } } } -.pane{ - position : relative; -} -.pageInfo{ +.pane { position : relative; } +.pageInfo { position : absolute; right : 17px; bottom : 0; z-index : 1000; - background-color : #333; font-size : 10px; font-weight : 800; color : white; + background-color : #333333; div { - display: inline-block; + display : inline-block; padding : 8px 10px; - &:not(:last-child){ - border-right: 1px solid #666; - } + &:not(:last-child) { border-right : 1px solid #666666; } } } -.ppr_msg{ +.ppr_msg { position : absolute; - left : 0px; bottom : 0; + left : 0px; z-index : 1000; padding : 8px 10px; - background-color : #333; font-size : 10px; font-weight : 800; color : white; + background-color : #333333; } From ddef21cd7ee216501656cd1f17d7f1b00eb0160c Mon Sep 17 00:00:00 2001 From: Trevor Buckner Date: Mon, 4 Dec 2023 21:54:44 -0500 Subject: [PATCH 120/123] Give editor highlighting sub/superscript alignment --- client/homebrew/editor/editor.less | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/client/homebrew/editor/editor.less b/client/homebrew/editor/editor.less index 1f8b6e718..b165f91db 100644 --- a/client/homebrew/editor/editor.less +++ b/client/homebrew/editor/editor.less @@ -44,12 +44,16 @@ color : green; } .superscript:not(.cm-comment) { - font-weight : bold; - color : goldenrod; + font-weight : bold; + color : goldenrod; + vertical-align : super; + font-size : 0.9em; } .subscript:not(.cm-comment) { - font-weight : bold; - color : rgb(123, 123, 15); + font-weight : bold; + color : rgb(123, 123, 15); + vertical-align : sub; + font-size : 0.9em; } } From 6bf51cd94aa7cb44dc07b6960f6a60c718b87810 Mon Sep 17 00:00:00 2001 From: Trevor Buckner Date: Mon, 4 Dec 2023 21:56:08 -0500 Subject: [PATCH 121/123] Allow both sub and super highlighting on same line --- client/homebrew/editor/editor.jsx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/client/homebrew/editor/editor.jsx b/client/homebrew/editor/editor.jsx index c4df7a89c..637394072 100644 --- a/client/homebrew/editor/editor.jsx +++ b/client/homebrew/editor/editor.jsx @@ -161,20 +161,20 @@ const Editor = createClass({ } // Superscript - if(line.includes('^^') && !line.includes('^^^')) { - const regex = /.*\^\^(.+)\^\^/y; + if(line.includes('\^')) { + const regex = /\^(?!\s)(?=([^\n\^]*[^\s\^]))\1\^/g; let match; while ((match = regex.exec(line)) != null) { - codeMirror.markText({ line: lineNumber, ch: line.indexOf(match[1]) - 2 }, { line: lineNumber, ch: line.indexOf(match[1]) + match[1].length + 2 }, { className: 'superscript' }); + codeMirror.markText({ line: lineNumber, ch: line.indexOf(match[1]) - 1 }, { line: lineNumber, ch: line.indexOf(match[1]) + match[1].length + 1 }, { className: 'superscript' }); } } // Subscript - if(line.includes('^^^')) { - const regex = /.*\^\^\^(.+)\^\^\^/y; + if(line.includes('^^')) { + const regex = /\^\^(?!\s)(?=([^\n\^]*[^\s\^]))\1\^\^/g; let match; while ((match = regex.exec(line)) != null) { - codeMirror.markText({ line: lineNumber, ch: line.indexOf(match[1]) - 3 }, { line: lineNumber, ch: line.indexOf(match[1]) + match[1].length + 3 }, { className: 'subscript' }); + codeMirror.markText({ line: lineNumber, ch: line.indexOf(match[1]) - 2 }, { line: lineNumber, ch: line.indexOf(match[1]) + match[1].length + 2 }, { className: 'subscript' }); } } From 38fa428fde303edc018d4c5417f8943c3fb3b997 Mon Sep 17 00:00:00 2001 From: Trevor Buckner Date: Mon, 4 Dec 2023 22:11:05 -0500 Subject: [PATCH 122/123] Change to 1 and 2 ^'s . Slight cleanup --- shared/naturalcrit/markdown.js | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/shared/naturalcrit/markdown.js b/shared/naturalcrit/markdown.js index 8cafe1ca5..7185cab8e 100644 --- a/shared/naturalcrit/markdown.js +++ b/shared/naturalcrit/markdown.js @@ -207,34 +207,30 @@ const mustacheInjectBlock = { }; const superSubScripts = { - name : 'superSubScripts', + name : 'superSubScript', level : 'inline', - start(src) { return src.match(/\^\^/m)?.index; }, // Hint to Marked.js to stop and check for a match + start(src) { return src.match(/\^/m)?.index; }, // Hint to Marked.js to stop and check for a match tokenizer(src, tokens) { - const superRegex = /^\^\^(?!\s)(?=([^\n\^]*[^\s\^]))\1\^\^/m; - const subRegex = /^\^\^\^([^\s\^][^\^]*[^\s\^])\^\^\^/m; + const superRegex = /^\^(?!\s)(?=([^\n\^]*[^\s\^]))\1\^/m; + const subRegex = /^\^\^(?!\s)(?=([^\n\^]*[^\s\^]))\1\^\^/m; let isSuper = false; let match = subRegex.exec(src); if(!match){ match = superRegex.exec(src); - if(match) { + if(match) isSuper = true; - } } if(match?.length) { - const tags = this.lexer.inlineTokens(match[1]); return { - type : 'superSubScripts', // Should match "name" above - raw : match[0], // Text to consume from the source - text : src, - super : isSuper, - tags + type : 'superSubScript', // Should match "name" above + raw : match[0], // Text to consume from the source + tag : isSuper ? 'sup' : 'sub', + tokens : this.lexer.inlineTokens(match[1]) }; } }, renderer(token) { - const tag = token.super ? 'sup' : 'sub'; - return `<${tag}>${this.parser.parseInline(token.tags)}`; + return `<${token.tag}>${this.parser.parseInline(token.tokens)}`; } }; From 2dc874daba433f3e9f5683221ef898d6c0592911 Mon Sep 17 00:00:00 2001 From: Trevor Buckner Date: Mon, 4 Dec 2023 22:21:58 -0500 Subject: [PATCH 123/123] Adjust hotkeys to match other changes --- shared/naturalcrit/codeEditor/codeEditor.jsx | 26 ++++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/shared/naturalcrit/codeEditor/codeEditor.jsx b/shared/naturalcrit/codeEditor/codeEditor.jsx index b6ea07cf1..fcfee1dbf 100644 --- a/shared/naturalcrit/codeEditor/codeEditor.jsx +++ b/shared/naturalcrit/codeEditor/codeEditor.jsx @@ -112,10 +112,10 @@ const CodeEditor = createClass({ 'Shift-Tab' : this.dedent, 'Ctrl-B' : this.makeBold, 'Cmd-B' : this.makeBold, - 'Ctrl-6' : this.makeSuper, - 'Cmd-6' : this.makeSuper, - 'Ctrl-7' : this.makeSub, - 'Cmd-7' : this.makeSub, + 'Shift-Ctrl-=' : this.makeSuper, + 'Shift-Cmd-=' : this.makeSuper, + 'Ctrl-=' : this.makeSub, + 'Cmd-=' : this.makeSub, 'Ctrl-I' : this.makeItalic, 'Cmd-I' : this.makeItalic, 'Ctrl-U' : this.makeUnderline, @@ -224,6 +224,15 @@ const CodeEditor = createClass({ }, makeSuper : function() { + 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 }); + } + }, + + makeSub : function() { const selection = this.codeMirror.getSelection(), t = selection.slice(0, 2) === '^^' && selection.slice(-2) === '^^'; this.codeMirror.replaceSelection(t ? selection.slice(2, -2) : `^^${selection}^^`, 'around'); if(selection.length === 0){ @@ -232,15 +241,6 @@ const CodeEditor = createClass({ } }, - makeSub : function() { - const selection = this.codeMirror.getSelection(), t = selection.slice(0, 3) === '^^^' && selection.slice(-3) === '^^^'; - this.codeMirror.replaceSelection(t ? selection.slice(3, -3) : `^^^${selection}^^^`, 'around'); - if(selection.length === 0){ - const cursor = this.codeMirror.getCursor(); - this.codeMirror.setCursor({ line: cursor.line, ch: cursor.ch - 3 }); - } - }, - makeNbsp : function() { this.codeMirror.replaceSelection(' ', 'end');