Skip to content

Commit

Permalink
Merge pull request #1381 from adobe/devToMaster8Sep
Browse files Browse the repository at this point in the history
Dev to master8 sep
  • Loading branch information
rismehta authored Sep 8, 2024
2 parents 26217fa + c2b12dd commit c599a34
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,15 @@
};

const correctEditableEditorType = function (editable, name) {
if (name == "EDIT") {
var hasRichTextLabel = editable.dom.find("[class$='__label']")[0] && editable.dom.find("[class$='__label']")[0].getAttribute("data-richtext") != null,
hasRichTextAttribute = editable.dom.find("[class$='__text']")[0] && editable.dom.find("[class$='__text']")[0].getAttribute("data-richtext") != null;
// We are checking for data-richtext in component to decide whether open rich-text inplace editor or plain text editor
if(!(hasRichTextLabel || hasRichTextAttribute)){
editable.config.editConfig.inplaceEditingConfig.editorType="plaintext";
if (name === "EDIT") {
const isAFComponent = editable.dom.find("[data-cmp-is^='adaptiveForm']")[0] != null;
if (isAFComponent) {
const hasRichTextLabel = editable.dom.find("[class$='__label']")[0] && editable.dom.find("[class$='__label']")[0].getAttribute("data-richtext") != null,
hasRichTextAttribute = editable.dom.find("[class$='__text']")[0] && editable.dom.find("[class$='__text']")[0].getAttribute("data-richtext") != null;
// We are checking for data-richtext in component to decide whether open rich-text inplace editor or plain text editor
if (!(hasRichTextLabel || hasRichTextAttribute)) {
editable.config.editConfig.inplaceEditingConfig.editorType = "plaintext";
}
}
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,15 +68,12 @@
<sly data-sly-use.clientLib="${'/libs/granite/sightly/templates/clientlib.html'}"/>
<sly data-sly-test.useIframe="${form.useIframe != 'false'}">
<sly data-sly-test.formLocaleString="${form.locale || 'en'}"/>
<sly data-sly-set.dataRef="${request.requestParameterMap['dataRef'] ? request.requestParameterMap['dataRef'][0].toString :'' @ context='attribute'}"/>
<sly data-sly-set.wcmmode="${!wcmmode.edit?'wcmmode=DISABLED':''}"/>
<sly data-sly-set.formUrlParams="${wcmmode ? '?':''}${wcmmode}${dataRef ? '&dataRef=' :''}${dataRef}"/>
<iframe title="${form.title}"
role="${form.roleAttribute || ''}"
class="cmp-aemform__iframecontent"
src="${request.contextPath}${resource.path}.iframe.${formLocaleString}.html${formUrlParams}"
width="100%;"
data-form-page-path="${form.formEditPagePath}"></iframe>
<iframe title="${form.title}"
role="${form.roleAttribute || ''}"
class="cmp-aemform__iframecontent"
src="${request.contextPath}${resource.path}.iframe.${formLocaleString}.html?dataRef=${request.requestParameterMap['dataRef'] != null ? request.requestParameterMap['dataRef'][0].toString : '' @ context='attribute'}${!wcmmode.edit ? '&wcmmode={0}':'' @ format=[wcmmode.toString]}"
width="100%;"
data-form-page-path="${form.formEditPagePath}"></iframe>
<sly data-sly-test="${form.useIframe != 'false' && form.height == 'auto'}"
data-sly-call="${clientLib.all @ categories=['core.forms.components.aemform.v2.iframeResizer']}"/>
</sly>
Expand Down
21 changes: 15 additions & 6 deletions ui.frontend/src/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export const Constants = {
* @property {object} event - The event object.
* @property {object} event.detail - Instance of FormContainer that is initialized.
* @example
* document.on("AF_FormContainerInitialised" , function(event) {
* document.addEventListener("AF_FormContainerInitialised" , function(event) {
* var formContainer = event.detail;
* // Handle the event
* });
Expand All @@ -50,10 +50,15 @@ export const Constants = {
* @property {object} event - The event object.
* @property {object} event.detail - Instance of child view that is added.
* @example
* formcontainer.getFormElement().on("AF_PanelInstanceAdded" , function(event) {
* var childView = event.detail;
* document.addEventListener("AF_FormContainerInitialised" , function(event) {
* var formContainer = event.detail;
* // Handle the event
* formcontainer.getFormElement().addEventListener("AF_PanelInstanceAdded" , function(event) {
* var childView = event.detail;
* // Handle the event
* });
* });
*
*/
PANEL_INSTANCE_ADDED : "AF_PanelInstanceAdded",

Expand All @@ -63,9 +68,13 @@ export const Constants = {
* @property {object} event - The event object.
* @property {object} event.detail - Instance of child view that was removed.
* @example
* formcontainer.getFormElement().on("AF_PanelInstanceRemoved" , function(event) {
* var childView = event.detail;
* document.addEventListener("AF_FormContainerInitialised" , function(event) {
* var formContainer = event.detail;
* // Handle the event
* formcontainer.getFormElement().addEventListener("AF_PanelInstanceRemoved" , function(event) {
* var childView = event.detail;
* // Handle the event
* });
* });
*/
PANEL_INSTANCE_REMOVED : "AF_PanelInstanceRemoved",
Expand All @@ -76,7 +85,7 @@ export const Constants = {
* @property {object} event - The event object.
* @property {object} event.detail - The locale that has loaded.
* @example
* document.on("AF_LanguageInitialised" , function(event) {
* document.addEventListener("AF_LanguageInitialised" , function(event) {
* var locale = event.detail;
* // Handle the event
* });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,6 @@ describe("Sites with Aem Embed Container", () => {
cy.get('.cmp-adaptiveform-container').should('have.length', 1);
cy.get('.cmp-adaptiveform-container').find('.cmp-adaptiveform-textinput__widget').should('have.length', 11);
})

it('Test iframe src with dataRef', () => {
cy.visit(pagePath+"?dataRef='testingDataRef'")
cy.get('.cmp-aemform__iframecontent').should('have.attr', 'src').should('include', "?wcmmode=DISABLED&dataRef='testingDataRef'");
});

it('Test iframe src without dataRef', () => {
cy.get('.cmp-aemform__iframecontent').should('have.attr', 'src').should('include', "?wcmmode=DISABLED");
});
})

context('aem embed container in iframe mode with custom height ', function () {
Expand Down
2 changes: 1 addition & 1 deletion ui.tests/test-module/specs/formcontainer.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ describe('Page/Form Authoring', function () {
cy.openEditableToolbar(sitesSelectors.overlays.overlay.component + formContainerEditPathSelector);
cy.invokeEditableAction("[data-action='CONFIGURE']");
// Open auto save tab
cy.get('.cmp-adaptiveform-container'+'__editdialog').contains('Auto-save').click({force:true});
cy.get('.cmp-adaptiveform-container'+'__editdialog').contains('Drafts').click({force:true});
cy.get("coral-checkbox[name='./fd:enableAutoSave']").should("exist");
cy.get("coral-checkbox[name='./fd:enableAutoSave']").click({force:true});
cy.get("coral-select[name='./fd:autoSaveStrategyType']").should("exist");
Expand Down

0 comments on commit c599a34

Please sign in to comment.