refactor(ascii-art): delete in-app modal #ascii-art-dialog, controller, dead preload channels

Amit Haridas
This commit is contained in:
2026-09-14 21:06:28 +05:30
parent 8c162c1714
commit ab50183dc0
6 changed files with 4 additions and 1029 deletions
-218
View File
@@ -914,224 +914,6 @@
</div>
</div>
<!-- ASCII Art Generator Dialog -->
<div
id="ascii-art-dialog"
class="modal hidden"
role="dialog"
aria-modal="true"
aria-labelledby="ascii-art-title"
>
<div class="modal-backdrop" data-close></div>
<div class="modal-content large">
<div class="modal-header">
<h3 id="ascii-art-title">🎨 ASCII Art Generator</h3>
<button class="modal-close" id="ascii-dialog-close" aria-label="Close">&times;</button>
</div>
<div class="modal-body">
<div class="export-section">
<label>Mode:</label>
<div style="display: flex; gap: 10px; margin-bottom: 10px">
<button id="ascii-mode-text" class="btn-secondary ascii-mode-btn active">
Text Banner
</button>
<button id="ascii-mode-box" class="btn-secondary ascii-mode-btn">Box/Frame</button>
<button id="ascii-mode-templates" class="btn-secondary ascii-mode-btn">
Templates
</button>
</div>
</div>
<!-- Text Banner Mode -->
<div id="ascii-text-mode" class="ascii-mode-section">
<div class="export-section">
<label for="ascii-text-input">Text to Convert:</label>
<input
type="text"
id="ascii-text-input"
placeholder="Enter your text..."
maxlength="50"
/>
</div>
<div class="export-section">
<label for="ascii-font-style">Style:</label>
<select id="ascii-font-style">
<option value="standard">Standard</option>
<option value="banner">Banner</option>
<option value="block">Block</option>
<option value="bubble">Bubble</option>
<option value="digital">Digital</option>
</select>
</div>
</div>
<!-- Box/Frame Mode -->
<div id="ascii-box-mode" class="ascii-mode-section hidden">
<div class="export-section">
<label for="ascii-box-text">Text Content:</label>
<textarea
id="ascii-box-text"
rows="3"
placeholder="Enter text for the box..."
></textarea>
</div>
<div class="export-section">
<label for="ascii-box-style">Box Style:</label>
<select id="ascii-box-style">
<option value="single">Single Line (─│┌┐└┘)</option>
<option value="double">Double Line (═║╔╗╚╝)</option>
<option value="rounded">Rounded (─│╭╮╰╯)</option>
<option value="bold">Bold (━┃┏┓┗┛)</option>
<option value="ascii">ASCII (+|-)</option>
</select>
</div>
<div class="export-section">
<label for="ascii-box-padding">Padding:</label>
<input
type="number"
id="ascii-box-padding"
min="1"
max="10"
value="2"
style="width: 80px"
/>
</div>
</div>
<!-- Templates Mode -->
<div id="ascii-templates-mode" class="ascii-mode-section hidden">
<div class="export-section">
<label>Arrows & Flow:</label>
<div
style="
display: grid;
grid-template-columns: repeat(4, 1fr);
gap: 8px;
margin-bottom: 15px;
"
>
<button class="btn-secondary ascii-template-btn" data-template="arrow-right">
Arrow →
</button>
<button class="btn-secondary ascii-template-btn" data-template="arrow-down">
Arrow ↓
</button>
<button class="btn-secondary ascii-template-btn" data-template="decision">
Decision
</button>
<button class="btn-secondary ascii-template-btn" data-template="process-flow">
Process Flow
</button>
</div>
<label>Diagrams & Charts:</label>
<div
style="
display: grid;
grid-template-columns: repeat(4, 1fr);
gap: 8px;
margin-bottom: 15px;
"
>
<button class="btn-secondary ascii-template-btn" data-template="flowchart">
Flowchart
</button>
<button class="btn-secondary ascii-template-btn" data-template="sequence">
Sequence
</button>
<button class="btn-secondary ascii-template-btn" data-template="network">
Network
</button>
<button class="btn-secondary ascii-template-btn" data-template="hierarchy">
Hierarchy
</button>
<button class="btn-secondary ascii-template-btn" data-template="timeline">
Timeline
</button>
<button class="btn-secondary ascii-template-btn" data-template="table-simple">
Table
</button>
</div>
<label>Boxes & Containers:</label>
<div
style="
display: grid;
grid-template-columns: repeat(4, 1fr);
gap: 8px;
margin-bottom: 15px;
"
>
<button class="btn-secondary ascii-template-btn" data-template="header">
Header
</button>
<button class="btn-secondary ascii-template-btn" data-template="note-box">
Note Box
</button>
<button class="btn-secondary ascii-template-btn" data-template="warning-box">
Warning
</button>
<button class="btn-secondary ascii-template-btn" data-template="info-box">
Info Box
</button>
</div>
<label>Decorative Elements:</label>
<div
style="
display: grid;
grid-template-columns: repeat(4, 1fr);
gap: 8px;
margin-bottom: 15px;
"
>
<button class="btn-secondary ascii-template-btn" data-template="divider">
Divider
</button>
<button class="btn-secondary ascii-template-btn" data-template="separator-fancy">
Separator
</button>
<button class="btn-secondary ascii-template-btn" data-template="brackets">
Brackets
</button>
<button class="btn-secondary ascii-template-btn" data-template="banner-stars">
Banner
</button>
<button class="btn-secondary ascii-template-btn" data-template="check">
Checklist ✓
</button>
<button class="btn-secondary ascii-template-btn" data-template="progress-bar">
Progress Bar
</button>
</div>
</div>
</div>
<div class="export-section">
<label for="ascii-preview">Preview:</label>
<pre
id="ascii-preview"
style="
background: #f5f5f5;
padding: 15px;
border-radius: 4px;
font-size: 12px;
max-height: 400px;
overflow: auto;
font-family: 'Courier New', monospace;
line-height: 1.2;
"
></pre>
</div>
</div>
<div class="modal-footer">
<button id="ascii-generate" class="btn btn-secondary">Generate Preview</button>
<button id="ascii-insert" class="btn btn-primary">Insert ASCII Art</button>
<button id="ascii-cancel" class="btn btn-secondary" data-close>Cancel</button>
</div>
</div>
</div>
<!-- Universal File Converter Dialog -->
<div
id="universal-converter-dialog"
+3 -4
View File
@@ -1,10 +1,9 @@
/**
* ASCII art templates — named pre-drawn diagrams and frames.
*
* Sourced from src/ascii-generator.html:596-626 and src/renderer.js:6542-6697
* (the `getASCIITemplate()` function). 19 entries; unknown names resolve to ''.
* `arrow-up` is the only template authored for this module — it completes the
* arrow triplet (right, down, up) and does not exist verbatim in either source.
* 19 entries; unknown names resolve to ''. `arrow-up` is the only template
* authored for this module — it completes the arrow triplet (right, down, up)
* and is not present in the legacy templates.
*
* @module AsciiArt.templates
*/
-4
View File
@@ -299,10 +299,6 @@ const ALLOWED_RECEIVE_CHANNELS = [
'pdf-operation-error',
'pdf-batch-complete',
// ASCII Art Generator
'show-ascii-generator-window',
'show-ascii-generator',
// Table Generator
'show-table-generator-window',
-799
View File
@@ -2185,7 +2185,6 @@ document.addEventListener('DOMContentLoaded', async () => {
const exportModal = new ModalManager('#export-dialog');
const printPreviewModal = new ModalManager('#print-preview-overlay');
const tableModal = new ModalManager('#table-generator-dialog');
const asciiModal = new ModalManager('#ascii-art-dialog');
const converterModal = new ModalManager('#universal-converter-dialog');
const batchModal = new ModalManager('#batch-dialog');
const pdfEditorModal = new ModalManager('#pdf-editor-dialog');
@@ -2199,7 +2198,6 @@ document.addEventListener('DOMContentLoaded', async () => {
exportModal,
printPreviewModal,
tableModal,
asciiModal,
converterModal,
batchModal,
pdfEditorModal,
@@ -5965,803 +5963,6 @@ document.getElementById('table-cols').addEventListener('keypress', (e) => {
}
});
// ============================================================================
// ASCII ART GENERATOR
// ============================================================================
let currentASCIIMode = 'text';
function showASCIIGenerator() {
window.modals.asciiModal.open();
// Initialize with text mode
switchASCIIMode('text');
// Generate initial preview
setTimeout(() => {
generateASCIIPreview();
}, 100);
}
function hideASCIIGenerator() {
window.modals.asciiModal.close();
}
function switchASCIIMode(mode) {
currentASCIIMode = mode;
// Update button states
document.querySelectorAll('.ascii-mode-btn').forEach((btn) => {
btn.classList.remove('active');
});
// Hide all mode sections
document.querySelectorAll('.ascii-mode-section').forEach((section) => {
section.classList.add('hidden');
});
// Show selected mode
if (mode === 'text') {
document.getElementById('ascii-mode-text').classList.add('active');
document.getElementById('ascii-text-mode').classList.remove('hidden');
} else if (mode === 'box') {
document.getElementById('ascii-mode-box').classList.add('active');
document.getElementById('ascii-box-mode').classList.remove('hidden');
} else if (mode === 'templates') {
document.getElementById('ascii-mode-templates').classList.add('active');
document.getElementById('ascii-templates-mode').classList.remove('hidden');
}
// Generate preview
generateASCIIPreview();
}
function generateASCIIPreview() {
let result = '';
if (currentASCIIMode === 'text') {
const text = document.getElementById('ascii-text-input').value || 'Sample';
const style = document.getElementById('ascii-font-style').value;
result = textToASCII(text, style);
} else if (currentASCIIMode === 'box') {
const text = document.getElementById('ascii-box-text').value || 'Sample Text';
const style = document.getElementById('ascii-box-style').value;
const padding = parseInt(document.getElementById('ascii-box-padding').value) || 2;
result = createASCIIBox(text, style, padding);
} else if (currentASCIIMode === 'templates') {
result = 'Select a template from the buttons above';
}
document.getElementById('ascii-preview').textContent = result;
}
// Simple ASCII art text generator
function textToASCII(text, style) {
const fonts = {
standard: {
height: 5,
chars: {
A: [' _ ', ' / \\ ', '/___\\', '| |', '| |'],
B: ['____ ', '| \\', '|___/', '| \\', '|___/'],
C: [' ___ ', '/ _/', '| \\', '| ', '\\___/'],
D: ['____ ', '| \\', '| |', '| |', '|___/'],
E: ['_____', '| ', '|___ ', '| ', '|____'],
F: ['_____', '| ', '|___ ', '| ', '| '],
G: [' ___ ', '/ _', '| ||', '| |', '\\___/'],
H: ['| |', '| |', '|___|', '| |', '| |'],
I: ['_____', ' | ', ' | ', ' | ', '_____'],
J: ['_____', ' | ', ' | ', '| | ', '\\__/ '],
K: ['| |', '| / ', '|_/ ', '| \\ ', '| \\ '],
L: ['| ', '| ', '| ', '| ', '|____'],
M: ['| |', '|\\ /|', '| V |', '| |', '| |'],
N: ['| |', '|\\ |', '| \\ |', '| \\|', '| |'],
O: [' ___ ', '/ \\', '| |', '| |', '\\___/'],
P: ['____ ', '| \\', '|___/', '| ', '| '],
Q: [' ___ ', '/ \\', '| |', '| |\\ ', '\\__\\|'],
R: ['____ ', '| \\', '|___/', '| \\ ', '| \\ '],
S: [' ___ ', '/ _/', '\\_ \\', ' \\ ', '\\___/'],
T: ['_____', ' | ', ' | ', ' | ', ' | '],
U: ['| |', '| |', '| |', '| |', '\\___/'],
V: ['| |', '| |', '| |', ' \\ / ', ' V '],
W: ['| |', '| |', '| W |', '|/ \\|', '| |'],
X: ['| |', ' \\ / ', ' X ', ' / \\ ', '| |'],
Y: ['| |', ' \\ / ', ' Y ', ' | ', ' | '],
Z: ['_____', ' / ', ' / ', ' / ', '/___ '],
' ': [' ', ' ', ' ', ' ', ' '],
0: [' ___ ', '/ \\', '| | |', '| |', '\\___/'],
1: [' | ', ' || ', ' | ', ' | ', ' _|_ '],
2: [' ___ ', '\\ /', ' __/ ', '/ ', '\\____'],
3: [' ___ ', '\\ /', ' __/ ', ' / ', '\\___/'],
4: ['| |', '| |', '|___|', ' |', ' |'],
5: [' ___ ', '| ', '|___ ', ' / ', '\\___/'],
6: [' ___ ', '/ ', '|___ ', '| |', '\\___/'],
7: ['_____', ' / ', ' / ', ' / ', '/ '],
8: [' ___ ', '| |', ' ___ ', '| |', '\\___/'],
9: [' ___ ', '| |', '\\___|', ' |', '\\___/'],
},
},
banner: {
height: 7,
chars: {
A: [
' ### ',
' ## ## ',
' ## ## ',
' ## ## ',
' ####### ',
' ## ## ',
' ## ## ',
],
B: [
' ###### ',
' ## ## ',
' ## ## ',
' ###### ',
' ## ## ',
' ## ## ',
' ###### ',
],
C: [
' ##### ',
' ## ## ',
' ## ',
' ## ',
' ## ',
' ## ## ',
' ##### ',
],
D: [
' ###### ',
' ## ## ',
' ## ## ',
' ## ## ',
' ## ## ',
' ## ## ',
' ###### ',
],
E: [
' ####### ',
' ## ',
' ## ',
' ##### ',
' ## ',
' ## ',
' ####### ',
],
F: [
' ####### ',
' ## ',
' ## ',
' ##### ',
' ## ',
' ## ',
' ## ',
],
G: [
' ##### ',
' ## ## ',
' ## ',
' ## ### ',
' ## ## ',
' ## ## ',
' ##### ',
],
H: [
' ## ## ',
' ## ## ',
' ## ## ',
' ####### ',
' ## ## ',
' ## ## ',
' ## ## ',
],
I: [
' ####### ',
' ### ',
' ### ',
' ### ',
' ### ',
' ### ',
' ####### ',
],
J: [
' ####### ',
' ## ',
' ## ',
' ## ',
' ## ## ',
' ## ## ',
' #### ',
],
K: [
' ## ## ',
' ## ## ',
' ## ## ',
' #### ',
' ## ## ',
' ## ## ',
' ## ## ',
],
L: [
' ## ',
' ## ',
' ## ',
' ## ',
' ## ',
' ## ',
' ####### ',
],
M: [
' ## ## ',
' ### ### ',
' ####### ',
' ## # ## ',
' ## ## ',
' ## ## ',
' ## ## ',
],
N: [
' ## ## ',
' ### ## ',
' #### ## ',
' ## #### ',
' ## ### ',
' ## ## ',
' ## ## ',
],
O: [
' ##### ',
' ## ## ',
' ## ## ',
' ## ## ',
' ## ## ',
' ## ## ',
' ##### ',
],
P: [
' ###### ',
' ## ## ',
' ## ## ',
' ###### ',
' ## ',
' ## ',
' ## ',
],
Q: [
' ##### ',
' ## ## ',
' ## ## ',
' ## ## ',
' ## # ## ',
' ## ## ',
' ### ## ',
],
R: [
' ###### ',
' ## ## ',
' ## ## ',
' ###### ',
' ## ## ',
' ## ## ',
' ## ## ',
],
S: [
' ##### ',
' ## ## ',
' ## ',
' ##### ',
' ## ',
' ## ## ',
' ##### ',
],
T: [
' ####### ',
' ### ',
' ### ',
' ### ',
' ### ',
' ### ',
' ### ',
],
U: [
' ## ## ',
' ## ## ',
' ## ## ',
' ## ## ',
' ## ## ',
' ## ## ',
' ##### ',
],
V: [
' ## ## ',
' ## ## ',
' ## ## ',
' ## ## ',
' ## ## ',
' ## ## ',
' ### ',
],
W: [
' ## ## ',
' ## ## ',
' ## ## ',
' ## # ## ',
' ####### ',
' ### ### ',
' ## ## ',
],
X: [
' ## ## ',
' ## ## ',
' ### ',
' # ',
' ### ',
' ## ## ',
' ## ## ',
],
Y: [
' ## ## ',
' ## ## ',
' ### ',
' # ',
' # ',
' # ',
' # ',
],
Z: [
' ####### ',
' ## ',
' ## ',
' ## ',
' ## ',
' ## ',
' ####### ',
],
' ': [
' ',
' ',
' ',
' ',
' ',
' ',
' ',
],
0: [
' ##### ',
' ## ## ',
' ## ### ',
' ## #### ',
' ### ## ',
' ## ## ',
' ##### ',
],
1: [
' ## ',
' ### ',
' ## ',
' ## ',
' ## ',
' ## ',
' ####### ',
],
2: [
' ##### ',
' ## ## ',
' ## ',
' ## ',
' ## ',
' ## ',
' ####### ',
],
3: [
' ##### ',
' ## ## ',
' ## ',
' ### ',
' ## ',
' ## ## ',
' ##### ',
],
4: [
' ### ',
' #### ',
' ## ## ',
' ## ## ',
' ####### ',
' ## ',
' ## ',
],
5: [
' ####### ',
' ## ',
' ###### ',
' ## ',
' ## ',
' ## ## ',
' ##### ',
],
6: [
' ##### ',
' ## ## ',
' ## ',
' ###### ',
' ## ## ',
' ## ## ',
' ##### ',
],
7: [
' ####### ',
' ## ',
' ## ',
' ## ',
' ## ',
' ## ',
' ## ',
],
8: [
' ##### ',
' ## ## ',
' ## ## ',
' ##### ',
' ## ## ',
' ## ## ',
' ##### ',
],
9: [
' ##### ',
' ## ## ',
' ## ## ',
' ###### ',
' ## ',
' ## ## ',
' ##### ',
],
},
},
block: {
height: 6,
chars: {
A: ['█████╗ ', '██╔══██╗', '███████║', '██╔══██║', '██║ ██║', '╚═╝ ╚═╝'],
B: ['██████╗ ', '██╔══██╗', '██████╔╝', '██╔══██╗', '██████╔╝', '╚═════╝ '],
C: ['██████╗', '██╔════╝', '██║ ', '██║ ', '╚██████╗', ' ╚═════╝'],
D: ['██████╗ ', '██╔══██╗', '██║ ██║', '██║ ██║', '██████╔╝', '╚═════╝ '],
E: ['███████╗', '██╔════╝', '█████╗ ', '██╔══╝ ', '███████╗', '╚══════╝'],
F: ['███████╗', '██╔════╝', '█████╗ ', '██╔══╝ ', '██║ ', '╚═╝ '],
G: ['██████╗ ', '██╔════╝', '██║ ███╗', '██║ ██║', '╚██████╔╝', ' ╚═════╝ '],
H: ['██╗ ██╗', '██║ ██║', '███████║', '██╔══██║', '██║ ██║', '╚═╝ ╚═╝'],
I: ['██╗', '██║', '██║', '██║', '██║', '╚═╝'],
' ': [' ', ' ', ' ', ' ', ' ', ' '],
},
},
bubble: {
height: 5,
chars: {
A: [' Ⓐ ', ' ⒜ ⒜ ', '⒜⒜⒜⒜⒜', '⒜ ⒜', '⒜ ⒜'],
B: ['ⒷⒷⒷⒷ ', 'Ⓑ Ⓑ', 'ⒷⒷⒷⒷ ', 'Ⓑ Ⓑ', 'ⒷⒷⒷⒷ '],
C: [' ⒸⒸⒸ ', 'Ⓒ ', 'Ⓒ ', 'Ⓒ ', ' ⒸⒸⒸ '],
' ': [' ', ' ', ' ', ' ', ' '],
},
},
digital: {
height: 7,
chars: {
A: [' ▄▀▀▀▄ ', '▐ ▌', '▐▄▄▄▄▌', '▐ ▌', '▐ ▌', '▐ ▌', ' '],
B: ['▐▀▀▀▄ ', '▐▄▄▄▀ ', '▐▄▄▄▄ ', '▐ ▌', '▐▄▄▄▀ ', ' ', ' '],
C: [' ▄▀▀▀▄', '▐ ', '▐ ', '▐ ', ' ▀▄▄▄▀', ' ', ' '],
' ': [' ', ' ', ' ', ' ', ' ', ' ', ' '],
},
},
};
// Use selected font or fallback to standard
const font = fonts[style] || fonts.standard;
const lines = [];
const upperText = text.toUpperCase();
for (let i = 0; i < font.height; i++) {
lines[i] = '';
}
for (const char of upperText) {
const charLines = font.chars[char] || font.chars[' '];
if (charLines) {
for (let i = 0; i < font.height; i++) {
lines[i] += charLines[i] || ' '.repeat(font.chars[' '][i].length);
}
}
}
return lines.join('\n');
}
// Create ASCII box/frame
function createASCIIBox(text, style, padding) {
const styles = {
single: {
tl: '┌',
tr: '┐',
bl: '└',
br: '┘',
h: '─',
v: '│',
},
double: {
tl: '╔',
tr: '╗',
bl: '╚',
br: '╝',
h: '═',
v: '║',
},
rounded: {
tl: '╭',
tr: '╮',
bl: '╰',
br: '╯',
h: '─',
v: '│',
},
bold: {
tl: '┏',
tr: '┓',
bl: '┗',
br: '┛',
h: '━',
v: '┃',
},
ascii: {
tl: '+',
tr: '+',
bl: '+',
br: '+',
h: '-',
v: '|',
},
};
const chars = styles[style] || styles.single;
const lines = text.split('\n');
const maxLength = Math.max(...lines.map((l) => l.length));
const width = maxLength + padding * 2;
let result = '';
// Top border
result += chars.tl + chars.h.repeat(width) + chars.tr + '\n';
// Padding rows above
for (let i = 0; i < padding - 1; i++) {
result += chars.v + ' '.repeat(width) + chars.v + '\n';
}
// Content lines
for (const line of lines) {
const paddedLine = line.padEnd(maxLength, ' ');
result += chars.v + ' '.repeat(padding) + paddedLine + ' '.repeat(padding) + chars.v + '\n';
}
// Padding rows below
for (let i = 0; i < padding - 1; i++) {
result += chars.v + ' '.repeat(width) + chars.v + '\n';
}
// Bottom border
result += chars.bl + chars.h.repeat(width) + chars.br;
return result;
}
// ASCII Art Templates
function getASCIITemplate(templateName) {
const templates = {
'arrow-right': `
┌────────┐
│ │
────► NEXT │
│ │
└────────┘`,
'arrow-down': `
│
│
▼
┌──────┐
│ NEXT │
└──────┘`,
check: `
✓ Task completed
✓ All tests passed
✓ Ready to deploy
✓ Documentation updated`,
divider: `
═══════════════════════════════════════════════════════════
`,
header: `
╔═══════════════════════════════════════════════════╗
║ SECTION HEADER ║
╚═══════════════════════════════════════════════════╝`,
flowchart: `
┌─────────────┐
│ START │
└──────┬──────┘
│
▼
┌─────────────┐
│ PROCESS │
└──────┬──────┘
│
┌───┴───┐
│ Check │
└───┬───┘
│
┌───▼──┬──────┐
│ Yes │ No │
▼ ▼ │
┌────┐ ┌────┐ │
│ A │ │ B │ │
└─┬──┘ └─┬──┘ │
│ │ │
└──┬───┘ │
│◄──────────┘
▼
┌─────────────┐
│ END │
└─────────────┘`,
decision: `
┌─────────┐
│ Check? │
└────┬────┘
│
┌─────┴─────┐
│ │
Yes│ │No
▼ ▼
┌────────┐ ┌────────┐
│ True │ │ False │
└────────┘ └────────┘`,
sequence: `
User System Database
│ │ │
│ Request │ │
├──────────►│ │
│ │ Query │
│ ├──────────►│
│ │ │
│ │ Result │
│ │◄──────────┤
│ Response │ │
│◄──────────┤ │
│ │ │`,
'table-simple': `
┌──────────┬──────────┬──────────┐
│ Header 1 │ Header 2 │ Header 3 │
├──────────┼──────────┼──────────┤
│ Data 1 │ Data 2 │ Data 3 │
├──────────┼──────────┼──────────┤
│ Data 4 │ Data 5 │ Data 6 │
└──────────┴──────────┴──────────┘`,
timeline: `
2020 2021 2022 2023
│ │ │ │
●───────────●───────────●───────────●
│ │ │ │
Start Milestone Release Current`,
network: `
┌──────────┐
│ Server │
└────┬─────┘
│
┌─────────┼─────────┐
│ │ │
┌───▼───┐ ┌──▼────┐ ┌──▼────┐
│Client1│ │Client2│ │Client3│
└───────┘ └───────┘ └───────┘`,
hierarchy: `
┌─────────┐
│ Root │
└────┬────┘
│
┌────────┴────────┐
│ │
┌───▼───┐ ┌───▼───┐
│Child 1│ │Child 2│
└───┬───┘ └───┬───┘
│ │
┌───▼───┐ ┌───▼───┐
│Grand 1│ │Grand 2│
└───────┘ └───────┘`,
'process-flow': `
┌─────────┐ ┌─────────┐ ┌─────────┐
│ Input │────►│Process 1│────►│ Output │
└─────────┘ └────┬────┘ └─────────┘
│
┌────▼────┐
│Process 2│
└─────────┘`,
'note-box': `
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ NOTE: ┃
┃ This is an important note ┃
┃ that requires attention! ┃
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛`,
'warning-box': `
╔════════════════════════════════════╗
║ ⚠ WARNING ║
║ Proceed with caution! ║
╚════════════════════════════════════╝`,
'info-box': `
╭────────────────────────────────────╮
│ ℹ Information │
│ Additional context here │
╰────────────────────────────────────╯`,
'separator-fancy': `
╭──────────────────────────────────────────────────────╮
│ │
╰──────────────────────────────────────────────────────╯`,
brackets: `
【 Important Text 】`,
'banner-stars': `
************************************************************************
* IMPORTANT BANNER *
************************************************************************`,
'progress-bar': `
Progress: [████████████░░░░░░░░] 60%
0% 100%`,
};
return templates[templateName] || '';
}
function loadASCIITemplate(templateName) {
const template = getASCIITemplate(templateName);
document.getElementById('ascii-preview').textContent = template;
}
function insertASCIIArt() {
const asciiArt = document.getElementById('ascii-preview').textContent;
if (!asciiArt || asciiArt === 'Select a template from the buttons above') {
notifyUser('Generate ASCII art first.', 'warning');
return;
}
// Insert using CodeMirror
if (!tabManager) {
notifyUser('No active editor found.', 'warning');
return;
}
// Insert in code block for proper rendering
const codeBlock = '\n```\n' + asciiArt + '\n```\n';
tabManager.insertAtCursor(codeBlock);
// Trigger update
if (tabManager) {
tabManager.handleEditorInput(tabManager.activeTabId);
}
// Close dialog
hideASCIIGenerator();
}
// ASCII Art Event Listeners
document.getElementById('ascii-dialog-close').addEventListener('click', hideASCIIGenerator);
document.getElementById('ascii-cancel').addEventListener('click', hideASCIIGenerator);
document.getElementById('ascii-generate').addEventListener('click', generateASCIIPreview);
document.getElementById('ascii-insert').addEventListener('click', insertASCIIArt);
// Mode switching
document.getElementById('ascii-mode-text').addEventListener('click', () => switchASCIIMode('text'));
document.getElementById('ascii-mode-box').addEventListener('click', () => switchASCIIMode('box'));
document
.getElementById('ascii-mode-templates')
.addEventListener('click', () => switchASCIIMode('templates'));
// Auto-update preview for text mode
document.getElementById('ascii-text-input').addEventListener('input', generateASCIIPreview);
document.getElementById('ascii-font-style').addEventListener('change', generateASCIIPreview);
// Auto-update preview for box mode
document.getElementById('ascii-box-text').addEventListener('input', generateASCIIPreview);
document.getElementById('ascii-box-style').addEventListener('change', generateASCIIPreview);
document.getElementById('ascii-box-padding').addEventListener('input', generateASCIIPreview);
// Template buttons
document.querySelectorAll('.ascii-template-btn').forEach((btn) => {
btn.addEventListener('click', function () {
const template = this.getAttribute('data-template');
loadASCIITemplate(template);
});
});
// IPC listener for menu
ipcRenderer.on('show-ascii-generator', () => {
showASCIIGenerator();
});
// ============================================================================
// PANE RESIZING
// ============================================================================
+1 -2
View File
@@ -25,8 +25,7 @@ describe('preload.js ASCII channels', () => {
expect(preloadSrc).toContain(`'${channel}'`);
});
// DEFERRED to T11 — channels still in allow-list until T11 deletes them.
test.skip.each(DEAD_CHANNELS)('removed %s from allow-list', (channel) => {
test.each(DEAD_CHANNELS)('removed %s from allow-list', (channel) => {
expect(preloadSrc).not.toContain(`'${channel}'`);
});
-2
View File
@@ -127,8 +127,6 @@ describe('Preload Security', () => {
'pdf-operation-complete',
'pdf-operation-error',
'pdf-operation-progress',
'show-ascii-generator-window',
'show-ascii-generator',
'show-table-generator-window',
'open-header-footer-dialog',
'insert-content',