2

I'm trying to capture changes to a Lightning app rich text editor. Using the following...

<lightning:inputRichText value="{!v.body}" aura:id="iBody" />

I've tried adding onBlur="{!c.blurBody}" but it doesn't fire. I also tried adding change, keyup, updateOn and blur and all are rejected by the developer console editor. Does anyone know where there is documentation on this component? Or which events work to get updates as the content changes?

By the way, I also tried <ui:inputRichText /> but as soon and I add the isRichText="true" attribute the developer console rejects the component.

FIELD_INTEGRITY_EXCEPTION Failed to save myCmp.cmp: The attribute "change" was not found on the COMPONENT markup://lightning:inputRichText: Source

I'm working with Summer 18 on a developer edition.

1 Answer 1

3

You can add a change handler event which basically does that, tracks changes on specified values:

component.cmp

<aura:component implements="forceCommunity:availableForAllPageTypes" access="global" >
    <aura:attribute name="myVal" type="String" />
    <aura:handler name="change" value="{!v.myVal}" action="{!c.handleValueChange}"/>

    <lightning:inputRichText value="{!v.myVal}" aura:id="grr"/>
</aura:component>

controller.js

    handleValueChange:function(cmp){
    console.log("value: " + cmp.get('v.myVal'));
}
4
  • brilliant. Now where in the documentation did you find that gem? :)
    – Bryan
    Commented Jun 12, 2018 at 2:38
  • 1
    its linked above, first sentence "change handler event"
    – glls
    Commented Jun 12, 2018 at 3:08
  • @glls How we can get the change even if we have used lightning:inputRichText in aura iteration? Commented Oct 17, 2018 at 12:43
  • it doesnt change anything, not sure what issue you are encountering, but feel free to open a new question if you are g etting any errors or unexpected behaviors
    – glls
    Commented Oct 17, 2018 at 13:03

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .