tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

nsIEditingSession.idl (2910B)


      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/. */
      5 
      6 #include "nsISupports.idl"
      7 #include "domstubs.idl"
      8 
      9 interface mozIDOMWindowProxy;
     10 interface nsIEditor;
     11 
     12 %{ C++
     13 class mozIDOMWindowProxy;
     14 namespace mozilla {
     15 class HTMLEditor;
     16 } // namespace mozilla
     17 %}
     18 
     19 [scriptable, builtinclass, uuid(24f963d1-e6fc-43ea-a206-99ac5fcc5265)]
     20 interface nsIEditingSession : nsISupports
     21 {
     22  /**
     23   *  Error codes when we fail to create an editor
     24   *  is placed in attribute editorStatus
     25   */
     26  const long eEditorOK = 0;
     27  const long eEditorCreationInProgress = 1;
     28  const long eEditorErrorCantEditMimeType = 2;
     29  const long eEditorErrorFileNotFound = 3;
     30  const long eEditorErrorCantEditFramesets = 8;
     31  const long eEditorErrorUnknown = 9;
     32 
     33  /**
     34   *  Status after editor creation and document loading
     35   *  Value is one of the above error codes
     36   */
     37  readonly attribute unsigned long editorStatus;
     38 
     39  /**
     40   *  Make this window editable
     41   *  @param aWindow nsIDOMWindow, the window the embedder needs to make editable
     42   *  @param aEditorType string, "html" "htmlsimple" "text" "textsimple"
     43   *  @param aMakeWholeDocumentEditable if PR_TRUE make the whole document in
     44   *                                    aWindow editable, otherwise it's the
     45   *                                    embedder who should make the document
     46   *                                    (or part of it) editable.
     47   *  @param aInteractive if PR_FALSE turn off scripting and plugins
     48   */
     49  [can_run_script]
     50  void makeWindowEditable(in mozIDOMWindowProxy window,
     51                          in string aEditorType,
     52                          in boolean doAfterUriLoad,
     53                          in boolean aMakeWholeDocumentEditable,
     54                          in boolean aInteractive);
     55 
     56  /**
     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.
     59   *
     60   *  Use this, passing the content root window, to test if we've set up editing
     61   *  for this content.
     62   */
     63  boolean windowIsEditable(in mozIDOMWindowProxy window);
     64 
     65  /**
     66   *  Get the editor for this window. May return null
     67   */
     68  nsIEditor getEditorForWindow(in mozIDOMWindowProxy window);
     69 
     70  /**
     71   *   Destroy editor and related support objects
     72   */
     73  [noscript] void tearDownEditorOnWindow(in mozIDOMWindowProxy window);
     74 
     75 %{C++
     76  /**
     77   * This method is implemented with nsIDocShell::GetHTMLEditor().  I.e.,
     78   * This method doesn't depend on nsEditingSession.  Therefore, even if
     79   * there were some implementation of nsIEditingSession interface, this
     80   * would be safe to use.
     81   */
     82  mozilla::HTMLEditor* GetHTMLEditorForWindow(mozIDOMWindowProxy* aWindow);
     83 %}
     84 };