').html(richTextTitleDiv.innerHTML).text();
+ }
+ }
+ }
+
+ /**
+ * hides the RTE/plain text field on the basis of rich text checkbox and
+ * resolves it's value for enumNAmes/Options.
+ *
+ * @param {HTMLElement} dialog The dialog on which the operation is to be performed.
+ * @param areOptionsRichText is rich text checkbox selected.
+ * @param isToggled is this function being called on toggle of rich text checkbox.
+ */
+ function resolveRichTextOptions(dialog, areOptionsRichText, isToggled) {
+ let enumNames = dialog.find(BASE_ENUMNAMES_VISIBLE),
+ richTextEnumNames = dialog.find(BASE_RICH_TEXT_ENUMNAMES),
+ richTextEnumNamesInput = dialog.find(BASE_WRAPPER_INPUT_RICH_TEXT_ENUMNAMES),
+ richTextEnumNamesDiv = dialog.find(BASE_WRAPPER_VALUE_RICH_TEXT_ENUMNAMES);
+ if(areOptionsRichText != null && areOptionsRichText.checked){
+ for (let i = 0; i < richTextEnumNames.length; i++) {
+ Utils.hideComponent(enumNames[i], "div");
+ Utils.showComponent(richTextEnumNames[i], "div");
+ copyTextValueToRte(enumNames[i], richTextEnumNamesDiv[i]);
+ richTextEnumNamesInput[i].value = enumNames[i].value;
+ }
+ } else {
+ for (let i = 0; i < richTextEnumNames.length; i++) {
+ Utils.hideComponent(richTextEnumNames[i], "div");
+ Utils.showComponent(enumNames[i], "div");
+ if(isToggled){
+ enumNames[i].value = $('
').html(richTextEnumNamesDiv[i].innerHTML).text();
+ }
+ }
+ }
+ }
+
+ function copyTextValueToRte (textElem, richTextElem) {
+ richTextElem.innerHTML = Utils.encodeScriptableTags(textElem.value);
+ }
+
+ function changeTextValue(textValue, richTextValue) {
+ if(textValue && richTextValue) {
+ textValue.value = Utils.encodeScriptableTags(richTextValue.value);
+ }
+ }
+
/**
* Initialise the conditional display of the various elements of the dialog.
*
@@ -162,7 +239,9 @@
*/
function initialise(dialog) {
dialog = $(dialog);
- var baseRequired = dialog.find(BASE_REQUIRED)[0];
+ let baseRequired = dialog.find(BASE_REQUIRED)[0],
+ isTitleRichText = dialog.find(BASE_IS_TITLE_RICH_TEXT)[0],
+ areOptionsRichText = dialog.find(BASE_ARE_OPTIONS_RICH_TEXT)[0];
if (baseRequired) {
handleRequired(dialog, baseRequired);
baseRequired.on("change", function() {
@@ -174,14 +253,69 @@
showHideDoRBindRefField(dialog);
validateName();
handleDialogSubmit(dialog);
- }
-
- channel.on("foundation-contentloaded", function(e) {
- if ($(e.target).find(EDIT_DIALOG).length > 0) {
- Coral.commons.ready(e.target, function(component) {
- initialise(component);
+ if (isTitleRichText) {
+ resolveRichText(dialog, isTitleRichText, false);
+ isTitleRichText.on("change", function() {
+ resolveRichText(dialog, isTitleRichText, true);
});
}
- });
+ if (areOptionsRichText) {
+ resolveRichTextOptions(dialog, areOptionsRichText, false);
+ areOptionsRichText.on("change", function() {
+ resolveRichTextOptions(dialog, areOptionsRichText, true);
+ });
+ }
+ }
+
+ /**
+ * whenever RTE value of enumName is changed, we save it's value corresponding to text value field.
+ */
+ function updateEnumNamesOnChange(){
+ channel.on("change", BASE_WRAPPER_VALUE_RICH_TEXT_ENUMNAMES, function (e) {
+ let richTextValue = channel.find(BASE_WRAPPER_INPUT_RICH_TEXT_ENUMNAMES),
+ textValue = channel.find(BASE_ENUMNAMES_VISIBLE);
+ for(let i=0; i
+ jcr:primaryType="nt:unstructured">
-
+
+ editorType="text">
+ textPropertyName="jcr:title">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/button/v1/button/button.html b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/button/v1/button/button.html
index 67ac6e522b..80e5376592 100644
--- a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/button/v1/button/button.html
+++ b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/button/v1/button/button.html
@@ -39,7 +39,7 @@
data-cmp-data-layer="${button.data.json}"
aria-label="${button.label.visible != false ? '' : button.label.value}">
- ${button.label.value}
+ ${button.label.value @ context = button.label.richText ? 'html' : 'text'}
diff --git a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/checkbox/v1/checkbox/checkbox.html b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/checkbox/v1/checkbox/checkbox.html
index 97e2c2f912..f5316ce0dc 100644
--- a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/checkbox/v1/checkbox/checkbox.html
+++ b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/checkbox/v1/checkbox/checkbox.html
@@ -44,7 +44,7 @@
value="${checkbox.default[0]}"
disabled="${!checkbox.enabled}" />
-
+
diff --git a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/checkboxgroup/v1/checkboxgroup/checkboxgroup.html b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/checkboxgroup/v1/checkboxgroup/checkboxgroup.html
index 500d0965ce..3c524e065c 100644
--- a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/checkboxgroup/v1/checkboxgroup/checkboxgroup.html
+++ b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/checkboxgroup/v1/checkboxgroup/checkboxgroup.html
@@ -35,7 +35,7 @@
data-cmp-adaptiveformcontainer-path="${formstructparser.formContainerPath}"
data-sly-test.widgetId="${'{0}-{1}' @ format=[checkboxgroup.id, 'widget']}">
diff --git a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/checkboxgroup/v1/checkboxgroup/widget.html b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/checkboxgroup/v1/checkboxgroup/widget.html
index 65d6b54424..c35a8c900a 100644
--- a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/checkboxgroup/v1/checkboxgroup/widget.html
+++ b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/checkboxgroup/v1/checkboxgroup/widget.html
@@ -25,7 +25,7 @@
checked="${checkboxgroup.enums[itemList.index] in checkboxgroup.default }"
disabled="${!checkboxgroup.enabled || checkboxgroup.readOnly}"
aria-readonly="${checkboxgroup.readOnly ? 'true' : ''}"/>
-
${checkboxgroup.enumNames[itemList.index]}
+
${checkboxgroup.enumNames[itemList.index] @ context = 'html'}
diff --git a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/container/v2/container/clientlibs/editorhook/js.txt b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/container/v2/container/clientlibs/editorhook/js.txt
index bd72121afc..40008b700d 100644
--- a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/container/v2/container/clientlibs/editorhook/js.txt
+++ b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/container/v2/container/clientlibs/editorhook/js.txt
@@ -20,5 +20,6 @@ componentutils.js
replacehook.js
dorhook.js
copypastehook.js
+toolbaractionhook.js
qualifiedNameHook.js
panelselect.js
diff --git a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/container/v2/container/clientlibs/editorhook/js/toolbaractionhook.js b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/container/v2/container/clientlibs/editorhook/js/toolbaractionhook.js
new file mode 100644
index 0000000000..9610ad0139
--- /dev/null
+++ b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/container/v2/container/clientlibs/editorhook/js/toolbaractionhook.js
@@ -0,0 +1,55 @@
+/*******************************************************************************
+ * Copyright 2023 Adobe
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ ******************************************************************************/
+(function (ns) {
+ "use strict";
+ let superSitesEditorAppendButton = ns.edit.Toolbar.prototype.appendButton;
+
+ /**
+ * @override
+ */
+ ns.edit.Toolbar.prototype.appendButton = function (editable, name, action) {
+ correctEditableEditorType(editable, name);
+ superSitesEditorAppendButton.apply(this, [editable, name, action]);
+ };
+
+ /**
+ * @override
+ * In case of forms editor we are overriding sites toolbar actions and has a custom toolbar implementation.
+ * Therefore, needs a special handling.
+ */
+ if(window.guidelib){
+ var superFormsEditorAppendButton = window.guidelib.touchlib.editToolbar.prototype.appendButton;
+ window.guidelib.touchlib.editToolbar.prototype.appendButton = function (editable, name, action) {
+ //adding this check because we don't want to change editorType for v1 forms.
+ if(window.guidelib.touchlib.utils.checkIfCoreComponentsBasedForm()){
+ correctEditableEditorType(editable, name);
+ }
+ superFormsEditorAppendButton.apply(this, [editable, name, action]);
+ };
+ };
+
+ 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";
+ }
+ }
+ };
+
+}(Granite.author));
diff --git a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/datepicker/v1/datepicker/datepicker.html b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/datepicker/v1/datepicker/datepicker.html
index b4f64bfcc0..4326e7e89d 100644
--- a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/datepicker/v1/datepicker/datepicker.html
+++ b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/datepicker/v1/datepicker/datepicker.html
@@ -32,7 +32,7 @@
data-cmp-adaptiveformcontainer-path="${formstructparser.formContainerPath}"
data-sly-test.widgetId="${'{0}-{1}' @ format=[datePicker.id, 'widget']}">