From 04f32a7484efe6ca1e5b6b63dc504a209c5caec2 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Tue, 24 Apr 2012 09:33:21 +0900 Subject: [PATCH] work around collapsing fields bug --- aqt/editor.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/aqt/editor.py b/aqt/editor.py index 63985a10c..cf9c28905 100644 --- a/aqt/editor.py +++ b/aqt/editor.py @@ -29,6 +29,7 @@ _html = """ .field { border: 1px solid #aaa; background:#fff; color:#000; padding: 5px; } +/* prevent floated images from being displayed outside field */ .field:after { content: "."; display: block; @@ -64,9 +65,17 @@ function onKey() { return; } clearChangeTimer(); - changeTimer = setTimeout(function () { - sendState(); - saveField("key"); }, 600); + if (currentField.innerHTML == "

") { + // fix empty div bug. slight flicker, but must be done in a timer + changeTimer = setTimeout(function () { + currentField.innerHTML = "
"; + sendState(); + saveField("key"); }, 1); + } else { + changeTimer = setTimeout(function () { + sendState(); + saveField("key"); }, 600); + } }; function sendState() {