公告 |
PJ3富文本编辑器FCKeditor换成UEditor
作者:admin 日期:2024-09-17
在UEditor官网github.com/fex-team/ueditor/releases下载ASP版本文件(ueditor1_4_3_3-utf8-asp.zip),解压到PJBlog根目录UEditor文件夹中,然后按照下边方法修改即可。
第一步:创建一个新的asp文件(UEditor.asp)
ASP/Visual Basic代码
- <%
- Class UEditor
- private sBasePath
- private sInstanceName
- private sWidth
- private sHeight
- private sToolbarSet
- private sValue
- Private Sub Class_Initialize()
- sBasePath = "/UEditor"
- sWidth = "100%"
- sHeight = "200px"
- sToolbarSet = "Default"
- sValue = ""
- End Sub
- Public Property Let BasePath( basePathValue )
- sBasePath = basePathValue
- End Property
- Public Property Let InstanceName( instanceNameValue )
- sInstanceName = instanceNameValue
- End Property
- Public Property Let Width( widthValue )
- sWidth = widthValue
- End Property
- Public Property Let Height( heightValue )
- sHeight = heightValue
- End Property
- Public Property Let ToolbarSet( toolbarSetValue )
- sToolbarSet = toolbarSetValue
- End Property
- Public Property Let Value( newValue )
- If ( IsNull( newValue ) or IsEmpty( newValue ) ) Then
- sValue = ""
- Else
- sValue = newValue
- End If
- End Property
- ' Generates the instace of the editor in the HTML output of the page.
- Public Sub Create( instanceName )
- response.write CreateHtml( instanceName )
- end Sub
- ' Returns the html code that must be used to generate an instance of UEditor.
- Public Function CreateHtml( instanceName )
- dim html
- html = ""
- '加载编辑器的容器
- html = html & Replace(Replace(Replace(Replace("<script id=""{0}"" name=""{0}"" type=""text/plain"" style=""width:{1};height:{2};"">{3}</script>", "{0}", instanceName), "{1}", sWidth), "{2}", sHeight), "{3}", sValue)
- '实例化编辑器
- If sToolbarSet="Basic" Then
- html = html & Replace("<script type=""text/javascript"">UE.getEditor('{0}', {toolbars: [['fullscreen', 'source', 'undo', 'redo', 'bold']]});</script>", "{0}", instanceName)
- Else
- html = html & Replace("<script type=""text/javascript"">UE.getEditor('{0}', {toolbars: [['fullscreen', 'source', '|', 'customstyle', 'paragraph', 'fontfamily', 'fontsize', '|','indent', 'justifyleft', 'justifycenter', 'justifyright', 'justifyjustify', '|','undo', 'redo', '|','bold', 'italic', 'underline', 'fontborder', 'strikethrough', 'superscript', 'subscript', 'removeformat', 'formatmatch', 'autotypeset', 'blockquote', 'pasteplain', '|', 'forecolor', 'backcolor', 'selectall', 'cleardoc', '|','link', 'unlink', 'anchor', '|','simpleupload', 'insertimage', 'emotion', 'insertvideo', 'music', 'attachment', 'map', 'pagebreak', 'template', 'background', '|','date', 'time', 'spechars', 'snapscreen', '|','touppercase', 'tolowercase', '|','inserttable', 'deletetable', 'insertparagraphbeforetable', 'insertrow', 'deleterow', 'insertcol', 'deletecol', 'mergecells', 'mergeright', 'mergedown', 'splittocells', 'splittorows', 'splittocols']]});</script>", "{0}", instanceName)
- End If
- CreateHtml = html
- End Function
- Public Sub LoadScript()
- dim html
- html = ""
- html = html & "<script type=""text/javascript"" charset=""utf-8"" src=""" & sBasePath & "/ueditor.config.js""></script>"
- html = html & "<script type=""text/javascript"" charset=""utf-8"" src=""" & sBasePath & "/ueditor.all.min.js""> </script>"
- html = html & "<script type=""text/javascript"" charset=""utf-8"" src=""" & sBasePath & "/lang/zh-cn/zh-cn.js""></script>"
- Response.Write(html)
- End Sub
- End Class
- %>
第二步:修改blogpost.asp
- 删除
ASP/Visual Basic代码
- <!--#include file="FCKeditor/fckeditor.asp" -->
2.添加
ASP/Visual Basic代码
- <!--#include file="UEditor/UEditor.asp" -->