goog.editor.plugins.LinkDialogPlugin
Classgoog.editor.plugins.LinkDialogPlugin
> goog.editor.plugins.AbstractDialogPlugin
> goog.editor.Plugin
> goog.events.EventTarget
> goog.Disposable
goog.editor.plugins.LinkDialogPlugin()
A plugin that opens the link dialog.
.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
}
.createDialog(dialogDomHelper, opt_link)
[protected]Creates a new instance of the dialog and registers for the relevant events.
dialogDomHelper
{goog.dom.DomHelper
}
opt_link
{*=}
goog.ui.editor.LinkDialog
}
.creationStack
{string
}Inherited from goog.Disposable
.
If monitoring the goog.Disposable instances is enabled, stores the creation stack trace of the Disposable instance.
.currentLink_
[protected] {goog.editor.Link
}Link object that the dialog is editing.
.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]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 };
.disposeOriginalSelection()
[protected]Inherited from goog.editor.plugins.AbstractDialogPlugin
.
Cleans up the structure used to save the original selection before the dialog was opened. Should be used by subclasses that don't restore the original selection via restoreOriginalSelection.
.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.plugins.AbstractDialogPlugin
.
Handles execCommand. Dialog plugins don't make any changes when they open a dialog, just when the dialog closes (because only modal dialogs are supported). Hence this method does not dispatch the change events that the superclass method does.
command
{string
}
var_args
{...*}
.execCommandInternal(command, opt_arg)
[protected]Handles execCommand by opening the dialog.
command
{string
}
opt_arg
{*=}
.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.
.getCurrentLink()
[protected]goog.editor.Link
}
.getDialog()
[protected]Inherited from goog.editor.plugins.AbstractDialogPlugin
.
Returns the current dialog that was created and opened by this plugin.
goog.ui.editor.AbstractDialog
}
.getDisposed
[deprecated]Deprecated. Use {@link #isDisposed} instead.
Inherited from goog.Disposable
.
boolean
}
.getEventHandler()
[protected]goog.events.EventHandler
}
.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
.handleAfterHide(e)
[protected]Handles when the dialog closes.
e
{goog.events.Event
}
.handleBeforeTestLink(e)
[protected]Handles the BeforeTestLink event fired when the 'test' link is clicked.
e
{goog.ui.editor.LinkDialog.BeforeTestLinkEvent
}
.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
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
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)
Inherited from goog.editor.plugins.AbstractDialogPlugin
.
Whether the string corresponds to a command this plugin handles.
command
{string
}
boolean
}
.logger
[protected] {goog.debug.Logger
}Inherited from goog.editor.Plugin
.
The logger for this plugin.
.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
}
.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
=}
.restoreOriginalSelection()
[protected]Inherited from goog.editor.plugins.AbstractDialogPlugin
.
Restores the selection in the editable field to what it was before the dialog was opened. This is not guaranteed to work if the contents of the field have changed.
.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 stop the 'Test Link' popup window from being created. Blocking doesn't affect link creation--if the user clicks the 'OK' button with an unsafe URL, the link will still be created as normal.
blockOpeningUnsafeSchemes
{boolean
}
.setEmailWarning(emailWarning)
Sets the warning message to show to users about including email addresses on public web pages.
emailWarning
{string
}
.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
?}
.setReuseDialog(reuse)
[protected]Inherited from goog.editor.plugins.AbstractDialogPlugin
.
Sets whether this plugin should reuse the same instance of the dialog each time execCommand is called or create a new one. This is intended for use by subclasses only, hence protected.
reuse
{boolean
}
.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
>}
.shouldOpenUrl(url)
[protected]Checks whether the plugin should open the given url in a new window.
url
{string
}
boolean
}
.showOpenLinkInNewWindow(startChecked)
Tells the dialog to show a checkbox where the user can choose to have the link open in a new window.
startChecked
{boolean
}
.showRelNoFollow()
Tells the dialog to show a checkbox where the user can choose to have 'rel=nofollow' attribute added to the link.
.stopReferrerLeaks()
Tells the plugin to stop leaking the page's url via the referrer header when the "test this link" 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.
.unregisterFieldObject(fieldObj)
Inherited from goog.editor.Plugin
.
Unregisters and disables this plugin for the current field object.
fieldObj
{goog.editor.Field
}