0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2026-01-24 16:23:01 +00:00

Compare commits

...

8 Commits

Author SHA1 Message Date
Trevor Buckner
0fd3448826 Fix check that editor is in Text tab 2024-10-15 08:01:41 -04:00
Trevor Buckner
3bd73417e6 Add optional chaining 2024-10-14 22:48:27 -04:00
Trevor Buckner
72b69ebb6a Memoize BrewRenderer
Only re-render BrewRenderer when specific props have changed.

Fixes lag during scrolling, which updates the "currentPage" prop, but isn't actually used until the text is changed.
2024-10-14 21:55:02 -04:00
Trevor Buckner
f1af87ee7e Merge pull request #3821 from naturalcrit/v3.16.0 2024-10-12 23:21:01 -04:00
Trevor Buckner
7dcceb983e Update changelog to v3.16.0 2024-10-12 23:10:13 -04:00
Trevor Buckner
6d4b1843ae Fix missed lines from 3.15.2 branch 2024-10-12 00:10:43 -04:00
Trevor Buckner
76d6679002 Fix line endings on app.js 2024-10-11 23:50:08 -04:00
Trevor Buckner
4efa1b10f3 Merge pull request #3808 from naturalcrit/v3.15.2 2024-10-11 23:48:34 -04:00
8 changed files with 660 additions and 572 deletions

View File

