зеркало из https://github.com/mozilla/pjs.git
Bug 473466 - Remove editor docs; r=ehsan
This commit is contained in:
Родитель
25785ef54f
Коммит
79dd5d1074
|
@ -1,704 +0,0 @@
|
|||
<!DOCTYPE doctype PUBLIC "-//w3c//dtd html 4.0 transitional//en">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type"
|
||||
content="text/html; charset=iso-8859-1">
|
||||
<meta name="Author" content="mike judge">
|
||||
<title></title>
|
||||
</head>
|
||||
<body>
|
||||
<h1><b> A Guide to Embedding The Gecko Editor</b></h1>
|
||||
11/5/02 original by Michael Judge <<a
|
||||
href="mailto:mjudge@netscape.com">mjudge@netscape.com</a>><br>
|
||||
3/27/03 updates by Kathleen Brade <<a
|
||||
href="mailto:brade@netscape.com">brade@netscape.com</a>><br>
|
||||
<h2>In the Beginning there is MakeEditable</h2>
|
||||
<p>Given an nsIWebBrowser instance, get a nsIDOMWindow from the
|
||||
GetContentDOMWindow call. Then simply call
|
||||
nsIWebBrowser->do_GetInterface on the nsIWebBrowser to retrieve the
|
||||
nsIEditingSession from it. From there you call
|
||||
editingSession->MakeWindowEditable(domWindow, editortype,
|
||||
PR_TRUE, PR_FALSE); The first parameter is the nsIDOMWindow
|
||||
you just retrieved, the second is the editor type you want to create and the
|
||||
third is whether you want the window editable immediately or when the
|
||||
document is done loading, the fourth is whether you want the editor to make
|
||||
the whole document editable, the fifth is whether you want to turn of
|
||||
scripts, plugins, ... In calling this method the editor is
|
||||
created underneath and the event listeners etc. are all prepared.<br>
|
||||
</p>
|
||||
<p><i> nsCOMPtr<nsIDOMWindow> domWindow;<br>
|
||||
nsresult rv =
|
||||
nsIWebBrowser->GetContentDOMWindow(getter_AddRefs(domWindow));<br>
|
||||
if (NS_FAILED(rv)) return NS_ERROR_FAILURE; // we
|
||||
are not setup??!!<br>
|
||||
</i></p>
|
||||
<p><i> nsCOMPtr<nsIEditingSession>
|
||||
editingSession;<br>
|
||||
|
||||
nsIWebBrowser->do_GetInterface(getter_AddRefs(editingSession));<br>
|
||||
if (editingSession)<br>
|
||||
|
||||
editingSession->MakeWindowEditable(domWindow, "html", PR_TRUE,
|
||||
PR_FALSE, PR_TRUE, PR_FALSE);</i></p>
|
||||
<p>The valid editor types are:<br>
|
||||
</p>
|
||||
<ul>
|
||||
<li>"text" (similar to NotePad or a textarea; does not allow for html)</li>
|
||||
<li>"textmail" (similar to "text" but html can be inserted; intended
|
||||
for plaintext mail usage and handling of citations)</li>
|
||||
<li>"html" (this is the default type if no type is specified; it
|
||||
allows for all html tags to be inserted)<br>
|
||||
</li>
|
||||
<li>"htmlmail" (this is much like "html" except there are a few
|
||||
editing rules / behaviors that differ such as splitting of mail quotes)<br>
|
||||
</li>
|
||||
</ul>
|
||||
<h2>Editor Commands</h2>
|
||||
<p>To do anything meaningful you of course need to call commands and<br>
|
||||
receive updates. First get the nsICommandManager from the nsIWebBrowser<br>
|
||||
using do_GetInterface.</p>
|
||||
<p><i> nsCOMPtr<nsICommandManager>
|
||||
commandManager;<br>
|
||||
|
||||
nsIWebBrowser->do_GetInterface(getter_AddRefs(commandMgr));</i><br>
|
||||
</p>
|
||||
<p>To call a command use DoCommand:</p>
|
||||
<p><i> </i><i>commandManager</i><i>->DoCommand(aCommand,
|
||||
aCommandParams);</i> </p>
|
||||
<p> <i>aCommand</i> is a const char * to a supported
|
||||
command name (see list below).<br>
|
||||
<i>aCommandParams</i> could possibly be a null
|
||||
pointer or a pointer to a valid structure filled with relative
|
||||
parameters to aCommand. (see list below for legal params)</p>
|
||||
<p>To see if a command is enabled use IsCommandEnabled</p>
|
||||
<p><i> </i><i>commandManager</i><i>->IsCommandEnabled(aCommand,
|
||||
retval)</i> </p>
|
||||
<p>To get the current command state of a given command use
|
||||
GetCommandState: </p>
|
||||
<p><i> </i><i>commandManager</i><i>->GetCommandState(aCommand,aCommandParams)</i> <br>
|
||||
</p>
|
||||
<h3>Index of Commands and Parameters</h3>
|
||||
<table cellpadding="2" cellspacing="2" border="1" width="100%">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td valign="top">Command<br>
|
||||
</td>
|
||||
<td valign="top" width="75%">cmd_bold, cmd_italics,
|
||||
cmd_underline, cmd_tt, cmd_strikethru, cmd_superscript, cmd_subscript,
|
||||
cmd_nobreak, cmd_em, cmd_strong, cmd_cite, cmd_abbr, cmd_acronym,
|
||||
cmd_code, cmd_samp, cmd_var<br>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">Description<br>
|
||||
</td>
|
||||
<td valign="top" width="75%">acts upon the current selection to
|
||||
apply style<br>
|
||||
(cmd_tt is fixed width or "teletype" style)<br>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">GetCommandState<br>
|
||||
</td>
|
||||
<td valign="top" width="75%">"state_all"(boolean),
|
||||
"state_begin"(boolean),<br>
|
||||
"state_end"(boolean), "state_mixed"(boolean)<br>
|
||||
"state_enabled" (boolean)<br>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">DoCommand<br>
|
||||
</td>
|
||||
<td valign="top" width="75%">no parameters<br>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top"><br>
|
||||
</td>
|
||||
<td valign="top" width="75%">see also cmd_removeStyles<br>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p><br>
|
||||
</p>
|
||||
<table cellpadding="2" cellspacing="2" border="1" width="100%">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td valign="top">Command<br>
|
||||
</td>
|
||||
<td valign="top" width="75%">cmd_removeLinks<br>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">Description<br>
|
||||
</td>
|
||||
<td valign="top" width="75%">removes the existing link from the
|
||||
selection (if any)<br>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">GetCommandState<br>
|
||||
</td>
|
||||
<td valign="top" width="75%">"state_enabled"(boolean)<br>
|
||||
???<br>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">DoCommand<br>
|
||||
</td>
|
||||
<td valign="top" width="75%">no parameters<br>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top"><br>
|
||||
</td>
|
||||
<td valign="top" width="75%"><br>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p><br>
|
||||
</p>
|
||||
<table cellpadding="2" cellspacing="2" border="1" width="100%">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td valign="top">Command<br>
|
||||
</td>
|
||||
<td valign="top" width="75%">cmd_ol, cmd_ul, cmd_dt, cmd_dd<br>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">Description<br>
|
||||
</td>
|
||||
<td valign="top" width="75%">converts selection to appropriate
|
||||
list or list item; inserts new list if no selection (cmd_ol, cmd_ul)<br>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">GetCommandState<br>
|
||||
</td>
|
||||
<td valign="top" width="75%">"state_enabled"(boolean)<br>
|
||||
???<br>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">DoCommand<br>
|
||||
</td>
|
||||
<td valign="top" width="75%">no parameters<br>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top"><br>
|
||||
</td>
|
||||
<td valign="top" width="75%">see also cmd_removeList<br>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p><br>
|
||||
</p>
|
||||
<table cellpadding="2" cellspacing="2" border="1" width="100%">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td valign="top">Command<br>
|
||||
</td>
|
||||
<td valign="top" width="75%">cmd_indent, cmd_outdent<br>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">Description<br>
|
||||
</td>
|
||||
<td valign="top" width="75%">indents/outdents the line(s) of the
|
||||
current selection<br>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">GetCommandState<br>
|
||||
</td>
|
||||
<td valign="top" width="75%">"state_enabled"(boolean)<br>
|
||||
???<br>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">DoCommand<br>
|
||||
</td>
|
||||
<td valign="top" width="75%">no parameters<br>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top"><br>
|
||||
</td>
|
||||
<td valign="top" width="75%"><br>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p><br>
|
||||
</p>
|
||||
<p> </p>
|
||||
<p> </p>
|
||||
<table cellpadding="2" cellspacing="2" border="1" width="100%">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td valign="top">Command<br>
|
||||
</td>
|
||||
<td valign="top" width="75%">cmd_increaseFont, cmd_decreaseFont<br>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">Description<br>
|
||||
</td>
|
||||
<td valign="top" width="75%">acts upon the current selection to
|
||||
adjust font size (uses <big> and <small> tags).<br>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">GetCommandState<br>
|
||||
</td>
|
||||
<td valign="top" width="75%">"state_enabled" </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">DoCommand<br>
|
||||
</td>
|
||||
<td valign="top" width="75%">no parameters<br>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top"><br>
|
||||
</td>
|
||||
<td valign="top" width="75%"><br>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p><br>
|
||||
</p>
|
||||
<table cellpadding="2" cellspacing="2" border="1" width="100%">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td valign="top">Command<br>
|
||||
</td>
|
||||
<td valign="top" width="75%">cmd_undo, cmd_redo<br>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">Description<br>
|
||||
</td>
|
||||
<td valign="top" width="75%">undoes/redoes last executed command.
|
||||
(only available if txmgr.dll is present)<br>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">GetCommandState<br>
|
||||
</td>
|
||||
<td valign="top" width="75%">"state_enabled" </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">DoCommand<br>
|
||||
</td>
|
||||
<td valign="top" width="75%">no parameters<br>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top"><br>
|
||||
</td>
|
||||
<td valign="top" width="75%"><br>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p><br>
|
||||
</p>
|
||||
<table cellpadding="2" cellspacing="2" border="1" width="100%">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td valign="top">Command<br>
|
||||
</td>
|
||||
<td valign="top" width="75%">cmd_fontColor<br>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">Description<br>
|
||||
</td>
|
||||
<td valign="top" width="75%">acts upon the current selection to
|
||||
set the font color<br>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">GetCommandState<br>
|
||||
</td>
|
||||
<td valign="top" width="75%">"state_attribute" (cstring)<br>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">DoCommand<br>
|
||||
</td>
|
||||
<td valign="top" width="75%">"state_attribute" (cstring) **<br>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top"><br>
|
||||
</td>
|
||||
<td valign="top" width="75%"><br>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p><br>
|
||||
</p>
|
||||
<table cellpadding="2" cellspacing="2" border="1" width="100%">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td valign="top">Command<br>
|
||||
</td>
|
||||
<td valign="top" width="75%">cmd_backgroundColor<br>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">Description<br>
|
||||
</td>
|
||||
<td valign="top" width="75%">sets the background color of
|
||||
the document<br>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">GetCommandState<br>
|
||||
</td>
|
||||
<td valign="top" width="75%">"state_attribute" (cstring) </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">DoCommand<br>
|
||||
</td>
|
||||
<td valign="top" width="75%">"state_attribute" (cstring) ** </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top"><br>
|
||||
</td>
|
||||
<td valign="top" width="75%"><br>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p><br>
|
||||
</p>
|
||||
<table cellpadding="2" cellspacing="2" border="1" width="100%">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td valign="top">Command<br>
|
||||
</td>
|
||||
<td valign="top" width="75%">cmd_fontFace<br>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">Description<br>
|
||||
</td>
|
||||
<td valign="top" width="75%">sets the font face for the current
|
||||
selection<br>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">GetCommandState<br>
|
||||
</td>
|
||||
<td valign="top" width="75%">"state_attribute" (string) </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">DoCommand<br>
|
||||
</td>
|
||||
<td valign="top" width="75%">"state_attribute" (cstring or
|
||||
string) <br>
|
||||
"Helvetica, Arial, sans-serif"<br>
|
||||
"Times New Roman, Times, serif"<br>
|
||||
"Courier New, Courier, monospace" <br>
|
||||
[any string is acceptable; the above strings should be considered
|
||||
examples or base functionality and in no way imply that this command
|
||||
won't handle other fonts]<br>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top"><br>
|
||||
</td>
|
||||
<td valign="top" width="75%"><br>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p><br>
|
||||
</p>
|
||||
<table cellpadding="2" cellspacing="2" border="1" width="100%">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td valign="top">Command<br>
|
||||
</td>
|
||||
<td valign="top" width="75%">cmd_align<br>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">Description<br>
|
||||
</td>
|
||||
<td valign="top" width="75%">sets the alignment for the lines
|
||||
contained in the current selection<br>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">GetCommandState<br>
|
||||
</td>
|
||||
<td valign="top" width="75%">"state_attribute" (cstring) </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">DoCommand<br>
|
||||
</td>
|
||||
<td valign="top" width="75%">"state_attribute"
|
||||
(cstring) "left","right","center", "full"??? XXXX<br>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top"><br>
|
||||
</td>
|
||||
<td valign="top" width="75%"><br>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p><br>
|
||||
cmd_insertHTML<br>
|
||||
cmd_insertLinkNoUI<br>
|
||||
cmd_insertImageNoUI<br>
|
||||
cmd_insertHR<br>
|
||||
</p>
|
||||
<p><br>
|
||||
</p>
|
||||
<table cellpadding="2" cellspacing="2" border="1" width="100%">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td valign="top">Command<br>
|
||||
</td>
|
||||
<td valign="top" width="75%">"cmd_charSet" XXXXX </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">Description<br>
|
||||
</td>
|
||||
<td valign="top" width="75%">sets the charset for the document.
|
||||
there must be a clear undo stack or this will not work<br>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">GetCommandState<br>
|
||||
</td>
|
||||
<td valign="top" width="75%">"state_attribute" (cstring)<br>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">DoCommand<br>
|
||||
</td>
|
||||
<td valign="top" width="75%">"state_attribute"
|
||||
(cstring) </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top"><br>
|
||||
</td>
|
||||
<td valign="top" width="75%"><br>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p><br>
|
||||
</p>
|
||||
<table cellpadding="2" cellspacing="2" border="1" width="100%">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td valign="top">Command<br>
|
||||
</td>
|
||||
<td valign="top" width="75%">"cmd_copy", "cmd_delete", "cmd_cut",
|
||||
"cmd_paste", "cmd_cutOrDelete"</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">Description<br>
|
||||
</td>
|
||||
<td valign="top" width="75%">operates on the current selection to
|
||||
copy, delete, cut and paste respectively<br>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">GetCommandState<br>
|
||||
</td>
|
||||
<td valign="top" width="75%">*"state_enabled" (boolean) </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">DoCommand<br>
|
||||
</td>
|
||||
<td valign="top" width="75%">no parameter </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top"><br>
|
||||
</td>
|
||||
<td valign="top" width="75%"><br>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p><br>
|
||||
</p>
|
||||
<table cellpadding="2" cellspacing="2" border="1" width="100%">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td valign="top">Command<br>
|
||||
</td>
|
||||
<td valign="top" width="75%">"cmd_deleteCharBackward", "cmd_deleteCharForward",
|
||||
"cmd_deleteWordForward",<br>
|
||||
"cmd_deleteWordBackward",
|
||||
"cmd_deleteToBeginningOfLine", "cmd_deleteToEndOfLine",<br>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">Description<br>
|
||||
</td>
|
||||
<td valign="top" width="75%">deletes relative to the current
|
||||
selection end point.<br>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">GetCommandState<br>
|
||||
</td>
|
||||
<td valign="top" width="75%">*"state_enabled" (boolean) </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">DoCommand<br>
|
||||
</td>
|
||||
<td valign="top" width="75%">no parameter </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top"><br>
|
||||
</td>
|
||||
<td valign="top" width="75%"><br>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p><br>
|
||||
</p>
|
||||
<table cellpadding="2" cellspacing="2" border="1" width="100%">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td valign="top">Command<br>
|
||||
</td>
|
||||
<td valign="top" width="75%">"cmd_scrollTop", "cmd_scrollBottom", "cmd_scrollPageUp", "cmd_scrollPageDown",<br>
|
||||
"cmd_selectTop",
|
||||
"cmd_selectBottom", "cmd_selectLineNext", "cmd_selectLinePrevious",<br>
|
||||
"cmd_selectCharPrevious",
|
||||
"cmd_selectCharNext", "cmd_selectBeginLine", "cmd_selectEndLine",<br>
|
||||
"cmd_selectWordPrevious", "cmd_selectWordNext", </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">Description<br>
|
||||
</td>
|
||||
<td valign="top" width="75%">scrolls relative to the current
|
||||
selection end point.<br>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">GetCommandState<br>
|
||||
</td>
|
||||
<td valign="top" width="75%">*"state_enabled" (boolean) </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">DoCommand<br>
|
||||
</td>
|
||||
<td valign="top" width="75%">no parameter </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top"><br>
|
||||
</td>
|
||||
<td valign="top" width="75%"><br>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p><br>
|
||||
</p>
|
||||
<table cellpadding="2" cellspacing="2" border="1" width="100%">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td valign="top">Command<br>
|
||||
</td>
|
||||
<td valign="top" width="75%">"cmd_movePageUp", "cmd_movePageDown", "cmd_moveTop", "cmd_moveBottom",<br>
|
||||
"cmd_lineNext",
|
||||
"cmd_linePrevious", "cmd_charPrevious", "cmd_charNext", "cmd_beginLine",<br>
|
||||
"cmd_endLine", "cmd_wordPrevious", "cmd_wordNext"</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">Description<br>
|
||||
</td>
|
||||
<td valign="top" width="75%">scrolls relative to the current
|
||||
selection end point.<br>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">GetCommandState<br>
|
||||
</td>
|
||||
<td valign="top" width="75%">*"state_enabled" (boolean) </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">DoCommand<br>
|
||||
</td>
|
||||
<td valign="top" width="75%">no parameter </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top"><br>
|
||||
</td>
|
||||
<td valign="top" width="75%"><br>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p>*Note: GetCommandState in these cases will return whether or not it
|
||||
is <br>
|
||||
possible to call DoCommand. This will not really give you any
|
||||
concrete <br>
|
||||
information on the state of the current indent and outdent .<br>
|
||||
**Note: for color values, use the cstring representation of RRGGBB. i.e.<br>
|
||||
RED="#FF0000" and BLACK="#000000"<br>
|
||||
<br>
|
||||
</p>
|
||||
<h2>nsICommandParams </h2>
|
||||
<h3>Creating:</h3>
|
||||
<i>- how do you create an nsICommandParams? -saari</i><br>
|
||||
<br>
|
||||
<h3>Writing:</h3>
|
||||
Once you have created an nsICommandParams you call the "Set" methods.
|
||||
<p>SetBooleanValue<br>
|
||||
SetLongValue<br>
|
||||
SetDoubleValue<br>
|
||||
SetStringValue<br>
|
||||
SetCStringValue<br>
|
||||
SetISupportsValue<br>
|
||||
RemoveValue</p>
|
||||
<p>Each will take a name value pair. In the case of
|
||||
SetBooleanValue for<br>
|
||||
example you use a boolean as the second parameter.</p>
|
||||
<p> <i>
|
||||
commandParam->SetCStringValue("state_attribute","left");</i><br>
|
||||
</p>
|
||||
<h3>Reading:</h3>
|
||||
For reading you may go after individual name/value pairs you know are<br>
|
||||
there or you may iterate through all the name/value pairs and<br>
|
||||
programatically pull off data.
|
||||
<p>First<br>
|
||||
GetNext (returns the next name in the name/value pair list)<br>
|
||||
HasMoreElements<br>
|
||||
GetValueType (numeric enum type see nsICommandParams for values)</p>
|
||||
<p>If the name/value pair is known or it was obtained using the methods<br>
|
||||
described above, it is possible to call the following methods.</p>
|
||||
<p>GetBooleanValue<br>
|
||||
GetLongValue<br>
|
||||
GetDoubleValue<br>
|
||||
GetStringValue<br>
|
||||
GetCStringValue<br>
|
||||
GetISupportsValue</p>
|
||||
<p>All of these take pointers to values except for GetStringValue which<br>
|
||||
demands a reference to an nsAString.</p>
|
||||
<p>commandParam->GetBooleanValue("state_enabled",&boolval);<br>
|
||||
</p>
|
||||
<br>
|
||||
</body>
|
||||
</html>
|
|
@ -1,426 +0,0 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
|
||||
<title>Midas Specification</title>
|
||||
<meta name="author" content="Kathleen Brade">
|
||||
<style type="text/css">
|
||||
td { vertical-align: top; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
Last revised: August 23, 2005<br>
|
||||
<br>
|
||||
This document describes the rich text editing controls for web pages
|
||||
available in recent mozilla browsers.<br>
|
||||
<br>
|
||||
<h1> Enabling Rich Text Editing in your web page:</h1>
|
||||
<div style="margin-left: 40px;">Given a document, you can add the
|
||||
attribute "designMode" and set it to "on" to get an editable document.
|
||||
For example, in JavaScript, if you have an iframe with an id of 'edit', you
|
||||
can get its contentDocument and set designMode to "on" like this:<br>
|
||||
<div style="margin-left: 40px;"><code>document.getElementById("edit").contentDocument.designMode="on";</code></div>
|
||||
<br>
|
||||
Right now, you can't completely turn off editing by setting designMode
|
||||
to "off." Setting designMode to "off" will prevent certain operations
|
||||
from being handled but typing and other actions are still possible.<br>
|
||||
</div>
|
||||
<br>
|
||||
<h1>Invoking Commands:</h1>
|
||||
<h2>execCommand</h2>
|
||||
<div style="margin-left: 40px;">Given a document that has rich text
|
||||
editing enabled (see above), you can invoke specific commands on the
|
||||
document by calling execCommand with 3 parameters. For example,
|
||||
in JavaScript, if you have an editable document,
|
||||
you can invoke the bold command by calling this:<br>
|
||||
<div style="margin-left: 40px;"><code>editableDocument.execCommand("Bold",
|
||||
false, null);</code></div><br>
|
||||
Notes: If you haven't set designMode to "On", you will get an
|
||||
error. This could also happen if you call execCommand with the wrong
|
||||
document.<br>
|
||||
<br>
|
||||
There are 3 required parameters for execCommand:<br>
|
||||
<ol>
|
||||
<li>command string</li>
|
||||
<li>boolean flag for showing UI</li>
|
||||
<li>value string</li>
|
||||
</ol>
|
||||
The first parameter is a string which contains the command. The
|
||||
second parameter is a boolean flag. If it is set to true, you will
|
||||
get an error (NS_ERROR_NOT_IMPLEMENTED). The third parameter is a
|
||||
string which is the value. Some commands will require details such
|
||||
as the particular size you want to set when setting a font size.<br>
|
||||
<br>
|
||||
The section on Supported Commands will document each command and any
|
||||
corresponding values needed.<br>
|
||||
</div>
|
||||
<div style="margin-left: 40px;"> </div>
|
||||
<br>
|
||||
<h2>queryCommandEnabled</h2>
|
||||
<blockquote>This command operates on the editable document. There
|
||||
is one required parameter (the command string). The result is a
|
||||
boolean which is true if the command is can be done given the current
|
||||
selection and/or caret position. The result is false if the command
|
||||
should not be invoked (execCommand) given the current selection and/or
|
||||
caret position.<br>
|
||||
</blockquote>
|
||||
<br>
|
||||
<h2>queryCommandState</h2>
|
||||
<blockquote>This section needs to be written. It can be called
|
||||
similarly to IE implementation.<br>
|
||||
</blockquote>
|
||||
<br>
|
||||
<h2>queryCommandValue</h2>
|
||||
<blockquote> This section needs to be written. It can be called
|
||||
similarly to IE implementation.
|
||||
</blockquote>
|
||||
<br>
|
||||
<h1>Supported Commands:</h1>
|
||||
<div style="margin-left: 40px;">The following list of commands is
|
||||
presented in alphabetical order. The commands may be mixed case
|
||||
or whatever makes your code more readable.<br>
|
||||
<br>
|
||||
<table cellpadding="4" cellspacing="0" border="1"
|
||||
style="text-align: left; width: 100%;">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>command</td>
|
||||
<td>value</td>
|
||||
<td>explanation / behavior</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>backcolor</td>
|
||||
<td>????</td>
|
||||
<td>This command will set the background color of the document.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>bold</td>
|
||||
<td>none</td>
|
||||
<td>If there is no selection, the insertion
|
||||
point will set bold for subsequently typed characters.<br>
|
||||
<br>
|
||||
If there is a selection and all of the characters are already bold, the
|
||||
bold will be removed. Otherwise, all selected characters will become
|
||||
bold.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>contentReadOnly</td>
|
||||
<td>true<br>false</td>
|
||||
<td>This command will make the editor readonly (true) or editable
|
||||
(false). Anticipated usage is for temporarily disabling input while
|
||||
something else is occurring elsewhere in the web page.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>copy</td>
|
||||
<td>none</td>
|
||||
<td>If there is a selection, this command will copy the selection
|
||||
to the clipboard. If there isn't a selection, nothing will happen.<br>
|
||||
<br>
|
||||
note: this command won't work without setting a pref or using signed
|
||||
JS. See: http://www.mozilla.org/editor/midasdemo/securityprefs.html<br>
|
||||
<br>
|
||||
note: the shortcut key will automatically trigger this command
|
||||
(typically accel-C) with or without the signed JS or any code on the page to
|
||||
handle it.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>createlink</td>
|
||||
<td>url (href)</td>
|
||||
<td>This command will not do anything if no selection
|
||||
is made. If there is a selection, a link will be inserted around
|
||||
the selection with the url parameter as the href of the link.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>cut</td>
|
||||
<td>none</td>
|
||||
<td>If there is a selection, this command will copy the selection
|
||||
to the clipboard and remove the selection from the edit control.
|
||||
If there isn't a selection, nothing will happen.<br>
|
||||
<br>
|
||||
note: this command won't work without setting a pref or using signed
|
||||
JS. See: http://www.mozilla.org/editor/midasdemo/securityprefs.html<br>
|
||||
<br>
|
||||
note: the shortcut key will automatically trigger this command
|
||||
(typically accel-X) with or without the signed JS or any code on the page to
|
||||
handle it.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>decreasefontsize</td>
|
||||
<td>none</td>
|
||||
<td>This command will add a <small> tag around selection or
|
||||
at insertion point.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>delete</td>
|
||||
<td>none</td>
|
||||
<td>This command will delete all text and objects that
|
||||
are selected.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>fontname</td>
|
||||
<td>????</td>
|
||||
<td>This command will set the fontface for a selection
|
||||
or at the insertion point if there is no selection.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>fontsize</td>
|
||||
<td>????</td>
|
||||
<td>This command will set the fontsize for a selection
|
||||
or at the insertion point if there is no selection.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>forecolor</td>
|
||||
<td>????</td>
|
||||
<td>This command will set the text color of the
|
||||
selection or at the insertion point.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>formatblock</td>
|
||||
<td><h1><br>
|
||||
<h2><br>
|
||||
<h3><br>
|
||||
<h4><br>
|
||||
<h5><br>
|
||||
<h6><br>
|
||||
<pre><br>
|
||||
<address><br>
|
||||
<p><br>
|
||||
p<br>
|
||||
[this list may not be complete]</td>
|
||||
<td><br></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>heading</td>
|
||||
<td><h1><br>
|
||||
<h2><br>
|
||||
<h3><br>
|
||||
<h4><br>
|
||||
<h5><br>
|
||||
<h6></td>
|
||||
<td><br></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>hilitecolor</td>
|
||||
<td>????</td>
|
||||
<td>This command will set the hilite color of the selection or at
|
||||
the insertion point. It only works with usecss enabled.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>increasefontsize</td>
|
||||
<td>none</td>
|
||||
<td>This command will add a
|
||||
<big> tag around selection or at insertion point.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>indent</td>
|
||||
<td>none</td>
|
||||
<td>Indent the block where the caret is located.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>inserthorizontalrule</td>
|
||||
<td>none</td>
|
||||
<td>This command will insert a horizontal rule
|
||||
(line) at the insertion point.<br>
|
||||
<br>
|
||||
Does it delete the selection?</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>inserthtml</td>
|
||||
<td>valid html string</td>
|
||||
<td>This command will insert the given html into the <body>
|
||||
in place of the current selection or at the caret location.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>insertimage</td>
|
||||
<td>url (src)</td>
|
||||
<td>This command will insert an image (referenced by
|
||||
url) at the insertion point.<br>
|
||||
<br>
|
||||
Does it delete the selection?</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>insertorderedlist</td>
|
||||
<td>none</td>
|
||||
<td><br></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>insertunorderedlist</td>
|
||||
<td>none</td>
|
||||
<td><br></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>insertparagraph</td>
|
||||
<td>none</td>
|
||||
<td><br></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>italic</td>
|
||||
<td>none</td>
|
||||
<td>If there is no selection, the insertion
|
||||
point will set italic for subsequently typed characters. <br>
|
||||
<br>
|
||||
If there is a selection and all of the characters are already italic,
|
||||
the italic will be removed. Otherwise, all selected characters will
|
||||
become italic.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>justifycenter</td>
|
||||
<td>none</td>
|
||||
<td><br></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>justifyfull</td>
|
||||
<td>none</td>
|
||||
<td><br></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>justifyleft</td>
|
||||
<td>none</td>
|
||||
<td><br></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>justifyright</td>
|
||||
<td>none</td>
|
||||
<td><br></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>outdent</td>
|
||||
<td>none</td>
|
||||
<td>Outdent the block where the caret is located. If the
|
||||
block is not indented prior to calling outdent, nothing will happen.<br>
|
||||
<br>
|
||||
note: is an error thrown if no outdenting is done?</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>paste</td>
|
||||
<td>none</td>
|
||||
<td>This command will paste the contents of the clipboard at the
|
||||
location of the caret. If there is a selection, it will be deleted
|
||||
prior to the insertion of the clipboard's contents.<br>
|
||||
<br>
|
||||
note: this command won't work without setting a pref or using signed
|
||||
JS.<br>
|
||||
<tt>user_pref("capability.policy.policynames", "allowclipboard");</tt><tt>
|
||||
user_pref("capability.policy.allowclipboard.Clipboard.paste",
|
||||
"allAccess");</tt><br>
|
||||
See: http://www.mozilla.org/editor/midasdemo/securityprefs.html<br>
|
||||
<br>
|
||||
note: the shortcut key will automatically trigger this command
|
||||
(typically accel-V) with or without the signed JS or any code on the page to
|
||||
handle it.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>redo</td>
|
||||
<td>none</td>
|
||||
<td>This command will redo the previous undo action. If undo
|
||||
was not the most recent action, this command will have no effect.<br>
|
||||
<br>
|
||||
note: the shortcut key will automatically trigger this command
|
||||
(typically accel-shift-Z)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>removeformat</td>
|
||||
<td>none</td>
|
||||
<td><br></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>selectall</td>
|
||||
<td>none</td>
|
||||
<td>This command will select all of the contents within the
|
||||
editable area.<br>
|
||||
<br>
|
||||
note: the shortcut key will automatically trigger this command
|
||||
(typically accel-A)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>strikethrough</td>
|
||||
<td>none</td>
|
||||
<td>If there is no selection, the insertion point
|
||||
will set strikethrough for subsequently typed characters.<br>
|
||||
<br>
|
||||
If there is a selection and all of the characters are already striked,
|
||||
the strikethrough will be removed. Otherwise, all selected characters
|
||||
will have a line drawn through them.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>styleWithCSS</td>
|
||||
<td>true<br>false</td>
|
||||
<td>This command is used for
|
||||
toggling the format of generated content. By default (at least
|
||||
today), this is true. An example of the differences is that the
|
||||
"bold" command will generate <b> if the styleWithCSS command is false
|
||||
and generate css style attribute if the styleWithCSS command is true.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>subscript</td>
|
||||
<td>none</td>
|
||||
<td>If there is no selection, the insertion point
|
||||
will set subscript for subsequently typed characters. <br>
|
||||
<br>
|
||||
If there is a selection and all of the characters are already
|
||||
subscripted, the subscript will be removed. Otherwise, all
|
||||
selected characters will be drawn slightly lower than normal text.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>superscript</td>
|
||||
<td>none</td>
|
||||
<td>If there is no selection, the insertion point
|
||||
will set superscript for subsequently typed characters.<br>
|
||||
<br>
|
||||
If there is a selection and all of the characters are already
|
||||
superscripted, the superscript will be removed. Otherwise, all
|
||||
selected characters will be drawn slightly higher than normal text.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>underline</td>
|
||||
<td>none</td>
|
||||
<td>If there is no selection, the insertion
|
||||
point will set underline for subsequently typed characters.<br>
|
||||
<br>
|
||||
If there is a selection and all of the characters are already
|
||||
underlined, the underline will be removed. Otherwise, all
|
||||
selected characters will become underlined.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>undo</td>
|
||||
<td>none</td>
|
||||
<td>This command will undo the previous action. If no action
|
||||
has occurred in the document, then this command will have no effect.<br>
|
||||
<br>
|
||||
note: the shortcut key will automatically trigger this command
|
||||
(typically accel-Z)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>unlink</td>
|
||||
<td>none</td>
|
||||
<td><br></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<br>
|
||||
<table cellpadding="4" cellspacing="0" border="1"
|
||||
style="text-align: left; width: 100%;">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td colspan="3">DEPRECATED COMMANDS</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>readonly</td>
|
||||
<td>true<br>false</td>
|
||||
<td>This command has been replaced with contentReadOnly. It
|
||||
takes the same values as contentReadOnly, but the meaning of true and
|
||||
false are inversed.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>useCSS</td>
|
||||
<td>truefalse</td>
|
||||
<td>This command has been replaced with styleWithCSS. It takes
|
||||
the same values as styleWithCSS, but the meaning of true and false are
|
||||
inversed.</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<br>
|
||||
</body>
|
||||
</html>
|
Загрузка…
Ссылка в новой задаче