0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2026-01-02 08:32:41 +00:00

Merge pull request #1562 from Gazook89/Page-Snippet-Menu

Editor-Specific Snippet Groups, and Print Snippet Menu Changes
This commit is contained in:
Trevor Buckner
2021-08-15 00:45:47 -04:00
committed by GitHub
3 changed files with 77 additions and 36 deletions

View File

@@ -39,12 +39,10 @@ const Snippetbar = createClass({
renderSnippetGroups : function(){ renderSnippetGroups : function(){
let snippets = []; let snippets = [];
if(this.props.view === 'text') { if(this.props.renderer === 'V3')
if(this.props.renderer === 'V3') snippets = SnippetsV3.filter((snippetGroup)=>snippetGroup.view === this.props.view);
snippets = SnippetsV3; else
else snippets = SnippetsLegacy.filter((snippetGroup)=>snippetGroup.view === this.props.view);
snippets = SnippetsLegacy;
}
return _.map(snippets, (snippetGroup)=>{ return _.map(snippets, (snippetGroup)=>{
return <SnippetGroup return <SnippetGroup

View File

@@ -14,6 +14,7 @@ module.exports = [
{ {
groupName : 'Editor', groupName : 'Editor',
icon : 'fas fa-pencil-alt', icon : 'fas fa-pencil-alt',
view : 'text',
snippets : [ snippets : [
{ {
name : 'Column Break', name : 'Column Break',
@@ -139,6 +140,7 @@ module.exports = [
{ {
groupName : 'PHB', groupName : 'PHB',
icon : 'fas fa-book', icon : 'fas fa-book',
view : 'text',
snippets : [ snippets : [
{ {
name : 'Spell', name : 'Spell',
@@ -230,6 +232,7 @@ module.exports = [
{ {
groupName : 'Tables', groupName : 'Tables',
icon : 'fas fa-table', icon : 'fas fa-table',
view : 'text',
snippets : [ snippets : [
{ {
name : 'Class Table', name : 'Class Table',
@@ -307,33 +310,54 @@ module.exports = [
/**************** PRINT *************/ /**************** PAGE *************/
{ {
groupName : 'Print', groupName : 'Print',
icon : 'fas fa-print', icon : 'fas fa-print',
view : 'style',
snippets : [ snippets : [
{ {
name : 'A4 PageSize', name : 'A4 Page Size',
icon : 'far fa-file', icon : 'far fa-file',
gen : ['<style>', gen : ['/* A4 Page Size */',
' .phb{', '.page{',
' width : 210mm;', ' width : 210mm;',
' height : 296.8mm;', ' height : 296.8mm;',
' }', '}',
'</style>' ''
].join('\n')
},
{
name : 'Square Page Size',
icon : 'far fa-file',
gen : ['/* Square Page Size */',
'.page {',
' width : 125mm;',
' height : 125mm;',
' padding : 12.5mm;',
' columns : unset;',
'}',
''
].join('\n') ].join('\n')
}, },
{ {
name : 'Ink Friendly', name : 'Ink Friendly',
icon : 'fas fa-tint', icon : 'fas fa-tint',
gen : ['<style>', gen : dedent`
' .phb{ background : white;}', /* Ink Friendly */
' .phb img{ display : none;}', .pages *:is(.page,.monster,.note,.descriptive) {
' .phb hr+blockquote{background : white;}', background : white !important;
'</style>', box-shadow : 0px 0px 3px !important;
'' }
].join('\n')
.page .note:before {
box-shadow : 0px 0px 3px;
}
.page img {
visibility : hidden;
}`
}, },
] ]
}, },

View File

@@ -6,13 +6,14 @@ const MonsterBlockGen = require('./monsterblock.gen.js');
const ClassFeatureGen = require('./classfeature.gen.js'); const ClassFeatureGen = require('./classfeature.gen.js');
const CoverPageGen = require('./coverpage.gen.js'); const CoverPageGen = require('./coverpage.gen.js');
const TableOfContentsGen = require('./tableOfContents.gen.js'); const TableOfContentsGen = require('./tableOfContents.gen.js');
const dedent = require('dedent-tabs').default;
module.exports = [ module.exports = [
{ {
groupName : 'Editor', groupName : 'Editor',
icon : 'fas fa-pencil-alt', icon : 'fas fa-pencil-alt',
view : 'text',
snippets : [ snippets : [
{ {
name : 'Column Break', name : 'Column Break',
@@ -114,6 +115,7 @@ module.exports = [
{ {
groupName : 'PHB', groupName : 'PHB',
icon : 'fas fa-book', icon : 'fas fa-book',
view : 'text',
snippets : [ snippets : [
{ {
name : 'Spell', name : 'Spell',
@@ -189,6 +191,7 @@ module.exports = [
{ {
groupName : 'Tables', groupName : 'Tables',
icon : 'fas fa-table', icon : 'fas fa-table',
view : 'text',
snippets : [ snippets : [
{ {
name : 'Class Table', name : 'Class Table',
@@ -273,28 +276,44 @@ module.exports = [
{ {
groupName : 'Print', groupName : 'Print',
icon : 'fas fa-print', icon : 'fas fa-print',
view : 'style',
snippets : [ snippets : [
{ {
name : 'A4 PageSize', name : 'A4 Page Size',
icon : 'far fa-file', icon : 'far fa-file',
gen : ['<style>', gen : ['/* A4 Page Size */',
' .phb{', '.phb {',
' width : 210mm;', ' width : 210mm;',
' height : 296.8mm;', ' height : 296.8mm;',
' }', '}'
'</style>' ].join('\n')
},
{
name : 'Square Page Size',
icon : 'far fa-file',
gen : ['/* Square Page Size */',
'.phb {',
' width : 125mm;',
' height : 125mm;',
' padding : 12.5mm;',
' columns : unset;',
'}',
''
].join('\n') ].join('\n')
}, },
{ {
name : 'Ink Friendly', name : 'Ink Friendly',
icon : 'fas fa-tint', icon : 'fas fa-tint',
gen : ['<style>', gen : dedent`
' .phb{ background : white;}', /* Ink Friendly */',
' .phb img{ display : none;}', .phb, .phb blockquote, .phb hr+blockquote {
' .phb hr+blockquote{background : white;}', background : white;
'</style>', box-shadow : 0px 0px 3px;
'' }
].join('\n')
.phb img {
visibility : hidden;
}`
}, },
] ]
}, },