-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
3047 lines (3012 loc) · 109 KB
/
Copy pathindex.html
File metadata and controls
3047 lines (3012 loc) · 109 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
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!doctype html>
<!--
Markdown Studio
Copyright (c) 2026 MOUSDIK ISMAIL
Licensed under the MIT License (see LICENSE)
-->
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width,initial-scale=1.0" />
<link
rel="apple-touch-icon"
sizes="180x180"
href="./assets/images/android-chrome-192x192.png"
/>
<link
rel="icon"
type="image/png"
sizes="32x32"
href="./assets/images/favicon-32x32.png"
/>
<link
rel="icon"
type="image/png"
sizes="16x16"
href="./assets/images/favicon-16x16.png"
/>
<link rel="manifest" href="./scripts/site.webmanifest" />
<title>Markdown Studio</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/3.4.21/vue.global.prod.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/marked/12.0.0/marked.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/highlight.min.js"></script>
<link
rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/styles/github.min.css"
id="hljs-theme"
/>
<script src="https://cdn.jsdelivr.net/npm/mermaid@10/dist/mermaid.min.js"></script>
<link
rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/katex@0.16.9/dist/katex.min.css"
/>
<script src="https://cdn.jsdelivr.net/npm/katex@0.16.9/dist/katex.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/dompurify/3.1.6/purify.min.js"></script>
<script
src="scripts/vendor/codemirror-bundle.js"
onerror="console.warn('[editor] CM bundle not found, using textarea fallback')"
></script>
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link
href="https://fonts.googleapis.com/css2?family=Crimson+Pro:ital,wght@0,300;0,400;0,600;1,400&family=DM+Mono:wght@400;500&family=DM+Sans:wght@300;400;500;600&family=Playfair+Display:ital,wght@0,700;1,400&family=Source+Serif+4:ital,wght@0,400;0,600;1,400&family=IBM+Plex+Sans:wght@300;400;500;600&family=JetBrains+Mono:wght@400;500&family=Libre+Baskerville:ital,wght@0,400;0,700;1,400&family=Raleway:wght@300;400;600;700&family=Space+Mono:ital,wght@0,400;0,700;1,400&display=swap"
rel="stylesheet"
/>
<link
rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/@tabler/icons-webfont@latest/dist/tabler-icons.min.css"
/>
<link rel="stylesheet" href="assets/style.css" />
</head>
<body>
<div id="vue-root">
<div id="topbar" :class="{expanded:topbarOpen}">
<div class="logo">
<div class="logo-mark"><i class="ti ti-markdown"></i></div>
<span class="logo-text">Studio</span>
</div>
<input
ref="mdFileInput"
type="file"
accept=".md,.markdown,.txt,.ipynb,application/x-ipynb+json"
style="display: none"
@change="onMdFileUpload"
/>
<input
ref="workspaceFileInput"
type="file"
accept=".json,application/json"
style="display: none"
@change="onWorkspaceRestore"
/>
<button
class="tb-icon"
:class="{active:sidebarOpen}"
@click="sidebarOpen=!sidebarOpen"
title="Sidebar"
>
<i class="ti ti-layout-sidebar"></i>
</button>
<button
class="tb-icon topbar-toggle"
:class="{active:topbarOpen}"
@click="topbarOpen=!topbarOpen"
title="Toolbar"
>
<i :class="topbarOpen?'ti ti-chevron-up':'ti ti-menu-2'"></i>
</button>
<div class="tb-group tb-group-file">
<button
class="tb-btn tb-primary"
:class="{active:unsaved,'unsaved-indicator':unsaved}"
@click="saveFile"
title="Save"
>
<i class="ti ti-device-floppy"></i>{{unsaved?'Save*':'Saved'}}
</button>
<button class="tb-btn" @click="openHistory" title="Version History">
<i class="ti ti-history"></i>History
</button>
<div class="tb-group-more">
<button class="tb-btn " @click="newFile" title="New file">
<i class="ti ti-file-plus"></i>New
</button>
<button class="tb-btn" @click="triggerMdUpload" title="Open Markdown or Notebook">
<i class="ti ti-folder-open"></i>Open
</button>
</div>
</div>
<div class="tb-file-chip">
<span v-if="!renamingFile" class="fname-badge" @dblclick="startRename"
>{{activeFile?.name||'untitled.md'}}</span
>
<input
v-else
class="rename-input"
ref="renameInputRef"
v-model="renameVal"
@blur="finishRename"
@keyup.enter="finishRename"
@keyup.escape="renamingFile=false"
/>
</div>
<select class="tb-theme-sel" v-model="renderTheme" title="File style theme">
<option v-for="t in renderThemes" :key="t.id" :value="t.id">
{{t.name}}
</option>
</select>
<div class="tb-group">
<button
class="tb-icon"
:class="{active:viewMode==='split'}"
@click="viewMode='split'"
title="Split view"
>
<i class="ti ti-layout-columns"></i>
</button>
<div class="tb-group-more">
<button
class="tb-icon"
:class="{active:viewMode==='editor'}"
@click="viewMode='editor'"
title="Editor only"
>
<i class="ti ti-code"></i>
</button>
<button
class="tb-icon"
:class="{active:viewMode==='preview'}"
@click="viewMode='preview'"
title="Preview only"
>
<i class="ti ti-eye"></i>
</button>
<button
class="tb-icon"
:class="{active:syncScrollEnabled}"
@click="toggleSyncScroll"
title="Sync scroll"
>
<i class="ti ti-arrows-left-right"></i>
</button>
</div>
</div>
<div class="tb-right">
<button class="tb-btn" @click="openExport" title="Export">
<i class="ti ti-download"></i>Export
</button>
<div class="tb-group">
<button
class="tb-btn tb-accent"
@click="openMermaidBuilder"
title="Mermaid Diagram Builder"
>
<i class="ti ti-topology-star"></i>Diagram
</button>
<div class="tb-group-more">
<button class="tb-btn tb-accent" @click="openLatexBuilder" title="LaTeX Math Helper">
<i class="ti ti-math-function"></i>Latex
</button>
<button class="tb-icon" @click="openImgManager" title="Images">
<i class="ti ti-photo"></i>
</button>
<button class="tb-icon" @click="openTemplates" title="Templates">
<i class="ti ti-layout-grid"></i>
</button>
<button
class="tb-icon"
:class="{active:activePanel==='organizer'}"
@click="activePanel=activePanel==='organizer'?'editor':'organizer'"
title="Block Organizer"
>
<i class="ti ti-layout-rows"></i>
</button>
</div>
</div>
<div class="tb-group">
<button class="tb-btn" @click="openSettings" title="Settings">
<i class="ti ti-settings"></i>Settings
</button>
<div class="tb-group-more">
<button class="tb-icon" @click="cycleThemeMode" :title="'Theme: '+themeModeLabel">
<i :class="themeModeIcon"></i>
</button>
<select
class="tb-mode-sel"
v-model="themeMode"
@change="setThemeMode(themeMode)"
title="Theme mode"
>
<option value="light">Light</option>
<option value="dark">Dark</option>
<option value="system">System</option>
</select>
<button class="tb-icon" @click="showShortcuts=true" title="Shortcuts">
<i class="ti ti-keyboard"></i>
</button>
<button class="tb-icon" @click="showTutorial=true" title="User guide">
<i class="ti ti-help-hexagon"></i>
</button>
<button class="tb-icon" :class="{active:focusMode}" @click="focusMode=true" title="Focus">
<i class="ti ti-maximize"></i>
</button>
</div>
</div>
<button
class="tb-icon"
:class="{active:showStylePanel}"
@click="showStylePanel=!showStylePanel"
title="Style panel"
>
<i class="ti ti-palette"></i>
</button>
</div>
</div>
<div id="app-body">
<div id="sidebar" :class="{collapsed:!sidebarOpen}">
<div class="sb-section">
<div class="sb-title">
Files
<button
class="sb-btn"
style="width: auto; padding: 1px 4px"
@click="newFile"
>
<i class="ti ti-plus"></i>
</button>
</div>
<label class="sb-search">
<i class="ti ti-search"></i>
<input
type="search"
v-model="fileSearch"
placeholder="Search files"
/>
</label>
<div
v-for="f in filteredFiles"
:key="f.id"
class="file-item"
:class="{active:activeFileId===f.id, dragging:draggedFileId===f.id, 'drag-over':fileDragOverId===f.id && draggedFileId!==f.id}"
:draggable="!isFileSearchActive"
@click="switchFile(f.id)"
@contextmenu.prevent="openFileCtx($event,f)"
@dragstart="onFileDragStart($event,f.id)"
@dragover="onFileDragOver($event,f.id)"
@drop="onFileDrop($event,f.id)"
@dragend="onFileDragEnd"
>
<i class="ti ti-file-text"></i
><span class="file-name">{{f.name}}</span>
<button class="file-del" @click.stop="deleteFile(f.id)">
<i class="ti ti-x"></i>
</button>
</div>
<div v-if="!filteredFiles.length" class="sb-empty">
No matching files
</div>
<button
class="sb-btn"
style="color: var(--fg3); margin-top: 2px"
@click="triggerMdUpload"
>
<i class="ti ti-upload"></i>Upload .md/.ipynb
</button>
</div>
<div class="sb-scroll">
<div class="sb-section sb-collapsible" style="border: none">
<button
class="sb-title sb-title-toggle"
@click="sidebarTemplatesOpen=!sidebarTemplatesOpen"
>
<span>Templates</span>
<i :class="sidebarTemplatesOpen?'ti ti-chevron-up':'ti ti-chevron-down'"></i>
</button>
<transition name="sb-collapse">
<div v-show="sidebarTemplatesOpen" class="sb-collapse-body">
<button
v-for="t in TEMPLATES.slice(0,7)"
:key="t.id"
class="sb-btn"
@click="loadTemplate(t)"
>
<i :class="'ti '+t.icon"></i>{{t.name}}
</button>
<button
class="sb-btn"
style="color: var(--acc)"
@click="openTemplates"
>
<i class="ti ti-dots"></i>All…
</button>
</div>
</transition>
</div>
<div class="sb-section" style="border: none; padding-top: 4px">
<div class="sb-title">Outline</div>
<div
v-if="!headings.length"
style="font-size: 11px; color: var(--fg3); padding: 2px 6px"
>
No headings
</div>
<div
v-for="h in headings"
:key="h.slug"
class="outline-item"
:style="{paddingLeft:(h.level-1)*10+5+'px'}"
@click="scrollToHeading(h.slug)"
>
<i
class="ti ti-hash"
style="font-size: 11px; opacity: 0.4; flex-shrink: 0"
></i>
<span style="overflow: hidden; text-overflow: ellipsis"
>{{h.text}}</span
>
</div>
</div>
<div class="sb-section" style="border: none; padding-top: 4px">
<div class="sb-title">Tools</div>
<button
class="sb-btn"
style="color: var(--acc)"
@click="openLatexBuilder"
>
<i class="ti ti-math-function"></i>LaTeX Builder
</button>
<button
class="sb-btn"
style="color: var(--acc)"
@click="openMermaidBuilder"
>
<i class="ti ti-topology-star"></i>Mermaid Builder
</button>
<button
class="sb-btn"
@click="activePanel=activePanel==='organizer'?'editor':'organizer'"
>
<i class="ti ti-layout-rows"></i>Block Organizer
</button>
</div>
</div>
</div>
<div id="main">
<div
id="editor-pane"
:class="{hidden:viewMode==='preview'}"
:style="viewMode==='split'?{flex:'0 0 '+editorWidth+'px',minWidth:'180px'}:{flex:'1'}"
>
<div class="pane-toolbar">
<span class="pane-label"
>{{activePanel==='organizer'?'Organizer':'Editor'}}</span
>
<div class="tool-sep"></div>
<template v-if="activePanel==='editor'">
<button class="tool-btn" @click="fmt('**','**')" title="Bold">
<i class="ti ti-bold"></i>
</button>
<button class="tool-btn" @click="fmt('*','*')" title="Italic">
<i class="ti ti-italic"></i>
</button>
<button class="tool-btn" @click="fmt('~~','~~')" title="Strike">
<i class="ti ti-strikethrough"></i>
</button>
<button class="tool-btn" @click="fmt('`','`')" title="Code">
<i class="ti ti-code"></i>
</button>
<div class="tool-sep"></div>
<button class="tool-btn" @click="fmtLine('# ')" title="H1">
<i class="ti ti-h-1"></i>
</button>
<button class="tool-btn" @click="fmtLine('## ')" title="H2">
<i class="ti ti-h-2"></i>
</button>
<button class="tool-btn" @click="fmtLine('### ')" title="H3">
<i class="ti ti-h-3"></i>
</button>
<div class="tool-sep"></div>
<button class="tool-btn" @click="fmtLine('- ')" title="Bullet">
<i class="ti ti-list"></i>
</button>
<button
class="tool-btn"
@click="fmtLine('1. ')"
title="Numbered"
>
<i class="ti ti-list-numbers"></i>
</button>
<button class="tool-btn" @click="fmtLine('> ')" title="Quote">
<i class="ti ti-blockquote"></i>
</button>
<button
class="tool-btn"
@click="fmtBlock('```\n','\n```')"
title="Code block"
>
<i class="ti ti-terminal-2"></i>
</button>
<div class="tool-sep"></div>
<button
class="tool-btn"
@click="openLatexBuilder"
title="LaTeX (Ctrl+M)"
style="color: var(--acc)"
>
<i class="ti ti-math-function"></i>
</button>
<button
class="tool-btn"
@click="openMermaidBuilder"
title="Mermaid (Ctrl+G)"
style="color: var(--acc)"
>
<i class="ti ti-topology-star"></i>
</button>
<div class="tool-sep"></div>
<button class="tool-btn" @click="insertLink" title="Link">
<i class="ti ti-link"></i>
</button>
<button
class="tool-btn"
@click="insertImageFromLib"
title="Image"
>
<i class="ti ti-photo"></i>
</button>
<button class="tool-btn" @click="insertTable" title="Table">
<i class="ti ti-table"></i>
</button>
<div class="tool-sep"></div>
<button class="tool-btn" @click="undo" title="Undo">
<i class="ti ti-arrow-back-up"></i>
</button>
<button class="tool-btn" @click="redo" title="Redo">
<i class="ti ti-arrow-forward-up"></i>
</button>
<button
class="tool-btn"
:class="{active:wordWrap}"
@click="wordWrap=!wordWrap"
title="Wrap"
>
<i class="ti ti-text-wrap"></i>
</button>
<button class="tool-btn" @click="openFR" title="Find & Replace">
<i class="ti ti-replace"></i>
</button>
<button
class="tool-btn"
@click="manualSnapshot"
title="Save snapshot (version)"
>
<i class="ti ti-camera"></i>
</button>
</template>
<template v-else>
<span style="font-size: 11px; color: var(--fg2)"
>{{blocks.length}} block(s) · Drag to reorder</span
>
<div style="margin-left: auto; display: flex; gap: 3px">
<button
class="tool-btn"
@click="parseBlocks();notify('Refreshed from editor','info',1500)"
title="Refresh from editor"
>
<i class="ti ti-refresh"></i>
</button>
<button
class="tool-btn"
@click="activePanel='editor'"
title="Back to editor"
>
<i class="ti ti-x"></i>
</button>
</div>
</template>
</div>
<!-- EDITOR TEXTAREA -->
<div
id="editor-wrap"
v-show="activePanel==='editor'"
@contextmenu.prevent="openEditorCtx"
ref="editorWrap"
>
<div
class="sync-indicator sync-indicator-editor"
v-show="syncIndicator.visible && syncScrollEnabled"
:style="{top:syncIndicator.editorTop+'px'}"
></div>
</div>
<!-- BLOCK ORGANIZER -->
<div class="block-organizer" v-show="activePanel==='organizer'">
<div class="block-org-toolbar">
<button
class="btn btn-sm btn-primary"
@click="addBlock(blocks.length-1,'paragraph')"
>
<i class="ti ti-plus"></i>Add block
</button>
<button class="btn btn-sm" @click="parseBlocks()">
<i class="ti ti-refresh"></i>Sync from editor
</button>
<span
style="margin-left: auto; font-size: 11px; color: var(--fg3)"
>{{blocks.length}} blocks</span
>
</div>
<div class="block-list">
<div
v-for="(block,idx) in blocks"
:key="block.id"
class="block-item"
:class="{selected:editingBlockIdx===idx}"
draggable="true"
@dragstart="onBlockDragStart($event,idx)"
@dragover="onBlockDragOver($event,idx)"
@drop="onBlockDrop($event,idx)"
@dragend="onBlockDragEnd"
>
<div class="block-drag-handle">
<i class="ti ti-grip-vertical"></i>
</div>
<div
class="block-content-preview"
@click="editingBlockIdx=editingBlockIdx===idx?-1:idx"
>
<div class="block-type-tag">
<i
:class="'ti '+(BLOCK_TYPES.find(b=>b.type===block.type)?.icon||'ti-file-text')"
style="font-size: 10px"
></i>
{{block.type}}
</div>
<div class="block-text-preview">
{{block.content.slice(0,120).replace(/\n/g,' ')||'(empty)'}}
</div>
<!-- Inline editor -->
<textarea
v-if="editingBlockIdx===idx"
class="block-inline-editor"
v-model="blocks[idx].content"
@input="blocksToContent()"
@click.stop
placeholder="Edit block content…"
></textarea>
</div>
<div class="block-actions-col">
<button
class="block-action-btn"
@click="moveBlock(idx,-1)"
title="Move up"
>
<i class="ti ti-arrow-up"></i>
</button>
<button
class="block-action-btn"
@click="moveBlock(idx,1)"
title="Move down"
>
<i class="ti ti-arrow-down"></i>
</button>
<button
class="block-action-btn"
@click="duplicateBlock(idx)"
title="Duplicate"
>
<i class="ti ti-copy"></i>
</button>
<button
class="block-action-btn"
@click="openBlockTypeMenu(idx,$event)"
title="Change type"
>
<i class="ti ti-replace"></i>
</button>
<button
class="block-action-btn danger"
@click="deleteBlock(idx)"
title="Delete"
>
<i class="ti ti-trash"></i>
</button>
</div>
</div>
<div class="block-add-row">
<button
class="block-add-btn"
@click="addBlock(blocks.length-1,'paragraph')"
>
<i class="ti ti-plus"></i>Add block
</button>
</div>
</div>
<!-- Block type picker menu -->
<div
v-if="blockTypeMenuOpen"
class="block-type-menu"
:style="{left:blockTypeMenuPos.x+'px',top:blockTypeMenuPos.y+'px'}"
@click.stop
>
<div style="padding: 4px 8px 4px">
<input
id="block-type-search"
v-model="blockTypeSearch"
placeholder="Search…"
style="font-size: 12px; padding: 4px 6px"
@click.stop
/>
</div>
<div
v-for="bt in filteredBlockTypes"
:key="bt.type"
class="block-type-opt"
@click="blocks[blockTypeMenuTarget].type=bt.type;blockTypeMenuOpen=false;blocksToContent()"
>
<i :class="'ti '+bt.icon"></i>{{bt.label}}
</div>
</div>
</div>
</div>
<div
id="resizer"
v-show="viewMode==='split'"
@mousedown="startResize"
></div>
<div id="preview-pane" :class="{hidden:viewMode==='editor'}">
<div class="pane-toolbar">
<span class="pane-label">Preview</span>
<div class="tool-sep"></div>
<span style="font-size: 11px; color: var(--fg2)"
>{{currentThemeName}}</span
>
<div class="preview-actions">
<button
class="tool-btn"
:class="{active:showStylePanel}"
@click="showStylePanel=!showStylePanel"
title="Preview style"
>
<i class="ti ti-adjustments-horizontal"></i>
</button>
<button
class="tool-btn"
:class="{active:previewCodeWrap}"
@click="previewCodeWrap=!previewCodeWrap"
title="Wrap code blocks"
>
<i class="ti ti-text-wrap"></i>
</button>
<button class="tool-btn" @click="copyHtml" title="Copy HTML">
<i class="ti ti-copy"></i>
</button>
<button class="tool-btn" @click="openExport">
<i class="ti ti-download"></i>
</button>
</div>
</div>
<div id="preview-scroller" ref="previewScroller" @contextmenu.prevent="openPreviewCtx">
<div
class="sync-indicator sync-indicator-preview"
v-show="syncIndicator.visible && syncScrollEnabled"
:style="{top:syncIndicator.previewTop+'px'}"
></div>
<div
id="preview-page"
:class="['md-body','theme-'+renderTheme, previewPageClass]"
:style="previewPageStyle"
>
<div
v-for="segment in previewSegments"
:key="segment.key"
class="preview-segment"
:data-preview-segment="segment.type"
v-html="segment.html"
></div>
</div>
</div>
</div>
<transition name="slide-r">
<div
id="style-panel-wrap"
class="style-panel"
v-if="showStylePanel"
>
<div class="style-panel-header">
<span class="style-panel-title"
><i class="ti ti-palette"></i
>Style</span
>
<button class="tool-btn" @click="showStylePanel=false">
<i class="ti ti-x"></i>
</button>
</div>
<div class="style-panel-body">
<div class="sp-section">
<div class="sp-title">Body font</div>
<div>
<span
v-for="f in fontChoices"
:key="f.val"
class="font-chip"
:class="{active:customFont===f.val}"
:style="{fontFamily:f.val}"
@click="customFont=f.val"
>{{f.name}}</span
>
</div>
</div>
<div class="sp-section">
<div class="sp-title">Typography</div>
<div class="slider-row">
<label>Font size</label
><input
type="range"
min="12"
max="22"
v-model.number="cFontSize"
/><span class="val">{{cFontSize}}px</span>
</div>
<div class="slider-row">
<label>Line height</label
><input
type="range"
min="1.2"
max="2.4"
step=".05"
v-model.number="cLineH"
/><span class="val">{{cLineH.toFixed(1)}}</span>
</div>
<div class="slider-row">
<label>Para gap</label
><input
type="range"
min="0"
max="2"
step=".1"
v-model.number="cParaGap"
/><span class="val">{{cParaGap.toFixed(1)}}em</span>
</div>
<div class="slider-row">
<label>Text wrap</label>
<input
type="checkbox"
v-model="previewTextWrap"
style="width: auto; justify-self: end"
/>
</div>
<div class="slider-row">
<label>Code size</label>
<input
type="range"
min="0.75"
max="1.4"
step="0.02"
v-model.number="previewCodeFontScale"
/>
<span class="val">{{previewCodeFontScale.toFixed(2)}}x</span>
</div>
<div class="slider-row">
<label>Code wrap</label>
<input
type="checkbox"
v-model="previewCodeWrap"
style="width: auto; justify-self: end"
/>
</div>
<div class="slider-row">
<label>LaTeX size</label>
<input
type="range"
min="0.75"
max="1.6"
step="0.02"
v-model.number="previewLatexFontScale"
/>
<span class="val">{{previewLatexFontScale.toFixed(2)}}x</span>
</div>
</div>
<div class="sp-section">
<div class="sp-title">Headings</div>
<div>
<span
v-for="f in fontChoices"
:key="f.val"
class="font-chip"
:class="{active:cHeadFont===f.val}"
:style="{fontFamily:f.val}"
@click="cHeadFont=f.val"
>{{f.name}}</span
>
</div>
<div class="slider-row" style="margin-top: 6px">
<label>H1 size</label
><input
type="range"
min="1.2"
max="4"
step=".05"
v-model.number="cH1"
/><span class="val">{{cH1.toFixed(1)}}em</span>
</div>
<div class="slider-row">
<label>H2 size</label
><input
type="range"
min="1"
max="3"
step=".05"
v-model.number="cH2"
/><span class="val">{{cH2.toFixed(1)}}em</span>
</div>
</div>
<div class="sp-section">
<div class="sp-title">Page</div>
<div class="slider-row">
<label>Max width</label
><input
type="range"
min="400"
max="1100"
step="10"
v-model.number="cWidth"
/><span class="val">{{cWidth}}</span>
</div>
<div class="slider-row">
<label>Padding H</label
><input
type="range"
min="12"
max="120"
step="4"
v-model.number="cPadH"
/><span class="val">{{cPadH}}px</span>
</div>
<div class="slider-row">
<label>Padding V</label
><input
type="range"
min="12"
max="120"
step="4"
v-model.number="cPadV"
/><span class="val">{{cPadV}}px</span>
</div>
</div>
<div class="sp-section">
<div class="sp-title">Tables</div>
<div class="slider-row">
<label>Layout</label>
<select v-model="previewTableLayout">
<option value="full">Full width</option>
<option value="fit">Fit content</option>
<option value="center">Centered</option>
</select>
</div>
<div class="slider-row">
<label>Font size</label>
<input
type="range"
min="0.8"
max="1.2"
step="0.02"
v-model.number="previewTableFontScale"
/>
<span class="val">{{previewTableFontScale.toFixed(2)}}x</span>
</div>
<div class="slider-row">
<label>Dense cells</label>
<input
type="checkbox"
v-model="previewTableCompact"
style="width: auto; justify-self: end"
/>
</div>
<div class="slider-row">
<label>Striped rows</label>
<input
type="checkbox"
v-model="previewTableStriped"
style="width: auto; justify-self: end"
/>
</div>
</div>
<div class="sp-section">
<div class="sp-title">Block Scale</div>
<div class="slider-row">
<label>Scope</label>
<select v-model="previewScaleScope">
<option value="all">All blocks</option>
<option value="media">Media + diagrams</option>
<option value="images">Images only</option>
<option value="mermaid">Mermaid only</option>
</select>
</div>
<div class="slider-row">
<label>Scale</label>
<input
type="range"
min="0.5"
max="2"
step="0.05"
v-model.number="previewScaleFactor"
/>
<span class="val">{{previewScaleFactor.toFixed(2)}}x</span>
</div>
</div>
<div class="sp-section">
<div class="sp-title">Media Blocks</div>
<div class="slider-row">
<label>Border</label>
<input
type="checkbox"
v-model="mediaBlockBorder"
style="width: auto; justify-self: end"
/>
</div>
<div class="slider-row">
<label>Background</label>
<select v-model="mediaBlockBgMode">
<option value="transparent">Transparent</option>
<option value="color">Color</option>
</select>
</div>
<div class="color-row" v-if="mediaBlockBgMode==='color'">
<label>Block color</label
><input type="color" v-model="mediaBlockBgColor" /><span
style="font-size: 10px; color: var(--fg3)"
>{{mediaBlockBgColor}}</span
>
</div>
</div>
<div class="sp-section">
<div class="sp-title">Colors</div>
<div class="color-row">
<label>Body text</label
><input type="color" v-model="cColorText" /><span
style="font-size: 10px; color: var(--fg3)"
>{{cColorText||'theme'}}</span
>
</div>
<div class="color-row">
<label>Headings</label
><input type="color" v-model="cColorHead" /><span
style="font-size: 10px; color: var(--fg3)"
>{{cColorHead||'theme'}}</span
>
</div>
<div class="color-row">
<label>Links</label
><input type="color" v-model="cColorLink" /><span
style="font-size: 10px; color: var(--fg3)"
>{{cColorLink||'theme'}}</span
>
</div>
<div class="color-row">
<label>Background</label
><input type="color" v-model="cColorBg" /><span
style="font-size: 10px; color: var(--fg3)"
>{{cColorBg||'theme'}}</span
>
</div>
</div>
<div
class="sp-section"
style="display: flex; flex-direction: column; gap: 5px"
>