asciidoctor / asciidoctor-firefox-addon

:wolf: An add-on for Mozilla Firefox that converts AsciiDoc files to HTML directly in the browser using Asciidoctor.js.
https://addons.mozilla.org/en-US/firefox/addon/asciidoctorjs-live-preview/
MIT License
32 stars 9 forks source link

Asciidoc files are only rendered once when using LiveReload #26

Closed lask79 closed 9 years ago

lask79 commented 9 years ago

Hi,

I am having problems using the Asciidoctor Firefox addon in combination with LiveReload and the JBoss Tools LiveReload (http://tools.jboss.org/features/livereload.html).

When I

When I disable the Asciidoctor Addon then every change is triggering an update of the raw text so the LiveReload connection itself seems to work.

Any idea?

ggrossetie commented 9 years ago

Hi @lask79 and thanks for using the Firefox add-on. This is a known issue and we already solved it on the Chrome extension (meaning the fix will be easy yay!). If I remember correctly the issue was that the LiveReload is injecting a script in the HTML page but the extension replaces the whole content with the converted html. We fix this issue by saving existing script in the page. If you are interested in live reload, the chrome extension have a built-in feature (no need to install LiveReload).

I will try to backport this fix and publish a new version to the Firefox add-on website.

lask79 commented 9 years ago

That would be great if you could fix this soon. Chrome is not allowed at our customer site and therefor not an option for us.

Regards Lasse

ggrossetie commented 9 years ago

@lask79 I pushed to master a new version to save scripts before updating the document body (and then restore them). Could you test if this fix the issue ?

maxandersen commented 9 years ago

How do I test this ? is it already live ? if yes, it seem to have been fixed. And yes I did see the same issue described here in the past thinking it was our livereload implementation that somehow was broken; good to see it is just limited to asciidoctor.js firefox add on. ;)

ggrossetie commented 9 years ago

How do I test this ? is it already live ?

I don't think so :smile: How did you install the add-on ? from the asciidoctor.org website or from https://addons.mozilla.org ? And can you tell me the version you are running ?

lask79 commented 9 years ago

How can I test this when this is not released yet? I am using 0.3.0.

ggrossetie commented 9 years ago

Actually 0.3.0 sounds good, are you still having the issue with 0.3.0 ?

If you are using Firefox 38+, you can build an xpi file with jpm: https://github.com/asciidoctor/asciidoctor-firefox-addon#local-build

Then you can simply drag and drop it on Firefox to install the Add-on.

If you are using Firefox < 38 you need to use the Firefox Add-on SDK: https://github.com/asciidoctor/asciidoctor-firefox-addon/blob/3020eaba83450b817c5ff6251ae3daffff1ea547/README.adoc#local-build

You also need to checkout efaa65c5f6151867a9a06cf987d5e2dd51f2a8eb (because master is currently targeting Firefox 38+ and is only compatible with jpm)

If this sounds too complicated I can produce a preview version and attach it on GitHub ?

maxandersen commented 9 years ago

I built this and it unfortunately does not seem to fix the bug

chrome works.

ggrossetie commented 9 years ago

@maxandersen Could you give me a description of your environment so I can try to reproduce this issue ?

maxandersen commented 9 years ago

Running latest firefox w/asciidoctor plugin and livereload plugin using JBoss Tools Livereload feature (import project, right click .adoc file and use Show In > Browse w/livereload) - I do not think this is specific to jboss tools livereload though.

Then in firefox enable livereload and then edit to save file. See the reload happen. edit and save file again - no reload happens.

enable livereload - things work again, but just once.

For "pure" html livereload works just fine. Only affects asciidoc.

For me this implies that the livereload feature does work, but somehow asciidoctor.js "resets" the reload feature which is unfortunate.

ggrossetie commented 9 years ago

@maxandersen thanks for the detailed procedure, I'm downloading JBoss Developer Studio 8.1.0.GA to reproduce, I will let you know

maxandersen commented 9 years ago

note, it also fails without jboss developer studio.

ggrossetie commented 9 years ago

Should be OK with my last commit 53bc70dcb8cba83eeec4c0a0f97ea67793d22032

lask79 commented 9 years ago

Now it works like a charm. Thanks for fixing.

ggrossetie commented 9 years ago

Cool, I will published a new version to the AMO :smile:

mojavelinux commented 9 years ago

:+1: Nice work!

ggrossetie commented 9 years ago

Resolved by 53bc70d

maxandersen commented 9 years ago

any ETA on this ? https://addons.mozilla.org/en-US/firefox/addon/asciidoctorjs-live-preview/ still says 0.3.2 ?

ggrossetie commented 9 years ago

I'm waiting review on #33 and #34 before publishing the new version

ggrossetie commented 9 years ago

@maxandersen I submitted v0.4.0 to AMO

maxandersen commented 9 years ago

cool, do you know how long it takes from submit to it showing up for now old 3.x is still there.

ggrossetie commented 9 years ago

Last time was 2 weeks or so, I will let you know when I heard from them.

maxandersen commented 9 years ago

just to verify that 0.4.0 built from source works like a charm! thanks.

mojavelinux commented 9 years ago

:+1:

ggrossetie commented 9 years ago

@maxandersen I have a good news!

Your add-on, Asciidoctor.js Live Preview 0.4.0, has been fully reviewed by an editor and is now available for download in our gallery at https://addons.mozilla.org/addon/asciidoctorjs-live-preview/

3 months to review a minor update... well done!

maxandersen commented 9 years ago

awesome!

mojavelinux commented 9 years ago

:beers: