Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

change keymap in pdf viewer #716

Closed
PPanter92 opened this issue Apr 3, 2018 · 5 comments
Closed

change keymap in pdf viewer #716

PPanter92 opened this issue Apr 3, 2018 · 5 comments

Comments

@PPanter92
Copy link

I change my scrollkeys to ijkl in normal, visual and insert mode, and for ace editor as well but when I open a PDF via the included js viewer it uses the default keymap. Is it possible to change the 'pdf keymap' somehow?

@nkkPb
Copy link

nkkPb commented Apr 5, 2018

I bump this. keys mapped by mapkey() don't appear on pdf viewer.

@brookhong
Copy link
Owner

This is because that unsafe-eval was removed from content_security_policy in manifest.json.

And for security reason, there is no possibility to bring it back.

@vogler
Copy link

vogler commented May 4, 2020

Could you explain the problem? What's the difference in loading settings between the internal PDF viewer and another website?
I assume it could be fixed by adding unsafe-eval again which you want to avoid?
Is it a pdf.js issue that maybe has been fixed? mozilla/pdf.js#10387

@brookhong
Copy link
Owner

The pdf viewer has its URL as chrome-extension://gfbliohnnapiefjpjlpjnehglfpaknnc/pages/pdf_viewer.html, which is a built-in page from SurfingKeys, and its content security policy is specified in manifest.json, which does not allow unsafe-eval.

But to load custom user script need unsafe-eval on built-in pages, please see https://github.com/brookhong/Surfingkeys/blob/master/content_scripts/content_scripts.js#L302

Yes, adding unsafe-eval back again could solve the issue, but Add-ons for Firefox (en-US) won't accpet that. Please see https://github.com/brookhong/Surfingkeys/blob/master/pages/changelog.md#0919

@vogler
Copy link

vogler commented May 9, 2020

My main issue with the default pdf keymap is #1226

Instead of using full-blown eval could we do a mini-interpreter that maybe only filters out simple map(x, y) statements (which are easy to parse) and executes them? That should avoid the need for unsafe-eval and still support simple remappings in the pdf viewer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants