B
BOOKFORGEPUBLISHING PRODUCTION V3
● Local workspace
R
Local workspaceSign in to sync manuscripts to your hosting account
Write
Book preview
Table of contents

Begin Your Book

Welcome to BookForge Studio V3 — your publishing-house workspace for writing, editing and preparing books for publication.

Chapter One

Start writing here. Import an existing Word document, paste your manuscript, or build your book chapter by chapter. Use the tools above to structure and format your content.

0 words0 characters0 paragraphs1 estimated pageAutosave ready
`} async function doExport(){let d=data(),fmt=$('exportFormat').value,scope=$('exportScope').value,list=scope==='all'?d.chapters:[d.chapters[active]];closeModal();if(fmt==='json'){download('bookforge-project.bookforge.json',JSON.stringify(d,null,2),'application/json');return}if(fmt==='txt'){download('manuscript.txt',list.map(c=>c.title+'\n\n'+new DOMParser().parseFromString(c.html,'text/html').body.innerText).join('\n\n'),'text/plain');return}if(fmt==='html'){download('book.html',buildFullBook(d,list),'text/html');return}if(fmt==='pdf'){let w=window.open('','_blank');if(!w){toast('Allow pop-ups to print');return}w.document.write(buildFullBook(d,list));w.document.close();setTimeout(()=>w.print(),500);return}if(fmt==='epub'){toast('EPUB packaging is planned for the next export-engine milestone');return}if(fmt==='docx'){try{await script('https://unpkg.com/html-docx-js@0.3.1/dist/html-docx.js');let blob=htmlDocx.asBlob(buildFullBook(d,list));let url=URL.createObjectURL(blob),a=document.createElement('a');a.href=url;a.download='manuscript.docx';a.click();setTimeout(()=>URL.revokeObjectURL(url),1500)}catch(e){toast('DOCX exporter could not load. Check internet and retry.')}return}} function openFindReplace(){ modal('Find & replace',`

Search and replacement apply to the current chapter. Review the result before saving.

`,()=>{ let find=$('findText').value,rep=$('replaceText').value;if(!find){toast('Enter text to find');return} let html=editor.innerHTML,flags=$('caseSensitive').checked?'g':'gi',escaped=find.replace(/[.*+?^${}()|[\]\\]/g,'\\$&'),re=new RegExp(escaped,flags),count=(html.match(re)||[]).length; editor.innerHTML=html.replace(re,()=>safe(rep));snapshot();stats();changed();closeModal();toast(count+' replacement(s) made') },'Replace all') } function openMatter(key){ let labels={title:'Title page',copyright:'Copyright page',dedication:'Dedication',preface:'Preface',acknowledgements:'Acknowledgements',about:'About the author'}; let defaults={title:`

${safe($('bookName').value)}

${safe($('author').value)}

Resonet Publishers

`,copyright:`

Copyright © ${new Date().getFullYear()} ${safe($('author').value||'Author')}

All rights reserved. No part of this publication may be reproduced without prior permission of the publisher, except as permitted by applicable law.

Published by Resonet Publishers

ISBN: ${safe($('isbn').value||'To be assigned')}

`,dedication:'

Dedication


',preface:'

Preface


',acknowledgements:'

Acknowledgements


',about:'

About the Author


'}; modal(labels[key],`

This section is stored separately from the chapter manuscript and included in book exports.

`,()=>{matter[key]=$('matterText').value;closeModal();saveAutosave();toast(labels[key]+' saved')},'Save section') } function openReferences(){ let list=references.map((r,i)=>`
${safe(r.author)} (${safe(r.year)})

${safe(r.title)}. ${safe(r.source||'')}

`).join(''); modal('References & bibliography',`${list}
`,()=>{let a=$('refAuthor').value,t=$('refTitle').value;if(!a||!t){toast('Author and title are required');return}references.push({author:a,year:$('refYear').value,title:t,source:$('refSource').value,style:$('refStyle').value});saveAutosave();openReferences()},'Add reference') } function removeReference(i){references.splice(i,1);saveAutosave();openReferences()} function openCoverStudio(){ modal('Cover designer',`
This creates a front-cover concept. Full wraparound cover dimensions, spine width and bleed must be calculated from the final print page count and paper stock by the printer.
`,async()=>{ cover.title=$('cvTitle').value;cover.subtitle=$('cvSubtitle').value;cover.author=$('cvAuthor').value;cover.publisher=$('cvPublisher').value;cover.background=$('cvBg').value;cover.accent=$('cvAccent').value; let f=$('cvImage').files[0];if(f)cover.image=await new Promise(ok=>{let r=new FileReader();r.onload=()=>ok(r.result);r.readAsDataURL(f)}); saveAutosave();closeModal();previewCover() },'Save & preview') } function previewCover(){ let image=cover.image?``:''; let w=window.open('','_blank');if(!w){toast('Allow pop-ups to preview cover');return} w.document.write(`Cover concept
${safe(cover.title)}
${safe(cover.subtitle)}
${image}
${safe(cover.author)}
${safe(cover.publisher)}
`);w.document.close() } function buildFullBook(d,list){ let matterHTML=Object.entries(d.matter||{}).filter(([k,v])=>v).map(([k,v])=>`
${v}
`).join(''); let refs=(d.references||[]).length?`

References

    ${d.references.map(r=>`
  1. ${safe(r.author)} (${safe(r.year)}). ${safe(r.title)}. ${safe(r.source)}
  2. `).join('')}
`:''; let running=``; return `${safe(d.title)}${running}

${safe(cover.title||d.title)}

${safe(cover.subtitle)}

${cover.image?``:''}

${safe(cover.author||d.author)}

${safe(cover.publisher)}

${matterHTML}

Contents

    ${list.map(c=>`
  1. ${safe(c.title)}
  2. `).join('')}
${list.map(c=>`

${safe(c.title)}

${c.html}
`).join('')}${refs}` } window.addEventListener('beforeunload',()=>{try{saveAutosave()}catch(e){}});try{let old=localStorage.getItem('bookforge-v2-autosave');if(old)loadProject(JSON.parse(old))}catch(e){}renderChapters();stats();