From cf311b9c1539859a7d691de447ee69a64b8fba82 Mon Sep 17 00:00:00 2001 From: hieplq Date: Wed, 29 Mar 2017 16:57:38 +0700 Subject: [PATCH] IDEMPIERE-1287:When editing in a field (header or detail) use shortcut key (alt + next) to move next record. value in this field is not save support CKEditor control (IDEMPIERE-2310) --- org.adempiere.ui.zk/index.zul | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/org.adempiere.ui.zk/index.zul b/org.adempiere.ui.zk/index.zul index cb93c1a172..dbd6769ad5 100644 --- a/org.adempiere.ui.zk/index.zul +++ b/org.adempiere.ui.zk/index.zul @@ -24,6 +24,28 @@ Copyright (C) 2007 Ashley G Ramdass. // just sent fake event when control is textfield and value is not yet sync to server if (wgt.$instanceof(zul.inp.Textbox) && wgt.$n().value != wgt.getText()) zAu.send(new zk.Event(zk.Widget.$(wgt), 'onChange',{"value":wgt.$n().value})); + else if (wgt.$instanceof(ckez.CKeditor)){ + // CKEditor extend from zul.Widget not from wget zul.inp.InputWidget + // so some behavior is not same standard input + // this code bring from ckez.CKeditor.onBlur + var editor = wgt._editor; + + if (wgt._tidChg) { + clearInterval(wgt._tidChg); + wgt._tidChg = null; + } + + if (!editor.document) + editor.document = editor.element.getDocument(); + + if (wgt.$class._checkEditorDirty(editor)) { // Issue #13 + var val = editor.getData(); + wgt._value = val; //save for onRestore + //ZKCK-16, 17 use sendAhead to make sure onChange always happens first + wgt.fire('onChange', {value: val}); + editor.resetDirty(); + } + } }, fireOnInitEdit: function (wgt) {