{"json_modified": "2016-03-28T08:14:51.854263", "uuid": "73fa76ce-27e4-49a4-9c5d-488d39fb0cb6", "title": "Editor Embedding Guide", "url": "/en-US/docs/Editor_Embedding_Guide", "tags": ["Embedding Mozilla", "Guide", "Midas", "NeedsHelp"], "translations": [], "modified": "2016-03-04T00:57:08", "label": "Editor Embedding Guide", "localization_tags": [], "locale": "en-US", "id": 17090, "last_edit": "2016-03-04T00:57:05", "summary": "Given an nsIWebBrowser
instance, get an 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)
. 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. In calling this method, the editor is created underneath and the event listeners are all prepa\u00a0if (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_TRU?E);", "sections": [{"id": "In_the_Beginning_there_is_MakeEditable", "title": "In the Beginning there is MakeEditable"}, {"id": "Editor_Commands", "title": "Editor Commands"}, {"id": "Index_of_Commands_and_Parameters", "title": "Index of Commands and Parameters"}, {"id": "cmd_bold", "title": "cmd_bold"}, {"id": "cmd_italics", "title": "cmd_italics"}, {"id": "cmd_underline", "title": "cmd_underline"}, {"id": "cmd_tt", "title": "cmd_tt"}, {"id": "cmd_strikethrough", "title": "cmd_strikethrough"}, {"id": "cmd_superscript", "title": "cmd_superscript"}, {"id": "cmd_subscript", "title": "cmd_subscript"}, {"id": "cmd_nobreak", "title": "cmd_nobreak"}, {"id": "cmd_em", "title": "cmd_em"}, {"id": "cmd_strong", "title": "cmd_strong"}, {"id": "cmd_cite", "title": "cmd_cite"}, {"id": "cmd_abbr", "title": "cmd_abbr"}, {"id": "cmd_acronym", "title": "cmd_acronym"}, {"id": "cmd_code", "title": "cmd_code"}, {"id": "cmd_samp", "title": "cmd_samp"}, {"id": "cmd_var", "title": "cmd_var"}, {"id": "cmd_removeLinks", "title": "cmd_removeLinks"}, {"id": "cmd_ol", "title": "cmd_ol"}, {"id": "cmd_ul", "title": "cmd_ul"}, {"id": "cmd_dt", "title": "cmd_dt"}, {"id": "cmd_dd", "title": "cmd_dd"}, {"id": "cmd_removeList", "title": "cmd_removeList"}, {"id": "cmd_indent", "title": "cmd_indent"}, {"id": "cmd_outdent", "title": "cmd_outdent"}, {"id": "cmd_increaseFont", "title": "cmd_increaseFont"}, {"id": "cmd_decreaseFont", "title": "cmd_decreaseFont"}, {"id": "cmd_undo", "title": "cmd_undo"}, {"id": "cmd_redo", "title": "cmd_redo"}, {"id": "cmd_fontColor", "title": "cmd_fontColor"}, {"id": "cmd_backgroundColor", "title": "cmd_backgroundColor"}, {"id": "cmd_fontFace", "title": "cmd_fontFace"}, {"id": "cmd_align", "title": "cmd_align"}, {"id": "cmd_insertHTML", "title": "cmd_insertHTML"}, {"id": "cmd_insertLinkNoUI", "title": "cmd_insertLinkNoUI"}, {"id": "cmd_insertImageNoUI", "title": "cmd_insertImageNoUI"}, {"id": "cmd_insertHR", "title": "cmd_insertHR"}, {"id": "cmd_charSet", "title": "cmd_charSet"}, {"id": "cmd_copy", "title": "cmd_copy"}, {"id": "cmd_cut", "title": "cmd_cut"}, {"id": "cmd_delete", "title": "cmd_delete"}, {"id": "cmd_paste", "title": "cmd_paste"}, {"id": "cmd_cutOrDelete", "title": "cmd_cutOrDelete"}, {"id": "cmd_deleteCharBackward", "title": "cmd_deleteCharBackward"}, {"id": "cmd_deleteCharForward", "title": "cmd_deleteCharForward"}, {"id": "cmd_deleteWordBackward", "title": "cmd_deleteWordBackward"}, {"id": "cmd_deleteWordForward", "title": "cmd_deleteWordForward"}, {"id": "cmd_deleteToBeginningOfLine", "title": "cmd_deleteToBeginningOfLine"}, {"id": "cmd_deleteToEndOfLine", "title": "cmd_deleteToEndOfLine"}, {"id": "cmd_deleteToEndOfLine_2", "title": "cmd_deleteToEndOfLine"}, {"id": "cmd_scrollTop", "title": "cmd_scrollTop"}, {"id": "cmd_scrollBottom", "title": "cmd_scrollBottom"}, {"id": "cmd_scrollPageUp", "title": "cmd_scrollPageUp"}, {"id": "cmd_scrollPageDown", "title": "cmd_scrollPageDown"}, {"id": "cmd_selectTop", "title": "cmd_selectTop"}, {"id": "cmd_selectBottom", "title": "cmd_selectBottom"}, {"id": "cmd_selectLineNext", "title": "cmd_selectLineNext"}, {"id": "cmd_selectLinePrevious", "title": "cmd_selectLinePrevious"}, {"id": "cmd_selectCharPrevious", "title": "cmd_selectCharPrevious"}, {"id": "cmd_selectCharNext", "title": "cmd_selectCharNext"}, {"id": "cmd_selectBeginLine", "title": "cmd_selectBeginLine"}, {"id": "cmd_selectEndLine", "title": "cmd_selectEndLine"}, {"id": "cmd_selectWordPrevious", "title": "cmd_selectWordPrevious"}, {"id": "cmd_selectWordNext", "title": "cmd_selectWordNext"}, {"id": "cmd_movePageUp", "title": "cmd_movePageUp"}, {"id": "cmd_movePageDown", "title": "cmd_movePageDown"}, {"id": "cmd_moveTop", "title": "cmd_moveTop"}, {"id": "cmd_moveBottom", "title": "cmd_moveBottom"}, {"id": "cmd_lineNext", "title": "cmd_lineNext"}, {"id": "cmd_linePrevious", "title": "cmd_linePrevious"}, {"id": "cmd_charPrevious", "title": "cmd_charPrevious"}, {"id": "cmd_charNext", "title": "cmd_charNext"}, {"id": "cmd_beginLine", "title": "cmd_beginLine"}, {"id": "cmd_endLine", "title": "cmd_endLine"}, {"id": "cmd_wordPrevious", "title": "cmd_wordPrevious"}, {"id": "cmd_wordNext", "title": "cmd_wordNext"}, {"id": "nsICommandParams", "title": "nsICommandParams"}, {"id": "Creating", "title": "Creating"}, {"id": "Writing", "title": "Writing"}, {"id": "Reading", "title": "Reading"}, {"id": "Original_Document_Information", "title": "Original Document Information"}], "slug": "Editor_Embedding_Guide", "review_tags": ["technical"]}