Displayhelp(), Isdomrequired() – Adobe Extending Dreamweaver CS4 User Manual
Page 127
121
EXTENDING DREAMWEAVER CS4
Insert bar objects
Example
The following code tells Dreamweaver to check to see that the document contains a particular string before allowing
the user to insert the selected object:
function canInsertObject(){
var docStr = dw.getDocumentDOM().documentElement.outerHTML;
var patt = /hava/;
var found = ( docStr.search(patt) != -1 );
var insertionIsValid = true;
if (!found){
insertionIsValid = false;
alert("the document must contain a 'hava' string to use this object.");}
return insertionIsValid;}
displayHelp()
Description
If you define this function, it displays a Help button below the OK and Cancel buttons in the Parameters dialog box.
This function is called when the user clicks the Help button.
Arguments
None.
Returns
Dreamweaver expects nothing.
Example
The following example opens the myObjectHelp.htm file in a browser; this file explains how to use the extension:
function displayHelp(){
var myHelpFile = dw.getConfigurationPath() +
'/ExtensionsHelp/myObjectHelp.htm';
dw.browseDocument(myHelpFile);
}
isDOMRequired()
Description
This function determines whether the object requires a valid DOM to operate. If this function returns a
true
value or
if the function is not defined, Dreamweaver assumes that the command requires a valid DOM and synchronizes the
Code and Design views for the document before executing. Synchronization causes all edits in the Code view to be
updated in the Design view.
Arguments
None.
Returns
Dreamweaver expects a
true
value if a command requires a valid DOM to operate;
false
otherwise.