Thanks Marius.

My edit button does this:

    edit.addClickHandler(new ClickHandler() {
      public void onClick(ClickEvent event) {
        Config config = new DefaultConfig(getEditorConfig());
        WysiwygEditor editor =
WysiwygEditorFactory.getInstance().newEditor(config);
        editorContainer.setWidget(editor.getUI());
      }
    });

... I create the config with this native method:

  private static final native
org.xwiki.gwt.dom.client.JavaScriptObject getEditorConfig() /*-{
    return {hookId:'editor', syntax: 'xwiki/2.0'};
  }-*/;

... and my GWT UiBinder file has this:

    <textarea id="editor" class="{style.editor}" />
    <g:FocusPanel ui:field="editorContainer" />

Upon further investigation, it turns out that Firefox reveals
different behavior. In FireFox, I get a visible editor, but each of
the toolbar widgets occupy an entire row, stretching right across the
page. In Google Chrome, the editor appears without any toolbar
widgets, and is not editable.

By the way, is the 'hook' element needed? I know that I can embed a
normal GWT RichTextArea into the UiBinder file as: <g:RichTextArea ...
/>. Can the XWiki RichTextEditor work in a similar fashion, or does it
always need the hook element?

David

On 10 May 2010 19:54, Marius Dumitru Florea
<[email protected]> wrote:
> Hi David,
>
> On 05/10/2010 11:13 AM, David Pinn wrote:
>> Marius wrote:
>> * Inherit the WYSIWYG GWT module in your own GWT module descriptor
>> ** Use the same entry point as the WYSIWYG GWT module, which publishes
>> a JavaScript API you can use to instantiate the editor, or
>> ** Use your own entry point and instantiate the editor in GWT code
>>
>> How would I instantiate the editor in GWT code? I've been trying to
>> achieve this, but I get an editor that will not accept typing. That
>> is, typing characters into the editor has no effect; the characters
>> don't display, and there is no change to the state of the editor in
>> the DOM. I figure it must be something to do with the way I'm creating
>> it.
>
> You can use either the RichTextEditorController, which manages a
> RichTextEditor (menu bar + tool bar + rich text area) and a set of rich
> text area plugins, or the WysiwygEditor which extends the
> RichTextEditorController with the ability to switch to source (plain
> text area).
>
> The WysiwygEditor constructor does this:
>
> super(new RichTextEditor(), config, pfm,
> svm.getSyntaxValidator(config.getParameter("syntax", DEFAULT_SYNTAX)));
>
> You can look in the WysiwygEditorFactory to see how to create a
> PluginFactoryManager and a SyntaxValidatorManager.
>
> As for the Config object, the WysiwygEditorApi does this:
>
> Config config = new DefaultConfig(jsConfig);
>
> which creates a configuration object from a JavaScript object (uses
> GWT's Dictionary class behind the scenes). Configuration options are
> listed on
> http://platform.xwiki.org/xwiki/bin/view/AdminGuide/WysiwygEditor (most
> of them are plugin related)
>
> Can you show me how you instantiate the editor? It's hard to understand
> the problem without seeing the code.
>
> Hope this helps,
> Marius
> _______________________________________________
> devs mailing list
> [email protected]
> http://lists.xwiki.org/mailman/listinfo/devs
>
_______________________________________________
devs mailing list
[email protected]
http://lists.xwiki.org/mailman/listinfo/devs

Reply via email to