mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-01-27 16:03:07 +00:00
Compare commits
3 Commits
pr-4527
...
new-brew-p
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
164330a4ef | ||
|
|
142fb8376f | ||
|
|
a65d4b8ac1 |
57
changelog.md
57
changelog.md
@@ -88,63 +88,6 @@ pre {
|
|||||||
## changelog
|
## changelog
|
||||||
For a full record of development, visit our [Github Page](https://github.com/naturalcrit/homebrewery).
|
For a full record of development, visit our [Github Page](https://github.com/naturalcrit/homebrewery).
|
||||||
|
|
||||||
### Friday 11/14/2025 - v13.20.0
|
|
||||||
|
|
||||||
{{taskList
|
|
||||||
##### calculuschild
|
|
||||||
* [x] Cleanup and removal of redundant code (home/new/edit pages)
|
|
||||||
* [x] Compress brew payloads and when saving to speed up saving and reduce bandwidth usage
|
|
||||||
|
|
||||||
##### Gazook89
|
|
||||||
* [x] Cleanup (reorganizing files and folders)
|
|
||||||
|
|
||||||
##### G-Ambatte
|
|
||||||
* [x] Fix default save location failing on new documents
|
|
||||||
|
|
||||||
Fixes issue [#4437](https://github.com/naturalcrit/homebrewery/issues/3175)
|
|
||||||
* [x] Fix usernames with special symbols unable to open userpage
|
|
||||||
|
|
||||||
Fixes issue [#807](https://github.com/naturalcrit/homebrewery/issues/807)
|
|
||||||
* [x] Cleanup (tests, documentation, localstorage key names)
|
|
||||||
|
|
||||||
Fixes issues [#4119](https://github.com/naturalcrit/homebrewery/issues/4119), [#4443](https://github.com/naturalcrit/homebrewery/issues/4443), [#4454](https://github.com/naturalcrit/homebrewery/issues/4454)
|
|
||||||
* [x] Added indexes to Mongo schema for speed improvements on local installs
|
|
||||||
|
|
||||||
##### 5e-Cleric
|
|
||||||
* [x] Better handling for errors during brew deletion
|
|
||||||
* [x] Improve file import error messaging
|
|
||||||
* [x] Tweaked editor visuals (scrollbar, dev environment, cursor type)
|
|
||||||
|
|
||||||
Fixes issue [#2689](https://github.com/naturalcrit/homebrewery/issues/2689)
|
|
||||||
* [x] Add support for math symbols in curly blocks for CSS `calc()`
|
|
||||||
|
|
||||||
Fixes issue [#3175](https://github.com/naturalcrit/homebrewery/issues/3175)
|
|
||||||
|
|
||||||
##### abquintic
|
|
||||||
* [x] Added new {{openSans **:fas_copyright: LICENSE**}} snippets (DriveThruRPG, AELF, GNU, WotC, Mongoose, etc.) with logos
|
|
||||||
* [x] Added d100 dice icons via `:icon_name:` syntax
|
|
||||||
* [x] Fix Firefox crash from very long blockquotes
|
|
||||||
|
|
||||||
Fixes issue [#3426](https://github.com/naturalcrit/homebrewery/issues/3426)
|
|
||||||
|
|
||||||
* [x] Allow more symbol characters in CSS vars inside curly blocks
|
|
||||||
|
|
||||||
Fixes issue [#4201](https://github.com/naturalcrit/homebrewery/issues/4201)
|
|
||||||
|
|
||||||
* [x] Remove duplicate columnbreak at end of page
|
|
||||||
|
|
||||||
Fixes issue [#4401](https://github.com/naturalcrit/homebrewery/issues/4401)
|
|
||||||
|
|
||||||
* [x] Fix editor losing scroll position after page resize
|
|
||||||
|
|
||||||
Fixes issue [#2963](https://github.com/naturalcrit/homebrewery/issues/2963)
|
|
||||||
|
|
||||||
##### Emmanuel Ferdman (first contribution!)
|
|
||||||
* [x] Fixed edge case crash on admin page
|
|
||||||
}}
|
|
||||||
|
|
||||||
\page
|
|
||||||
|
|
||||||
### Wednesday 7/09/2025 - v3.19.3
|
### Wednesday 7/09/2025 - v3.19.3
|
||||||
|
|
||||||
{{taskList
|
{{taskList
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
const { useRef, useEffect } = React;
|
const { useRef, useEffect } = React;
|
||||||
|
|
||||||
function Dialog({ dismisskeys = [], closeText = 'Close', blocking = false, ...rest }) {
|
function Dialog({ dismisskeys = [], closeText = 'Close', blocking = false, callbackFn = ()=>{}, ...rest }) {
|
||||||
const dialogRef = useRef(null);
|
const dialogRef = useRef(null);
|
||||||
|
|
||||||
useEffect(()=>{
|
useEffect(()=>{
|
||||||
@@ -15,6 +15,7 @@ function Dialog({ dismisskeys = [], closeText = 'Close', blocking = false, ...re
|
|||||||
localStorage.setItem(key, 'true');
|
localStorage.setItem(key, 'true');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
callbackFn();
|
||||||
dialogRef.current?.close();
|
dialogRef.current?.close();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
80
client/components/newDocumentForm.jsx
Normal file
80
client/components/newDocumentForm.jsx
Normal file
@@ -0,0 +1,80 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import './newDocumentForm.less';
|
||||||
|
|
||||||
|
const sizes = [
|
||||||
|
// ISO A-series (converted from mm)
|
||||||
|
{ id: 'A3', width: 11.7, height: 16.5 }, // 297 × 420 mm
|
||||||
|
{ id: 'A4', width: 8.27, height: 11.69 }, // 210 × 297 mm
|
||||||
|
{ id: 'A5', width: 5.83, height: 8.27 }, // 148 × 210 mm
|
||||||
|
{ id: 'A6', width: 4.13, height: 5.83 }, // 105 × 148 mm
|
||||||
|
|
||||||
|
// US & common book trim sizes
|
||||||
|
{ id: 'US_Letter', width: 8.5, height: 11 },
|
||||||
|
{ id: 'Trade_Paperback', width: 6, height: 9 },
|
||||||
|
{ id: 'Digest', width: 5.5, height: 8.5 },
|
||||||
|
{ id: 'Pocket_Book', width: 4, height: 6 },
|
||||||
|
{ id: 'Square_8_5', width: 8.5, height: 8.5 },
|
||||||
|
{ id: 'Large_Square', width: 10, height: 10 },
|
||||||
|
];
|
||||||
|
const cmPerInch = 2.54;
|
||||||
|
const pxPerInch = 96;
|
||||||
|
|
||||||
|
const showAs = (val, unit)=>{
|
||||||
|
switch (unit) {
|
||||||
|
case 'cm':
|
||||||
|
return Math.round(val*cmPerInch);
|
||||||
|
case 'px':
|
||||||
|
return Math.round(val*pxPerInch);
|
||||||
|
default:
|
||||||
|
return val;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const unit = 'cm';
|
||||||
|
|
||||||
|
export function NewDocumentForm() {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<nav className='popupTabs'>
|
||||||
|
<button>templates</button>
|
||||||
|
<button>import</button>
|
||||||
|
<button>clone</button>
|
||||||
|
</nav>
|
||||||
|
<div className='content'>
|
||||||
|
<div className='templates'>
|
||||||
|
{sizes.map((size)=>(
|
||||||
|
<div className='template' key={size.id} onClick={()=>{}}>
|
||||||
|
<div
|
||||||
|
className='image'
|
||||||
|
style={{ height: '100px', width: `${(size.width / size.height) * 100}px` }}>
|
||||||
|
<span>{showAs(size.width, unit)}{unit} by {showAs(size.height, unit)}{unit}</span>
|
||||||
|
</div>
|
||||||
|
<span>{size.id.replaceAll('_', ' ')}</span>
|
||||||
|
</div>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
<div className='metadataPanel'>
|
||||||
|
<div className='field title'>
|
||||||
|
<label>title</label>
|
||||||
|
<input type='text' defaultValue='' placeholder='title' className='title' onChange={(e)=>{}} />
|
||||||
|
</div>
|
||||||
|
<div className='field description'>
|
||||||
|
<label>description</label>
|
||||||
|
<textarea className='description'onChange={(e)=>{}} />
|
||||||
|
</div>
|
||||||
|
<button
|
||||||
|
id='newButton'
|
||||||
|
onClick={()=>{
|
||||||
|
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Create new
|
||||||
|
<i
|
||||||
|
className={'fa-solid fa-file'}
|
||||||
|
/>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
98
client/components/newDocumentForm.less
Normal file
98
client/components/newDocumentForm.less
Normal file
@@ -0,0 +1,98 @@
|
|||||||
|
.newBrewPopup {
|
||||||
|
position: relative;
|
||||||
|
background: #282828;
|
||||||
|
border: unset;
|
||||||
|
display: grid;
|
||||||
|
grid-template-rows: 50px 1fr;
|
||||||
|
padding: 0;
|
||||||
|
color: #ddd;
|
||||||
|
border-radius: 10px;
|
||||||
|
box-shadow: 1px 0 14px black;
|
||||||
|
|
||||||
|
.popupTabs {
|
||||||
|
padding: 10px;
|
||||||
|
padding-right:100px;
|
||||||
|
padding-left:50px;
|
||||||
|
background: #333;
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-evenly;
|
||||||
|
}
|
||||||
|
|
||||||
|
.content {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: 1fr 200px;
|
||||||
|
height:100% !important;
|
||||||
|
|
||||||
|
.templates {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(5, 1fr);
|
||||||
|
padding: 50px;
|
||||||
|
gap:30px;
|
||||||
|
box-shadow: inset 0 0 20px rgba(0,0,0,0.62);
|
||||||
|
|
||||||
|
.template {
|
||||||
|
width: 100px;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
text-align:center;
|
||||||
|
align-items: center;
|
||||||
|
gap:10px;
|
||||||
|
|
||||||
|
.image {
|
||||||
|
background-color:#444;
|
||||||
|
border:2px solid #777;
|
||||||
|
border-radius:2px;
|
||||||
|
display:grid;
|
||||||
|
place-items:center;
|
||||||
|
padding:10px;
|
||||||
|
font-size:12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.metadataPanel {
|
||||||
|
height:100%;
|
||||||
|
background-color: #555;
|
||||||
|
padding:25px;
|
||||||
|
|
||||||
|
.field {
|
||||||
|
display:grid;
|
||||||
|
grid-template-columns:50px 1fr;
|
||||||
|
}
|
||||||
|
|
||||||
|
#newButton {
|
||||||
|
.colorButton(@green);
|
||||||
|
position : absolute;
|
||||||
|
right : 10px;
|
||||||
|
bottom : 10px;
|
||||||
|
|
||||||
|
i {
|
||||||
|
margin-left : 10px;
|
||||||
|
animation-duration : 1000s;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.dismiss {
|
||||||
|
position: absolute;
|
||||||
|
top: 0px;
|
||||||
|
right: 0px;
|
||||||
|
width:50px;
|
||||||
|
height:50px;
|
||||||
|
z-index:10;
|
||||||
|
display:grid;
|
||||||
|
place-items:center;
|
||||||
|
}
|
||||||
|
|
||||||
|
input, textarea {
|
||||||
|
color:white;
|
||||||
|
background-color:#333;
|
||||||
|
border-radius:5px;
|
||||||
|
outline:1px solid #777;
|
||||||
|
border:unset;
|
||||||
|
box-shadow: inset 0 0 5px rgba(0,0,0,0.62);
|
||||||
|
width:100%;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -4,13 +4,13 @@ const React = require('react');
|
|||||||
const { useState, useRef, useMemo, useEffect } = React;
|
const { useState, useRef, useMemo, useEffect } = React;
|
||||||
const _ = require('lodash');
|
const _ = require('lodash');
|
||||||
|
|
||||||
const MarkdownLegacy = require('markdownLegacy.js');
|
const MarkdownLegacy = require('naturalcrit/markdownLegacy.js');
|
||||||
import Markdown from 'markdown.js';
|
import Markdown from 'naturalcrit/markdown.js';
|
||||||
const ErrorBar = require('./errorBar/errorBar.jsx');
|
const ErrorBar = require('./errorBar/errorBar.jsx');
|
||||||
const ToolBar = require('./toolBar/toolBar.jsx');
|
const ToolBar = require('./toolBar/toolBar.jsx');
|
||||||
|
|
||||||
//TODO: move to the brew renderer
|
//TODO: move to the brew renderer
|
||||||
const RenderWarnings = require('client/components/renderWarnings/renderWarnings.jsx');
|
const RenderWarnings = require('homebrewery/renderWarnings/renderWarnings.jsx');
|
||||||
const NotificationPopup = require('./notificationPopup/notificationPopup.jsx');
|
const NotificationPopup = require('./notificationPopup/notificationPopup.jsx');
|
||||||
const Frame = require('react-frame-component').default;
|
const Frame = require('react-frame-component').default;
|
||||||
const dedent = require('dedent-tabs').default;
|
const dedent = require('dedent-tabs').default;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
require('./notificationPopup.less');
|
require('./notificationPopup.less');
|
||||||
import React, { useEffect, useState } from 'react';
|
import React, { useEffect, useState } from 'react';
|
||||||
import request from '../../utils/request-middleware.js';
|
import request from '../../utils/request-middleware.js';
|
||||||
import Markdown from 'markdown.js';
|
import Markdown from 'naturalcrit/markdown.js';
|
||||||
|
|
||||||
import Dialog from '../../../components/dialog.jsx';
|
import Dialog from '../../../components/dialog.jsx';
|
||||||
|
|
||||||
|
|||||||
@@ -4,9 +4,9 @@ const React = require('react');
|
|||||||
const createClass = require('create-react-class');
|
const createClass = require('create-react-class');
|
||||||
const _ = require('lodash');
|
const _ = require('lodash');
|
||||||
const dedent = require('dedent-tabs').default;
|
const dedent = require('dedent-tabs').default;
|
||||||
import Markdown from '../../../shared/markdown.js';
|
import Markdown from '../../../shared/naturalcrit/markdown.js';
|
||||||
|
|
||||||
const CodeEditor = require('client/components/codeEditor/codeEditor.jsx');
|
const CodeEditor = require('naturalcrit/codeEditor/codeEditor.jsx');
|
||||||
const SnippetBar = require('./snippetbar/snippetbar.jsx');
|
const SnippetBar = require('./snippetbar/snippetbar.jsx');
|
||||||
const MetadataEditor = require('./metadataEditor/metadataEditor.jsx');
|
const MetadataEditor = require('./metadataEditor/metadataEditor.jsx');
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
const React = require('react');
|
const React = require('react');
|
||||||
const createClass = require('create-react-class');
|
const createClass = require('create-react-class');
|
||||||
const Nav = require('client/homebrew/navbar/nav.jsx');
|
const Nav = require('naturalcrit/nav/nav.jsx');
|
||||||
const request = require('superagent');
|
const request = require('superagent');
|
||||||
|
|
||||||
const Account = createClass({
|
const Account = createClass({
|
||||||
@@ -70,7 +70,7 @@ const Account = createClass({
|
|||||||
{global.account.username}
|
{global.account.username}
|
||||||
</Nav.item>
|
</Nav.item>
|
||||||
<Nav.item
|
<Nav.item
|
||||||
href={`/user/${encodeURIComponent(global.account.username)}`}
|
href={`/user/${encodeURI(global.account.username)}`}
|
||||||
color='yellow'
|
color='yellow'
|
||||||
icon='fas fa-beer'
|
icon='fas fa-beer'
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
require('./error-navitem.less');
|
require('./error-navitem.less');
|
||||||
const React = require('react');
|
const React = require('react');
|
||||||
const Nav = require('client/homebrew/navbar/nav.jsx');
|
const Nav = require('naturalcrit/nav/nav.jsx');
|
||||||
|
|
||||||
const ErrorNavItem = ({ error = '', clearError })=>{
|
const ErrorNavItem = ({ error = '', clearError })=>{
|
||||||
const response = error.response;
|
const response = error.response;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
const React = require('react');
|
const React = require('react');
|
||||||
const dedent = require('dedent-tabs').default;
|
const dedent = require('dedent-tabs').default;
|
||||||
|
|
||||||
const Nav = require('client/homebrew/navbar/nav.jsx');
|
const Nav = require('naturalcrit/nav/nav.jsx');
|
||||||
|
|
||||||
module.exports = function(props){
|
module.exports = function(props){
|
||||||
return <Nav.dropdown>
|
return <Nav.dropdown>
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ const React = require('react');
|
|||||||
const createClass = require('create-react-class');
|
const createClass = require('create-react-class');
|
||||||
const Moment = require('moment');
|
const Moment = require('moment');
|
||||||
|
|
||||||
const Nav = require('client/homebrew/navbar/nav.jsx');
|
const Nav = require('naturalcrit/nav/nav.jsx');
|
||||||
|
|
||||||
|
|
||||||
const MetadataNav = createClass({
|
const MetadataNav = createClass({
|
||||||
@@ -32,7 +32,7 @@ const MetadataNav = createClass({
|
|||||||
return <>
|
return <>
|
||||||
{this.props.brew.authors.map((author, idx, arr)=>{
|
{this.props.brew.authors.map((author, idx, arr)=>{
|
||||||
const spacer = arr.length - 1 == idx ? <></> : <span>, </span>;
|
const spacer = arr.length - 1 == idx ? <></> : <span>, </span>;
|
||||||
return <span key={idx}><a className='userPageLink' href={`/user/${encodeURIComponent(author)}`}>{author}</a>{spacer}</span>;
|
return <span key={idx}><a className='userPageLink' href={`/user/${author}`}>{author}</a>{spacer}</span>;
|
||||||
})}
|
})}
|
||||||
</>;
|
</>;
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ require('./navbar.less');
|
|||||||
const React = require('react');
|
const React = require('react');
|
||||||
const createClass = require('create-react-class');
|
const createClass = require('create-react-class');
|
||||||
|
|
||||||
const Nav = require('client/homebrew/navbar/nav.jsx');
|
const Nav = require('naturalcrit/nav/nav.jsx');
|
||||||
const PatreonNavItem = require('./patreon.navitem.jsx');
|
const PatreonNavItem = require('./patreon.navitem.jsx');
|
||||||
|
|
||||||
const Navbar = createClass({
|
const Navbar = createClass({
|
||||||
|
|||||||
@@ -1,13 +1,22 @@
|
|||||||
const React = require('react');
|
const React = require('react');
|
||||||
|
const { useState } = React;
|
||||||
|
|
||||||
const _ = require('lodash');
|
const _ = require('lodash');
|
||||||
const Nav = require('client/homebrew/navbar/nav.jsx');
|
const Nav = require('naturalcrit/nav/nav.jsx');
|
||||||
const { splitTextStyleAndMetadata } = require('../../../shared/helpers.js'); // Importing the function from helpers.js
|
const { splitTextStyleAndMetadata } = require('../../../shared/helpers.js'); // Importing the function from helpers.js
|
||||||
|
import Dialog from '../../components/dialog.jsx';
|
||||||
|
import { NewDocumentForm } from '../../components/newDocumentForm.jsx';
|
||||||
|
|
||||||
const BREWKEY = 'homebrewery-new';
|
const BREWKEY = 'homebrewery-new';
|
||||||
const STYLEKEY = 'homebrewery-new-style';
|
const STYLEKEY = 'homebrewery-new-style';
|
||||||
const METAKEY = 'homebrewery-new-meta';
|
const METAKEY = 'homebrewery-new-meta';
|
||||||
|
|
||||||
|
const DISMISS_BUTTON = <i className='fas fa-times dismiss' />;
|
||||||
|
|
||||||
const NewBrew = ()=>{
|
const NewBrew = ()=>{
|
||||||
|
|
||||||
|
const [open, setOpen] = useState(false);
|
||||||
|
|
||||||
const handleFileChange = (e)=>{
|
const handleFileChange = (e)=>{
|
||||||
const file = e.target.files[0];
|
const file = e.target.files[0];
|
||||||
if(!file) return;
|
if(!file) return;
|
||||||
@@ -43,15 +52,24 @@ const NewBrew = ()=>{
|
|||||||
reader.readAsText(file);
|
reader.readAsText(file);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
return <>
|
||||||
return (
|
|
||||||
<Nav.dropdown>
|
|
||||||
<Nav.item
|
<Nav.item
|
||||||
className='new'
|
className='new'
|
||||||
color='purple'
|
color='purple'
|
||||||
icon='fa-solid fa-plus-square'>
|
icon='fa-solid fa-plus-square'
|
||||||
|
onClick={()=>{ setOpen(true);}}>
|
||||||
new
|
new
|
||||||
|
|
||||||
</Nav.item>
|
</Nav.item>
|
||||||
|
{open && <Dialog blocking className='newBrewPopup' closeText={DISMISS_BUTTON} callbackFn={()=>{setOpen(false);}}>
|
||||||
|
<NewDocumentForm/>
|
||||||
|
</Dialog>
|
||||||
|
}
|
||||||
|
|
||||||
|
</>;
|
||||||
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
<Nav.item
|
<Nav.item
|
||||||
className='fromBlank'
|
className='fromBlank'
|
||||||
href='/new'
|
href='/new'
|
||||||
@@ -60,7 +78,6 @@ const NewBrew = ()=>{
|
|||||||
icon='fa-solid fa-file'>
|
icon='fa-solid fa-file'>
|
||||||
from blank
|
from blank
|
||||||
</Nav.item>
|
</Nav.item>
|
||||||
|
|
||||||
<Nav.item
|
<Nav.item
|
||||||
className='fromFile'
|
className='fromFile'
|
||||||
color='purple'
|
color='purple'
|
||||||
@@ -69,8 +86,7 @@ const NewBrew = ()=>{
|
|||||||
<input id='uploadTxt' className='newFromLocal' type='file' onChange={handleFileChange} style={{ display: 'none' }} />
|
<input id='uploadTxt' className='newFromLocal' type='file' onChange={handleFileChange} style={{ display: 'none' }} />
|
||||||
from file
|
from file
|
||||||
</Nav.item>
|
</Nav.item>
|
||||||
</Nav.dropdown>
|
*/
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
module.exports = NewBrew;
|
module.exports = NewBrew;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
const React = require('react');
|
const React = require('react');
|
||||||
const Nav = require('client/homebrew/navbar/nav.jsx');
|
const Nav = require('naturalcrit/nav/nav.jsx');
|
||||||
|
|
||||||
module.exports = function(props){
|
module.exports = function(props){
|
||||||
return <Nav.item
|
return <Nav.item
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
const React = require('react');
|
const React = require('react');
|
||||||
const Nav = require('client/homebrew/navbar/nav.jsx');
|
const Nav = require('naturalcrit/nav/nav.jsx');
|
||||||
const { printCurrentBrew } = require('../../../shared/helpers.js');
|
const { printCurrentBrew } = require('../../../shared/helpers.js');
|
||||||
|
|
||||||
module.exports = function(){
|
module.exports = function(){
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ const createClass = require('create-react-class');
|
|||||||
const _ = require('lodash');
|
const _ = require('lodash');
|
||||||
const Moment = require('moment');
|
const Moment = require('moment');
|
||||||
|
|
||||||
const Nav = require('client/homebrew/navbar/nav.jsx');
|
const Nav = require('naturalcrit/nav/nav.jsx');
|
||||||
|
|
||||||
const EDIT_KEY = 'HB_nav_recentlyEdited';
|
const EDIT_KEY = 'HB_nav_recentlyEdited';
|
||||||
const VIEW_KEY = 'HB_nav_recentlyViewed';
|
const VIEW_KEY = 'HB_nav_recentlyViewed';
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import dedent from 'dedent-tabs';
|
import dedent from 'dedent-tabs';
|
||||||
import Nav from 'client/homebrew/navbar/nav.jsx';
|
import Nav from 'naturalcrit/nav/nav.jsx';
|
||||||
|
|
||||||
const getShareId = (brew)=>(
|
const getShareId = (brew)=>(
|
||||||
brew.googleId && !brew.stubbed
|
brew.googleId && !brew.stubbed
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
const React = require('react');
|
const React = require('react');
|
||||||
|
|
||||||
const Nav = require('client/homebrew/navbar/nav.jsx');
|
const Nav = require('naturalcrit/nav/nav.jsx');
|
||||||
|
|
||||||
module.exports = function (props) {
|
module.exports = function (props) {
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
const React = require('react');
|
const React = require('react');
|
||||||
const moment = require('moment');
|
const moment = require('moment');
|
||||||
const UIPage = require('../basePages/uiPage/uiPage.jsx');
|
const UIPage = require('../basePages/uiPage/uiPage.jsx');
|
||||||
const NaturalCritIcon = require('client/components/svg/naturalcrit-d20.svg.jsx');
|
const NaturalCritIcon = require('naturalcrit/svg/naturalcrit.svg.jsx');
|
||||||
|
|
||||||
let SAVEKEY = '';
|
let SAVEKEY = '';
|
||||||
|
|
||||||
|
|||||||
@@ -143,7 +143,7 @@ const BrewItem = ({
|
|||||||
<span title="Username contained an email address; hidden to protect user's privacy">
|
<span title="Username contained an email address; hidden to protect user's privacy">
|
||||||
{author}
|
{author}
|
||||||
</span>
|
</span>
|
||||||
) : (<a href={`/user/${encodeURIComponent(author)}`}>{author}</a>)}
|
) : (<a href={`/user/${author}`}>{author}</a>)}
|
||||||
{index < brew.authors.length - 1 && ', '}
|
{index < brew.authors.length - 1 && ', '}
|
||||||
</React.Fragment>
|
</React.Fragment>
|
||||||
))}
|
))}
|
||||||
|
|||||||
@@ -2,12 +2,12 @@ require('./uiPage.less');
|
|||||||
const React = require('react');
|
const React = require('react');
|
||||||
const createClass = require('create-react-class');
|
const createClass = require('create-react-class');
|
||||||
|
|
||||||
const Nav = require('client/homebrew/navbar/nav.jsx');
|
const Nav = require('naturalcrit/nav/nav.jsx');
|
||||||
const Navbar = require('client/homebrew/navbar/navbar.jsx');
|
const Navbar = require('../../../navbar/navbar.jsx');
|
||||||
const NewBrewItem = require('client/homebrew/navbar/newbrew.navitem.jsx');
|
const NewBrewItem = require('../../../navbar/newbrew.navitem.jsx');
|
||||||
const HelpNavItem = require('client/homebrew/navbar/help.navitem.jsx');
|
const HelpNavItem = require('../../../navbar/help.navitem.jsx');
|
||||||
const RecentNavItem = require('client/homebrew/navbar/recent.navitem.jsx').both;
|
const RecentNavItem = require('../../../navbar/recent.navitem.jsx').both;
|
||||||
const Account = require('client/homebrew/navbar/account.navitem.jsx');
|
const Account = require('../../../navbar/account.navitem.jsx');
|
||||||
|
|
||||||
|
|
||||||
const UIPage = createClass({
|
const UIPage = createClass({
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import './editPage.less';
|
|||||||
// Common imports
|
// Common imports
|
||||||
import React, { useState, useEffect, useRef } from 'react';
|
import React, { useState, useEffect, useRef } from 'react';
|
||||||
import request from '../../utils/request-middleware.js';
|
import request from '../../utils/request-middleware.js';
|
||||||
import Markdown from 'markdown.js';
|
import Markdown from 'naturalcrit/markdown.js';
|
||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
|
|
||||||
import { DEFAULT_BREW_LOAD } from '../../../../server/brewDefaults.js';
|
import { DEFAULT_BREW_LOAD } from '../../../../server/brewDefaults.js';
|
||||||
@@ -14,15 +14,15 @@ import SplitPane from 'client/components/splitPane/splitPane.jsx';
|
|||||||
import Editor from '../../editor/editor.jsx';
|
import Editor from '../../editor/editor.jsx';
|
||||||
import BrewRenderer from '../../brewRenderer/brewRenderer.jsx';
|
import BrewRenderer from '../../brewRenderer/brewRenderer.jsx';
|
||||||
|
|
||||||
import Nav from 'client/homebrew/navbar/nav.jsx';
|
import Nav from 'naturalcrit/nav/nav.jsx';
|
||||||
import Navbar from 'client/homebrew/navbar/navbar.jsx';
|
import Navbar from '../../navbar/navbar.jsx';
|
||||||
import NewBrewItem from 'client/homebrew/navbar/newbrew.navitem.jsx';
|
import NewBrewItem from '../../navbar/newbrew.navitem.jsx';
|
||||||
import AccountNavItem from 'client/homebrew/navbar/account.navitem.jsx';
|
import AccountNavItem from '../../navbar/account.navitem.jsx';
|
||||||
import ErrorNavItem from 'client/homebrew/navbar/error-navitem.jsx';
|
import ErrorNavItem from '../../navbar/error-navitem.jsx';
|
||||||
import HelpNavItem from 'client/homebrew/navbar/help.navitem.jsx';
|
import HelpNavItem from '../../navbar/help.navitem.jsx';
|
||||||
import VaultNavItem from 'client/homebrew/navbar/vault.navitem.jsx';
|
import VaultNavItem from '../../navbar/vault.navitem.jsx';
|
||||||
import PrintNavItem from 'client/homebrew/navbar/print.navitem.jsx';
|
import PrintNavItem from '../../navbar/print.navitem.jsx';
|
||||||
import { both as RecentNavItem } from 'client/homebrew/navbar/recent.navitem.jsx';
|
import { both as RecentNavItem } from '../../navbar/recent.navitem.jsx';
|
||||||
|
|
||||||
// Page specific imports
|
// Page specific imports
|
||||||
import { Meta } from 'vitreum/headtags';
|
import { Meta } from 'vitreum/headtags';
|
||||||
@@ -30,7 +30,7 @@ import { md5 } from 'hash-wasm';
|
|||||||
import { gzipSync, strToU8 } from 'fflate';
|
import { gzipSync, strToU8 } from 'fflate';
|
||||||
import { makePatches, stringifyPatches } from '@sanity/diff-match-patch';
|
import { makePatches, stringifyPatches } from '@sanity/diff-match-patch';
|
||||||
|
|
||||||
import ShareNavItem from 'client/homebrew/navbar/share.navitem.jsx';
|
import ShareNavItem from '../../navbar/share.navitem.jsx';
|
||||||
import LockNotification from './lockNotification/lockNotification.jsx';
|
import LockNotification from './lockNotification/lockNotification.jsx';
|
||||||
import { updateHistory, versionHistoryGarbageCollection } from '../../utils/versionHistory.js';
|
import { updateHistory, versionHistoryGarbageCollection } from '../../utils/versionHistory.js';
|
||||||
import googleDriveIcon from '../../googleDrive.svg';
|
import googleDriveIcon from '../../googleDrive.svg';
|
||||||
@@ -119,10 +119,6 @@ const EditPage = (props)=>{
|
|||||||
if(autoSaveEnabled) trySave(false, hasChange);
|
if(autoSaveEnabled) trySave(false, hasChange);
|
||||||
}, [currentBrew]);
|
}, [currentBrew]);
|
||||||
|
|
||||||
useEffect(()=>{
|
|
||||||
trySave(true);
|
|
||||||
}, [saveGoogle]);
|
|
||||||
|
|
||||||
const handleSplitMove = ()=>{
|
const handleSplitMove = ()=>{
|
||||||
editorRef.current?.update();
|
editorRef.current?.update();
|
||||||
};
|
};
|
||||||
@@ -183,6 +179,7 @@ const EditPage = (props)=>{
|
|||||||
const toggleGoogleStorage = ()=>{
|
const toggleGoogleStorage = ()=>{
|
||||||
setSaveGoogle((prev)=>!prev);
|
setSaveGoogle((prev)=>!prev);
|
||||||
setError(null);
|
setError(null);
|
||||||
|
trySave(true);
|
||||||
};
|
};
|
||||||
|
|
||||||
const trySave = (immediate = false, hasChanges = true)=>{
|
const trySave = (immediate = false, hasChanges = true)=>{
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
require('./errorPage.less');
|
require('./errorPage.less');
|
||||||
const React = require('react');
|
const React = require('react');
|
||||||
const UIPage = require('../basePages/uiPage/uiPage.jsx');
|
const UIPage = require('../basePages/uiPage/uiPage.jsx');
|
||||||
import Markdown from '../../../../shared/markdown.js';
|
import Markdown from '../../../../shared/naturalcrit/markdown.js';
|
||||||
const ErrorIndex = require('./errors/errorIndex.js');
|
const ErrorIndex = require('./errors/errorIndex.js');
|
||||||
|
|
||||||
const ErrorPage = ({ brew })=>{
|
const ErrorPage = ({ brew })=>{
|
||||||
|
|||||||
@@ -96,7 +96,7 @@ const errorIndex = (props)=>{
|
|||||||
|
|
||||||
**Brew Title:** ${escape(props.brew.brewTitle) || 'Unable to show title'}
|
**Brew Title:** ${escape(props.brew.brewTitle) || 'Unable to show title'}
|
||||||
|
|
||||||
**Current Authors:** ${props.brew.authors?.map((author)=>{return `[${author}](/user/${encodeURIComponent(author)})`;}).join(', ') || 'Unable to list authors'}
|
**Current Authors:** ${props.brew.authors?.map((author)=>{return `[${author}](/user/${author})`;}).join(', ') || 'Unable to list authors'}
|
||||||
|
|
||||||
[Click here to be redirected to the brew's share page.](/share/${props.brew.shareId})`,
|
[Click here to be redirected to the brew's share page.](/share/${props.brew.shareId})`,
|
||||||
|
|
||||||
@@ -111,7 +111,7 @@ const errorIndex = (props)=>{
|
|||||||
|
|
||||||
**Brew Title:** ${escape(props.brew.brewTitle) || 'Unable to show title'}
|
**Brew Title:** ${escape(props.brew.brewTitle) || 'Unable to show title'}
|
||||||
|
|
||||||
**Current Authors:** ${props.brew.authors?.map((author)=>{return `[${author}](/user/${encodeURIComponent(author)})`;}).join(', ') || 'Unable to list authors'}
|
**Current Authors:** ${props.brew.authors?.map((author)=>{return `[${author}](/user/${author})`;}).join(', ') || 'Unable to list authors'}
|
||||||
|
|
||||||
[Click here to be redirected to the brew's share page.](/share/${props.brew.shareId})`,
|
[Click here to be redirected to the brew's share page.](/share/${props.brew.shareId})`,
|
||||||
|
|
||||||
@@ -222,7 +222,7 @@ const errorIndex = (props)=>{
|
|||||||
|
|
||||||
**Brew Title:** ${escape(props.brew.brewTitle)}
|
**Brew Title:** ${escape(props.brew.brewTitle)}
|
||||||
|
|
||||||
**Brew Authors:** ${props.brew.authors?.map((author)=>{return `[${author}](/user/${encodeURIComponent(author)})`;}).join(', ') || 'Unable to list authors'}`,
|
**Brew Authors:** ${props.brew.authors?.map((author)=>{return `[${author}](/user/${author})`;}).join(', ') || 'Unable to list authors'}`,
|
||||||
|
|
||||||
// ####### Admin page error #######
|
// ####### Admin page error #######
|
||||||
'52' : dedent`
|
'52' : dedent`
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import './homePage.less';
|
|||||||
// Common imports
|
// Common imports
|
||||||
import React, { useState, useEffect, useRef } from 'react';
|
import React, { useState, useEffect, useRef } from 'react';
|
||||||
import request from '../../utils/request-middleware.js';
|
import request from '../../utils/request-middleware.js';
|
||||||
import Markdown from 'markdown.js';
|
import Markdown from 'naturalcrit/markdown.js';
|
||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
|
|
||||||
import { DEFAULT_BREW } from '../../../../server/brewDefaults.js';
|
import { DEFAULT_BREW } from '../../../../server/brewDefaults.js';
|
||||||
@@ -14,15 +14,15 @@ import SplitPane from 'client/components/splitPane/splitPane.jsx';
|
|||||||
import Editor from '../../editor/editor.jsx';
|
import Editor from '../../editor/editor.jsx';
|
||||||
import BrewRenderer from '../../brewRenderer/brewRenderer.jsx';
|
import BrewRenderer from '../../brewRenderer/brewRenderer.jsx';
|
||||||
|
|
||||||
import Nav from 'client/homebrew/navbar/nav.jsx';
|
import Nav from 'naturalcrit/nav/nav.jsx';
|
||||||
import Navbar from 'client/homebrew/navbar/navbar.jsx';
|
import Navbar from '../../navbar/navbar.jsx';
|
||||||
import NewBrewItem from 'client/homebrew/navbar/newbrew.navitem.jsx';
|
import NewBrewItem from '../../navbar/newbrew.navitem.jsx';
|
||||||
import AccountNavItem from 'client/homebrew/navbar/account.navitem.jsx';
|
import AccountNavItem from '../../navbar/account.navitem.jsx';
|
||||||
import ErrorNavItem from 'client/homebrew/navbar/error-navitem.jsx';
|
import ErrorNavItem from '../../navbar/error-navitem.jsx';
|
||||||
import HelpNavItem from 'client/homebrew/navbar/help.navitem.jsx';
|
import HelpNavItem from '../../navbar/help.navitem.jsx';
|
||||||
import VaultNavItem from 'client/homebrew/navbar/vault.navitem.jsx';
|
import VaultNavItem from '../../navbar/vault.navitem.jsx';
|
||||||
import PrintNavItem from 'client/homebrew/navbar/print.navitem.jsx';
|
import PrintNavItem from '../../navbar/print.navitem.jsx';
|
||||||
import { both as RecentNavItem } from 'client/homebrew/navbar/recent.navitem.jsx';
|
import { both as RecentNavItem } from '../../navbar/recent.navitem.jsx';
|
||||||
|
|
||||||
// Page specific imports
|
// Page specific imports
|
||||||
import { Meta } from 'vitreum/headtags';
|
import { Meta } from 'vitreum/headtags';
|
||||||
@@ -55,7 +55,6 @@ const HomePage =(props)=>{
|
|||||||
|
|
||||||
const editorRef = useRef(null);
|
const editorRef = useRef(null);
|
||||||
const lastSavedBrew = useRef(_.cloneDeep(props.brew));
|
const lastSavedBrew = useRef(_.cloneDeep(props.brew));
|
||||||
const unsavedChangesRef = useRef(unsavedChanges);
|
|
||||||
|
|
||||||
useEffect(()=>{
|
useEffect(()=>{
|
||||||
fetchThemeBundle(setError, setThemeBundle, currentBrew.renderer, currentBrew.theme);
|
fetchThemeBundle(setError, setThemeBundle, currentBrew.renderer, currentBrew.theme);
|
||||||
@@ -71,20 +70,12 @@ const HomePage =(props)=>{
|
|||||||
};
|
};
|
||||||
|
|
||||||
document.addEventListener('keydown', handleControlKeys);
|
document.addEventListener('keydown', handleControlKeys);
|
||||||
window.onbeforeunload = ()=>{
|
|
||||||
if(unsavedChangesRef.current)
|
|
||||||
return 'You have unsaved changes!';
|
|
||||||
};
|
|
||||||
return ()=>{
|
return ()=>{
|
||||||
document.removeEventListener('keydown', handleControlKeys);
|
document.removeEventListener('keydown', handleControlKeys);
|
||||||
window.onbeforeunload = null;
|
|
||||||
};
|
};
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
useEffect(()=>{
|
|
||||||
unsavedChangesRef.current = unsavedChanges;
|
|
||||||
}, [unsavedChanges]);
|
|
||||||
|
|
||||||
const save = ()=>{
|
const save = ()=>{
|
||||||
request.post('/api')
|
request.post('/api')
|
||||||
.send(currentBrew)
|
.send(currentBrew)
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import './newPage.less';
|
|||||||
// Common imports
|
// Common imports
|
||||||
import React, { useState, useEffect, useRef } from 'react';
|
import React, { useState, useEffect, useRef } from 'react';
|
||||||
import request from '../../utils/request-middleware.js';
|
import request from '../../utils/request-middleware.js';
|
||||||
import Markdown from 'markdown.js';
|
import Markdown from 'naturalcrit/markdown.js';
|
||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
|
|
||||||
import { DEFAULT_BREW } from '../../../../server/brewDefaults.js';
|
import { DEFAULT_BREW } from '../../../../server/brewDefaults.js';
|
||||||
@@ -14,15 +14,15 @@ import SplitPane from 'client/components/splitPane/splitPane.jsx';
|
|||||||
import Editor from '../../editor/editor.jsx';
|
import Editor from '../../editor/editor.jsx';
|
||||||
import BrewRenderer from '../../brewRenderer/brewRenderer.jsx';
|
import BrewRenderer from '../../brewRenderer/brewRenderer.jsx';
|
||||||
|
|
||||||
import Nav from 'client/homebrew/navbar/nav.jsx';
|
import Nav from 'naturalcrit/nav/nav.jsx';
|
||||||
import Navbar from 'client/homebrew/navbar/navbar.jsx';
|
import Navbar from '../../navbar/navbar.jsx';
|
||||||
import NewBrewItem from 'client/homebrew/navbar/newbrew.navitem.jsx';
|
import NewBrewItem from '../../navbar/newbrew.navitem.jsx';
|
||||||
import AccountNavItem from 'client/homebrew/navbar/account.navitem.jsx';
|
import AccountNavItem from '../../navbar/account.navitem.jsx';
|
||||||
import ErrorNavItem from 'client/homebrew/navbar/error-navitem.jsx';
|
import ErrorNavItem from '../../navbar/error-navitem.jsx';
|
||||||
import HelpNavItem from 'client/homebrew/navbar/help.navitem.jsx';
|
import HelpNavItem from '../../navbar/help.navitem.jsx';
|
||||||
import VaultNavItem from 'client/homebrew/navbar/vault.navitem.jsx';
|
import VaultNavItem from '../../navbar/vault.navitem.jsx';
|
||||||
import PrintNavItem from 'client/homebrew/navbar/print.navitem.jsx';
|
import PrintNavItem from '../../navbar/print.navitem.jsx';
|
||||||
import { both as RecentNavItem } from 'client/homebrew/navbar/recent.navitem.jsx';
|
import { both as RecentNavItem } from '../../navbar/recent.navitem.jsx';
|
||||||
|
|
||||||
// Page specific imports
|
// Page specific imports
|
||||||
import { Meta } from 'vitreum/headtags';
|
import { Meta } from 'vitreum/headtags';
|
||||||
@@ -56,10 +56,6 @@ const NewPage = (props)=>{
|
|||||||
|
|
||||||
const editorRef = useRef(null);
|
const editorRef = useRef(null);
|
||||||
const lastSavedBrew = useRef(_.cloneDeep(props.brew));
|
const lastSavedBrew = useRef(_.cloneDeep(props.brew));
|
||||||
// const saveTimeout = useRef(null);
|
|
||||||
// const warnUnsavedTimeout = useRef(null);
|
|
||||||
const trySaveRef = useRef(trySave); // CTRL+S listener lives outside React and needs ref to use trySave with latest copy of brew
|
|
||||||
const unsavedChangesRef = useRef(unsavedChanges); // Similarly, onBeforeUnload lives outside React and needs ref to unsavedChanges
|
|
||||||
|
|
||||||
useEffect(()=>{
|
useEffect(()=>{
|
||||||
loadBrew();
|
loadBrew();
|
||||||
@@ -118,11 +114,6 @@ const NewPage = (props)=>{
|
|||||||
if(autoSaveEnabled) trySave(false, hasChange);
|
if(autoSaveEnabled) trySave(false, hasChange);
|
||||||
}, [currentBrew]);
|
}, [currentBrew]);
|
||||||
|
|
||||||
useEffect(()=>{
|
|
||||||
trySaveRef.current = trySave;
|
|
||||||
unsavedChangesRef.current = unsavedChanges;
|
|
||||||
});
|
|
||||||
|
|
||||||
const handleSplitMove = ()=>{
|
const handleSplitMove = ()=>{
|
||||||
editorRef.current.update();
|
editorRef.current.update();
|
||||||
};
|
};
|
||||||
@@ -150,7 +141,7 @@ const NewPage = (props)=>{
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const trySave = async ()=>{
|
const save = async ()=>{
|
||||||
setIsSaving(true);
|
setIsSaving(true);
|
||||||
|
|
||||||
const updatedBrew = { ...currentBrew };
|
const updatedBrew = { ...currentBrew };
|
||||||
@@ -199,7 +190,7 @@ const NewPage = (props)=>{
|
|||||||
|
|
||||||
// #3 - Unsaved changes exist, click to save, show SAVE NOW
|
// #3 - Unsaved changes exist, click to save, show SAVE NOW
|
||||||
if(unsavedChanges)
|
if(unsavedChanges)
|
||||||
return <Nav.item className='save' onClick={trySave} color='blue' icon='fas fa-save'>save now</Nav.item>;
|
return <Nav.item className='save' onClick={save} color='blue' icon='fas fa-save'>save now</Nav.item>;
|
||||||
|
|
||||||
// #4 - No unsaved changes, autosave is ON, show AUTO-SAVED
|
// #4 - No unsaved changes, autosave is ON, show AUTO-SAVED
|
||||||
if(autoSaveEnabled)
|
if(autoSaveEnabled)
|
||||||
|
|||||||
@@ -3,12 +3,12 @@ const React = require('react');
|
|||||||
const { useState, useEffect, useCallback } = React;
|
const { useState, useEffect, useCallback } = React;
|
||||||
const { Meta } = require('vitreum/headtags');
|
const { Meta } = require('vitreum/headtags');
|
||||||
|
|
||||||
const Nav = require('client/homebrew/navbar/nav.jsx');
|
const Nav = require('naturalcrit/nav/nav.jsx');
|
||||||
const Navbar = require('client/homebrew/navbar/navbar.jsx');
|
const Navbar = require('../../navbar/navbar.jsx');
|
||||||
const MetadataNav = require('client/homebrew/navbar/metadata.navitem.jsx');
|
const MetadataNav = require('../../navbar/metadata.navitem.jsx');
|
||||||
const PrintNavItem = require('client/homebrew/navbar/print.navitem.jsx');
|
const PrintNavItem = require('../../navbar/print.navitem.jsx');
|
||||||
const RecentNavItem = require('client/homebrew/navbar/recent.navitem.jsx').both;
|
const RecentNavItem = require('../../navbar/recent.navitem.jsx').both;
|
||||||
const Account = require('client/homebrew/navbar/account.navitem.jsx');
|
const Account = require('../../navbar/account.navitem.jsx');
|
||||||
const BrewRenderer = require('../../brewRenderer/brewRenderer.jsx');
|
const BrewRenderer = require('../../brewRenderer/brewRenderer.jsx');
|
||||||
|
|
||||||
const { DEFAULT_BREW_LOAD } = require('../../../../server/brewDefaults.js');
|
const { DEFAULT_BREW_LOAD } = require('../../../../server/brewDefaults.js');
|
||||||
|
|||||||
@@ -4,14 +4,14 @@ const _ = require('lodash');
|
|||||||
|
|
||||||
const ListPage = require('../basePages/listPage/listPage.jsx');
|
const ListPage = require('../basePages/listPage/listPage.jsx');
|
||||||
|
|
||||||
const Nav = require('client/homebrew/navbar/nav.jsx');
|
const Nav = require('naturalcrit/nav/nav.jsx');
|
||||||
const Navbar = require('client/homebrew/navbar/navbar.jsx');
|
const Navbar = require('../../navbar/navbar.jsx');
|
||||||
const RecentNavItem = require('client/homebrew/navbar/recent.navitem.jsx').both;
|
const RecentNavItem = require('../../navbar/recent.navitem.jsx').both;
|
||||||
const Account = require('client/homebrew/navbar/account.navitem.jsx');
|
const Account = require('../../navbar/account.navitem.jsx');
|
||||||
const NewBrew = require('client/homebrew/navbar/newbrew.navitem.jsx');
|
const NewBrew = require('../../navbar/newbrew.navitem.jsx');
|
||||||
const HelpNavItem = require('client/homebrew/navbar/help.navitem.jsx');
|
const HelpNavItem = require('../../navbar/help.navitem.jsx');
|
||||||
const ErrorNavItem = require('client/homebrew/navbar/error-navitem.jsx');
|
const ErrorNavItem = require('../../navbar/error-navitem.jsx');
|
||||||
const VaultNavitem = require('client/homebrew/navbar/vault.navitem.jsx');
|
const VaultNavitem = require('../../navbar/vault.navitem.jsx');
|
||||||
|
|
||||||
const UserPage = (props)=>{
|
const UserPage = (props)=>{
|
||||||
props = {
|
props = {
|
||||||
|
|||||||
@@ -5,12 +5,12 @@ require('./vaultPage.less');
|
|||||||
const React = require('react');
|
const React = require('react');
|
||||||
const { useState, useEffect, useRef } = React;
|
const { useState, useEffect, useRef } = React;
|
||||||
|
|
||||||
const Nav = require('client/homebrew/navbar/nav.jsx');
|
const Nav = require('naturalcrit/nav/nav.jsx');
|
||||||
const Navbar = require('client/homebrew/navbar/navbar.jsx');
|
const Navbar = require('../../navbar/navbar.jsx');
|
||||||
const RecentNavItem = require('client/homebrew/navbar/recent.navitem.jsx').both;
|
const RecentNavItem = require('../../navbar/recent.navitem.jsx').both;
|
||||||
const Account = require('client/homebrew/navbar/account.navitem.jsx');
|
const Account = require('../../navbar/account.navitem.jsx');
|
||||||
const NewBrew = require('client/homebrew/navbar/newbrew.navitem.jsx');
|
const NewBrew = require('../../navbar/newbrew.navitem.jsx');
|
||||||
const HelpNavItem = require('client/homebrew/navbar/help.navitem.jsx');
|
const HelpNavItem = require('../../navbar/help.navitem.jsx');
|
||||||
const BrewItem = require('../basePages/listPage/brewItem/brewItem.jsx');
|
const BrewItem = require('../basePages/listPage/brewItem/brewItem.jsx');
|
||||||
const SplitPane = require('client/components/splitPane/splitPane.jsx');
|
const SplitPane = require('client/components/splitPane/splitPane.jsx');
|
||||||
const ErrorIndex = require('../errorPage/errors/errorIndex.js');
|
const ErrorIndex = require('../errorPage/errors/errorIndex.js');
|
||||||
|
|||||||
4
package-lock.json
generated
4
package-lock.json
generated
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "homebrewery",
|
"name": "homebrewery",
|
||||||
"version": "3.20.0",
|
"version": "3.19.3",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "homebrewery",
|
"name": "homebrewery",
|
||||||
"version": "3.20.0",
|
"version": "3.19.3",
|
||||||
"hasInstallScript": true,
|
"hasInstallScript": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "homebrewery",
|
"name": "homebrewery",
|
||||||
"description": "Create authentic looking D&D homebrews using only markdown",
|
"description": "Create authentic looking D&D homebrews using only markdown",
|
||||||
"version": "3.20.0",
|
"version": "3.19.3",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"engines": {
|
"engines": {
|
||||||
"npm": "^10.8.x",
|
"npm": "^10.8.x",
|
||||||
@@ -44,9 +44,7 @@
|
|||||||
"phb": "node --experimental-require-module scripts/phb.js",
|
"phb": "node --experimental-require-module scripts/phb.js",
|
||||||
"prod": "set NODE_ENV=production && npm run build",
|
"prod": "set NODE_ENV=production && npm run build",
|
||||||
"postinstall": "npm run build",
|
"postinstall": "npm run build",
|
||||||
"start": "node --experimental-require-module server.js",
|
"start": "node --experimental-require-module server.js"
|
||||||
"docker:build": "docker build -t ${DOCKERID}/homebrewery:$npm_package_version .",
|
|
||||||
"docker:publish": "docker login && docker push ${DOCKERID}/homebrewery:$npm_package_version"
|
|
||||||
},
|
},
|
||||||
"author": "stolksdorf",
|
"author": "stolksdorf",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import { model as HomebrewModel } from './homebrew.model.js';
|
|||||||
import express from 'express';
|
import express from 'express';
|
||||||
import zlib from 'zlib';
|
import zlib from 'zlib';
|
||||||
import GoogleActions from './googleActions.js';
|
import GoogleActions from './googleActions.js';
|
||||||
import Markdown from '../shared/markdown.js';
|
import Markdown from '../shared/naturalcrit/markdown.js';
|
||||||
import yaml from 'js-yaml';
|
import yaml from 'js-yaml';
|
||||||
import asyncHandler from 'express-async-handler';
|
import asyncHandler from 'express-async-handler';
|
||||||
import { nanoid } from 'nanoid';
|
import { nanoid } from 'nanoid';
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ const React = require('react');
|
|||||||
const createClass = require('create-react-class');
|
const createClass = require('create-react-class');
|
||||||
const _ = require('lodash');
|
const _ = require('lodash');
|
||||||
|
|
||||||
import Dialog from '../dialog.jsx';
|
import Dialog from '../../../client/components/dialog.jsx';
|
||||||
|
|
||||||
const RenderWarnings = createClass({
|
const RenderWarnings = createClass({
|
||||||
displayName : 'RenderWarnings',
|
displayName : 'RenderWarnings',
|
||||||
@@ -25,7 +25,7 @@ const RenderWarnings = createClass({
|
|||||||
if(!isChrome){
|
if(!isChrome){
|
||||||
return <li key='chrome'>
|
return <li key='chrome'>
|
||||||
<em>Built for Chrome </em> <br />
|
<em>Built for Chrome </em> <br />
|
||||||
Other browsers have not been tested for compatibility. If you
|
Other browsers have not been tested for compatiblilty. If you
|
||||||
experience issues with your document not rendering or printing
|
experience issues with your document not rendering or printing
|
||||||
properly, please try using the latest version of Chrome before
|
properly, please try using the latest version of Chrome before
|
||||||
submitting a bug report.
|
submitting a bug report.
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
import diceFont from 'themes/fonts/iconFonts/diceFont.js';
|
import diceFont from '../../../themes/fonts/iconFonts/diceFont.js';
|
||||||
import elderberryInn from 'themes/fonts/iconFonts/elderberryInn.js';
|
import elderberryInn from '../../../themes/fonts/iconFonts/elderberryInn.js';
|
||||||
import fontAwesome from 'themes/fonts/iconFonts/fontAwesome.js';
|
import fontAwesome from '../../../themes/fonts/iconFonts/fontAwesome.js';
|
||||||
import gameIcons from 'themes/fonts/iconFonts/gameIcons.js';
|
import gameIcons from '../../../themes/fonts/iconFonts/gameIcons.js';
|
||||||
|
|
||||||
const emojis = {
|
const emojis = {
|
||||||
...diceFont,
|
...diceFont,
|
||||||
@@ -16,10 +16,10 @@ import { gfmHeadingId as MarkedGFMHeadingId, resetHeadings as MarkedGFMResetHead
|
|||||||
import { markedEmoji as MarkedEmojis } from 'marked-emoji';
|
import { markedEmoji as MarkedEmojis } from 'marked-emoji';
|
||||||
|
|
||||||
//Icon fonts included so they can appear in emoji autosuggest dropdown
|
//Icon fonts included so they can appear in emoji autosuggest dropdown
|
||||||
import diceFont from '../themes/fonts/iconFonts/diceFont.js';
|
import diceFont from '../../themes/fonts/iconFonts/diceFont.js';
|
||||||
import elderberryInn from '../themes/fonts/iconFonts/elderberryInn.js';
|
import elderberryInn from '../../themes/fonts/iconFonts/elderberryInn.js';
|
||||||
import gameIcons from '../themes/fonts/iconFonts/gameIcons.js';
|
import gameIcons from '../../themes/fonts/iconFonts/gameIcons.js';
|
||||||
import fontAwesome from '../themes/fonts/iconFonts/fontAwesome.js';
|
import fontAwesome from '../../themes/fonts/iconFonts/fontAwesome.js';
|
||||||
|
|
||||||
const renderer = new Marked.Renderer();
|
const renderer = new Marked.Renderer();
|
||||||
const tokenizer = new Marked.Tokenizer();
|
const tokenizer = new Marked.Tokenizer();
|
||||||
@@ -5,7 +5,7 @@ const createClass = require('create-react-class');
|
|||||||
const _ = require('lodash');
|
const _ = require('lodash');
|
||||||
const cx = require('classnames');
|
const cx = require('classnames');
|
||||||
|
|
||||||
const NaturalCritIcon = require('client/components/svg/naturalcrit-d20.svg.jsx');
|
const NaturalCritIcon = require('naturalcrit/svg/naturalcrit.svg.jsx');
|
||||||
|
|
||||||
const Nav = {
|
const Nav = {
|
||||||
base : createClass({
|
base : createClass({
|
||||||
3
shared/naturalcrit/svg/combat.svg.jsx
Normal file
3
shared/naturalcrit/svg/combat.svg.jsx
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
module.exports = function(props){
|
||||||
|
return <svg version='1.1' x='0px' y='0px' viewBox='0 0 80 100' enableBackground='new 0 0 80 80'><g><g><polygon fill='#000000' points='12.9,71.4 7.6,66.1 19.3,54.4 20.7,55.8 10.4,66.1 12.9,68.6 23.2,58.3 24.6,59.7 '/></g><g><path fill='#000000' d='M29,61.6c-1.7,0-3.4-0.7-4.6-1.9l-5.1-5.1c-2.5-2.5-2.5-6.6,0-9.2l0.7-0.7L34.3,59l-0.7,0.7 C32.4,60.9,30.8,61.6,29,61.6z M20.1,47.6c-1.1,1.7-0.9,4.1,0.6,5.6l5.1,5.1c0.8,0.8,2,1.3,3.2,1.3c0.9,0,1.7-0.2,2.4-0.7 L20.1,47.6z'/></g><g><path fill='#000000' d='M12.3,74.8c-0.8,0-1.5-0.3-2-0.8l-5.2-5.2c-0.5-0.5-0.8-1.2-0.8-2c0-0.8,0.3-1.5,0.8-2 c1.1-1.1,2.9-1.1,4,0l5.2,5.2c1.1,1.1,1.1,2.9,0,4C13.8,74.5,13.1,74.8,12.3,74.8z M7.1,65.9c-0.2,0-0.4,0.1-0.6,0.2 c-0.2,0.2-0.2,0.4-0.2,0.6s0.1,0.4,0.2,0.6l5.2,5.2c0.3,0.3,0.9,0.3,1.2,0c0.3-0.3,0.3-0.8,0-1.2l-5.2-5.2 C7.5,66,7.3,65.9,7.1,65.9z'/></g><g><polygon fill='#000000' points='31.7,58.7 30.3,57.3 70,17.6 70,9 62.4,9 23.3,49.4 21.9,48 61.6,7 72,7 72,18.4 '/></g><g><rect x='46' y='6.7' transform='matrix(0.7168 0.6973 -0.6973 0.7168 35.9716 -23.568)' fill='#000000' width='2' height='51.6'/></g><g><rect x='13' y='61' fill='#000000' width='2' height='7'/></g><g><rect x='17' y='57' fill='#000000' width='2' height='7'/></g></g><g><g><polygon fill='#000000' points='68.4,71.4 56.7,59.7 58.1,58.3 68.4,68.6 70.8,66.1 60.5,55.8 61.9,54.4 73.6,66.1 '/></g><g><path fill='#000000' d='M52.2,61.6c-1.7,0-3.4-0.7-4.6-1.9L46.9,59l14.3-14.3l0.7,0.7c2.5,2.5,2.5,6.6,0,9.2l-5.1,5.1 C55.6,60.9,53.9,61.6,52.2,61.6z M49.8,58.9c0.7,0.4,1.5,0.7,2.4,0.7c1.2,0,2.3-0.5,3.2-1.3l5.1-5.1c1.5-1.5,1.7-3.8,0.6-5.6 L49.8,58.9z'/></g><g><path fill='#000000' d='M68.9,74.8c-0.8,0-1.5-0.3-2-0.8c-1.1-1.1-1.1-2.9,0-4l5.2-5.2c1.1-1.1,2.9-1.1,4,0c0.5,0.5,0.8,1.2,0.8,2 c0,0.8-0.3,1.5-0.8,2L70.9,74C70.4,74.5,69.7,74.8,68.9,74.8z M74.2,65.9c-0.2,0-0.4,0.1-0.6,0.2l-5.2,5.2c-0.3,0.3-0.3,0.8,0,1.2 c0.3,0.3,0.9,0.3,1.2,0l5.2-5.2c0.2-0.2,0.2-0.4,0.2-0.6s-0.1-0.4-0.2-0.6C74.6,66,74.4,65.9,74.2,65.9z'/></g><g><rect x='38.6' y='52.3' transform='matrix(0.7082 0.706 -0.706 0.7082 50.8397 -16.4875)' fill='#000000' width='13.4' height='2'/></g><g><polygon fill='#000000' points='30.6,39.9 9,18.4 9,7 19.7,7 41.1,29.1 39.7,30.5 18.8,9 11,9 11,17.6 32,38.5 '/></g><g><rect x='47.8' y='43.1' transform='matrix(0.6959 0.7181 -0.7181 0.6959 48.1381 -25.5246)' fill='#000000' width='12.8' height='2'/></g><g><rect x='12' y='23.1' transform='matrix(0.6974 0.7167 -0.7167 0.6974 25.1384 -11.3825)' fill='#000000' width='28.1' height='2'/></g><g><rect x='43.8' y='46.4' transform='matrix(0.6974 0.7167 -0.7167 0.6974 48.7492 -20.5985)' fill='#000000' width='10' height='2'/></g><g><rect x='66' y='61' fill='#000000' width='2' height='7'/></g><g><rect x='62' y='57' fill='#000000' width='2' height='7'/></g></g></svg>;
|
||||||
|
};
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
|
|
||||||
|
|
||||||
import Markdown from 'markdown.js';
|
import Markdown from 'naturalcrit/markdown.js';
|
||||||
|
|
||||||
test('Processes the markdown within an HTML block if its just a class wrapper', function() {
|
test('Processes the markdown within an HTML block if its just a class wrapper', function() {
|
||||||
const source = '<div>*Bold text*</div>';
|
const source = '<div>*Bold text*</div>';
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
|
|
||||||
|
|
||||||
import Markdown from 'markdown.js';
|
import Markdown from 'naturalcrit/markdown.js';
|
||||||
|
|
||||||
describe('Inline Definition Lists', ()=>{
|
describe('Inline Definition Lists', ()=>{
|
||||||
test('No Term 1 Definition', function() {
|
test('No Term 1 Definition', function() {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import Markdown from 'markdown.js';
|
import Markdown from 'naturalcrit/markdown.js';
|
||||||
const dedent = require('dedent-tabs').default;
|
const dedent = require('dedent-tabs').default;
|
||||||
|
|
||||||
// Marked.js adds line returns after closing tags on some default tokens.
|
// Marked.js adds line returns after closing tags on some default tokens.
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
|
|
||||||
|
|
||||||
import Markdown from 'markdown.js';
|
import Markdown from 'naturalcrit/markdown.js';
|
||||||
|
|
||||||
describe('Hard Breaks', ()=>{
|
describe('Hard Breaks', ()=>{
|
||||||
test('Single Break', function() {
|
test('Single Break', function() {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/* eslint-disable max-lines */
|
/* eslint-disable max-lines */
|
||||||
|
|
||||||
const dedent = require('dedent-tabs').default;
|
const dedent = require('dedent-tabs').default;
|
||||||
import Markdown from 'markdown.js';
|
import Markdown from 'naturalcrit/markdown.js';
|
||||||
|
|
||||||
// Marked.js adds line returns after closing tags on some default tokens.
|
// Marked.js adds line returns after closing tags on some default tokens.
|
||||||
// This removes those line returns for comparison sake.
|
// This removes those line returns for comparison sake.
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
|
|
||||||
|
|
||||||
import Markdown from 'markdown.js';
|
import Markdown from 'naturalcrit/markdown.js';
|
||||||
|
|
||||||
describe('Non-Breaking Spaces Interactions', ()=>{
|
describe('Non-Breaking Spaces Interactions', ()=>{
|
||||||
test('I am actually a single-line definition list!', function() {
|
test('I am actually a single-line definition list!', function() {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
|
|
||||||
|
|
||||||
import Markdown from 'markdown.js';
|
import Markdown from 'naturalcrit/markdown.js';
|
||||||
|
|
||||||
describe('Justification', ()=>{
|
describe('Justification', ()=>{
|
||||||
test('Left Justify', function() {
|
test('Left Justify', function() {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/* eslint-disable max-lines */
|
/* eslint-disable max-lines */
|
||||||
|
|
||||||
const dedent = require('dedent-tabs').default;
|
const dedent = require('dedent-tabs').default;
|
||||||
import Markdown from 'markdown.js';
|
import Markdown from 'naturalcrit/markdown.js';
|
||||||
|
|
||||||
// Marked.js adds line returns after closing tags on some default tokens.
|
// Marked.js adds line returns after closing tags on some default tokens.
|
||||||
// This removes those line returns for comparison sake.
|
// This removes those line returns for comparison sake.
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import Markdown from '../../../../shared/markdown.js';
|
import Markdown from '../../../../shared/naturalcrit/markdown.js';
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
createFooterFunc : function(headerSize=1){
|
createFooterFunc : function(headerSize=1){
|
||||||
|
|||||||
Reference in New Issue
Block a user