From 9a44cc04b1ebdfb62ac5b3fec6e7c0a5414f8238 Mon Sep 17 00:00:00 2001 From: Gazook89 <58999374+Gazook89@users.noreply.github.com> Date: Tue, 10 Aug 2021 21:46:47 -0500 Subject: [PATCH 01/10] Add Square Page snippet Add a snippet to Print menu (renamed to "Page") for a square page. Reduces padding and removes columns as well. --- .../editor/snippetbar/snippets/snippets.js | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/client/homebrew/editor/snippetbar/snippets/snippets.js b/client/homebrew/editor/snippetbar/snippets/snippets.js index b30a96e7c..d68cc32ac 100644 --- a/client/homebrew/editor/snippetbar/snippets/snippets.js +++ b/client/homebrew/editor/snippetbar/snippets/snippets.js @@ -285,14 +285,14 @@ module.exports = [ - /**************** PRINT *************/ + /**************** PAGE *************/ { - groupName : 'Print', + groupName : 'Page', icon : 'fas fa-print', snippets : [ { - name : 'A4 PageSize', + name : 'A4 Page Size', icon : 'far fa-file', gen : ['' ].join('\n') }, + { + name : 'Square Page Size', + icon : 'far fa-file', + gen : ['' + ].join('\n') + }, { name : 'Ink Friendly', icon : 'fas fa-tint', From a63949636ebe60eeffffd796f26491fa8c1d2c7f Mon Sep 17 00:00:00 2001 From: Gazook89 <58999374+Gazook89@users.noreply.github.com> Date: Tue, 10 Aug 2021 22:02:46 -0500 Subject: [PATCH 02/10] Update Ink Friendly snippet for v3 updated the ink friendly snippet so that it points to elements like .monster rather than hr+blockquote. Goes further than original snippet by setting white background for monster, note, descriptive blocks. Did not update Legacy. --- client/homebrew/editor/snippetbar/snippets/snippets.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/client/homebrew/editor/snippetbar/snippets/snippets.js b/client/homebrew/editor/snippetbar/snippets/snippets.js index d68cc32ac..6e26ab9ee 100644 --- a/client/homebrew/editor/snippetbar/snippets/snippets.js +++ b/client/homebrew/editor/snippetbar/snippets/snippets.js @@ -319,9 +319,9 @@ module.exports = [ name : 'Ink Friendly', icon : 'fas fa-tint', gen : ['', '' ].join('\n') From 69a69bbb82e897839c146c85aad75c99c67ec258 Mon Sep 17 00:00:00 2001 From: Gazook89 <58999374+Gazook89@users.noreply.github.com> Date: Wed, 11 Aug 2021 21:44:39 -0500 Subject: [PATCH 03/10] Add 'editor' property to snippets.js Add another property to the snippet groups, "editor", with values either "text" or "style". --- client/homebrew/editor/snippetbar/snippets/snippets.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/client/homebrew/editor/snippetbar/snippets/snippets.js b/client/homebrew/editor/snippetbar/snippets/snippets.js index 6e26ab9ee..ad8dc2750 100644 --- a/client/homebrew/editor/snippetbar/snippets/snippets.js +++ b/client/homebrew/editor/snippetbar/snippets/snippets.js @@ -14,6 +14,7 @@ module.exports = [ { groupName : 'Editor', icon : 'fas fa-pencil-alt', + editor : 'text', snippets : [ { name : 'Column Break', @@ -129,6 +130,7 @@ module.exports = [ { groupName : 'PHB', icon : 'fas fa-book', + editor : 'text', snippets : [ { name : 'Spell', @@ -208,6 +210,7 @@ module.exports = [ { groupName : 'Tables', icon : 'fas fa-table', + editor : 'text', snippets : [ { name : 'Class Table', @@ -290,6 +293,7 @@ module.exports = [ { groupName : 'Page', icon : 'fas fa-print', + editor : 'style', snippets : [ { name : 'A4 Page Size', From 3d9f8ea142f4fb5d622f550a3633a5aaeeb506ff Mon Sep 17 00:00:00 2001 From: Gazook89 <58999374+Gazook89@users.noreply.github.com> Date: Thu, 12 Aug 2021 06:01:48 -0500 Subject: [PATCH 04/10] Update snippet.js 'editor' to 'view' Change new property 'editor' to 'view' on @calculuschild 's recommendation. --- client/homebrew/editor/snippetbar/snippets/snippets.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/client/homebrew/editor/snippetbar/snippets/snippets.js b/client/homebrew/editor/snippetbar/snippets/snippets.js index ad8dc2750..8f608a614 100644 --- a/client/homebrew/editor/snippetbar/snippets/snippets.js +++ b/client/homebrew/editor/snippetbar/snippets/snippets.js @@ -14,7 +14,7 @@ module.exports = [ { groupName : 'Editor', icon : 'fas fa-pencil-alt', - editor : 'text', + view : 'text', snippets : [ { name : 'Column Break', @@ -130,7 +130,7 @@ module.exports = [ { groupName : 'PHB', icon : 'fas fa-book', - editor : 'text', + view : 'text', snippets : [ { name : 'Spell', @@ -210,7 +210,7 @@ module.exports = [ { groupName : 'Tables', icon : 'fas fa-table', - editor : 'text', + view : 'text', snippets : [ { name : 'Class Table', @@ -293,7 +293,7 @@ module.exports = [ { groupName : 'Page', icon : 'fas fa-print', - editor : 'style', + view : 'style', snippets : [ { name : 'A4 Page Size', From 3545bdc5868dcda1b9014ce3e17bc550e7794cb3 Mon Sep 17 00:00:00 2001 From: Gazook89 <58999374+Gazook89@users.noreply.github.com> Date: Thu, 12 Aug 2021 06:59:55 -0500 Subject: [PATCH 05/10] Update snippetbar.jsx with filter for editor/view specific menus Add logic to filter available snippet menus based on the view/editor that is open ("text" vs "style") for both Legacy and v3. --- .../homebrew/editor/snippetbar/snippetbar.jsx | 24 +++++++++++++++---- .../snippetbar/snippetsLegacy/snippets.js | 4 ++++ 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/client/homebrew/editor/snippetbar/snippetbar.jsx b/client/homebrew/editor/snippetbar/snippetbar.jsx index 0c054b12b..560786344 100644 --- a/client/homebrew/editor/snippetbar/snippetbar.jsx +++ b/client/homebrew/editor/snippetbar/snippetbar.jsx @@ -39,12 +39,26 @@ const Snippetbar = createClass({ renderSnippetGroups : function(){ let snippets = []; - if(this.props.view === 'text') { - if(this.props.renderer === 'V3') - snippets = SnippetsV3; + + if(this.props.renderer === 'V3') + if(this.props.view === 'text') { + snippets = SnippetsV3.filter(SnippetsV3 => SnippetsV3.view === 'text'); + } + else if(this.props.view === 'style') { + snippets = SnippetsV3.filter(SnippetsV3 => SnippetsV3.view === 'style'); + } else - snippets = SnippetsLegacy; - } + snippets = null + else + if(this.props.view === 'text') { + snippets = SnippetsLegacy.filter(SnippetsLegacy => SnippetsLegacy.view === 'text'); + } + else if(this.props.view === 'style') { + snippets = SnippetsLegacy.filter(SnippetsLegacy => SnippetsLegacy.view === 'style'); + } + else + snippets = null + return _.map(snippets, (snippetGroup)=>{ return Date: Thu, 12 Aug 2021 07:00:51 -0500 Subject: [PATCH 06/10] Change 'print' to 'page' on Legacy snippet.js Tiny fix to change "Print" menu to "Page" menu on Legacy. --- client/homebrew/editor/snippetbar/snippetsLegacy/snippets.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/homebrew/editor/snippetbar/snippetsLegacy/snippets.js b/client/homebrew/editor/snippetbar/snippetsLegacy/snippets.js index d497148e3..b66430dbb 100644 --- a/client/homebrew/editor/snippetbar/snippetsLegacy/snippets.js +++ b/client/homebrew/editor/snippetbar/snippetsLegacy/snippets.js @@ -266,7 +266,7 @@ module.exports = [ /**************** PRINT *************/ { - groupName : 'Print', + groupName : 'Page', icon : 'fas fa-print', view : 'style', snippets : [ From 807f865d8b1ea88db7c640eb201f05993e32f2eb Mon Sep 17 00:00:00 2001 From: Gazook89 <58999374+Gazook89@users.noreply.github.com> Date: Thu, 12 Aug 2021 07:42:08 -0500 Subject: [PATCH 07/10] Match Legacy snippets to v3, remove ' + gen : ['/* A4 Page Size */', + '.phb{', + ' width : 210mm;', + ' height : 296.8mm;', + '}', + '' ].join('\n') }, { name : 'Square Page Size', icon : 'far fa-file', - gen : ['' + gen : ['/* Square Page Size */', + '.page {', + ' width:5.25in;', + ' height:5.25in;', + ' padding:.5in;', + ' columns:unset;', + '}', + '' ].join('\n') }, { name : 'Ink Friendly', icon : 'fas fa-tint', - gen : ['', + gen : ['/* Ink Friendly */', + '.pages *:is(.page,.monster,.note,.descriptive) {', + ' background:white !important;', + ' box-shadow:0px 0px 3px !important;', + '}', + '', + '.page .note:before {', + ' box-shadow:0px 0px 3px;', + '}', '' ].join('\n') }, diff --git a/client/homebrew/editor/snippetbar/snippetsLegacy/snippets.js b/client/homebrew/editor/snippetbar/snippetsLegacy/snippets.js index b66430dbb..5015d371a 100644 --- a/client/homebrew/editor/snippetbar/snippetsLegacy/snippets.js +++ b/client/homebrew/editor/snippetbar/snippetsLegacy/snippets.js @@ -271,24 +271,36 @@ module.exports = [ view : 'style', snippets : [ { - name : 'A4 PageSize', + name : 'A4 Page Size', icon : 'far fa-file', - gen : ['' + '}' + ].join('\n') + }, + { + name : 'Square Page Size', + icon : 'far fa-file', + gen : ['/* Square Page Size */', + '.phb {', + ' width:5.25in;', + ' height:5.25in;', + ' padding:.5in;', + ' columns:unset;', + '}', + '' ].join('\n') }, { name : 'Ink Friendly', icon : 'fas fa-tint', - gen : ['', + gen : ['/* Ink Friendly */', + '.phb, .phb blockquote, .phb hr+blockquote {', + ' background : white;', + ' box-shadow : 0px 0px 3px;', + '}', '' ].join('\n') }, From 562bf6d4ac29ecff79b9d233dbc0c5292c8c68bd Mon Sep 17 00:00:00 2001 From: Gazook89 <58999374+Gazook89@users.noreply.github.com> Date: Thu, 12 Aug 2021 07:45:00 -0500 Subject: [PATCH 08/10] Fix to snippets.js both legacy and v3 for CircleCI --- client/homebrew/editor/snippetbar/snippets/snippets.js | 8 ++++---- .../homebrew/editor/snippetbar/snippetsLegacy/snippets.js | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/client/homebrew/editor/snippetbar/snippets/snippets.js b/client/homebrew/editor/snippetbar/snippets/snippets.js index 39f28133c..a4c47d765 100644 --- a/client/homebrew/editor/snippetbar/snippets/snippets.js +++ b/client/homebrew/editor/snippetbar/snippets/snippets.js @@ -14,7 +14,7 @@ module.exports = [ { groupName : 'Editor', icon : 'fas fa-pencil-alt', - view : 'text', + view : 'text', snippets : [ { name : 'Column Break', @@ -130,7 +130,7 @@ module.exports = [ { groupName : 'PHB', icon : 'fas fa-book', - view : 'text', + view : 'text', snippets : [ { name : 'Spell', @@ -210,7 +210,7 @@ module.exports = [ { groupName : 'Tables', icon : 'fas fa-table', - view : 'text', + view : 'text', snippets : [ { name : 'Class Table', @@ -293,7 +293,7 @@ module.exports = [ { groupName : 'Page', icon : 'fas fa-print', - view : 'style', + view : 'style', snippets : [ { name : 'A4 Page Size', diff --git a/client/homebrew/editor/snippetbar/snippetsLegacy/snippets.js b/client/homebrew/editor/snippetbar/snippetsLegacy/snippets.js index 5015d371a..b9cf865a9 100644 --- a/client/homebrew/editor/snippetbar/snippetsLegacy/snippets.js +++ b/client/homebrew/editor/snippetbar/snippetsLegacy/snippets.js @@ -13,7 +13,7 @@ module.exports = [ { groupName : 'Editor', icon : 'fas fa-pencil-alt', - view : 'text', + view : 'text', snippets : [ { name : 'Column Break', @@ -115,7 +115,7 @@ module.exports = [ { groupName : 'PHB', icon : 'fas fa-book', - view : 'text', + view : 'text', snippets : [ { name : 'Spell', @@ -183,7 +183,7 @@ module.exports = [ { groupName : 'Tables', icon : 'fas fa-table', - view : 'text', + view : 'text', snippets : [ { name : 'Class Table', @@ -268,7 +268,7 @@ module.exports = [ { groupName : 'Page', icon : 'fas fa-print', - view : 'style', + view : 'style', snippets : [ { name : 'A4 Page Size', From 88c485ffe5934c44e16b668baf0df0473ee25411 Mon Sep 17 00:00:00 2001 From: Gazook89 <58999374+Gazook89@users.noreply.github.com> Date: Thu, 12 Aug 2021 21:10:13 -0500 Subject: [PATCH 09/10] circleCI fix hopefully last one.. circleCI fixes circleCI fixes --- .../homebrew/editor/snippetbar/snippetbar.jsx | 28 ++++++++----------- 1 file changed, 11 insertions(+), 17 deletions(-) diff --git a/client/homebrew/editor/snippetbar/snippetbar.jsx b/client/homebrew/editor/snippetbar/snippetbar.jsx index 560786344..5302a339b 100644 --- a/client/homebrew/editor/snippetbar/snippetbar.jsx +++ b/client/homebrew/editor/snippetbar/snippetbar.jsx @@ -39,26 +39,20 @@ const Snippetbar = createClass({ renderSnippetGroups : function(){ let snippets = []; - if(this.props.renderer === 'V3') if(this.props.view === 'text') { - snippets = SnippetsV3.filter(SnippetsV3 => SnippetsV3.view === 'text'); - } - else if(this.props.view === 'style') { - snippets = SnippetsV3.filter(SnippetsV3 => SnippetsV3.view === 'style'); - } - else - snippets = null + snippets = SnippetsV3.filter((SnippetsV3)=>SnippetsV3.view === 'text'); + } else if(this.props.view === 'style') { + snippets = SnippetsV3.filter((SnippetsV3)=>SnippetsV3.view === 'style'); + } else + snippets = null; else - if(this.props.view === 'text') { - snippets = SnippetsLegacy.filter(SnippetsLegacy => SnippetsLegacy.view === 'text'); - } - else if(this.props.view === 'style') { - snippets = SnippetsLegacy.filter(SnippetsLegacy => SnippetsLegacy.view === 'style'); - } - else - snippets = null - + if(this.props.view === 'text') { + snippets = SnippetsLegacy.filter((SnippetsLegacy)=>SnippetsLegacy.view === 'text'); + } else if(this.props.view === 'style') { + snippets = SnippetsLegacy.filter((SnippetsLegacy)=>SnippetsLegacy.view === 'style'); + } else + snippets = null; return _.map(snippets, (snippetGroup)=>{ return Date: Sun, 15 Aug 2021 00:45:01 -0400 Subject: [PATCH 10/10] Refactoring switching logic, formatting LESS --- .../homebrew/editor/snippetbar/snippetbar.jsx | 14 +------ .../editor/snippetbar/snippets/snippets.js | 39 ++++++++++--------- .../snippetbar/snippetsLegacy/snippets.js | 33 +++++++++------- 3 files changed, 41 insertions(+), 45 deletions(-) diff --git a/client/homebrew/editor/snippetbar/snippetbar.jsx b/client/homebrew/editor/snippetbar/snippetbar.jsx index 5302a339b..9ea04695f 100644 --- a/client/homebrew/editor/snippetbar/snippetbar.jsx +++ b/client/homebrew/editor/snippetbar/snippetbar.jsx @@ -40,19 +40,9 @@ const Snippetbar = createClass({ let snippets = []; if(this.props.renderer === 'V3') - if(this.props.view === 'text') { - snippets = SnippetsV3.filter((SnippetsV3)=>SnippetsV3.view === 'text'); - } else if(this.props.view === 'style') { - snippets = SnippetsV3.filter((SnippetsV3)=>SnippetsV3.view === 'style'); - } else - snippets = null; + snippets = SnippetsV3.filter((snippetGroup)=>snippetGroup.view === this.props.view); else - if(this.props.view === 'text') { - snippets = SnippetsLegacy.filter((SnippetsLegacy)=>SnippetsLegacy.view === 'text'); - } else if(this.props.view === 'style') { - snippets = SnippetsLegacy.filter((SnippetsLegacy)=>SnippetsLegacy.view === 'style'); - } else - snippets = null; + snippets = SnippetsLegacy.filter((snippetGroup)=>snippetGroup.view === this.props.view); return _.map(snippets, (snippetGroup)=>{ return