editor/composer/public/nsIEditingSession.idl

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/editor/composer/public/nsIEditingSession.idl	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,102 @@
     1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.8 +
     1.9 +#include "nsISupports.idl"
    1.10 +#include "domstubs.idl"
    1.11 +
    1.12 +interface nsIEditor;
    1.13 +
    1.14 +[scriptable, uuid(24f3f4da-18a4-448d-876d-7360fefac029)]
    1.15 +
    1.16 +interface nsIEditingSession : nsISupports
    1.17 +{
    1.18 +  /**
    1.19 +   *  Error codes when we fail to create an editor
    1.20 +   *  is placed in attribute editorStatus
    1.21 +   */
    1.22 +  const long eEditorOK = 0;
    1.23 +  const long eEditorCreationInProgress = 1;
    1.24 +  const long eEditorErrorCantEditMimeType = 2;
    1.25 +  const long eEditorErrorFileNotFound = 3;
    1.26 +  const long eEditorErrorCantEditFramesets = 8;
    1.27 +  const long eEditorErrorUnknown = 9;
    1.28 +
    1.29 +  /**
    1.30 +   *  Status after editor creation and document loading
    1.31 +   *  Value is one of the above error codes
    1.32 +   */
    1.33 +  readonly attribute unsigned long editorStatus;
    1.34 +
    1.35 +  /**
    1.36 +   *  Make this window editable
    1.37 +   *  @param aWindow nsIDOMWindow, the window the embedder needs to make editable
    1.38 +   *  @param aEditorType string, "html" "htmlsimple" "text" "textsimple"
    1.39 +   *  @param aMakeWholeDocumentEditable if PR_TRUE make the whole document in
    1.40 +   *                                    aWindow editable, otherwise it's the
    1.41 +   *                                    embedder who should make the document
    1.42 +   *                                    (or part of it) editable.
    1.43 +   *  @param aInteractive if PR_FALSE turn off scripting and plugins
    1.44 +   */
    1.45 +  void makeWindowEditable(in nsIDOMWindow window, in string aEditorType,
    1.46 +                          in boolean doAfterUriLoad,
    1.47 +                          in boolean aMakeWholeDocumentEditable,
    1.48 +                          in boolean aInteractive);
    1.49 +  
    1.50 +  /**
    1.51 +   *  Test whether a specific window has had its editable flag set; it may have an editor
    1.52 +   *  now, or will get one after the uri load.
    1.53 +   *  
    1.54 +   *  Use this, passing the content root window, to test if we've set up editing
    1.55 +   *  for this content.
    1.56 +   */
    1.57 +  boolean windowIsEditable(in nsIDOMWindow window);
    1.58 +  
    1.59 +  /**
    1.60 +   *  Get the editor for this window. May return null
    1.61 +   */
    1.62 +	nsIEditor getEditorForWindow(in nsIDOMWindow window);	
    1.63 +
    1.64 +  /** 
    1.65 +   *  Setup editor and related support objects
    1.66 +   */
    1.67 +  void setupEditorOnWindow(in nsIDOMWindow window);
    1.68 +
    1.69 +  /** 
    1.70 +   *   Destroy editor and related support objects
    1.71 +   */
    1.72 +  void tearDownEditorOnWindow(in nsIDOMWindow window);
    1.73 +
    1.74 +  void setEditorOnControllers(in nsIDOMWindow aWindow,
    1.75 +                              in nsIEditor aEditor);
    1.76 +
    1.77 +  /**
    1.78 +   * Disable scripts and plugins in aWindow.
    1.79 +   */
    1.80 +  void disableJSAndPlugins(in nsIDOMWindow aWindow);
    1.81 +
    1.82 +  /**
    1.83 +   * Restore JS and plugins (enable/disable them) according to the state they
    1.84 +   * were before the last call to disableJSAndPlugins.
    1.85 +   */
    1.86 +  void restoreJSAndPlugins(in nsIDOMWindow aWindow);
    1.87 +
    1.88 +  /**
    1.89 +   * Removes all the editor's controllers/listeners etc and makes the window
    1.90 +   * uneditable.
    1.91 +   */
    1.92 +  void detachFromWindow(in nsIDOMWindow aWindow);
    1.93 +
    1.94 +  /**
    1.95 +   * Undos detachFromWindow(), reattaches this editing session/editor
    1.96 +   * to the window.
    1.97 +   */
    1.98 +  void reattachToWindow(in nsIDOMWindow aWindow);
    1.99 +
   1.100 +  /**
   1.101 +   * Whether this session has disabled JS and plugins.
   1.102 +   */
   1.103 +  readonly attribute boolean jsAndPluginsDisabled;
   1.104 +};
   1.105 +

mercurial