-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathindex.html
More file actions
335 lines (325 loc) · 18.2 KB
/
index.html
File metadata and controls
335 lines (325 loc) · 18.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="Content-Security-Policy" content="default-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval'; style-src 'self' 'unsafe-inline'; img-src 'self' data:">
<title>Markdown Editor</title>
<link rel="stylesheet" href="node_modules/highlight.js/styles/github.css">
<link rel="stylesheet" href="styles.css">
</head>
<body>
<div class="container">
<header>
<div class="header-left">
<div class="toolbar">
<button id="new-btn" class="toolbar-icon-btn" title="New File (Ctrl+N)">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"/>
<polyline points="14 2 14 8 20 8"/>
<line x1="12" y1="18" x2="12" y2="12"/>
<line x1="9" y1="15" x2="15" y2="15"/>
</svg>
</button>
<button id="open-btn" class="toolbar-icon-btn" title="Open File (Ctrl+O)">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z"/>
</svg>
</button>
<button id="save-btn" class="toolbar-icon-btn" title="Save (Ctrl+S)" disabled>
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M19 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11l5 5v11a2 2 0 0 1-2 2z"/>
<polyline points="17 21 17 13 7 13 7 21"/>
<polyline points="7 3 7 8 15 8"/>
</svg>
</button>
<div class="toolbar-separator"></div>
<div class="formatting-toolbar-inline" id="formatting-toolbar-inline" style="display: none;">
<button id="fmt-bold" class="fmt-btn-inline" title="Bold (Ctrl+B)"><strong>B</strong></button>
<button id="fmt-italic" class="fmt-btn-inline" title="Italic (Ctrl+I)"><em>I</em></button>
<button id="fmt-strikethrough" class="fmt-btn-inline" title="Strikethrough"><s>S</s></button>
<button id="fmt-code" class="fmt-btn-inline" title="Inline Code"></></button>
<div class="fmt-separator-inline"></div>
<button id="fmt-h1" class="fmt-btn-inline fmt-heading-btn" title="Heading 1">H1</button>
<button id="fmt-h2" class="fmt-btn-inline fmt-heading-btn" title="Heading 2">H2</button>
<button id="fmt-h3" class="fmt-btn-inline fmt-heading-btn" title="Heading 3">H3</button>
<button id="fmt-h4" class="fmt-btn-inline fmt-heading-btn" title="Heading 4">H4</button>
<button id="fmt-h5" class="fmt-btn-inline fmt-heading-btn" title="Heading 5">H5</button>
<button id="fmt-h6" class="fmt-btn-inline fmt-heading-btn" title="Heading 6">H6</button>
<button id="fmt-link" class="fmt-btn-inline" title="Link">
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5">
<path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"/>
<path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"/>
</svg>
</button>
<button id="fmt-ul" class="fmt-btn-inline" title="Bullet List">
<svg width="14" height="14" viewBox="0 0 24 24" fill="currentColor">
<circle cx="4" cy="6" r="2"/><circle cx="4" cy="12" r="2"/><circle cx="4" cy="18" r="2"/>
<rect x="9" y="5" width="12" height="2"/><rect x="9" y="11" width="12" height="2"/><rect x="9" y="17" width="12" height="2"/>
</svg>
</button>
<button id="fmt-ol" class="fmt-btn-inline" title="Numbered List">
<svg width="14" height="14" viewBox="0 0 24 24" fill="currentColor">
<text x="1" y="7" font-size="6" font-weight="bold">1</text>
<text x="1" y="13" font-size="6" font-weight="bold">2</text>
<text x="1" y="19" font-size="6" font-weight="bold">3</text>
<rect x="9" y="5" width="12" height="2"/><rect x="9" y="11" width="12" height="2"/><rect x="9" y="17" width="12" height="2"/>
</svg>
</button>
<button id="fmt-quote" class="fmt-btn-inline" title="Quote">
<svg width="14" height="14" viewBox="0 0 24 24" fill="currentColor">
<path d="M6 17h3l2-4V7H5v6h3zm8 0h3l2-4V7h-6v6h3z"/>
</svg>
</button>
<button id="fmt-codeblock" class="fmt-btn-inline" title="Code Block">{}</button>
</div>
</div>
<span id="file-name" style="display: none;"></span>
</div>
<div class="header-center">
<div class="toggle-group" id="toggle-group" style="display: none;">
<button id="edit-btn" class="toggle-btn">Edit</button>
<button id="split-btn" class="toggle-btn active">Split</button>
<button id="preview-btn" class="toggle-btn">Preview</button>
</div>
</div>
<div class="header-right">
<span id="current-file-path" class="current-file-path"></span>
<button id="outline-toggle-btn" class="toolbar-icon-btn" title="Toggle Outline">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<line x1="3" y1="6" x2="15" y2="6"></line>
<line x1="3" y1="12" x2="21" y2="12"></line>
<line x1="3" y1="18" x2="18" y2="18"></line>
</svg>
</button>
<div id="theme-toggle" class="theme-toggle" title="Toggle theme">
<span class="theme-icon light-icon">
<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" width="16" height="16"><g clip-path="url(#a)" fill="currentColor"><path d="M12 0a1 1 0 0 1 1 1v4a1 1 0 1 1-2 0V1a1 1 0 0 1 1-1ZM4.929 3.515a1 1 0 0 0-1.414 1.414l2.828 2.828a1 1 0 0 0 1.414-1.414L4.93 3.515ZM1 11a1 1 0 1 0 0 2h4a1 1 0 1 0 0-2H1ZM18 12a1 1 0 0 1 1-1h4a1 1 0 1 1 0 2h-4a1 1 0 0 1-1-1ZM17.657 16.243a1 1 0 0 0-1.414 1.414l2.828 2.828a1 1 0 1 0 1.414-1.414l-2.828-2.828ZM7.757 17.657a1 1 0 1 0-1.414-1.414L3.515 19.07a1 1 0 1 0 1.414 1.414l2.828-2.828ZM20.485 4.929a1 1 0 0 0-1.414-1.414l-2.828 2.828a1 1 0 1 0 1.414 1.414l2.828-2.828ZM13 19a1 1 0 1 0-2 0v4a1 1 0 1 0 2 0v-4ZM12 7a5 5 0 1 0 0 10 5 5 0 0 0 0-10Z"></path></g><defs><clipPath id="a"><path fill="#ffffff" d="M0 0h24v24H0z"></path></clipPath></defs></svg>
</span>
<span class="theme-icon dark-icon">
<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" width="16" height="16"><path d="M12 22c5.523 0 10-4.477 10-10 0-.463-.694-.54-.933-.143a6.5 6.5 0 1 1-8.924-8.924C12.54 2.693 12.463 2 12 2 6.477 2 2 6.477 2 12s4.477 10 10 10Z" fill="currentColor"></path></svg>
</span>
</div>
<a href="#" id="donate-link" class="donate-link" title="Buy me a coffee">☕ Donate</a>
</div>
</header>
<main>
<aside id="sidebar" class="sidebar">
<div class="sidebar-header">
<span class="sidebar-title">Explorer</span>
<button id="toggle-sidebar" class="sidebar-toggle" title="Collapse sidebar">◀</button>
</div>
<div class="sidebar-content">
<div class="sidebar-section" id="open-files-section">
<div class="sidebar-section-header" id="open-files-header">
<svg class="section-chevron" width="10" height="10" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<polyline points="6 9 12 15 18 9"></polyline>
</svg>
<span class="sidebar-section-title">Open Files</span>
</div>
<div class="sidebar-section-content">
<ul id="file-list" class="file-list"></ul>
</div>
</div>
</div>
</aside>
<div id="sidebar-resize-handle" class="resize-handle resize-handle-left"></div>
<div class="main-content">
<div id="welcome" class="welcome">
<p>Welcome to Markdown Editor</p>
<p>Press <kbd>Ctrl+O</kbd> or click "Open" to load a markdown file</p>
</div>
<div id="editor-container" class="editor-container" style="display: none;">
<div id="tabs-bar" class="tabs-bar"></div>
<div class="editor-content">
<div id="editor-pane" class="pane editor-pane" style="display: none;">
<div class="editor-wrapper">
<div id="line-numbers" class="line-numbers"><span>1</span></div>
<textarea id="editor" spellcheck="false"></textarea>
</div>
<div class="status-bar">
<div class="status-left">
<button id="toggle-line-numbers" class="status-btn" title="Toggle line numbers">Ln#</button>
<button id="toggle-word-wrap" class="status-btn active" title="Toggle word wrap">Wrap</button>
</div>
<div class="status-right">
<span id="line-count">0 lines</span>
<span id="word-count">0 words</span>
<span id="char-count">0 chars</span>
<span id="cursor-position">Ln 1, Col 1</span>
</div>
</div>
</div>
<div id="preview-pane" class="pane preview-pane">
<div id="content" class="markdown-body"></div>
</div>
</div>
</div>
</div>
<div id="right-sidebar-resize-handle" class="resize-handle resize-handle-right"></div>
<aside id="right-sidebar" class="right-sidebar">
<div class="right-sidebar-header">
<div class="right-sidebar-tabs">
<button id="tab-outline" class="right-sidebar-tab active" title="Document Outline">Outline</button>
<button id="tab-chat" class="right-sidebar-tab" title="AI Chat">Chat</button>
</div>
<button id="toggle-right-sidebar" class="right-sidebar-toggle" title="Close sidebar">×</button>
</div>
<div class="right-sidebar-content">
<!-- Outline Tab Content -->
<div id="outline-panel" class="right-sidebar-panel active">
<div id="outline-list" class="outline-list">
<div class="outline-empty">No headings found</div>
</div>
</div>
<!-- Chat Tab Content -->
<div id="chat-panel" class="right-sidebar-panel">
<div class="chat-header">
<button id="chat-clear" class="chat-clear-btn" title="Clear chat">
<svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2">
<polyline points="3 6 5 6 21 6"></polyline>
<path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"></path>
</svg>
Clear
</button>
</div>
<div id="chat-messages" class="chat-messages">
<div class="chat-welcome">
<p>Ask AI anything about your document or get writing help.</p>
</div>
</div>
<div class="chat-input-container">
<div class="chat-context-toggle">
<label class="chat-context-label" title="Include current document content as context">
<input type="checkbox" id="chat-include-context">
<span class="chat-context-text">Include document</span>
</label>
</div>
<div class="chat-input-row">
<textarea id="chat-input" class="chat-input" placeholder="Ask AI..." rows="1"></textarea>
<button id="chat-send" class="chat-send-btn" title="Send (Enter)">
<svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="2">
<path d="M22 2L11 13M22 2l-7 20-4-9-9-4 20-7z"/>
</svg>
</button>
</div>
</div>
</div>
</div>
</aside>
</main>
</div>
<!-- Loading indicator for AI processing (small, non-blocking) -->
<div id="loading-indicator" class="loading-indicator hidden">
<div class="loading-spinner-small"></div>
<span id="loading-message">Processing...</span>
</div>
<!-- Prompt dialog (legacy, keeping for other uses) -->
<div id="prompt-dialog" class="prompt-dialog hidden">
<div class="prompt-dialog-overlay"></div>
<div class="prompt-dialog-content">
<h3 id="prompt-dialog-title">Enter prompt</h3>
<textarea id="prompt-dialog-input" placeholder="Enter your prompt..." rows="3"></textarea>
<div class="prompt-dialog-buttons">
<button id="prompt-dialog-cancel" class="prompt-btn cancel">Cancel</button>
<button id="prompt-dialog-ok" class="prompt-btn ok">OK</button>
</div>
</div>
</div>
<!-- Inline AI Prompt Input -->
<div id="inline-prompt" class="inline-prompt hidden">
<div class="inline-prompt-input-row">
<textarea id="inline-prompt-input" placeholder="Edit with AI..." rows="1" autocomplete="off"></textarea>
<button id="inline-prompt-submit" class="inline-prompt-submit" title="Submit (Enter)">
<svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="2">
<path d="M12 19V5M5 12l7-7 7 7"/>
</svg>
</button>
<button id="inline-prompt-close" class="inline-prompt-close" title="Close (Esc)">×</button>
</div>
<div class="inline-prompt-hint">
<kbd>Enter</kbd> to submit · <kbd>Shift+Enter</kbd> for new line · <kbd>Esc</kbd> to cancel
</div>
</div>
<!-- AI Review dialog -->
<div id="ai-review-dialog" class="ai-review-dialog hidden">
<div class="ai-review-overlay"></div>
<div class="ai-review-content">
<div class="ai-review-header">
<h3>Review AI Generated Text</h3>
<button id="ai-review-close" class="ai-review-close">×</button>
</div>
<div class="ai-review-body">
<div class="ai-review-section">
<label>Original:</label>
<div id="ai-review-original" class="ai-review-text original"></div>
</div>
<div class="ai-review-section">
<label>Generated:</label>
<div id="ai-review-generated" class="ai-review-text generated"></div>
</div>
</div>
<div class="ai-review-footer">
<button id="ai-review-regenerate" class="ai-review-btn regenerate">Regenerate</button>
<div class="ai-review-actions">
<button id="ai-review-reject" class="ai-review-btn reject">Reject</button>
<button id="ai-review-accept" class="ai-review-btn accept">Accept</button>
</div>
</div>
</div>
</div>
<!-- Mermaid diagram lightbox -->
<div id="mermaid-lightbox" class="mermaid-lightbox hidden">
<div class="mermaid-lightbox-overlay"></div>
<div class="mermaid-lightbox-content">
<div class="mermaid-lightbox-header">
<span class="mermaid-lightbox-title">Diagram</span>
<div class="mermaid-lightbox-controls">
<button id="mermaid-lb-zoom-out" class="mermaid-lb-btn" title="Zoom Out">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="11" cy="11" r="8"/><line x1="21" y1="21" x2="16.65" y2="16.65"/><line x1="8" y1="11" x2="14" y2="11"/></svg>
</button>
<span id="mermaid-lb-zoom-level" class="mermaid-lb-zoom-level">100%</span>
<button id="mermaid-lb-zoom-in" class="mermaid-lb-btn" title="Zoom In">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="11" cy="11" r="8"/><line x1="21" y1="21" x2="16.65" y2="16.65"/><line x1="11" y1="8" x2="11" y2="14"/><line x1="8" y1="11" x2="14" y2="11"/></svg>
</button>
<div class="mermaid-lb-separator"></div>
<button id="mermaid-lb-fit" class="mermaid-lb-btn" title="Fit to View">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M15 3h6v6M9 21H3v-6M21 3l-7 7M3 21l7-7"/></svg>
</button>
<button id="mermaid-lb-actual" class="mermaid-lb-btn" title="Actual Size (100%)">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="3" y="3" width="18" height="18" rx="2"/><line x1="9" y1="3" x2="9" y2="21"/><line x1="15" y1="3" x2="15" y2="21"/><line x1="3" y1="9" x2="21" y2="9"/><line x1="3" y1="15" x2="21" y2="15"/></svg>
</button>
</div>
<button id="mermaid-lightbox-close" class="modal-close" title="Close (Esc)">×</button>
</div>
<div id="mermaid-lightbox-body" class="mermaid-lightbox-body">
<div id="mermaid-lightbox-svg-wrap" class="mermaid-lightbox-svg-wrap"></div>
</div>
</div>
</div>
<!-- Notification container -->
<div id="notification-container" class="notification-container"></div>
<!-- Inline AI Diff Panel -->
<div id="inline-diff-panel" class="inline-diff-panel hidden">
<div class="inline-diff-header">
<span id="inline-diff-action" class="inline-diff-action">shorten</span>
<div class="inline-diff-buttons">
<button id="inline-diff-reject" class="inline-diff-btn reject">Reject <kbd>Esc</kbd></button>
<button id="inline-diff-accept" class="inline-diff-btn accept">Accept <kbd>⌘↩</kbd></button>
</div>
</div>
<div class="inline-diff-body">
<div id="inline-diff-original" class="inline-diff-text original"></div>
<div id="inline-diff-generated" class="inline-diff-text generated"></div>
</div>
</div>
<!-- Mermaid diagram rendering -->
<script src="node_modules/mermaid/dist/mermaid.min.js"></script>
<!-- Plugin scripts -->
<script src="src/renderer/plugin-api.js"></script>
<script src="src/renderer/plugin-host.js"></script>
<script src="src/renderer/settings-modal.js"></script>
<script src="plugins/ai-editor/plugin.js"></script>
<script src="renderer.js"></script>
</body>
</html>