Instead of trying to use a full WYSIWYG editor, I think it'd already be good if we enhance the current editor(f.e. ScrypTik Javascript Editor
, Antechinus JavaScript Editor or 1st JavaScript Editor
) with some simple javascript.
Here's what I did:// I changed EditTemplate.jsp (or editcontent.jsp, depending on the template)
- Add a link to a javascript file in the header
<script src="wikiedit.js" type="text/javascript"></script>
- Give the form with the textarea the name EditForm (to better reference this in javascript)
- Add buttons to do the various actions. eg.
<input type="button" name="Bold" value="Bold" onClick="javascript:bold(document.editForm.text)" />
Create a file wikiedit.js
function insertDate(textField){
s = textField.value ;
sel= s.substring( textField.selectionStart, textField.selectionEnd );
before= s.substring( 0, textField.selectionStart);
after= s.substring( textField.selectionEnd );
textField.value = before+ ' __'+sel+ '__ '+after;
textField.setFocus();
}
I was thinking of buttons for:
- Adding simple formatting like bold, italic, H1
- Insert date and time values / UserName
- Create tables!
I'd like to see this working. Not so much for editing basics like bold, italics, etc. But for more typing intensive stuff I could see the buttons being useful. If they were user customizable "macro" like buttons that'd be ideal I think. How about "Sign" or "Signature" to automatically put -- Your Name, Month Day Year --JohnV, Jan-20 2005 <grin/>
JSPWiki 2.5.x has FCK Editor integration, currently worked on by David Au!
--JanneJalkanen, 13-Mar-2007
Actually, the BrushedTemplate currently has these 'JavaScript buttons' (not shown in the screenshots). Another template that also has these buttons is the SmallpieceTemplate2. I could also see it being useful for some if the plain-text editor for the default template had maybe a subset of these buttons -- unless that would make it problematic or would be considered 'overextending' the plain-text editor. But then again, the new link suggestion feature utilizes AJAX, so it's not just a plain textarea anymore.
--David Au, 13-Mar-2007