goog.editor.plugins.LinkBubble
Classgoog.editor.plugins.LinkBubble
> goog.editor.plugins.AbstractBubblePlugin
> goog.editor.Plugin
> goog.events.EventTarget
> goog.Disposable
goog.editor.plugins.LinkBubble(var_args)
Property bubble plugin for links.
var_args
{...!goog.editor.plugins.LinkBubble.Action
}
goog.editor.plugins.LinkBubble.Action
ClassConstructor for extra actions that can be added to the link bubble. … more
.activeOnUneditableFields
Inherited from goog.editor.Plugin
.
boolean
}
.addEventListener(type, handler, opt_capture, opt_handlerScope)
Inherited from goog.events.EventTarget
.
Adds an event listener to the event target. The same handler can only be added once per the type. Even if you add the same handler multiple times using the same type then it will only be called once when the event is dispatched. Supported for legacy but use goog.events.listen(src, type, handler) instead.
type
{string
}
handler
{Function
|Object
}
opt_capture
{boolean
=}
opt_handlerScope
{Object
=}
.addOnDisposeCallback(callback, opt_scope)
Inherited from goog.Disposable
.
Invokes a callback function when this object is disposed. Callbacks are invoked in the order in which they were added.
callback
{!Function
}
opt_scope
{Object
=}
.cleanContentsDom
Inherited from goog.editor.Plugin
.
Cleans the contents of the node passed to it. The node contents are modified directly, and the modifications will subsequently be used, for operations such as saving the innerHTML of the editor etc. Since the plugins act on the DOM directly, this method can be very expensive. This op is invoked even on disabled plugins.
fieldCopy
{!Element
}
.cleanContentsHtml
Inherited from goog.editor.Plugin
.
Cleans the html contents of Trogedit. Both cleanContentsDom and and cleanContentsHtml will be called on contents extracted from Trogedit. The inverse of prepareContentsHtml. This op is invoked even on disabled plugins.
originalHtml
{string
}
string
}
.closeBubble()
Inherited from goog.editor.plugins.AbstractBubblePlugin
.
Closes the bubble.
.createBubble(targetElement)
Inherited from goog.editor.plugins.AbstractBubblePlugin
.
Creates and shows the property bubble.
targetElement
{Element
}
.createBubbleContents(bubbleContainer)
[protected]Should be overriden by subclasses to add the type specific contents to the bubble.
bubbleContainer
{Element
}
.createLink(linkId, linkText, opt_onClick, opt_container)
[protected]Inherited from goog.editor.plugins.AbstractBubblePlugin
.
Helper method that creates a link with text set to linkText and optionaly wires up a listener for the CLICK event or the link.
linkId
{string
}
linkText
{string
}
opt_onClick
{Function
=}
opt_container
{Element
=}
Element
}
.createLinkHelper(linkId, linkText, isAnchor, opt_container)
[protected]Inherited from goog.editor.plugins.AbstractBubblePlugin
.
Helper method to create a link to insert into the bubble.
linkId
{string
}
linkText
{string
}
isAnchor
{boolean
}
opt_container
{Element
=}
Element
}
.createLinkOption(id)
[protected]Inherited from goog.editor.plugins.AbstractBubblePlugin
.
Helper method that creates option links (such as edit, test, remove)
id
{string
}
Element
}
.creationStack
{string
}Inherited from goog.Disposable
.
If monitoring the goog.Disposable instances is enabled, stores the creation stack trace of the Disposable instance.
.disable(fieldObject)
Inherited from goog.editor.plugins.AbstractBubblePlugin
.
Disables this plugin for the specified, registered field object.
fieldObject
{goog.editor.Field
}
.dispatchEvent(e)
Inherited from goog.events.EventTarget
.
Dispatches an event (or event like object) and calls all listeners listening for events of this type. The type of the event is decided by the type property on the event object. If any of the listeners returns false OR calls preventDefault then this function will return false. If one of the capture listeners calls stopPropagation, then the bubble listeners won't fire.
e
{string
|Object
|goog.events.Event
}
boolean
}
.dispose()
Inherited from goog.Disposable
.
Disposes of the object. If the object hasn't already been disposed of, calls {@link #disposeInternal}. Classes that extend {@code goog.Disposable} should override {@link #disposeInternal} in order to delete references to COM objects, DOM nodes, and other disposable objects. Reentrant.
void
}
.disposeInternal()
[protected]Inherited from goog.editor.Plugin
.
Unattach listeners from this object. Classes that extend EventTarget may need to override this method in order to remove references to DOM Elements and additional listeners, it should be something like this:
MyClass.prototype.disposeInternal = function() { MyClass.superClass_.disposeInternal.call(this); // Dispose logic for MyClass };
.enable(fieldObject)
Inherited from goog.editor.Plugin
.
Enables this plugin for the specified, registered field object. A field object should only be enabled when it is loaded.
fieldObject
{goog.editor.Field
}
.execCommand(command, var_args)
Inherited from goog.editor.Plugin
.
Handles execCommand. This default implementation handles dispatching BEFORECHANGE, CHANGE, and SELECTIONCHANGE events, and calls execCommandInternal to perform the actual command. Plugins that want to do their own event dispatching should override execCommand, otherwise it is preferred to only override execCommandInternal. This version of execCommand will only work for single field plugins. Multi-field plugins must override execCommand.
command
{string
}
var_args
{...*}
.execCommandInternal()
.fieldObject
[protected] {goog.editor.Field
}Deprecated. Use goog.editor.Plugin.getFieldObject and goog.editor.Plugin.setFieldObject.
Inherited from goog.editor.Plugin
.
The field object this plugin is attached to.
.getBubbleDom()
Inherited from goog.editor.plugins.AbstractBubblePlugin
.
goog.dom.DomHelper
}
.getBubbleTargetFromSelection()
.getBubbleTitle()
[protected]string
}
.getBubbleType()
[protected]string
}
.getDisposed
[deprecated]Deprecated. Use {@link #isDisposed} instead.
Inherited from goog.Disposable
.
boolean
}
.getFieldDomHelper()
Inherited from goog.editor.Plugin
.
goog.dom.DomHelper
?}
.getFieldObject()
[protected]Inherited from goog.editor.Plugin
.
Sets the field object for use with this plugin.
goog.editor.Field
}
.getParentEventTarget()
Inherited from goog.events.EventTarget
.
Returns the parent of this event target to use for bubbling.
goog.events.EventTarget
}
.getTargetElement()
Inherited from goog.editor.plugins.AbstractBubblePlugin
.
Returns the element whose properties the bubble manipulates.
Element
}
.getTargetUrl()
[protected]Returns the target element url for the bubble.
string
}
.getTrogClassId()
string
}
.handleKeyDown
Inherited from goog.editor.Plugin
.
Handles keydown. It is run before handleKeyboardShortcut and if it returns true handleKeyboardShortcut will not be called.
e
{!goog.events.BrowserEvent
}
boolean
}
.handleKeyPress
Inherited from goog.editor.Plugin
.
Handles keypress. It is run before handleKeyboardShortcut and if it returns true handleKeyboardShortcut will not be called.
e
{!goog.events.BrowserEvent
}
boolean
}
.handleKeyUp(e)
Inherited from goog.editor.plugins.AbstractBubblePlugin
.
Handles keyup.
e
{!goog.events.BrowserEvent
}
boolean
}
.handleKeyboardShortcut
Inherited from goog.editor.Plugin
.
Handles keyboard shortcuts. Preferred to using handleKey* as it will use the proper event based on browser and will be more performant. If handleKeyPress/handleKeyDown returns true, this will not be called. If the plugin handles the shortcut, it is responsible for dispatching appropriate events (change, selection change at the time of this comment). If the plugin calls execCommand on the editable field, then execCommand already takes care of dispatching events. NOTE: For performance reasons this is only called when any key is pressed in conjunction with ctrl/meta keys OR when a small subset of keys (defined in goog.editor.Field.POTENTIAL_SHORTCUT_KEYCODES_) are pressed without ctrl/meta keys. We specifically don't invoke it when altKey is pressed since alt key is used in many i8n UIs to enter certain characters.
e
{!goog.events.BrowserEvent
}
key
{string
}
isModifierPressed
{boolean
}
boolean
}
.handleSelectionChange(opt_e, opt_target)
Inherited from goog.editor.plugins.AbstractBubblePlugin
.
Pops up a property bubble for the given selection if appropriate and closes open property bubbles if no longer needed. This should not be overridden.
opt_e
{!goog.events.BrowserEvent
=}
opt_target
{!Node
=}
boolean
}
.isAutoDispose()
Inherited from goog.editor.Plugin
.
boolean
}
.isDisposed()
Inherited from goog.Disposable
.
boolean
}
.isEnabled(fieldObject)
Inherited from goog.editor.Plugin
.
Returns whether this plugin is enabled for the field object.
fieldObject
{goog.editor.Field
}
boolean
}
.isInvalidUrl
Returns whether the URL should be considered invalid. This always returns false in the base class, and should be overridden by subclasses that wish to impose validity rules on URLs.
url
{string
}
boolean
}
.isSilentCommand
Inherited from goog.editor.Plugin
.
command
{string
}
boolean
}
.isSupportedCommand()
.isVisible()
Inherited from goog.editor.plugins.AbstractBubblePlugin
.
boolean
}
.logger
[protected] {goog.debug.Logger
}Inherited from goog.editor.Plugin
.
The logger for this plugin.
.onShow()
[protected]Sets the proper state for the action links.
.prepareContentsHtml
Inherited from goog.editor.Plugin
.
Prepares the given HTML for editing. Strips out content that should not appear in an editor, and normalizes content as appropriate. The inverse of cleanContentsHtml. This op is invoked even on disabled plugins.
originalHtml
{string
}
styles
{Object
}
string
}
.queryCommandValue
Inherited from goog.editor.Plugin
.
Gets the state of this command if this plugin serves that command.
command
{string
}
.registerClickHandler(target, handler)
[protected]Inherited from goog.editor.plugins.AbstractBubblePlugin
.
Register the handler for the target's CLICK event.
target
{Element
}
handler
{Function
}
.registerDisposable(disposable)
Inherited from goog.Disposable
.
Associates a disposable object with this object so that they will be disposed together.
disposable
{goog.disposable.IDisposable
}
.registerFieldObject(fieldObject)
Inherited from goog.editor.Plugin
.
Registers the field object for use with this plugin.
fieldObject
{goog.editor.Field
}
.removeEventListener(type, handler, opt_capture, opt_handlerScope)
Inherited from goog.events.EventTarget
.
Removes an event listener from the event target. The handler must be the same object as the one added. If the handler has not been added then nothing is done.
type
{string
}
handler
{Function
|Object
}
opt_capture
{boolean
=}
opt_handlerScope
{Object
=}
.reposition()
Inherited from goog.editor.plugins.AbstractBubblePlugin
.
Reposition the property bubble.
.setAutoDispose(autoDispose)
Inherited from goog.editor.Plugin
.
Set if this plugin should automatically be disposed when the registered field is disposed.
autoDispose
{boolean
}
.setBlockOpeningUnsafeSchemes(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.
blockOpeningUnsafeSchemes
{boolean
}
.setBubbleParent(bubbleParent)
Inherited from goog.editor.plugins.AbstractBubblePlugin
.
Sets the bubble parent.
bubbleParent
{Element
}
.setFieldObject(fieldObject)
[protected]Inherited from goog.editor.Plugin
.
Sets the field object for use with this plugin.
fieldObject
{goog.editor.Field
}
.setParentEventTarget(parent)
Inherited from goog.events.EventTarget
.
Sets the parent of this event target to use for bubbling.
parent
{goog.events.EventTarget
?}
.setSafeToOpenSchemes(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.
schemes
{Array
.<String
>}
.setTestLinkUrlFn(func)
Set the optional function for getting the "test" link of a url.
func
{function
(string
) : string
}
.setupLink(link, linkId, opt_container)
[protected]Inherited from goog.editor.plugins.AbstractBubblePlugin
.
Inserts a link in the given container if it is specified or removes the old link with this id and replaces it with the new link
link
{Element
}
linkId
{string
}
opt_container
{Element
=}
.shouldOpenUrl(url)
[protected]Checks whether the plugin should open the given url in a new window.
url
{string
}
boolean
}
.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()
[protected]Tests the link by opening it in a new tab/window. Should be used as the click event handler for the test pseudo-link.
.unregisterFieldObject(fieldObj)
Inherited from goog.editor.Plugin
.
Unregisters and disables this plugin for the current field object.
fieldObj
{goog.editor.Field
}