From b95395434eae5ace490267ae32ac826eeefaad25 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= Date: Wed, 17 Apr 2024 21:38:05 +0100 Subject: [PATCH] if a sheet is removed or moved, re-request comment positions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit a problem since: commit 72b2ce4bb649aeb36182303783f064b0b5d5e35a Author: Caolán McNamara Date: Wed Oct 25 19:19:08 2023 +0100 we don't need to round-trip through core to reposition notes Signed-off-by: Caolán McNamara Change-Id: If00ae17a8e80ca3f8d2a530efa6cdba90207be56 --- browser/src/layer/tile/CalcTileLayer.js | 5 +++++ .../desktop/calc/annotation_spec.js | 19 +++++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/browser/src/layer/tile/CalcTileLayer.js b/browser/src/layer/tile/CalcTileLayer.js index 1acddd9e5..b9b04b304 100644 --- a/browser/src/layer/tile/CalcTileLayer.js +++ b/browser/src/layer/tile/CalcTileLayer.js @@ -440,7 +440,12 @@ L.CalcTileLayer = L.CanvasTileLayer.extend({ this._documentInfo = textMsg; var partNames = textMsg.match(/[^\r\n]+/g); // only get the last matches + var oldPartNames = this._partNames; this._partNames = partNames.slice(partNames.length - this._parts); + // if the number of parts, or order has changed then refresh comment positions + if (oldPartNames !== this._partNames) { + app.socket.sendMessage('commandvalues command=.uno:ViewAnnotationsPosition'); + } this._map.fire('updateparts', { selectedPart: this._selectedPart, parts: this._parts, diff --git a/cypress_test/integration_tests/desktop/calc/annotation_spec.js b/cypress_test/integration_tests/desktop/calc/annotation_spec.js index 1944ceabf..38a3e189f 100644 --- a/cypress_test/integration_tests/desktop/calc/annotation_spec.js +++ b/cypress_test/integration_tests/desktop/calc/annotation_spec.js @@ -2,6 +2,7 @@ var helper = require('../../common/helper'); var desktopHelper = require('../../common/desktop_helper'); +var calcHelper = require('../../common/calc_helper'); describe(['tagdesktop'], 'Annotation Tests', function() { var origTestFileName = 'annotation.ods'; @@ -82,6 +83,24 @@ describe(['tagdesktop'], 'Annotation Tests', function() { cy.cGet('body').contains('.context-menu-item','Remove').click(); cy.cGet('#comment-container-1').should('not.exist'); }); + + it('Delete then Create Sheet should not retain comment',function() { + calcHelper.assertNumberofSheets(1); + + cy.cGet('#spreadsheet-toolbar #insertsheet').click(); + calcHelper.assertNumberofSheets(2); + + desktopHelper.insertComment(); + cy.cGet('.cool-annotation').should('exist'); + + calcHelper.selectOptionFromContextMenu('Delete Sheet...'); + cy.cGet('#delete-sheet-modal-response').click(); + calcHelper.assertNumberofSheets(1); + + cy.cGet('#spreadsheet-toolbar #insertsheet').click(); + calcHelper.assertNumberofSheets(2); + cy.cGet('#comment-container-1').should('not.exist'); + }); }); describe(['tagdesktop'], 'Annotation Autosave Tests', function() {