I have a <lightning:inputRichText>
whose value I can initialize properly like so:
Controller:
init : function(component, event, helper) {
component.find("body").set("v.value", "<p>This will be init properly once I switch to ContentNote</p>");
}
Component:
<lightning:inputRichText aura:id="body" />
However, if I move the line
component.find("body").set("v.value", "<p>This will be init properly once I switch to ContentNote</p>");
from the init to a different method, the <lightning:inputRichText>
value won't be initialized. It's only the <lightning:inputRichText>
that's causing a problem.
If I switch the <lightning:inputRichText>
to a <lightning:input type="text">
, it's initialized fine!
The method follows below, along with the component markup. I stripped it down to the minimum that would reproduce the issue - any help at all would be appreciated.
Method:
showPanel : function(component, event, helper) {
var overlay = component.find("overlay");
$A.util.removeClass(overlay, "slds-hide");
component.find("body").set("v.value", "<p>This will be init properly once I switch to ContentNote</p>");
}
Component:
<aura:component controller="EditOverlayController">
<lightning:button label="Set InputRichText Value" onclick="{!c.showPanel}"/>
<div aura:id="overlay" class="slds-hide slds-align--absolute-center" style="position:fixed;width:100%;height:100%;left:0;top:0;background:rgba(51,51,51,0.9);z-index:10;">
<label class="slds-form-element__label">Body</label>
<lightning:inputRichText aura:id="body" />
</div>
</aura:component>