Ver Mensaje Individual
  #1 (permalink)  
Antiguo 11/05/2012, 17:35
WalkmanXZ
 
Fecha de Ingreso: abril-2010
Ubicación: Mexico
Mensajes: 21
Antigüedad: 14 años
Puntos: 0
Busqueda Ckeditor, plugin BBcode

Estoy intentando crear un plugin BBcode para el Ckeditor (el de VB4 solo que usado en otro sistema), por ahora tengo esto, segun tutoriales y etc... el plugin agrega correctamente el boton al editor, pero no he tenido suerte para hacer que agregue el BBCODE, no busco preformatear el bbcode con wysiwyg, si no que me inserte [spoiler\]LALALALAL[/spoiler\]....

Código Javascript:
Ver original
  1. CKEDITOR.plugins.add( 'spoiler',
  2. {
  3.     init: function( editor )
  4.     {
  5.         editor.addCommand( 'insertSpoiler',
  6.             {
  7.                 exec : function( editor )
  8.                 {    
  9. //                  var timestamp = new Date();
  10. //                  editor.insertHtml( 'The current date and time is: <em>' + timestamp.toString() + '</em>' );
  11.    
  12.                 var myEditor = CKEDITOR.instances.thepost;
  13.                 var mySelection = editor.getSelection();
  14.  
  15.                 if (CKEDITOR.env.ie) {
  16.                     mySelection.unlock(true);
  17.                     theSelectedText = mySelection.getNative().createRange().text;
  18.                 } else {
  19.                     theSelectedText = mySelection.getNative();
  20.                 }
  21.  
  22.                 var FormattedText = '[spoiler]'+theSelectedText+'[/spoiler]';
  23.                 myEditor.insertHtml(FormattedText);
  24.  
  25.                 }
  26.             });
  27.         editor.ui.addButton( 'Spoiler',
  28.         {
  29.             label: 'Insert Spoiler',
  30.             command: 'insertSpoiler',
  31.             icon: this.path + 'images/spoiler.png'
  32.         } );
  33.     }
  34. } );

Si alguien tiene nocion con este tema, me serviria demaciado

EDIT: solucionado, gracias y disculpen el thread

Última edición por WalkmanXZ; 11/05/2012 a las 17:45