Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 Programming Discussions
  #1  
Old 10-05-2011, 03:03 AM
ErnestA ErnestA is offline
 
Join Date: Jan 2009
Posts: 35
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default CKeditor javascript API

I've got the hang of creating my own custom BBCodes with buttons in CKeditor, but I'm a bit stumped with something else I'm trying to do. I've added a few extra fields input type fields to the editor window which get populated automatically with some vBulletin variables (attachment ids). BBCodes buttons are nice, but all they do is add the opening and closing BBCode tags, the user must manually fill the rest in. What I'd like to do is make a simple javascript button which takes the value of the input field I've created and inserts it into the current cursor position of the editor. Does anyone know where I can find the correct functions and methods to do this with the vBulletin / ckEditor? It's really a simple piece of Javascript code, but a bit challenging when you don't know anything about interfacing to the editor.

I found the following reference on ckEditor's site:

CKEDITOR.instances.editor1.insertText( ' line1 \n\n line2' );

But I can't find where and how vBulletin is creating an instance of the editor and what the instance is named...

Any help is greatly appreciated.

Thanks,

Ernest A.
Reply With Quote
  #2  
Old 10-07-2011, 05:16 PM
ErnestA ErnestA is offline
 
Join Date: Jan 2009
Posts: 35
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

OK, so I edited one of my templates and added the following code

Code:
<button onclick="vB_Editor['{vb:raw editorid}'].insertText('This is a test to insert text');">InsertText</button>
But this just submits my post instead of adding the text to the editor... I think I'm on the right track with referencing the instance of the editor... But without documentation it's kinda hard... I'd really appreciate it if someone could throw me some breadcrumbs here .

Thanks,
Reply With Quote
  #3  
Old 10-08-2011, 09:35 AM
fromtheflames fromtheflames is offline
 
Join Date: Dec 2009
Posts: 18
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hi,

I suggest you to use the method I've explained here to load the templates function already present in ckeditor.

Follow that steps, create the plugin and the files .js that contains the templates you want to use; examples are in default.js files in /clientscript/ckeditor/plugins/templates/templates/ dir

Ask if you need help

thomas

--

mmm reading the problem again, it seems that my solution is too far from what you ask

I'm not a js expert, I cannot help you as well
Reply With Quote
  #4  
Old 11-16-2011, 04:56 PM
killer_t killer_t is offline
 
Join Date: Nov 2010
Posts: 27
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I've the same request!
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 07:20 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.03652 seconds
  • Memory Usage 2,173KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)bbcode_code
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (4)post_thanks_box
  • (4)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (4)post_thanks_postbit_info
  • (4)postbit
  • (4)postbit_onlinestatus
  • (4)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete