Introduction to Extending Dreamweaver Introduction Background Installing an extension Creating an extension Additional resources for extension writers What's new in Dreamweaver Documentation changes Macromedia Press Deprecated functions Errata Conventions used in this guide Customizing Dreamweaver Customizing Dreamweaver Ways to customize Dreamweaver Customizing default documents Customizing page designs Customizing the appearance of dialog boxes Changing the default file type Customizing the interpretation of third-party tags Customizing Dreamweaver in a multiuser environment Deleting configuration files in a multiuser environment About mm_deleted_files.xml tag syntax <deleteditems> <item> Reinstalling and uninstalling Dreamweaver in a multiuser environment Working with browser profiles About browser-profile formatting Creating and editing a browser profile Changing FTP mappings Extensible document types in Dreamweaver Opening a document in Dreamweaver Customizing workspace layouts <panelset> <application> <document> <panelframe> <panelcontainer> <panel> Customizing the Code view toolbar Customizing Code View Code hints The CodeHints.xml file Code Hints tags <codehints> <menugroup> <description> <menu> <menuitem> <function> Code coloring Code coloring files <scheme> <blockEnd> <blockStart> <brackets> <charStart> <charEnd> <charEsc> <commentStart> <commentEnd> <cssImport/> <cssMedia/> <cssProperty/> <cssSelector/> <cssValue/> <defaultAttribute> <defaultTag> <defaultText/> <endOfLineComment> <entity/> <functionKeyword> <idChar1> <idCharRest> <ignoreCase> <ignoreMMTParams> <ignoreTags> <isLocked> <keyword> <keywords> <numbers/> <operators> <regexp> <sampleText> <searchPattern> <stringStart> <stringEnd> <stringEsc> <tagGroup> Scheme block delimiter coloring innerText customText outerTag innerTag nameTag nameTagScript Scheme processing Wildcard characters Escape characters Maximum string length Scheme precedence Editing schemes Code coloring examples Code validation <css-support> <property> <value> Changing default HTML formatting Overview of Extending Dreamweaver User Interfaces for Extensions Designing an extension user interface Dreamweaver HTML rendering control Using custom UI controls in extensions Editable select lists Database controls Adding a database tree control Adding a variable grid control Adding tree controls Manipulating content within a tree control A color button control for extensions Adding Flash content to Dreamweaver A simple Flash dialog box example Extending Dreamweaver Types of Dreamweaver extensions Other ways to extend Dreamweaver Configuration folders and extensions Multiuser Configuration folders Running scripts at startup or shutdown Reloading extensions Extension APIs How Dreamweaver processes JavaScript in extensions Displaying Help Localizing an extension XML String files Localizable Strings with Embedded Values Working with the Extension Manager The Dreamweaver Document Object Model Which document DOM? The Dreamweaver DOM Objects, properties, and methods of the Dreamweaver DOM Properties and methods of the document object Properties and methods of HTML tag objects Properties and methods of text objects Properties and methods of comment objects The dreamweaver and site objects Properties of the dreamweaver object The site object Extension APIs Insert Bar Objects How object files work The Insert bar definition file Insert bar definition tags <insertbar> <category> <menubutton> <button /> <checkbutton /> <separator /> Insert bar definition tag attributes id="unique id" image="image_path" canDrag="Boolean" showIf="enabler" enabled="enabler" checked="enabler" command="API_function" file="file_path" tag="editor" name="tooltip_text" Modifying the Insert bar Adding objects to the Insert bar Adding objects to the Insert menu A simple insert object example Creating the HTML file Adding the JavaScript functions Creating the image Editing the insertbar.xml file Adding a dialog box Building an Insert bar pop-up menu The Objects API canInsertObject() displayHelp() isDomRequired() insertObject() objectTag() windowDimensions() Commands How commands work Adding commands to the Commands menu A simple command example Creating the UI Writing the JavaScript code Testing the extension The Commands API canAcceptCommand() commandButtons() isDomRequired() receiveArguments() windowDimensions() Menus and Menu Commands About the menus.xml file <menubar> <menu> <menuitem> <separator> <shortcutlist> <shortcut> <tool> <action> <activate> <override> Changing menus and menu commands Changing the name of a menu command or menu Changing keyboard shortcuts Menu commands Modifying the Commands menu How menu commands work A simple menu command example Creating the menu commands Writing the JavaScript code canAcceptCommand() receiveArguments() setMenuText() Placing the command file in the Menu folder A dynamic menu example Creating the dynamic menu items Writing the JavaScript code canAcceptCommand() havePreviewTarget() receiveArguments() The Menu Commands API canAcceptCommand() commandButtons() getDynamicContent() isCommandChecked() receiveArguments() setMenuText() windowDimensions() Toolbars How toolbars work How toolbars behave How toolbar commands work A simple toolbar command file Creating the text box Writing the JavaScript code canAcceptCommand(): enable the toolbar item receiveArguments(): set the title getCurrentValue(): get the title The toolbar definition file <toolbar> <include/> <itemtype/> <itemref/> <separator/> Toolbar item tags <button> <checkbutton> <radiobutton> <menubutton> <dropdown> <combobox> <editcontrol> <colorpicker> Item tag attributes id="unique_id" showIf="script" image="image_path" disabledImage="image_path" overImage="image_path" tooltip="tooltip string" label="label string" width="number" menuID="menu_id" colorRect="left top right bottom" file="command_file_path" domRequired="true" or "false" enabled="script" checked="script" value="script" update="update_frequency_list" command="script" arguments="argument_list" The toolbar command API canAcceptCommand() getCurrentValue() getDynamicContent() getMenuID() getUpdateFrequency() isCommandChecked() isDOMRequired() receiveArguments() showIf() Reports Site reports How site reports work Creating the report definition Writing the JavaScript code Stand-alone reports How stand-alone reports work A simple stand-alone report example Creating the dialog box UI Writing the JavaScript code The Reports API processFile() beginReporting() endReporting() commandButtons() configureSettings() windowDimensions() Tag Libraries and Editors Tag library file format The Tag Chooser A simple example of creating a new tag editor Tag editor APIs inspectTag() validateTag() applyTag() Property Inspectors Property inspector files How Property inspector files work A simple Property inspector example Creating the user interface Writing the JavaScript code Creating the image Testing the Property inspector The Property inspector API canInspectSelection() displayHelp() inspectSelection() Floating Panels How floating panel files work A simple floating panel example Creating the floating panels Writing the JavaScript code Creating a menu item The Floating panel API displayHelp() documentEdited() getDockingSide() initialPosition() initialTabs() isATarget() isAvailableInCodeView() isResizable() selectionChanged() Behaviors How Behaviors work Inserting multiple functions in the user's file What to do when an action requires a return value A simple behavior example Creating the behavior extension Creating the HTML files to browse Testing the behavior The Behaviors API applyBehavior() behaviorFunction() canAcceptBehavior() displayHelp() deleteBehavior() identifyBehaviorArguments() inspectBehavior() windowDimensions() Server Behaviors Dreamweaver architecture Group files Participant files The script file A simple server behavior example Creating the dynamic page document Defining the new server behavior Defining the code to insert How the Server Behavior API functions are called The Server Behavior API analyzeServerBehavior() applyServerBehavior() canApplyServerBehavior() copyServerBehavior() deleteServerBehavior() displayHelp() findServerBehaviors() inspectServerBehavior() pasteServerBehavior() Server behavior implementation functions dwscripts.findSBs() dwscripts.applySB() dwscripts.deleteSB() Editing EDML files Regular expressions Notes about EDML structure Group EDML file tags <group> <group> attributes version serverBehavior dataSource subType <title> <groupParticipants> <groupParticipants> attributes selectParticipant <groupParticipant> <groupParticipant> attributes name partType Participant EDML files <participant> <participant> attributes version <quickSearch> <insertText> <insertText> attributes location nodeParamName <searchPatterns> <searchPatterns> attributes whereToSearch <searchPattern> <searchPattern> attributes paramNames limitSearch isOptional <updatePatterns> <updatePattern> <updatePattern> attributes paramName <delete> <delete> attributes deleteType <translator> <searchPatterns> <translations> <translation> <translation> attributes whereToSearch limitSearch translationType <openTag> <attributes> <attribute> <display> <closeTag> Server behavior techniques Finding server behaviors Updating server behaviors Deleting server behaviors Avoiding conflicts with share-in-memory JavaScript files Data Sources How data sources work A simple data source example Creating the data source definition file Creating the EDML file Creating the JavaScript file that implements the Data Sources API functions Creating the supporting command files for user input Testing the new data source The Data Sources API addDynamicSource() deleteDynamicSource() displayHelp() editDynamicSource() findDynamicSources() generateDynamicDataRef() generateDynamicSourceBindings() inspectDynamicDataRef() Server Formats How data formatting works The Formats.xml file The Edit Format List Plus (+) menu When the data formatting functions are called The Server Formats API applyFormat() applyFormatDefinition() deleteFormat() formatDynamicDataRef() inspectFormatDefinition() Components Component basics Extending the Components panel How to customize the Components panel Components panel files Components panel API functions getComponentChildren() getContextMenuId() getCodeViewDropCode() getSetupSteps() setupStepsCompleted() handleDesignViewDrop() handleDoubleClick() toolbarControls() Server Models How customizing server models works The Server Model API functions canRecognizeDocument() getFileExtensions() getLanguageSignatures() getServerExtension() getServerInfo() getServerLanguages() getServerModelExtDataNameUD4() getServerModelDelimiters() getServerModelDisplayName() getServerModelFolderName() getServerSupportsCharset() getVersionArray() Data Translators How data translators work Determining what kind of translator to use Adding a translated attribute to a tag Translating more than one attribute at a time Inspecting translated attributes Locking translated tags or blocks of code Creating Property inspectors for locked content Finding bugs in your translator A simple attribute translator example Creating the tagspec tag Creating the icon Creating the attribute translator A simple block/tag translator example The Data Translator API getTranslatorInfo() translateMarkup() liveDataTranslateMarkup() C-Level Extensibility How integrating C functions works C-level extensibility and the JavaScript interpreter Data types The C-level API typedef JSBool (*JSNative)(JSContext *cx, JSObject *obj, unsigned int argc, jsval *argv, jsval *rval) JSBool JS_DefineFunction() char *JS_ValueToString() JSBool JS_ValueToInteger() JSBool JS_ValueToDouble() JSBool JS_ValueToBoolean() JSBool JS_ValueToObject() JSBool JS_StringToValue() JSBool JS_DoubleToValue() JSVal JS_BooleanToValue() JSVal JS_IntegerToValue() JSVal JS_ObjectToValue() char *JS_ObjectType() JSObject *JS_NewArrayObject() long JS_GetArrayLength() JSBool JS_GetElement() JSBool JS_SetElement() JSBool JS_ExecuteScript() JSBool JS_ReportError() File Access and Multiuser Configuration API JS_Object MM_GetConfigFolderList() JSBool MM_ConfigFileExists() int MM_OpenConfigFile() JSBool MM_GetConfigFileAttributes() JSBool MM_SetConfigFileAttributes() JSBool MM_CreateConfigFolder() JSBool MM_RemoveConfigFolder() JSBool MM_DeleteConfigFile() Calling a C function from JavaScript Appendix The Shared Folder The Shared folder contents The Common folder The MM folder Other folders Using the Shared folder Introduction to Extending Dreamweaver Introduction Background Installing an extension Creating an extension Additional resources for extension writers What's new in Dreamweaver Documentation changes Macromedia Press Deprecated functions Errata Conventions used in this guide Customizing Dreamweaver Customizing Dreamweaver Ways to customize Dreamweaver Customizing default documents Customizing page designs Customizing the appearance of dialog boxes Changing the default file type Customizing the interpretation of third-party tags Customizing Dreamweaver in a multiuser environment Deleting configuration files in a multiuser environment About mm_deleted_files.xml tag syntax <deleteditems> <item> Reinstalling and uninstalling Dreamweaver in a multiuser environment Working with browser profiles About browser-profile formatting Creating and editing a browser profile Changing FTP mappings Extensible document types in Dreamweaver Opening a document in Dreamweaver Customizing workspace layouts <panelset> <application> <document> <panelframe> <panelcontainer> <panel> Customizing the Code view toolbar Customizing Code View Code hints The CodeHints.xml file Code Hints tags <codehints> <menugroup> <description> <menu> <menuitem> <function> Code coloring Code coloring files <scheme> <blockEnd> <blockStart> <brackets> <charStart> <charEnd> <charEsc> <commentStart> <commentEnd> <cssImport/> <cssMedia/> <cssProperty/> <cssSelector/> <cssValue/> <defaultAttribute> <defaultTag> <defaultText/> <endOfLineComment> <entity/> <functionKeyword> <idChar1> <idCharRest> <ignoreCase> <ignoreMMTParams> <ignoreTags> <isLocked> <keyword> <keywords> <numbers/> <operators> <regexp> <sampleText> <searchPattern> <stringStart> <stringEnd> <stringEsc> <tagGroup> Scheme block delimiter coloring innerText customText outerTag innerTag nameTag nameTagScript Scheme processing Wildcard characters Escape characters Maximum string length Scheme precedence Editing schemes Code coloring examples Code validation <css-support> <property> <value> Changing default HTML formatting Overview of Extending Dreamweaver User Interfaces for Extensions Designing an extension user interface Dreamweaver HTML rendering control Using custom UI controls in extensions Editable select lists Database controls Adding a database tree control Adding a variable grid control Adding tree controls Manipulating content within a tree control A color button control for extensions Adding Flash content to Dreamweaver A simple Flash dialog box example Extending Dreamweaver Types of Dreamweaver extensions Other ways to extend Dreamweaver Configuration folders and extensions Multiuser Configuration folders Running scripts at startup or shutdown Reloading extensions Extension APIs How Dreamweaver processes JavaScript in extensions Displaying Help Localizing an extension XML String files Localizable Strings with Embedded Values Working with the Extension Manager The Dreamweaver Document Object Model Which document DOM? The Dreamweaver DOM Objects, properties, and methods of the Dreamweaver DOM Properties and methods of the document object Properties and methods of HTML tag objects Properties and methods of text objects Properties and methods of comment objects The dreamweaver and site objects Properties of the dreamweaver object The site object Extension APIs Insert Bar Objects How object files work The Insert bar definition file Insert bar definition tags <insertbar> <category> <menubutton> <button /> <checkbutton /> <separator /> Insert bar definition tag attributes id="unique id" image="image_path" canDrag="Boolean" showIf="enabler" enabled="enabler" checked="enabler" command="API_function" file="file_path" tag="editor" name="tooltip_text" Modifying the Insert bar Adding objects to the Insert bar Adding objects to the Insert menu A simple insert object example Creating the HTML file Adding the JavaScript functions Creating the image Editing the insertbar.xml file Adding a dialog box Building an Insert bar pop-up menu The Objects API canInsertObject() displayHelp() isDomRequired() insertObject() objectTag() windowDimensions() Commands How commands work Adding commands to the Commands menu A simple command example Creating the UI Writing the JavaScript code Testing the extension The Commands API canAcceptCommand() commandButtons() isDomRequired() receiveArguments() windowDimensions() Menus and Menu Commands About the menus.xml file <menubar> <menu> <menuitem> <separator> <shortcutlist> <shortcut> <tool> <action> <activate> <override> Changing menus and menu commands Changing the name of a menu command or menu Changing keyboard shortcuts Menu commands Modifying the Commands menu How menu commands work A simple menu command example Creating the menu commands Writing the JavaScript code canAcceptCommand() receiveArguments() setMenuText() Placing the command file in the Menu folder A dynamic menu example Creating the dynamic menu items Writing the JavaScript code canAcceptCommand() havePreviewTarget() receiveArguments() The Menu Commands API canAcceptCommand() commandButtons() getDynamicContent() isCommandChecked() receiveArguments() setMenuText() windowDimensions() Toolbars How toolbars work How toolbars behave How toolbar commands work A simple toolbar command file Creating the text box Writing the JavaScript code canAcceptCommand(): enable the toolbar item receiveArguments(): set the title getCurrentValue(): get the title The toolbar definition file <toolbar> <include/> <itemtype/> <itemref/> <separator/> Toolbar item tags <button> <checkbutton> <radiobutton> <menubutton> <dropdown> <combobox> <editcontrol> <colorpicker> Item tag attributes id="unique_id" showIf="script" image="image_path" disabledImage="image_path" overImage="image_path" tooltip="tooltip string" label="label string" width="number" menuID="menu_id" colorRect="left top right bottom" file="command_file_path" domRequired="true" or "false" enabled="script" checked="script" value="script" update="update_frequency_list" command="script" arguments="argument_list" The toolbar command API canAcceptCommand() getCurrentValue() getDynamicContent() getMenuID() getUpdateFrequency() isCommandChecked() isDOMRequired() receiveArguments() showIf() Reports Site reports How site reports work Creating the report definition Writing the JavaScript code Stand-alone reports How stand-alone reports work A simple stand-alone report example Creating the dialog box UI Writing the JavaScript code The Reports API processFile() beginReporting() endReporting() commandButtons() configureSettings() windowDimensions() Tag Libraries and Editors Tag library file format The Tag Chooser A simple example of creating a new tag editor Tag editor APIs inspectTag() validateTag() applyTag() Property Inspectors Property inspector files How Property inspector files work A simple Property inspector example Creating the user interface Writing the JavaScript code Creating the image Testing the Property inspector The Property inspector API canInspectSelection() displayHelp() inspectSelection() Floating Panels How floating panel files work A simple floating panel example Creating the floating panels Writing the JavaScript code Creating a menu item The Floating panel API displayHelp() documentEdited() getDockingSide() initialPosition() initialTabs() isATarget() isAvailableInCodeView() isResizable() selectionChanged() Behaviors How Behaviors work Inserting multiple functions in the user's file What to do when an action requires a return value A simple behavior example Creating the behavior extension Creating the HTML files to browse Testing the behavior The Behaviors API applyBehavior() behaviorFunction() canAcceptBehavior() displayHelp() deleteBehavior() identifyBehaviorArguments() inspectBehavior() windowDimensions() Server Behaviors Dreamweaver architecture Group files Participant files The script file A simple server behavior example Creating the dynamic page document Defining the new server behavior Defining the code to insert How the Server Behavior API functions are called The Server Behavior API analyzeServerBehavior() applyServerBehavior() canApplyServerBehavior() copyServerBehavior() deleteServerBehavior() displayHelp() findServerBehaviors() inspectServerBehavior() pasteServerBehavior() Server behavior implementation functions dwscripts.findSBs() dwscripts.applySB() dwscripts.deleteSB() Editing EDML files Regular expressions Notes about EDML structure Group EDML file tags <group> <group> attributes version serverBehavior dataSource subType <title> <groupParticipants> <groupParticipants> attributes selectParticipant <groupParticipant> <groupParticipant> attributes name partType Participant EDML files <participant> <participant> attributes version <quickSearch> <insertText> <insertText> attributes location nodeParamName <searchPatterns> <searchPatterns> attributes whereToSearch <searchPattern> <searchPattern> attributes paramNames limitSearch isOptional <updatePatterns> <updatePattern> <updatePattern> attributes paramName <delete> <delete> attributes deleteType <translator> <searchPatterns> <translations> <translation> <translation> attributes whereToSearch limitSearch translationType <openTag> <attributes> <attribute> <display> <closeTag> Server behavior techniques Finding server behaviors Updating server behaviors Deleting server behaviors Avoiding conflicts with share-in-memory JavaScript files Data Sources How data sources work A simple data source example Creating the data source definition file Creating the EDML file Creating the JavaScript file that implements the Data Sources API functions Creating the supporting command files for user input Testing the new data source The Data Sources API addDynamicSource() deleteDynamicSource() displayHelp() editDynamicSource() findDynamicSources() generateDynamicDataRef() generateDynamicSourceBindings() inspectDynamicDataRef() Server Formats How data formatting works The Formats.xml file The Edit Format List Plus (+) menu When the data formatting functions are called The Server Formats API applyFormat() applyFormatDefinition() deleteFormat() formatDynamicDataRef() inspectFormatDefinition() Components Component basics Extending the Components panel How to customize the Components panel Components panel files Components panel API functions getComponentChildren() getContextMenuId() getCodeViewDropCode() getSetupSteps() setupStepsCompleted() handleDesignViewDrop() handleDoubleClick() toolbarControls() Server Models How customizing server models works The Server Model API functions canRecognizeDocument() getFileExtensions() getLanguageSignatures() getServerExtension() getServerInfo() getServerLanguages() getServerModelExtDataNameUD4() getServerModelDelimiters() getServerModelDisplayName() getServerModelFolderName() getServerSupportsCharset() getVersionArray() Data Translators How data translators work Determining what kind of translator to use Adding a translated attribute to a tag Translating more than one attribute at a time Inspecting translated attributes Locking translated tags or blocks of code Creating Property inspectors for locked content Finding bugs in your translator A simple attribute translator example Creating the tagspec tag Creating the icon Creating the attribute translator A simple block/tag translator example The Data Translator API getTranslatorInfo() translateMarkup() liveDataTranslateMarkup() C-Level Extensibility How integrating C functions works C-level extensibility and the JavaScript interpreter Data types The C-level API typedef JSBool (*JSNative)(JSContext *cx, JSObject *obj, unsigned int argc, jsval *argv, jsval *rval) JSBool JS_DefineFunction() char *JS_ValueToString() JSBool JS_ValueToInteger() JSBool JS_ValueToDouble() JSBool JS_ValueToBoolean() JSBool JS_ValueToObject() JSBool JS_StringToValue() JSBool JS_DoubleToValue() JSVal JS_BooleanToValue() JSVal JS_IntegerToValue() JSVal JS_ObjectToValue() char *JS_ObjectType() JSObject *JS_NewArrayObject() long JS_GetArrayLength() JSBool JS_GetElement() JSBool JS_SetElement() JSBool JS_ExecuteScript() JSBool JS_ReportError() File Access and Multiuser Configuration API JS_Object MM_GetConfigFolderList() JSBool MM_ConfigFileExists() int MM_OpenConfigFile() JSBool MM_GetConfigFileAttributes() JSBool MM_SetConfigFileAttributes() JSBool MM_CreateConfigFolder() JSBool MM_RemoveConfigFolder() JSBool MM_DeleteConfigFile() Calling a C function from JavaScript Appendix The Shared Folder The Shared folder contents The Common folder The MM folder Other folders Using the Shared folder