|[ LiB ]|
Dreamweaver extensions are constructed following the Dreamweaver application programming interface (API), which consists of all the procedures, file construction specifications, custom functions, and formatting instructions that determine how and when commands will be processed and dialog boxes will appear, and so on. Learning how to write your own extensions means becoming familiar with the API. The official "dictionary" that explains and documents the API is Macromedia's Extending Dreamweaver manual. This manual comes in PDF format on the Dreamweaver application CD-ROM; you also can download the PDF from the Macromedia website (www.macromedia.com/support/dreamweaver/).
Each extension (object, behavior, command, inspector, floating panel, report, translator, and so on) consists of one or more files in the Configuration folder. The file types are as follows :
Every rule has an exception. Although most extensions exist in HTML and JS files, it is possible to create simple extensions that exist solely as command lines built into menus .xml . How that works is beyond the scope of this chapter.
HTML file Each extension begins with an HTML file. Every command, object, and behavior has one HTML file that is the extension. Form elements, placed in the body, become the extension's user interface.
GIF files Icons, buttons , and any other graphic elements that appear in the user interface are created from GIF images, which are also stored in the Configuration folder.
In addition to these files, each extension might have an entry in one of the XML files, such as menus.xml or insertbar.xml , that Dreamweaver uses to populate many of its interface elements.
The Dreamweaver ( dw ) object This object contains dozens of methods to control application-wide behavior. Some sample methods are dw.openDocument() , dw.browseForFileURL() , dw.openWithExternalEditor() , and dw.undo() . This object also contains child objects representing different parts of the application, each of which has its own set of methods, such as dw.cssStylePalette.edit-SelectedStyle() and dw.historyPalette.startRecording() .
The Document ( dom ) object This object contains hundreds of methods, controlling all aspects of document editing. Document object methods and properties can be used to manipulate the selection ( dom.getSelectedNode() , dom.setSelection() ), can change any document property ( dom.body. bgcolor ="000000" ), and can access and edit any item in a document ( dom.deleteTableRow() ).
The Site object This object contains methods for working with sites and the Site panel. Site methods let you get and put files ( site.get() , site.put() ), perform sitewide file-management chores ( site.findLinkSource() , site.locateInSite() ), and work with the Site panel itself ( site.editColumns(), site.setFocus() ).
|[ LiB ]|