Pregunta

En esta pregunta, Scott escribe que es posible obtener el HTML actual de lo que está escrito en el FCKeditor usando FCKeditorAPI.__Instances['instanceNameHere'font>.GetHTML();

¿Podría alguien proporcionar instrucciones paso a paso sobre cómo lograr esto en una página ASP.NET? Todo lo que tengo hasta ahora en el archivo .aspx es esto:

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

Solución

En javascript

Bueno, puedes hacer esto aquí:

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

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

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top