-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathindex.html
More file actions
489 lines (484 loc) · 25.6 KB
/
Copy pathindex.html
File metadata and controls
489 lines (484 loc) · 25.6 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
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
<!doctype html>
<html lang="en" data-theme="dark">
<head>
<meta charset="UTF-8" />
<title>MarkWrite</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<script>
(function () {
try {
var t = localStorage.getItem('markwrite-theme');
if (t === 'light' || t === 'dark') document.documentElement.setAttribute('data-theme', t);
else document.documentElement.setAttribute('data-theme', 'dark');
} catch (e) {
document.documentElement.setAttribute('data-theme', 'dark');
}
})();
</script>
<link rel="stylesheet" href="/node_modules/bootstrap-icons/font/bootstrap-icons.css" />
<link rel="stylesheet" href="tailwind.output.css" />
<link rel="stylesheet" href="styles.css" />
<link rel="stylesheet" href="theme.css" />
</head>
<body>
<div class="titlebar">
<div class="titlebar-left">
<span class="titlebar-logo">◆</span>
<span class="titlebar-title">MarkWrite</span>
</div>
<div class="titlebar-right">
<span class="titlebar-hint">Markdown · Local-first · AI-ready</span>
<div class="titlebar-window-controls">
<button type="button" class="window-btn window-btn-min" id="window-minimize" title="最小化">
<i class="bi bi-dash"></i>
</button>
<button type="button" class="window-btn window-btn-max" id="window-maximize" title="最大化 / 还原">
<i class="bi bi-square"></i>
</button>
<button type="button" class="window-btn window-btn-close" id="window-close" title="关闭">
<i class="bi bi-x-lg"></i>
</button>
</div>
</div>
</div>
<!-- 页面内自定义菜单栏(不占用系统菜单) -->
<div class="menu-bar">
<div class="menu-bar-left">
<div class="menu-root">
<button type="button" class="menu-root-btn">File</button>
<div class="menu-dropdown">
<button type="button" id="menu-file-new">New File</button>
<button type="button" id="menu-file-open">Open…</button>
<button type="button" id="menu-file-save">Save</button>
<button type="button" id="menu-file-saveas">Save As…</button>
<button type="button" id="menu-file-open-workspace">Open Workspace…</button>
</div>
</div>
<div class="menu-root">
<button type="button" class="menu-root-btn">View</button>
<div class="menu-dropdown">
<button type="button" id="menu-view-toggle-explorer">Toggle Explorer</button>
<button type="button" id="menu-view-toggle-preview">Toggle Preview</button>
<hr />
<button type="button" id="menu-view-toggle-devtools">Toggle DevTools</button>
</div>
</div>
<div class="menu-root">
<button type="button" class="menu-root-btn">创作</button>
<div class="menu-dropdown menu-dropdown-create">
<div class="menu-dropdown-section-title">博客</div>
<button type="button" id="menu-content-new-blog">新建博客</button>
<button type="button" id="menu-content-drafts-blog">博客草稿箱</button>
<div class="menu-submenu">
<button type="button" class="menu-submenu-trigger">远程博客 <i class="bi bi-chevron-right"></i></button>
<div class="menu-submenu-panel">
<button type="button" id="menu-content-remote-blog-mine">我的博客</button>
<button type="button" id="menu-content-remote-blog-all">全部博客</button>
</div>
</div>
<hr />
<div class="menu-dropdown-section-title">书籍</div>
<button type="button" id="menu-content-new-book">新建书籍</button>
<button type="button" id="menu-content-drafts-book">书籍草稿箱</button>
<div class="menu-submenu">
<button type="button" class="menu-submenu-trigger">远程书籍 <i class="bi bi-chevron-right"></i></button>
<div class="menu-submenu-panel">
<button type="button" id="menu-content-remote-book-mine">我的书籍</button>
<button type="button" id="menu-content-remote-book-all">全部书籍</button>
</div>
</div>
<hr />
<button type="button" id="menu-settings-open">设置</button>
</div>
</div>
</div>
<div class="menu-bar-right">
<!-- 预留将来放快速入口,例如同步状态等 -->
</div>
</div>
<div class="app-container">
<div class="collapsed-explorer-handle">
<button type="button" class="icon-btn" id="btn-expand-explorer" title="展开文件侧栏">
<i class="bi bi-layout-sidebar-inset"></i>
</button>
</div>
<div class="pane pane-files" id="pane-files">
<div class="pane-header">
<div id="pane-files-title">Files</div>
<span class="pane-header-actions" id="pane-files-actions-explorer">
<span>Explorer</span>
<button type="button" class="icon-btn" id="btn-refresh-files" title="刷新工作区">
<i class="bi bi-arrow-clockwise"></i>
</button>
<button type="button" class="icon-btn" id="btn-toggle-explorer" title="收起文件侧栏">
<i class="bi bi-layout-sidebar-inset-reverse"></i>
</button>
</span>
</div>
<div class="pane-body pane-files-body" style="padding-left: 0">
<div id="pane-files-explorer-body" class="pane-files-explorer-body">
<ul class="file-list" id="file-tree"></ul>
</div>
<div id="pane-files-outline-body" class="pane-files-outline-body">
<nav class="book-compose-left-nav" id="book-compose-left-nav" aria-label="书籍创作">
<button type="button" class="book-compose-nav-item is-active" id="book-compose-nav-info" data-book-view="info">
<i class="bi bi-journal-text"></i>
<span class="book-compose-nav-text">
<span class="book-compose-nav-title">书籍信息</span>
<span class="book-compose-nav-desc">封面、标题、作者与标签</span>
</span>
</button>
<button type="button" class="book-compose-nav-item" id="book-compose-nav-editor" data-book-view="editor">
<i class="bi bi-pencil-square"></i>
<span class="book-compose-nav-text">
<span class="book-compose-nav-title">编辑正文</span>
<span class="book-compose-nav-desc">Markdown 全书正文</span>
</span>
</button>
<button type="button" class="book-compose-nav-item" id="book-compose-nav-upload" data-book-view="upload">
<i class="bi bi-cloud-upload"></i>
<span class="book-compose-nav-text">
<span class="book-compose-nav-title">上传与同步</span>
<span class="book-compose-nav-desc">分项对比、上传服务器</span>
</span>
</button>
</nav>
<div id="book-compose-outline-section" class="book-compose-outline-section">
<div class="book-outline-toolbar">
<div class="book-outline-toolbar-row book-outline-toolbar-row--full">
<button type="button" class="book-outline-tool-btn" id="book-outline-edit-json" title="以 JSON 编辑大纲">
<i class="bi bi-code-slash"></i> 编辑大纲
</button>
<button
type="button"
class="book-outline-tool-btn"
id="book-outline-save-draft"
title="将书籍信息、大纲与正文保存到本地草稿箱"
>
<i class="bi bi-save"></i> 保存大纲
</button>
</div>
<div class="book-outline-toolbar-row book-outline-toolbar-row--pair">
<button type="button" class="book-outline-tool-btn" id="book-outline-add-folder" title="新建目录">
<i class="bi bi-folder-plus"></i> 新建目录
</button>
<button type="button" class="book-outline-tool-btn" id="book-outline-add-chapter" title="新建章节">
<i class="bi bi-file-earmark-plus"></i> 新建章节
</button>
</div>
</div>
<div id="book-outline-tree" class="book-outline-tree" aria-label="书籍大纲"></div>
<textarea
id="content-compose-outline"
class="content-compose-outline-input"
spellcheck="false"
aria-hidden="true"
tabindex="-1"
style="position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; pointer-events: none"
></textarea>
</div>
</div>
</div>
</div>
<div class="pane pane-editor" id="pane-editor">
<div class="pane-header">
<div>Editor</div>
<span class="pane-header-actions">
<button type="button" class="icon-btn" id="btn-new" title="新建文件"><i class="bi bi-file-earmark-plus"></i></button>
<span id="editor-filename">未命名</span>
<button type="button" class="md-preview-toggle" id="preview-toggle" title="切换预览">预览</button>
</span>
</div>
<div class="pane-body">
<div class="content-compose-panel" id="content-compose-panel" style="display:none;">
<div class="content-compose-head">
<div>
<h3 class="content-compose-title" id="content-compose-title">创作内容</h3>
<p class="content-compose-subtitle" id="content-compose-subtitle">在下方编辑器中撰写正文</p>
</div>
<div class="content-compose-head-trailing">
<div id="content-compose-head-actions" class="content-compose-head-actions" aria-label="博客草稿与发布">
<button type="button" class="apply-editor-btn apply-editor-btn-secondary" id="content-compose-save-draft">
保存草稿
</button>
<button type="button" class="apply-editor-btn apply-editor-btn-primary" id="content-compose-publish">发布</button>
</div>
<button type="button" class="content-compose-close" id="content-compose-close" title="退出创作页">
<i class="bi bi-x-lg"></i>
</button>
</div>
</div>
<div id="content-compose-top-host"></div>
</div>
<div class="editor-with-preview" id="editor-with-preview" data-preview="closed">
<div class="md-editor-column">
<div class="md-toolbar">
<button type="button" class="md-toolbar-btn" id="md-bold" title="Bold"><i class="bi bi-type-bold"></i></button>
<button type="button" class="md-toolbar-btn" id="md-italic" title="Italic"><i class="bi bi-type-italic"></i></button>
<button type="button" class="md-toolbar-btn" id="md-strike" title="Strikethrough"><i class="bi bi-type-strikethrough"></i></button>
<span class="md-toolbar-sep"></span>
<button type="button" class="md-toolbar-btn" id="md-h1" title="Heading 1"><i class="bi bi-type-h1"></i></button>
<button type="button" class="md-toolbar-btn" id="md-h2" title="Heading 2"><i class="bi bi-type-h2"></i></button>
<button type="button" class="md-toolbar-btn" id="md-h3" title="Heading 3"><i class="bi bi-type-h3"></i></button>
<span class="md-toolbar-sep"></span>
<button type="button" class="md-toolbar-btn" id="md-quote" title="Quote"><i class="bi bi-quote"></i></button>
<button type="button" class="md-toolbar-btn" id="md-ul" title="Unordered List"><i class="bi bi-list-ul"></i></button>
<button type="button" class="md-toolbar-btn" id="md-ol" title="Ordered List"><i class="bi bi-list-ol"></i></button>
<span class="md-toolbar-sep"></span>
<button type="button" class="md-toolbar-btn" id="md-table" title="Insert Table"><i class="bi bi-table"></i></button>
<span class="md-toolbar-sep"></span>
<button type="button" class="md-toolbar-btn" id="md-link" title="Create Link"><i class="bi bi-link-45deg"></i></button>
<button type="button" class="md-toolbar-btn" id="md-image" title="Insert Image"><i class="bi bi-image"></i></button>
<button type="button" class="md-toolbar-btn" id="md-upload-image" title="Upload Image"><i class="bi bi-cloud-upload"></i></button>
<span class="md-toolbar-sep"></span>
<button type="button" class="md-toolbar-btn" id="md-code" title="Inline Code"><i class="bi bi-code-slash"></i></button>
<button type="button" class="md-toolbar-btn" id="md-fence" title="Code Block"><i class="bi bi-file-code"></i></button>
<button type="button" class="md-toolbar-btn" id="md-hr" title="Horizontal Rule"><i class="bi bi-dash-lg"></i></button>
</div>
<div id="monaco-container"></div>
</div>
<div class="md-preview-wrap">
<div class="preview-panel-header">
<i class="bi bi-eye"></i>
<span>Preview</span>
<button type="button" class="preview-back-btn" id="preview-back-btn" title="Back to editor">
<i class="bi bi-pencil-square"></i>
<span>Edit</span>
</button>
</div>
<div id="md-preview" class="md-preview-body">预览将显示在这里…</div>
</div>
</div>
<div class="book-chapter-save-row" id="book-chapter-save-row">
<button type="button" class="apply-editor-btn apply-editor-btn-secondary" id="book-chapter-save-draft">
<i class="bi bi-save"></i> 保存内容
</button>
</div>
<div id="content-compose-bottom-host"></div>
</div>
</div>
<div class="splitter pane-splitter-chat" id="splitter-chat" title="拖动调整聊天宽度"></div>
<div class="pane pane-chat" id="pane-chat">
<div class="pane-header pane-header-chat">
<span class="pane-header-actions">
<label class="ai-model-label">Models</label>
<select id="ai-model-select" class="ai-model-select" title="AI 模型">
<option value="" selected>加载模型中…</option>
</select>
<span class="pane-header-ai-tag">AI</span>
</span>
</div>
<div class="pane-body">
<div class="ai-chat-container">
<div class="status-row" id="ai-status-row">
<div class="status-dot" id="ai-status-dot"></div>
<div id="ai-status-text">检测中…</div>
</div>
<div class="ai-messages" id="ai-messages"></div>
<div class="ai-input-area">
<textarea
id="ai-input"
rows="2"
placeholder="Ask AI, or describe what you want to change…"
></textarea>
<button type="button" id="ai-send" class="ai-send-btn" title="Send">
<i class="bi bi-arrow-up"></i>
</button>
</div>
</div>
</div>
</div>
</div>
<div class="statusbar">
<div class="statusbar-left">
<span class="status-pill">Markdown</span>
<span>LF</span>
<span>UTF-8</span>
</div>
<div class="statusbar-right">
<span class="sync-conn-pill is-idle" id="sync-conn-status" title="服务器连接状态">
<span class="sync-conn-dot"></span>
<span id="sync-conn-text">服务器:未检测</span>
</span>
<button
type="button"
id="sync-conn-reconnect"
class="sync-conn-toggle-btn"
title="停止连接"
aria-label="停止连接"
>
<i class="bi bi-stop-fill sync-conn-toggle-ic" id="sync-conn-toggle-icon" aria-hidden="true"></i>
</button>
<span>MarkWrite · Shell v0.1</span>
<span>AI: not configured</span>
</div>
</div>
<div class="compose-drafts-overlay" id="compose-drafts-overlay" style="display:none;">
<div class="compose-drafts-box">
<div class="compose-drafts-header">
<span class="compose-drafts-title">草稿箱</span>
<button type="button" class="compose-drafts-close" id="compose-drafts-close" title="关闭">
<i class="bi bi-x-lg"></i>
</button>
</div>
<p class="compose-drafts-hint">
草稿保存在当前工作区的 <code>.markwrite/compose-drafts</code>:博客为单文件
<code>*.json</code>;书籍为目录 <code><id>/</code>,含 <code>meta.json</code>、<code>outline.json</code>、<code>chapters/<章节id>.md</code>。点击一条即可打开;也可按 Enter。
</p>
<div class="compose-drafts-filters">
<button type="button" class="compose-drafts-filter is-active" id="compose-drafts-filter-all">全部</button>
<button type="button" class="compose-drafts-filter" id="compose-drafts-filter-blog">博客</button>
<button type="button" class="compose-drafts-filter" id="compose-drafts-filter-book">书籍</button>
</div>
<ul class="compose-drafts-list" id="compose-drafts-list"></ul>
<div class="compose-drafts-empty" id="compose-drafts-empty" style="display:none;">暂无草稿</div>
</div>
</div>
<div class="remote-blogs-overlay" id="remote-blogs-overlay" style="display:none;">
<div class="remote-blogs-box">
<div class="remote-blogs-header">
<span class="remote-blogs-title" id="remote-blogs-title">远程博客</span>
<button type="button" class="remote-blogs-close" id="remote-blogs-close" title="关闭">
<i class="bi bi-x-lg"></i>
</button>
</div>
<p class="remote-blogs-hint" id="remote-blogs-hint">从远程服务器读取博客列表</p>
<ul class="remote-blogs-list" id="remote-blogs-list"></ul>
<div class="remote-blogs-empty" id="remote-blogs-empty" style="display:none;">暂无远程博客</div>
<div class="remote-blogs-footer">
<button type="button" class="compose-drafts-filter" id="remote-blogs-prev">上一页</button>
<span class="remote-blogs-page" id="remote-blogs-page">第 1 页</span>
<button type="button" class="compose-drafts-filter" id="remote-blogs-next">下一页</button>
<button type="button" class="compose-drafts-filter" id="remote-blogs-refresh">刷新</button>
</div>
</div>
</div>
<div class="remote-blogs-overlay" id="remote-books-overlay" style="display:none;">
<div class="remote-blogs-box">
<div class="remote-blogs-header">
<span class="remote-blogs-title" id="remote-books-title">远程书籍</span>
<button type="button" class="remote-blogs-close" id="remote-books-close" title="关闭">
<i class="bi bi-x-lg"></i>
</button>
</div>
<p class="remote-blogs-hint" id="remote-books-hint">从远程服务器读取书籍(get_books)</p>
<div id="remote-books-download-panel" class="remote-books-download-panel" style="display: none" aria-live="polite">
<div class="remote-books-download-panel-title">下载进度</div>
<ul id="remote-books-download-steps" class="remote-books-download-steps"></ul>
</div>
<ul class="remote-blogs-list" id="remote-books-list"></ul>
<div class="remote-blogs-empty" id="remote-books-empty" style="display:none;">暂无远程书籍</div>
<div class="remote-blogs-footer">
<button type="button" class="compose-drafts-filter" id="remote-books-prev">上一页</button>
<span class="remote-blogs-page" id="remote-books-page">第 1 页</span>
<button type="button" class="compose-drafts-filter" id="remote-books-next">下一页</button>
<button type="button" class="compose-drafts-filter" id="remote-books-refresh">刷新</button>
</div>
</div>
</div>
<!-- 设置页:页面内大弹窗 -->
<div class="settings-overlay" id="settings-overlay" style="display:none;">
<div class="settings-box">
<div class="settings-header">
<div class="settings-title">Settings</div>
<button type="button" class="settings-close-btn" id="settings-close-btn" title="Close">
<i class="bi bi-x-lg"></i>
</button>
</div>
<div class="settings-body" id="settings-body">
<!-- 内容由 renderer 从 settings-modal.html 加载,便于按功能分割维护 -->
</div>
</div>
</div>
<div id="book-outline-json-modal" class="book-outline-json-modal" style="display: none" aria-hidden="true" role="dialog" aria-modal="true" aria-labelledby="book-outline-json-modal-title">
<div class="book-outline-json-modal-box">
<div class="book-outline-json-modal-head">
<span id="book-outline-json-modal-title">编辑原始大纲 (JSON)</span>
<button type="button" class="book-outline-json-dismiss" title="关闭">
<i class="bi bi-x-lg"></i>
</button>
</div>
<p class="book-outline-json-hint">每项需含 id、title、type(chapter 或 folder);folder 可有 children 数组。</p>
<textarea id="book-outline-json-textarea" class="book-outline-json-textarea" spellcheck="false"></textarea>
<div id="book-outline-json-error" class="book-outline-json-error" role="alert"></div>
<div class="book-outline-json-modal-actions">
<button type="button" class="content-compose-mini-btn book-outline-json-dismiss">取消</button>
<button type="button" class="apply-editor-btn apply-editor-btn-primary" id="book-outline-json-apply">应用更改</button>
</div>
</div>
</div>
<div
id="book-outline-rename-modal"
class="book-outline-rename-modal"
style="display: none"
aria-hidden="true"
role="dialog"
aria-modal="true"
aria-labelledby="book-outline-rename-modal-title"
>
<div class="book-outline-rename-modal-box">
<div class="book-outline-rename-modal-head">
<span id="book-outline-rename-modal-title">重命名</span>
<button type="button" class="book-outline-json-dismiss book-outline-rename-dismiss" title="关闭">
<i class="bi bi-x-lg"></i>
</button>
</div>
<label for="book-outline-rename-input" id="book-outline-rename-label" class="book-outline-rename-label">名称</label>
<input type="text" id="book-outline-rename-input" class="book-outline-rename-input" maxlength="200" autocomplete="off" />
<div class="book-outline-rename-modal-actions">
<button type="button" class="content-compose-mini-btn book-outline-rename-dismiss">取消</button>
<button type="button" class="apply-editor-btn apply-editor-btn-primary" id="book-outline-rename-confirm">确定</button>
</div>
</div>
</div>
<div
id="book-chapter-switch-modal"
class="book-chapter-switch-modal book-outline-json-modal"
style="display: none"
aria-hidden="true"
role="dialog"
aria-modal="true"
aria-labelledby="book-chapter-switch-title"
>
<div class="book-outline-rename-modal-box book-chapter-switch-modal-box">
<div class="book-outline-rename-modal-head">
<span id="book-chapter-switch-title">切换章节</span>
</div>
<p class="book-outline-json-hint">当前章节有未保存的修改。请选择:保存到草稿箱后再切换、放弃修改并切换,或留在本章节继续编辑。</p>
<div class="book-chapter-switch-actions">
<button type="button" class="apply-editor-btn apply-editor-btn-primary" id="book-chapter-switch-save">保存并切换</button>
<button type="button" class="content-compose-mini-btn" id="book-chapter-switch-discard">不保存并切换</button>
<button type="button" class="content-compose-mini-btn" id="book-chapter-switch-cancel">取消</button>
</div>
</div>
</div>
<script src="./lib/book-outline.js"></script>
<script src="/node_modules/monaco-editor/min/vs/loader.js"></script>
<script src="/node_modules/mermaid/dist/mermaid.min.js"></script>
<script>
window.mermaid = window.mermaid || {};
if (window.mermaid.run === undefined) {
try {
window.mermaid.initialize({ startOnLoad: false });
} catch (_) {}
}
</script>
<script>
require.config({
paths: { vs: '/node_modules/monaco-editor/min/vs' },
'vs/nls': { availableLanguages: {} }
});
// 使用 Monaco 的 AMD 版本时,worker 也需要走 min 目录下的 AMD 入口,
// 不能直接指向 ESM 的 editor.worker.js(否则会出现 \"Cannot use import statement outside a module\" 错误)。
window.MonacoEnvironment = {
getWorkerUrl: function (workerId, label) {
return '/node_modules/monaco-editor/min/vs/base/worker/workerMain.js';
}
};
require(['vs/editor/editor.main'], function() {
window.dispatchEvent(new Event('monaco-ready'));
});
</script>
<script src="./renderer.js"></script>
</body>
</html>