<?xml version="1.0" encoding="iso-8859-1" ?>
<?xml-stylesheet type="text/xsl" href="/lib/xsl/devedge-1.00/article_en.xsl"?>
<nde:article 
  url="/toolbox/examples/2003/xbDesignMode/" 
  xmlns="http://www.w3.org/1999/xhtml"
  xmlns:nde="http://devedge.netscape.com/2002/de"
  xmlns:ent="http://devedge.netscape.com/2003/ent"
  xml:lang="en"
  >

 <nde:header>

   <nde:title>
      Class xbDesignMode
   </nde:title>

   <nde:category>
     Manpage
   </nde:category>

  <nde:pubdate year="2003" month="04" day="25" />

  <nde:summary>
      Cross Browser JavaScript Object that helps to utilize the designMode feature.      
  </nde:summary>

  <nde:authlist>
    <nde:author>
      <nde:authname>Doron Rosenberg</nde:authname>
      <nde:authaffil>Netscape Communications</nde:authaffil>
    </nde:author>
  </nde:authlist>

  <nde:channels>
    <nde:channel id="examples"/>
  </nde:channels>

</nde:header>


 <nde:head>
 </nde:head>

 <nde:content>
   <h2>Synopis</h2>
   <pre><![CDATA[
class xbDesignMode
{
public:

xbDesignMode(String aId);
xbDesignMode(HTMLElement aIFrameReference);

  // properties
  HTMLDocument mEditorDocument; 
  HTMLIFrame mIFrameElement;
  
  // methods
  void execCommand(string aCommandName, string aParam);
  void setCSSCreation(boolean aUseCss)
}]]></pre>

    <h2>Source</h2>
    <p>
      <a href="xbDesignMode.js">xbDesignMode.js</a>
    </p>
   
    <h2>See Also</h2>
    
    <ul>
      <li>
       <a href="/viewsource/2003/midas/01/">Rich-Text Editing in Mozilla 1.3</a>
     </li>
    </ul>

    <h2>Introduction</h2>
    
    <p>
      With Mozilla 1.3, the Gecko engine now supports IE's designMode, which makes a document editable.
    </p>

    <p>
      xbDesignMode is a JavaScript Object which provides a wrapper for the
      designMode feature which hides differences between IE and Mozilla. 
    </p>

    <h2>Description</h2>

      
      <h3>Notes</h3>

      <p>
        <h4>Script Location/Invocation</h4>
        <p>
          xbDesignMode takes the id of an iframe or a reference to an iframe element as its argument.  For example: <br /><br />
          <strong>Invocation using an id</strong><br />
          var myDesignMode = new xbDesignMode("iframeID");<br /><br />
          <strong>Invocation using an iframe element reference</strong><br />
          var myIFrame = document.getElementById("iframeID");<br />
          var myDesignMode = new xbDesignMode(myIFrame);<br />
        </p>
      </p>

      <p>
        <h4>Browser Support</h4>
      </p>
      <p>
        Fully supports Mozilla 1.3+ and IE5.5
      </p>

    <h2>Properties</h2>
    <dl>
      <dt>
        mEditorDocument
      </dt>
      <dd>
        <p>reference to the document element of the rich-text widget</p>
      </dd>    
      <dt>
        mIFrameElement
      </dt>
      <dd>
        <p>reference to the iframe used as an rich-text editor.</p>
      </dd>    
    </dl>

    <h2>Methods</h2>
    <dl>

        <dt>xbDesignMode(String aID)</dt>
        <dd>
          <p>Constructs an instance of the xbDesignMode class.</p>
          <p>
            <h3>Arguments:</h3>
            <p>
              String aID - id of the element that will become a rich-text editable widget.  Needs to be an
              iframe.
            </p>
          </p>
          <p>
            <h3>Returns:</h3>
            <p>nothing</p>
          </p>
          <p>
            <h3>Throws:</h3>
            <p>Throws an exception if the element with the specified id isn't an iframe.</p>
          </p>
          
        </dd>

        <dt>xbDesignMode(HTMLElement aIFrameReference)</dt>
        <dd>
          <p>Constructs an instance of the xbDesignMode class.</p>
          <p>
            <h3>Arguments:</h3>
            <p>
              HTMLElement aIFrameReference - reference to the element that will become a rich-text editable widget.  Needs to 
              be an iframe.
            </p>
          </p>
          <p>
            <h3>Returns:</h3>
            <p>nothing</p>
          </p>
          <p>
            <h3>Throws:</h3>
            <p>Throws an exception if the passed in element isn't an iframe.</p>
          </p>          
        </dd>
        
        
        <dt>execCommand(string aCommandName, string aParam)</dt>
        <dd>
          <p>executes an command</p>
          <p>
            <h3>Arguments:</h3>
            <p>
              String aCommandName - name of the command, such as "bold".
            </p>
            <p>
              String aParam - optional parameter for specified command.  Example is "insertimage", the
              optiona parameter would be the URI for the image to be used.
            </p>
          </p>
          <p>
            <h3>Returns:</h3>
            <p>nothing</p>
          </p>
        </dd>

        <dt>setCSSCreation(boolean aUseCss)</dt>
        <dd>
          <p>Toggles CSS creation. Mozilla 1.3 automatically has it set to true.  IE can only create markup, so this is only used
          by Mozilla.</p>
          <p>
            <h3>Arguments:</h3>
            <p>
              boolean aUseCss - should CSS creation be used (&lt;span style="font-weight:bold">) or should html tags be created (&lt;b>).
            </p>
          </p>
          <p>
            <h3>Returns:</h3>
            <p>nothing</p>
          </p>
        </dd>        
                

    </dl>

    <h2>Examples</h2>

    <p>
      <h3>Support for Examples</h3>
      <p>
        Mozilla 1.3+ and IE5.5+ are supported.
      </p>
    </p>

    <h3>General Examples</h3>

  <h4><a href="example1.html">Simple editing interface passing in the id of the iframe</a></h4>
    <p>
      A simple rich text editing example using xbDesignMode.
    </p>
    
  <h4><a href="example2.html">Simple editing interface passing in a reference to the iframe</a></h4>
    <p>
      A simple rich text editing example using xbDesignMode.
    </p>    

  


 </nde:content>

<nde:related area="nde">
  <nde:item url="/viewsource/2003/midas/01/">Rich-Text Editing in Mozilla 1.3</nde:item>
  <nde:item url="/toolbox/examples/2002/xb/">More xbAPI Examples</nde:item>
</nde:related>

</nde:article>
