taikonauten / kirby-page-lock-plugin

MIT License
25 stars 2 forks source link

Seems to break Kirby modals #1

Open andreasnymark opened 7 years ago

andreasnymark commented 7 years ago

The plugin seems to break modals in Panel. For every modal I’m being redirected to a fallback page. E.g. when I change the url it flashes the modal for a second and then redirects me to /panel/pages/pagename/url. I’ve got a few plugins installed, but disabling page-lock makes modals work again.

Using Kirby 2.4.1/Chrome 56/Firefox 51.

stffndtz commented 7 years ago

Hi @andreasnymark - to be able to further investigate the issue, could please provide a list of plugins?

Moreover, what type of modals are broken, how are they triggered (i.e. from structured fields, any other plugin)?

Thanks!

andreasnymark commented 7 years ago

Following fields/plugins are used:

[submodule "site/fields/quickselect"]
    path = site/fields/quickselect
    url = https://github.com/medienbaecker/kirby-quickselect
[submodule "site/fields/panelimage"]
    path = site/fields/panelimage
    url = https://github.com/jgabrielsen/kirby-panel-image
[submodule "site/fields/subpagelist"]
    path = site/fields/subpagelist
    url = https://github.com/flokosiol/kirby-subpagelist
[submodule "site/fields/tabs"]
    path = site/fields/tabs
    url = https://github.com/afbora/Kirby-Tabs-Field
[submodule "site/plugins/cachebuster"]
    path = site/plugins/cachebuster
    url = https://github.com/getkirby-plugins/cachebuster-plugin
[submodule "site/plugins/cdn"]
    path = site/plugins/cdn
    url = https://github.com/getkirby-plugins/cdn-plugin
[submodule "site/plugins/dominantcolor"]
    path = site/plugins/dominantcolor
    url = https://github.com/iandoe/kirby-dominant-color
[submodule "site/plugins/page-lock"]
    path = site/plugins/page-lock
    url = https://github.com/taikonauten/kirby-page-lock-plugin
[submodule "site/plugins/focus"]
    path = site/plugins/focus
    url = https://github.com/flokosiol/kirby-focus
[submodule "panel"]
    path = panel
    url = https://github.com/getkirby/panel
[submodule "site/plugins/drafts-widget"]
    path = site/plugins/drafts-widget
    url = https://github.com/Thiousi/kirby-drafts-widget
[submodule "site/plugins/patterns"]
    path = site/plugins/patterns
    url = https://github.com/getkirby-plugins/patterns-plugin
[submodule "kirby"]
    path = kirby
    url = https://github.com/getkirby/kirby
[submodule "site/plugins/xml-sitemap"]
    path = site/plugins/xml-sitemap
    url = https://github.com/pedroborges/kirby-xml-sitemap
[submodule "site/plugins/feed"]
    path = site/plugins/feed
    url = https://github.com/getkirby-plugins/feed-plugin

Following modals are not working in Panel:

"Add page" from the dashboard is the only modal that seems to be working.

ffraenz commented 7 years ago

Hi @andreasnymark,

I was able to reproduce this issue.

The current version of this plugin keeps track of the currently viewed panel page by injecting a script tag into the ajax responses. However, in my environment this script execution got blocked by the Content Security Policy which led to the flashing and redirecting you described.

A quick fix consists of allowing the unsafe-eval source in the Content Security Policy header:

Header add Content-Security-Policy "default-src https: data: wss: 'unsafe-inline' 'unsafe-eval'"

To solve the issue, a new strategy for tracking currently viewed panel pages needs to be found. I leave this issue open until we get there.

Thank's for reporting!