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.

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'));
}
| improve this answer | |
  • brilliant. Now where in the documentation did you find that gem? :) – Bryan Jun 12 '18 at 2:38
  • 1
    its linked above, first sentence "change handler event" – glls Jun 12 '18 at 3:08
  • @glls How we can get the change even if we have used lightning:inputRichText in aura iteration? – Sagar Thoriya Oct 17 '18 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 Oct 17 '18 at 13:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.