Richard Jones wrote:
Hi:

I'm trying to get a simple editor to work, just as an example for now.
I started out with the editorexamples package
(http://segment7.net/projects/mozilla/editor/index.html) however this
doesn't work with my version of Mozilla (classic 1.5).

So I've been trying to get it to work.  Latest, non-working, version
is below.  (NB. /tmp/ad.html is just a random piece of HTML I have in
/tmp).  It fails at SetupHTMLEditorCommands() warning that
window.contents has no properties.  I have no idea what this means.

Help!

Can someone send me a really minimal, working example?

Rich.

<?xml version="1.0"?>

<?xml-stylesheet href="chrome://communicator/skin/" type="text/css"?>
<?xml-stylesheet href="chrome://editor/skin/editorFormatToolbar.css"
  type="text/css"?>

  <!--<?xul-overlay href="chrome://global/content/globalOverlay.xul"?>-->
<?xul-overlay href="chrome://editor/content/editorOverlay.xul"?>

<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
  onload="Init();"
  title="Example 3">

  <script src="chrome://editor/content/editor.js"
    type="application/x-javascript"/>

  <script type="application/x-javascript"><![CDATA[
    function Init() {
      var editorElement = GetCurrentEditorElement ();
      var editor = GetCurrentEditor ();
      editorElement.editortype = "html";
      EditorSharedStartup ();

      /* Load file. */
      var url = "/tmp/ad.html";
      editorElement.webNavigation.loadURI (url,
                nsIWebNavigation.LOAD_FLAGS_BYPASS_CACHE,
                null, /* referer */
                null, /* post-data stream */
                null); /* ? */

      /* Documented in editor.js as 'Set up the mime type and register the
       * commands'.
       */
      SetupHTMLEditorCommands();
    }
  ]]></script>

  <commandset id="composerMenuItems"/>
  <commandset id="composerStyleMenuItems"/>

  <keyset id="editorKeys"/>

  <toolbox>
    <toolbar>
      <menulist id="ParagraphSelect"/>
      <box id="FormatToolbar">
        <toolbarbutton id="boldButton"/>
        <toolbarbutton id="italicButton"/>
        <toolbarbutton id="underlineButton"/>
        <toolbarseparator/>
      </box>
      <toolbarbutton id="linkButton"/>
    </toolbar>
  </toolbox>
  <editor type="content" id="content-frame" flex="1"/>
</window>




A minimal example is just:


<window onload="Init();" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";>

<script>
function init()
{
  var edit = document.getElementById("edit");
  edit.makeEditable('html',false);
}
</script>

<editor id="edit" src="about:blank"/>

</window>

/ Neil
_______________________________________________
mozilla-editor mailing list
[EMAIL PROTECTED]
http://mail.mozilla.org/listinfo/mozilla-editor

Reply via email to