Skip to content

Commit

Permalink
added pimcore.helpers.htmlEncodeTextField (#24)
Browse files Browse the repository at this point in the history
  • Loading branch information
Corepex authored Apr 20, 2023
1 parent 95ce977 commit fd04f7c
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions public/js/pimcore/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,17 @@ pimcore.helpers.sanitizeUrlSlug = function (slug) {
return slug.replace(/[^a-z0-9-_+/]/gi, '');
};

pimcore.helpers.htmlEncodeTextField = function (textField) {
if(textField.getValue()) {
textField.suspendEvent('change');
const decodedValue = Ext.util.Format.htmlDecode(textField.getValue());
textField.setValue(
Ext.util.Format.htmlEncode(decodedValue)
);
textField.resumeEvent('change');
}
};

pimcore.helpers.registerKeyBindings = function (bindEl, ExtJS) {

if (!ExtJS) {
Expand Down

0 comments on commit fd04f7c

Please sign in to comment.