UEditorForNetCore2 1.0.0

The owner has unlisted this package. This could mean that the package is deprecated, has security vulnerabilities or shouldn't be used anymore.
dotnet add package UEditorForNetCore2 --version 1.0.0                
NuGet\Install-Package UEditorForNetCore2 -Version 1.0.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="UEditorForNetCore2" Version="1.0.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add UEditorForNetCore2 --version 1.0.0                
#r "nuget: UEditorForNetCore2, 1.0.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install UEditorForNetCore2 as a Cake Addin
#addin nuget:?package=UEditorForNetCore2&version=1.0.0

// Install UEditorForNetCore2 as a Cake Tool
#tool nuget:?package=UEditorForNetCore2&version=1.0.0                

关于UEditorNetCore

百度在线编辑器UEditor在ASP.NET Core下的服务端,使用简单,易于扩展。
相关文章:http://www.cnblogs.com/durow/p/6116393.html
UEditor官网:http://ueditor.baidu.com/website/index.html  
UEditor源代码:https://github.com/fex-team/ueditor    

安装

Install-Package UEditorForNetCore2

使用

1.在Startup.cs的ConfigureServices方法中添加UEditorNetCore服务

public void ConfigureServices(IServiceCollection services)
{
    //第一个参数为配置文件路径,默认为项目目录下config.json
    //第二个参数为是否缓存配置文件,默认false
    services.AddUEditorService()
    services.AddMvc();
}

2.添加Controller用于处理来自UEditor的请求

[Route("api/[controller]")] //配置路由
public class UEditorController : Controller
{
    private UEditorService ue;
    public UEditorController(UEditorService ue)
    {
        this.ue = ue;
    }

    public void Do()
    {
        ue.DoAction(HttpContext);
    }
}

3.修改前端配置文件ueditor.config.js

修改serverUrl为第2步Controller中配置的路由,使用例子中的路由按照以下配置:

serverUrl:"/api/UEditor"

4.修改服务端配置config.json

上传类的操作需要配置相应的PathFormat和Prefix,在示例中部署在web根目录,因此Prefix都设置为"/"。使用时要根据具体情况配置。 例如示例中图片上传的配置如下:

"imageUrlPrefix": "/", /* 图片访问路径前缀 */
"imagePathFormat": "upload/image/{yyyy}{mm}{dd}/{time}{rand:6}", 

5.添加javascript引用

<script type="text/javascript" charset="utf-8" src="~/lib/ueditor/ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="~/lib/ueditor/ueditor.all.min.js"> </script>
<script type="text/javascript" charset="utf-8" src="~/lib/ueditor/lang/zh-cn/zh-cn.js"></script>

扩展

如果需要扩展action,可以在Startup.cs的ConfigureServices方法中进行。

添加新的action

public void ConfigureServices(IServiceCollection services)
{
    services.AddUEditorService()
        .Add("test", context =>
        {
            context.Response.WriteAsync("from test action");
        })
        .Add("test2", context =>
        {
            context.Response.WriteAsync("from test2 action");
        });
    services.AddMvc();
}

以上代码扩展了名字为test和test2两个action,作为示例仅仅返回了字符串。在扩展时可以读取Config配置,并使用已有的Handler。

覆盖现有action

上面的Add方法除了添加新action外还可以覆盖现有action。例如现有的action可能不符合你的要求,可以Add一个同名的action覆盖现有的。

移除action

如果要移除某个action,可以使用Remove方法。

public void ConfigureServices(IServiceCollection services)
{
    services.AddUEditorService()
        .Remove("test");
    services.AddMvc();
}

以上代码移除了名为test的action。

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated