cosmocode / dokuwiki-plugin-prosemirror

A modern WYSIWYG editor for DokuWiki
https://wysiwyg.wiki.cosmocode.de/
54 stars 20 forks source link

Changes are lost when switching editors with unsaved content #165

Closed rotdrop closed 1 year ago

rotdrop commented 2 years ago

More precisely:

This is with the current master of both Dokuwiki as the prosemirror plugin.

For me it would be acceptable to just disable the switch-button when the content is "dirty".

Klap-in commented 2 years ago

Could you reproduce this behavior on other pages of your wiki? Or on this test wiki? https://wysiwyg.wiki.cosmocode.de/doku.php?id=en:playground:start

rotdrop commented 2 years ago

Oopps.

Seems somehow be caused by embedding the wiki-page into an iframe.

I investigate further and close this issue for now.

Am 08.02.22 um 14:30 schrieb Gerrit Uitslag:

Could you reproduce this behavior on other pages of your wiki? Or on this test wiki? https://wysiwyg.wiki.cosmocode.de/doku.php?id=en:playground:start https://wysiwyg.wiki.cosmocode.de/doku.php?id=en:playground:start

— Reply to this email directly, view it on GitHub https://github.com/cosmocode/dokuwiki-plugin-prosemirror/issues/165#issuecomment-1032611288, or unsubscribe https://github.com/notifications/unsubscribe-auth/AALM54IBIWQVV47ZSSDWOOLU2ELHDANCNFSM5N2MTIDQ. Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you authored the thread.Message ID: @.***>

-- Claus-Justus Heine @.*** http://www.claus-justus-heine.de/

Schatzmeister der Camerata Academica Freiburg e.V. --- www.cafev.de

rotdrop commented 2 years ago

Ok, reopening. Regardless of the embedding iframe one problem is that the switch-WYSIWYG button submits the form, as its type is not set to "button", from MDN:

If your buttons are not for submitting form data to a server, be sure to set their type attribute to button. Otherwise they will try to submit form data and to load the (nonexistent) response, possibly destroying the current state of the document.

The rest probably is some kind of a race condition. Is your playground-Wiki running on the master branch of DokuWiki? I would suggest to add a return false; to the toggleEditor() handler, or create the toggle-button with a type="button" attribute.

TZanke commented 1 year ago

I can verify this issue.

New Dokuwiki with just Prosemirror. Release 2022-07-31a "Igor" Plugin: Installed version: 2022-03-29

Also the cancel button is not working in the dialog, who should prevent you from loosing changes.

https://user-images.githubusercontent.com/1613368/196137538-d4d8fd58-7b29-4584-b08f-389aa168e82a.mp4

annda commented 1 year ago

Fixed. Thank you @rotdrop and @TZanke for debugging this issue.