Skip to content

Commit

Permalink
Merge pull request #2070 from magento-obsessive-owls/MAGETWO-87490-de…
Browse files Browse the repository at this point in the history
…code-directives

[Obsessive Owls] MAGETWO-87490: Decode Directives Error
  • Loading branch information
Igor Melnikov authored Feb 9, 2018
2 parents a29b455 + cd9d036 commit 7ce6ffb
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lib/web/mage/adminhtml/wysiwyg/tiny_mce/tinymce4Adapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -608,7 +608,7 @@ define([
decodeDirectives: function (content) {
// escape special chars in directives url to use it in regular expression
var url = this.makeDirectiveUrl('%directive%').replace(/([$^.?*!+:=()\[\]{}|\\])/g, '\\$1'),
reg = new RegExp(url.replace('%directive%', '([a-zA-Z0-9%,_-]+)\/?'));
reg = new RegExp(url.replace('%directive%', '([a-zA-Z0-9,_-]+(?:%2[A-Z]|)+)'));

return content.gsub(reg, function (match) { //eslint-disable-line no-extra-bind
return Base64.mageDecode(decodeURIComponent(match[1])).replace(/"/g, '"');
Expand Down Expand Up @@ -640,12 +640,12 @@ define([
* @return {*}
*/
decodeContent: function (content) {
content = varienGlobalEvents.fireEventReducer('wysiwygDecodeContent', content);

if (this.config['add_directives']) {
content = this.decodeDirectives(content);
}

content = varienGlobalEvents.fireEventReducer('wysiwygDecodeContent', content);

return content;
},

Expand All @@ -654,12 +654,12 @@ define([
* @return {*}
*/
encodeContent: function (content) {
content = varienGlobalEvents.fireEventReducer('wysiwygEncodeContent', content);

if (this.config['add_directives']) {
content = this.encodeDirectives(content);
}

content = varienGlobalEvents.fireEventReducer('wysiwygEncodeContent', content);

return content;
},

Expand Down

0 comments on commit 7ce6ffb

Please sign in to comment.