You can use tag editors to insert new tags, edit existing tags, and access reference information about tags. The Tag Chooser lets users organize their tags so that they can easily select frequently used tags. The tag libraries that come with Dreamweaver store information about tags that are used in standards-based markup languages and most widely used tag-based scripting languages. You can use the JavaScript Tag editor, Tag Chooser, and Tag library functions when you need to access and work with tag editors and tag libraries in your extensions.

dom.getTagSelectorTag()

Availability

Dreamweaver MX.

Description

This function gets the DOM node for the tag that is currently selected in the Tag Selector bar at the bottom of the document window.

Arguments

None.

Returns

The DOM node for the currently selected tag; null if no tag is selected.

dreamweaver.popupInsertTagDialog()

Availability

Dreamweaver MX.

Description

This function checks the VTM files to see if a tag editor has been defined for the tag. If so, the editor for that tag pops up and accepts the start tag. If not, the start tag is inserted unmodified into the user’s document.

Arguments

start_tag_string

A start tag string that includes one of the following types of initial values:

  • A tag, such as <input>

  • A tag with attributes, such as <input type='text'>

  • A directive, such as <%= %>

Returns

A Boolean value: true if anything is inserted into the document; false otherwise.

dreamweaver.popupEditTagDialog()

Availability

Dreamweaver MX.

Description

If a tag is selected, this function opens the Tag editor for that tag, so you can edit the tag.

Arguments

None.

Returns

Nothing.

Enabler

dreamweaver.showTagChooser()

Availability

Dreamweaver MX (deprecated since Dreamweaver CS5.5)

Description

This function displays the Tag Chooser dialog box, brings it to the front, and sets it in focus.

Arguments

None.

Returns

Nothing.

dreamweaver.showTagLibraryEditor()

Availability

Dreamweaver MX.

Description

This function opens the Tag Library editor.

Arguments

None.

Returns

None.

dreamweaver.tagLibrary.getTagLibraryDOM()

Availability

Dreamweaver MX.

Description

Given the URL of a filename.vtm file, this function returns the DOM for that file, so that its contents can be edited.This function should be called only when the Tag Library editor is active.

Arguments

fileURL

  • The fileURL argument is the URL of a filename.vtm file, relative to the Configuration/Tag Libraries folder, as shown in the following example: "HTML/img.vtm"

Returns

A DOM pointer to a new or previously existing file within the TagLibraries folder.

dreamweaver.tagLibrary.getSelectedLibrary()

Availability

Dreamweaver MX.

Description

If a library node is selected in the Tag Library editor, this function gets the library name.

Arguments

None.

Returns

A string: the name of the library that is currently selected in the Tag Library editor; returns an empty string if no library is selected.

dreamweaver.tagLibrary.getSelectedTag()

Availability

Dreamweaver MX.

Description

If an attribute node is currently selected, this function gets the name of the tag that contains the attribute.

Arguments

None.

Returns

A string: the name of the tag that is currently selected in the Tag Library editor; returns an empty string if no tag is selected.

dreamweaver.tagLibrary.importDTDOrSchema()

Availability

Dreamweaver MX.

Description

This function imports a DTD or schema file from a remote server into the tag library.

Arguments

fileURL, Prefix

  • The fileURL argument is the path to DTD or schema file, in local URL format.

  • The Prefix argument is the prefix string that should be added to all tags in this tag library.

Returns

Name of the imported tag library.

dreamweaver.tagLibrary.getImportedTagList()

Availability

Dreamweaver MX.

Description

This function generates a list of tagInfo objects from an imported tag library.

Arguments

libname

  • The libname argument is the name of the imported tag library.

Returns

Array of tagInfo objects.

A taginfo object contains information about a single tag that is included in the tag library. The following properties are defined in a tagInfo object:

  • The tagName property, which is a string

  • The attributes property, which is an array of strings. Each string is the name of an attribute that is defined for this tag.

Example:

The following example shows that using the dw.tagLibrary.getImportedTagList() function can get an array of tags from the libName library:

     // "fileURL" and "prefix" have been entered by the user. 
    // tell the Tag Library to Import the DTD/Schema 
var libName = dw.tagLibrary.importDTDOrSchema(fileURL, prefix); 
 
    // get the array of tags for this library 
    // this is the TagInfo object 
var tagArray = dw.tagLibrary.getImportedTagList(libName); 
 
    // now I have an array of tagInfo objects. 
    // I can get info out of them. This gets info out of the first one. 
    // note: this assumes there is at least one TagInfo in the array. 
var firstTagName = tagArray[0].name; 
var firstTagAttributes = tagArray[0].attributes; 
    // note that firstTagAttributes is an array of attributes. 
 

This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License  Twitter™ and Facebook posts are not covered under the terms of Creative Commons.

Legal Notices   |   Online Privacy Policy