Re: Midas in XUL througg <editor> does not format text - throw error instead

Ehsan Akhgari <[email protected]>
Newsgroups gmane.comp.mozilla.devel.xpfe
Message-ID <[email protected]>
Can you please file a bug about this?

https://bugzilla.mozilla.org/enter_bug.cgi?product=Core&component=Editor

Cheers,
Ehsan

On 11-07-12 11:59 AM, Adam Victor Nazareth Brandizzi wrote:
> Hello, all!
>
> I am trying to use Midas through the element of XUL following the
> instructions of this article. So far I have the code below:
>
> <window id="main" title="Anunciador Blog Editor" width="300" height="300"
>      xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
>      xmlns:xhtml="http://www.w3.org/1999/xhtml">
>      <script type="application/x-javascript">
>      <![CDATA[
>      var editor = null;
>      function onLoad() {
>          editor = document.getElementById('editor');
>          editor.contentDocument.designMode = 'on';
>      }
>
>      function onBoldButtonCommand() {
>          editor.contentDocument.execCommand('bold', false, null);
>      }
>
>      window.addEventListener("load", onLoad, false);
>      ]]>
>      </script>
>      <button label="Bold" oncommand="onBoldButtonCommand();" />
>      <editor id="editor" type="content-primary" editortype="html"
> src="about:blank" flex="1" />
> </window>
>
> However, when I click in the "Bold" button with some text selected in
> the<editor>, the text is not altered and the JS console presents the
> following error:
>
> Error: uncaught exception: [Exception... "Component returned failure
> code: 0x80004005
> (NS_ERROR_FAILURE) [nsIDOMNSHTMLDocument.execCommand]"  nsresult: "0x80004005
> (NS_ERROR_FAILURE)"  location: "JS frame ::
> chrome://anunciador/content/main.xul ::
> onBoldButtonCommand :: line 14"  data: no]
>
> That does not make sense to me because I have enabled the edit mode with:
>
> editor.contentDocument.designMode = 'on';
>
> Did I forget something?
>
> Thanks in advance!
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.