PDA

View Full Version : Creating a custom editor button to insert text


Emmy2
05-26-2006, 01:02 PM
I wonder if someone can help me with this.

I want to create a new button on the regular and quickreply editors that will insert some pre-defined text into the reply box when it is clicked.

I am aware of this thread (https://vborg.vbsupport.ru/showthread.php?t=102282) that will add extra buttons to the quickreply but those are for features already available on the full reply (like align, font etc.).

What I want to do is create a button for a CUSTOM function that is not anywhere else and that is NOT a custom bbcode.

In other words, a user clicks the button and a phrase like "abcdefghijk" is automatically inserted into the reply box so they don't have to type it themselves. Simply that.

Can this be done?

If it can, a little more complex would be if there was a drop-down menu to choose from several different phrases to insert....but that's not absolutely necessary...getting just the one custom phrase insert would be a tremendous help. I'm not a coder but I can follow directions. Can anyone help me? Thanks so much.

creedmaniac
05-26-2006, 02:33 PM
this would be an awesome hack, it'd be useful to me as well

Krahl
05-27-2006, 04:33 AM
If this is turning into a full-blown request for a mod from one of our outstanding coders, I'll vote for the drop-down, multiple choice version.

Great idea, I hope someone can and will do this one!

Emmy2
05-28-2006, 10:45 AM
can anyone help? is this doable?

Me again. Been spending a lot of time trying to search for a way to do this. Again, I'm not a coder so I'm hampered quite a bit already there. Anyway, from what I've read so far....

Is there some way to use the "onclick" command within a link to do this? Make a button on the editor and "onclick" it returns "this" and puts it in the textarea box. Like the emoticons, that get inserted using "onclick". But instead of inserting :smilie: into the textarea it would insert a string of text that I pre-define.

Is this helping any? Getting closer at all?

Emmy2
05-31-2006, 12:04 PM
If this is turning into a full-blown request for a mod from one of our outstanding coders, I'll vote for the drop-down, multiple choice version.

Great idea, I hope someone can and will do this one!

If anyone is interested I've figured out how to create a button to insert text into the reply box. I've posted it in the Dice Roll thread because we are using it to insert code for a preset dice roll. But it could be used to insert ANY complex bbcode string or text sentence or whatever you wanted to insert with the click of a button.

My code to add one button is on page 6, then others add code to create drown down menus and user interfaces...

https://vborg.vbsupport.ru/showthread.php?t=113972&page=6

ps. unfortunately the code only works with the standard editors. Users would have to click the A/A button to toggle from the wysiwyg editor to standard to use the insert buttons.