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
Can we force the extension to load page not by specified file extension? #271
Comments
Perhaps we can look for a query string argument (or some other URL modifier). |
I have no idea how to develop these plugin extension. However, I can see JSONView can do so via an option of "When you click the extension" |
Hello @w-wong, From a technical point of view it's really easy to load the extension on every page. That's what JSONView is doing but, in my opinion, it's also a very bad practice because the extension is basically making your browser slower even if you don't navigate to a JSON document or in our case an AsciiDoc document. asciidoctor-browser-extension/app/manifest.json Lines 22 to 52 in 2502031
The Asciidoctor extension will only be loaded if the URL matches.
That could work, maybe we could use an hint like I think we should be careful because query string arguments are already used as Asciidoctor attributes and they can also cause conflicts...
Could you please provide an example ? |
Hi @Mogztter, Thanks for your answer. I actually expect a possibility of a manual load of the asciidoc by clicking the extension button. In my use case, I need to upload my document to a content management system, which support only docx and pdf as attachment. We can see the uploaded attachment in another page. When we click on the hyper link on that page. It redirects to open the document in another browser window or tab with the url not really referring to the actual document file. Therefore, I can only see the plain text of my asciidoc In another scenario, I uploaded a json file as an attachment. When I click on the JSONView extension button, the page can be reloaded with a Json view. I hope you can understand what I explained. |
I'm thinking, is it possible to detect a modified click on the extension button? We can't use a regular click since that action has already been taken to enable/disable the extension (which is an important use case). |
If we looked for a query string, I'd making it something pretty formal such as |
What is this enable/disable use case? I thought "When you click the extension" option is the disable use case provided that you can re-enable the current page/tab by clicking the extension button Thanks |
The button is currently used to toggle the extension on and off. This is a persistent setting. The reason for it is that having the page preview is not always desirable. Sometimes you are interested in looking at the AsciiDoc source. So it's possible to quickly disable the extension. I suppose we could reconsider that setting and have it be per document. |
Thanks for reconsidering that. |
@w-wong Would that be useful in your context ?
That does not change the fact that the extension should be always "loaded".
The user can then decide to "force" the extension to convert non-matching page by clicking on the extension (disabled -> enabled). Arguably this approach is better from a UX perspective but it's bad in term of security and performance. I'm torn between the two options... |
Oh, I see what you're saying about the pre-filtering. That's what sets this extension apart from many others. Most extensions are always active, whereas this one is only active for relevant URLs (which is different from performing work). That makes it very lightweight, something we may not want to give up. 🤔 |
Exactly. Tough decision but since it's not the most common use case then I think we should not deteriorate performance or security. |
No because the content management system control how to display my document after it is uploaded. I can't even see my document name on the URL when my document is opened in the browser.
This approach sounds pretty good as it becomes user choice on how to view the document. |
After your explanation, I agree there is security issue and pretty serious actually, which I never think of the power of extension. Maybe this is the reason why the extension (both AsciiDoc extension and JSONView) can't work for documents in Google Drive and One Drive. However, it turns out I can only use it for reading local files. |
@w-wong I appreciate your use case. Similarly, I would like to have Box render asciidoc files. The above discussion suggests that this be done at the Box server, similar to GitHub, and not at the extension level. |
@sturtison If https://www.box.com can serve the AsciiDoc file as plain-text from an URL ending with |
Yes and no, the main reason is that the content needs to be served as plain-text otherwise the extension cannot extract the AsciiDoc content (or JSON content) from an HTML page. |
Can we force the extension to load page without checking on specified file extension?
Sometimes we can't change the remote link file extension
The text was updated successfully, but these errors were encountered: