1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #include
"nsISupports.idl"
7 #include
"domstubs.idl"
9 interface mozIDOMWindowProxy
;
13 class mozIDOMWindowProxy
;
16 } // namespace mozilla
19 [scriptable
, builtinclass
, uuid(24f963d1
-e6fc
-43ea
-a206
-99ac5fcc5265
)]
21 interface nsIEditingSession
: nsISupports
24 * Error codes when we fail to create an editor
25 * is placed in attribute editorStatus
27 const long eEditorOK
= 0;
28 const long eEditorCreationInProgress
= 1;
29 const long eEditorErrorCantEditMimeType
= 2;
30 const long eEditorErrorFileNotFound
= 3;
31 const long eEditorErrorCantEditFramesets
= 8;
32 const long eEditorErrorUnknown
= 9;
35 * Status after editor creation and document loading
36 * Value is one of the above error codes
38 readonly attribute
unsigned long editorStatus
;
41 * Make this window editable
42 * @param aWindow nsIDOMWindow, the window the embedder needs to make editable
43 * @param aEditorType string, "html" "htmlsimple" "text" "textsimple"
44 * @param aMakeWholeDocumentEditable if PR_TRUE make the whole document in
45 * aWindow editable, otherwise it's the
46 * embedder who should make the document
47 * (or part of it) editable.
48 * @param aInteractive if PR_FALSE turn off scripting and plugins
50 void makeWindowEditable
(in mozIDOMWindowProxy window
,
51 in string aEditorType
,
52 in boolean doAfterUriLoad
,
53 in boolean aMakeWholeDocumentEditable
,
54 in boolean aInteractive
);
57 * Test whether a specific window has had its editable flag set; it may have an editor
58 * now, or will get one after the uri load.
60 * Use this, passing the content root window, to test if we've set up editing
63 boolean windowIsEditable
(in mozIDOMWindowProxy window
);
66 * Get the editor for this window. May return null
68 nsIEditor getEditorForWindow
(in mozIDOMWindowProxy window
);
71 * Setup editor and related support objects
73 void setupEditorOnWindow
(in mozIDOMWindowProxy window
);
76 * Destroy editor and related support objects
78 void tearDownEditorOnWindow
(in mozIDOMWindowProxy window
);
80 void setEditorOnControllers
(in mozIDOMWindowProxy aWindow
,
81 in nsIEditor aEditor
);
84 * Disable scripts and plugins in aWindow.
86 void disableJSAndPlugins
(in mozIDOMWindowProxy aWindow
);
89 * Restore JS and plugins (enable/disable them) according to the state they
90 * were before the last call to disableJSAndPlugins.
92 void restoreJSAndPlugins
(in mozIDOMWindowProxy aWindow
);
95 * Removes all the editor's controllers/listeners etc and makes the window
98 void detachFromWindow
(in mozIDOMWindowProxy aWindow
);
101 * Undos detachFromWindow(), reattaches this editing session/editor
104 void reattachToWindow
(in mozIDOMWindowProxy aWindow
);
107 * Whether this session has disabled JS and plugins.
109 readonly attribute
boolean jsAndPluginsDisabled
;
113 * This method is implemented with nsIDocShell::GetHTMLEditor(). I.e.,
114 * This method doesn't depend on nsEditingSession. Therefore, even if
115 * there were some implementation of nsIEditingSession interface, this
116 * would be safe to use.
118 mozilla
::HTMLEditor
* GetHTMLEditorForWindow
(mozIDOMWindowProxy
* aWindow
);