Skip to content

Commit ac3ae89

Browse files
author
Cari Spruiell
authored
Merge pull request #3109 from magento-obsessive-owls/cms-team-1-delivery
[CMS Team 1] Bug Fixes
2 parents a56545d + ccc7b1d commit ac3ae89

File tree

6 files changed

+52
-5
lines changed

6 files changed

+52
-5
lines changed

app/code/Magento/Downloadable/Test/Mftf/Test/AdminRemoveDefaultImageDownloadableProductTest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
<testCaseId value="MC-201"/>
1919
<group value="Downloadable"/>
2020
<skip>
21-
<issueId value="MAGETWO-94795"/>
21+
<issueId value="MC-4063"/>
2222
</skip>
2323
</annotations>
2424
<before>

app/code/Magento/Tinymce3/view/base/web/tinymce3Adapter.js

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,15 @@ define([
3737
this.config = config;
3838
this.schema = config.schema || html5Schema;
3939

40-
_.bindAll(this, 'beforeSetContent', 'saveContent', 'onChangeContent', 'openFileBrowser', 'updateTextArea');
40+
_.bindAll(
41+
this,
42+
'beforeSetContent',
43+
'saveContent',
44+
'onChangeContent',
45+
'openFileBrowser',
46+
'updateTextArea',
47+
'removeEvents'
48+
);
4149

4250
varienGlobalEvents.attachEventHandler('tinymceChange', this.onChangeContent);
4351
varienGlobalEvents.attachEventHandler('tinymceBeforeSetContent', this.beforeSetContent);
@@ -72,6 +80,17 @@ define([
7280
tinyMCE3.init(this.getSettings(mode));
7381
},
7482

83+
/**
84+
* Remove events from instance.
85+
*
86+
* @param {String} wysiwygId
87+
*/
88+
removeEvents: function (wysiwygId) {
89+
var editor = tinyMceEditors.get(wysiwygId);
90+
91+
varienGlobalEvents.removeEventHandler('tinymceChange', editor.onChangeContent);
92+
},
93+
7594
/**
7695
* @param {*} mode
7796
* @return {Object}

app/code/Magento/Ui/Component/Form/Element/Wysiwyg.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
use Magento\Ui\Component\Wysiwyg\ConfigInterface;
1414

1515
/**
16+
* WYSIWYG form element
17+
*
1618
* @api
1719
* @since 100.1.0
1820
*/
@@ -50,8 +52,9 @@ public function __construct(
5052
) {
5153
$wysiwygConfigData = isset($config['wysiwygConfigData']) ? $config['wysiwygConfigData'] : [];
5254
$this->form = $formFactory->create();
55+
$wysiwygId = $context->getNamespace() . '_' . $data['name'];
5356
$this->editor = $this->form->addField(
54-
$context->getNamespace() . '_' . $data['name'],
57+
$wysiwygId,
5558
\Magento\Framework\Data\Form\Element\Editor::class,
5659
[
5760
'force_load' => true,
@@ -62,6 +65,7 @@ public function __construct(
6265
]
6366
);
6467
$data['config']['content'] = $this->editor->getElementHtml();
68+
$data['config']['wysiwygId'] = $wysiwygId;
6569

6670
parent::__construct($context, $components, $data);
6771
}

app/code/Magento/Ui/view/base/web/js/form/element/wysiwyg.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,14 @@ define([
6161
return this;
6262
},
6363

64+
/**
65+
* @inheritdoc
66+
*/
67+
destroy: function () {
68+
this._super();
69+
wysiwyg.removeEvents(this.wysiwygId);
70+
},
71+
6472
/**
6573
*
6674
* @returns {exports}

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

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ define([
4040
'onChangeContent',
4141
'openFileBrowser',
4242
'updateTextArea',
43-
'onUndo'
43+
'onUndo',
44+
'removeEvents'
4445
);
4546

4647
varienGlobalEvents.attachEventHandler('tinymceChange', this.onChangeContent);
@@ -110,7 +111,7 @@ define([
110111
tinyMCE4.ui.FloatPanel.zIndex = settings.toolbarZIndex;
111112
}
112113

113-
varienGlobalEvents.removeEventHandler('tinymceChange', this.onChangeContent);
114+
this.removeEvents(self.id);
114115
}
115116

116117
jQuery.when.apply(jQuery, deferreds).done(function () {
@@ -120,6 +121,20 @@ define([
120121
}.bind(this));
121122
},
122123

124+
/**
125+
* Remove events from instance.
126+
*
127+
* @param {String} wysiwygId
128+
*/
129+
removeEvents: function (wysiwygId) {
130+
var editor;
131+
132+
if (typeof tinyMceEditors !== 'undefined') {
133+
editor = tinyMceEditors.get(wysiwygId);
134+
varienGlobalEvents.removeEventHandler('tinymceChange', editor.onChangeContent);
135+
}
136+
},
137+
123138
/**
124139
* Add plugin to the toolbar if not added.
125140
*

lib/web/tiny_mce_4/plugins/lineheight/plugin.min.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)