nnn
nn
nIn this tutorial, I will show you step by step process on how to use Jodit Editor in your ASP.Net Core application including support for file upload.
n
nnnnnn
n
nJodit Basic Setup
nIt is pretty straight forward to set up and use Jodit Editor. Just download the latest version.
n
nInclude the CSS and javascript like so:n
n
n
nOr Via CDN like so:n
n
n
nnUsage
nAnd some textarea element like so:
n
nAfter this, you can init Jodit plugin.n
n
nWith this simple setup, fire open your project in browser, you should get a screen like this:nn
n
n
n
nHowever, if you click on the insert image button the only option you have by default if you want to insert image the url field.
n
n
n
nAdding Support for File Upload
n
nThe following code example illustrates how to handle image upload on your server using .Net Core as a server-side language.
nnnnn
nWe will create an ActionResult in the HomeController that will be responsible for the file upload like so:
n
nnnThe code is self-explanatory, but the very important part of it is the response format will must always be the way it is so that Jodit will be able to read it on the client-side. We will see this in a moment.
n
nThe next thing we have to do is to update the Jodit javascript initialization like so:
n
nnnWith this update, run your project and you should be able to choose a file for upload and display on the editor. See below:
n
n
nI hope this helps someone. Happy coding!
nnn
n