annotation: remove obsolete mobile wizard popup code

it was introduced in 13bc532
and it was removed from use in 2f77b3a

Signed-off-by: Pranam Lashkari <lpranam@collabora.com>
Change-Id: Iec401a9505491fe69196cdb1e7192fa499d3d38f
pull/8442/head
Pranam Lashkari 2024-03-02 16:41:24 +05:30 committed by Szymon Kłos
parent 2e8561195c
commit bfe0c5e7de
5 changed files with 4 additions and 398 deletions

View File

@ -354,7 +354,6 @@ COOL_JS_LST =\
src/control/Control.MobileWizardBuilder.js \
src/control/Control.MobileWizardWindow.js \
src/control/Control.MobileWizard.js \
src/control/Control.MobileWizardPopup.js \
src/control/Control.LanguageDialog.js \
src/control/Control.Attribution.js \
src/control/Control.MobileSlide.js \
@ -750,7 +749,6 @@ pot:
src/control/Control.MobileWizardBuilder.js \
src/control/Control.MobileWizardWindow.js \
src/control/Control.MobileWizard.js \
src/control/Control.MobileWizardPopup.js \
src/control/Control.Notebookbar.js \
src/control/Control.NotebookbarBuilder.js \
src/control/Control.NotebookbarCalc.js \

View File

