We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Rich Text Editor - Upload images by custom events

Good day.

I met one problem with uploading images inside SharePoint.
I can't implement my own special endpoint for it and I need use OOTB provided endpoints.
Can you advise approach where I can catch 'image selected' event and override 'image uploading' event insideRichTextEditorComponent component?

5 Replies

RK Revanth Krishnan Syncfusion Team January 20, 2020 12:57 PM UTC

Hi Pavel, 
 
Greetings from Syncfusion support. 
 
Query 1: `To use 'image selected' event and override 'image uploading' event inside rich text editor component’ 
 
We have validated your requirement, and we suggest you to refer the below code snippet, sample and documentation link mentioned below. 
 
Code Snippet: 
 
export class ImageSample extends SampleBase { 
    constructor() { 
        super(...arguments); 
        this.insertImageSetting = { 
            saveUrl: 'https://aspnetmvc.syncfusion.com/services/api/uploadbox/Save' 
        }; 
    } 
    imageUploading(e) { 
       console.log('image uplaoding event called'); 
    } 
    imageSelected() { 
      console.log('image selected event called'); 
    } 
    render() { 
        return (<div className='control-pane'> 
                <div className='col-lg-8'> 
                    <div className='control-section' id="rteAPI"> 
                        <div className='rte-control-section'> 
                            <RichTextEditorComponent id="imageRTE" ref={(richtexteditor) => { this.rteObj = richtexteditor; }} insertImageSettings={this.insertImageSetting}  imageUploading={this.imageUploading.bind(this)} imageSelected={this.imageSelected.bind(this)}> 
                                    <p>Rich Text Editor allows to insert images from online source as well as local computer where you want to insert the image in your content.</p> 
                                <Inject services={[HtmlEditor, Toolbar, Image, Link, QuickToolbar]}/> 
                            </RichTextEditorComponent> 
                        </div> 
                    </div> 
                </div> 
              </div>); 
    } 
} 
 
 
Please find the documentation link for the image upload event, 
 
Query 2: I met one problem with uploading images inside SharePoint. I can't implement my own special endpoint for it and I need use OOTB provided endpoints. 
 
Currently we are validating the above query with high priority, we will update further details on or before 22nd Jan 2020. 
 
Thanks 
Revanth 



IS Indrajith Srinivasan Syncfusion Team January 23, 2020 01:34 PM UTC

Hi Pavel,

Good day to you

Whether the provided solution for using the “image uploading” and “image selected” in RichTextEditor meets your requirements. Please let us know if you need any further assistance on this.

Regards,
 
Indrajith 



PD Pavel Danilchyk January 27, 2020 01:46 PM UTC

Good day. 
I think not. 
As example:
SharePoint provides 2 different endpoints for upload big files  like:
/_api/web/getfilebyserverrelativeurl('{0}')/startupload(uploadId=guid'{1} /_api/web/getfilebyserverrelativeurl('{0}')/finishupload(uploadId=guid'{1}',fileOffset={2}) /_api/web/getfilebyserverrelativeurl('{0}')/continueupload(uploadId=guid'{1}',fileOffset={2}) + special headers 

Anyway we decided to skip this feature in current moment.

+ One more note regading Upload Image:
  /**
     * Event triggers when a dialog is opened.
     * @event
     * @blazorProperty 'DialogOpened'
     * @blazorType DialogOpenEventArgs
     */
    dialogOpen?: EmitType<Object>; This action provides possibility to catch dialog and dialog content as DOM element for linkDialog(LinkModule), and doesn't provide- for UploadImage dialog. Looks like content rendered after dialog component creation in js.



RK Revanth Krishnan Syncfusion Team January 28, 2020 10:55 AM UTC

Hi Pavel, 
 
Query : Dialog open event doesn't have the DOM element content for UploadImage dialog. Looks like content rendered after dialog component creation. 
 
We have validated the reported issue and able to reproduce the issue from our end, we confirmed “Dialog open event doesn't return the element content in the image dialog” as a defect from our end and logged a report for the same. We will include the fix in the patch release which is expected on  11th Feb. 
 
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: 
 
Thanks 
Revanth 



IS Indrajith Srinivasan Syncfusion Team February 11, 2020 03:08 PM UTC

Hi Pavel, 
 
Thanks for your patience, 
 
We have resolved the issue “Dialog open event doesn't return the element content in the image dialog” with ImageDialog in RichTextEditor and the fix is now available with the package version 17.4.49. We have also prepared a sample based on your requirement. 
 
 
Can you please update the package to this version to resolve the issue from your end ? 
 
Regards, 
Indrajith 


Loader.
Up arrow icon