goog.editor.plugins.AbstractBubblePlugin
Classgoog.editor.plugins.AbstractBubblePlugin
> goog.editor.Plugin
> goog.events.EventTarget
> goog.Disposable
goog.editor.plugins.AbstractBubblePlugin()
Base class for bubble plugins. This is used for to connect user behavior in the editor to a goog.ui.editor.Bubble UI element that allows the user to modify the properties of an element on their page (e.g. the alt text of an image tag). Subclasses should override the abstract method getBubbleTargetFromSelection() with code to determine if the current selection should activate the bubble type. The other abstract method createBubbleContents() should be overriden with code to create the inside markup of the bubble. The base class creates the rest of the bubble.
.DASH_NBSP_STRING
[protected] {string
}The constant string used to separate option links.
.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()
Closes the bubble.
.createBubble(targetElement)
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]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]Helper method to create a link to insert into the bubble.
linkId
{string
}
linkText
{string
}
isAnchor
{boolean
}
opt_container
{Element
=}
Element
}
.createLinkOption(id)
[protected]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)
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
}
.eventRegister
[protected] {goog.events.EventHandler
}Place to register events the plugin listens to.
.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
[protected]Inherited from goog.editor.Plugin
.
Handles execCommand. This default implementation does nothing, and is called by execCommand, which handles event dispatching. This method should be overriden by plugins that don't need to do their own event dispatching. If custom event dispatching is needed, execCommand shoul be overriden instead.
command
{string
}
var_args
{...*}
.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()
goog.dom.DomHelper
}
.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()
Returns the element whose properties the bubble manipulates.
Element
}
.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)
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)
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
}
.isSilentCommand
Inherited from goog.editor.Plugin
.
command
{string
}
boolean
}
.isSupportedCommand(command)
Inherited from goog.editor.Plugin
.
Whether the string corresponds to a command this plugin handles.
command
{string
}
boolean
}
.isVisible()
boolean
}
.logger
[protected] {goog.debug.Logger
}Inherited from goog.editor.Plugin
.
The logger for this plugin.
.onShow
[protected]Called after the bubble is shown. The default implementation does nothing. Override it to provide your own one.
.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]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()
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
}
.setBubbleFactory(bubbleFactory)
Sets the bubble factory function.
bubbleFactory
{function
(!Element
, number
): !goog.ui.editor.Bubble
}
.setBubbleParent(bubbleParent)
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
?}
.setupLink(link, linkId, opt_container)
[protected]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
=}
.unregisterFieldObject(fieldObj)
Inherited from goog.editor.Plugin
.
Unregisters and disables this plugin for the current field object.
fieldObj
{goog.editor.Field
}