Adobe Extending Dreamweaver CS4 User Manual

Page 124

Advertising
background image

118

EXTENDING DREAMWEAVER CS4

Insert bar objects

•

Strike through the content they want to remove or make new content blue

Organize the files

1

Create a new Configuration/Objects/Editorial folder in your Dreamweaver installation folder.

2

Copy the files for the Strikethrough object example you created (Strikethrough.htm, Strikethrough.js, and
Strikethrough.gif) to the Editorial folder.

Create the Blue Text object

1

Create an HTML file.

2

Add the following code:

<html>

<head>
<title>Blue Text</title>
<script language="javascript">

//--------------- API FUNCTIONS---------------

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'){
dom.applyFontMarkup("color",

"#0000FF");

}

// Just return -- don't do anything else.
return;

}

</script>

</head>
<body>
</body>
</html>

3

Save the file as AddBlue.htm in the Editorial folder.

Now you can create an image for the Blue Text Object.

Advertising
This manual is related to the following products: