How can I enable live preview for FCKeditor in an

2019-02-25 21:26发布

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条回答
Explosion°爆炸
2楼-- · 2019-02-25 21:28

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

查看更多
登录 后发表回答