[研究][ASP.NET][WebForm]CKFinder 3.5.11 + CKEditor 試用(Zip安裝)(二)
2020-09-03
注意,CKFinder是付費套件,免費版會不定時跳出 Demo Version 訊息。
續這篇
[研究][ASP.NET][WebForm]CKFinder 3.5.11 試用(Zip安裝)
https://shaurong.blogspot.com/2020/09/aspnetwebformckfinder-3511-zip.html
Default.aspx 內容如下
********************************************************************************
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="CKSource.CKFinder.Connector.WebApp.Default" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title></title>
<script src="Scripts/ckeditor/ckeditor.js"></script>
<script src="CKFinderScripts/ckfinder.js"></script>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:TextBox ID="TextBox1" runat="server" TextMode="MultiLine" Height="200px" Width="200px"></asp:TextBox><br />
<asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button1_Click" style="height: 21px" /><br />
<br />
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
<%--操作 TextBox1 的 JavaScript 必須寫在該 Id 物件之下,不能寫 <head></head>區域--%>
<script type="text/javascript">
// https://ckeditor.com/docs/ckfinder/ckfinder3-net/integration.html#integration_embedding
var editor = CKEDITOR.replace('TextBox1');
CKFinder.setupCKEditor(editor);
</script>
</div>
</form>
</body>
</html>
********************************************************************************
using System;
namespace CKSource.CKFinder.Connector.WebApp
{
public partial class Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
}
}
}
********************************************************************************
********************************************************************************
var editor = CKEDITOR.replace('TextBox1');
可依需求調整類似如下:
var editor = CKEDITOR.replace('TextBox1',
{
filebrowserBrowseUrl: '/CKFinderScripts/ckfinder.html',
filebrowserImageBrowseUrl: '/CKFinderScripts/ckfinder.html?type=Images',
filebrowserUploadUrl: '/CKFinderScripts/connector?command=QuickUpload&type=Files',
filebrowserImageUploadUrl: '/CKFinderScripts/connector?command=QuickUpload&type=Images'
});
若是在 ContentPlaceHolder 中,改要成類似如下:(依實際情況而變動)
var editor = CKEDITOR.replace('ContentPlaceHolder1_TextBox_WinnersContent');
********************************************************************************
(完)
沒有留言:
張貼留言