Treat the Jupyter input line as editable
This commit is contained in:
parent
fa3bb9a5c8
commit
e832105dd5
@ -73,6 +73,7 @@ Fixed
|
|||||||
- `:navigate prev/next` now detects `rel` attributes on `<a>` elements, and
|
- `:navigate prev/next` now detects `rel` attributes on `<a>` elements, and
|
||||||
handles multiple `rel` attributes correctly.
|
handles multiple `rel` attributes correctly.
|
||||||
- Fixed a crash when hinting with target `userscript` and spawning a non-existing script
|
- Fixed a crash when hinting with target `userscript` and spawning a non-existing script
|
||||||
|
- Lines in Jupyter notebook now trigger insert mode
|
||||||
|
|
||||||
v0.9.1
|
v0.9.1
|
||||||
------
|
------
|
||||||
|
@ -223,18 +223,22 @@ class AbstractWebElement(collections.abc.MutableMapping):
|
|||||||
else:
|
else:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def _is_editable_div(self):
|
def _is_editable_classes(self):
|
||||||
"""Check if a div-element is editable.
|
"""Check if an element is editable based on its classes.
|
||||||
|
|
||||||
Return:
|
Return:
|
||||||
True if the element is editable, False otherwise.
|
True if the element is editable, False otherwise.
|
||||||
"""
|
"""
|
||||||
# Beginnings of div-classes which are actually some kind of editor.
|
# Beginnings of div-classes which are actually some kind of editor.
|
||||||
div_classes = ('CodeMirror', # Javascript editor over a textarea
|
classes = {
|
||||||
'kix-', # Google Docs editor
|
'div': ['CodeMirror', # Javascript editor over a textarea
|
||||||
'ace_') # http://ace.c9.io/
|
'kix-', # Google Docs editor
|
||||||
|
'ace_'], # http://ace.c9.io/
|
||||||
|
'pre': ['CodeMirror'],
|
||||||
|
}
|
||||||
|
relevant_classes = classes[self.tag_name()]
|
||||||
for klass in self.classes():
|
for klass in self.classes():
|
||||||
if any([klass.startswith(e) for e in div_classes]):
|
if any([klass.strip().startswith(e) for e in relevant_classes]):
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
@ -265,10 +269,9 @@ class AbstractWebElement(collections.abc.MutableMapping):
|
|||||||
return config.get('input', 'insert-mode-on-plugins') and not strict
|
return config.get('input', 'insert-mode-on-plugins') and not strict
|
||||||
elif tag == 'object':
|
elif tag == 'object':
|
||||||
return self._is_editable_object() and not strict
|
return self._is_editable_object() and not strict
|
||||||
elif tag == 'div':
|
elif tag in ['div', 'pre']:
|
||||||
return self._is_editable_div() and not strict
|
return self._is_editable_classes() and not strict
|
||||||
else:
|
return False
|
||||||
return False
|
|
||||||
|
|
||||||
def is_text_input(self):
|
def is_text_input(self):
|
||||||
"""Check if this element is some kind of text box."""
|
"""Check if this element is some kind of text box."""
|
||||||
|
Loading…
Reference in New Issue
Block a user