Adobe 38040334 - Dreamweaver CS3 User Manual page 117

Extending dreamweaver
Hide thumbs Also See for 38040334 - Dreamweaver CS3:
Table of Contents

Advertisement

This line identifies the beginning of the Common category on the Insert bar.
2
Start a new line after the category tag; then insert the
for the Strikethrough object.
The ID must be a unique name for the button (following standard naming conventions, use
DW_Text_Strikethrough
the supporting files, as shown here:
_
_
<button id="DW
Text
Strikethrough"
image="Text\Strikethrough.gif"
file="Text\Strikethrough.htm"/>
3
Save the insertbar.xml file.
Reload the extensions (see "Reloading extensions" on page 74).
4
The new object appears at the beginning of the Common category on the Insert bar, as shown in the following figure:
Adding a dialog box
You can add a form to your object to let the user enter parameters before Dreamweaver inserts the specified code
(for example, the Hyperlink object requests the text, link, target, category index, title, and access key values from the
user). In this example, you add a form to the Strikethrough object from the previous example. The form opens a
dialog box that provides the user with the option to change the text color to red as well as add the strike-through tag.
This example assumes you have already created a separate JavaScript file called Strikethrough.js.
First, in Strikethrough.js, you add the function that the form calls if the user changes the text color. This function is
similar to the
objectTag()
To create the function:
After the
1
objectTag()
following code:
function fontColorRed(){
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="#FF0000">','</FONT>');
}else{
dom.source.wrapSelection('<font color="#FF0000">','</font>');
}
}else if (dw.getFocus() == 'document'){
dom.applyFontMarkup("color", "#FF0000");
}
// Just return -- don't do anything else.
return;
}
for this object). The
image
function for the Strikethrough object, but is an optional function.
function in Strikethrough.js, create a function called
tag and assign it the
button
and
attributes simply tell Dreamweaver the location of
file
fontColorRed()
DREAMWEAVER CS3
Extending Dreamweaver
,
, and
attributes
id
image
file
by entering the
111

Advertisement

Table of Contents
loading

This manual is also suitable for:

Dreamweaver cs3

Table of Contents