2024年4月20日 星期六

[研究]ASP.NET,WebForm,試用Quill 2.0.0 WYSIWYG HTML editor 套件

[研究]ASP.NET,WebForm,試用Quill 2.0.0 WYSIWYG HTML editor 套件

2024-04-20

環境:Visual Studio 2022 + ASP.NET + WebForm + Web Application + C# + SQL Server 2019 + SQL Server Management Studio (SSMS) 19

官方網站:https://quilljs.com/

https://github.com/quilljs/quill/releases

目前最新2.0.0,2024-04-17釋出。

********************************************************************************

Default.aspx

<%@ Page Language="C#" AutoEventWireup="true"
    CodeBehind="Default.aspx.cs" Inherits="WebApplication1.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>
<%--    <link href="https://cdn.quilljs.com/1.3.7/quill.snow.css" rel="stylesheet" />
    <script src="https://cdn.quilljs.com/1.3.7/quill.js"></script>--%>
    <link href="https://cdn.jsdelivr.net/npm/quill@2.0.0/dist/quill.snow.css" rel="stylesheet" />
    <script src="https://cdn.jsdelivr.net/npm/quill@2.0.0/dist/quill.js"></script>
</head>
<body>
    <form id="form1" runat="server">
        <div>
            <div id="editor"></div>
            <asp:Button ID="btnSubmit" runat="server" Text="Submit" OnClick="btnSubmit_Click" />
        </div>
    </form>

    <script>
        var quill = new Quill('#editor', {
            theme: 'snow'
        });
    </script>
</body>
</html>



Default.aspx.cs

using System;

namespace WebApplication1
{
    public partial class Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
        }
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            string quillContent = Request.Form["editor"];
            Response.Write("<script>alert('" + quillContent + "')</script>");
        }
    }
}



(完)

相關

沒有留言:

張貼留言