diff --git a/client/template.js b/client/template.js index cab4790b9..e8ac8e22f 100644 --- a/client/template.js +++ b/client/template.js @@ -11,6 +11,7 @@ const template = async function(name, title='', props = {}){ return ` + diff --git a/package-lock.json b/package-lock.json index d67e545a1..e903a3cb9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -35,7 +35,7 @@ "marked-smartypants-lite": "^1.0.0", "markedLegacy": "npm:marked@^0.3.19", "moment": "^2.29.4", - "mongoose": "^7.4.1", + "mongoose": "^7.4.2", "nanoid": "3.3.4", "nconf": "^0.12.0", "npm": "^9.8.1", @@ -10204,9 +10204,9 @@ } }, "node_modules/mongoose": { - "version": "7.4.1", - "resolved": "https://registry.npmjs.org/mongoose/-/mongoose-7.4.1.tgz", - "integrity": "sha512-o3E5KHHiHdaiwCJG3+9r70sncRKki71Ktf/TfXdW6myu+53rtZ56uLl5ylkQiCf60V3COJuOeekcxXVsjQ7cBA==", + "version": "7.4.2", + "resolved": "https://registry.npmjs.org/mongoose/-/mongoose-7.4.2.tgz", + "integrity": "sha512-sNolW2hyncwvWmZjIEIwAckjaSKtC1SE86zE1v2TKm3vPTRogZfBQf+3zLYYdrgrVTzoaoICieVpct9hjcn3EQ==", "dependencies": { "bson": "^5.4.0", "kareem": "2.5.1", diff --git a/package.json b/package.json index 7a2f333d2..45251a723 100644 --- a/package.json +++ b/package.json @@ -103,7 +103,7 @@ "marked-smartypants-lite": "^1.0.0", "markedLegacy": "npm:marked@^0.3.19", "moment": "^2.29.4", - "mongoose": "^7.4.1", + "mongoose": "^7.4.2", "nanoid": "3.3.4", "nconf": "^0.12.0", "npm": "^9.8.1", diff --git a/shared/naturalcrit/codeEditor/codeEditor.less b/shared/naturalcrit/codeEditor/codeEditor.less index 1334299e4..80af543d9 100644 --- a/shared/naturalcrit/codeEditor/codeEditor.less +++ b/shared/naturalcrit/codeEditor/codeEditor.less @@ -9,6 +9,9 @@ } .codeEditor{ + @media screen and (pointer : coarse) { + font-size : 16px; + } .CodeMirror-foldmarker { font-family: inherit; text-shadow: none; diff --git a/shared/naturalcrit/splitPane/splitPane.jsx b/shared/naturalcrit/splitPane/splitPane.jsx index 38f84b220..c4cd207c2 100644 --- a/shared/naturalcrit/splitPane/splitPane.jsx +++ b/shared/naturalcrit/splitPane/splitPane.jsx @@ -61,7 +61,8 @@ const SplitPane = createClass({ return result; }, - handleUp : function(){ + handleUp : function(e){ + e.preventDefault(); if(this.state.isDragging){ this.props.onDragFinish(this.state.currentDividerPos); window.localStorage.setItem(this.props.storageKey, this.state.currentDividerPos); @@ -76,6 +77,7 @@ const SplitPane = createClass({ }, handleMove : function(e){ + e.preventDefault(); if(!this.state.isDragging) return; const newSize = this.limitPosition(e.pageX); @@ -122,7 +124,7 @@ const SplitPane = createClass({ renderDivider : function(){ return <> {this.renderMoveArrows()} -
+
@@ -133,7 +135,7 @@ const SplitPane = createClass({ }, render : function(){ - return
+ return
_.padEnd(f, 21)); // Pad to equal length of 21 chars long + +const classnames = [ + 'Ackerman', 'Berserker-Typist', 'Concierge', 'Fishmonger', + 'Haberdasher', 'Manicurist', 'Netrunner', 'Weirkeeper' ]; -const classnames = ['Ackerman', 'Berserker-Typist', 'Concierge', 'Fishmonger', - 'Haberdasher', 'Manicurist', 'Netrunner', 'Weirkeeper']; - -const levels = ['1st', '2nd', '3rd', '4th', '5th', - '6th', '7th', '8th', '9th', '10th', - '11th', '12th', '13th', '14th', '15th', - '16th', '17th', '18th', '19th', '20th']; - -const profBonus = [2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6]; - -const maxes = [4, 3, 3, 3, 3, 2, 2, 1, 1]; - -const drawSlots = function(Slots, rows, padding){ - let slots = Number(Slots); - return _.times(rows, function(i){ - const max = maxes[i]; - if(slots < 1) return _.pad('—', padding); - const res = _.min([max, slots]); - slots -= res; - return _.pad(res.toString(), padding); - }).join(' | '); -}; - module.exports = { - full : function(classes){ - const classname = _.sample(classnames); - - - let cantrips = 3; - let spells = 1; - let slots = 2; - return `{{${classes}\n##### The ${classname}\n` + - `| Level | Proficiency | Features | Cantrips | Spells | --- Spell Slots Per Spell Level ---|||||||||\n`+ - `| ^| Bonus ^| ^| Known ^| Known ^|1st |2nd |3rd |4th |5th |6th |7th |8th |9th |\n`+ - `|:-----:|:-----------:|:-------------|:--------:|:------:|:--:|:--:|:--:|:--:|:--:|:--:|:--:|:--:|:--:|\n${ - _.map(levels, function(levelName, level){ - const res = [ - _.pad(levelName, 5), - _.pad(`+${profBonus[level]}`, 2), - _.padEnd(_.sample(features), 21), - _.pad(cantrips.toString(), 8), - _.pad(spells.toString(), 6), - drawSlots(slots, 9, 2), - ].join(' | '); - - cantrips += _.random(0, 1); - spells += _.random(0, 1); - slots += _.random(0, 2); - - return `| ${res} |`; - }).join('\n')}\n}}\n\n`; + non : function(snippetClasses){ + return dedent` + {{${snippetClasses} + ##### The ${_.sample(classnames)} + | Level | Proficiency Bonus | Features | ${_.sample(features)} | + |:-----:|:-----------------:|:---------|:---------------------:| + | 1st | +2 | ${_.sample(features)} | 2 | + | 2nd | +2 | ${_.sample(features)} | 2 | + | 3rd | +2 | ${_.sample(features)} | 3 | + | 4th | +2 | ${_.sample(features)} | 3 | + | 5th | +3 | ${_.sample(features)} | 3 | + | 6th | +3 | ${_.sample(features)} | 4 | + | 7th | +3 | ${_.sample(features)} | 4 | + | 8th | +3 | ${_.sample(features)} | 4 | + | 9th | +4 | ${_.sample(features)} | 4 | + | 10th | +4 | ${_.sample(features)} | 4 | + | 11th | +4 | ${_.sample(features)} | 4 | + | 12th | +4 | ${_.sample(features)} | 5 | + | 13th | +5 | ${_.sample(features)} | 5 | + | 14th | +5 | ${_.sample(features)} | 5 | + | 15th | +5 | ${_.sample(features)} | 5 | + | 16th | +5 | ${_.sample(features)} | 5 | + | 17th | +6 | ${_.sample(features)} | 6 | + | 18th | +6 | ${_.sample(features)} | 6 | + | 19th | +6 | ${_.sample(features)} | 6 | + | 20th | +6 | ${_.sample(features)} | unlimited | + }}\n\n`; }, - half : function(classes){ - const classname = _.sample(classnames); - - let featureScore = 1; - return `{{${classes}\n##### The ${classname}\n` + - `| Level | Proficiency Bonus | Features | ${_.pad(_.sample(features), 21)} |\n` + - `|:-----:|:-----------------:|:---------|:---------------------:|\n${ - _.map(levels, function(levelName, level){ - const res = [ - _.pad(levelName, 5), - _.pad(`+${profBonus[level]}`, 2), - _.padEnd(_.sample(features), 23), - _.pad(`+${featureScore}`, 21), - ].join(' | '); - - featureScore += _.random(0, 1); - - return `| ${res} |`; - }).join('\n')}\n}}\n\n`; + full : function(snippetClasses){ + return dedent` + {{${snippetClasses} + ##### The ${_.sample(classnames)} + | Level | Proficiency | Features | Cantrips | --- Spell Slots Per Spell Level ---||||||||| + | ^| Bonus ^| ^| Known ^|1st |2nd |3rd |4th |5th |6th |7th |8th |9th | + |:-----:|:-----------:|:-------------|:--------:|:--:|:--:|:--:|:--:|:--:|:--:|:--:|:--:|:--:| + | 1st | +2 | ${_.sample(features)} | 2 | 2 | — | — | — | — | — | — | — | — | + | 2nd | +2 | ${_.sample(features)} | 2 | 3 | — | — | — | — | — | — | — | — | + | 3rd | +2 | ${_.sample(features)} | 2 | 4 | 2 | — | — | — | — | — | — | — | + | 4th | +2 | ${_.sample(features)} | 3 | 4 | 3 | — | — | — | — | — | — | — | + | 5th | +3 | ${_.sample(features)} | 3 | 4 | 3 | 2 | — | — | — | — | — | — | + | 6th | +3 | ${_.sample(features)} | 3 | 4 | 3 | 3 | — | — | — | — | — | — | + | 7th | +3 | ${_.sample(features)} | 3 | 4 | 3 | 3 | 1 | — | — | — | — | — | + | 8th | +3 | ${_.sample(features)} | 3 | 4 | 3 | 3 | 2 | — | — | — | — | — | + | 9th | +4 | ${_.sample(features)} | 3 | 4 | 3 | 3 | 2 | 1 | — | — | — | — | + | 10th | +4 | ${_.sample(features)} | 3 | 4 | 3 | 3 | 2 | 1 | — | — | — | — | + | 11th | +4 | ${_.sample(features)} | 4 | 4 | 3 | 3 | 2 | 1 | 1 | — | — | — | + | 12th | +4 | ${_.sample(features)} | 4 | 4 | 3 | 3 | 2 | 1 | 1 | — | — | — | + | 13th | +5 | ${_.sample(features)} | 4 | 4 | 3 | 3 | 2 | 1 | 1 | 1 | — | — | + | 14th | +5 | ${_.sample(features)} | 4 | 4 | 3 | 3 | 2 | 1 | 1 | 1 | — | — | + | 15th | +5 | ${_.sample(features)} | 4 | 4 | 3 | 3 | 2 | 1 | 1 | 1 | 1 | — | + | 16th | +5 | ${_.sample(features)} | 4 | 4 | 3 | 3 | 2 | 1 | 1 | 1 | 1 | — | + | 17th | +6 | ${_.sample(features)} | 4 | 4 | 3 | 3 | 2 | 1 | 1 | 1 | 1 | 1 | + | 18th | +6 | ${_.sample(features)} | 4 | 4 | 3 | 3 | 3 | 1 | 1 | 1 | 1 | 1 | + | 19th | +6 | ${_.sample(features)} | 4 | 4 | 3 | 3 | 3 | 2 | 2 | 1 | 1 | 1 | + | 20th | +6 | ${_.sample(features)} | 4 | 4 | 3 | 3 | 3 | 2 | 2 | 2 | 1 | 1 | + }}\n\n`; }, - third : function(classes){ - const classname = _.sample(classnames); + half : function(snippetClasses){ + return dedent` + {{${snippetClasses} + ##### The ${_.sample(classnames)} + | Level | Proficiency | Features | Spells |--- Spell Slots Per Spell Level ---||||| + | ^| Bonus ^| ^| Known ^| 1st | 2nd | 3rd | 4th | 5th | + |:-----:|:-----------:|:-------------|:------:|:-----:|:-----:|:-----:|:-----:|:-----:| + | 1st | +2 | ${_.sample(features)} | — | — | — | — | — | — | + | 2nd | +2 | ${_.sample(features)} | 2 | 2 | — | — | — | — | + | 3rd | +2 | ${_.sample(features)} | 3 | 3 | — | — | — | — | + | 4th | +2 | ${_.sample(features)} | 3 | 3 | — | — | — | — | + | 5th | +3 | ${_.sample(features)} | 4 | 4 | 2 | — | — | — | + | 6th | +3 | ${_.sample(features)} | 4 | 4 | 2 | — | — | — | + | 7th | +3 | ${_.sample(features)} | 5 | 4 | 3 | — | — | — | + | 8th | +3 | ${_.sample(features)} | 5 | 4 | 3 | — | — | — | + | 9th | +4 | ${_.sample(features)} | 6 | 4 | 3 | 2 | — | — | + | 10th | +4 | ${_.sample(features)} | 6 | 4 | 3 | 2 | — | — | + | 11th | +4 | ${_.sample(features)} | 7 | 4 | 3 | 3 | — | — | + | 12th | +4 | ${_.sample(features)} | 7 | 4 | 3 | 3 | — | — | + | 13th | +5 | ${_.sample(features)} | 8 | 4 | 3 | 3 | 1 | — | + | 14th | +5 | ${_.sample(features)} | 8 | 4 | 3 | 3 | 1 | — | + | 15th | +5 | ${_.sample(features)} | 9 | 4 | 3 | 3 | 2 | — | + | 16th | +5 | ${_.sample(features)} | 9 | 4 | 3 | 3 | 2 | — | + | 17th | +6 | ${_.sample(features)} | 10 | 4 | 3 | 3 | 3 | 1 | + | 18th | +6 | ${_.sample(features)} | 10 | 4 | 3 | 3 | 3 | 1 | + | 19th | +6 | ${_.sample(features)} | 11 | 4 | 3 | 3 | 3 | 2 | + | 20th | +6 | ${_.sample(features)} | 11 | 4 | 3 | 3 | 3 | 2 | + }}\n\n`; + }, - let cantrips = 3; - let spells = 1; - let slots = 2; - return `{{${classes}\n##### ${classname} Spellcasting\n` + - `| Class | Cantrips | Spells |--- Spells Slots per Spell Level ---||||\n` + - `| Level ^| Known ^| Known ^| 1st | 2nd | 3rd | 4th |\n` + - `|:------:|:--------:|:-------:|:-------:|:-------:|:-------:|:-------:|\n${ - _.map(levels, function(levelName, level){ - const res = [ - _.pad(levelName, 6), - _.pad(cantrips.toString(), 8), - _.pad(spells.toString(), 7), - drawSlots(slots, 4, 7), - ].join(' | '); - - cantrips += _.random(0, 1); - spells += _.random(0, 1); - slots += _.random(0, 1); - - return `| ${res} |`; - }).join('\n')}\n}}\n\n`; + third : function(snippetClasses){ + return dedent` + {{${snippetClasses} + ##### ${_.sample(classnames)} Spellcasting + | Level | Cantrips | Spells |--- Spells Slots per Spell Level ---|||| + | ^| Known ^| Known ^| 1st | 2nd | 3rd | 4th | + |:-----:|:--------:|:------:|:-------:|:-------:|:-------:|:-------:| + | 3rd | 2 | 3 | 2 | — | — | — | + | 4th | 2 | 4 | 3 | — | — | — | + | 5th | 2 | 4 | 3 | — | — | — | + | 6th | 2 | 4 | 3 | — | — | — | + | 7th | 2 | 5 | 4 | 2 | — | — | + | 8th | 2 | 6 | 4 | 2 | — | — | + | 9th | 2 | 6 | 4 | 2 | — | — | + | 10th | 3 | 7 | 4 | 3 | — | — | + | 11th | 3 | 8 | 4 | 3 | — | — | + | 12th | 3 | 8 | 4 | 3 | — | — | + | 13th | 3 | 9 | 4 | 3 | 2 | — | + | 14th | 3 | 10 | 4 | 3 | 2 | — | + | 15th | 3 | 10 | 4 | 3 | 2 | — | + | 16th | 3 | 11 | 4 | 3 | 3 | — | + | 17th | 3 | 11 | 4 | 3 | 3 | — | + | 18th | 3 | 11 | 4 | 3 | 3 | — | + | 19th | 3 | 12 | 4 | 3 | 3 | 1 | + | 20th | 3 | 13 | 4 | 3 | 3 | 1 | + }}\n\n`; } }; diff --git a/themes/V3/5ePHB/snippets/tableOfContents.gen.js b/themes/V3/5ePHB/snippets/tableOfContents.gen.js index 44605c05d..97d82ed40 100644 --- a/themes/V3/5ePHB/snippets/tableOfContents.gen.js +++ b/themes/V3/5ePHB/snippets/tableOfContents.gen.js @@ -29,21 +29,23 @@ const getTOC = (pages)=>{ const res = []; _.each(pages, (page, pageNum)=>{ - const lines = page.split('\n'); - _.each(lines, (line)=>{ - if(_.startsWith(line, '# ')){ - const title = line.replace('# ', ''); - add1(title, pageNum); - } - if(_.startsWith(line, '## ')){ - const title = line.replace('## ', ''); - add2(title, pageNum); - } - if(_.startsWith(line, '### ')){ - const title = line.replace('### ', ''); - add3(title, pageNum); - } - }); + if(!page.includes("{{frontCover}}") && !page.includes("{{insideCover}}") && !page.includes("{{partCover}}") && !page.includes("{{backCover}}")) { + const lines = page.split('\n'); + _.each(lines, (line)=>{ + if(_.startsWith(line, '# ')){ + const title = line.replace('# ', ''); + add1(title, pageNum); + } + if(_.startsWith(line, '## ')){ + const title = line.replace('## ', ''); + add2(title, pageNum); + } + if(_.startsWith(line, '### ')){ + const title = line.replace('### ', ''); + add3(title, pageNum); + } + }); + } }); return res; };