Hi - in our app we use your RichTextEditor in Markdown - mode. We have some custom functionality where we generate custom tags and want to insert those in the markdown text.
The inserting works well with something like this:
const textArea = this.rteObj.contentModule.getEditPanel() as HTMLTextAreaElement; textArea.value = ...
but this manipulation does not appear in the undo/redo history.
The RhichTextEditor API offers a method executeCommand() which should do exactly this, but unfortunately the documentation say that this useful method is not implemented for the Markdown-Editor...
https://ej2.syncfusion.com/angular/documentation/rich-text-editor/exec-command/
The officially deprecated but still supported javascript feature document.execCommand() also does not work - it inserts the text but undo/redo history is broken (see also https://www.syncfusion.com/forums/173394/undo-redo-in-richtext-markdown-editor-breaks-when-pasing-text )
document.execCommand('insertText', false, imageTag); // broken undo/redo historyHow can I insert text programatically into the Markdown Editor with correct undo/redo history?
Hi Bernd,
Greetings from Syncfusion support,
We have already considered “Support for 'ExecuteCommand' public method in Rich Text Editor 'Markdown' mode” as a feature request from our end and logged the report for the same, the feature will be included in any of the upcoming 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/33225/
Regards,
Indrajith
I've found it out myself. Of course this was not officially documented anywhere in your documentation, I've "accidentally" found it in the code while stumbling through the Stackblitzes of your examples, so: why is this not documented?
Regarding your documentation: I've stumbled over lots of dead links or wrong links (e.g. clicking on the "open in new window" icon in the example below and landing on a page about the data grid etc...).
The final hint I've found in the code of this example: https://ej2.syncfusion.com/angular/demos/?_gl=1*1bw290r*_ga*MTQxMDI0NjYwOS4xNjI2MTgyODg0*_ga_WC4JKKPHH0*MTY0NjY2MjAyMi4yMS4xLjE2NDY2NjMxOTcuMA..&_ga=2.182009315.591030263.1646639733-1410246609.1626182884#/material/rich-text-editor/insert-special-characters
Digging into the code of your example - especially your onInsert() method: Am I right that
executeCommand() alone wouldn't have solved the issue? ...and that I have to maintain the undo/redo history by hand ?
So the solution I've found for the markdown-editor is something like this:
Hi - regarding the dead links in the documentation - it turned out that this was a strange behavior of my chrome-Browser.
When I've clicked on a link of your documentation, the browser redirected me on a Link that has a "aspnetcoretest" inserted into the original URL which then led led to a dead link.
I've analyzed the network traffic and saw that there were two requests: