Edit text saved in tinymce?

0

I try to understand how it is possible to obtain the content I keep from the tinymce editor, and then edit it when I re-enter the data, try the basics in terms of code, save the information and display it correctly in other pages, but I can not edit what you saved from iframe .

tinyMCE.init({
    // Opciones generales
    mode : "textarea_especifico",
    editor_selector : "mceEditor"
});

console.debug(tinyMCE.activeEditor.getContent());

tinyMCE.activeEditor.getContent({format : 'raw'});

tinyMCE.get('textarea_especifico').getContent()

I use version 4.3 of tinymce. If someone knows how to do what I ask in another wysiwyg, they can also put the way they did to guide me.

    
asked by Guillermo Navarro 07.08.2016 в 02:40
source

1 answer

1

I did something similar with Tinymce with PHP, javascript and HTML, if it works:

For the Tynmce script

$('textarea.editable').tinymce({
    //Ruta del archivo
    script_url : '../js/tiny_mce/tiny_mce.js',
    //El modo en que va a operar, normalmente se recomiendan textareas
    mode:"textareas",
    // Opciones generales
    theme : "advanced",
    plugins:"preview",
    // Las opciones del tema
    theme_advanced_buttons1 : "bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,styleselect,formatselect,fontselect,fontsizeselect",
    theme_advanced_buttons2 : "undo,redo,|,forecolor,backcolor,|,preview",
    theme_advanced_toolbar_location : "top",
    theme_advanced_toolbar_align : "left",
    theme_advanced_statusbar_location : "bottom",
    theme_advanced_resizing : true                        
});

To save what exists in the textarea, I simply put it in a form and with its submit button

<form name="formulario" id="formulario">
     <textarea class="editable"></textarea>
     <button type="submit" id="boton_ini" name="boton_ini" class="tbtnazul">Guardar</button>
 </form>

Note: Here it depends on how many things you want to send.

Afterwards, in the submit I sent the content to a php function to update the document.

For example for the project you use with Postgresql

pg_send_query_params($conexiondb, 'UPDATE constancia SET constrech = $documento WHERE material = $id;', array($id, $documento));
$res = pg_get_result($conexiondb);
$codErr = pg_result_error_field($res, PGSQL_DIAG_SQLSTATE);
pg_free_result($res);
if($codErr !== null && $codErr !== ''){ return obtener_ErrorDB($codErr); }
return true;

That would be an example of how to update your content and if you want to enter the content just print a PHP VARIABLE with your SELECT query.

    
answered by 07.08.2016 в 09:55