Fixed content editable elements losing focus on control keys

This commit is contained in:
squidfunk 2019-03-12 16:51:22 +01:00
parent 9a16b9c6ea
commit 1aa8aeb252
3 changed files with 6 additions and 7 deletions

File diff suppressed because one or more lines are too long

View File

@ -190,7 +190,7 @@
{% endblock %} {% endblock %}
</div> </div>
{% block scripts %} {% block scripts %}
<script src="{{ 'assets/javascripts/application.a1129ccd.js' | url }}"></script> <script src="{{ 'assets/javascripts/application.51c3f73e.js' | url }}"></script>
{% if lang.t("search.language") != "en" %} {% if lang.t("search.language") != "en" %}
{% set languages = lang.t("search.language").split(",") %} {% set languages = lang.t("search.language").split(",") %}
{% if languages | length and languages[0] != "" %} {% if languages | length and languages[0] != "" %}

View File

@ -340,6 +340,11 @@ function initialize(config) { // eslint-disable-line func-style
if (!(query instanceof HTMLInputElement)) if (!(query instanceof HTMLInputElement))
throw new ReferenceError throw new ReferenceError
/* Skip editable elements */
if (document.activeElement instanceof HTMLElement &&
document.activeElement.contentEditable === "true")
return
/* Abort if meta key (macOS) or ctrl key (Windows) is pressed */ /* Abort if meta key (macOS) or ctrl key (Windows) is pressed */
if (ev.metaKey || ev.ctrlKey) if (ev.metaKey || ev.ctrlKey)
return return