Text content does not show on copy paste

Hi, 

We are trying to copy paste more then 500 char. but content is not showing till 500 char. also (It shows blank)
Desired output, It should show content till 500 char. even Maxlength text cross with validation.


HTML
======
<ejs-richtexteditor #iframeRTE id='iframeRTE'
                    [toolbarSettings]='tools'
                    [showCharCount]='true'
                    [enableResize]='false'
                    [height]='height'
                    [maxLength]='maxLength'
                    placeholder="Write/ Paste text here. Max length 500 characters.">
</ejs-richtexteditor>

TS
====
private _value: string;
public height = 200;
public maxLength = 500;
public iframe: IFrameSettingsModel = {
  enable: false
};
public inlineMode: object = {
  enable: true,
  onSelection: true
};




7 Replies

RK Revanth Krishnan Syncfusion Team February 11, 2021 02:12 PM UTC

Hi Sujeet, 
 
 
Greetings from Syncfusion support. 
 
 
We have validated your query “When the MaxLength is set to 500 and pasting the content more than 500, but still, the content up to 500 is not showing”. 
 
This is the default behavior of the Rich Text Editor, where pasting the contents more than the ‘MaxLength’ will restrict the paste operation. Also it is not feasible to achieve this use case in the Rich Text Editor. 
 
Please let us know if you need any further assistance. 
 
Regards, 
Revanth 



LL Lam Le May 27, 2022 07:49 AM UTC

Hi Revanth,

I'm having this problem too.
Can you help me trim text if text input is more than the max length?

Regards.


BS Buvana Sathasivam Syncfusion Team June 1, 2022 01:07 PM UTC

Hi Lam,


If you wish to trim or change the pasted content into the Rich Text Editor component, you can remove the maxLength property, check the character counts, and trim the text as per your wish using the afterPasteCleanup event. Please find the below code and sample for your reference.

app.component.html

<ejs-richtexteditor (afterPasteCleanup)="afterPasteCleanup($event)">………

  </ejs-richtexteditor>


app.component.ts

public afterPasteCleanup(eany): void {

    // Here, you can able to trim or change the copied content

    if (this.rteObj.getText().length > 500) {

      e.value = '<p>Changed or trimmed text</p>';

    }

  }


Sample: https://stackblitz.com/edit/angular-e8zjhy?file=app.component.html,app.component.ts,app.component.css


API link: https://ej2.syncfusion.com/angular/documentation/api/rich-text-editor#afterpastecleanup


Regards,

Buvana S



LL Lam Le replied to Buvana Sathasivam June 7, 2022 03:20 AM UTC

Hi  Buvana S,

Thanks, for your support for me.

If remove the maxLength property, the customer will input the characters more than the maxlength. ​I don't want the customer could do it. 

Can you support the afterPasteCleanup event emits an: error and value if the characters more than the maxlength. ​I trim the text copied content and  executeCommand  value for rich text.


Regards,

Lam



BS Buvana Sathasivam Syncfusion Team June 9, 2022 01:15 PM UTC

Hi Lam,


Currently, we are not allowed to paste content into Rich Text Editor content when it exceeds the maxLength property. So, we have considered “Need to indicate warning message when pasted content exceeds the maxLength property” as a uncertain feature request from our end and the fix will be included with any of our releases.


You can now track the current status of the report, review the proposed resolution timeline, and contact us for any further inquiries through this link:

https://www.syncfusion.com/feedback/35545/need-to-indicate-warning-message-when-pasted-content-exceeds-the-maxlength


Regards,

Buvana S



LL Lam Le replied to Buvana Sathasivam June 13, 2022 10:29 AM UTC

Thanks for your support for me.



BS Buvana Sathasivam Syncfusion Team June 14, 2022 08:10 AM UTC

You're welcome! Please track the status of the feature in the below feedback link.

https://www.syncfusion.com/feedback/35545/need-to-indicate-warning-message-when-pasted-content-exceeds-the-maxlength


Loader.
Up arrow icon