Ver Mensaje Individual
  #5 (permalink)  
Antiguo 08/12/2009, 16:39
Avatar de chalchis
chalchis
 
Fecha de Ingreso: julio-2003
Mensajes: 1.773
Antigüedad: 21 años, 6 meses
Puntos: 21
Respuesta: Cargar tinyMCE dinámicamente

ok creo que ya entendi quieres generar campos dinamicos con javascript
bueno mira trate de hacer un ejmplo usando un ejemplo del sitio del editor

Código:
<script type="text/javascript" src="<your installation path>/tiny_mce/tiny_mce.js"></script>
02.
<script type="text/javascript">
03.
function setup() {
04.
tinyMCE.init({
05.
mode : "textareas",
06.
theme : "advanced",
07.
plugins : "safari,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template",
08.
theme_advanced_buttons1 : "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect,fontselect,fontsizeselect",
09.
theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor",
10.
theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen",
11.
theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,pagebreak",
12.
theme_advanced_toolbar_location : "top",
13.
theme_advanced_toolbar_align : "left",
14.
theme_advanced_statusbar_location : "bottom",
15.
theme_advanced_resizing : true
16.
});
17.
}
18.
</script>
19.
 
20.
<form method="post" action="somepage">
21.
<textarea name="content" style="width:100%">
22.
</textarea>
23.
<a href="javascript:setup();">Load TinyMCE</a>
24.
</form>
ahora probe usando un script para generar los textarea
de este site solo hay que modificarlo para que cree textearea en lugar de input text

http://www.mredkj.com/tutorials/tableaddrow.html

ahora carga las propiedades del editor en una funcion
asi como mencione en el sitio oficial viene un ejemplo
http://tinymce.moxiecode.com/examples/example_12.php
Código:
<script type="text/javascript">
function setup() {
tinyMCE.init({
mode : "textareas",
theme : "advanced",
plugins : "safari,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template",
theme_advanced_buttons1 : "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect,fontselect,fontsizeselect",
theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor",
theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen",
theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,pagebreak",
theme_advanced_toolbar_location : "top",
theme_advanced_toolbar_align : "left",
theme_advanced_statusbar_location : "bottom",
theme_advanced_resizing : true
});
}
</script>
ahora pueba creando los textarea ya sea usando tu script o el que pongo
de ejmplo inserta esta linea siguientes en alguna parte body de la pagina
despues de crear los textares ejecuta la función yu veras que todo los textareas
se les cargara el estilo del editor, solo hay que ver ahora como cargarse de manera
automativa, disculpa que escriba asi de rapido pero voy de salida

Código:
ejemplo
<body>
<a href="javascript:setup();">Load TinyMCE</a>
.
.
.
</body
saludos
__________________
gerardo