Skip to content

Commit 24b575a

Browse files
committed
MC-13917: Content types mark up within Text content type causes whole stage to become HTML
- Refactor role out of findElementByName function
1 parent f887efd commit 24b575a

File tree

4 files changed

+6
-8
lines changed

4 files changed

+6
-8
lines changed

app/code/Magento/PageBuilder/view/adminhtml/web/js/master-format/read/configurable.js

Lines changed: 2 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/code/Magento/PageBuilder/view/adminhtml/web/js/stage-builder.js

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

app/code/Magento/PageBuilder/view/adminhtml/web/ts/js/master-format/read/configurable.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export default class Configurable implements ReadInterface {
4141
let data = {};
4242
for (const elementName of Object.keys(config.elements)) {
4343
const elementConfig = config.elements[elementName];
44-
const currentElement = this.findElementByName(role, element, elementName);
44+
const currentElement = this.findElementByName(element, elementName);
4545

4646
// If we cannot locate the current element skip trying to read any attributes from it
4747
if (currentElement === null || currentElement === undefined) {
@@ -93,12 +93,11 @@ export default class Configurable implements ReadInterface {
9393
* Find the element for the current content type by it's name, avoiding searching in other content types by
9494
* removing any other element which contains it's own data-role.
9595
*
96-
* @param {string} role
9796
* @param {HTMLElement} element
9897
* @param {string} name
9998
* @returns {HTMLElement}
10099
*/
101-
private findElementByName(role: string, element: HTMLElement, name: string): HTMLElement {
100+
private findElementByName(element: HTMLElement, name: string): HTMLElement {
102101
// Create a clone of the element to avoid modifying the source
103102
const currentElement = $(element).clone();
104103
if (currentElement.attr("data-element") === name) {

app/code/Magento/PageBuilder/view/adminhtml/web/ts/js/stage-builder.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import alertDialog from "Magento_Ui/js/modal/alert";
1010
import * as _ from "underscore";
1111
import Config from "./config";
1212
import ConfigFieldInterface from "./config-field";
13+
import ContentTypeCollection from "./content-type-collection";
1314
import ContentTypeCollectionInterface from "./content-type-collection.d";
1415
import ContentTypeConfigInterface from "./content-type-config.d";
1516
import createContentType from "./content-type-factory";
@@ -20,7 +21,6 @@ import validateFormat from "./master-format/validator";
2021
import Stage from "./stage";
2122
import {removeQuotesInMediaDirectives} from "./utils/directives";
2223
import {set} from "./utils/object";
23-
import ContentTypeCollection from "./content-type-collection";
2424

2525
/**
2626
* Build the stage with the provided value

0 commit comments

Comments
 (0)