Skip to content
This repository was archived by the owner on Apr 29, 2019. It is now read-only.

Commit 7ce6ffb

Browse files
author
Igor Melnikov
authored
Merge pull request #2070 from magento-obsessive-owls/MAGETWO-87490-decode-directives
[Obsessive Owls] MAGETWO-87490: Decode Directives Error
2 parents a29b455 + cd9d036 commit 7ce6ffb

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

lib/web/mage/adminhtml/wysiwyg/tiny_mce/tinymce4Adapter.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -608,7 +608,7 @@ define([
608608
decodeDirectives: function (content) {
609609
// escape special chars in directives url to use it in regular expression
610610
var url = this.makeDirectiveUrl('%directive%').replace(/([$^.?*!+:=()\[\]{}|\\])/g, '\\$1'),
611-
reg = new RegExp(url.replace('%directive%', '([a-zA-Z0-9%,_-]+)\/?'));
611+
reg = new RegExp(url.replace('%directive%', '([a-zA-Z0-9,_-]+(?:%2[A-Z]|)+)'));
612612

613613
return content.gsub(reg, function (match) { //eslint-disable-line no-extra-bind
614614
return Base64.mageDecode(decodeURIComponent(match[1])).replace(/"/g, '"');
@@ -640,12 +640,12 @@ define([
640640
* @return {*}
641641
*/
642642
decodeContent: function (content) {
643-
content = varienGlobalEvents.fireEventReducer('wysiwygDecodeContent', content);
644-
645643
if (this.config['add_directives']) {
646644
content = this.decodeDirectives(content);
647645
}
648646

647+
content = varienGlobalEvents.fireEventReducer('wysiwygDecodeContent', content);
648+
649649
return content;
650650
},
651651

@@ -654,12 +654,12 @@ define([
654654
* @return {*}
655655
*/
656656
encodeContent: function (content) {
657-
content = varienGlobalEvents.fireEventReducer('wysiwygEncodeContent', content);
658-
659657
if (this.config['add_directives']) {
660658
content = this.encodeDirectives(content);
661659
}
662660

661+
content = varienGlobalEvents.fireEventReducer('wysiwygEncodeContent', content);
662+
663663
return content;
664664
},
665665

0 commit comments

Comments
 (0)