@ -518,24 +518,6 @@ nav.spreadsheet-color-indicator ~ #sidebar-dock-wrapper {
max-height: initial !important;
}
.cool-annotation:not(annotation-active) .cool-annotation-collapsed{
position: absolute;
left: 24px;
}
.cool-annotation.annotation-active:not(.rtl) .cool-annotation-collapsed{
position: absolute;
left: 0 !important;
}
.cool-annotation.annotation-active.rtl .cool-annotation-collapsed{
position: absolute;
left: 48px !important;
}
#document-container > .cool-annotation:hover .cool-annotation-collapsed{
box-shadow: 0 0 3px 0 rgb(0 0 0 / 50%), 0 0 10px 4px rgb(0 0 0 / 10%);
cursor: pointer;
}
.cool-annotation-content-wrapper, .cool-annotation-redline-content-wrapper {
padding: 8px;
font-family: var(--cool-font) !important;
@ -556,8 +538,7 @@ nav.spreadsheet-color-indicator ~ #sidebar-dock-wrapper {
}
.annotation-active.modify-annotation-container .cool-annotation-content-wrapper,
.annotation-active.reply-annotation-container .cool-annotation-content-wrapper,
.cool-annotation-collapsed.modalpopup {
.annotation-active.reply-annotation-container .cool-annotation-content-wrapper {
width: auto;
}
@ -591,56 +572,10 @@ nav.spreadsheet-color-indicator ~ #sidebar-dock-wrapper {
z-index: 0;
}
.cool-annotation-collapsed {
background: var(--color-background-lighter);
border-radius: 50%;
width: 36px;
height: 36px;
box-shadow: 0 0 3px 5px var(--color-background-lighter), 0 0 1px 5px var(--color-box-shadow);
}
.annotation-active .cool-annotation-collapsed {
box-shadow: 0 0 3px 5px var(--color-background-lighter), 0 0 1px 5px var(--color-box-shadow);
}
.jsdialog-container.cool-annotation-collapsed.modalpopup {
border-radius: 8px !important;
border: 1px solid var(--color-border) !important;
background: var(--color-background-lighter) !important;
}
#mobile-wizard-popup {
background-color: var(--color-background-lighter) !important;
}
.jsdialog-container.cool-annotation-collapsed.modalpopup .lokdialog.ui-dialog-content {
background-color: transparent !important;
}
.jsdialog-container.cool-annotation-collapsed.modalpopup .cool-annotation {
margin-bottom: 16px;
}
.jsdialog-container.cool-annotation-collapsed.modalpopup .cool-annotation:last-of-type {
margin-bottom: 8px;
}
.jsdialog-container.cool-annotation-collapsed.modalpopup .cool-annotation:first-of-type {
margin-top: 8px;
}
.jsdialog-container.cool-annotation-collapsed.modalpopup .cool-annotation-content-wrapper {
box-shadow: none;
border-width: 0px 0px 1px !important;
border-bottom: 1px solid var(--color-border) !important;
border-radius: 0 !important;
background: var(--color-background-lighter);
}
.jsdialog-container.cool-annotation-collapsed.modalpopup [id^='comment-container-']:last-child > .cool-annotation-content-wrapper{
border-width: 0 !important;
}
.cool-dont-break {
/* These are technically the same, but use both */
@ -801,12 +736,6 @@ nav.spreadsheet-color-indicator ~ #sidebar-dock-wrapper {
transition: all 0.1s ease 0.5s;
visibility: visible;
}
.cool-annotation-collapsed [data-title]:hover:after {
position: static;
float: right;
margin-top: 22px;
margin-right: 8px;
}
[data-title]:after {
content: attr(data-title);
font-size: 1em !important;

View File

@ -1,317 +0,0 @@
/* -*- js-indent-level: 8 -*- */
/*
* Copyright the Collabora Online contributors.
*
* SPDX-License-Identifier: MPL-2.0
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
/*
* L.Control.MobileWizardPopup - shows a popup with content styled like in mobile-wizard.
* it will be used to show touch-device friendly UI in popups
* on devices with smaller screens which are not smartphones
* (desktop and tablets). Example of usage: show comments preview
* when browser has reduced size.
*/
/* global app $ */
L.Control.MobileWizardPopup = L.Control.extend({
_builder: null,
_overlay: null,
_inMainMenu: true,
_isActive: false,
_inBuilding: false,
_currentDepth: 0,
_mainTitle: '',
_customTitle: false,
_isTabMode: false,
_currentPath: [],
_tabs: [],
_currentScrollPosition: 0,
_RTL: false,
initialize: function (options) {
L.setOptions(this, options);
},
onAdd: function (map) {
this.map = map;
map.on('mobilewizardpopup', this._onMobileWizardPopup, this);
map.on('mobilewizardpopupresize', this._onResizeRequest, this);
map.on('mobilewizardpopupclose', this._hideWizard, this);
window.addEventListener('resize', this._hideWizard.bind(this));
this._RTL = document.documentElement.dir === 'rtl';
},
removeContainer: function () {
L.DomUtil.remove(this._overlay);
L.DomUtil.remove(this._container);
},
onRemove: function() {
this.removeContainer();
this.map.off('mobilewizardpopup', this._onMobileWizardPopup, this);
this.map.off('mobilewizardpopupresize', this._onResizeRequest, this);
this.map.off('mobilewizardpopupclose', this._hideWizard, this);
window.removeEventListener('resize', this._hideWizard.bind(this));
},
_hideWizard: function () {
this.removeContainer();
if (app.sectionContainer && app.sectionContainer.doesSectionExist(L.CSections.CommentList.name)) {
app.sectionContainer.getSectionWithName(L.CSections.CommentList.name).removeHighlighters();
app.sectionContainer.getSectionWithName(L.CSections.CommentList.name).layout();
}
},
_setTitle: function(title) {
this.title.innerText = title;
},
_setCustomTitle: function(title) {
this.title.innerHTML = title;
},
// TODO: make code shared with Control.MobileWizardWindow
/* jscpd:ignore-start */
goLevelDown: function(contentToShow, options) {
var animate = (options && options.animate != undefined) ? options.animate : true;
if (!this._isTabMode || this._currentDepth > 0)
L.DomUtil.removeClass(this.backButton, 'close-button');
if (this._isTabMode && this._currentDepth > 0) {
this.titlebar.show();
}
var nodesToHide = $(contentToShow).siblings().not('.mobile-wizard-scroll-indicator');
var parent = $(contentToShow).parent();
if (parent.hasClass('toolbox'))
nodesToHide = nodesToHide.add(parent.siblings().not('.mobile-wizard-scroll-indicator'));
var duration = 10;
if (animate) {
nodesToHide.hide('slide', { direction: 'left' }, duration);
// be sure all is hidden, sometimes jQuery doesn't work here ...
// restoreStyle is called in some jQuery cleanup what causes showing nodes again
setTimeout(function() { nodesToHide.hide(); }, duration + 5);
}
else
nodesToHide.hide();
$(contentToShow).children('.ui-header').hide();
if (animate)
$(contentToShow).children('.ui-content').first().show('slide', { direction: 'right' }, 'fast');
else
$(contentToShow).children('.ui-content').first().show();
this._currentDepth++;
if (!this._inBuilding)
history.pushState({context: 'mobile-wizard', level: this._currentDepth}, 'mobile-wizard-level-' + this._currentDepth);
var title = $(contentToShow).children('.ui-content').get(0).title;
if (this._customTitle)
this._setCustomTitle(this._customTitle);
else
this._setTitle(title);
this._inMainMenu = false;
this._currentPath.push(title);
},
goLevelUp: function() {
this._currentPath.pop();
if (this._inMainMenu || (this._isTabMode && this._currentDepth == 1)) {
this._hideWizard();
this._currentDepth = 0;
} else {
this._currentDepth--;
var parent = $('.ui-content.mobile-wizard:visible');
if (this._currentDepth > 0 && parent)
this._customTitle ? this._setCustomTitle(parent.get(0).customTitleBar) : this._setTitle(parent.get(0).title);
else
this._customTitle ? this._setCustomTitle(this._customTitle) : this._setTitle(this._mainTitle);
var currentNode = $('.ui-explorable-entry.level-' + this._currentDepth + '.mobile-wizard:visible');
var headers = currentNode.siblings();
var currentHeader = currentNode.children('.ui-header');
headers = headers.add(currentHeader);
var parent = currentNode.parent();
if (parent.hasClass('toolbox'))
headers = headers.add(parent.siblings());
headers = headers.not('.hidden');
$('.ui-content.level-' + this._currentDepth + '.mobile-wizard:visible').hide();
headers.show('slide', { direction: 'left' }, 'fast');
if (this._currentDepth == 0 || (this._isTabMode && this._currentDepth == 1)) {
this._inMainMenu = true;
L.DomUtil.addClass(this.backButton, 'close-button');
if (this._isTabMode) {
this.titlebar.hide();
}
}
app.sectionContainer.getSectionWithName(L.CSections.CommentList.name).removeHighlighters();
}
},
/* jscpd:ignore-end */
/// used for comments, when we extend popup's content
_onResizeRequest: function() {
var that = this;
setTimeout(function () {
if (!that._container || !that._popupParent)
return;
var bottomY = that._container.getBoundingClientRect().bottom;
if (bottomY > that.map._container.getBoundingClientRect().bottom) {
var diff = bottomY - that.map._container.getBoundingClientRect().bottom + 40;
var posX = that._popupParent.getBoundingClientRect().left;
if (that._RTL)
posX -= that.map._container.getBoundingClientRect().width;
(new L.PosAnimation()).run(that._popupParent,
{
x: posX,
y: that._popupParent.getBoundingClientRect().top - diff
});
}
that._container.style.marginLeft = (that._RTL ? 15 : (15 - that._container.clientWidth)) + 'px';
}, 100);
},
_onMobileWizardPopup: function(data) {
this.removeContainer();
var callback = data.callback;
data = data.data;
if (data) {
var that = this;
this._hideWizard();
this._currentDepth = 0;
this._inMainMenu = true;
this._isTabMode = false;
this._currentPath = [];
this._tabs = [];
var parent = null;
if (data.popupParent) {
parent = L.DomUtil.get(data.popupParent);
this._popupParent = parent;
}
if (!parent)
parent = document.body;
var isCommentWizard = data.children && data.children.length && data.children[0].type == 'comment';
this._container = L.DomUtil.create('div', 'jsdialog-container ui-dialog ui-widget-content lokdialog_container cool-annotation-collapsed', parent);
this._container.id = 'mobile-wizard-popup';
this._container.style.visibility = 'hidden';
if (data.collapsed && (data.collapsed === 'true' || data.collapsed === true))
L.DomUtil.addClass(this._container, 'collapsed');
L.DomUtil.addClass(this._container, 'modalpopup');
this.titlebar = L.DomUtil.create('table', 'mobile-wizard-titlebar', this._container);
this.titlebar.style.width = '100%';
this.titlebar.style.top = '0px';
var tr = L.DomUtil.create('tr', 'mobile-wizard-titlebar', this.titlebar);
this.backButton = L.DomUtil.create('td', 'mobile-wizard-back', tr);
L.DomUtil.addClass(this.backButton, 'close-button');
this.backButton.onclick = function() { that.goLevelUp(); };
this.title = L.DomUtil.create('td', 'mobile-wizard-title ui-widget', tr);
var content = L.DomUtil.create('div', 'lokdialog ui-dialog-content', this._container);
this.content = content;
this.content.style.maxHeight = (that.map._container.getBoundingClientRect().height - 50) + 'px';
var builder = new L.control.jsDialogBuilder({windowId: data.id, mobileWizard: this, map: this.map, cssClass: 'jsdialog'});
var overlayParent = document.body;
if (isCommentWizard)
overlayParent = that.map._container;
this._overlay = L.DomUtil.create('div', builder.options.cssClass + ' jsdialog-overlay cancellable', overlayParent);
this._overlay.onclick = function () { that._hideWizard(); };
this._builder = L.control.mobileWizardBuilder({windowId: data.id, mobileWizard: this, map: this.map, cssClass: 'mobile-wizard', callback: callback});
this._builder.build(content, [data]);
if (!this.content.querySelector('.ui-explorable-entry'))
this.titlebar.style.display = 'none';
var posX = 0;
var posY = 0;
var setupPosition = function () {
if (data.popupParent && parent != document.body) {
// TODO: handle general case
if (isCommentWizard) {
that._container.style.zIndex = -1;
that._overlay.style.zIndex = 10;
posY = 15;
posX = that._RTL ? 15 : 15 - content.clientWidth;
// be sure it is fully visible
var absolutePosY = parent.getBoundingClientRect().top + posY;
var diffY = 0;
if (absolutePosY + content.clientHeight > window.innerHeight)
diffY = absolutePosY + content.clientHeight - that.map._container.getBoundingClientRect().bottom + 20;
if (diffY) {
var tmpPosX = parent.getBoundingClientRect().left;
if (that._RTL)
tmpPosX -= that.map._container.getBoundingClientRect().width;
(new L.PosAnimation()).run(parent,
{
x: tmpPosX,
y: absolutePosY - diffY - that.map._container.getBoundingClientRect().top
});
}
}
} else if (this._container) {
posX = window.innerWidth/2 - this._container.offsetWidth/2;
posY = window.innerHeight/2 - this._container.offsetHeight/2;
} else {
console.error('no _container objet in mobile wizard popup');
}
};
setupPosition();
this._container.style.marginLeft = posX + 'px';
this._container.style.marginTop = posY + 'px';
setTimeout(function () {
setupPosition();
that._container.style.marginLeft = posX + 'px';
that._container.style.marginTop = posY + 'px';
that._container.style.visibility = '';
}, 200);
}
},
});
L.control.mobileWizardPopup = function (options) {
return new L.Control.MobileWizardPopup(options);
};

View File

@ -217,8 +217,6 @@ L.Control.UIManager = L.Control.extend({
this.map.sidebar = L.control.sidebar({animSpeed: 200});
this.map.addControl(this.map.sidebar);
this.map.addControl(L.control.mobileWizardPopup());
this.map.addControl(L.control.mention());
}

View File

@ -68,15 +68,13 @@ describe(['tagscreenshot'], 'Help dialog screenshot updation', function() {
copyScreenshot('repair-document.png');
});
it.skip('Comment', function() {
it('Comment', function() {
hideSidebar();
cy.cGet('#toolbar-up > .w2ui-scroll-right').click();
cy.cGet('#tb_editbar_item_insertannotation').click();
cy.cGet('#input-modal-input').type('comment added');
cy.cGet('.vex-dialog-buttons .button-primary').click(); // save button
cy.wait(1000);
cy.cGet('.jsdialog-container.cool-annotation-collapsed').click();
cy.cGet('#annotation-modify-textarea-new').type('comment added');
cy.cGet('#annotation-save-new').click(); // save button
cy.wait(1000);
cy.cGet('.cool-annotation-content-wrapper').should('exist');
cy.cGet('#comment .cool-annotation').screenshot('comment');