Fixes: U4-3420 Firefox v25.0 - Right click context menu doesn't work - this felt like being a web dev 10 years ago when you had to code totally differently for each browser. Firefox unfortunatley treats 'a' tags differently than anything else and combined with angular saying you can have empty 'href' tags doesn't work. In the end, the fix was easy, just remove the empty (supposed to be supported) href attributes from the 'a' tags in the tree, then the contextmenu starts working in firefox and the events can be canceled as per normal. This commit also moves the angular localization library to use bower.
This commit is contained in:
@@ -21,7 +21,8 @@
|
||||
"rgrove-lazyload": "*",
|
||||
"jquery": "2.0.3",
|
||||
"jquery-file-upload": "~9.4.0",
|
||||
"jquery-ui": "1.10.3"
|
||||
"jquery-ui": "1.10.3",
|
||||
"angular-dynamic-locale": "~0.1.27"
|
||||
},
|
||||
"exportsOverride": {
|
||||
"rgrove-lazyload": {
|
||||
@@ -33,6 +34,9 @@
|
||||
"underscore": {
|
||||
"": "underscore-min.{js,map}"
|
||||
},
|
||||
"angular-dynamic-locale": {
|
||||
"": "tmhDynamicLocale.min.{js,js.map}"
|
||||
},
|
||||
"jquery": {
|
||||
"": "jquery.min.{js,map}"
|
||||
},
|
||||
|
||||
@@ -1,186 +0,0 @@
|
||||
( function(window) {
|
||||
'use strict';
|
||||
angular.module('tmh.dynamicLocale', []).provider('tmhDynamicLocale', function() {
|
||||
|
||||
var defaultLocale,
|
||||
localeLocationPattern = 'angular/i18n/angular-locale_{{locale}}.js',
|
||||
storageFactory = 'tmhDynamicLocaleStorageCache',
|
||||
storage,
|
||||
storeKey = 'tmhDynamicLocale.locale',
|
||||
promiseCache = {},
|
||||
activeLocale;
|
||||
|
||||
/**
|
||||
* Loads a script asynchronously
|
||||
*
|
||||
* @param {string} url The url for the script
|
||||
@ @param {function) callback A function to be called once the script is loaded
|
||||
*/
|
||||
function loadScript(url, callback, errorCallback, $timeout) {
|
||||
var script = document.createElement('script'),
|
||||
body = document.getElementsByTagName('body')[0],
|
||||
removed = false;
|
||||
|
||||
script.type = 'text/javascript';
|
||||
if (script.readyState) { // IE
|
||||
script.onreadystatechange = function () {
|
||||
if (script.readyState === 'complete' ||
|
||||
script.readyState === 'loaded') {
|
||||
script.onreadystatechange = null;
|
||||
$timeout(
|
||||
function () {
|
||||
if (removed) return;
|
||||
removed = true;
|
||||
body.removeChild(script);
|
||||
callback();
|
||||
}, 30, false);
|
||||
}
|
||||
};
|
||||
} else { // Others
|
||||
script.onload = function () {
|
||||
if (removed) return;
|
||||
removed = true;
|
||||
body.removeChild(script);
|
||||
callback();
|
||||
};
|
||||
script.onerror = function () {
|
||||
if (removed) return;
|
||||
removed = true;
|
||||
body.removeChild(script);
|
||||
errorCallback();
|
||||
};
|
||||
}
|
||||
script.src = url;
|
||||
script.async = false;
|
||||
body.appendChild(script);
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads a locale and replaces the properties from the current locale with the new locale information
|
||||
*
|
||||
* @param localeUrl The path to the new locale
|
||||
* @param $locale The locale at the curent scope
|
||||
*/
|
||||
function loadLocale(localeUrl, $locale, localeId, $rootScope, $q, localeCache, $timeout) {
|
||||
|
||||
function overrideValues(oldObject, newObject) {
|
||||
if (activeLocale !== localeId) {
|
||||
return;
|
||||
}
|
||||
angular.forEach(oldObject, function(value, key) {
|
||||
if (!newObject[key]) {
|
||||
delete oldObject[key];
|
||||
} else if (angular.isArray(newObject[key])) {
|
||||
oldObject[key].length = newObject[key].length;
|
||||
}
|
||||
});
|
||||
angular.forEach(newObject, function(value, key) {
|
||||
if (angular.isArray(newObject[key]) || angular.isObject(newObject[key])) {
|
||||
if (!oldObject[key]) {
|
||||
oldObject[key] = angular.isArray(newObject[key]) ? [] : {};
|
||||
}
|
||||
overrideValues(oldObject[key], newObject[key]);
|
||||
} else {
|
||||
oldObject[key] = newObject[key];
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
if (promiseCache[localeId]) return promiseCache[localeId];
|
||||
|
||||
var cachedLocale,
|
||||
deferred = $q.defer();
|
||||
if (localeId === activeLocale) {
|
||||
deferred.resolve($locale);
|
||||
} else if ((cachedLocale = localeCache.get(localeId))) {
|
||||
activeLocale = localeId;
|
||||
$rootScope.$evalAsync(function() {
|
||||
overrideValues($locale, cachedLocale);
|
||||
$rootScope.$broadcast('$localeChangeSuccess', localeId, $locale);
|
||||
storage.put(storeKey, localeId);
|
||||
deferred.resolve($locale);
|
||||
});
|
||||
} else {
|
||||
activeLocale = localeId;
|
||||
promiseCache[localeId] = deferred.promise;
|
||||
loadScript(localeUrl, function () {
|
||||
// Create a new injector with the new locale
|
||||
var localInjector = angular.injector(['ngLocale']),
|
||||
externalLocale = localInjector.get('$locale');
|
||||
|
||||
overrideValues($locale, externalLocale);
|
||||
localeCache.put(localeId, externalLocale);
|
||||
delete promiseCache[localeId];
|
||||
|
||||
$rootScope.$apply(function () {
|
||||
$rootScope.$broadcast('$localeChangeSuccess', localeId, $locale);
|
||||
storage.put(storeKey, localeId);
|
||||
deferred.resolve($locale);
|
||||
});
|
||||
}, function () {
|
||||
delete promiseCache[localeId];
|
||||
|
||||
$rootScope.$apply(function () {
|
||||
$rootScope.$broadcast('$localeChangeError', localeId);
|
||||
deferred.reject(localeId);
|
||||
});
|
||||
}, $timeout);
|
||||
}
|
||||
return deferred.promise;
|
||||
}
|
||||
|
||||
this.localeLocationPattern = function(value) {
|
||||
if (value) {
|
||||
localeLocationPattern = value;
|
||||
return this;
|
||||
} else {
|
||||
return localeLocationPattern;
|
||||
}
|
||||
};
|
||||
|
||||
this.useStorage = function(storageName) {
|
||||
storageFactory = storageName;
|
||||
};
|
||||
|
||||
this.useCookieStorage = function() {
|
||||
this.useStorage('$cookieStore');
|
||||
};
|
||||
|
||||
this.defaultLocale = function (value) {
|
||||
defaultLocale = value;
|
||||
};
|
||||
|
||||
this.$get = ['$rootScope', '$injector', '$interpolate', '$locale', '$q', 'tmhDynamicLocaleCache', '$timeout', function($rootScope, $injector, interpolate, locale, $q, tmhDynamicLocaleCache, $timeout) {
|
||||
var localeLocation = interpolate(localeLocationPattern);
|
||||
|
||||
storage = $injector.get(storageFactory);
|
||||
$rootScope.$evalAsync(function () {
|
||||
var initialLocale;
|
||||
if ((initialLocale = (storage.get(storeKey) || defaultLocale))) {
|
||||
loadLocale(localeLocation({locale: initialLocale}), locale, initialLocale, $rootScope, $q, tmhDynamicLocaleCache, $timeout);
|
||||
}
|
||||
});
|
||||
return {
|
||||
/**
|
||||
* @ngdoc method
|
||||
* @description
|
||||
* @param {string=} value Sets the locale to the new locale. Changing the locale will trigger
|
||||
* a background task that will retrieve the new locale and configure the current $locale
|
||||
* instance with the information from the new locale
|
||||
*/
|
||||
set: function(value) {
|
||||
return loadLocale(localeLocation({locale: value}), locale, value, $rootScope, $q, tmhDynamicLocaleCache, $timeout);
|
||||
}
|
||||
};
|
||||
}];
|
||||
}).provider('tmhDynamicLocaleCache', function() {
|
||||
this.$get = ['$cacheFactory', function($cacheFactory) {
|
||||
return $cacheFactory('tmh.dynamicLocales');
|
||||
}];
|
||||
}).provider('tmhDynamicLocaleStorageCache', function() {
|
||||
this.$get = ['$cacheFactory', function($cacheFactory) {
|
||||
return $cacheFactory('tmh.dynamicLocales.store');
|
||||
}];
|
||||
}).run(['tmhDynamicLocale', angular.noop]);
|
||||
}(window) );
|
||||
@@ -33,7 +33,7 @@ function umbTreeDirective($compile, $log, $q, $rootScope, treeService, notificat
|
||||
'<h5>' +
|
||||
'<i ng-if="enablecheckboxes == \'true\'" ng-class="selectEnabledNodeClass(tree.root)"></i>' +
|
||||
'<a href="#/{{section}}" ng-click="select(tree.root, $event)" class="root-link">{{tree.name}}</a></h5>' +
|
||||
'<a href class="umb-options" ng-hide="tree.root.isContainer || !tree.root.menuUrl" ng-click="options(tree.root, $event)" ng-swipe-right="options(tree.root, $event)"><i></i><i></i><i></i></a>' +
|
||||
'<a class="umb-options" ng-hide="tree.root.isContainer || !tree.root.menuUrl" ng-click="options(tree.root, $event)" ng-swipe-right="options(tree.root, $event)"><i></i><i></i><i></i></a>' +
|
||||
'</div>';
|
||||
template += '<ul>' +
|
||||
'<umb-tree-item ng-repeat="child in tree.root.children" eventhandler="eventhandler" node="child" current-node="currentNode" tree="this" section="{{section}}" ng-animate="animation()"></umb-tree-item>' +
|
||||
|
||||
@@ -41,9 +41,9 @@ angular.module("umbraco.directives")
|
||||
'<ins style="width:18px;"></ins>' +
|
||||
'<ins ng-class="{\'icon-navigation-right\': !node.expanded, \'icon-navigation-down\': node.expanded}" ng-click="load(node)"></ins>' +
|
||||
'<i class="icon umb-tree-icon sprTree"></i>' +
|
||||
'<a href ng-click="select(node, $event)" on-right-click="altSelect(node, $event)"></a>' +
|
||||
'<a ng-click="select(node, $event)"></a>' +
|
||||
//NOTE: These are the 'option' elipses
|
||||
'<a href class="umb-options" ng-click="options(node, $event)"><i></i><i></i><i></i></a>' +
|
||||
'<a class="umb-options" ng-click="options(node, $event)"><i></i><i></i><i></i></a>' +
|
||||
'<div ng-show="node.loading" class="l"><div></div></div>' +
|
||||
'</div>' +
|
||||
'</li>',
|
||||
@@ -59,6 +59,7 @@ angular.module("umbraco.directives")
|
||||
|
||||
// Helper function to emit tree events
|
||||
function emitEvent(eventName, args) {
|
||||
|
||||
if (scope.eventhandler) {
|
||||
$(scope.eventhandler).trigger(eventName, args);
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ LazyLoad.js(
|
||||
|
||||
'lib/angular/angular-ui-sortable.js',
|
||||
|
||||
'lib/angular/tmhDynamicLocale.js',
|
||||
'lib/angular-dynamic-locale/tmhDynamicLocale.min.js',
|
||||
|
||||
/* App-wide file-upload helper */
|
||||
'lib/jquery-file-upload/jquery.fileupload.js',
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
'lib/angular/angular-ui-sortable.js',
|
||||
|
||||
'lib/angular/tmhDynamicLocale.js',
|
||||
'lib/angular-dynamic-locale/tmhDynamicLocale.min.js',
|
||||
|
||||
'lib/blueimp-load-image/load-image.all.min.js',
|
||||
'lib/jquery-file-upload/jquery.fileupload.js',
|
||||
|
||||
Reference in New Issue
Block a user