From 5648e55774c9b62b717b376cdf6874ce11bffc67 Mon Sep 17 00:00:00 2001 From: David Bolack Date: Fri, 23 May 2025 14:45:37 -0500 Subject: [PATCH 01/75] Add column, columnbreak, and pagebreak compatibuility to Legacy --- client/homebrew/brewRenderer/brewRenderer.jsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/client/homebrew/brewRenderer/brewRenderer.jsx b/client/homebrew/brewRenderer/brewRenderer.jsx index c391d8c43..9c5e03032 100644 --- a/client/homebrew/brewRenderer/brewRenderer.jsx +++ b/client/homebrew/brewRenderer/brewRenderer.jsx @@ -20,6 +20,8 @@ import HeaderNav from './headerNav/headerNav.jsx'; import { safeHTML } from './safeHTML.js'; const PAGEBREAK_REGEX_V3 = /^(?=\\page(?:break)?(?: *{[^\n{}]*})?$)/m; +const PAGEBREAK_REGEX_LEGACY = /\\page(?:break)?/m; +const COLUMNBREAK_LEGACY = /\\column(:?break)?/m; const PAGE_HEIGHT = 1056; const INITIAL_CONTENT = dedent` @@ -128,7 +130,7 @@ const BrewRenderer = (props)=>{ const pagesRef = useRef(null); if(props.renderer == 'legacy') { - rawPages = props.text.split('\\page'); + rawPages = props.text.replace(COLUMNBREAK_LEGACY, '```\n````\n').split(PAGEBREAK_REGEX_LEGACY); } else { rawPages = props.text.split(PAGEBREAK_REGEX_V3); } From 77dcc9b433d020d8f96dedaf2dd84704a132099d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Losada=20Hern=C3=A1ndez?= Date: Wed, 28 May 2025 08:34:52 +0200 Subject: [PATCH 02/75] initial commit --- shared/naturalcrit/markdown.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/shared/naturalcrit/markdown.js b/shared/naturalcrit/markdown.js index ac6988734..54884c33e 100644 --- a/shared/naturalcrit/markdown.js +++ b/shared/naturalcrit/markdown.js @@ -185,7 +185,7 @@ const mustacheSpans = { start(src) { return src.match(/{{[^{]/)?.index; }, // Hint to Marked.js to stop and check for a match tokenizer(src, tokens) { const completeSpan = /^{{[^\n]*}}/; // Regex for the complete token - const inlineRegex = /{{(?=((?:[:=](?:"['\w,\-()#%=?. ]*"|[\w\-()#%.]*)|[^"=':{}\s]*)*))\1 *|}}/g; + const inlineRegex = /{{(?=((?:[:=](?:"['\w,\-+*/()#%=?. ]*"|[\w\-()#%.]*)|[^"=':{}\s]*)*))\1 *|}}/g; const match = completeSpan.exec(src); if(match) { //Find closing delimiter @@ -242,7 +242,7 @@ const mustacheDivs = { start(src) { return src.match(/\n *{{[^{]/m)?.index; }, // Hint to Marked.js to stop and check for a match tokenizer(src, tokens) { const completeBlock = /^ *{{[^\n}]* *\n.*\n *}}/s; // Regex for the complete token - const blockRegex = /^ *{{(?=((?:[:=](?:"['\w,\-()#%=?. ]*"|[\w\-()#%.]*)|[^"=':{}\s]*)*))\1 *$|^ *}}$/gm; + const blockRegex = /^ *{{(?=((?:[:=](?:"['\w,\-+*/()#%=?. ]*"|[\w\-()#%.]*)|[^"=':{}\s]*)*))\1 *$|^ *}}$/gm; const match = completeBlock.exec(src); if(match) { //Find closing delimiter @@ -297,7 +297,7 @@ const mustacheInjectInline = { level : 'inline', start(src) { return src.match(/ *{[^{\n]/)?.index; }, // Hint to Marked.js to stop and check for a match tokenizer(src, tokens) { - const inlineRegex = /^ *{(?=((?:[:=](?:"['\w,\-()#%=?. ]*"|[\w\-()#%.]*)|[^"=':{}\s]*)*))\1}/g; + const inlineRegex = /^ *{(?=((?:[:=](?:"['\w,\-+*/()#%=?. ]*"|[\w\-()#%.]*)|[^"=':{}\s]*)*))\1}/g; const match = inlineRegex.exec(src); if(match) { const lastToken = tokens[tokens.length - 1]; @@ -343,7 +343,7 @@ const mustacheInjectBlock = { level : 'block', start(src) { return src.match(/\n *{[^{\n]/m)?.index; }, // Hint to Marked.js to stop and check for a match tokenizer(src, tokens) { - const inlineRegex = /^ *{(?=((?:[:=](?:"['\w,\-()#%=?. ]*"|[\w\-()#%.]*)|[^"=':{}\s]*)*))\1}/ym; + const inlineRegex = /^ *{(?=((?:[:=](?:"['\w,\-+*/()#%=?. ]*"|[\w\-()#%.]*)|[^"=':{}\s]*)*))\1}/ym; const match = inlineRegex.exec(src); if(match) { const lastToken = tokens[tokens.length - 1]; From 6d0d6f08b538e3cbca2abb1eca98a5b3c7abf530 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Losada=20Hern=C3=A1ndez?= Date: Wed, 28 May 2025 09:09:14 +0200 Subject: [PATCH 03/75] initial commit --- client/homebrew/homebrew.jsx | 117 ++++++++++++++++------------------- 1 file changed, 53 insertions(+), 64 deletions(-) diff --git a/client/homebrew/homebrew.jsx b/client/homebrew/homebrew.jsx index 415390498..3559c7521 100644 --- a/client/homebrew/homebrew.jsx +++ b/client/homebrew/homebrew.jsx @@ -1,12 +1,8 @@ -//╔===--------------- Polyfills --------------===╗// +/* eslint-disable camelcase */ import 'core-js/es/string/to-well-formed.js'; -//╚===--------------- ---------------===╝// - -require('./homebrew.less'); -const React = require('react'); -const createClass = require('create-react-class'); -const { StaticRouter:Router } = require('react-router'); -const { Route, Routes, useParams, useSearchParams } = require('react-router'); +import './homebrew.less'; +import React from 'react'; +import { StaticRouter as Router, Route, Routes, useParams, useSearchParams } from 'react-router'; const HomePage = require('./pages/homePage/homePage.jsx'); const EditPage = require('./pages/editPage/editPage.jsx'); @@ -34,62 +30,55 @@ const WithRoute = (props)=>{ return ; }; -const Homebrew = createClass({ - displayName : 'Homebrewery', - getDefaultProps : function() { - return { - url : '', - welcomeText : '', - changelog : '', - version : '0.0.0', - account : null, - enable_v3 : false, - brew : { - title : '', - text : '', - shareId : null, - editId : null, - createdAt : null, - updatedAt : null, - lang : '' - } - }; - }, +const Homebrew = (props)=>{ + const { + url = '', + version = '0.0.0', + account = null, + enable_v3 = false, + enable_themes, + config, + brew = { + title : '', + text : '', + shareId : null, + editId : null, + createdAt : null, + updatedAt : null, + lang : '' + }, + userThemes, + brews + } = props; - getInitialState : function() { - global.account = this.props.account; - global.version = this.props.version; - global.enable_v3 = this.props.enable_v3; - global.enable_themes = this.props.enable_themes; - global.config = this.props.config; + global.account = account; + global.version = version; + global.enable_v3 = enable_v3; + global.enable_themes = enable_themes; + global.config = config; - return {}; - }, + return ( + +
+ + } /> + } /> + } /> + } /> + } /> + }/> + } /> + } /> + } /> + } /> + } /> + } /> + } /> + } /> + +
+
+ ); +}; - render : function (){ - return ( - -
- - } /> - } /> - } /> - } /> - } /> - }/> - } /> - } /> - } /> - } /> - } /> - } /> - } /> - } /> - -
-
- ); - } -}); - -module.exports = Homebrew; \ No newline at end of file +module.exports = Homebrew; From c2cf695c1721e41277f9883f1f80f298cb86a938 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Losada=20Hern=C3=A1ndez?= Date: Mon, 2 Jun 2025 13:50:51 +0200 Subject: [PATCH 04/75] add defaults --- client/homebrew/brewRenderer/brewRenderer.jsx | 4 +++- client/homebrew/brewRenderer/toolBar/toolBar.jsx | 8 ++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/client/homebrew/brewRenderer/brewRenderer.jsx b/client/homebrew/brewRenderer/brewRenderer.jsx index c391d8c43..114fe7ed6 100644 --- a/client/homebrew/brewRenderer/brewRenderer.jsx +++ b/client/homebrew/brewRenderer/brewRenderer.jsx @@ -113,7 +113,9 @@ const BrewRenderer = (props)=>{ zoomLevel : 100, spread : 'single', startOnRight : true, - pageShadows : true + pageShadows : true, + rowGap : 5, + columnGap : 10, }); //useEffect to store or gather toolbar state from storage diff --git a/client/homebrew/brewRenderer/toolBar/toolBar.jsx b/client/homebrew/brewRenderer/toolBar/toolBar.jsx index 4f3e356a7..81af0d56f 100644 --- a/client/homebrew/brewRenderer/toolBar/toolBar.jsx +++ b/client/homebrew/brewRenderer/toolBar/toolBar.jsx @@ -21,8 +21,8 @@ const ToolBar = ({ displayOptions, onDisplayOptionsChange, visiblePages, totalPa }, [visiblePages]); useEffect(()=>{ - const visibility = localStorage.getItem('hb_toolbarVisibility') === 'true'; - setToolsVisible(visibility); + const visibility = localStorage.getItem('hb_toolbarVisibility'); + if(visibility) setToolsVisible(visibility); }, []); const handleZoomButton = (zoom)=>{ @@ -68,7 +68,7 @@ const ToolBar = ({ displayOptions, onDisplayOptionsChange, visiblePages, totalPa } else if(mode == 'fit'){ // find the page with the largest single dim (height or width) so that zoom can be adapted to fit it. let minDimRatio; - if(displayOptions.spread === 'active') + if(displayOptions.spread === 'single') minDimRatio = [...pages].reduce( (minRatio, page)=>Math.min(minRatio, iframeWidth / page.offsetWidth, @@ -165,7 +165,7 @@ const ToolBar = ({ displayOptions, onDisplayOptionsChange, visiblePages, totalPa id='single-spread' className='tool' title='Single Page' - onClick={()=>{handleOptionChange('spread', 'active');}} + onClick={()=>{handleOptionChange('spread', 'single');}} aria-checked={displayOptions.spread === 'single'} >