Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8690201
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T23:51:07+00:00 2026-06-12T23:51:07+00:00

I have a simple wrapper around a WYSIWYG editor (TinyMCE). I’m using JSNI to

  • 0

I have a simple wrapper around a WYSIWYG editor (TinyMCE). I’m using JSNI to call a Java instance method (onClick) from Javascript. However the Java onClick method always gets called on the same Java instance (the last one created), no matter the editor that originated it.

        private SimplePanel panel;
        private TextArea ta;
        private String id;

        public TinyMCE(AbstractTinyMCEConfiguration config) {       
            id = HTMLPanel.createUniqueId();
            ta = new TextArea();
            ta.getElement().setId(id);
                panel = new SimplePanel();
            panel.add(ta);
            initWidget(panel);
            init(config);
        }

        protected native void init(AbstractTinyMCEConfiguration conf) /*-{
            var ins = this;
            $wnd.tinyMCE.init({
                    // General options
                    mode : conf.@com.chip.tinymce.client.AbstractTinyMCEConfiguration::getMode()(),
                    setup : function(ed) {
                        ed.onClick.add(function(ed,e) { 
                            alert(ed.id);
                            ins.@com.chip.tinymce.client.TinyMCE::onClick(Lcom/google/gwt/dom/client/NativeEvent;)(e);
                        }); 
                    }
                }); 
        }-*/;

        private void onClick(NativeEvent e) {
            GWT.log("onClick " + id);
            ClickEvent.fireNativeEvent(e, this);
        }

I’m not sure if I can call a Java method from a Javascript funcion that is inside another funcion. Maybe that explains my problem… or maybe I’m missing something. Thanks for your help.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T23:51:08+00:00Added an answer on June 12, 2026 at 11:51 pm

    I think TinyMCE has one shared configuration for all editors, and that is the problem here.

    It probably does not make much sense to hand the configuration to the constructor if it is shared…

    Why not add a static map that maps the id back to the Java instance, something like

        // ....
        private static Map<String, TinyMCE> idMap = new HashMap<String, TinyMCE>();
    
        public TinyMCE() {       
            // ...
            idMap.put(id, this);
        }
    
        // call this from Javascript with (ed.id, e)
        private static void onClick(String id, NativeEvent e) {
          idMap.get(id).onClick(e);
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a simple wrapper around C null-terminated string, which is essentially a subclass
I have a derived class that's a very thin wrapper around a base class.
I want to write a simple wrapper around another class. A small example: class
I am making a simple wrapper for a c library that needs to have
I have a usercontrol wrapper around a DataGridView in a WindowsFormsHost. The wrapper has
I'm trying to build a simple .Net wrapper around some basic C++ code. The
I have a sample project here on github where I created a c++ wrapper
I have a simple managed C++ assembly which I am providing unmanaged wrappers for
I have created a simple linux 32bit shared library(.so) for my rendering wrappers but
I have a fairly simple layout with an image, and some textviews wrapped in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.