mirror of
https://github.com/ankitects/anki.git
synced 2025-09-24 16:56:36 -04:00
focus elements on drag over so dropped images are saved
This commit is contained in:
parent
93118b2710
commit
cd4b1e894e
1 changed files with 5 additions and 1 deletions
|
@ -116,6 +116,10 @@ function onFocus(elem) {
|
|||
}
|
||||
}
|
||||
|
||||
function onDragOver(elem) {
|
||||
elem.focus();
|
||||
}
|
||||
|
||||
function caretToEnd() {
|
||||
var r = document.createRange()
|
||||
r.selectNodeContents(currentField);
|
||||
|
@ -177,6 +181,7 @@ function setFields(fields, focusTo) {
|
|||
txt += "<tr><td class=fname>{0}</td></tr><tr><td width=100%%>".format(n);
|
||||
txt += "<div id=f{0} onkeydown='onKey();' onmouseup='onKey();'".format(i);
|
||||
txt += " onfocus='onFocus(this);' onblur='onBlur();' class=field ";
|
||||
txt += "ondragover='onDragOver(this);' ";
|
||||
txt += "contentEditable=true>{0}</div>".format(f);
|
||||
txt += "</td></tr>";
|
||||
}
|
||||
|
@ -911,7 +916,6 @@ class EditorWebView(AnkiWebView):
|
|||
evt.mouseButtons(), evt.keyboardModifiers())
|
||||
evt.accept()
|
||||
QWebView.dropEvent(self, new)
|
||||
self.editor.saveNow()
|
||||
|
||||
def prepareClip(self, keep=False, mode=QClipboard.Clipboard):
|
||||
clip = self.editor.mw.app.clipboard()
|
||||
|
|
Loading…
Reference in a new issue