Created
October 31, 2021 14:36
-
-
Save amitastreait/97c8219f401896a742d1c02437b20d3e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<design:component> | |
<design:attribute name="value" description="The value for RichText Area Component"/> | |
<design:attribute name="label" description="The Label for RichText Area Component"/> | |
<design:attribute name="required" description="Input is required or not value should be true or false"/> | |
<design:attribute name="placeholder" description="The place holder"/> | |
</design:component> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<aura:component implements="lightning:availableForFlowScreens" > | |
<!-- Attributes --> | |
<aura:attribute name="value" type="String" /> | |
<aura:attribute name="label" type="String" /> | |
<aura:attribute name="required" type="Boolean" /> | |
<aura:attribute name="placeholder" type="String" /> | |
<!-- Handlers --> | |
<aura:handler name="init" value="{!this}" action="{!c.doInit}"/> | |
<aura:attribute name="validate" type="Aura.Action"/> | |
<!-- | |
isValid = true/false | |
errorMessage - | |
--> | |
<lightning:inputRichText labelVisible="true" | |
label="{!v.label}" | |
required="{!v.required}" | |
variant="bottom-toolbar" | |
value="{!v.value}" | |
placeholder="{!v.placeholder}"> | |
<lightning:insertImageButton/> | |
</lightning:inputRichText> | |
</aura:component> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
({ | |
doInit : function(component, event, helper) { | |
var error = 'Please complete required information.'; | |
component.set('v.validate', function() { | |
if( component.get("v.required") && !component.get("v.value") ) { | |
return { | |
isValid: false, | |
errorMessage: error | |
} | |
}else{ | |
return { | |
isValid: true, | |
errorMessage: error | |
} | |
} | |
}); | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment