-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: LPS-124728 Avoid using unsupported APIs in IE11
We were using `URL`, `URLSearchParams` and `Object.entries`, which aren't supported in IE11 . In theory we have polyfills for these but apparently when `getUrl` is executed these polyfills aren't loaded yet. So this patch reverts a previous patch and adds more . Tested against [LPS-124728](https://issues.liferay.com/browse/LPS-124728) and [LPS-112982](https://issues.liferay.com/browse/LPS-112982)
- Loading branch information
Julien Castelain
committed
Dec 21, 2020
1 parent
48e65ee
commit a11ce92
Showing
7 changed files
with
67 additions
and
6 deletions.
There are no files selected for viewing
2 changes: 1 addition & 1 deletion
2
patches/0001-LPS-89596-Cannot-Drag-Image-from-top-content-line-in.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
patches/0002-LPS-95472-Tabs-in-popups-not-appears-correctly-in-ma.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
patches/0004-LPP-36989-Remove-obsolete-summary-field-from-table-e.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
patches/0005-LPS-112982-Add-additional-resource-URL-parameters.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
patches/0006-LPS-118624-Don-t-pass-languageId-to-css-files-reques.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
From d0bf70988e63c2c84076d7418eb6cfe0edc438de Mon Sep 17 00:00:00 2001 | ||
From: Julien Castelain <julien.castelain@liferay.com> | ||
Date: Mon, 21 Dec 2020 09:12:53 +0100 | ||
Subject: [PATCH] LPS-124728 Avoid breaking IE11 | ||
|
||
IE11 Doesn't support URL, URLSearchParams and Object.entries | ||
In theory though we have a pollyfill for these but it seems that | ||
they aren't loaded when getUrl is executed. | ||
--- | ||
core/ckeditor_base.js | 30 ++++++++++++++++++------------ | ||
1 file changed, 18 insertions(+), 12 deletions(-) | ||
|
||
diff --git a/core/ckeditor_base.js b/core/ckeditor_base.js | ||
index 6d9fcbc03..59b3e4a0b 100644 | ||
--- a/core/ckeditor_base.js | ||
+++ b/core/ckeditor_base.js | ||
@@ -171,26 +171,32 @@ if ( !window.CKEDITOR ) { | ||
* @returns {String} The full URL. | ||
*/ | ||
getUrl: function( resource ) { | ||
- var resourceUrl = resource.startsWith(this.basePath) | ||
- ? new URL(resource) | ||
- : new URL(this.basePath + resource); | ||
+ function set(key, value) { | ||
+ if (!resource.match(new RegExp('[&?]' + key + '\\b'))) { | ||
+ resource += (resource.indexOf('?') >= 0 ? '&' : '?') + key + '=' + value; | ||
+ } | ||
+ } | ||
|
||
- if (!resourceUrl.toString().endsWith('/')) { | ||
- if (this.timestamp && !resourceUrl.searchParams.has('t')) { | ||
- resourceUrl.searchParams.set('t', this.timestamp); | ||
+ // If this is not a full or absolute path. | ||
+ if (resource.indexOf(':/') === -1 && resource.indexOf('/') !== 0) { | ||
+ resource = this.basePath + resource; | ||
+ } | ||
+ | ||
+ if (resource.charAt(resource.length - 1) !== '/') { | ||
+ if (this.timestamp) { | ||
+ set('t', this.timestamp); | ||
} | ||
|
||
- Object.entries(CKEDITOR.ADDITIONAL_RESOURCE_PARAMS).forEach(function(entries) { | ||
- var key = entries[0]; | ||
- var value = entries[1]; | ||
+ Object.keys(CKEDITOR.ADDITIONAL_RESOURCE_PARAMS).forEach(function(key) { | ||
+ var value = CKEDITOR.ADDITIONAL_RESOURCE_PARAMS[key]; | ||
|
||
- if (!resourceUrl.searchParams.has(key) && !(resourceUrl.toString().includes('.css') && key === 'languageId')) { | ||
- resourceUrl.searchParams.set(key, value); | ||
+ if (!/\.css$/.test(resource) || key !== 'languageId') { | ||
+ set(key, value); | ||
} | ||
}); | ||
} | ||
|
||
- return resourceUrl.toString(); | ||
+ return resource; | ||
}, | ||
|
||
/** |