Skip to content

Commit cc3d2ae

Browse files
committed
[js:core] bugfix of registration of fm.decodeRawString by fm.options.rawStringDecoder
1 parent 5e4b61c commit cc3d2ae

File tree

4 files changed

+15
-46
lines changed

4 files changed

+15
-46
lines changed

elfinder.legacy.html

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,15 +50,14 @@
5050
function(fm, extraObj) {
5151
// `init` event callback function
5252
fm.bind('init', function() {
53-
// Optional for Japanese decoder "extras/encoding-japanese.min"
54-
delete fm.options.rawStringDecoder;
53+
// Optional for Japanese decoder "encoding-japanese.js"
5554
if (fm.lang === 'jp') {
5655
fm.loadScript(
57-
[ fm.baseUrl + 'js/extras/encoding-japanese.min.js' ],
56+
[ '//cdn.rawgit.com/polygonplanet/encoding.js/master/encoding.min.js' ],
5857
function() {
5958
if (window.Encoding && Encoding.convert) {
6059
fm.options.rawStringDecoder = function(s) {
61-
return Encoding.convert(s,{to:'UNICODE',type:'string'});
60+
return Encoding.convert(s, {to:'UNICODE',type:'string'});
6261
};
6362
}
6463
},

js/elFinder.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3554,7 +3554,7 @@ var elFinder = function(node, opts, bootCallback) {
35543554
* @param String str
35553555
* @return String
35563556
*/
3557-
this.decodeRawString = $.isFunction(this.options.rawStringDecoder)? this.options.rawStringDecoder : function(str) {
3557+
this.decodeRawString = function(str) {
35583558
var charCodes = function(str) {
35593559
var i, len, arr;
35603560
for (i=0,len=str.length,arr=[]; i<len; i++) {
@@ -4676,6 +4676,11 @@ var elFinder = function(node, opts, bootCallback) {
46764676
},
46774677
toChkTh = {};
46784678

4679+
// regist decodeRawString function
4680+
if (self.options.rawStringDecoder && $.isFunction(self.options.rawStringDecoder)) {
4681+
self.decodeRawString = self.options.rawStringDecoder;
4682+
}
4683+
46794684
// re-calculate elFinder node z-index
46804685
self.zIndexCalc();
46814686

0 commit comments

Comments
 (0)