Pergunta

Ao longo em esta questão , Scott escreve que é possível obter o código HTML atual para o que está escrito no FCKeditor usando FCKeditorAPI.__Instances['instanceNameHere'].GetHTML();

Alguém poderia fornecer instruções passo-a-passo sobre como fazer isso em uma página ASP.NET? Tudo o que eu tenho atualmente tão longe no arquivo.aspx é esta:

<%@ 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>
Foi útil?

Solução

Em javascript

Bem, você pode fazer isso aqui:

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

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

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top