How can I enable live preview for FCKeditor in an ASP.Net site?

泪湿孤枕 提交于 2019-12-02 04:35:44

问题


Over in this question, Scott writes that it is possible to get the current HTML for what's written in the FCKeditor by using FCKeditorAPI.__Instances['instanceNameHere'].GetHTML();

Could someone provide step-by-step instructions on how to accomplish this in an ASP.NET page? All I currently have so far in the .aspx file is this:

<%@ Register Assembly="FredCK.FCKeditorV2" Namespace="FredCK.FCKeditorV2" TagPrefix="FCKeditorV2" %>
<%@ Page Title="" Language="C#" ... %>
<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
<h2>Create a new piece</h2>
<form id="form1" runat="server">

<FCKeditorV2:FCKeditor ID="FCKeditor1" runat="server">
</FCKeditorV2:FCKeditor>

<input id="Submit1" type="submit" value="Submit" runat="server" />
</form>
</asp:Content>

回答1:


In javascript

Well you can do this here:

<script type="text/javascript">
    var oEditor = FCKeditorAPI.GetInstance(’IDFromFCKEditor’);
    oEditor.Events.AttachEvent( 'OnSelectionChange', function() {
        document.getElementById("PreviewDiv").innerHTML = oEditor.GetHTML(true);
    }) ;
</script>

Source http://docs.fckeditor.net/FCKeditor_2.x/Developers_Guide/JavaScript_API



来源:https://stackoverflow.com/questions/293854/how-can-i-enable-live-preview-for-fckeditor-in-an-asp-net-site

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!