[Libreoffice-commits] online.git: loleaflet/archived-packages loleaflet/css loleaflet/Makefile.am loleaflet/package.json loleaflet/src
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Fri May 3 10:17:36 UTC 2019
loleaflet/Makefile.am | 9
loleaflet/archived-packages/bluebird-3.5.4-d6cc66159.tar |binary
loleaflet/archived-packages/classlist-polyfill-1.2.0-935bc2dfd.tar |binary
loleaflet/archived-packages/deep-clone-simple-1.1.1-0ec358dfc.tar |binary
loleaflet/archived-packages/domify-1.4.0-11483617f.tar |binary
loleaflet/archived-packages/es6-object-assign-1.1.0-c2c358265.tar |binary
loleaflet/archived-packages/form-serialize-0.7.1-48f74e37d.tar |binary
loleaflet/archived-packages/spdx-license-ids-3.0.4-75ecd1a88.tar |binary
loleaflet/archived-packages/vex-dialog-1.1.0-8a2b57b70.tar |binary
loleaflet/archived-packages/vex-js-4.1.0-88c996c7a.tar |binary
loleaflet/css/loleaflet.css | 13 +
loleaflet/package.json | 2
loleaflet/src/control/Control.AlertDialog.js | 13 -
loleaflet/src/control/Signing.js | 15 -
loleaflet/src/control/Toolbar.js | 32 +--
loleaflet/src/core/Socket.js | 91 ++--------
loleaflet/src/map/Map.js | 68 +++----
17 files changed, 99 insertions(+), 144 deletions(-)
New commits:
commit ef1669b389246f2fd58ac21c144f18539f1ed52d
Author: Alexandru Vlăduţu <alexandru.vladutu at 1and1.ro>
AuthorDate: Fri May 3 12:41:39 2019 +0300
Commit: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
CommitDate: Fri May 3 12:17:02 2019 +0200
loleaflet: update vex.js library
Change-Id: I6b32c6a60a27aa27eb32784bb73e40c979f67def
Reviewed-on: https://gerrit.libreoffice.org/71726
Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
Tested-by: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
diff --git a/loleaflet/Makefile.am b/loleaflet/Makefile.am
index 9d46d96a7..0cb26b4a0 100644
--- a/loleaflet/Makefile.am
+++ b/loleaflet/Makefile.am
@@ -74,9 +74,9 @@ LOLEAFLET_CSS =\
$(srcdir)/css/editor.css \
$(srcdir)/css/jquery.mCustomScrollbar.css \
$(builddir)/node_modules/jquery-contextmenu/dist/jquery.contextMenu.css \
- $(builddir)/node_modules/vex-js/css/vex.css \
- $(builddir)/node_modules/vex-js/css/vex-theme-plain.css \
- $(builddir)/node_modules/vex-js/css/vex-theme-bottom-right-corner.css \
+ $(builddir)/node_modules/vex-js/dist/css/vex.css \
+ $(builddir)/node_modules/vex-js/dist/css/vex-theme-plain.css \
+ $(builddir)/node_modules/vex-js/dist/css/vex-theme-bottom-right-corner.css \
$(builddir)/node_modules/smartmenus/dist/css/sm-core-css.css \
$(builddir)/node_modules/smartmenus/dist/css/sm-simple/sm-simple.css \
$(srcdir)/css/menubar.css \
@@ -96,8 +96,7 @@ NODE_MODULES_JS =\
node_modules/autolinker/dist/Autolinker.js \
node_modules/json-js/json2.js \
node_modules/select2/dist/js/select2.js \
- node_modules/vex-js/js/vex.js \
- node_modules/vex-js/js/vex.dialog.js \
+ node_modules/vex-js/dist/js/vex.combined.js \
node_modules/@braintree/sanitize-url/dist.js
LOLEAFLET_LIBS_JS =\
diff --git a/loleaflet/archived-packages/bluebird-3.5.3-7d01c6f96.tar b/loleaflet/archived-packages/bluebird-3.5.4-d6cc66159.tar
similarity index 98%
rename from loleaflet/archived-packages/bluebird-3.5.3-7d01c6f96.tar
rename to loleaflet/archived-packages/bluebird-3.5.4-d6cc66159.tar
index db26d55a5..b9fdaf3d0 100644
Binary files a/loleaflet/archived-packages/bluebird-3.5.3-7d01c6f96.tar and b/loleaflet/archived-packages/bluebird-3.5.4-d6cc66159.tar differ
diff --git a/loleaflet/archived-packages/classlist-polyfill-1.2.0-935bc2dfd.tar b/loleaflet/archived-packages/classlist-polyfill-1.2.0-935bc2dfd.tar
new file mode 100644
index 000000000..90ff124c8
Binary files /dev/null and b/loleaflet/archived-packages/classlist-polyfill-1.2.0-935bc2dfd.tar differ
diff --git a/loleaflet/archived-packages/deep-clone-simple-1.1.1-0ec358dfc.tar b/loleaflet/archived-packages/deep-clone-simple-1.1.1-0ec358dfc.tar
new file mode 100644
index 000000000..f1f200283
Binary files /dev/null and b/loleaflet/archived-packages/deep-clone-simple-1.1.1-0ec358dfc.tar differ
diff --git a/loleaflet/archived-packages/domify-1.4.0-11483617f.tar b/loleaflet/archived-packages/domify-1.4.0-11483617f.tar
new file mode 100644
index 000000000..b760f7cac
Binary files /dev/null and b/loleaflet/archived-packages/domify-1.4.0-11483617f.tar differ
diff --git a/loleaflet/archived-packages/es6-object-assign-1.1.0-c2c358265.tar b/loleaflet/archived-packages/es6-object-assign-1.1.0-c2c358265.tar
new file mode 100644
index 000000000..be5e4d374
Binary files /dev/null and b/loleaflet/archived-packages/es6-object-assign-1.1.0-c2c358265.tar differ
diff --git a/loleaflet/archived-packages/form-serialize-0.7.1-48f74e37d.tar b/loleaflet/archived-packages/form-serialize-0.7.1-48f74e37d.tar
new file mode 100644
index 000000000..85403a30d
Binary files /dev/null and b/loleaflet/archived-packages/form-serialize-0.7.1-48f74e37d.tar differ
diff --git a/loleaflet/archived-packages/spdx-license-ids-3.0.3-81c0ce8f2.tar b/loleaflet/archived-packages/spdx-license-ids-3.0.4-75ecd1a88.tar
similarity index 86%
rename from loleaflet/archived-packages/spdx-license-ids-3.0.3-81c0ce8f2.tar
rename to loleaflet/archived-packages/spdx-license-ids-3.0.4-75ecd1a88.tar
index 54f10abfb..cbe4b48ff 100644
Binary files a/loleaflet/archived-packages/spdx-license-ids-3.0.3-81c0ce8f2.tar and b/loleaflet/archived-packages/spdx-license-ids-3.0.4-75ecd1a88.tar differ
diff --git a/loleaflet/archived-packages/vex-dialog-1.1.0-8a2b57b70.tar b/loleaflet/archived-packages/vex-dialog-1.1.0-8a2b57b70.tar
new file mode 100644
index 000000000..baecccc11
Binary files /dev/null and b/loleaflet/archived-packages/vex-dialog-1.1.0-8a2b57b70.tar differ
diff --git a/loleaflet/archived-packages/vex-js-2.3.2-d352329a1.tar b/loleaflet/archived-packages/vex-js-4.1.0-88c996c7a.tar
similarity index 91%
rename from loleaflet/archived-packages/vex-js-2.3.2-d352329a1.tar
rename to loleaflet/archived-packages/vex-js-4.1.0-88c996c7a.tar
index be6ee6a32..f3b499dbf 100644
Binary files a/loleaflet/archived-packages/vex-js-2.3.2-d352329a1.tar and b/loleaflet/archived-packages/vex-js-4.1.0-88c996c7a.tar differ
diff --git a/loleaflet/css/loleaflet.css b/loleaflet/css/loleaflet.css
index fbc9bddc7..79b620422 100644
--- a/loleaflet/css/loleaflet.css
+++ b/loleaflet/css/loleaflet.css
@@ -482,3 +482,16 @@ body {
bottom: 40px !important;
right: 10px !important;
}
+/* Vex dialogs */
+.vex-open .vex-overlay {
+ z-index: 1001; /* required to be displayed over the document */
+}
+.vex-open .vex-idle { /* dialog shown when user is idle */
+ background: rgba(0, 0, 0, 0)!important;
+ font-size: xx-large!important;
+ color: #fff!important;
+ text-align: center!important;
+}
+.vex-open .vex-idle .vex-dialog-buttons {
+ display: none!important;
+}
diff --git a/loleaflet/package.json b/loleaflet/package.json
index d7baa176b..420c8bd8f 100644
--- a/loleaflet/package.json
+++ b/loleaflet/package.json
@@ -25,7 +25,7 @@
"uglify-js": "2.4.24",
"uglifycss": "0.0.27",
"uglifyify": "3.0.2",
- "vex-js": "2.3.2"
+ "vex-js": "4.1.0"
},
"repository": {
"type": "git",
diff --git a/loleaflet/src/control/Control.AlertDialog.js b/loleaflet/src/control/Control.AlertDialog.js
index 336c14dd7..5e1a77fe0 100644
--- a/loleaflet/src/control/Control.AlertDialog.js
+++ b/loleaflet/src/control/Control.AlertDialog.js
@@ -12,10 +12,10 @@ L.Control.AlertDialog = L.Control.extend({
},
_onError: function(e) {
- if (vex.dialogID > 0 && !this._map._fatal) {
+ if (!this._map._fatal) {
// TODO. queue message errors and pop-up dialogs
// Close other dialogs before presenting a new one.
- vex.close(vex.dialogID);
+ vex.closeAll();
}
if (e.msg) {
@@ -44,8 +44,7 @@ L.Control.AlertDialog = L.Control.extend({
className: 'vex-dialog-button-primary',
click: function openClick () {
window.open(url, '_blank');
- vex.close(vex.dialogID);
- vex.dialogID = 0;
+ vex.closeAll();
}
});
}
@@ -56,8 +55,7 @@ L.Control.AlertDialog = L.Control.extend({
className: 'vex-dialog-button-secondary',
click: function editClick () {
e.map.toggleCommandState('HyperlinkDialog');
- vex.close(vex.dialogID);
- vex.dialogID = 0;
+ vex.closeAll();
}
});
@@ -77,9 +75,6 @@ L.Control.AlertDialog = L.Control.extend({
msg = msg.replace('%1', e.cmd);
vex.dialog.alert(msg);
}
-
- // Remember the current dialog ID to close it later.
- vex.dialogID = vex.globalID - 1;
}
});
diff --git a/loleaflet/src/control/Signing.js b/loleaflet/src/control/Signing.js
index da60783ea..4cb539bd1 100644
--- a/loleaflet/src/control/Signing.js
+++ b/loleaflet/src/control/Signing.js
@@ -229,7 +229,8 @@ function verignNewIdentity(newIdentity) {
escapeButtonCloses: true,
overlayClosesOnClick: true,
buttons: {},
- afterOpen: function($vexContent) {
+ afterOpen: function() {
+ var $vexContent = $(this.contentEl);
var container = $vexContent.find('#image-container');
var image = $('<img style="display: block; margin-left: auto; margin-right: auto"/>');
image.attr('src', result.data.image);
@@ -479,9 +480,11 @@ L.Map.include({
showCloseButton: true,
escapeButtonCloses: true,
overlayClosesOnClick: true,
- contentCSS: { width: w + 'px' },
buttons: {},
- afterOpen: function($vexContent) {
+ afterOpen: function() {
+ var that = this;
+ this.contentEl.style.width = w + 'px';
+ var $vexContent = $(this.contentEl);
$('#select-identity').text(_('Select identity:'));
$('#login-qr').text(_('Login from mobile'));
$('#recover-from-email').text(_('Recover from email'));
@@ -494,18 +497,18 @@ L.Map.include({
button.css('background-color', identities[key].identityColor);
button.click({ key: key }, function(current) {
selectedIdentityKey = current.data.key;
- vex.close($vexContent.data().vex.id);
+ that.close();
});
identitiesDiv.append(button);
}
});
$('#login-qr').click(function() {
loginWithQR = true;
- vex.close($vexContent.data().vex.id);
+ that.close();
});
$('#recover-from-email').click(function() {
recoverFromEmail = true;
- vex.close($vexContent.data().vex.id);
+ that.close();
});
},
afterClose: function () {
diff --git a/loleaflet/src/control/Toolbar.js b/loleaflet/src/control/Toolbar.js
index b33e2433d..3258e8b10 100644
--- a/loleaflet/src/control/Toolbar.js
+++ b/loleaflet/src/control/Toolbar.js
@@ -198,13 +198,15 @@ L.Map.include({
var map = this;
$.get('loleaflet-help.html', function(data) {
vex.open({
- content: data,
+ unsafeContent: data,
showCloseButton: true,
escapeButtonCloses: true,
overlayClosesOnClick: true,
- contentCSS: {width: w + 'px'},
buttons: {},
- afterOpen: function($vexContent) {
+ afterOpen: function() {
+ var that = this;
+ var $vexContent = $(this.contentEl);
+ this.contentEl.style.width = w + 'px'
map.enable(false);
// Display help according to document opened
if (map.getDocType() === 'text') {
@@ -236,14 +238,12 @@ L.Map.include({
translatableContent[i].firstChild.nodeValue = translatableContent[i].firstChild.nodeValue.toLocaleString();
}
- $('.vex-content').attr('tabindex', -1);
- $('.vex-content').focus();
+ $vexContent.attr('tabindex', -1);
+ $vexContent.focus();
// workaround for https://github.com/HubSpot/vex/issues/43
$('.vex-overlay').css({ 'pointer-events': 'none'});
- $('.vex').click(function() {
- vex.close($vexContent.data().vex.id);
- });
- $('.vex-content').click(function(e) {
+ $vexContent.one('click', function(e) {
+ that.close();
e.stopPropagation();
});
},
@@ -290,21 +290,21 @@ L.Map.include({
}
};
vex.open({
- content: content,
+ unsafeContent: content[0].outerHTML,
showCloseButton: true,
escapeButtonCloses: true,
overlayClosesOnClick: true,
- contentCSS: { width: w + 'px'},
buttons: {},
- afterOpen: function($vexContent) {
+ afterOpen: function() {
+ var that = this;
+ this.contentEl.style.width = w + 'px';
+ var $vexContent = $(this.contentEl);
map.enable(false);
$(window).bind('keyup.vex', handler);
// workaround for https://github.com/HubSpot/vex/issues/43
$('.vex-overlay').css({ 'pointer-events': 'none'});
- $('.vex').click(function() {
- vex.close($vexContent.data().vex.id);
- });
- $('.vex-content').click(function(e) {
+ $vexContent.one('click', function(e) {
+ that.close();
e.stopPropagation();
});
},
diff --git a/loleaflet/src/core/Socket.js b/loleaflet/src/core/Socket.js
index 464a1f1df..d1a09583d 100644
--- a/loleaflet/src/core/Socket.js
+++ b/loleaflet/src/core/Socket.js
@@ -290,11 +290,7 @@ L.Socket = L.Class.extend({
var commandresult = JSON.parse(textMsg.substring(textMsg.indexOf('{')));
if (commandresult['command'] === 'savetostorage' && commandresult['success']) {
// Close any open confirmation dialogs
- if (vex.dialogID > 0) {
- var id = vex.dialogID;
- vex.dialogID = -1;
- vex.close(id);
- }
+ vex.closeAll();
}
return;
}
@@ -339,11 +335,7 @@ L.Socket = L.Class.extend({
if (socket.connected()) {
// We're connected: cancel timer and dialog.
clearTimeout(vex.timer);
- if (vex.dialogID > 0) {
- var id = vex.dialogID;
- vex.dialogID = -1;
- vex.close(id);
- }
+ vex.closeAll();
return;
}
@@ -389,53 +381,27 @@ L.Socket = L.Class.extend({
}
// Close any open dialogs first.
- if (vex.dialogID > 0) {
- id = vex.dialogID;
- vex.dialogID = -1;
- vex.close(id);
- }
+ vex.closeAll();
var message = '';
if (!this._map['wopi'].DisableInactiveMessages) {
message = msg;
}
- var options = $.extend({}, vex.defaultOptions, {
- contentCSS: {'background':'rgba(0, 0, 0, 0)',
- 'font-size': 'xx-large',
- 'color': '#fff',
- 'text-align': 'center'},
- content: message
- });
- options.id = vex.globalID;
- vex.dialogID = options.id;
- vex.globalID += 1;
- options.$vex = $('<div>').addClass(vex.baseClassNames.vex).addClass(options.className).css(options.css).data({
- vex: options
- });
- options.$vexOverlay = $('<div>').addClass(vex.baseClassNames.overlay).addClass(options.overlayClassName).css(options.overlayCSS).data({
- vex: options
- });
-
- options.$vex.append(options.$vexOverlay);
-
- options.$vexContent = $('<div>').addClass(vex.baseClassNames.content).addClass(options.contentClassName).css(options.contentCSS).text(options.content).data({
- vex: options
+ var dialogOpened = vex.dialog.open({
+ message: message,
+ contentClassName: 'vex-idle'
});
- options.$vex.append(options.$vexContent);
if (textMsg === 'idle' || textMsg === 'oom') {
var map = this._map;
- options.$vex.bind('click.vex', function() {
+ dialogOpened.contentEl.onclick = function() {
console.debug('idleness: reactivating');
map._documentIdle = false;
return map._activate();
- });
+ };
}
- $(options.appendLocation).append(options.$vex);
- vex.setupBodyClassName(options.$vex);
-
if (postMsgData['Reason']) {
// Tell WOPI host about it which should handle this situation
this._map.fire('postMessage', {msgId: 'Session_Closed', args: postMsgData});
@@ -470,37 +436,30 @@ L.Socket = L.Class.extend({
{
storageError = errorMessages.storage.documentconflict;
- // TODO: We really really need to factor this out duplicate dialog code logic everywhere
- // Close any open dialogs first.
- if (vex.dialogID > 0) {
- id = vex.dialogID;
- vex.dialogID = -1;
- vex.close(id);
- }
+ vex.closeAll();
vex.dialog.open({
message: _('Document has been changed in storage. What would you like to do with your unsaved changes?'),
escapeButtonCloses: false,
overlayClosesOnClick: false,
- contentCSS: { width: '600px' },
buttons: [
$.extend({}, vex.dialog.buttons.YES, { text: _('Discard'),
- click: function($vexContent) {
- $vexContent.data().vex.value = 'discard';
- vex.close($vexContent.data().vex.id);
+ click: function() {
+ this.value = 'discard';
+ this.close();
}}),
$.extend({}, vex.dialog.buttons.YES, { text: _('Overwrite'),
- click: function($vexContent) {
- $vexContent.data().vex.value = 'overwrite';
- vex.close($vexContent.data().vex.id);
+ click: function() {
+ this.value = 'overwrite';
+ this.close();
}}),
$.extend({}, vex.dialog.buttons.YES, { text: _('Save to new file'),
- click: function($vexContent) {
- $vexContent.data().vex.value = 'saveas';
- vex.close($vexContent.data().vex.id);
+ click: function() {
+ this.value = 'saveas';
+ this.close();
}})
],
- callback: L.bind(function(value) {
+ callback: function(value) {
if (value === 'discard') {
// They want to refresh the page and load document again for all
this.sendMessage('closedocument');
@@ -514,9 +473,11 @@ L.Socket = L.Class.extend({
this._map.saveAs(filename);
}
}
- }, this)
+ },
+ afterOpen: function() {
+ this.contentEl.style.width = '600px';
+ }
});
- vex.dialogID = vex.globalID - 1;
return;
}
@@ -690,11 +651,7 @@ L.Socket = L.Class.extend({
// We're connected: cancel timer and dialog.
this.ReconnectCount = 0;
clearTimeout(vex.timer);
- if (vex.dialogID > 0) {
- id = vex.dialogID;
- vex.dialogID = -1;
- vex.close(id);
- }
+ vex.closeAll();
}
}
else if (!textMsg.startsWith('tile:') && !textMsg.startsWith('renderfont:') && !textMsg.startsWith('windowpaint:')) {
diff --git a/loleaflet/src/map/Map.js b/loleaflet/src/map/Map.js
index 1c3e00096..3f2ee86ee 100644
--- a/loleaflet/src/map/Map.js
+++ b/loleaflet/src/map/Map.js
@@ -16,6 +16,14 @@ function moveObjectVertically(obj, diff) {
}
}
+function isAnyVexDialogActive() {
+ var res = false;
+ for (var vexId in vex.getAll()) {
+ res = res || vex.getById(vexId).isOpen;
+ }
+ return res;
+}
+
/* global closebutton vex revHistoryEnabled $ _ */
L.Map = L.Evented.extend({
@@ -99,8 +107,6 @@ L.Map = L.Evented.extend({
this._documentIdle = false;
this._helpTarget = null; // help page that fits best the current context
- vex.dialogID = -1;
-
this.callInitHooks();
if (this.options.imagePath) {
@@ -995,19 +1001,19 @@ L.Map = L.Evented.extend({
this._docLayer._requestNewTiles();
}
- if (vex.dialogID > 0) {
- var id = vex.dialogID;
-
- var options = vex.getVexByID(id).data().vex;
- if (!options.overlayClosesOnClick || !options.escapeButtonCloses)
- return false;
+ if (isAnyVexDialogActive()) {
+ for (var vexId in vex.getAll()) {
+ var opts = vex.getById(vexId).options;
+ if (!opts.overlayClosesOnClick || !opts.escapeButtonCloses) {
+ return false;
+ }
+ }
- vex.dialogID = -1;
this._startInactiveTimer();
if (!L.Browser.mobile) {
this.focus();
}
- return vex.close(id);
+ return vex.closeAll();
}
} else {
this.loadDocument();
@@ -1040,36 +1046,18 @@ L.Map = L.Evented.extend({
message = _('Inactive document - please click to resume editing');
}
- var options = $.extend({}, vex.defaultOptions, {
- contentCSS: {'background':'rgba(0, 0, 0, 0)',
- 'font-size': 'xx-large',
- 'color': '#fff',
- 'text-align': 'center'},
- content: message
- });
- options.id = vex.globalID;
- vex.dialogID = options.id;
- vex.globalID += 1;
- options.$vex = $('<div>').addClass(vex.baseClassNames.vex).addClass(options.className).css(options.css).data({
- vex: options
+ vex.open({
+ content: message,
+ contentClassName: 'vex-idle',
+ afterOpen: function() {
+ var $vexContent = $(this.contentEl);
+ $vexContent.bind('click.vex', function() {
+ console.debug('_dim: click.vex function');
+ return map._activate();
+ });
+ },
+ showCloseButton: false
});
- options.$vexOverlay = $('<div>').addClass(vex.baseClassNames.overlay).addClass(options.overlayClassName).css(options.overlayCSS).data({
- vex: options
- });
-
- options.$vex.bind('click.vex', function() {
- console.debug('_dim: click.vex function');
- return map._activate();
- });
- options.$vex.append(options.$vexOverlay);
-
- options.$vexContent = $('<div>').addClass(vex.baseClassNames.content).addClass(options.contentClassName).css(options.contentCSS).text(options.content).data({
- vex: options
- });
- options.$vex.append(options.$vexContent);
-
- $(options.appendLocation).append(options.$vex);
- vex.setupBodyClassName(options.$vex);
this._doclayer && this._docLayer._onMessage('textselection:', null);
console.debug('_dim: sending userinactive');
@@ -1108,7 +1096,7 @@ L.Map = L.Evented.extend({
console.debug('_deactivate:');
clearTimeout(vex.timer);
- if (!this._active || vex.dialogID > 0) {
+ if (!this._active || isAnyVexDialogActive()) {
// A dialog is already dimming the screen and probably
// shows an error message. Leave it alone.
this._active = false;
More information about the Libreoffice-commits
mailing list