29 lines
525 B
Swift
29 lines
525 B
Swift
|
//
|
||
|
// JavaScriptEditorView.swift
|
||
|
// MongoView
|
||
|
//
|
||
|
// Created by Shadowfacts on 4/4/20.
|
||
|
// Copyright © 2020 Shadowfacts. All rights reserved.
|
||
|
//
|
||
|
|
||
|
import AppKit
|
||
|
|
||
|
class JavaScriptEditorView: NSTextView {
|
||
|
|
||
|
override var string: String {
|
||
|
didSet {
|
||
|
rehighlight()
|
||
|
}
|
||
|
}
|
||
|
|
||
|
func rehighlight() {
|
||
|
JavaScriptHighlighter(mutableAttributed: self.textStorage!).highlight()
|
||
|
}
|
||
|
|
||
|
override func didChangeText() {
|
||
|
rehighlight()
|
||
|
|
||
|
super.didChangeText()
|
||
|
}
|
||
|
}
|