Treat CodeMirror instances as editable
This commit is contained in:
parent
de27c6d4a7
commit
91416e345d
@ -185,16 +185,14 @@ class WebView(QWebView):
|
|||||||
"""
|
"""
|
||||||
# FIXME is this algorithm accurate?
|
# FIXME is this algorithm accurate?
|
||||||
elem = hitresult.element()
|
elem = hitresult.element()
|
||||||
|
tag = elem.tagName().lower()
|
||||||
if hitresult.isContentEditable() and webelem.is_writable(elem):
|
if hitresult.isContentEditable() and webelem.is_writable(elem):
|
||||||
# text fields and the like
|
# text fields and the like
|
||||||
return True
|
return True
|
||||||
if not config.get('input', 'insert-mode-on-plugins'):
|
elif tag in ('embed', 'applet', 'select'):
|
||||||
return False
|
|
||||||
tag = elem.tagName().lower()
|
|
||||||
if tag in ('embed', 'applet', 'select'):
|
|
||||||
# Flash/Java/...
|
# Flash/Java/...
|
||||||
return True
|
return config.get('input', 'insert-mode-on-plugins')
|
||||||
if tag == 'object':
|
elif tag == 'object':
|
||||||
# Could be Flash/Java/..., could be image/audio/...
|
# Could be Flash/Java/..., could be image/audio/...
|
||||||
if not elem.hasAttribute('type'):
|
if not elem.hasAttribute('type'):
|
||||||
log.mouse.debug("<object> without type clicked...")
|
log.mouse.debug("<object> without type clicked...")
|
||||||
@ -206,8 +204,12 @@ class WebView(QWebView):
|
|||||||
# at least a classid attribute. Oh, and let's home images/...
|
# at least a classid attribute. Oh, and let's home images/...
|
||||||
# DON"T have a classid attribute. HTML sucks.
|
# DON"T have a classid attribute. HTML sucks.
|
||||||
log.mouse.debug("<object type='{}'> clicked.".format(objtype))
|
log.mouse.debug("<object type='{}'> clicked.".format(objtype))
|
||||||
|
return config.get('input', 'insert-mode-on-plugins')
|
||||||
|
elif tag == 'div':
|
||||||
|
if any([c.startswith('CodeMirror') for c in elem.classes()]):
|
||||||
return True
|
return True
|
||||||
return False
|
else:
|
||||||
|
return False
|
||||||
|
|
||||||
def _mousepress_backforward(self, e):
|
def _mousepress_backforward(self, e):
|
||||||
"""Handle back/forward mouse button presses.
|
"""Handle back/forward mouse button presses.
|
||||||
|
Loading…
Reference in New Issue
Block a user