Code view toolbar functions

 < Day Day Up > 

Code view toolbar functions let you insert text, remove comments, show or hide special characters for white spaces in Code view, and get the path of the current document.

NOTE

There are two different Coding toolbars: one for Code view and one for the Code inspector. Both are customized in the file Configuration/Toolbars/toolbars.xml.


dom.getOpenPathName()

Availability

Dreamweaver 8.

Description

This function gets the absolute file path of the open document.

Arguments

None.

Returns

A string that is the absolute file path of the open document.

Example

The following example assigns the string that contains the path of the currently open document to the variable fileName:

 var fileName = dom.getOpenPathName(); 

dom.getShowHiddenCharacters()

Availability

Dreamweaver 8.

Description

This function determines whether the special characters for white spaces are shown in the Code view of the Document window.

Arguments

None.

Returns

A Boolean: true if the hidden characters are displayed; false otherwise.

Example

The following example turns off the display of the special characters for white space, if the display of special characters is turned on initially:

 var currentDOM = dw.getDocumentDOM(); if (currentDOM.getShowHiddenCharacters()){   currentDOM.setShowHiddenCharacters(false);   } 

dom.setShowHiddenCharacters()

Availability

Dreamweaver 8.

Description

This function shows or hides the special characters for white spaces in the Code view of the Code inspector.

Arguments

 show 

  • The show argument, which is required, is a Boolean value that indicates whether to display the hidden characters.

Returns

Nothing.

Example

See "dom.getShowHiddenCharacters()" on page 753.

dom.source.applyComment()

Availability

Dreamweaver 8.

Description

This function inserts the text specified in the beforeText argument before the current selection and the text specified in the afterText argument after the current selection. The function then extends the current selection to include the added text. However, if there is no current selection, the function does not select anything. If the text specified in the afterText argument is null, the function inserts the text specified in the beforeText argument at the beginning of every line in the current selection.

Arguments

 beforeText 

  • The beforeText argument is required. It specifies the text to insert at the beginning of the selection, or, if the value of the afterText argument is null, it specifies the text to insert at the beginning of every line in the selection.

     afterText 

  • The afterText argument, which is optional, specifies the text to insert at the end of the selection.

Returns

Nothing.

Example

The following example makes the current selection an HTML comment:

 dw.getDocumentDOM().source.applyComment('<!--', '-->') 

dom.source.removeComment()

Availability

Dreamweaver 8.

Description

This function removes comments. If you specify no arguments, it removes all types of comments from the current selection, except server-side includes and Dreamweaver-specific comments. If there are nested comments, it removes only the outer comment. If there is no current selection, it removes only the first line comment of the line on which the cursor is located. If you specify arguments, the function removes only comments that match the values specified in the beforeText and afterText arguments, even if the matching comments are nested inside other types of comments.

Arguments

 beforeText 

  • The beforeText argument is optional. It specifies the text to identify the beginning of the comment to remove from the selection, or, if the value of the afterText argument is null, it specifies the type of line comment to remove from the current selection.

     afterText 

  • The afterText argument, which is optional, specifies the text to identify the end of the comment to remove from the selection.

Returns

Nothing.

Example

The following example removes an HTML comment:

 dw.getDocumentDOM().source.removeComment('<!--', '-->') 

dreamweaver.htmlInspector.getShowHiddenCharacters()

Availability

Dreamweaver 8.

Description

This function determines whether the special characters for white spaces are displayed in the Code view of the Code inspector.

Arguments

None.

Returns

A Boolean: TRue if the hidden characters are displayed; false otherwise.

Example

The following example turns off the display of the special characters for white space in the Code inspector, if the display of special characters is turned on initially:

 if (dreamweaver.htmlinspector.getShowHiddenCharacters()){   dreamweaver.htmlinspector.setShowHiddenCharacters(false);   } 

dreamweaver.htmlInspector.setShowHiddenCharacters()

Availability

Dreamweaver 8.

Description

This function shows or hides the special characters for white spaces in the Code view of the Code inspector.

Arguments

 show 

  • The show argument, which is required, is a Boolean value that indicates whether to display hidden characters for white spaces.

Returns

A Boolean: true if the hidden characters are displayed; false otherwise.

Example

See "dreamweaver.htmlInspector.getShowHiddenCharacters()" on page 756.

     < Day Day Up > 


    Developing Extensions for Macromedia Dreamweaver 8
    Developing Extensions for Macromedia Dreamweaver 8
    ISBN: 0321395409
    EAN: 2147483647
    Year: 2005
    Pages: 282

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net