Fix for WYSIWYG editor on github (#114).
authorDaniel Carl <danielcarl@gmx.de>
Thu, 16 Oct 2014 13:05:00 +0000 (15:05 +0200)
committerDaniel Carl <danielcarl@gmx.de>
Thu, 16 Oct 2014 13:05:00 +0000 (15:05 +0200)
For these editors the click does not reach the editable element, so that vimb
does not switch to insert mode. But the textarea is focused when the click
appears, so that we can pick up the click event and check if the focused
element is editable.
I hope this will not break other pages that heavily depend on JavaScript.

src/main.c

index f503889..3325072 100644 (file)
@@ -1143,6 +1143,11 @@ static gboolean button_relase_cb(WebKitWebView *webview, GdkEventButton *event)
          * mode when the user clicks into a form field */
         mode_enter('i');
         propagate = true;
+    } else if (vb.mode->id == 'n' && dom_is_editable(dom_get_active_element(vb.gui.webview))) {
+        /* if the focus is on an editable element after the click - switch
+         * also to insert mode - this seems to work also for WYSIWYG editors */
+        mode_enter('i');
+        propagate = true;
     }
     g_object_unref(result);