Handle translations like template options
Translations will now be passed through `escapeMarkup` and injected into the results messages as HTML just like the templating options for the the results and selections. This fixes the regression from 3.x where the old formatters always supported HTML. This closes https://github.com/select2/select2/issues/3008.
This commit is contained in:
parent
78b6faf13e
commit
1766e31447
8
dist/js/select2.amd.full.js
vendored
8
dist/js/select2.amd.full.js
vendored
@ -272,6 +272,8 @@ define('select2/results',[
|
||||
};
|
||||
|
||||
Results.prototype.displayMessage = function (params) {
|
||||
var escapeMarkup = this.options.get('escapeMarkup');
|
||||
|
||||
this.clear();
|
||||
this.hideLoading();
|
||||
|
||||
@ -281,7 +283,11 @@ define('select2/results',[
|
||||
|
||||
var message = this.options.get('translations').get(params.message);
|
||||
|
||||
$message.text(message(params.args));
|
||||
$message.append(
|
||||
escapeMarkup(
|
||||
message(params.args)
|
||||
)
|
||||
);
|
||||
|
||||
this.$results.append($message);
|
||||
};
|
||||
|
8
dist/js/select2.amd.js
vendored
8
dist/js/select2.amd.js
vendored
@ -272,6 +272,8 @@ define('select2/results',[
|
||||
};
|
||||
|
||||
Results.prototype.displayMessage = function (params) {
|
||||
var escapeMarkup = this.options.get('escapeMarkup');
|
||||
|
||||
this.clear();
|
||||
this.hideLoading();
|
||||
|
||||
@ -281,7 +283,11 @@ define('select2/results',[
|
||||
|
||||
var message = this.options.get('translations').get(params.message);
|
||||
|
||||
$message.text(message(params.args));
|
||||
$message.append(
|
||||
escapeMarkup(
|
||||
message(params.args)
|
||||
)
|
||||
);
|
||||
|
||||
this.$results.append($message);
|
||||
};
|
||||
|
8
dist/js/select2.full.js
vendored
8
dist/js/select2.full.js
vendored
@ -710,6 +710,8 @@ define('select2/results',[
|
||||
};
|
||||
|
||||
Results.prototype.displayMessage = function (params) {
|
||||
var escapeMarkup = this.options.get('escapeMarkup');
|
||||
|
||||
this.clear();
|
||||
this.hideLoading();
|
||||
|
||||
@ -719,7 +721,11 @@ define('select2/results',[
|
||||
|
||||
var message = this.options.get('translations').get(params.message);
|
||||
|
||||
$message.text(message(params.args));
|
||||
$message.append(
|
||||
escapeMarkup(
|
||||
message(params.args)
|
||||
)
|
||||
);
|
||||
|
||||
this.$results.append($message);
|
||||
};
|
||||
|
2
dist/js/select2.full.min.js
vendored
2
dist/js/select2.full.min.js
vendored
File diff suppressed because one or more lines are too long
8
dist/js/select2.js
vendored
8
dist/js/select2.js
vendored
@ -710,6 +710,8 @@ define('select2/results',[
|
||||
};
|
||||
|
||||
Results.prototype.displayMessage = function (params) {
|
||||
var escapeMarkup = this.options.get('escapeMarkup');
|
||||
|
||||
this.clear();
|
||||
this.hideLoading();
|
||||
|
||||
@ -719,7 +721,11 @@ define('select2/results',[
|
||||
|
||||
var message = this.options.get('translations').get(params.message);
|
||||
|
||||
$message.text(message(params.args));
|
||||
$message.append(
|
||||
escapeMarkup(
|
||||
message(params.args)
|
||||
)
|
||||
);
|
||||
|
||||
this.$results.append($message);
|
||||
};
|
||||
|
2
dist/js/select2.min.js
vendored
2
dist/js/select2.min.js
vendored
File diff suppressed because one or more lines are too long
8
src/js/select2/results.js
vendored
8
src/js/select2/results.js
vendored
@ -31,6 +31,8 @@ define([
|
||||
};
|
||||
|
||||
Results.prototype.displayMessage = function (params) {
|
||||
var escapeMarkup = this.options.get('escapeMarkup');
|
||||
|
||||
this.clear();
|
||||
this.hideLoading();
|
||||
|
||||
@ -40,7 +42,11 @@ define([
|
||||
|
||||
var message = this.options.get('translations').get(params.message);
|
||||
|
||||
$message.text(message(params.args));
|
||||
$message.append(
|
||||
escapeMarkup(
|
||||
message(params.args)
|
||||
)
|
||||
);
|
||||
|
||||
this.$results.append($message);
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user