mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-08-06 04:37:37 +00:00
Merge branch 'master' into fixSafeHTML
This commit is contained in:
@@ -29,6 +29,7 @@ const TOOLBAR_STATE_KEY = 'HB_renderer_toolbarState';
|
|||||||
|
|
||||||
const INITIAL_CONTENT = dedent`
|
const INITIAL_CONTENT = dedent`
|
||||||
<!DOCTYPE html><html><head>
|
<!DOCTYPE html><html><head>
|
||||||
|
<title>Rendered Brew Content</title>
|
||||||
<link href='/homebrew/bundle.css' type="text/css" rel='stylesheet' />
|
<link href='/homebrew/bundle.css' type="text/css" rel='stylesheet' />
|
||||||
<link href="${brewRendererStylesUrl}" rel="stylesheet" />
|
<link href="${brewRendererStylesUrl}" rel="stylesheet" />
|
||||||
<link href="${headerNavStylesUrl}" rel="stylesheet" />
|
<link href="${headerNavStylesUrl}" rel="stylesheet" />
|
||||||
@@ -210,7 +211,7 @@ const BrewRenderer = (props)=>{
|
|||||||
classes = [classes, injectedTags.classes].join(' ').trim();
|
classes = [classes, injectedTags.classes].join(' ').trim();
|
||||||
attributes = injectedTags.attributes;
|
attributes = injectedTags.attributes;
|
||||||
if(global.enablev4) {
|
if(global.enablev4) {
|
||||||
if (attributes && Object.hasOwn(attributes, 'hbtemplate')) {
|
if(attributes && Object.hasOwn(attributes, 'hbtemplate')) {
|
||||||
pageTemplates[index] = attributes['hbtemplate'];
|
pageTemplates[index] = attributes['hbtemplate'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -220,7 +221,7 @@ const BrewRenderer = (props)=>{
|
|||||||
if(!pageTemplates[index]) {
|
if(!pageTemplates[index]) {
|
||||||
for (let i=index;i>=0; i--) {
|
for (let i=index;i>=0; i--) {
|
||||||
// If one is found, add the template attribute
|
// If one is found, add the template attribute
|
||||||
if (pageTemplates[i]) attributes['hbtemplate'] = pageTemplates[i];
|
if(pageTemplates[i]) attributes['hbtemplate'] = pageTemplates[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -348,10 +349,11 @@ const BrewRenderer = (props)=>{
|
|||||||
<ToolBar displayOptions={displayOptions} onDisplayOptionsChange={handleDisplayOptionsChange} visiblePages={state.visiblePages.length > 0 ? state.visiblePages : [state.centerPage]} totalPages={rawPages.length} headerState={headerState} setHeaderState={setHeaderState}/>
|
<ToolBar displayOptions={displayOptions} onDisplayOptionsChange={handleDisplayOptionsChange} visiblePages={state.visiblePages.length > 0 ? state.visiblePages : [state.centerPage]} totalPages={rawPages.length} headerState={headerState} setHeaderState={setHeaderState}/>
|
||||||
|
|
||||||
{/*render in iFrame so broken code doesn't crash the site.*/}
|
{/*render in iFrame so broken code doesn't crash the site.*/}
|
||||||
<Frame id='BrewRenderer' initialContent={INITIAL_CONTENT}
|
<Frame id='BrewRenderer' title="Rendered Brew Content" initialContent={INITIAL_CONTENT}
|
||||||
style={{ width: '100%', height: '100%', visibility: state.visibility }}
|
style={{ width: '100%', height: '100%', visibility: state.visibility }}
|
||||||
contentDidMount={frameDidMount}
|
contentDidMount={frameDidMount}
|
||||||
onClick={()=>{emitClick();}}
|
onClick={()=>{emitClick();}}
|
||||||
|
sandbox="allow-same-origin allow-modals allow-top-navigation"
|
||||||
>
|
>
|
||||||
<div className='brewRenderer'
|
<div className='brewRenderer'
|
||||||
onKeyDown={handleControlKeys}
|
onKeyDown={handleControlKeys}
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import createApp from './server/app.js';
|
|||||||
import config from './server/config.js';
|
import config from './server/config.js';
|
||||||
import { createServer as createViteServer } from 'vite';
|
import { createServer as createViteServer } from 'vite';
|
||||||
|
|
||||||
const isDev = process.env.NODE_ENV === 'local';
|
const isDev = config.get('local_environments').includes(process.env.NODE_ENV);
|
||||||
|
|
||||||
async function start() {
|
async function start() {
|
||||||
let vite;
|
let vite;
|
||||||
|
|||||||
Reference in New Issue
Block a user