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 7f5f91a  [OPENMEETINGS-2581] WB contents modification is fixed
7f5f91a is described below

commit 7f5f91a1cf0c77a2a4aa359221da52fa19f6d9fc
Author: Maxim Solodovnik <[email protected]>
AuthorDate: Thu Feb 25 13:43:31 2021 +0700

    [OPENMEETINGS-2581] WB contents modification is fixed
---
 openmeetings-web/src/main/front/wb/src/wb-area.js            |  9 +++++++--
 openmeetings-web/src/main/front/wb/src/wb.js                 | 12 ++++++++----
 .../org/apache/openmeetings/web/app/WhiteboardManager.java   |  5 ++++-
 .../java/org/apache/openmeetings/web/room/wb/WbPanel.java    |  3 ++-
 4 files changed, 21 insertions(+), 8 deletions(-)

diff --git a/openmeetings-web/src/main/front/wb/src/wb-area.js 
b/openmeetings-web/src/main/front/wb/src/wb-area.js
index 6fb7e2e..4e94fec 100644
--- a/openmeetings-web/src/main/front/wb/src/wb-area.js
+++ b/openmeetings-web/src/main/front/wb/src/wb-area.js
@@ -181,7 +181,12 @@ module.exports = class DrawWbArea extends WbAreaBase {
                                .confirmation({
                                        confirmationEvent: 'bla'
                                        , onConfirm: function() {
-                                               OmUtil.wbAction({action: 
'removeWb', data: {wbId: wbId}});
+                                               const prevLi = li.prev()
+                                                       , prevWbId = 
prevLi.length > 0 ? prevLi.find('a').data('wb-id') : -1;
+                                               OmUtil.wbAction({action: 
'removeWb', data: {
+                                                       wbId: wbId
+                                                       , prevWbId: prevWbId
+                                               }});
                                        }
                                });
                }
@@ -343,7 +348,7 @@ module.exports = class DrawWbArea extends WbAreaBase {
                        }
                        _getWbTab(obj.wbId).parent().remove();
                        _getWbContent(obj.wbId).remove();
-                       _actionActivateWb(_getActive().data().id);
+                       _actionActivateWb(obj.prevWbId);
                };
                this.load = (json) => {
                        if (!_inited) {
diff --git a/openmeetings-web/src/main/front/wb/src/wb.js 
b/openmeetings-web/src/main/front/wb/src/wb.js
index b065bd4..8d6a3cf 100644
--- a/openmeetings-web/src/main/front/wb/src/wb.js
+++ b/openmeetings-web/src/main/front/wb/src/wb.js
@@ -147,6 +147,12 @@ module.exports = class Wb {
                        if (role === Role.NONE && o.omType !== 'pointer') {
                                return;
                        }
+                       function modifiedAction(items) {
+                               OmUtil.wbAction({action: 'modifyObj', data: {
+                                       wbId: self.id
+                                       , obj: items
+                               }});
+                       }
                        o.includeDefaultValues = false;
                        if ('activeSelection' === o.type) {
                                o.clone(function(_o) {
@@ -156,14 +162,12 @@ module.exports = class Wb {
                                        for (let i = 0; i < _items.length; ++i) 
{
                                                
items.push(self._toOmJson(_items[i]));
                                        }
+                                       modifiedAction(items);
                                }, extraProps);
                        } else {
                                items.push(self._toOmJson(o));
+                               modifiedAction(items);
                        }
-                       OmUtil.wbAction({action: 'modifyObj', data: {
-                               wbId: self.id
-                               , obj: items
-                       }});
                }
                function objSelectedHandler(e) {
                        tools.updateCoordinates(e.target);
diff --git 
a/openmeetings-web/src/main/java/org/apache/openmeetings/web/app/WhiteboardManager.java
 
b/openmeetings-web/src/main/java/org/apache/openmeetings/web/app/WhiteboardManager.java
index 9ab90cd..8af5a6b 100644
--- 
a/openmeetings-web/src/main/java/org/apache/openmeetings/web/app/WhiteboardManager.java
+++ 
b/openmeetings-web/src/main/java/org/apache/openmeetings/web/app/WhiteboardManager.java
@@ -242,9 +242,12 @@ public class WhiteboardManager implements 
IWhiteboardManager {
                }
        }
 
-       public Whiteboard remove(long roomId, Long wbId) {
+       public Whiteboard remove(long roomId, long wbId, long prevWbId) {
                Whiteboards wbs = get(roomId);
                Whiteboard wb = wbs.getWhiteboards().remove(wbId);
+               if (prevWbId > -1) {
+                       wbs.setActiveWb(prevWbId);
+               }
                update(wbs);
                return wb;
        }
diff --git 
a/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/wb/WbPanel.java
 
b/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/wb/WbPanel.java
index 80b165b..2f3bf22 100644
--- 
a/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/wb/WbPanel.java
+++ 
b/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/wb/WbPanel.java
@@ -256,7 +256,8 @@ public class WbPanel extends AbstractWbPanel {
                                {
                                        long id = obj.optLong("wbId", -1);
                                        if (id > -1) {
-                                               wbm.remove(roomId, id);
+                                               long prevId = 
obj.optLong("prevWbId", -1);
+                                               wbm.remove(roomId, id, prevId);
                                                sendWbAll(WbAction.removeWb, 
obj);
                                        }
                                }

Reply via email to