chore: removed unused code
mellbacon committed
Sep 17, 2023 at 23:27 UTC
415cf3b15883ab7995cd6c212b983e737f7c3042
1 file changed
-45
src/lib/Editor.svelte
-45
@@ -161,51 +161,6 @@
161
(editorContainer as HTMLElement).style.setProperty("font-family", family, "important")
162
}
163
}
164
-
165
- // TODO: need to find a much better way of handling this
166
- // yes im aware how messy all these functions are but it works!
167
- export async function append(value: string) {
168
- let cursorpos = getCurrentEditor().getView().state.selection.main.head + value.length;
169
- const lines = value.split("\n").length - 1;
170
- if (lines > 0) {
171
- cursorpos -= lines;
172
- }
173
- getCurrentEditor().getView().dispatch({
174
- changes: {
175
- from: getCurrentEditor().getView().state.selection.ranges[0].from,
176
- to: getCurrentEditor().getView().state.selection.ranges[0].to,
177
- insert: value,
178
- },
179
- selection: {anchor: cursorpos, head: cursorpos},
180
- scrollIntoView: true
181
- })
182
- await getCurrentEditor().updateContent();
183
- getCurrentEditor().updateLineInfo();
184
- }
185
- export async function copy() {
186
- const selection = getCurrentEditor().getView().state.sliceDoc(getCurrentEditor().getView().state.selection.main.from, getCurrentEditor().getView().state.selection.main.to)
187
- await navigator.clipboard.writeText(selection);
188
- }
189
- export async function cut() {
190
- deleteToLineEnd(getCurrentEditor().getView())
191
- await getCurrentEditor().updateContent();
192
- getCurrentEditor().updateLineInfo();
193
- }
194
- export async function undoChange() {
195
- undo(getCurrentEditor().getView());
196
- await getCurrentEditor().updateContent();
197
- getCurrentEditor().updateLineInfo();
198
- }
199
- export async function redoChange() {
200
- redo(getCurrentEditor().getView());
201
- await getCurrentEditor().updateContent();
202
- getCurrentEditor().updateLineInfo();
203
- }
204
- export async function deleteChars() {
205
- deleteCharForward(getCurrentEditor().getView());
206
- await getCurrentEditor().updateContent();
207
- getCurrentEditor().updateLineInfo();
208
- }
164
</script>
165
166
<div bind:this={ref} class="editor" class:hidden on:mousedown={updateLineInfo} on:keydown={handleKeyDown}></div>