The Commands Api Functions - Adobe 38040334 - Dreamweaver CS3 User Manual

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

Advertisement

Testing the extension
After you place the files in the Commands folder, you can test the extension.
To test the extension:
Restart Dreamweaver or reload extensions. For information on reloading extensions, see "Reloading extensions"
1
on page 74.
The Change Case entry should now appear on the Commands menu.
2
Type some text in a document.
Select the text.
3
Note: Change Case is dimmed until the user selects text in the document.
4
Select Change Case from the Commands menu.
The text changes case.

The commands API functions

The custom functions in the commands API are not required.
canAcceptCommand()
Description
This function determines whether the command is appropriate for the current selection.
Note: Do not define
canAcceptCommand()
defined, the command is assumed to be appropriate. Making this assumption saves time and improves performance.
Arguments
None.
Returns
Dreamweaver expects a
true
command in the menu.
Example
The following example of the
is a table:
function canAcceptCommand(){
var retval=false;
var selObj=dw.getDocumentDOM.getSelectedNode();
return (selObj.nodeType == Node.ELEMENT_NODE && ¬
selObj.tagName=="TABLE");{
retval=true;
}
return retval;
}
unless it returns a value of
value if the command is allowed; if the value is
function makes the command available only when the selection
canAcceptCommand()
in at least one case. If the function is not
false
, Dreamweaver dims the
false
DREAMWEAVER CS3
133
Extending Dreamweaver

Advertisement

Table of Contents
loading

This manual is also suitable for:

Dreamweaver cs3

Table of Contents