You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openmeetings.apache.org by so...@apache.org on 2019/03/07 16:34:14 UTC
[openmeetings] branch master updated: [OPENMEETINGS-2025] update
btn is disabled if no Math oject is selected
This is an automated email from the ASF dual-hosted git repository.
solomax pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/openmeetings.git
The following commit(s) were added to refs/heads/master by this push:
new 0914fdd [OPENMEETINGS-2025] update btn is disabled if no Math oject is selected
0914fdd is described below
commit 0914fddbbdd2cb50b55091e42ae75e9f75239827
Author: Maxim Solodovnik <so...@gmail.com>
AuthorDate: Thu Mar 7 23:33:39 2019 +0700
[OPENMEETINGS-2025] update btn is disabled if no Math oject is selected
---
.../openmeetings/web/room/wb/raw-tool-math.js | 32 ++++++++++++++++------
1 file changed, 24 insertions(+), 8 deletions(-)
diff --git a/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/wb/raw-tool-math.js b/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/wb/raw-tool-math.js
index ecca514..044b065 100644
--- a/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/wb/raw-tool-math.js
+++ b/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/wb/raw-tool-math.js
@@ -54,19 +54,34 @@ var TMath = function(wb, s) {
const math = ShapeBase();
math.obj = null;
- math.mouseDown = function(o) {
- const canvas = this
- , pointer = canvas.getPointer(o.e)
+ function _enableUpdate(upd, obj) {
+ upd.data('uid', obj.uid);
+ upd.data('slide', obj.slide);
+ upd.button('enable');
+ }
+ function _updateDisabled(cnvs) {
+ const canvas = cnvs || wb.getCanvas()
, ao = canvas.getActiveObject()
, fml = wb.getFormula()
, ta = fml.find('textarea')
, upd = fml.find('.update-btn');
- fml.show();
if (!!ao && ao.omType === 'Math') {
- upd.data('uid', ao.uid);
- upd.data('slide', ao.slide);
+ _enableUpdate(upd, ao);
ta.val(ao.formula);
+ return false;
} else {
+ upd.button('disable');
+ return true;
+ }
+ }
+ math.mouseDown = function(o) {
+ const canvas = this
+ , pointer = canvas.getPointer(o.e)
+ , fml = wb.getFormula()
+ , ta = fml.find('textarea')
+ , upd = fml.find('.update-btn');
+ fml.show();
+ if (_updateDisabled(canvas)) {
const err = fml.find('.status');
err.text('');
if (ta.val().trim() === '') {
@@ -89,8 +104,7 @@ var TMath = function(wb, s) {
if (wb.getRole() !== NONE) {
canvas.setActiveObject(math.obj);
}
- upd.data('uid', math.obj.uid);
- upd.data('slide', math.obj.slide);
+ _enableUpdate(upd, math.obj);
}
, function(msg) {
err.text(msg);
@@ -109,6 +123,7 @@ var TMath = function(wb, s) {
}
});
});
+ _updateDisabled();
ToolUtil.disableAllProps(s);
};
math.deactivate = function() {
@@ -121,6 +136,7 @@ var TMath = function(wb, s) {
}
});
});
+ wb.getFormula().find('.update-btn').button('disable');
};
return math;