2016-12-27 11:32:55 +03:00
|
|
|
/**
|
|
|
|
* Tae Won Ha - http://taewon.de - @hataewon
|
|
|
|
* See LICENSE
|
|
|
|
*/
|
|
|
|
|
|
|
|
import Cocoa
|
2017-01-06 16:41:19 +03:00
|
|
|
import RxSwift
|
2016-12-27 11:32:55 +03:00
|
|
|
|
|
|
|
protocol PreviewRenderer: class {
|
|
|
|
|
2017-01-01 09:52:02 +03:00
|
|
|
static var identifier: String { get }
|
|
|
|
static func prefData(from: [String: Any]) -> StandardPrefData?
|
|
|
|
|
|
|
|
var identifier: String { get }
|
|
|
|
var prefData: StandardPrefData? { get }
|
2017-01-06 16:41:19 +03:00
|
|
|
var scrollSink: Observable<Any> { get }
|
2017-01-01 09:52:02 +03:00
|
|
|
|
2016-12-30 06:32:08 +03:00
|
|
|
var toolbar: NSView? { get }
|
|
|
|
var menuItems: [NSMenuItem]? { get }
|
|
|
|
|
|
|
|
func canRender(fileExtension: String) -> Bool
|
2016-12-27 11:32:55 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
enum PreviewRendererAction {
|
|
|
|
|
|
|
|
case htmlString(renderer: PreviewRenderer, html: String, baseUrl: URL)
|
|
|
|
case view(renderer: PreviewRenderer, view: NSView)
|
|
|
|
|
|
|
|
case scroll(to: Position)
|
|
|
|
|
|
|
|
case error(renderer: PreviewRenderer)
|
|
|
|
}
|