tinymce / tinymce-blazor

Blazor integration
MIT License
45 stars 13 forks source link

How to insert HTML content at cursor point ? #35

Closed alex241175 closed 2 years ago

alex241175 commented 2 years ago

In javascript, we can insert content using command tinyMce.editor.execCommand('mceInsertContent', false, noteText); How to do this in Blazor context?

exalate-issue-sync[bot] commented 2 years ago

Ref: INT-2757

jscasca commented 2 years ago

Hey @alex241175 unfortunately, the Blazor component currently doesn't have that implemented (yet). You would have to access the editor via the JS side of things to run that command.

Can you tell me more about your particular use case? We can probably expose a component function to insert the content if needed.

kgbhun commented 2 years ago

I would need this feature too. I want to insert the line of a video selected from an external dropdow at the cursor position

jscasca commented 2 years ago

I made #44 to address this. You should be able to have something like this: <Editor @ref="MyEditor" /> and then call MyEditor.insertContent("My content").

@kgbhun @alex241175 would this work for your current use cases?

kgbhun commented 2 years ago

Thanks, that would be great. In the meantime, I bridged it with a javascript call, but it would be nice if it was built in originally

                    <Editor @ref="editor"

ApiKey='' Field="() => model.WorkflowContent" @@." @." /> JSRuntime.InvokeVoidAsync("insertHTML",editor.Id,"something");

jscasca @.***> ezt írta (időpont: 2022. ápr. 6., Sze, 7:39):

I made #44 https://github.com/tinymce/tinymce-blazor/pull/44 to address this. You should be able to have something like this: <Editor @ref="MyEditor" /> and then call MyEditor.insertContent("My content").

@kgbhun https://github.com/kgbhun @alex241175 https://github.com/alex241175 would this work for your current use cases?

— Reply to this email directly, view it on GitHub https://github.com/tinymce/tinymce-blazor/issues/35#issuecomment-1089840635, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANAWSD2BHMCQ3J46UHBPRY3VDUPPRANCNFSM5NWAVLJA . You are receiving this because you were mentioned.Message ID: @.***>

jscasca commented 2 years ago

This feature was added and it's available in our latest release v1.0.2