|
I am working on admin back-end for my personal project and I need a script similar to WYSIWYG editor. I have looked at many ready-to use scripts but all of them are incredibly bloated, trying to completely mimic real word processors not to mention they use old tags like <b> for bold or <br> for line breaks and sometimes they even break the web page style.
All I need is 7 buttons that apply to any <textarea> with some given ID. The buttons I need are:
“B” for wrapping highlighted text in <strong> </strong> tags
“I” for wrapping highlighted text in <i> </i> tags
“U” for wrapping highlighted text in <u> </u> tags
“SUB” for wrapping highlighted text in <sub> </sub> tags
“SUP” for wrapping highlighted text in <sup> </sup> tags
and
“Link” button, which when clicked shows a small popup window where I can type the desired URL and then it wraps the selected text into <a href=”URL as typed” class=”tlink”> </a>. The "tlink" class is my personal style that I will use once the site is up and running, so I need it there.
Also, the “Enter” key stroke should result in <br /> being added to the end of the line and then move down.
If possible I'd also like a colour picker with either a grid of 8 or 16 basic colours. The ideal functionality would be a “COL” button, which when clicked shows a small popup window where I can choose the desired colour and wraps the highlighted text in <span style=”color: #HEXcolorcode;”> </span> tags.
I do not need those tags to be hidden from writers view. They can be visible as soon as I hit the appropriate button. Like I said, this is for admin back-end use, so it doesn't have to behave like those big time WYSIWYG scripts.
I don't know how easy or difficult this is to do for anyone who knows JS, but except for “Link”, “COL” and “ENTER” key functionality it seems like a lot of repetitive code, which makes me hopeful that I'll find somebody willing to do this. I don't want any <p> tags or font types, font sizes, image insertions, undo, redo, bulletpoint, unlink, smilies etc, etc.
I have already made the buttons, but I am no good with JavaScript so I want to ask you guys for help. Can someone please write that script for me?
In the attachment you'll find my buttons
__________________
THE FORCE is with me at last! All I need now is some TALKUPATION ;)
|