diff --git a/client/homebrew/editor/editor.jsx b/client/homebrew/editor/editor.jsx index a00c47403..0ffd2e8a0 100644 --- a/client/homebrew/editor/editor.jsx +++ b/client/homebrew/editor/editor.jsx @@ -58,7 +58,7 @@ const Editor = createClass({ return { editorTheme : this.props.editorTheme, view : 'text', //'text', 'style', 'meta', 'snippet' - snippetbarHeight : 25 + snippetBarHeight : 26, }; }, @@ -85,7 +85,15 @@ const Editor = createClass({ editorTheme : editorTheme }); } - this.setState({ snippetbarHeight: document.querySelector('.editor > .snippetBar').offsetHeight }); + const snippetBar = document.querySelector('.editor > .snippetBar'); + if (!snippetBar) return; + + this.resizeObserver = new ResizeObserver(entries => { + const height = document.querySelector('.editor > .snippetBar').offsetHeight; + this.setState({ snippetBarHeight: height }); + }); + + this.resizeObserver.observe(snippetBar); }, componentDidUpdate : function(prevProps, prevState, snapshot) { @@ -108,6 +116,10 @@ const Editor = createClass({ } }, + componentWillUnmount() { + if (this.resizeObserver) this.resizeObserver.disconnect(); + }, + handleControlKeys : function(e){ if(!(e.ctrlKey && e.metaKey && e.shiftKey)) return; const LEFTARROW_KEY = 37; @@ -408,11 +420,7 @@ const Editor = createClass({ }, //Called when there are changes to the editor's dimensions - update : function(){ - const snipHeight = document.querySelector('.editor > .snippetBar').offsetHeight; - if(snipHeight !== this.state.snippetbarHeight) - this.setState({ snippetbarHeight: snipHeight }); - }, + update : function(){}, updateEditorTheme : function(newTheme){ window.localStorage.setItem(EDITOR_THEME_KEY, newTheme); @@ -437,7 +445,7 @@ const Editor = createClass({ onChange={this.props.onBrewChange('text')} editorTheme={this.state.editorTheme} rerenderParent={this.rerenderParent} - style={{ height: `calc(100% - ${this.state.snippetbarHeight}px)` }} /> + style={{ height: `calc(100% - ${this.state.snippetBarHeight}px)` }} /> ; } if(this.isStyle()){ @@ -451,7 +459,7 @@ const Editor = createClass({ enableFolding={true} editorTheme={this.state.editorTheme} rerenderParent={this.rerenderParent} - style={{ height: `calc(100% - ${this.state.snippetbarHeight}px)` }} /> + style={{ height: `calc(100% - ${this.state.snippetBarHeight}px)` }} /> ; } if(this.isMeta()){ @@ -468,7 +476,6 @@ const Editor = createClass({ userThemes={this.props.userThemes}/> ; } - if(this.isSnip()){ if(!this.props.brew.snippets) { this.props.brew.snippets = DEFAULT_SNIPPET_TEXT; } return <> @@ -481,7 +488,7 @@ const Editor = createClass({ enableFolding={true} editorTheme={this.state.editorTheme} rerenderParent={this.rerenderParent} - style={{ height: `calc(100% - ${this.state.snippetbarHeight}px)` }} /> + style={{ height: `calc(100% -${this.state.snippetBarHeight}px)` }} /> ; } }, diff --git a/client/homebrew/editor/snippetbar/snippetbar.less b/client/homebrew/editor/snippetbar/snippetbar.less index c53d4be8e..8e50aa764 100644 --- a/client/homebrew/editor/snippetbar/snippetbar.less +++ b/client/homebrew/editor/snippetbar/snippetbar.less @@ -14,7 +14,7 @@ .snippets { display : flex; justify-content : flex-start; - min-width : 432.18px; //must be controlled every time an item is added, must be hardcoded for the wrapping as it is applied + min-width : 499.35px; //must be controlled every time an item is added, must be hardcoded for the wrapping as it is applied } .editors { @@ -237,7 +237,7 @@ } } -@container editor (width < 683px) { +@container editor (width < 750px) { .snippetBar { .editors { flex : 1; diff --git a/client/homebrew/navbar/newbrew.navitem.jsx b/client/homebrew/navbar/newbrew.navitem.jsx index fe8c05dc7..b8cf82ab7 100644 --- a/client/homebrew/navbar/newbrew.navitem.jsx +++ b/client/homebrew/navbar/newbrew.navitem.jsx @@ -3,19 +3,16 @@ const _ = require('lodash'); const Nav = require('client/homebrew/navbar/nav.jsx'); const { splitTextStyleAndMetadata } = require('../../../shared/helpers.js'); // Importing the function from helpers.js -const BREWKEY = 'homebrewery-new'; -const STYLEKEY = 'homebrewery-new-style'; -const METAKEY = 'homebrewery-new-meta'; +const BREWKEY = 'HB_newPage_content'; +const STYLEKEY = 'HB_newPage_style'; +const METAKEY = 'HB_newPage_meta'; const NewBrew = ()=>{ const handleFileChange = (e)=>{ const file = e.target.files[0]; if(!file) return; - const currentNew = localStorage.getItem(BREWKEY); - if(currentNew && !confirm( - `You have some text in the new brew space, if you load a file that text will be lost, are you sure you want to load the file?` - )) return; + if(!confirmLocalStorageChange()) return; const reader = new FileReader(); reader.onload = (e)=>{ @@ -37,12 +34,35 @@ const NewBrew = ()=>{ alert(`This file is invalid: ${!type ? 'Missing file extension' :`.${type} files are not supported`}. Only .txt files exported from the Homebrewery are allowed.`); - console.log(file); }; reader.readAsText(file); }; + const confirmLocalStorageChange = ()=>{ + const currentText = localStorage.getItem(BREWKEY); + const currentStyle = localStorage.getItem(STYLEKEY); + const currentMeta = localStorage.getItem(METAKEY); + + // TRUE if no data in any local storage key + // TRUE if data in any local storage key AND approval given + // FALSE if data in any local storage key AND approval declined + return (!(currentText || currentStyle || currentMeta) || confirm( + `You have made changes in the new brew space. If you continue, that information will be PERMANENTLY LOST.\nAre you sure you wish to continue?` + )); + }; + + const clearLocalStorage = ()=>{ + if(!confirmLocalStorageChange()) return; + + localStorage.removeItem(BREWKEY); + localStorage.removeItem(STYLEKEY); + localStorage.removeItem(METAKEY); + + window.location.href = '/new'; + return; + }; + return ( @@ -50,24 +70,31 @@ const NewBrew = ()=>{ className='new' color='purple' icon='fa-solid fa-plus-square'> - new + new - from blank + resume draft + + { clearLocalStorage(); }}> + from blank - { document.getElementById('uploadTxt').click(); }}> - from file + from file ); diff --git a/client/homebrew/pages/homePage/homePage.jsx b/client/homebrew/pages/homePage/homePage.jsx index 32401163c..463df333b 100644 --- a/client/homebrew/pages/homePage/homePage.jsx +++ b/client/homebrew/pages/homePage/homePage.jsx @@ -53,8 +53,9 @@ const HomePage =(props)=>{ const [isSaving , setIsSaving] = useState(false); const [autoSaveEnabled , setAutoSaveEnable] = useState(false); - const editorRef = useRef(null); - const lastSavedBrew = useRef(_.cloneDeep(props.brew)); + const editorRef = useRef(null); + const lastSavedBrew = useRef(_.cloneDeep(props.brew)); + const unsavedChangesRef = useRef(unsavedChanges); useEffect(()=>{ fetchThemeBundle(setError, setThemeBundle, currentBrew.renderer, currentBrew.theme); @@ -70,12 +71,20 @@ const HomePage =(props)=>{ }; document.addEventListener('keydown', handleControlKeys); - + window.onbeforeunload = ()=>{ + if(unsavedChangesRef.current) + return 'You have unsaved changes!'; + }; return ()=>{ document.removeEventListener('keydown', handleControlKeys); + window.onbeforeunload = null; }; }, []); + useEffect(()=>{ + unsavedChangesRef.current = unsavedChanges; + }, [unsavedChanges]); + const save = ()=>{ request.post('/api') .send(currentBrew) diff --git a/client/homebrew/pages/newPage/newPage.less b/client/homebrew/pages/newPage/newPage.less index 083e1ee09..d2f07ac40 100644 --- a/client/homebrew/pages/newPage/newPage.less +++ b/client/homebrew/pages/newPage/newPage.less @@ -1,12 +1,15 @@ .newPage { .navItem.save { - .fadeInRight(); - .transition(opacity); background-color : @orange; + transition:all 0.2s; &:hover { background-color : @green; } + &.neverSaved { - .fadeOutRight(); + translate:-100%; opacity: 0; + background-color :#333; + cursor:auto; } } } + diff --git a/package-lock.json b/package-lock.json index c0d6845c3..527a4f94c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13,7 +13,7 @@ "@babel/core": "^7.28.4", "@babel/plugin-transform-runtime": "^7.28.3", "@babel/preset-env": "^7.28.3", - "@babel/preset-react": "^7.27.1", + "@babel/preset-react": "^7.28.5", "@babel/runtime": "^7.28.4", "@dmsnell/diff-match-patch": "^1.1.0", "@googleapis/drive": "^18.0.0", @@ -22,7 +22,7 @@ "classnames": "^2.5.1", "codemirror": "^5.65.6", "cookie-parser": "^1.4.7", - "core-js": "^3.46.0", + "core-js": "^3.47.0", "cors": "^2.8.5", "create-react-class": "^15.7.0", "dedent-tabs": "^0.10.3", @@ -34,29 +34,29 @@ "fs-extra": "11.3.2", "hash-wasm": "^4.12.0", "idb-keyval": "^6.2.2", - "js-yaml": "^4.1.0", + "js-yaml": "^4.1.1", "jwt-simple": "^0.5.6", "less": "^3.13.1", "lodash": "^4.17.21", "marked": "15.0.12", "marked-alignment-paragraphs": "^1.0.0", "marked-definition-lists": "^1.0.1", - "marked-emoji": "^2.0.1", + "marked-emoji": "^2.0.2", "marked-extended-tables": "^2.0.1", - "marked-gfm-heading-id": "^4.1.2", + "marked-gfm-heading-id": "^4.1.3", "marked-nonbreaking-spaces": "^1.0.1", "marked-smartypants-lite": "^1.0.3", "marked-subsuper-text": "^1.0.4", "marked-variables": "^1.0.4", "markedLegacy": "npm:marked@^0.3.19", "moment": "^2.30.1", - "mongoose": "^8.19.1", + "mongoose": "^8.20.0", "nanoid": "5.1.6", "nconf": "^0.13.0", "react": "^18.3.1", "react-dom": "^18.3.1", "react-frame-component": "^4.1.3", - "react-router": "^7.9.4", + "react-router": "^7.9.6", "romans": "^3.1.0", "sanitize-filename": "1.6.3", "superagent": "^10.2.1", @@ -66,8 +66,8 @@ "devDependencies": { "@stylistic/stylelint-plugin": "^4.0.0", "babel-plugin-transform-import-meta": "^2.3.3", - "eslint": "^9.37.0", - "eslint-plugin-jest": "^29.0.1", + "eslint": "^9.39.1", + "eslint-plugin-jest": "^29.1.0", "eslint-plugin-react": "^7.37.5", "globals": "^16.4.0", "jest": "^30.2.0", @@ -1427,9 +1427,9 @@ } }, "node_modules/@babel/plugin-transform-react-display-name": { - "version": "7.27.1", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-react-display-name/-/plugin-transform-react-display-name-7.27.1.tgz", - "integrity": "sha512-p9+Vl3yuHPmkirRrg021XiP+EETmPMQTLr6Ayjj85RLNEbb3Eya/4VI0vAdzQG9SEAl2Lnt7fy5lZyMzjYoZQQ==", + "version": "7.28.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-react-display-name/-/plugin-transform-react-display-name-7.28.0.tgz", + "integrity": "sha512-D6Eujc2zMxKjfa4Zxl4GHMsmhKKZ9VpcqIchJLvwTxad9zWIYulwYItBovpDOoNLISpcZSXoDJ5gaGbQUDqViA==", "license": "MIT", "dependencies": { "@babel/helper-plugin-utils": "^7.27.1" @@ -1795,14 +1795,14 @@ } }, "node_modules/@babel/preset-react": { - "version": "7.27.1", - "resolved": "https://registry.npmjs.org/@babel/preset-react/-/preset-react-7.27.1.tgz", - "integrity": "sha512-oJHWh2gLhU9dW9HHr42q0cI0/iHHXTLGe39qvpAZZzagHy0MzYLCnCVV0symeRvzmjHyVU7mw2K06E6u/JwbhA==", + "version": "7.28.5", + "resolved": "https://registry.npmjs.org/@babel/preset-react/-/preset-react-7.28.5.tgz", + "integrity": "sha512-Z3J8vhRq7CeLjdC58jLv4lnZ5RKFUJWqH5emvxmv9Hv3BD1T9R/Im713R4MTKwvFaV74ejZ3sM01LyEKk4ugNQ==", "license": "MIT", "dependencies": { "@babel/helper-plugin-utils": "^7.27.1", "@babel/helper-validator-option": "^7.27.1", - "@babel/plugin-transform-react-display-name": "^7.27.1", + "@babel/plugin-transform-react-display-name": "^7.28.0", "@babel/plugin-transform-react-jsx": "^7.27.1", "@babel/plugin-transform-react-jsx-development": "^7.27.1", "@babel/plugin-transform-react-pure-annotations": "^7.27.1" @@ -2258,9 +2258,9 @@ } }, "node_modules/@eslint/js": { - "version": "9.39.0", - "resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.39.0.tgz", - "integrity": "sha512-BIhe0sW91JGPiaF1mOuPy5v8NflqfjIcDNpC+LbW9f609WVRX1rArrhi6Z2ymvrAry9jw+5POTj4t2t62o8Bmw==", + "version": "9.39.1", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.39.1.tgz", + "integrity": "sha512-S26Stp4zCy88tH94QbBv3XCuzRQiZ9yXofEILmglYTh/Ug/a9/umqvgFtYBAo3Lp0nsI/5/qH1CCrbdK3AP1Tw==", "dev": true, "license": "MIT", "engines": { @@ -5343,9 +5343,9 @@ } }, "node_modules/core-js": { - "version": "3.46.0", - "resolved": "https://registry.npmjs.org/core-js/-/core-js-3.46.0.tgz", - "integrity": "sha512-vDMm9B0xnqqZ8uSBpZ8sNtRtOdmfShrvT6h2TuQGLs0Is+cR0DYbj/KWP6ALVNbWPpqA/qPLoOuppJN07humpA==", + "version": "3.47.0", + "resolved": "https://registry.npmjs.org/core-js/-/core-js-3.47.0.tgz", + "integrity": "sha512-c3Q2VVkGAUyupsjRnaNX6u8Dq2vAdzm9iuPj5FW0fRxzlxgq9Q39MDq10IvmQSpLgHQNyQzQmOo6bgGHmH3NNg==", "hasInstallScript": true, "license": "MIT", "funding": { @@ -6259,9 +6259,9 @@ } }, "node_modules/eslint": { - "version": "9.39.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-9.39.0.tgz", - "integrity": "sha512-iy2GE3MHrYTL5lrCtMZ0X1KLEKKUjmK0kzwcnefhR66txcEmXZD2YWgR5GNdcEwkNx3a0siYkSvl0vIC+Svjmg==", + "version": "9.39.1", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-9.39.1.tgz", + "integrity": "sha512-BhHmn2yNOFA9H9JmmIVKJmd288g9hrVRDkdoIgRCRuSySRUHH7r/DI6aAXW9T1WwUuY3DFgrcaqB+deURBLR5g==", "dev": true, "license": "MIT", "dependencies": { @@ -6271,7 +6271,7 @@ "@eslint/config-helpers": "^0.4.2", "@eslint/core": "^0.17.0", "@eslint/eslintrc": "^3.3.1", - "@eslint/js": "9.39.0", + "@eslint/js": "9.39.1", "@eslint/plugin-kit": "^0.4.1", "@humanfs/node": "^0.16.6", "@humanwhocodes/module-importer": "^1.0.1", @@ -6319,9 +6319,9 @@ } }, "node_modules/eslint-plugin-jest": { - "version": "29.0.1", - "resolved": "https://registry.npmjs.org/eslint-plugin-jest/-/eslint-plugin-jest-29.0.1.tgz", - "integrity": "sha512-EE44T0OSMCeXhDrrdsbKAhprobKkPtJTbQz5yEktysNpHeDZTAL1SfDTNKmcFfJkY6yrQLtTKZALrD3j/Gpmiw==", + "version": "29.1.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-jest/-/eslint-plugin-jest-29.1.0.tgz", + "integrity": "sha512-LabxXbASXVjguqL+kBHTPMf3gUeSqwH4fsrEyHTY/MCs42I/p9+ctg09SJpYiD8eGaIsP6GwYr5xW6xWS9XgZg==", "dev": true, "license": "MIT", "dependencies": { @@ -9466,9 +9466,9 @@ "license": "MIT" }, "node_modules/js-yaml": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", - "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.1.tgz", + "integrity": "sha512-qQKT4zQxXl8lLwBtHMWwaTcGfFOZviOJet3Oy/xmGk2gZH677CJM9EvtfdSkgWcATZhj/55JZ0rmy3myCT5lsA==", "license": "MIT", "dependencies": { "argparse": "^2.0.1" @@ -10026,12 +10026,12 @@ } }, "node_modules/marked-emoji": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/marked-emoji/-/marked-emoji-2.0.1.tgz", - "integrity": "sha512-P+nRr02dD+yPOFhtGdaVBzp0qzwlksI2f5GumIdHW/3UadzJ5sVi78CZikiSLr9PmdtUOZodZUBNIO6k38pDMQ==", + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/marked-emoji/-/marked-emoji-2.0.2.tgz", + "integrity": "sha512-EFnLQn4wTyf+6pXfptkm83Z2mt3VbdEYedHBAsDpwUas5n5satsj42RGqAijBpmetgGerI1EzUuzf7NIccINUQ==", "license": "MIT", "peerDependencies": { - "marked": ">=4 <17" + "marked": ">=4 <18" } }, "node_modules/marked-extended-tables": { @@ -10044,15 +10044,15 @@ } }, "node_modules/marked-gfm-heading-id": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/marked-gfm-heading-id/-/marked-gfm-heading-id-4.1.2.tgz", - "integrity": "sha512-EQ1WiEGHJh0C8viU+hbXbhHyWTDgEia2i96fiSemm2wdYER6YBw/9QI5TB6YFTqFfmMOxBFXPcPJtlgD0fVV2w==", + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/marked-gfm-heading-id/-/marked-gfm-heading-id-4.1.3.tgz", + "integrity": "sha512-aR0i63LmFbuxU/gAgrgz1Ir+8HK6zAIFXMlckeKHpV+qKbYaOP95L4Ux5Gi+sKmCZU5qnN2rdKpvpb7PnUBIWg==", "license": "MIT", "dependencies": { "github-slugger": "^2.0.0" }, "peerDependencies": { - "marked": ">=13 <17" + "marked": ">=13 <18" } }, "node_modules/marked-nonbreaking-spaces": { @@ -10436,9 +10436,9 @@ } }, "node_modules/mongoose": { - "version": "8.19.2", - "resolved": "https://registry.npmjs.org/mongoose/-/mongoose-8.19.2.tgz", - "integrity": "sha512-ww2T4dBV+suCbOfG5YPwj9pLCfUVyj8FEA1D3Ux1HHqutpLxGyOYEPU06iPRBW4cKr3PJfOSYsIpHWPTkz5zig==", + "version": "8.20.0", + "resolved": "https://registry.npmjs.org/mongoose/-/mongoose-8.20.0.tgz", + "integrity": "sha512-SxqNb8yx+VOjIOx2l7HqkGvYuLC/T85d+jPvqGDdUbKJFz/5PVSsVxQzypQsX7chenYvq5bd8jIr4LtunedE7g==", "license": "MIT", "dependencies": { "bson": "^6.10.4", @@ -12065,9 +12065,9 @@ "license": "MIT" }, "node_modules/react-router": { - "version": "7.9.5", - "resolved": "https://registry.npmjs.org/react-router/-/react-router-7.9.5.tgz", - "integrity": "sha512-JmxqrnBZ6E9hWmf02jzNn9Jm3UqyeimyiwzD69NjxGySG6lIz/1LVPsoTCwN7NBX2XjCEa1LIX5EMz1j2b6u6A==", + "version": "7.9.6", + "resolved": "https://registry.npmjs.org/react-router/-/react-router-7.9.6.tgz", + "integrity": "sha512-Y1tUp8clYRXpfPITyuifmSoE2vncSME18uVLgaqyxh9H35JWpIfzHo+9y3Fzh5odk/jxPW29IgLgzcdwxGqyNA==", "license": "MIT", "dependencies": { "cookie": "^1.0.1", diff --git a/package.json b/package.json index b4b86693d..38b24a7a4 100644 --- a/package.json +++ b/package.json @@ -88,7 +88,7 @@ "@babel/core": "^7.28.4", "@babel/plugin-transform-runtime": "^7.28.3", "@babel/preset-env": "^7.28.3", - "@babel/preset-react": "^7.27.1", + "@babel/preset-react": "^7.28.5", "@babel/runtime": "^7.28.4", "@dmsnell/diff-match-patch": "^1.1.0", "@googleapis/drive": "^18.0.0", @@ -97,7 +97,7 @@ "classnames": "^2.5.1", "codemirror": "^5.65.6", "cookie-parser": "^1.4.7", - "core-js": "^3.46.0", + "core-js": "^3.47.0", "cors": "^2.8.5", "create-react-class": "^15.7.0", "dedent-tabs": "^0.10.3", @@ -109,29 +109,29 @@ "fs-extra": "11.3.2", "hash-wasm": "^4.12.0", "idb-keyval": "^6.2.2", - "js-yaml": "^4.1.0", + "js-yaml": "^4.1.1", "jwt-simple": "^0.5.6", "less": "^3.13.1", "lodash": "^4.17.21", "marked": "15.0.12", "marked-alignment-paragraphs": "^1.0.0", "marked-definition-lists": "^1.0.1", - "marked-emoji": "^2.0.1", + "marked-emoji": "^2.0.2", "marked-extended-tables": "^2.0.1", - "marked-gfm-heading-id": "^4.1.2", + "marked-gfm-heading-id": "^4.1.3", "marked-nonbreaking-spaces": "^1.0.1", "marked-smartypants-lite": "^1.0.3", "marked-subsuper-text": "^1.0.4", "marked-variables": "^1.0.4", "markedLegacy": "npm:marked@^0.3.19", "moment": "^2.30.1", - "mongoose": "^8.19.1", + "mongoose": "^8.20.0", "nanoid": "5.1.6", "nconf": "^0.13.0", "react": "^18.3.1", "react-dom": "^18.3.1", "react-frame-component": "^4.1.3", - "react-router": "^7.9.4", + "react-router": "^7.9.6", "romans": "^3.1.0", "sanitize-filename": "1.6.3", "superagent": "^10.2.1", @@ -141,8 +141,8 @@ "devDependencies": { "@stylistic/stylelint-plugin": "^4.0.0", "babel-plugin-transform-import-meta": "^2.3.3", - "eslint": "^9.37.0", - "eslint-plugin-jest": "^29.0.1", + "eslint": "^9.39.1", + "eslint-plugin-jest": "^29.1.0", "eslint-plugin-react": "^7.37.5", "globals": "^16.4.0", "jest": "^30.2.0", diff --git a/shared/markdown.js b/shared/markdown.js index 412be27a7..eecc945f9 100644 --- a/shared/markdown.js +++ b/shared/markdown.js @@ -31,7 +31,12 @@ renderer.html = function (token) { const openTag = html.substring(0, html.indexOf('>')+1); html = html.substring(html.indexOf('>')+1); html = html.substring(0, html.lastIndexOf('')); - return `${openTag} ${Marked.parse(html)} `; + + // Repeat the markdown processing for content inside the div, minus the preprocessing and postprocessing hooks which should only run once globally + const opts = Marked.defaults; + const tokens = Marked.lexer(html, opts); + Marked.walkTokens(tokens, opts.walkTokens); + return `${openTag} ${Marked.parser(tokens, opts)} `; } return html; }; diff --git a/themes/V3/Blank/style.less b/themes/V3/Blank/style.less index 858ecebfb..4c65304b3 100644 --- a/themes/V3/Blank/style.less +++ b/themes/V3/Blank/style.less @@ -492,7 +492,7 @@ body { counter-reset : page-numbers 0; } .pageNumber { left : 30px; } } - .resetCounting { counter-set : page-numbers 1; } + &:has(.resetCounting) { counter-set : page-numbers 1; } &:not(:has(.skipCounting)) { counter-increment : page-numbers; } diff --git a/themes/V3/UnearthedArcana/settings.json b/themes/V3/UnearthedArcana/settings.json index 273f0bb2f..21b1342a3 100644 --- a/themes/V3/UnearthedArcana/settings.json +++ b/themes/V3/UnearthedArcana/settings.json @@ -1,6 +1,6 @@ { "name" : "UnearthedArcana", "renderer" : "V3", - "baseTheme" : false, + "baseTheme" : "Blank", "baseSnippets" : false } diff --git a/themes/themes.json b/themes/themes.json index 7e01b180c..7cabe8486 100644 --- a/themes/themes.json +++ b/themes/themes.json @@ -39,7 +39,7 @@ "UnearthedArcana": { "name": "UnearthedArcana", "renderer": "V3", - "baseTheme": false, + "baseTheme": "Blank", "baseSnippets": false, "path": "UnearthedArcana" }