goog.editor.plugins.BasicTextFormatter
Classgoog.editor.plugins.BasicTextFormatter
> goog.editor.Plugin
> goog.events.EventTarget
> goog.Disposable
goog.editor.plugins.BasicTextFormatter()
Functions to style text (e.g. underline, make bold, etc.)
goog.editor.plugins.BasicTextFormatter.COMMAND
EnumCommands implemented by this plugin. … 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(fieldCopy)
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(originalHtml)
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
}
.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.Plugin
.
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(command, var_args)
[protected]Execute a user-initiated command.
command
{string
}
var_args
{...*}
Object
|undefined
}
.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.
.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
}
.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
Inherited from goog.editor.Plugin
.
Handles keyup.
e
{!goog.events.BrowserEvent
}
boolean
}
.handleKeyboardShortcut(e, key, isModifierPressed)
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
Inherited from goog.editor.Plugin
.
Handles selection change.
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)
Whether the string corresponds to a command this plugin handles.
command
{string
}
boolean
}
.logger
[protected] {goog.debug.Logger
}Logging object.
.prepareContentsHtml(originalHtml, styles)
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(command)
Gets the command value.
command
{string
}
string
|boolean
|null
}
.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
=}
.setAutoDispose(autoDispose)
Inherited from goog.editor.Plugin
.
Set if this plugin should automatically be disposed when the registered field is disposed.
autoDispose
{boolean
}
.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
?}
.unregisterFieldObject(fieldObj)
Inherited from goog.editor.Plugin
.
Unregisters and disables this plugin for the current field object.
fieldObj
{goog.editor.Field
}