editor.Link Extends
Wrap an editable link.

Inheritance

Constructor

goog.editor.Link(anchorisNew)

Parameters

anchor : HTMLAnchorElement
The anchor element.
isNew : boolean
Whether this is a new link.

Instance Methods

Public Protected Private
finishLinkCreation(field)
After link creation, finish creating the link depending on the type of link being created.
Arguments:
field : goog.editor.Field
The field where this link is being created.
code »
getAnchor() HTMLAnchorElement
No description.
Returns: HTMLAnchorElement  The anchor element.
code »
getCurrentText() string
No description.
Returns: string  The inner text for the anchor.
code »
getExtraAnchors() !Array.<HTMLAnchorElement>
No description.
Returns: !Array.<HTMLAnchorElement>  The extra anchor elements, if any, created by the browser from a selection.
code »
getValidLinkFromText() ?string
No description.
Returns: ?string  The modified string for the link if the link text appears to be a valid link. Returns null if this is not a valid link address.
code »
initializeUrl(url)
Set the url without affecting the isNew() status of the link.
Arguments:
url : string
A URL.
code »
isNew() boolean
No description.
Returns: boolean  Whether the link is new.
code »
placeCursorRightOf()
Places the cursor to the right of the anchor. Note that this is different from goog.editor.range's placeCursorNextTo in that it specifically handles the placement of a cursor in browsers that trap you in links, by adding a space when necessary and placing the cursor after that space.
code »
removeLink()
Removes the link, leaving its contents in the document. Note that this object will no longer be usable/useful after this call.
code »
setTextAndUrl(newTextnewUrl)
Change the link.
Arguments:
newText : string
New text for the link. If the link contains all its text in one descendent, newText will only replace the text in that one node. Otherwise, we'll change the innerHTML of the whole link to newText.
newUrl : string
A new URL.
code »
updateLinkDisplay_(fieldurl)
Updates the cursor position and link bubble for this link.
Arguments:
field : goog.editor.Field
The field in which the link is created.
url : string
The link url.
code »

Instance Properties

anchor_ :
The link DOM element.
Code »
extraAnchors_ :
Any extra anchors created by the browser from a selection in the same operation that created the primary link
Code »
isNew_ :
Whether this link represents a link just added to the document.
Code »

Static Methods

goog.editor.Link.createNewLink(anchorurlopt_targetopt_extraAnchors) !goog.editor.Link
Initialize a new link.
Arguments:
anchor : HTMLAnchorElement
The anchor element.
url : string
The initial URL.
opt_target : string=
The target.
opt_extraAnchors : Array.<HTMLAnchorElement>>
Extra anchors created by the browser when parsing a selection.
Returns: !goog.editor.Link  The link.
code »
goog.editor.Link.isLikelyEmailAddress(str) boolean
Returns true if str could be an email address, false otherwise Ex: goog.editor.Link.isLikelyEmailAddress_("some word") == false goog.editor.Link.isLikelyEmailAddress_("foo@foo.com") == true
Arguments:
str : string
String to test for being email address.
Returns: boolean  Whether "str" looks like an email address.
code »
goog.editor.Link.isLikelyUrl(str) boolean
Returns true if str could be a URL, false otherwise Ex: TR_Util.isLikelyUrl_("http://www.google.com") == true TR_Util.isLikelyUrl_("www.google.com") == true
Arguments:
str : string
String to check if it looks like a URL.
Returns: boolean  Whether str could be a URL.
code »
goog.editor.Link.isMailto(url) boolean
Determines whether or not a url is an email link.
Arguments:
url : string
A url.
Returns: boolean  Whether the url is a mailto link.
code »

Static Properties

goog.editor.Link.LIKELY_EMAIL_ADDRESS_ :
Regular expression that matches strings that could be an email address.
Code »

Package editor

Package Reference