This plugin provides NormalizeStyle capability to the editor. It is a headless plugin that tries to normalize how content is styled when it comes out of th editor ('b' or css). It also auto-converts incoming content to the proper one expected by the browser as well so that the native styling buttons work.
Parameter | Type | Description |
---|---|---|
args | Object |
Optional Initial settings for any of the attributes. |
See the dojox/editor/plugins/NormalizeStyle reference documentation for more information.
Pointer to dijit/form/Button or other widget (ex: dijit/form/FilteringSelect)
that is added to the toolbar to control this plugin.
If not specified, will be created on initialization according to buttonClass
String like "insertUnorderedList", "outdent", "justifyCenter", etc. that represents an editor command.
Passed to editor.execCommand() if useDefaultCommand
is true.
A boolean variable indicating if it should try to condense 'span''span''span' styles when in css mode The default is true, it will try to combine where it can.
Flag to indicate if this plugin has been disabled and should do nothing helps control button state, among other things. Set via the setter api.
The CSS class name for the button node is formed from iconClassPrefix
and command
A String variable indicating if it should use semantic tags 'b', 'i', etc, or CSS styling. The default is semantic.
If true, this plugin executes by calling Editor.execCommand() with the argument specified in command
.
Method to condense spans if you end up with multi-wrapping from from converting b, i, u, to span nodes.
Parameter | Type | Description |
---|---|---|
node | undefined | The node (and its children), to process. |
A function to convert the HTML structure of 'node' into css span styles around text instead of semantic tags. Note: It does not do compression of spans together.
Parameter | Type | Description |
---|---|---|
node | DOMNode | The node to process |
A function to convert the HTML structure of 'node' into semantic tags where possible.
Parameter | Type | Description |
---|---|---|
node | DOMNode | The node to process. |
The node to process.
Helper function for get() and set(). Caches attribute name values so we don't do the string ops every time.
Parameter | Type | Description |
---|---|---|
name | undefined |
Initialize the button or other widget that will control this plugin. This code only works for plugins controlling built-in commands in the editor.
Function to trap and over-ride the editor inserthtml implementation to try and filter it to match the editor's internal styling mode. Helpful for plugins like PasteFromWord, in that it extra-filters and normalizes the input if it can.
Parameter | Type | Description |
---|---|---|
html | undefined | The HTML string to insert. |
Function to determine if the current tag is an inline element that does formatting, as we don't want to try to combine inlines with divs on styles.
Parameter | Type | Description |
---|---|---|
tag | undefined | The tag to examine |
A function to handle normalizing certain tag types contained under 'node'
Parameter | Type | Description |
---|---|---|
node | undefined | The node to search from. |
The node to search from.
Helper function to set new value for specified attribute
Parameter | Type | Description |
---|---|---|
name | String | |
value | anything |
Function to set the plugin state and call updateState to make sure the button is updated appropriately.
Parameter | Type | Description |
---|---|---|
disabled | undefined |
Class of widget (ex: dijit.form.Button or dijit/form/FilteringSelect)
that is added to the toolbar to control this plugin.
This is used to instantiate the button, unless button
itself is specified directly.
Deprecated. Use this.own() with dojo/on or dojo/aspect.instead.
Make a connect.connect() that is automatically disconnected when this plugin is destroyed.
Similar to dijit/_Widget.connect()
.
Parameter | Type | Description |
---|---|---|
o | undefined | |
f | undefined | |
tf | undefined |
Get a property from a plugin.
Get a named property from a plugin. The property may potentially be retrieved via a getter method. If no getter is defined, this just retrieves the object's property. For example, if the plugin has a properties "foo" and "bar" and a method named "_getFooAttr", calling:
plugin.get("foo");
would be equivalent to writing:
plugin._getFooAttr();
and:
plugin.get("bar");
would be equivalent to writing:
plugin.bar;
Parameter | Type | Description |
---|---|---|
name | undefined | The property to get. |
Returns the label to use for the button
Parameter | Type | Description |
---|---|---|
key | String |
Track specified handles and remove/destroy them when this instance is destroyed, unless they were already removed/destroyed manually.
The array of specified handles, so you can do for example:
var handle = this.own(on(...))[0];
Set a property on a plugin
Sets named properties on a plugin which may potentially be handled by a setter in the plugin. For example, if the plugin has a properties "foo" and "bar" and a method named "_setFooAttr", calling:
plugin.set("foo", "Howdy!");
would be equivalent to writing:
plugin._setFooAttr("Howdy!");
and:
plugin.set("bar", 3);
would be equivalent to writing:
plugin.bar = 3;
set() may also be called with a hash of name/value pairs, ex:
plugin.set({ foo: "Howdy", bar: 3 })
This is equivalent to calling set(foo, "Howdy") and set(bar, 3)
Parameter | Type | Description |
---|---|---|
name | attribute | The property to set. |
value | anything | The value to set in the property. |
Set a property on a plugin
Over-ride for the setting of the editor.
Parameter | Type | Description |
---|---|---|
editor | Object | The editor to configure for this plugin to use. |
Tell the plugin to add it's controller widget (often a button) to the toolbar. Does nothing if there is no controller widget.
Parameter | Type | Description |
---|---|---|
toolbar | dijit/Toolbar |
Change state of the plugin to respond to events in the editor.
This is called on meaningful events in the editor, such as change of selection or caret position (but not simple typing of alphanumeric keys). It gives the plugin a chance to update the CSS of its button.
For example, the "bold" plugin will highlight/unhighlight the bold button depending on whether the characters next to the caret are bold or not.
Only makes sense when useDefaultCommand
is true, as it calls Editor.queryCommandEnabled(command
).