Skip to content

Commit 6ad7bd8

Browse files
[EngCom] Public Pull Requests - 2.3-develop
- merged latest code from mainline branch
2 parents 9a52f1c + 30f8f18 commit 6ad7bd8

File tree

2 files changed

+29
-0
lines changed
  • app/code/Magento/Ui/view/base/web/js/form/element
  • lib/internal/Magento/Framework/Data/Form/Element

2 files changed

+29
-0
lines changed

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

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ define([
2020
return Abstract.extend({
2121
defaults: {
2222
elementSelector: 'textarea',
23+
suffixRegExpPattern: '\\${ \\$.wysiwygUniqueSuffix }',
2324
$wysiwygEditorButton: '',
2425
links: {
2526
value: '${ $.provider }:${ $.dataScope }'
@@ -60,6 +61,25 @@ define([
6061
return this;
6162
},
6263

64+
/** @inheritdoc */
65+
initConfig: function (config) {
66+
var pattern = config.suffixRegExpPattern || this.constructor.defaults.suffixRegExpPattern;
67+
68+
config.content = config.content.replace(new RegExp(pattern, 'g'), this.getUniqueSuffix(config));
69+
this._super();
70+
71+
return this;
72+
},
73+
74+
/**
75+
* Build unique id based on name, underscore separated.
76+
*
77+
* @param {Object} config
78+
*/
79+
getUniqueSuffix: function (config) {
80+
return config.name.replace(/(\.|-)/g, '_');
81+
},
82+
6383
/**
6484
* @inheritdoc
6585
*/

lib/internal/Magento/Framework/Data/Form/Element/Editor.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -542,4 +542,13 @@ protected function getInlineJs($jsSetupObject, $forceLoad)
542542
</script>';
543543
return $jsString;
544544
}
545+
546+
/**
547+
* @inheritdoc
548+
*/
549+
public function getHtmlId()
550+
{
551+
$suffix = $this->getConfig('dynamic_id') ? '${ $.wysiwygUniqueSuffix }' : '';
552+
return parent::getHtmlId() . $suffix;
553+
}
545554
}

0 commit comments

Comments
 (0)