mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
parent
93d288454f
commit
0e131d6f13
3 changed files with 12 additions and 21 deletions
6
src/legacy/ui/public/chrome/api/angular.js
vendored
6
src/legacy/ui/public/chrome/api/angular.js
vendored
|
@ -34,12 +34,6 @@ const URL_LIMIT_WARN_WITHIN = 1000;
|
|||
export function initAngularApi(chrome, internals) {
|
||||
chrome.getFirstPathSegment = _.noop;
|
||||
|
||||
internals.disableAutoAngularUrlEncodingFix = false;
|
||||
chrome.disableAutoAngularUrlEncodingFix = () => {
|
||||
internals.disableAutoAngularUrlEncodingFix = true;
|
||||
return chrome;
|
||||
};
|
||||
|
||||
chrome.setupAngular = function () {
|
||||
const kibana = uiModules.get('kibana');
|
||||
|
||||
|
|
|
@ -74,20 +74,18 @@ export function kbnChromeProvider(chrome, internals) {
|
|||
}
|
||||
}
|
||||
|
||||
if (!internals.disableAutoAngularUrlEncodingFix) {
|
||||
$rootScope.$on('$locationChangeStart', (e, newUrl) => {
|
||||
// This handler fixes issue #31238 where browser back navigation
|
||||
// fails due to angular 1.6 parsing url encoded params wrong.
|
||||
const absUrlHash = url.parse($location.absUrl()).hash.slice(1);
|
||||
const decodedAbsUrlHash = decodeURIComponent(absUrlHash);
|
||||
const hash = url.parse(newUrl).hash.slice(1);
|
||||
const decodedHash = decodeURIComponent(hash);
|
||||
if (absUrlHash !== hash && decodedHash === decodedAbsUrlHash) {
|
||||
// replace the urlencoded hash with the version that angular sees.
|
||||
$location.url(absUrlHash).replace();
|
||||
}
|
||||
});
|
||||
}
|
||||
$rootScope.$on('$locationChangeStart', (e, newUrl) => {
|
||||
// This handler fixes issue #31238 where browser back navigation
|
||||
// fails due to angular 1.6 parsing url encoded params wrong.
|
||||
const absUrlHash = url.parse($location.absUrl()).hash.slice(1);
|
||||
const decodedAbsUrlHash = decodeURIComponent(absUrlHash);
|
||||
const hash = url.parse(newUrl).hash.slice(1);
|
||||
const decodedHash = decodeURIComponent(hash);
|
||||
if (absUrlHash !== hash && decodedHash === decodedAbsUrlHash) {
|
||||
// replace the urlencoded hash with the version that angular sees.
|
||||
$location.url(absUrlHash).replace();
|
||||
}
|
||||
});
|
||||
|
||||
$rootScope.$on('$routeChangeSuccess', onRouteChange);
|
||||
$rootScope.$on('$routeUpdate', onRouteChange);
|
||||
|
|
1
src/legacy/ui/public/chrome/index.d.ts
vendored
1
src/legacy/ui/public/chrome/index.d.ts
vendored
|
@ -45,7 +45,6 @@ declare interface Chrome extends ChromeNavLinks {
|
|||
addApplicationClass(classNames: string | string[]): this;
|
||||
removeApplicationClass(classNames: string | string[]): this;
|
||||
getApplicationClasses(): string;
|
||||
disableAutoAngularUrlEncodingFix(): this;
|
||||
}
|
||||
|
||||
declare const chrome: Chrome;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue