         selectAllText()
     }
 
-    // MARK: Accessory views
-    private var defaultEditToolbarView = DefaultEditToolbarView.wmf_viewFromClassNib()
-    private var contextualHighlightEditToolbarView = ContextualHighlightEditToolbarView.wmf_viewFromClassNib()
+    // MARK: Input view controller
 
-    // MARK: Input view
-
-    private var inputViewType: TextFormattingInputViewController.InputViewType?
-
-    private var textFormattingInputViewController: TextFormattingInputViewController
-
+    // inputViewController is a get-only property
+    // so we can't set it the same way we're setting inputAccessoryView
     override var inputViewController: UIInputViewController? {
-        guard let inputViewType = inputViewType else {
-            return nil
-        }
-        textFormattingInputViewController.inputViewType = inputViewType
-        return textFormattingInputViewController
-    }
-
-    // MARK: - Showing input view
-
-    func setInputViewHidden(type: TextFormattingInputViewController.InputViewType? = nil, hidden: Bool) {
-        inputViewType = type
-
-        if hidden {
-            inputAccessoryViewType = previousInputAccessoryViewType
-        } else {
-            inputAccessoryViewType = nil
-        }
-
-        reloadInputViews()
+        return inputViewsSource?.inputViewController
     }
 
     // MARK: Input accessory view
 
-    func configureInputAccessoryViews() {
-        inputAccessoryViewType = .default
-    }
-
-    private var previousInputAccessoryViewType: InputAccessoryViewType?
-    private var inputAccessoryViewType: InputAccessoryViewType? = .default {
-        didSet {
-            previousInputAccessoryViewType = oldValue
-            inputAccessoryView = preferredInputAccessoryView()
-            reloadInputViews()
-        }
-    }
-
-    private enum InputAccessoryViewType {
-        case `default`
-        case highlight
+    func setInputAccessoryView(_ inputAccessoryView: UIView?) {
+        self.inputAccessoryView = inputAccessoryView
+        reloadInputViews()
     }
 
     override func reloadInputViews() {
         themeInputViews(theme: theme)
         super.reloadInputViews()
     }
+}
 
-    private func preferredInputAccessoryView() -> (UIView & Themeable)? {
-        guard let inputAccessoryViewType = inputAccessoryViewType else {
-            return nil
-        }
+// MARK: Themeable
 
-        let maybeView: Any?
-
-        switch inputAccessoryViewType {
-        case .default:
-            maybeView = defaultEditToolbarView
-        case .highlight:
-            maybeView = contextualHighlightEditToolbarView
-        }
-
-        guard let preferredInputAccessoryView = maybeView as? UIView & Themeable else {
-            assertionFailure("Couldn't get preferredInputAccessoryView")
-            return nil
-        }
-
-        return preferredInputAccessoryView
-    }
-
-    // MARK: Notifications
-
-    @objc private func textSelectionDidChange(_ notification: Notification) {
-        guard inputViewController == nil else {
-            return
-        }
-        guard let userInfo = notification.userInfo else {
-            return
-        }
-        guard let message = userInfo[SectionEditorWebViewConfiguration.WMFSectionEditorSelectionChanged] as? SelectionChangedMessage else {
-            return
-        }
-        if message.selectionIsRange {
-            inputAccessoryViewType = .highlight
-        } else {
-            inputAccessoryViewType = .default
-        }
+extension SectionEditorWebViewWithEditToolbar {
+    private func themeInputViews(theme: Theme) {
+        (inputAccessoryView as? Themeable)?.apply(theme: theme)
+        (inputView as? Themeable)?.apply(theme: theme)
     }
 
     override func apply(theme: Theme) {

class SectionEditorWebViewWithEditToolbar: SectionEditorWebView {
    
    override init(theme: Theme) {
        textFormattingInputViewController = TextFormattingInputViewController.wmf_viewControllerFromStoryboardNamed("TextFormatting")
        super.init(theme: theme)
        setEditMenuItems()
        textFormattingInputViewController.delegate = self
        defaultEditToolbarView?.delegate = self
        contextualHighlightEditToolbarView?.delegate = self
        NotificationCenter.default.addObserver(self, selector: #selector(textSelectionDidChange(_:)), name: Notification.Name.WMFSectionEditorSelectionChangedNotification, object: nil)
    }

    deinit {

        themeInputViews(theme: theme)
    }
}
