MenuCoranto Docs
Coranto LinksPmWiki Home |
Addons /
QuickTagsOn this page... (hide) Addon Author: Susan E. Stoner DescriptionFrom the addon docs by Sue Stoner: QuickTags is a simple addon that will add buttons to the News Text field allowing users to insert selected HTML tags to news posts quickly and easily. QuickTags will work with MSIE and Gecko-based browsers (Mozilla, Camino, Firefox, Netscape). QuickTags will not work correctly with browsers that do not support inserting at the cursor position (Opera, Safari, OmniWeb). QuickTags will append tags to the end of the content in unsupported browsers. Javascript must be enabled. QuickTags has been tested with Coranto v 1.23 and 1.24. It should also work with older and newer versions of Coranto, but has not been tested. QuickTags is not compatible with the WebWriter or HTMLBuilder Addons. QuickTags comes with tags defined for bold, italic, underline, Mailto, and Link. QuickTags is based on JS Quicktags by Alex King. Using QuickTagsQuickTags adds buttons above the text entry field that can be used to insert html (or just about any other text into the text field. ![]() This image shows an installation where custom tags have been added. You simply click on the tag for the code you want to insert and it is inserted at the cursor in supported browsers. If the tag has both an open and close tag the button will change to the close tag after the open tag is inserted. If text is highlighted the tags are inserted before and after the text. On a browser that does not support inserting at the cursor position the tags are inserted at the end of the text in the field, so you can still use QuickTags as you enter the text. Customizing the TagsQuickTags depends on javascript to work. This section will not be a javascript tutorial, but will show you how to add and modify the tags that are available for you to use. How It All WorksThis function: function edButton(id, display, tagStart, tagEnd, frmtTag, open) {
this.id = id; // used to name the toolbar button
this.display = display; // label on button
this.tagStart = tagStart; // open tag
this.tagEnd = tagEnd; // close tag
this.frmtTag = frmtTag // for display separator
this.open = open; // set to -1 if tag does not need to be closed
}
defines the structure of each button. The comments tell us what each line of the button definition does. So this button: edButtons[edButtons.length] = new edButton('ed_br'
,'BR'
,'<br />'
,''
,' '
,-1
);
would be used for the html break tag.
So to add a new tag you simply copy a tag definition and edit it to fit your needs. edButtons[edButtons.length] = new edButton('ed_test'
,'Test'
,'This is a test.'
,''
,''
,-1
);
The above tag definition would insert the text This is a test. when clicked. edButtons[edButtons.length] = new edButton('ed_ul'
,'UL'
,'<ul>'
,'</ul>'
,''
);
This tag definition inserts the opening and closing tags for an unordered list. Pop-Up Information EntryedButtons[edButtons.length] = new edButton('ed_link'
,'Link'
,''
,'</a>'
); // special case
This is the tag definition for entering a url to create a link. You will notice that the information for the opening tag is missing. In the script there is a series of routines to handle special cases like this. This is done by checking the id of the button clicked and then taking action based on that id. if (button.id == 'ed_link') { The javascript above will cause a pop-up input window to open where the URL can be typed or pasted. Formatting the Tag DisplayYou can format the tag display to group tags together and to display multiple rows of tags. ![]() You can use any valid html as separators. Possibilities include:
Notes and Warnings
Further ReadingEmpty Field Bug and Solution You can leave comments using this form. |