Skip to main content

HTMLUtils

Import :

const HTMLUtils = brackets.getModule("language/HTMLUtils")

TAG_NAME : string

Key representing tag name

Kind: global constant

CLOSING_TAG : string

Key representing closing tag

Kind: global constant

ATTR_NAME : string

Key representing attribute name

Kind: global constant

ATTR_VALUE : string

Key representing attribute value

Kind: global constant

getTagAttributes(editor, pos) ⇒ Array.<string>

Compiles a list of used attributes for a given tag.

Kind: global function
Returns: Array.<string> - - A list of the used attributes within the current tag.

ParamTypeDescription
editorCodeMirrorAn instance of a CodeMirror editor.
posObjectThe position in the CodeMirror editor, specified by character and line numbers.

createTagInfo([tokenType], [offset], [tagName], [attrName], [attrValue]) ⇒ Object

Creates a tagInfo object and assures all the values are entered or are empty strings

Kind: global function
Returns: Object - A tagInfo object with some context about the current tag hint.

ParamTypeDescription
[tokenType]stringwhat is getting edited and should be hinted
[offset]numberwhere the cursor is for the part getting hinted
[tagName]stringThe name of the tag
[attrName]stringThe name of the attribute
[attrValue]stringThe value of the attribute

getTagInfo(editor, constPos, let) ⇒ Object

Figure out if we're in a tag, and if we are return info about it An example token stream for this tag is

<span id="open-files-disclosure-arrow"></span> :
className:tag string:"<span"
className: string:" "
className:attribute string:"id"
className: string:"="
className:string string:""open-files-disclosure-arrow""
className:tag string:"></span>"

Kind: global function
Returns: Object - A tagInfo object with some context about the current tag hint.

ParamTypeDescription
editorEditorAn instance of a Brackets editor
constPosObjectA CM pos (likely from editor.getCursorPos())
letisHtmlMode:booleanthe module know we are in html mode

findBlocks(editor, modeName) ⇒ Object

Returns an Array of info about all blocks whose token mode name matches that passed in, in the given Editor's HTML document (assumes the Editor contains HTML text).

Kind: global function
Returns: Object - Array

ParamTypeDescription
editorEditorthe editor containing the HTML text
modeNamestringthe mode name of the tokens to look for

findStyleBlocks(editor) ⇒ Object

Returns an Array of info about all 'style' blocks in the given Editor's HTML document (assumes the Editor contains HTML text).

Kind: global function
Returns: Object - Array

ParamType
editorEditor