Thread ID: |
Created: |
Updated: |
Platform: |
Replies: |
144048 | Apr 16,2019 07:32 AM UTC | Dec 18,2020 02:00 PM UTC | ASP.NET Core - EJ 2 | 5 |
![]() |
Tags: Rich Text Editor |
@{
List<String> toolsList = new List<string>() { "images" };
List<String> images = new List<string>() { "image" };
}
<ej-rte id="rteSample" width="820px" tools-list="toolsList">
<e-content-template>
<div>
The Rich Text Editor(RTE) control is an easy to render in client side. Customer easy to edit the contents
and get the HTML content for the displayed content. A rich text editor control provides
users with a toolbar that helps them to apply rich text formats to the text entered
in the text area.
</div>
</e-content-template>
<e-image-browser extension-allow="*.png, *.gif, *.jpg, *.jpeg" file-path="/images/FileExplorerContent" ajax-action="@Url.Content("FileActionDefault")">
<e-file-ajax-settings>
<e-download url="/RichTextEditor/Download{0}"></e-download>
<e-get-image url="/RichTextEditor/GetImage{0}"></e-get-image>
<e-upload url="/RichTextEditor/Upload{0}"></e-upload>
</e-file-ajax-settings>
</e-image-browser>
<e-tools images="images"></e-tools>
</ej-rte> |
public FileExplorerOperations operation;
public RichTextEditorController(IHostingEnvironment hostingEnvironment)
{
this.operation = new FileExplorerOperations(hostingEnvironment.ContentRootPath);
}
public ActionResult Upload(FileExplorerParams args)
{
operation.Upload(args.FileUpload, "/wwwroot" + args.Path);
return Json("");
}
public ActionResult Download(FileExplorerParams args)
{
return operation.Download("/wwwroot" + args.Path, args.Names);
}
public ActionResult GetImage(FileExplorerParams args)
{
return operation.GetImage("/wwwroot" + args.Path);
}
public ActionResult FileActionDefault([FromBody] FileExplorerParams args)
{
var Path = "/wwwroot" + args.Path;
try
{
if (args.ActionType != "Paste" && args.ActionType != "GetDetails")
{
var FilePath = operation.GetPhysicalPath(Path);
if (!FilePath.ToLower().Contains("fileexplorercontent"))
throw new ArgumentException(FilePath + "is not accessible. Access is denied.");
}
switch (args.ActionType)
{
case "Read":
return Json(operation.Read(Path, args.ExtensionsAllow));
case "CreateFolder":
return Json(operation.CreateFolder(Path, args.Name));
case "Paste":
return Json(operation.Paste(args.LocationFrom, args.LocationTo, args.Names, args.Action, args.CommonFiles));
case "Remove":
return Json(operation.Remove(args.Names, Path, args.SelectedItems));
case "Rename":
return Json(operation.Rename(Path, args.Name, args.NewName, args.CommonFiles));
case "GetDetails":
return Json(operation.GetDetails(Path, args.Names));
case "Search":
return Json(operation.Search(Path, args.ExtensionsAllow, args.SearchString, args.CaseSensitive));
}
return Json("");
}
catch (Exception e)
{
FileExplorerResponse Response = new FileExplorerResponse();
Response.error = e.GetType().FullName + ", " + e.Message;
return Json(Response);
}
}
} |
Thanks Vinoth for reply, but your solution works only for ASP.NET Core JS1 (jQuery).
I want this solution for ASP.NET Core JS2 (Pure Javascript), and tag helpers in this solution doesn't work with JS2 (Pure JS). (There are completely different!)
e-image-browser & e-tools images tags doesnt' support ejs-richtexteditor.
Is there any solution for the problem?
When I click Insert Image, I have this window:
But I don't the window & need this one:
This post will be permanently deleted. Are you sure you want to continue?
Sorry, An error occured while processing your request. Please try again later.
This page will automatically be redirected to the sign-in page in 10 seconds.