Try the fastest and simplest way to install ONLYOFFICE

triggering button press with javascript

Integration questions/issues

triggering button press with javascript

Postby robertotomas » Fri Sep 29, 2017 1:41 pm

given the helloworld plugin:

Code: Select all
(function(window, undefined){

    window.Asc.plugin.init = function()
    {
        var sScript = 'var oDocument = Api.GetDocument();';
        sScript += 'var oParagraph = Api.CreateParagraph();';
        sScript += 'oParagraph.AddText(\'Hello world!\');';
        sScript += 'oDocument.InsertContent([oParagraph]);';
        window.Asc.plugin.info.recalculate = true;
        this.executeCommand("close", sScript);
    };

    window.Asc.plugin.button = function(id)
    {
    };

})(window, undefined);


How can I trigger this plugin's button press from the outer window containing the docEditor?

this is may have to be done with a postMessage and adding a listener in my plugin or editing the api.js file .. however, from there I must actually trigger the plugin to fire off. How is that done?

I want to use this to trigger an effect from the UI ..
robertotomas
 
Posts: 17
Joined: Thu Aug 31, 2017 4:05 pm

Re: triggering button press with javascript

Postby Maxim » Thu Oct 12, 2017 7:13 am

Hello!
You can use this plugin.
Maxim
 
Posts: 1077
Joined: Tue Oct 11, 2016 2:34 pm

Re: triggering button press with javascript

Postby robertotomas » Thu Oct 12, 2017 7:23 pm

Maxim, I have a plugin that works, very similar in many ways to that one. You don't have to worry about this at this point (I could still use help understanding why our server configuration doesnt seem to recongize plugins at all though).

For my custom plugin to work, I needed to alter app.js.

I can't get *your* plugin to work at all. executing the code in test.js directly in the (otherwise) working docker install on my local dev machine does nothing.
robertotomas
 
Posts: 17
Joined: Thu Aug 31, 2017 4:05 pm

Re: triggering button press with javascript

Postby Maxim » Tue Oct 17, 2017 5:59 am

Hello robertotomas!
In that case i do not worry :D :D
Maxim
 
Posts: 1077
Joined: Tue Oct 11, 2016 2:34 pm


Return to API

Who is online

Users browsing this forum: Bing [Bot] and 1 guest

cron