Skip to content

Scribble component #1569

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 18 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ private ReservedProperties() {
public static final String FD_ENABLE_AUTO_SAVE = "fd:enableAutoSave";
public static final String FD_AUTO_SAVE_STRATEGY_TYPE = "fd:autoSaveStrategyType";
public static final String FD_AUTO_SAVE_INTERVAL = "fd:autoSaveInterval";
public static final String FD_DIALOG_LABEL = "fd:dialogLabel";

public static final String FD_XFA_SCRIPTS = "fd:xfaScripts";

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~ Copyright 2025 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.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/

package com.adobe.cq.forms.core.components.internal.models.v1.form;

import java.util.Map;

import org.apache.sling.api.SlingHttpServletRequest;
import org.apache.sling.api.resource.Resource;
import org.apache.sling.models.annotations.Default;
import org.apache.sling.models.annotations.Exporter;
import org.apache.sling.models.annotations.Model;
import org.apache.sling.models.annotations.injectorspecific.InjectionStrategy;
import org.apache.sling.models.annotations.injectorspecific.ValueMapValue;
import org.jetbrains.annotations.NotNull;

import com.adobe.cq.export.json.ComponentExporter;
import com.adobe.cq.export.json.ExporterConstants;
import com.adobe.cq.forms.core.components.internal.form.ReservedProperties;
import com.adobe.cq.forms.core.components.models.form.Scribble;
import com.adobe.cq.forms.core.components.util.AbstractFieldImpl;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;

@Model(
adaptables = { SlingHttpServletRequest.class, Resource.class },
adapters = { Scribble.class, ComponentExporter.class },
resourceType = "core/fd/components/form/scribble/v1/scribble")
@Exporter(
name = ExporterConstants.SLING_MODEL_EXPORTER_NAME,
extensions = ExporterConstants.SLING_MODEL_EXTENSION)
public class ScribbleImpl extends AbstractFieldImpl implements Scribble {

@ValueMapValue(injectionStrategy = InjectionStrategy.OPTIONAL)
@JsonInclude(JsonInclude.Include.NON_EMPTY)
private String value;

@ValueMapValue(injectionStrategy = InjectionStrategy.OPTIONAL, name = ReservedProperties.FD_DIALOG_LABEL)
@Default(values = Scribble.DEFAULT_DIALOG_LABEL)
protected String dialogLabel;

@Override
public String getValue() {
return value;
}

@JsonIgnore
public String getDialogLabel() {
return dialogLabel;
}

@Override
public @NotNull Map<String, Object> getProperties() {
Map<String, Object> customProperties = super.getProperties();
if (getDialogLabel() != null)
customProperties.put(ReservedProperties.FD_DIALOG_LABEL, getDialogLabel());
return customProperties;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~ Copyright 2024 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.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/

package com.adobe.cq.forms.core.components.models.form;

import org.osgi.annotation.versioning.ConsumerType;

/**
* Defines the form Scribble Sling Model used for the Scribble component.
*
* @since com.adobe.cq.forms.core.components.models.form 5.11.0
*/
@ConsumerType
public interface Scribble extends Field {

String DEFAULT_DIALOG_LABEL = "Please sign here";

/**
* Returns the base64 encoded string of the scribble.
*
* @return Base64 encoded string representing the scribble
* @since com.adobe.cq.forms.core.components.models.form 5.11.0
*/
String getValue();

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"id": "scribble-178a5c65c2",
"fieldType": "text-input",
"name": "scribble1710484027357",
"value": "",
"type": "string",
"label": {
"value": "Scribble"
},
"events": {
"custom:setProperty": [
"$event.payload"
]
},
"properties": {
"fd:dor": {
"dorExclusion": false
},
"fd:path": "/content/forms/af/scribbletest/jcr:content/guideContainer/scribble"
},
":type": "forms-components-examples/components/form/scribble"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:cq="http://www.day.com/jcr/cq/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0"
jcr:primaryType="cq:Component"
jcr:title="Adaptive Form Scribble"
jcr:description="Add a field to capture scribble signature."
sling:resourceSuperType="core/fd/components/form/scribble/v1/scribble"
componentGroup="Core Components Examples - Adaptive Form"/>
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:nt="http://www.jcp.org/jcr/nt/1.0" xmlns:cq="http://www.day.com/jcr/cq/1.0" xmlns:fd="http://www.adobe.com/aemfd/fd/1.0"
jcr:primaryType="nt:unstructured"
jcr:title="Scribble"
fd:dialogLabel="Please sign here"
placeholder="Type Your Signature Here"
fieldType="scribble"/>
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:nt="http://www.jcp.org/jcr/nt/1.0" xmlns:cq="http://www.day.com/jcr/cq/1.0" xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:fd="http://www.adobe.com/aemfd/fd/1.0"
jcr:primaryType="cq:Page">
<jcr:content
cq:lastModified="{Date}2025-05-13T10:52:13.652+05:30"
cq:lastModifiedBy="admin"
cq:tags="[]"
cq:template="/conf/core-components-examples/settings/wcm/templates/content-page"
jcr:description="Text Input"
jcr:primaryType="cq:PageContent"
jcr:title="Text Input"
sling:resourceType="forms-components-examples/components/page">
<root
jcr:primaryType="nt:unstructured"
sling:resourceType="wcm/foundation/components/responsivegrid">
<responsivegrid
jcr:primaryType="nt:unstructured"
sling:resourceType="wcm/foundation/components/responsivegrid">
<text_1740702241
cq:styleIds="[1644862132301]"
jcr:created="{Date}2019-02-15T19:05:53.032+01:00"
jcr:createdBy="admin"
jcr:lastModified="{Date}2025-05-13T10:46:48.636+05:30"
jcr:lastModifiedBy="admin"
jcr:primaryType="nt:unstructured"
sling:resourceType="core/wcm/components/text/v2/text"
text="&lt;h1>&lt;sub>Scribblev1&lt;/sub>&lt;/h1>&#xd;&#xa;"
textIsRich="true"/>
<text
cq:styleIds="[1544762734201]"
jcr:created="{Date}2018-12-06T19:11:23.947+01:00"
jcr:createdBy="admin"
jcr:lastModified="{Date}2025-05-13T10:51:01.755+05:30"
jcr:lastModifiedBy="admin"
jcr:primaryType="nt:unstructured"
sling:resourceType="core/wcm/components/text/v2/text"
text="&lt;p>A Scribble component&amp;nbsp; allows users to manually draw or input their signature using a mouse. This component is commonly used in forms that require user authentication, acknowledgment, or consent.&lt;/p>&#xd;&#xa;&lt;p>The Scribble component can be placed within a form and is typically accompanied by a label that clearly indicates its purpose. It captures freehand input as image data and can be stored as a base64 image or transmitted as part of the form data.&lt;/p>&#xd;&#xa;"
textIsRich="true"/>
<teaser
cq:styleIds="[1550165685463]"
jcr:created="{Date}2019-02-14T16:41:54.952+01:00"
jcr:createdBy="admin"
jcr:description="&lt;p>GitHub&lt;/p>&#xd;&#xa;"
jcr:lastModified="{Date}2025-05-13T10:52:13.639+05:30"
jcr:lastModifiedBy="admin"
jcr:primaryType="nt:unstructured"
jcr:title="Technical Documentation"
sling:resourceType="core-components-examples/components/teaser"
actionsEnabled="false"
altValueFromDAM="true"
descriptionFromPage="false"
fileReference="/content/dam/core-components-examples/library/github-logo.svg"
imageFromPageImage="false"
isDecorative="false"
linkTarget="_self"
linkURL="https://github.com/adobe/aem-core-forms-components/tree/master/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/scribble/v1/scribble"
textIsRich="true"
titleFromPage="false"/>
<title_865328580
cq:styleIds="[1544759664489]"
jcr:created="{Date}2018-12-06T19:22:23.729+01:00"
jcr:createdBy="admin"
jcr:lastModified="{Date}2018-12-06T19:23:25.116+01:00"
jcr:lastModifiedBy="admin"
jcr:primaryType="nt:unstructured"
jcr:title="Examples"
sling:resourceType="core/wcm/components/title/v2/title"
type="h2"/>
<title_290384408
cq:styleIds="[1544759676459]"
jcr:created="{Date}2018-12-06T19:22:48.620+01:00"
jcr:createdBy="admin"
jcr:lastModified="{Date}2019-05-22T11:01:40.926+03:00"
jcr:lastModifiedBy="admin"
jcr:primaryType="nt:unstructured"
jcr:title="Standard"
sling:resourceType="core/wcm/components/title/v2/title"
type="h3"/>
<text_1337506761
jcr:created="{Date}2018-12-06T19:23:41.968+01:00"
jcr:createdBy="admin"
jcr:lastModified="{Date}2019-05-22T11:26:32.604+03:00"
jcr:lastModifiedBy="admin"
jcr:primaryType="nt:unstructured"
sling:resourceType="core/wcm/components/text/v2/text"
text="&lt;p>The component, simply displaying placeholder data.&lt;/p>"
textIsRich="true"/>
<demo
jcr:created="{Date}2018-12-07T12:55:03.496+01:00"
jcr:createdBy="admin"
jcr:lastModified="{Date}2018-12-07T12:55:03.496+01:00"
jcr:lastModifiedBy="admin"
jcr:primaryType="nt:unstructured"
sling:resourceType="forms-components-examples/components/demo">
<component
jcr:primaryType="nt:unstructured"
sling:resourceType="forms-components-examples/components/demo/component">
<guideContainer
fd:version="2.1"
jcr:primaryType="nt:unstructured"
sling:resourceType="forms-components-examples/components/form/container"
fieldType="form">
<container
jcr:primaryType="nt:unstructured"
sling:resourceType="forms-components-examples/components/demo/component">
<scribble
jcr:created="{Date}2025-05-13T10:42:40.868+05:30"
jcr:createdBy="admin"
jcr:lastModified="{Date}2025-05-13T10:42:40.868+05:30"
jcr:lastModifiedBy="admin"
jcr:primaryType="nt:unstructured"
jcr:title="Scribble"
sling:resourceType="forms-components-examples/components/form/scribble"
fieldType="scribble"
name="scribble1747113160904"/>
<textinput_demo
jcr:created="{Date}2019-03-06T14:11:01.819+01:00"
jcr:createdBy="admin"
jcr:lastModified="{Date}2019-05-21T18:59:35.605+03:00"
jcr:lastModifiedBy="admin"
jcr:primaryType="nt:unstructured"
jcr:title="Text Input"
sling:resourceType="forms-components-examples/components/form/textinput"
description="&lt;p>This is a long description.&lt;/p>"
fieldType="text-input"
name="textinput_demo1747112925773"
placeholder="Enter text here"
tooltip="&lt;p>This is a short description.&lt;/p>"
tooltipVisible="true"/>
</container>
</guideContainer>
</component>
<info
jcr:primaryType="nt:unstructured"
sling:resourceType="core-components-examples/components/tabs">
<properties
cq:panelTitle="Properties"
jcr:primaryType="nt:unstructured"
sling:resourceType="core-components-examples/components/demo/properties"
reference="../../component/guideContainer/container"/>
<markup
cq:panelTitle="Markup"
jcr:primaryType="nt:unstructured"
sling:resourceType="core-components-examples/components/demo/markup"
reference="../../component/guideContainer/container"/>
<json
cq:panelTitle="JSON"
jcr:primaryType="nt:unstructured"
sling:resourceType="core-components-examples/components/demo/json"
reference="../../component/guideContainer/container"/>
</info>
</demo>
</responsivegrid>
</root>
</jcr:content>
</jcr:root>
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:rep="internal"
jcr:mixinTypes="[rep:AccessControllable]"
jcr:primaryType="sling:Folder"
hidden="true"/>
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:nt="http://www.jcp.org/jcr/nt/1.0" xmlns:cq="http://www.day.com/jcr/cq/1.0" xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:fd="http://www.adobe.com/aemfd/fd/1.0"
jcr:primaryType="cq:Page">
<jcr:content
cq:deviceGroups="[/etc/mobile/groups/responsive]"
cq:lastModified="{Date}2025-05-12T11:21:33.952+05:30"
cq:lastModifiedBy="admin"
cq:template="/conf/core-components-examples/settings/wcm/templates/af-blank-v2"
fd:ignoreTranslationInvalidation="{Boolean}true"
jcr:language="en"
jcr:primaryType="cq:PageContent"
jcr:title="Scribble Form"
sling:configRef="/conf/forms/scribble-form/"
sling:resourceType="forms-components-examples/components/page">
<guideContainer
fd:version="2.1"
jcr:primaryType="nt:unstructured"
sling:resourceType="forms-components-examples/components/form/container"
dorType="none"
fieldType="form"
thankYouOption="page"
themeRef="/libs/fd/af/themes/canvas"
title="Scribble Form">
<scribble_1246399518
jcr:created="{Date}2025-05-12T11:16:08.171+05:30"
jcr:createdBy="admin"
jcr:lastModified="{Date}2025-05-12T11:16:39.856+05:30"
jcr:lastModifiedBy="admin"
jcr:primaryType="nt:unstructured"
jcr:title="Scribble"
sling:resourceType="forms-components-examples/components/form/scribble"
description="&lt;p>This is long description&lt;/p>&#xd;&#xa;"
enabled="{Boolean}true"
fieldType="scribble"
hideTitle="false"
name="scribble_12463995181747028768202"
textIsRich="[true,true,true]"
tooltip="&lt;p>This is short description&lt;/p>&#xd;&#xa;"
tooltipVisible="true"
unboundFormElement="{Boolean}false"
visible="{Boolean}true"/>
</guideContainer>
</jcr:content>
</jcr:root>
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
cssProcessor="[default:none,min:none]"
jsProcessor="[default:none,min:none]"
categories="[core.forms.components.runtime.all]"
embed="[core.forms.components.runtime.base,core.forms.components.container.v2.runtime,core.forms.components.datePicker.v1.runtime,core.forms.components.textinput.v1.runtime,core.forms.components.numberinput.v1.runtime,core.forms.components.panelcontainer.v1.runtime,core.forms.components.radiobutton.v1.runtime,core.forms.components.text.v1.runtime,core.forms.components.checkboxgroup.v1.runtime,core.forms.components.button.v1.runtime,core.forms.components.image.v1.runtime,core.forms.components.dropdown.v1.runtime,core.forms.components.fileinput.v3.runtime,core.forms.components.accordion.v1.runtime,core.forms.components.tabs.v1.runtime,core.forms.components.wizard.v1.runtime,core.forms.components.verticaltabs.v1.runtime,core.forms.components.recaptcha.v1.runtime,core.forms.components.checkbox.v1.runtime,core.forms.components.fragment.v1.runtime,core.forms.components.switch.v1.runtime,core.forms.components.termsandconditions.v1.runtime, core.forms.components.hcaptcha.v1.runtime,core.forms.components.review.v1.runtime, core.forms.components.turnstile.v1.runtime]"/>
embed="[core.forms.components.runtime.base,core.forms.components.container.v2.runtime,core.forms.components.datePicker.v1.runtime,core.forms.components.textinput.v1.runtime,core.forms.components.numberinput.v1.runtime,core.forms.components.panelcontainer.v1.runtime,core.forms.components.radiobutton.v1.runtime,core.forms.components.text.v1.runtime,core.forms.components.checkboxgroup.v1.runtime,core.forms.components.button.v1.runtime,core.forms.components.image.v1.runtime,core.forms.components.dropdown.v1.runtime,core.forms.components.fileinput.v3.runtime,core.forms.components.accordion.v1.runtime,core.forms.components.tabs.v1.runtime,core.forms.components.wizard.v1.runtime,core.forms.components.verticaltabs.v1.runtime,core.forms.components.recaptcha.v1.runtime,core.forms.components.checkbox.v1.runtime,core.forms.components.fragment.v1.runtime,core.forms.components.switch.v1.runtime,core.forms.components.termsandconditions.v1.runtime, core.forms.components.hcaptcha.v1.runtime,core.forms.components.review.v1.runtime, core.forms.components.turnstile.v1.runtime,core.forms.components.scribble.v1.runtime]"/>
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0"
jcr:primaryType="sling:Folder"/>
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:nt="http://www.jcp.org/jcr/nt/1.0"
jcr:primaryType="nt:unstructured">

</jcr:root>
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:cq="http://www.day.com/jcr/cq/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0"
cq:icon="abc"
jcr:description="Add a field to capture scribble signature."
jcr:primaryType="cq:Component"
jcr:title="Adaptive Form Scribble (v1)"
sling:resourceSuperType="core/fd/components/form/base/v1/base"
componentGroup=".core-adaptiveform"/>
Loading