Try the fastest and simplest way to install ONLYOFFICE

Disabling Editor "Focus" on Document Ready

Integration questions/issues

Disabling Editor "Focus" on Document Ready

Postby enigma » Mon Jan 22, 2018 3:13 pm

We use the Document Server within our application.

When the editor loads a new document, it gets focused. This focus event scrolls automatically down to the editor.

How can I prevent this? Where in the code can I comment this line?
enigma
 
Posts: 4
Joined: Mon Jan 22, 2018 3:02 pm

Re: Disabling Editor "Focus" on Document Ready

Postby Maxim » Tue Jan 23, 2018 8:19 am

Hello enigma!
This focus event scrolls automatically down to the editor

Attach a screenshot please.
Maxim
 
Posts: 1737
Joined: Tue Oct 11, 2016 2:34 pm

Re: Disabling Editor "Focus" on Document Ready

Postby enigma » Tue Jan 23, 2018 9:23 am

Please see attached a screenshot.

The user clicks a button, the form/popup (as shown in the attachment) appears. After the document in the editor is loaded completely, it gets the focus and the browser scrolls down so that the editor is active. If the user previously clicks on a input field above the editor, it looses the focus. Im pretty sure that your code contains some logic like $('iframe').focus(), but I can't find it.

I basically want to disable the focus event of the editor.
Attachments
Selection_001.png
Selection_001.png (52.75 KiB) Viewed 1127 times
enigma
 
Posts: 4
Joined: Mon Jan 22, 2018 3:02 pm

Re: Disabling Editor "Focus" on Document Ready

Postby Maxim » Wed Jan 24, 2018 6:08 am

Hello enigma!
Maybe this can help you!
Maxim
 
Posts: 1737
Joined: Tue Oct 11, 2016 2:34 pm

Re: Disabling Editor "Focus" on Document Ready

Postby enigma » Wed Jan 24, 2018 8:16 am

There actually is one piece of code that does exactly what I mean - but only for mobile!

(line 216):

Code: Select all
if (_config.type === 'mobile') {
                document.body.onfocus = function(e) {
                    setTimeout(function(){
                        iframe.contentWindow.focus();

                        _sendCommand({
                            command: 'resetFocus',
                            data: {}
                        })
                    }, 10);
                };
            }


Any idea where I can get this type of code or DESKTOP? There is no other part that requests the focus...
enigma
 
Posts: 4
Joined: Mon Jan 22, 2018 3:02 pm

Re: Disabling Editor "Focus" on Document Ready

Postby Maxim » Mon Jan 29, 2018 8:35 am

Hello enigma!
I was informed that this problem with "Focus" will be fixed to next release.
Maxim
 
Posts: 1737
Joined: Tue Oct 11, 2016 2:34 pm


Return to API

Who is online

Users browsing this forum: No registered users and 2 guests