Skip to content

Commit

Permalink
FORMS-16201 Register auto save in publish(disabled) mode only
Browse files Browse the repository at this point in the history
  • Loading branch information
girotraapankaj committed Sep 19, 2024
1 parent e1a2739 commit d1005a3
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -373,4 +373,9 @@ public String getName() {
return FormContainer.super.getName();
}

@JsonIgnore
public AutoSaveConfiguration getAutoSaveConfig() {
return autoSaveConfig;

Check warning on line 378 in bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/models/v2/form/FormContainerImpl.java

View check run for this annotation

Codecov / codecov/patch

bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/models/v2/form/FormContainerImpl.java#L378

Added line #L378 was not covered by tests
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
*/
#setupAutoSave(formModel) {
const autoSaveProperties = formModel?.properties?.['fd:autoSave'];
const enableAutoSave = autoSaveProperties?.['fd:enableAutoSave'];
const enableAutoSave = this.#getAutoSaveAttribute();
if (enableAutoSave) {
const autoSaveStrategyType = autoSaveProperties['fd:autoSaveStrategyType'];
const autoSaveInterval = autoSaveProperties['fd:autoSaveInterval'];
Expand All @@ -96,6 +96,10 @@
}
}
}

#getAutoSaveAttribute() {
return this.getFormElement()?.getAttribute('data-cmp-auto-save') === 'true';
}
}

async function onDocumentReady() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
data-sly-use.templates="core/wcm/components/commons/v1/templates.html"
action="${container.metadata.action}"
id="${container.id}"
data-cmp-auto-save="${wcmmode.disabled && container.autoSaveConfig && container.autoSaveConfig.enableAutoSave ? 'true' : 'false'}"
data-cmp-is="adaptiveFormContainer"
data-cmp-context-path="${request.contextPath}"
data-cmp-page-lang="${container.containingPageLang}"
Expand All @@ -61,4 +62,4 @@
</div>
</form>
<div data-cmp-adaptiveform-container-loader="${container.id}"></div>
</sly>
</sly>

0 comments on commit d1005a3

Please sign in to comment.