 
     fileprivate(set) var editingMode: EditMode = .richText {
         didSet {
-            view.endEditing(true)
-            
             switch editingMode {
             case .html:
                 switchToHTML()

    }

    fileprivate func switchToRichText() {
        navigationItem.rightBarButtonItem?.title = NSLocalizedString("HTML", comment: "HTML!")

        richTextView.setHTML(htmlTextView.text)
        richTextView.becomeFirstResponder()

    }

    fileprivate func switchToHTML() {
        view.endEditing(true)
        
        htmlTextView.text = richTextView.getHTML()
        htmlTextView.becomeFirstResponder()
