[Libreoffice-commits] online.git: loleaflet/src
Pranam Lashkari (via logerrit)
logerrit at kemper.freedesktop.org
Mon May 4 12:00:05 UTC 2020
loleaflet/src/control/Control.JSDialogBuilder.js | 2 +-
loleaflet/src/core/Util.js | 7 +++++++
2 files changed, 8 insertions(+), 1 deletion(-)
New commits:
commit 85f09360d8f3d4b68f7f533d4cef5203fc58413f
Author: Pranam Lashkari <lpranam at collabora.com>
AuthorDate: Wed Jan 29 02:35:02 2020 +0530
Commit: Michael Meeks <michael.meeks at collabora.com>
CommitDate: Mon May 4 13:59:47 2020 +0200
Follow up for be48005
substr method replaced with startsWith for more readability and optimisation
Change-Id: I205a843359942ef7dea92333eaf2076ab2080983
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/87661
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
Reviewed-by: Michael Meeks <michael.meeks at collabora.com>
diff --git a/loleaflet/src/control/Control.JSDialogBuilder.js b/loleaflet/src/control/Control.JSDialogBuilder.js
index 7573c1376..e10211306 100644
--- a/loleaflet/src/control/Control.JSDialogBuilder.js
+++ b/loleaflet/src/control/Control.JSDialogBuilder.js
@@ -1891,7 +1891,7 @@ L.Control.JSDialogBuilder = L.Control.extend({
}
var icon = null;
- var commandName = data.command && data.command.substring(0, '.uno:'.length) === '.uno:' ? data.command.substring('.uno:'.length) : data.id;
+ var commandName = data.command && data.command.startsWith('.uno:') ? data.command.substring('.uno:'.length) : data.id;
if (commandName && commandName.length && L.LOUtil.existsIconForCommand(commandName, builder.map.getDocType())) {
var iconName = builder._generateMenuIconName(commandName);
var iconSpan = L.DomUtil.create('span', 'menu-entry-icon ' + iconName, menuEntry);
diff --git a/loleaflet/src/core/Util.js b/loleaflet/src/core/Util.js
index e504c92c5..0ea2b0ff6 100644
--- a/loleaflet/src/core/Util.js
+++ b/loleaflet/src/core/Util.js
@@ -244,6 +244,13 @@ L.Util = {
L.Util.MIN_SAFE_INTEGER = -L.Util.MAX_SAFE_INTEGER;
})();
+if (!String.prototype.startsWith) {
+ String.prototype.startsWith = function(searchString, position) {
+ position = position || 0;
+ return this.substr(position, searchString.length) === searchString;
+ };
+}
+
// shortcuts for most used utility functions
L.extend = L.Util.extend;
L.bind = L.Util.bind;
More information about the Libreoffice-commits
mailing list