-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
119 lines (111 loc) · 5.59 KB
/
Copy pathindex.html
File metadata and controls
119 lines (111 loc) · 5.59 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Text Formatter by John Req</title>
<link rel="stylesheet" href="style.css">
<script src="https://unpkg.com/vue@3.5.13/dist/vue.global.prod.js"></script>
</head>
<body>
<div id="app">
<header>
<h1>Text Formatter</h1>
<button type="button" @click="toggleTheme">
{{ theme === 'dark' ? 'Dark' : 'Light' }}
</button>
</header>
<div id="tab-controls-container">
<button type="button" class="tab" :class="{ active: active_tab === 'formatter' }" @click="active_tab = 'formatter'">Text Formatter</button>
<button type="button" class="tab" :class="{ active: active_tab === 'editor' }" @click="active_tab = 'editor'">Text Editor</button>
</div>
<div id="text-formatter-container" v-if="active_tab === 'formatter'">
<div id="text-formatter-input-container">
<textarea v-model="input" spellcheck="false" placeholder="Type something..."></textarea>
</div>
<div class="output" v-for="(variant, name) in variants" :key="name">
<div class="variant-header">
<h5 :title="name">{{ transform(name, variant) }}</h5>
<button type="button" @click="copyToClipboard(formattedVariants[name], name)">
{{ copied === name ? 'Copied!' : 'Copy' }}
</button>
</div>
<pre>{{ formattedVariants[name] }}</pre>
</div>
</div>
<div id="text-editor-container" v-if="active_tab === 'editor'">
<div class="editor-split">
<aside class="editor-section editor-left">
<section class="editor-group">
<h3 class="section-title">Unicode Styles</h3>
<div class="toolbar">
<button
type="button"
class="text-format"
v-for="(map, name) in variants"
:key="name"
:value="name"
@click="applyStyleToSelection(name)"
>
{{ transform(name, map) }}
</button>
</div>
</section>
<section class="editor-group">
<h3 class="section-title">Case Presets</h3>
<div class="toolbar">
<button
type="button"
class="text-format"
v-for="(preset, name) in casePresets"
:key="name"
@click="applyCasePreset(name)"
>
{{ name }}
</button>
</div>
</section>
<section class="editor-group">
<h3 class="section-title">Actions</h3>
<div class="editor-actions">
<button type="button" @click="copyToClipboard(editor_input, null, true)">
{{ editorCopied ? 'Copied!' : 'Copy' }}
</button>
<button type="button" class="text-format" @click="removeFormatFromSelection">Remove Format</button>
<button type="button" class="text-format" @click="replaceCurlyQuotesInEditor">Straight Quotes</button>
<button type="button" class="text-format" @click="cleanMarkdownInEditor">Convert Markdown</button>
<button type="button" class="text-format" :disabled="!canUndo" @click="undoEditor">Undo</button>
<button type="button" class="text-format" :disabled="!canRedo" @click="redoEditor">Redo</button>
<button type="button" class="text-format danger" @click="resetFormatting">Reset all</button>
</div>
</section>
</aside>
<section class="editor-section editor-right">
<h3 class="section-title">Editor</h3>
<div class="scope-hint" aria-live="polite">
<p class="scope-hint-line">{{ editorSelectionHint }}</p>
<p class="scope-hint-line">{{ editorTypingHint }}</p>
</div>
<textarea
ref="editorTextarea"
class="long-editor"
v-model="editor_input"
@beforeinput="handleEditorBeforeInput"
@keydown="handleEditorKeydown"
@input="handleEditorInput"
@select="updateSelectionFromEvent"
@mouseup="updateSelectionFromEvent"
@keyup="updateSelectionFromEvent"
spellcheck="false"
placeholder="Type and highlight text, then apply style."
cols="40"
></textarea>
</section>
</div>
</div>
</div>
<script src="formatter-core.js"></script>
<script src="formatter-storage.js"></script>
<script src="main.js"></script>
</body>
</html>