-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmock-overtype.ts
More file actions
44 lines (36 loc) · 1.1 KB
/
mock-overtype.ts
File metadata and controls
44 lines (36 loc) · 1.1 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
/**
* Mock implementation of Overtype for development
* This wraps a textarea and provides a minimal interface
*/
export class OverType {
public element: HTMLTextAreaElement
public instanceId: number
public initialized: boolean = true
private static instanceCount = 0
constructor(target: HTMLTextAreaElement) {
this.element = target
this.instanceId = ++OverType.instanceCount
// Store reference on the element
;(target as any).overTypeInstance = this
// Apply basic styling or enhancement
this.enhance()
}
private enhance(): void {
// Mock enhancement - could add basic styling, event handlers, etc.
this.element.style.fontFamily =
'Monaco, "Cascadia Code", "Roboto Mono", Consolas, "Courier New", monospace'
this.element.style.fontSize = '14px'
this.element.style.lineHeight = '1.5'
}
getValue(): string {
return this.element.value
}
setValue(value: string): void {
this.element.value = value
}
destroy(): void {
// Clean up any enhancements
delete (this.element as any).overTypeInstance
this.initialized = false
}
}