Purpose: Full single-file intake + legal analysis system with statutory triggers, protocol tracking, linked-record logic, and embedded document-display word processor.
Instructions
Full legal intake instructions preserved.
Analyze document for:
- Type
- Sender / Recipient
- Date / Method
- Legal purpose
- Statutory relevance
- Chronology
- Linked filings
Then produce:
- Title
- Description
- Legal impact
- Timeline entry
- Evidence matrix
- Duty triggers
- Compliance findings
NEXT HTML BUILD REQUIREMENT — EMBEDDED WORD PROCESSOR:
When you generate the next court-ready HTML exhibit page, do not use a plain textarea for the main document display area. In the generated exhibit HTML, replace that document display textarea with the following mini word processor module.
The word processor must appear in the generated HTML page, not in this instruction-builder page.
The generated HTML must preserve these functions:
- contenteditable document display area
- bold, italic, underline
- font size increase and decrease
- text color buttons
- page grow, page shrink, and reset
- HTML/render toggle
- copy all editor content
- paste from clipboard
- save editor content as HTML
- import PDF, JPG, JPEG, PNG, TXT, HTML, HTM, and RTF
- direct pasted image support
- hide/show toolbar button so only the document content area is visible when hidden
Place this module where the generated exhibit page would normally display the pasted filing, PDF/image capture, Word text, or document content.
BEGIN WORD PROCESSOR MODULE TO INSERT INTO NEXT GENERATED HTML:
<style>
.wp-wrap{
max-width:960px;
margin:8px auto 0 auto;
background:#f9f9f9;
border:1px solid #bbb;
padding:8px;
}
.wp-actions{
display:flex;
flex-wrap:wrap;
align-items:center;
gap:4px;
margin-bottom:6px;
}
.wp-actions button,
.wp-toolbar button,
.wp-toolbar .wp-import-label{
background:#111;
color:#fff;
padding:6px 10px;
border:none;
margin:2px;
cursor:pointer;
font-family:Arial, sans-serif;
font-size:8pt;
}
.wp-toolbar{
margin-bottom:6px;
display:flex;
flex-wrap:wrap;
align-items:center;
gap:3px;
padding:6px;
background:#eee;
border:1px solid #ccc;
}
.wp-toolbar.hidden{
display:none;
}
.wp-color-btn{
width:18px;
height:18px;
padding:0 !important;
border:1px solid #999 !important;
border-radius:3px;
min-width:18px;
}
#wpEditor{
margin:auto;
min-height:400px;
min-width:320px;
width:8.5in;
max-width:100%;
height:10.5in;
overflow:auto;
border:1px solid #888;
border-radius:5px;
background:#fff;
padding:10px;
outline:none;
font-size:12pt;
transform-origin:top center;
transition:transform 0.2s;
}
#wpEditor.code-view{
font-family:monospace;
white-space:pre-wrap;
}
.wp-file-input{
display:none;
}
.wp-toolbar-sep{
width:1px;
background:#ccc;
height:20px;
margin:0 4px;
}
@media print{
.wp-actions,
.wp-toolbar{
display:none !important;
}
}
</style>
<div class="wp-wrap">
<div class="wp-actions">
<button type="button" onclick="wpToggleToolbar()" id="wpToolbarToggleBtn">Hide Toolbar</button>
</div>
<div class="wp-toolbar" id="wpToolbar">
<button type="button" onclick="wpFormat('bold')" title="Bold"><b>B</b></button>
<button type="button" onclick="wpFormat('italic')" title="Italic"><i>I</i></button>
<button type="button" onclick="wpFormat('underline')" title="Underline"><u>U</u></button>
<span class="wp-toolbar-sep"></span>
<button type="button" onclick="wpResizeFont(1)" title="Increase Font Size">+</button>
<button type="button" onclick="wpResizeFont(-1)" title="Decrease Font Size">–</button>
<span class="wp-toolbar-sep"></span>
<button type="button" class="wp-color-btn" style="background:#000;color:#fff" onclick="wpColor('black')" title="Black"></button>
<button type="button" class="wp-color-btn" style="background:#f00" onclick="wpColor('red')" title="Red"></button>
<button type="button" class="wp-color-btn" style="background:#00f" onclick="wpColor('blue')" title="Blue"></button>
<button type="button" class="wp-color-btn" style="background:#080" onclick="wpColor('green')" title="Green"></button>
<button type="button" class="wp-color-btn" style="background:#ffa500" onclick="wpColor('orange')" title="Orange"></button>
<button type="button" class="wp-color-btn" style="background:#800080" onclick="wpColor('purple')" title="Purple"></button>
<button type="button" class="wp-color-btn" style="background:#ff0" onclick="wpColor('yellow')" title="Yellow"></button>
<button type="button" class="wp-color-btn" style="background:#ccc" onclick="wpColor('gray')" title="Gray"></button>
<span class="wp-toolbar-sep"></span>
<button type="button" onclick="wpScalePage(1.1)" title="Grow Page">Page +</button>
<button type="button" onclick="wpScalePage(0.9)" title="Shrink Page">Page –</button>
<button type="button" onclick="wpResetScale()" title="Reset Page Scale">Reset</button>
<span class="wp-toolbar-sep"></span>
<button type="button" onclick="wpToggleHtml()" title="Toggle Code/Render View">HTML/Render</button>
<span class="wp-toolbar-sep"></span>
<button type="button" onclick="wpCopyAll()" title="Copy All">Copy All</button>
<button type="button" onclick="wpPasteFromClipboard()" title="Paste, or use Ctrl+V">Paste</button>
<button type="button" onclick="wpSaveFile()" title="Save as HTML">Save</button>
<span class="wp-toolbar-sep"></span>
<label class="wp-import-label" title="Import PDF/JPEG/PNG/TXT/HTML/RTF">
<input class="wp-file-input" type="file" accept=".pdf,.jpg,.jpeg,.png,.txt,.html,.htm,.rtf,application/pdf,image/*,text/plain,text/html" onchange="wpImportFile(event)" />
Import
</label>
</div>
<div contenteditable="true" id="wpEditor" aria-label="Word Processor Main Area"></div>
</div>
<script>
let wpScale = 1;
let wpIsCodeView = false;
function wpEl(id){
return document.getElementById(id);
}
function wpFormat(cmd){
wpEl('wpEditor').focus();
document.execCommand(cmd, false, null);
}
function wpColor(c){
wpEl('wpEditor').focus();
document.execCommand('foreColor', false, c);
}
function wpResizeFont(delta){
const sel = window.getSelection();
if(!sel.rangeCount) return;
const range = sel.getRangeAt(0);
if(range.collapsed) return;
const span = document.createElement('span');
let node = sel.anchorNode;
if(node && node.nodeType === Node.TEXT_NODE) node = node.parentNode;
let currentSize = 12;
if(node instanceof HTMLElement && node.style.fontSize){
currentSize = parseFloat(node.style.fontSize) || 12;
}
span.style.fontSize = Math.max(6, currentSize + delta) + 'pt';
try{
range.surroundContents(span);
sel.removeAllRanges();
const newRange = document.createRange();
newRange.selectNodeContents(span);
sel.addRange(newRange);
}catch(err){
document.execCommand('fontSize', false, delta > 0 ? '4' : '2');
}
}
function wpScalePage(mult){
wpScale *= mult;
wpScale = Math.max(0.35, Math.min(wpScale, 2.5));
wpEl('wpEditor').style.transform = 'scale(' + wpScale + ')';
}
function wpResetScale(){
wpScale = 1;
wpEl('wpEditor').style.transform = 'scale(1)';
}
function wpToggleToolbar(){
const toolbar = wpEl('wpToolbar');
const btn = wpEl('wpToolbarToggleBtn');
toolbar.classList.toggle('hidden');
btn.textContent = toolbar.classList.contains('hidden') ? 'Show Toolbar' : 'Hide Toolbar';
}
function wpGetContent(){
const ed = wpEl('wpEditor');
return wpIsCodeView ? ed.textContent : ed.innerHTML;
}
function wpCopyAll(){
const content = wpGetContent();
if(navigator.clipboard && navigator.clipboard.writeText){
navigator.clipboard.writeText(content).then(function(){ alert('Copied.'); });
}else{
const ta = document.createElement('textarea');
ta.value = content;
document.body.appendChild(ta);
ta.select();
document.execCommand('copy');
ta.remove();
alert('Copied.');
}
}
function wpPasteFromClipboard(){
const ed = wpEl('wpEditor');
ed.focus();
if(navigator.clipboard && navigator.clipboard.read){
navigator.clipboard.read().then(function(items){
let found = false;
items.forEach(function(item){
item.types.forEach(async function(type){
if(type.startsWith('image/')){
const blob = await item.getType(type);
const url = URL.createObjectURL(blob);
const img = document.createElement('img');
img.src = url;
img.style.maxWidth = '90%';
ed.appendChild(img);
found = true;
}else if(type === 'text/html'){
const blob = await item.getType('text/html');
const html = await blob.text();
ed.insertAdjacentHTML('beforeend', html);
found = true;
}else if(type === 'text/plain'){
const blob = await item.getType('text/plain');
const txt = await blob.text();
ed.appendChild(document.createTextNode(txt));
found = true;
}
});
});
setTimeout(function(){
if(!found) alert('Nothing found to paste. Ctrl+V may still work.');
}, 300);
}).catch(function(){
alert('Use Ctrl+V/Cmd+V to paste manually.');
});
}else{
alert('Use Ctrl+V/Cmd+V to paste in this browser.');
}
}
function wpSaveFile(){
const html = '<!DOCTYPE html><html><head><meta charset="UTF-8"><title>Saved Document</title></head><body>' + wpEl('wpEditor').innerHTML + '</body></html>';
const a = document.createElement('a');
const file = new Blob([html], {type:'text/html'});
a.href = URL.createObjectURL(file);
a.download = 'document.html';
a.click();
URL.revokeObjectURL(a.href);
}
function wpToggleHtml(){
const ed = wpEl('wpEditor');
if(!wpIsCodeView){
ed.textContent = ed.innerHTML;
ed.classList.add('code-view');
wpIsCodeView = true;
}else{
ed.innerHTML = ed.textContent;
ed.classList.remove('code-view');
wpIsCodeView = false;
}
}
function wpImportFile(e){
const file = e.target.files[0];
if(!file) return;
const ed = wpEl('wpEditor');
const reader = new FileReader();
if(file.type.startsWith('image/')){
reader.onload = function(evt){
const img = document.createElement('img');
img.src = evt.target.result;
img.style.maxWidth = '90%';
ed.appendChild(img);
};
reader.readAsDataURL(file);
}else if(file.type === 'application/pdf' || file.name.toLowerCase().endsWith('.pdf')){
reader.onload = function(evt){
const blob = new Blob([evt.target.result], {type:'application/pdf'});
const url = URL.createObjectURL(blob);
const iframe = document.createElement('iframe');
iframe.src = url;
iframe.style.width = '95%';
iframe.style.height = '500px';
iframe.style.border = '1px solid #999';
ed.appendChild(iframe);
};
reader.readAsArrayBuffer(file);
}else{
reader.onload = function(evt){
const text = evt.target.result;
const lowerName = file.name.toLowerCase();
if(lowerName.endsWith('.html') || lowerName.endsWith('.htm') || file.type === 'text/html'){
ed.insertAdjacentHTML('beforeend', text);
}else{
ed.appendChild(document.createTextNode(text));
}
};
reader.readAsText(file);
}
e.target.value = '';
}
document.addEventListener('DOMContentLoaded', function(){
const editor = wpEl('wpEditor');
if(!editor) return;
editor.addEventListener('paste', function(e){
const clipboard = e.clipboardData || window.clipboardData;
if(!clipboard || !clipboard.items) return;
const items = clipboard.items;
for(let i = 0; i < items.length; i++){
if(items[i].kind === 'file' && items[i].type.startsWith('image/')){
const blob = items[i].getAsFile();
const reader = new FileReader();
reader.onload = function(e2){
const img = document.createElement('img');
img.src = e2.target.result;
img.style.maxWidth = '90%';
wpEl('wpEditor').appendChild(img);
};
reader.readAsDataURL(blob);
e.preventDefault();
}
}
});
});
</script>
END WORD PROCESSOR MODULE TO INSERT INTO NEXT GENERATED HTML.