2011-01-28 22 views
10
código

Mi CKEditor es¿Obtiene el contenido de CKEditor? - jQuery

window.onload = function() 
{ 
    var editor = CKEDITOR.replace(\'big_info\'); 
    CKEDITOR.config.height = \'330px\'; 
    CKEDITOR.config.toolbar_Full = 
    [ 
     [\'Source\',\'-\',\'Templates\'], 
     [\'Maximize\', \'ShowBlocks\'], 
     [\'Cut\',\'Copy\',\'Paste\',\'PasteText\',\'PasteFromWord\',\'-\',\'SpellChecker\', \'Scayt\'], 
     [\'Undo\',\'Redo\',\'-\',\'Find\',\'Replace\',\'-\',\'SelectAll\',\'RemoveFormat\'], 
     [\'TextColor\',\'BGColor\'], 

     [\'NumberedList\',\'BulletedList\',\'-\',\'Outdent\',\'Indent\',\'Blockquote\'], 
     \'/\', 
     [\'Bold\',\'Italic\',\'Underline\',\'Strike\',\'-\'], 
     [\'Styles\',\'Format\',\'Font\',\'FontSize\'], 
     [\'JustifyLeft\',\'JustifyCenter\',\'JustifyRight\',\'JustifyBlock\'], 
     [\'Link\',\'Unlink\',\'Anchor\'], 
     [\'Image\',\'Flash\',\'Table\',\'HorizontalRule\',\'PageBreak\'] 
    ]; 

    CKFinder.SetupCKEditor(editor, { BasePath : \'/javascript/ckfinder/\', RememberLastFolder : false }) ; 
}; 

quiero tomar el contenido de la caja de edición y enviarlo a través de JSON desde mi script jQuery. No puedo encontrar cómo hacerlo.

Respuesta

36

Esto se explica en el integration Guide

var editor_data = CKEDITOR.instances.big_info.getData(); 

Se puede utilizar también la integración de jQuery como se explica en el CKEditor blog y jQuery integration docs

// Get the editor data. 
var data = $('textarea.editor').val(); 
// Set the editor data. 
$('textarea.editor').val('my new content'); 
Cuestiones relacionadas