',
@@ -202,7 +187,7 @@ module.exports = [
},
{
name : 'Split Table',
- icon : 'fa-th-large',
+ icon : 'fas fa-th-large',
gen : function(){
return [
'
',
@@ -238,11 +223,11 @@ module.exports = [
{
groupName : 'Print',
- icon : 'fa-print',
+ icon : 'fas fa-print',
snippets : [
{
name : 'A4 PageSize',
- icon : 'fa-file-o',
+ icon : 'far fa-file',
gen : ['
+
+
+
+# ${_.sample(titles)}
+
+
+
+##### ${_.sample(subtitles)}
+
+
+\\page`;
+};
\ No newline at end of file
diff --git a/client/homebrew/editor/snippetbar/snippetsLegacy/fullclass.gen.js b/client/homebrew/editor/snippetbar/snippetsLegacy/fullclass.gen.js
new file mode 100644
index 0000000000..5ede9e501f
--- /dev/null
+++ b/client/homebrew/editor/snippetbar/snippetsLegacy/fullclass.gen.js
@@ -0,0 +1,43 @@
+const _ = require('lodash');
+
+const ClassFeatureGen = require('./classfeature.gen.js');
+
+const ClassTableGen = require('./classtable.gen.js');
+
+module.exports = function(){
+
+ const classname = _.sample(['Archivist', 'Fancyman', 'Linguist', 'Fletcher',
+ 'Notary', 'Berserker-Typist', 'Fishmongerer', 'Manicurist', 'Haberdasher', 'Concierge']);
+
+
+ const image = _.sample(_.map([
+ 'http://orig01.deviantart.net/4682/f/2007/099/f/c/bard_stick_figure_by_wrpigeek.png',
+ 'http://img07.deviantart.net/a3c9/i/2007/099/3/a/archer_stick_figure_by_wrpigeek.png',
+ 'http://pre04.deviantart.net/d596/th/pre/f/2007/099/5/2/adventurer_stick_figure_by_wrpigeek.png',
+ 'http://img13.deviantart.net/d501/i/2007/099/d/4/black_mage_stick_figure_by_wrpigeek.png',
+ 'http://img09.deviantart.net/5cf3/i/2007/099/d/d/dark_knight_stick_figure_by_wrpigeek.png',
+ 'http://pre01.deviantart.net/7a34/th/pre/f/2007/099/6/3/monk_stick_figure_by_wrpigeek.png',
+ 'http://img11.deviantart.net/5dcc/i/2007/099/d/1/mystic_knight_stick_figure_by_wrpigeek.png',
+ 'http://pre08.deviantart.net/ad45/th/pre/f/2007/099/a/0/thief_stick_figure_by_wrpigeek.png',
+ ], function(url){
+ return `
`;
+ }));
+
+
+ return `${[
+ image,
+ '',
+ '```',
+ '```',
+ '
\n\n',
+ `## ${classname}`,
+ 'Cool intro stuff will go here',
+
+ '\\page',
+ ClassTableGen(classname),
+ ClassFeatureGen(classname),
+
+
+
+ ].join('\n')}\n\n\n`;
+};
\ No newline at end of file
diff --git a/client/homebrew/editor/snippetbar/snippetsLegacy/magic.gen.js b/client/homebrew/editor/snippetbar/snippetsLegacy/magic.gen.js
new file mode 100644
index 0000000000..ed17f86922
--- /dev/null
+++ b/client/homebrew/editor/snippetbar/snippetsLegacy/magic.gen.js
@@ -0,0 +1,91 @@
+const _ = require('lodash');
+
+const spellNames = [
+ 'Astral Rite of Acne',
+ 'Create Acne',
+ 'Cursed Ramen Erruption',
+ 'Dark Chant of the Dentists',
+ 'Erruption of Immaturity',
+ 'Flaming Disc of Inconvenience',
+ 'Heal Bad Hygene',
+ 'Heavenly Transfiguration of the Cream Devil',
+ 'Hellish Cage of Mucus',
+ 'Irritate Peanut Butter Fairy',
+ 'Luminous Erruption of Tea',
+ 'Mystic Spell of the Poser',
+ 'Sorcerous Enchantment of the Chimneysweep',
+ 'Steak Sauce Ray',
+ 'Talk to Groupie',
+ 'Astonishing Chant of Chocolate',
+ 'Astounding Pasta Puddle',
+ 'Ball of Annoyance',
+ 'Cage of Yarn',
+ 'Control Noodles Elemental',
+ 'Create Nervousness',
+ 'Cure Baldness',
+ 'Cursed Ritual of Bad Hair',
+ 'Dispell Piles in Dentist',
+ 'Eliminate Florists',
+ 'Illusionary Transfiguration of the Babysitter',
+ 'Necromantic Armor of Salad Dressing',
+ 'Occult Transfiguration of Foot Fetish',
+ 'Protection from Mucus Giant',
+ 'Tinsel Blast',
+ 'Alchemical Evocation of the Goths',
+ 'Call Fangirl',
+ 'Divine Spell of Crossdressing',
+ 'Dominate Ramen Giant',
+ 'Eliminate Vindictiveness in Gym Teacher',
+ 'Extra-Planar Spell of Irritation',
+ 'Induce Whining in Babysitter',
+ 'Invoke Complaining',
+ 'Magical Enchantment of Arrogance',
+ 'Occult Globe of Salad Dressing',
+ 'Overwhelming Enchantment of the Chocolate Fairy',
+ 'Sorcerous Dandruff Globe',
+ 'Spiritual Invocation of the Costumers',
+ 'Ultimate Rite of the Confetti Angel',
+ 'Ultimate Ritual of Mouthwash',
+];
+
+module.exports = {
+
+ spellList : function(){
+ const levels = ['Cantrips (0 Level)', '2nd Level', '3rd Level', '4th Level', '5th Level', '6th Level', '7th Level', '8th Level', '9th Level'];
+
+ const content = _.map(levels, (level)=>{
+ const spells = _.map(_.sampleSize(spellNames, _.random(5, 15)), (spell)=>{
+ return `- ${spell}`;
+ }).join('\n');
+ return `##### ${level} \n${spells} \n`;
+ }).join('\n');
+
+ return `
\n${content}\n
`;
+ },
+
+ spell : function(){
+ const level = ['1st', '2nd', '3rd', '4th', '5th', '6th', '7th', '8th', '9th'];
+ const spellSchools = ['abjuration', 'conjuration', 'divination', 'enchantment', 'evocation', 'illusion', 'necromancy', 'transmutation'];
+
+
+ let components = _.sampleSize(['V', 'S', 'M'], _.random(1, 3)).join(', ');
+ if(components.indexOf('M') !== -1){
+ components += ` (${_.sampleSize(['a small doll', 'a crushed button worth at least 1cp', 'discarded gum wrapper'], _.random(1, 3)).join(', ')})`;
+ }
+
+ return [
+ `#### ${_.sample(spellNames)}`,
+ `*${_.sample(level)}-level ${_.sample(spellSchools)}*`,
+ '___',
+ '- **Casting Time:** 1 action',
+ `- **Range:** ${_.sample(['Self', 'Touch', '30 feet', '60 feet'])}`,
+ `- **Components:** ${components}`,
+ `- **Duration:** ${_.sample(['Until dispelled', '1 round', 'Instantaneous', 'Concentration, up to 10 minutes', '1 hour'])}`,
+ '',
+ 'A flame, equivalent in brightness to a torch, springs from from an object that you touch. ',
+ 'The effect look like a regular flame, but it creates no heat and doesn\'t use oxygen. ',
+ 'A *continual flame* can be covered or hidden but not smothered or quenched.',
+ '\n\n\n'
+ ].join('\n');
+ }
+};
\ No newline at end of file
diff --git a/client/homebrew/editor/snippetbar/snippetsLegacy/monsterblock.gen.js b/client/homebrew/editor/snippetbar/snippetsLegacy/monsterblock.gen.js
new file mode 100644
index 0000000000..1e8a0eebd4
--- /dev/null
+++ b/client/homebrew/editor/snippetbar/snippetsLegacy/monsterblock.gen.js
@@ -0,0 +1,200 @@
+const _ = require('lodash');
+
+const genList = function(list, max){
+ return _.sampleSize(list, _.random(0, max)).join(', ') || 'None';
+};
+
+const getMonsterName = function(){
+ return _.sample([
+ 'All-devouring Baseball Imp',
+ 'All-devouring Gumdrop Wraith',
+ 'Chocolate Hydra',
+ 'Devouring Peacock',
+ 'Economy-sized Colossus of the Lemonade Stand',
+ 'Ghost Pigeon',
+ 'Gibbering Duck',
+ 'Sparklemuffin Peacock Spider',
+ 'Gum Elemental',
+ 'Illiterate Construct of the Candy Store',
+ 'Ineffable Chihuahua',
+ 'Irritating Death Hamster',
+ 'Irritating Gold Mouse',
+ 'Juggernaut Snail',
+ 'Juggernaut of the Sock Drawer',
+ 'Koala of the Cosmos',
+ 'Mad Koala of the West',
+ 'Milk Djinni of the Lemonade Stand',
+ 'Mind Ferret',
+ 'Mystic Salt Spider',
+ 'Necrotic Halitosis Angel',
+ 'Pinstriped Famine Sheep',
+ 'Ritalin Leech',
+ 'Shocker Kangaroo',
+ 'Stellar Tennis Juggernaut',
+ 'Wailing Quail of the Sun',
+ 'Angel Pigeon',
+ 'Anime Sphinx',
+ 'Bored Avalanche Sheep of the Wasteland',
+ 'Devouring Nougat Sphinx of the Sock Drawer',
+ 'Djinni of the Footlocker',
+ 'Ectoplasmic Jazz Devil',
+ 'Flatuent Angel',
+ 'Gelatinous Duck of the Dream-Lands',
+ 'Gelatinous Mouse',
+ 'Golem of the Footlocker',
+ 'Lich Wombat',
+ 'Mechanical Sloth of the Past',
+ 'Milkshake Succubus',
+ 'Puffy Bone Peacock of the East',
+ 'Rainbow Manatee',
+ 'Rune Parrot',
+ 'Sand Cow',
+ 'Sinister Vanilla Dragon',
+ 'Snail of the North',
+ 'Spider of the Sewer',
+ 'Stellar Sawdust Leech',
+ 'Storm Anteater of Hell',
+ 'Stupid Spirit of the Brewery',
+ 'Time Kangaroo',
+ 'Tomb Poodle',
+ ]);
+};
+
+const getType = function(){
+ return `${_.sample(['Tiny', 'Small', 'Medium', 'Large', 'Gargantuan', 'Stupidly vast'])} ${_.sample(['beast', 'fiend', 'annoyance', 'guy', 'cutie'])}`;
+};
+
+const getAlignment = function(){
+ return _.sample([
+ 'annoying evil',
+ 'chaotic gossipy',
+ 'chaotic sloppy',
+ 'depressed neutral',
+ 'lawful bogus',
+ 'lawful coy',
+ 'manic-depressive evil',
+ 'narrow-minded neutral',
+ 'neutral annoying',
+ 'neutral ignorant',
+ 'oedpipal neutral',
+ 'silly neutral',
+ 'unoriginal neutral',
+ 'weird neutral',
+ 'wordy evil',
+ 'unaligned'
+ ]);
+};
+
+const getStats = function(){
+ return `>|${_.times(6, function(){
+ const num = _.random(1, 20);
+ const mod = Math.ceil(num/2 - 5);
+ return `${num} (${mod >= 0 ? `+${mod}` : mod})`;
+ }).join('|')}|`;
+};
+
+const genAbilities = function(){
+ return _.sample([
+ '> ***Pack Tactics.*** These guys work together. Like super well, you don\'t even know.',
+ '> ***Fowl Appearance.*** While the creature remains motionless, it is indistinguishable from a normal chicken.',
+ '> ***Onion Stench.*** Any creatures within 5 feet of this thing develops an irrational craving for onion rings.',
+ '> ***Enormous Nose.*** This creature gains advantage on any check involving putting things in its nose.',
+ '> ***Sassiness.*** When questioned, this creature will talk back instead of answering.',
+ '> ***Big Jerk.*** Thinks he is just *waaaay* better than you.',
+ ]);
+};
+
+const genAction = function(){
+ const name = _.sample([
+ 'Abdominal Drop',
+ 'Airplane Hammer',
+ 'Atomic Death Throw',
+ 'Bulldog Rake',
+ 'Corkscrew Strike',
+ 'Crossed Splash',
+ 'Crossface Suplex',
+ 'DDT Powerbomb',
+ 'Dual Cobra Wristlock',
+ 'Dual Throw',
+ 'Elbow Hold',
+ 'Gory Body Sweep',
+ 'Heel Jawbreaker',
+ 'Jumping Driver',
+ 'Open Chin Choke',
+ 'Scorpion Flurry',
+ 'Somersault Stump Fists',
+ 'Suffering Wringer',
+ 'Super Hip Submission',
+ 'Super Spin',
+ 'Team Elbow',
+ 'Team Foot',
+ 'Tilt-a-whirl Chin Sleeper',
+ 'Tilt-a-whirl Eye Takedown',
+ 'Turnbuckle Roll'
+ ]);
+
+ return `> ***${name}.*** *Melee Weapon Attack:* +4 to hit, reach 5ft., one target. *Hit* 5 (1d6 + 2) `;
+};
+
+
+module.exports = {
+
+ full : function(){
+ return `${[
+ '___',
+ '___',
+ `> ## ${getMonsterName()}`,
+ `>*${getType()}, ${getAlignment()}*`,
+ '> ___',
+ `> - **Armor Class** ${_.random(10, 20)}`,
+ `> - **Hit Points** ${_.random(1, 150)}(1d4 + 5)`,
+ `> - **Speed** ${_.random(0, 50)}ft.`,
+ '>___',
+ '>|STR|DEX|CON|INT|WIS|CHA|',
+ '>|:---:|:---:|:---:|:---:|:---:|:---:|',
+ getStats(),
+ '>___',
+ `> - **Condition Immunities** ${genList(['groggy', 'swagged', 'weak-kneed', 'buzzed', 'groovy', 'melancholy', 'drunk'], 3)}`,
+ `> - **Senses** passive Perception ${_.random(3, 20)}`,
+ `> - **Languages** ${genList(['Common', 'Pottymouth', 'Gibberish', 'Latin', 'Jive'], 2)}`,
+ `> - **Challenge** ${_.random(0, 15)} (${_.random(10, 10000)} XP)`,
+ '> ___',
+ _.times(_.random(3, 6), function(){
+ return genAbilities();
+ }).join('\n>\n'),
+ '> ### Actions',
+ _.times(_.random(4, 6), function(){
+ return genAction();
+ }).join('\n>\n'),
+ ].join('\n')}\n\n\n`;
+ },
+
+ half : function(){
+ return `${[
+ '___',
+ `> ## ${getMonsterName()}`,
+ `>*${getType()}, ${getAlignment()}*`,
+ '> ___',
+ `> - **Armor Class** ${_.random(10, 20)}`,
+ `> - **Hit Points** ${_.random(1, 150)}(1d4 + 5)`,
+ `> - **Speed** ${_.random(0, 50)}ft.`,
+ '>___',
+ '>|STR|DEX|CON|INT|WIS|CHA|',
+ '>|:---:|:---:|:---:|:---:|:---:|:---:|',
+ getStats(),
+ '>___',
+ `> - **Condition Immunities** ${genList(['groggy', 'swagged', 'weak-kneed', 'buzzed', 'groovy', 'melancholy', 'drunk'], 3)}`,
+ `> - **Senses** passive Perception ${_.random(3, 20)}`,
+ `> - **Languages** ${genList(['Common', 'Pottymouth', 'Gibberish', 'Latin', 'Jive'], 2)}`,
+ `> - **Challenge** ${_.random(0, 15)} (${_.random(10, 10000)} XP)`,
+ '> ___',
+ _.times(_.random(2, 3), function(){
+ return genAbilities();
+ }).join('\n>\n'),
+ '> ### Actions',
+ _.times(_.random(1, 2), function(){
+ return genAction();
+ }).join('\n>\n'),
+ ].join('\n')}\n\n\n`;
+ }
+};
diff --git a/client/homebrew/editor/snippetbar/snippetsLegacy/snippets.js b/client/homebrew/editor/snippetbar/snippetsLegacy/snippets.js
new file mode 100644
index 0000000000..b8410bd9f6
--- /dev/null
+++ b/client/homebrew/editor/snippetbar/snippetsLegacy/snippets.js
@@ -0,0 +1,268 @@
+/* eslint-disable max-lines */
+
+const MagicGen = require('./magic.gen.js');
+const ClassTableGen = require('./classtable.gen.js');
+const MonsterBlockGen = require('./monsterblock.gen.js');
+const ClassFeatureGen = require('./classfeature.gen.js');
+const CoverPageGen = require('./coverpage.gen.js');
+const TableOfContentsGen = require('./tableOfContents.gen.js');
+
+
+module.exports = [
+
+ {
+ groupName : 'Editor',
+ icon : 'fas fa-pencil-alt',
+ snippets : [
+ {
+ name : 'Column Break',
+ icon : 'fas fa-columns',
+ gen : '```\n```\n\n'
+ },
+ {
+ name : 'New Page',
+ icon : 'fas fa-file-alt',
+ gen : '\\page\n\n'
+ },
+ {
+ name : 'Vertical Spacing',
+ icon : 'fas fa-arrows-alt-v',
+ gen : '
\n\n'
+ },
+ {
+ name : 'Wide Block',
+ icon : 'fas fa-arrows-alt-h',
+ gen : '
\nEverything in here will be extra wide. Tables, text, everything! Beware though, CSS columns can behave a bit weird sometimes.\n
\n'
+ },
+ {
+ name : 'Image',
+ icon : 'fas fa-image',
+ gen : [
+ '
',
+ 'Credit: Kyounghwan Kim'
+ ].join('\n')
+ },
+ {
+ name : 'Background Image',
+ icon : 'fas fa-tree',
+ gen : [
+ '
'
+ ].join('\n')
+ },
+
+ {
+ name : 'Page Number',
+ icon : 'fas fa-bookmark',
+ gen : '
1
\n\n\n'
+ },
+
+ {
+ name : 'Auto-incrementing Page Number',
+ icon : 'fas fa-sort-numeric-down',
+ gen : '
\n'
+ },
+
+ {
+ name : 'Link to page',
+ icon : 'fas fa-link',
+ gen : '[Click here](#p3) to go to page 3\n'
+ },
+
+ {
+ name : 'Table of Contents',
+ icon : 'fas fa-book',
+ gen : TableOfContentsGen
+ },
+
+
+ ]
+ },
+
+
+ /************************* PHB ********************/
+
+ {
+ groupName : 'PHB',
+ icon : 'fas fa-book',
+ snippets : [
+ {
+ name : 'Spell',
+ icon : 'fas fa-magic',
+ gen : MagicGen.spell,
+ },
+ {
+ name : 'Spell List',
+ icon : 'fas fa-list',
+ gen : MagicGen.spellList,
+ },
+ {
+ name : 'Class Feature',
+ icon : 'fas fa-trophy',
+ gen : ClassFeatureGen,
+ },
+ {
+ name : 'Note',
+ icon : 'fas fa-sticky-note',
+ gen : function(){
+ return [
+ '> ##### Time to Drop Knowledge',
+ '> Use notes to point out some interesting information. ',
+ '> ',
+ '> **Tables and lists** both work within a note.'
+ ].join('\n');
+ },
+ },
+ {
+ name : 'Descriptive Text Box',
+ icon : 'far fa-sticky-note',
+ gen : function(){
+ return [
+ '
',
+ '##### Time to Drop Knowledge',
+ 'Use notes to point out some interesting information. ',
+ '',
+ '**Tables and lists** both work within a note.',
+ '
'
+ ].join('\n');
+ },
+ },
+ {
+ name : 'Monster Stat Block',
+ icon : 'fas fa-bug',
+ gen : MonsterBlockGen.half,
+ },
+ {
+ name : 'Wide Monster Stat Block',
+ icon : 'fas fa-paw',
+ gen : MonsterBlockGen.full,
+ },
+ {
+ name : 'Cover Page',
+ icon : 'far fa-file-word',
+ gen : CoverPageGen,
+ },
+ ]
+ },
+
+
+
+ /********************* TABLES *********************/
+
+ {
+ groupName : 'Tables',
+ icon : 'fas fa-table',
+ snippets : [
+ {
+ name : 'Class Table',
+ icon : 'fas fa-table',
+ gen : ClassTableGen.full,
+ },
+ {
+ name : 'Half Class Table',
+ icon : 'fas fa-list-alt',
+ gen : ClassTableGen.half,
+ },
+ {
+ name : 'Table',
+ icon : 'fas fa-th-list',
+ gen : function(){
+ return [
+ '##### Cookie Tastiness',
+ '| Tastiness | Cookie Type |',
+ '|:----:|:-------------|',
+ '| -5 | Raisin |',
+ '| 8th | Chocolate Chip |',
+ '| 11th | 2 or lower |',
+ '| 14th | 3 or lower |',
+ '| 17th | 4 or lower |\n\n',
+ ].join('\n');
+ },
+ },
+ {
+ name : 'Wide Table',
+ icon : 'fas fa-list',
+ gen : function(){
+ return [
+ '
',
+ '##### Cookie Tastiness',
+ '| Tastiness | Cookie Type |',
+ '|:----:|:-------------|',
+ '| -5 | Raisin |',
+ '| 8th | Chocolate Chip |',
+ '| 11th | 2 or lower |',
+ '| 14th | 3 or lower |',
+ '| 17th | 4 or lower |',
+ '
\n\n'
+ ].join('\n');
+ },
+ },
+ {
+ name : 'Split Table',
+ icon : 'fas fa-th-large',
+ gen : function(){
+ return [
+ '
',
+ '| d10 | Damage Type |',
+ '|:---:|:------------|',
+ '| 1 | Acid |',
+ '| 2 | Cold |',
+ '| 3 | Fire |',
+ '| 4 | Force |',
+ '| 5 | Lightning |',
+ '',
+ '```',
+ '```',
+ '',
+ '| d10 | Damage Type |',
+ '|:---:|:------------|',
+ '| 6 | Necrotic |',
+ '| 7 | Poison |',
+ '| 8 | Psychic |',
+ '| 9 | Radiant |',
+ '| 10 | Thunder |',
+ '
\n\n',
+ ].join('\n');
+ },
+ }
+ ]
+ },
+
+
+
+
+ /**************** PRINT *************/
+
+ {
+ groupName : 'Print',
+ icon : 'fas fa-print',
+ snippets : [
+ {
+ name : 'A4 PageSize',
+ icon : 'far fa-file',
+ gen : [''
+ ].join('\n')
+ },
+ {
+ name : 'Ink Friendly',
+ icon : 'fas fa-tint',
+ gen : ['',
+ ''
+ ].join('\n')
+ },
+ ]
+ },
+
+];
diff --git a/client/homebrew/editor/snippetbar/snippetsLegacy/tableOfContents.gen.js b/client/homebrew/editor/snippetbar/snippetsLegacy/tableOfContents.gen.js
new file mode 100644
index 0000000000..ca49526d4e
--- /dev/null
+++ b/client/homebrew/editor/snippetbar/snippetsLegacy/tableOfContents.gen.js
@@ -0,0 +1,72 @@
+const _ = require('lodash');
+
+const getTOC = (pages)=>{
+ const add1 = (title, page)=>{
+ res.push({
+ title : title,
+ page : page + 1,
+ children : []
+ });
+ };
+ const add2 = (title, page)=>{
+ if(!_.last(res)) add1('', page);
+ _.last(res).children.push({
+ title : title,
+ page : page + 1,
+ children : []
+ });
+ };
+ const add3 = (title, page)=>{
+ if(!_.last(res)) add1('', page);
+ if(!_.last(_.last(res).children)) add2('', page);
+ _.last(_.last(res).children).children.push({
+ title : title,
+ page : page + 1,
+ children : []
+ });
+ };
+
+ 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);
+ }
+ });
+ });
+ return res;
+};
+
+module.exports = function(brew){
+ const pages = brew.split('\\page');
+ const TOC = getTOC(pages);
+ const markdown = _.reduce(TOC, (r, g1, idx1)=>{
+ r.push(`- **[${idx1 + 1} ${g1.title}](#p${g1.page})**`);
+ if(g1.children.length){
+ _.each(g1.children, (g2, idx2)=>{
+ r.push(` - [${idx1 + 1}.${idx2 + 1} ${g2.title}](#p${g2.page})`);
+ if(g2.children.length){
+ _.each(g2.children, (g3, idx3)=>{
+ r.push(` - [${idx1 + 1}.${idx2 + 1}.${idx3 + 1} ${g3.title}](#p${g3.page})`);
+ });
+ }
+ });
+ }
+ return r;
+ }, []).join('\n');
+
+ return `
+##### Table Of Contents
+${markdown}
+
\n`;
+};
\ No newline at end of file
diff --git a/client/homebrew/homebrew.jsx b/client/homebrew/homebrew.jsx
index 93ee8f31fd..640a73f770 100644
--- a/client/homebrew/homebrew.jsx
+++ b/client/homebrew/homebrew.jsx
@@ -20,6 +20,7 @@ const Homebrew = createClass({
changelog : '',
version : '0.0.0',
account : null,
+ enable_v3 : false,
brew : {
title : '',
text : '',
@@ -33,6 +34,7 @@ const Homebrew = createClass({
componentWillMount : function() {
global.account = this.props.account;
global.version = this.props.version;
+ global.enable_v3 = this.props.enable_v3;
},
render : function (){
diff --git a/client/homebrew/navbar/account.navitem.jsx b/client/homebrew/navbar/account.navitem.jsx
index 3d36e5bc6e..f40fc92dee 100644
--- a/client/homebrew/navbar/account.navitem.jsx
+++ b/client/homebrew/navbar/account.navitem.jsx
@@ -20,12 +20,12 @@ const Account = createClass({
render : function(){
if(global.account){
- return
+ return
{global.account.username}
;
}
- return
+ return
login
;
}
diff --git a/client/homebrew/navbar/issue.navitem.jsx b/client/homebrew/navbar/issue.navitem.jsx
index d0dfd88bba..529744c29f 100644
--- a/client/homebrew/navbar/issue.navitem.jsx
+++ b/client/homebrew/navbar/issue.navitem.jsx
@@ -6,8 +6,8 @@ module.exports = function(props){
return
report issue
;
-};
\ No newline at end of file
+};
diff --git a/client/homebrew/navbar/patreon.navitem.jsx b/client/homebrew/navbar/patreon.navitem.jsx
index 03fb69af4b..555e3a15c4 100644
--- a/client/homebrew/navbar/patreon.navitem.jsx
+++ b/client/homebrew/navbar/patreon.navitem.jsx
@@ -8,7 +8,7 @@ module.exports = function(props){
newTab={true}
href='https://www.patreon.com/NaturalCrit'
color='green'
- icon='fa-heart'>
+ icon='fas fa-heart'>
help out
;
};
diff --git a/client/homebrew/navbar/print.navitem.jsx b/client/homebrew/navbar/print.navitem.jsx
index 7d1509a57c..4907cad734 100644
--- a/client/homebrew/navbar/print.navitem.jsx
+++ b/client/homebrew/navbar/print.navitem.jsx
@@ -3,7 +3,7 @@ const createClass = require('create-react-class');
const Nav = require('naturalcrit/nav/nav.jsx');
module.exports = function(props){
- return
+ return
get PDF
;
-};
\ No newline at end of file
+};
diff --git a/client/homebrew/navbar/recent.navitem.jsx b/client/homebrew/navbar/recent.navitem.jsx
index 5b2895ad74..d123899484 100644
--- a/client/homebrew/navbar/recent.navitem.jsx
+++ b/client/homebrew/navbar/recent.navitem.jsx
@@ -143,7 +143,7 @@ const RecentItems = createClass({
},
render : function(){
- return this.handleDropdown(true)}
onMouseLeave={()=>this.handleDropdown(false)}>
{this.props.text}
diff --git a/client/homebrew/pages/editPage/editPage.jsx b/client/homebrew/pages/editPage/editPage.jsx
index d75b647e6c..4e58e9f1cf 100644
--- a/client/homebrew/pages/editPage/editPage.jsx
+++ b/client/homebrew/pages/editPage/editPage.jsx
@@ -41,17 +41,18 @@ const EditPage = createClass({
tags : '',
published : false,
authors : [],
- systems : []
+ systems : [],
+ renderer : 'legacy'
}
};
},
getInitialState : function() {
return {
- brew : this.props.brew,
-
+ brew : this.props.brew,
isSaving : false,
isPending : false,
+ alertRenderChange : false,
saveGoogle : this.props.brew.googleId ? true : false,
confirmGoogleTransfer : false,
errors : null,
@@ -66,6 +67,8 @@ const EditPage = createClass({
url : window.location.href
});
+ this.savedBrew = JSON.parse(JSON.stringify(this.props.brew)); //Deep copy
+
this.trySave();
window.onbeforeunload = ()=>{
if(this.state.isSaving || this.state.isPending){
@@ -101,6 +104,11 @@ const EditPage = createClass({
},
handleMetadataChange : function(metadata){
+ if(metadata.renderer != this.savedBrew.renderer){
+ this.setState({
+ alertRenderChange : true
+ });
+ }
this.setState((prevState)=>({
brew : _.merge({}, prevState.brew, metadata),
isPending : true,
@@ -122,8 +130,7 @@ const EditPage = createClass({
},
hasChanges : function(){
- const savedBrew = this.savedBrew ? this.savedBrew : this.props.brew;
- return !_.isEqual(this.state.brew, savedBrew);
+ return !_.isEqual(this.state.brew, this.savedBrew);
},
trySave : function(){
@@ -142,6 +149,12 @@ const EditPage = createClass({
this.clearErrors();
},
+ closeAlerts : function(){
+ this.setState({
+ alertRenderChange : false
+ });
+ },
+
toggleGoogleStorage : function(){
this.setState((prevState)=>({
saveGoogle : !prevState.saveGoogle,
@@ -294,7 +307,7 @@ const EditPage = createClass({
} catch (e){}
if(this.state.errors.status == '401'){
- return
+ return
Oops!
You must be signed in to a Google account
@@ -312,7 +325,7 @@ const EditPage = createClass({
;
}
- return
+ return
Oops!
Looks like there was a problem saving.
@@ -325,16 +338,25 @@ const EditPage = createClass({
}
if(this.state.isSaving){
- return
saving...;
+ return
saving...;
}
if(this.state.isPending && this.hasChanges()){
- return
Save Now;
+ return
Save Now;
}
if(!this.state.isPending && !this.state.isSaving){
return
saved.;
}
},
+ // {this.state.alertRenderChange &&
+ //
+ // Rendering mode for this brew has been changed! Refresh the page to load the new renderer.
+ //
+ // OK
+ //
+ //
+ // }
+
processShareId : function() {
return this.state.brew.googleId ?
this.state.brew.googleId + this.state.brew.shareId :
@@ -351,7 +373,7 @@ const EditPage = createClass({
{this.renderGoogleDriveIcon()}
{this.renderSaveButton()}
-
+
Share
@@ -374,8 +396,9 @@ const EditPage = createClass({
onChange={this.handleTextChange}
metadata={this.state.brew}
onMetadataChange={this.handleMetadataChange}
+ renderer={this.state.brew.renderer}
/>
-
+
;
diff --git a/client/homebrew/pages/editPage/editPage.less b/client/homebrew/pages/editPage/editPage.less
index 381b29fca8..b73467d50c 100644
--- a/client/homebrew/pages/editPage/editPage.less
+++ b/client/homebrew/pages/editPage/editPage.less
@@ -1,8 +1,14 @@
-
+@keyframes glideDown {
+ 0% {transform : translate(-50% + 3px, 0px);
+ opacity : 0;}
+ 100% {transform : translate(-50% + 3px, 10px);
+ opacity : 1;}
+}
.editPage{
.navItem.save{
width : 106px;
text-align : center;
+ position : relative;
&.saved{
cursor : initial;
color : #666;
@@ -21,12 +27,15 @@
margin : -5px;
}
.errorContainer{
+ animation-name: glideDown;
+ animation-duration: 0.4s;
position : absolute;
top : 100%;
left : 50%;
- z-index : 1000;
+ z-index : 100000;
width : 140px;
padding : 3px;
+ color : white;
background-color : #333;
border : 3px solid #444;
border-radius : 5px;
diff --git a/client/homebrew/pages/homePage/homePage.jsx b/client/homebrew/pages/homePage/homePage.jsx
index e245b990b6..d782b8b819 100644
--- a/client/homebrew/pages/homePage/homePage.jsx
+++ b/client/homebrew/pages/homePage/homePage.jsx
@@ -55,7 +55,7 @@ const HomePage = createClass({
return
-
+
Changelog
@@ -77,11 +77,11 @@ const HomePage = createClass({