Home

# Class goog.editor.plugins.LinkBubble

Property bubble plugin for links.

extends goog.editor.plugins.AbstractBubblePlugin

Instance Method Summary
| `createBubbleContents(?Element bubbleContainer)` Should be overriden by subclasses to add the type specific contents to the bubble.
| `deleteLink_()` Deletes the link associated with the bubble
| `getBubbleTargetFromSelection(?Element selectedElement) ⇒ ?Element` Should be overriden by subclasses to return the bubble target element or null if an element of their required type isn't found.
| `getBubbleTitle() ⇒ string`
| `getBubbleType() ⇒ string`
| `getLinkToTextObj_() ⇒ ?Object` Gets the text to display for a link, based on the type of link
| `getTargetUrl() ⇒ string` Returns the target element url for the bubble.
| `getTestLinkAction_() ⇒ string` Gets the url for the bubble test link. The test link is the link in the bubble the user can click on to make sure the link they entered is correct.
| `isSafeSchemeToOpen_(string url) ⇒ boolean` Determines whether or not a url has a scheme which is safe to open. Schemes like javascript are unsafe due to the possibility of XSS.
| `isSupportedCommand(string command) ⇒ boolean` Whether the string corresponds to a command this plugin handles.
| `onShow()` Sets the proper state for the action links.
| `setBlockOpeningUnsafeSchemes(boolean blockOpeningUnsafeSchemes)` Tells the plugin whether to block URLs with schemes not in the whitelist. If blocking is enabled, this plugin will not linkify the link in the bubble popup.
| `setSafeToOpenSchemes(?Array.<(String|null)> schemes)` Sets a whitelist of allowed URL schemes that are safe to open. Schemes should all be in lowercase. If the plugin is set to block opening unsafe schemes, user-entered URLs will be converted to lowercase and checked against this list. The whitelist has no effect if blocking is not enabled.
| `setTestLinkUrlFn(function (string): string func)` Set the optional function for getting the "test" link of a url.
| `shouldOpenUrl(string url) ⇒ boolean` Checks whether the plugin should open the given url in a new window.
| `showLinkDialog_()` Shows the link dialog

`stopReferrerLeaks()`

Tells the plugin to stop leaking the page's url via the referrer header when the link text link is clicked. When the user clicks on a link, the browser makes a request for the link url, passing the url of the current page in the request headers. If the user wants the current url to be kept secret (e.g. an unpublished document), the owner of the url that was clicked will see the secret url in the request headers, and it will no longer be a secret. Calling this method will not send a referrer header in the request, just as if the user had opened a blank window and typed the url in themselves.

| `testLink()` Tests the link by opening it in a new tab/window. Should be used as the click event handler for the test pseudo-link.
| `updateLink_()` Updates the href in the link bubble with a new link.