Go to insertmode in google docs

This commit is contained in:
Florian Bruhin 2014-06-23 08:02:10 +02:00
parent 35ffc2c2c0
commit 0028bd94cc
2 changed files with 12 additions and 9 deletions

View File

@ -10,8 +10,6 @@ Bugs
- Handle it correctly when a new statusbar question is asked while another is - Handle it correctly when a new statusbar question is asked while another is
still active. (see notes) still active. (see notes)
- iggy: qutebrowser gets out of insert mode a lot on Google Drive/Docs
- Ugly font rendering on Windows on http://support.sigasi.com/Knowledgebase/List - Ugly font rendering on Windows on http://support.sigasi.com/Knowledgebase/List
- On doodle, when modifying something on http://doodle.com/create and clicking - On doodle, when modifying something on http://doodle.com/create and clicking

View File

@ -185,7 +185,9 @@ class WebView(QWebView):
Args: Args:
hitresult: A QWebHitTestResult hitresult: A QWebHitTestResult
""" """
# FIXME is this algorithm accurate? # Beginnings of div-classes which are actually some kind of editor.
DIV_CLASSES = ['CodeMirror', # Javascript editor over a textarea
'kix-'] # Google Docs editor
elem = hitresult.element() elem = hitresult.element()
tag = elem.tagName().lower() tag = elem.tagName().lower()
if hitresult.isContentEditable() and webelem.is_writable(elem): if hitresult.isContentEditable() and webelem.is_writable(elem):
@ -208,12 +210,15 @@ class WebView(QWebView):
log.mouse.debug("<object type='{}'> clicked.".format(objtype)) log.mouse.debug("<object type='{}'> clicked.".format(objtype))
return config.get('input', 'insert-mode-on-plugins') return config.get('input', 'insert-mode-on-plugins')
elif tag == 'div': elif tag == 'div':
# CodeMirror is some java-script editor which hides the underlying log.webview.debug("div with classes {} clicked!".format(
# textarea, but is editable. elem.classes()))
if any([c.startswith('CodeMirror') for c in elem.classes()]): for klass in elem.classes():
return True if any([klass.startswith(e) for e in DIV_CLASSES]):
else: return True
return False elif tag == 'span':
log.webview.debug("span with classes {} clicked!".format(
elem.classes()))
return False
def _mousepress_backforward(self, e): def _mousepress_backforward(self, e):
"""Handle back/forward mouse button presses. """Handle back/forward mouse button presses.