HTML and CSS Reference
In-Depth Information
• The second argument,
showUI
, is a bool.
showUI
determines whether the user
will see the default UI associated with
command
. (Some commands don't have a
UI.)
• The third argument,
value
, is a string.
execCommand
will invoke
command
with
value
as its argument.
The number of required arguments for an
execCommand
depends on the command passed
to the first argument. See
appendix B
or
http://dvcs.w3.org/hg/editing/raw-file/tip/edit-
ing.html
for a list of argument specifications for each formatting and editing command.
Step 2: Implement the rich-text editing toolbar in the visual editor
To use
execCommand
, the application will use a
click
event handler to pass the func-
tion name of a pressed toolbar button to
execCommand
's
command
argument. This func-
tion name will be retrieved from the button's
data-command
attribute. Add the code
from the following listing to app.js, directly after the code you added in the previous sec-
tion.
Listing 3.7. app.js-Implementing the rich-text editing toolbar in the visual editor