Building an Insert bar pop-up menu
The Dreamweaver Insert bar introduces a new organization for objects and now supports pop-up
menus to help organize objects into smaller groups, as shown in the following figure.
The following example builds a new category on the Insert bar called Editorial and then adds a
pop-up menu to that category. The pop-up menu will contain the Strikethrough object from
simple Insert Object example" on page 126
The objects in the Editorial category on the Insert bar let users make editorial comments on a file
and either strikethrough the content they want to remove or make new content blue so from the
rest of the text.
To keep the files organized, create a new Configuration/Objects/Editorial folder in your
Dreamweaver installation folder. Copy the files for the Strikethrough object example you created
to the Editorial folder (Strikethrough.htm, Strikethrough.js, and Strikethrough.gif ).
Next, make the new Blue Text object. Create a new HTML file called AddBlue.htm that contains
the following code:
<html>
<head>
<title>Blue Text</title>
<script language="javascript">
//---------------
function isDOMRequired() {
// Return false, indicating that this object is available in code view.
return false;
}
function objectTag() {
// Manually wrap tags around selection.
var dom = dw.getDocumentDOM();
if (dw.getFocus() == 'textView' || dw.getFocus(true) == 'html'){
var upCaseTag = (dw.getPreferenceString("Source Format", "Tags Upper
Case", "") == 'TRUE');
// Manually wrap tags around selection.
if (upCaseTag){
dom.source.wrapSelection('<FONT COLOR="#0000FF">','</FONT>');
}else{
dom.source.wrapSelection('<font color="#0000FF">','</font>');
}
}else if (dw.getFocus() == 'document'){
132
Chapter 6: Insert Bar Objects
and groups it with a Blue Text object you will create.
API FUNCTIONS
---------------
"A
Need help?
Do you have a question about the DREAMWEAVER MX 2004-EXTENDING DREAMWEAVER and is the answer not in the manual?
Questions and answers