diff --git a/editor/docs/Editor_Embedding_Guide.html b/editor/docs/Editor_Embedding_Guide.html deleted file mode 100644 index 3c076f3f9dd..00000000000 --- a/editor/docs/Editor_Embedding_Guide.html +++ /dev/null @@ -1,704 +0,0 @@ - - -
- - -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.
-
nsCOMPtr<nsIDOMWindow> domWindow;
- nsresult rv =
-nsIWebBrowser->GetContentDOMWindow(getter_AddRefs(domWindow));
- if (NS_FAILED(rv)) return NS_ERROR_FAILURE; // we
-are not setup??!!
-
nsCOMPtr<nsIEditingSession>
-editingSession;
-
-nsIWebBrowser->do_GetInterface(getter_AddRefs(editingSession));
- if (editingSession)
-
-editingSession->MakeWindowEditable(domWindow, "html", PR_TRUE,
-PR_FALSE, PR_TRUE, PR_FALSE);
The valid editor types are:
-
To do anything meaningful you of course need to call commands and
-receive updates. First get the nsICommandManager from the nsIWebBrowser
-using do_GetInterface.
nsCOMPtr<nsICommandManager>
-commandManager;
-
-nsIWebBrowser->do_GetInterface(getter_AddRefs(commandMgr));
-
To call a command use DoCommand:
-commandManager->DoCommand(aCommand, -aCommandParams);
- aCommand is a const char * to a supported
-command name (see list below).
- aCommandParams 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)
To see if a command is enabled use IsCommandEnabled
-commandManager->IsCommandEnabled(aCommand, -retval)
-To get the current command state of a given command use -GetCommandState:
- commandManager->GetCommandState(aCommand,aCommandParams)
-
Command - |
- 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 - |
-
Description - |
- acts upon the current selection to
-apply style -(cmd_tt is fixed width or "teletype" style) - |
-
GetCommandState - |
- "state_all"(boolean),
-"state_begin"(boolean), -"state_end"(boolean), "state_mixed"(boolean) -"state_enabled" (boolean) - |
-
DoCommand - |
- no parameters - |
-
- |
- see also cmd_removeStyles - |
-
-
Command - |
- cmd_removeLinks - |
-
Description - |
- removes the existing link from the
-selection (if any) - |
-
GetCommandState - |
- "state_enabled"(boolean) -??? - |
-
DoCommand - |
- no parameters - |
-
- |
- - |
-
-
Command - |
- cmd_ol, cmd_ul, cmd_dt, cmd_dd - |
-
Description - |
- converts selection to appropriate
-list or list item; inserts new list if no selection (cmd_ol, cmd_ul) - |
-
GetCommandState - |
- "state_enabled"(boolean) -??? - |
-
DoCommand - |
- no parameters - |
-
- |
- see also cmd_removeList - |
-
-
Command - |
- cmd_indent, cmd_outdent - |
-
Description - |
- indents/outdents the line(s) of the
-current selection - |
-
GetCommandState - |
- "state_enabled"(boolean) -??? - |
-
DoCommand - |
- no parameters - |
-
- |
- - |
-
-
-
-
Command - |
- cmd_increaseFont, cmd_decreaseFont - |
-
Description - |
- acts upon the current selection to
-adjust font size (uses <big> and <small> tags). - |
-
GetCommandState - |
- "state_enabled" | -
DoCommand - |
- no parameters - |
-
- |
- - |
-
-
Command - |
- cmd_undo, cmd_redo - |
-
Description - |
- undoes/redoes last executed command.
- (only available if txmgr.dll is present) - |
-
GetCommandState - |
- "state_enabled" | -
DoCommand - |
- no parameters - |
-
- |
- - |
-
-
Command - |
- cmd_fontColor - |
-
Description - |
- acts upon the current selection to
-set the font color - |
-
GetCommandState - |
- "state_attribute" (cstring) - |
-
DoCommand - |
- "state_attribute" (cstring) ** - |
-
- |
- - |
-
-
Command - |
- cmd_backgroundColor - |
-
Description - |
- sets the background color of
- the document - |
-
GetCommandState - |
- "state_attribute" (cstring) | -
DoCommand - |
- "state_attribute" (cstring) ** | -
- |
- - |
-
-
Command - |
- cmd_fontFace - |
-
Description - |
- sets the font face for the current
-selection - |
-
GetCommandState - |
- "state_attribute" (string) | -
DoCommand - |
- "state_attribute" (cstring or
-string) - "Helvetica, Arial, sans-serif" - "Times New Roman, Times, serif" - "Courier New, Courier, monospace" -[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] - |
-
- |
- - |
-
-
Command - |
- cmd_align - |
-
Description - |
- sets the alignment for the lines
-contained in the current selection - |
-
GetCommandState - |
- "state_attribute" (cstring) | -
DoCommand - |
- "state_attribute"
-(cstring) "left","right","center", "full"??? XXXX - |
-
- |
- - |
-
-cmd_insertHTML
-cmd_insertLinkNoUI
-cmd_insertImageNoUI
-cmd_insertHR
-
-
Command - |
- "cmd_charSet" XXXXX | -
Description - |
- sets the charset for the document.
-there must be a clear undo stack or this will not work - |
-
GetCommandState - |
- "state_attribute" (cstring) - |
-
DoCommand - |
- "state_attribute" -(cstring) | -
- |
- - |
-
-
Command - |
- "cmd_copy", "cmd_delete", "cmd_cut", -"cmd_paste", "cmd_cutOrDelete" | -
Description - |
- operates on the current selection to
-copy, delete, cut and paste respectively - |
-
GetCommandState - |
- *"state_enabled" (boolean) | -
DoCommand - |
- no parameter | -
- |
- - |
-
-
Command - |
- "cmd_deleteCharBackward", "cmd_deleteCharForward",
-"cmd_deleteWordForward", -"cmd_deleteWordBackward", -"cmd_deleteToBeginningOfLine", "cmd_deleteToEndOfLine", - |
-
Description - |
- deletes relative to the current
-selection end point. - |
-
GetCommandState - |
- *"state_enabled" (boolean) | -
DoCommand - |
- no parameter | -
- |
- - |
-
-
Command - |
- "cmd_scrollTop", "cmd_scrollBottom", "cmd_scrollPageUp", "cmd_scrollPageDown", -"cmd_selectTop", -"cmd_selectBottom", "cmd_selectLineNext", "cmd_selectLinePrevious", -"cmd_selectCharPrevious", -"cmd_selectCharNext", "cmd_selectBeginLine", "cmd_selectEndLine", -"cmd_selectWordPrevious", "cmd_selectWordNext", |
-
Description - |
- scrolls relative to the current
-selection end point. - |
-
GetCommandState - |
- *"state_enabled" (boolean) | -
DoCommand - |
- no parameter | -
- |
- - |
-
-
Command - |
- "cmd_movePageUp", "cmd_movePageDown", "cmd_moveTop", "cmd_moveBottom", -"cmd_lineNext", -"cmd_linePrevious", "cmd_charPrevious", "cmd_charNext", "cmd_beginLine", -"cmd_endLine", "cmd_wordPrevious", "cmd_wordNext" |
-
Description - |
- scrolls relative to the current
-selection end point. - |
-
GetCommandState - |
- *"state_enabled" (boolean) | -
DoCommand - |
- no parameter | -
- |
- - |
-
*Note: GetCommandState in these cases will return whether or not it
-is
-possible to call DoCommand. This will not really give you any
-concrete
-information on the state of the current indent and outdent .
-**Note: for color values, use the cstring representation of RRGGBB. i.e.
-RED="#FF0000" and BLACK="#000000"
-
-
SetBooleanValue
-SetLongValue
-SetDoubleValue
-SetStringValue
-SetCStringValue
-SetISupportsValue
-RemoveValue
Each will take a name value pair. In the case of
-SetBooleanValue for
-example you use a boolean as the second parameter.
-commandParam->SetCStringValue("state_attribute","left");
-
First
-GetNext (returns the next name in the name/value pair list)
-HasMoreElements
-GetValueType (numeric enum type see nsICommandParams for values)
If the name/value pair is known or it was obtained using the methods
-described above, it is possible to call the following methods.
GetBooleanValue
-GetLongValue
-GetDoubleValue
-GetStringValue
-GetCStringValue
-GetISupportsValue
All of these take pointers to values except for GetStringValue which
-demands a reference to an nsAString.
commandParam->GetBooleanValue("state_enabled",&boolval);
-
document.getElementById("edit").contentDocument.designMode="on";
editableDocument.execCommand("Bold",
-false, null);
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.-
-
This section needs to be written. It can be called -similarly to IE implementation.-
-
This section needs to be written. It can be called -similarly to IE implementation. --
command | -value | -explanation / behavior | -
backcolor | -???? | -This command will set the background color of the document. | -
bold | -none | -If there is no selection, the insertion
-point will set bold for subsequently typed characters. - -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. |
-
contentReadOnly | -true false |
- 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. | -
copy | -none | -If there is a selection, this command will copy the selection
-to the clipboard. If there isn't a selection, nothing will happen. - -note: this command won't work without setting a pref or using signed -JS. See: http://www.mozilla.org/editor/midasdemo/securityprefs.html - -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. |
-
createlink | -url (href) | -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. | -
cut | -none | -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. - -note: this command won't work without setting a pref or using signed -JS. See: http://www.mozilla.org/editor/midasdemo/securityprefs.html - -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. |
-
decreasefontsize | -none | -This command will add a <small> tag around selection or -at insertion point. | -
delete | -none | -This command will delete all text and objects that -are selected. | -
fontname | -???? | -This command will set the fontface for a selection -or at the insertion point if there is no selection. | -
fontsize | -???? | -This command will set the fontsize for a selection -or at the insertion point if there is no selection. | -
forecolor | -???? | -This command will set the text color of the -selection or at the insertion point. | -
formatblock | -<h1> -<h2> -<h3> -<h4> -<h5> -<h6> -<pre> -<address> -<p> -p -[this list may not be complete] |
- |
heading | -<h1> -<h2> -<h3> -<h4> -<h5> -<h6> |
- |
hilitecolor | -???? | -This command will set the hilite color of the selection or at -the insertion point. It only works with usecss enabled. | -
increasefontsize | -none | -This command will add a -<big> tag around selection or at insertion point. | -
indent | -none | -Indent the block where the caret is located. | -
inserthorizontalrule | -none | -This command will insert a horizontal rule
-(line) at the insertion point. - -Does it delete the selection? |
-
inserthtml | -valid html string | -This command will insert the given html into the <body> -in place of the current selection or at the caret location. | -
insertimage | -url (src) | -This command will insert an image (referenced by
-url) at the insertion point. - -Does it delete the selection? |
-
insertorderedlist | -none | -|
insertunorderedlist | -none | -|
insertparagraph | -none | -|
italic | -none | -If there is no selection, the insertion
-point will set italic for subsequently typed characters. - -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. |
-
justifycenter | -none | -|
justifyfull | -none | -|
justifyleft | -none | -|
justifyright | -none | -|
outdent | -none | -Outdent the block where the caret is located. If the
-block is not indented prior to calling outdent, nothing will happen. - -note: is an error thrown if no outdenting is done? |
-
paste | -none | -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. - -note: this command won't work without setting a pref or using signed -JS. - user_pref("capability.policy.policynames", "allowclipboard"); -user_pref("capability.policy.allowclipboard.Clipboard.paste", -"allAccess"); -See: http://www.mozilla.org/editor/midasdemo/securityprefs.html - -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. |
-
redo | -none | -This command will redo the previous undo action. If undo
-was not the most recent action, this command will have no effect. - -note: the shortcut key will automatically trigger this command -(typically accel-shift-Z) |
-
removeformat | -none | -|
selectall | -none | -This command will select all of the contents within the
-editable area. - -note: the shortcut key will automatically trigger this command -(typically accel-A) |
-
strikethrough | -none | -If there is no selection, the insertion point
-will set strikethrough for subsequently typed characters. - -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. |
-
styleWithCSS | -true false |
- 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. | -
subscript | -none | -If there is no selection, the insertion point
-will set subscript for subsequently typed characters. - -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. |
-
superscript | -none | -If there is no selection, the insertion point
-will set superscript for subsequently typed characters. - -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. |
-
underline | -none | -If there is no selection, the insertion
-point will set underline for subsequently typed characters. - -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. |
-
undo | -none | -This command will undo the previous action. If no action
-has occurred in the document, then this command will have no effect. - -note: the shortcut key will automatically trigger this command -(typically accel-Z) |
-
unlink | -none | -
DEPRECATED COMMANDS | -||
readonly | -true false |
- This command has been replaced with contentReadOnly. It -takes the same values as contentReadOnly, but the meaning of true and -false are inversed. | -
useCSS | -truefalse | -This command has been replaced with styleWithCSS. It takes -the same values as styleWithCSS, but the meaning of true and false are -inversed. | -