Closed rahul-dealroom closed 2 years ago
_toggleShowLinkInput() seems to be firing twice when the link button is pressed. Adding event.stopPropagation() should fix it.
okay thanks @robert-commonsku this fix/change needs to be done on the library itself right?
Yes. I have no affiliation with this library except as a user. I just noticed this problem when I upgraded react. I was able to resolve it by monkey-patching node_modules/react-rte/dist/react-rte.js to include a call to stopPropagation in the _toggleShowLinkInput function.
Where exactly would i put the event.stopPropogation function? This is where I have it currently and am not seeing a change in behavior.
Am I referencing the wrong variable?
{key:"_toggleShowLinkInput",value:function(t){t.stopPropagation();var e=this.state.showLinkInput;if(e){var n=!0;if(t&&"click"===t.type){var r=ut.a.findDOMNode(this).parentNode,i=document,o=i.activeElement;null==o||o===document.body||r.contains(o)||(n=!1)}n&&this.props.focusEditor()}this.setState({showLinkInput:!e})}}
The t.shopPropagation();
at the beginning of the function is what I added to resolve this issue.
Amazing thank you so much
On Thu, Jun 24, 2021 at 4:50 PM robert-commonsku @.***> wrote:
{key:"_toggleShowLinkInput",value:function(t){t.stopPropagation();var e=this.state.showLinkInput;if(e){var n=!0;if(t&&"click"===t.type){var r=ut.a.findDOMNode(this).parentNode,i=document,o=i.activeElement;null==o||o===document.body||r.contains(o)||(n=!1)}n&&this.props.focusEditor()}this.setState({showLinkInput:!e})}} The t.shopPropagation(); at the beginning of the function is what I added to resolve this issue.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/sstur/react-rte/issues/409#issuecomment-867942622, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGNK3JAADYRK33PBT2AJJWLTUOLBPANCNFSM46XD3WYQ .
-- Jim Tisdale, Full Stack Web Developer program, Thinkful.com
I added this commit in our own repo https://github.com/schooltracs/react-rte/commit/1d1ca8f122a139bdb2f31d2d10ede0a7e24c7596
The code fix for react 17 not necessarily work with react-dom 17 especially with the link popover part