@@ -81,9 +81,85 @@ pre {
}
```
## changelog
For a full record of development, visit our [Github Page](https://github.com/naturalcrit/homebrewery).
### Saturday 10/12/2024 - v3.16.0
{{taskList
##### 5e-Cleric
* [x] Added a new API endpoint `/metadata/:shareId` to fetch metadata about individual brews
Fixes issue [#2638](https://github.com/naturalcrit/homebrewery/issues/2638)
* [x] Added A3, A5, and Card page size snippets under {{openSans **:fas_paintbrush: STYLE TAB :fas_arrow_right: :fas_print: PRINT**}}
* [x] Adjust navbar styling for very long titles
Fixes issue [#2071](https://github.com/naturalcrit/homebrewery/issues/2071)
* [x] Added some sorting options to the {{openSans **VAULT** {{fas,fa-dungeon}}}} page
* [x] Fix `language` property not working in share page
Fixes issue [#3776](https://github.com/naturalcrit/homebrewery/issues/3776)
##### abquintic
* [x] New {{openSans **:fas_pencil: TEXT EDITOR :fas_arrow_right: :fas_bookmark: PAGE NUMBER :fas_arrow_right:**}}
{{openSans **:fas_xmark: SKIP PAGE NUMBER**}} and {{openSans **:fas_arrow_rotate_left: RESTART PAGE NUMBER**}} snippets for more control over automatic page numbering.
Fixes issue [#513](https://github.com/naturalcrit/homebrewery/issues/513)
* [x] New Table of Contents control options via {{openSans **:fas_pencil: TEXT EDITOR :fas_arrow_right: :fas_book: TABLE OF CONTENTS**}} submenus. By default, H1-H3 is included in the ToC generation, but the new options allow marking `{{blocks}}` to include or exclude specific or ranges of contained headers. Also, a global option to increase the default range of H1-H3 to H1-H4/5/6. After applying these markers, you must regenerate the Table of Contents to see the changes.
* [x] Added a ":fas_lock: SYNC VIEWS" button onto the divider bar. When locked, scrolling on either panel will sync the other panel to the same page.
Fixes issue [#241](https://github.com/naturalcrit/homebrewery/issues/241)
##### Gazook89
* [x] Added a :fas_glasses: HIDE button to the page navigation bar
##### G-Ambatte
* [x] Automatic local backups of your files, in case of accidental data loss. Stores up to 5 snapshots of each brew edited in your browser, incrementing from a few minutes old to a maximum of several days. Restore a backup by clicking an entry in the new {{openSans **:fas_clock_rotate_left: HISTORY**}} button in the snippet bar.
Fixes issue [#3070](https://github.com/naturalcrit/homebrewery/issues/3070)
* [x] Fix issue with legacy brews breaking on Share page
Fixes issue [#3764](https://github.com/naturalcrit/homebrewery/issues/3764)
* [x] Fix print size when printing a zoomed document
Fixes issue [#3744](https://github.com/naturalcrit/homebrewery/issues/3744)
##### All
* [x] Background code cleanup, security fixes, dev tool improvements, dependency updates, prep for upcoming features, etc.
}}
### Wednesday 9/25/2024 - v3.15.1
{{taskList
##### calculuschild
* [x] Background fixes to handle Google Drive issues
* [x] Remove duplicate error logging
##### calculuschild, 5e-Cleric
* [x] Fix links in {{openSans **RECENT BREWS :fas_clock_rotate_left:**}} and user {{openSans **BREWS :fas_beer_mug_empty:**}} pointing to trashed Google Drive files after transferring from Google to Homebrewery storage
Fixes issue [#3776](https://github.com/naturalcrit/homebrewery/issues/3776)
}}
\page
### Wednesday 9/04/2024 - v3.15.0
{{taskList

View File

@@ -1,7 +1,7 @@
/*eslint max-lines: ["warn", {"max": 300, "skipBlankLines": true, "skipComments": true}]*/
require('./brewRenderer.less');
const React = require('react');
const { useState, useRef, useCallback } = React;
const { useState, useRef, useCallback, memo } = React;
const _ = require('lodash');
const MarkdownLegacy = require('naturalcrit/markdownLegacy.js');
@@ -47,7 +47,7 @@ const BrewPage = (props)=>{
const renderedPages = [];
let rawPages = [];
const BrewRenderer = (props)=>{
const BrewRenderer = memo((props)=>{
props = {
text : '',
style : '',
@@ -224,6 +224,19 @@ const BrewRenderer = (props)=>{
</Frame>
</>
);
};
}, arePropsEqual);
//Only re-render brewRenderer if arePropsEqual == true
function arePropsEqual(oldProps, newProps) {
return (
oldProps?.text?.length === newProps?.text?.length &&
oldProps?.style?.length === newProps?.style?.length &&
oldProps?.renderer === newProps?.renderer &&
oldProps?.theme === newProps?.theme &&
oldProps?.errors === newProps?.errors &&
oldProps?.themeBundle === newProps?.themeBundle &&
oldProps?.lang === newProps?.lang
);
}
module.exports = BrewRenderer;

View File

@@ -355,7 +355,7 @@ const Editor = createClass({
},
sourceJump : function(targetPage=this.props.currentBrewRendererPageNum, smooth=true){
if(!this.isText || isJumping)
if(!this.isText() || isJumping)
return;
const textSplit = this.props.renderer == 'V3' ? /^\\page$/gm : /\\page/;

4
package-lock.json generated
View File

@@ -1,12 +1,12 @@
{
"name": "homebrewery",
"version": "3.15.0",
"version": "3.16.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "homebrewery",
"version": "3.15.0",
"version": "3.16.0",
"hasInstallScript": true,
"license": "MIT",
"dependencies": {

View File

@@ -1,7 +1,7 @@
{
"name": "homebrewery",
"description": "Create authentic looking D&D homebrews using only markdown",
"version": "3.15.0",
"version": "3.16.0",
"engines": {
"npm": "^10.2.x",
"node": "^20.17.x"

File diff suppressed because it is too large Load Diff

View File

@@ -154,9 +154,8 @@ const GoogleActions = {
return brews;
},
updateGoogleBrew : async (brew, auth = defaultAuth, userIp)=>{
const drive = googleDrive.drive({ version: 'v3', auth: auth });
console.log(auth == defaultAuth ? 'UPDATE w SERVICEACC' : 'UPDATE w USERACC')
updateGoogleBrew : async (brew, userIp)=>{
const drive = googleDrive.drive({ version: 'v3', auth: defaultAuth });
await drive.files.update({
fileId : brew.googleId,

View File

@@ -353,7 +353,7 @@ const api = {
if(!brew.googleId) return;
} else if(brew.googleId) {
// If the google id exists and no other actions are being performed, update the google brew
const updated = await GoogleActions.updateGoogleBrew(api.excludeGoogleProps(brew));
const updated = await GoogleActions.updateGoogleBrew(api.excludeGoogleProps(brew), req.ip);
if(!updated) return;
}