Hello!
I want to grab MS Word (usually in .rtf format) from the server side by calling custom API method that returns it in a format of: content="base64 string", contentType = "application/octet-stream", and then insert into RTE component. I expect it to work like as I get open .rtf file through MS Word and then copy\paste it content directly into RTE.
Basically, i have a table that lists existing files and once I click a Document Name link, the logic will get a file content fron the server and insert it into RTE.
Currently I am using "value" property and not sure how to set the content dynamically. My guess is about using a blob, but i am not certain in an approach.
I am able to convert file content into a Blob, but direct setting it as value to RTE does not work:
When I am receiving rtf file content type as "application/octet-stream" with byteArray content, I see the following text in RTE:
Thanks in advance!
|
export class Default extends SampleBase {
val = '<p>Test</p>';
buttonClick() {
this.rteObj.executeCommand('insertHTML', this.val);
}
render() {
return (
<div className="control-pane">
<div className="control-section" id="rte">
<div className="rte-control-section">
<button
className="e-control e-btn dlgbtn"
ref={this.buttonRef}
onClick={this.buttonClick.bind(this)}
id="dialogBtn"
>
{' '}
Insert HTML
</button>
<RichTextEditorComponent
id="defaultRTE"
ref={(richtexteditor) => {
this.rteObj = richtexteditor;
}}
>
<Inject
services={[HtmlEditor, Toolbar, Image, Link, QuickToolbar]}
/>
</RichTextEditorComponent>
</div>
</div>
</div>
);
}
} |
Thanks for the clarification.
That what i was thinking about.