arturobernalg opened a new pull request, #613:
URL: https://github.com/apache/jspwiki/pull/613

   The editor locks the page. When the user left it by a link, the address bar 
or the back button, the lock stayed until it expired (the part of JSPWIKI-375 
that is still open; the question before leaving was already there for the plain 
editor and #563 added it to the wysiwyg editor).
   
   Wiki.releaseLockOnLeave sends a cancel request with navigator.sendBeacon 
when the page is hidden for good and window.onbeforeunload is still set. The 
submit of the form clears onbeforeunload, so Save, Preview and Cancel do not 
send it. The plain editor (Wiki.Edit.js) and the wysiwyg editor (wysiwyg.jsp) 
call it.
   
   Every load of the editor gets a token (a session attribute, and a hidden 
field locktoken in plain.jsp and wysiwyg.jsp). The cancel request of a page 
that has been loaded again, as in a reload, carries an old token and Edit.jsp 
does not release the lock then, because the lock is already the one of the new 
editor. Without the token a reload lost the lock. The cancel button does not 
send the token, so it works as before.
   
   Checked on a running wiki with the list of locks (ListLocksPlugin), in the 
plain and in the wysiwyg editor: opening the editor creates the lock, a reload 
keeps it, leaving by a link releases it, and Save saves and leaves no lock and 
no extra request. Not checked: leaving with changes after answering yes to the 
question of the browser, which cannot be driven from the browser tool. The 
editors CKeditor.jsp and TinyMCE.jsp are not changed. Full "mvn clean package" 
passes.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to