Adobe 38040334 - Dreamweaver CS3 User Manual page 115

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

Advertisement

To add the isDOMRequired() function:
1
In the head section of the Strikethrough.htm file, between the opening and closing
function:
<script language="javascript">
function isDOMRequired() {
// Return false, indicating that this object is available in Code view.
return false;
}
</script>
2
Save the file.
Next, decide whether to use
simply wraps the
tag around the selected text, so it doesn't meet the criteria for using the
s
function (see "insertObject()" on page 117).
Within the
function, use
objectTag()
the Code view has input focus, the function should wrap the appropriate (uppercase or lowercase) tag around the
selected text. If the Design view has input focus, the function can use
formatting to the selected text. Remember that this function works only for supported tags (see
in the Dreamweaver API Reference). For other tags or operations, you may need to use other API
terMarkup()
functions. After Dreamweaver applies the formatting, it should return the insertion point (cursor) to the document
without any messages or prompting. The following procedure shows how the
To add the objectTag() function:
1
In the head section of the Strikethrough.htm file, after the
function:
function objectTag() {
// Determine if the user is in Code view.
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('<S>','</S>');
}else{
dom.source.wrapSelection('<s>','</s>');
}
// If the user is not in Code view, apply the formatting in Design view.
}else if (dw.getFocus() == 'document'){
dom.applyCharacterMarkup("s");
}
// Just return--don't do anything else.
return;
}
Save the file as Strikethrough.htm in the Configuration/Objects/Text folder.
2
Instead of including the JavaScript functions in the head section of the HTML file, you can create a separate
JavaScript file. This separate organization is useful for objects that contain several functions, or functions that might
be shared by other objects.
or
objectTag()
insertObject()
dw.getFocus()
for the next function. The Strikethrough object
to determine whether the Code view is the current view. If
dom.applyCharacterMarkup()
objectTag()
function, add the following
isDOMRequired()
DREAMWEAVER CS3
Extending Dreamweaver
tags, add the following
script
insertObject()
to assign the
dom.applyCharac-
function now reads.
109

Advertisement

Table of Contents
loading

This manual is also suitable for:

Dreamweaver cs3

Table of Contents