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
Make firefox compatible #130
Conversation
manifest.json
Outdated
"options_page": "fancy-settings/source/index.html", | ||
"options_ui": { | ||
"page": "fancy-settings/source/index.html", | ||
"browser_style": true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems brower_style is Firefox only?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see only browser_style
is not supported which is not really needed anyway. https://developer.mozilla.org/en-US/Add-ons/WebExtensions/manifest.json/options_ui#Browser_compatibility
fancy-settings/source/settings.js
Outdated
@@ -11,7 +11,7 @@ function localMessageHandler(msg, port) { | |||
|
|||
// Test for the presence of an Edit Server | |||
function test_server() { | |||
var port = chrome.extension.connect(); | |||
var port = browser.runtime.connect(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This breaks on Chrome: Uncaught ReferenceError: browser is not defined
at Object.test_server (settings.js:14)
at Object. (mootools-core.js:1436)
at Array.forEach ()
at Function.forEach (mootools-core.js:211)
at Array.each (mootools-core.js:324)
at Object.fireEvent (mootools-core.js:1434)
at Object.wrapper.extend.$owner (mootools-core.js:1316)
at Object. (setting.js:161)
at HTMLInputElement.defn (mootools-core.js:3703)
So maybe this isn't as cross-platform as it should be
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, https://developer.mozilla.org/en-US/Add-ons/WebExtensions/API/runtime/connect says it's supported but apparently not :(
@dakra I'm afraid I can't merge this as it breaks in Chrome. I'm quite happy to make the extension cross platform if we can but I can't break it's working case in the process. Please test on both Chrome and Firefox on your next PR. |
@stsquad I make some shims for the Thanks! |
So, how can we use it if Firefox? Any *.xpi files? Any topics on addons.mozilla.org? |
I've just tested the master branch on Chrome and it still works. I fixed a minor typo that was throwing up a warning. However with this branch merged all functionality is lost (edit button goes away). Errors include:
|
Is this obstacle to make two different, bun similar extentions for chrome and firefox? To anyone: you, Dakra? As far as I understand, Dakra have made extention for firefox for self, so he has working xpi file. Am I wrong? Or may be I just shoud write direct to Dakra's repository? |
@stiv-sigmal I'm sure it's possible but I'm waiting for a tested PR that doesn't break the existing functionality. |
@stiv-sigmal @stsquad I'll check again the next few days and try to figure out The "problem" is only that I don't use chrome and don't want to spend too much Anyway, I'll upload the xpi I'm using daily for Firefox (I'm writing this in |
@stsquad @stiv-sigmal ok, I rebased to current master and fixed some things. (now I make a correct In my quick test it worked fine in chrome as well as in firefox. Since it's unsigned you have to set For this zip I added "applications": {
"gecko": { "id": "edit-with-emacs@1.14" }
} to mainfest.json but I think if you upload it to amo it's not necessary (not sure though) |
javascript/context_menu.js
Outdated
@@ -56,7 +56,11 @@ | |||
sendResponse({}); | |||
} | |||
|
|||
chrome.extension.onRequest.addListener(processRequest); | |||
// Check for Firefox compatibility | |||
if (typeof browser === 'undefined') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How did this work?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's obviously wrong.
Fixed now.
Cool, is there any release date for this feature ? |
@stsquad Thanks, good to hear :) @stiv-sigmal @zw963 Here's the latest version. It works for me but I guess not very well tested with different setups. |
Hi, It seem like worked for Firefox 48 developer Edition, but have some limit:
my emacs config(require 'edit-server)
(setq edit-server-url-major-mode-alist '(
("github\\.com" . markdown-mode)
("ruby-china" . markdown-mode)
("gitlab" . markdown-mode)
)
edit-server-port "9293"
)
(when (and (require 'edit-server nil t) (daemonp))
(edit-server-start)
(add-hook 'edit-server-start-hook (lambda ()
(local-set-key [(control c) (return)] 'org-ctrl-c-ret)
(local-set-key [(control c) (?\r)] 'org-ctrl-c-ret)
))
) extension configshow edit button. (not work) |
Seem like when I press Ctrl-x Ctrl-s, emacs not response with correct response, |
emacs 25.3.1 Thanks |
@dakra seems to work for me, thanks! tested on two machines, both running firefox 57, and on both tested at https://paste.debian.net
the only minimal glitch I noticed is that the edit button is placed a bit far from the textarea, but that's only cosmetical. |
@zw963 those sound like issues with the edit-server. Where do you get your copy from? |
@gregoa the img button is now in a which in theory should make it easier to position with CSS. However this is a little beyond my CSS skills at the moment.
|
Hmm, that doesn't happen to me. I can just have the daemon running and
Oh, now that you say it, it's missing here as well.
You can save and close with 'C-c C-c' and discard with 'C-c C-k'.
What does not correct mean? Thanks. |
Sorry, this issue seem like from
It not worked for me. BTW: I use firefox and emacs on openSUSE 42.3.
From this github project. current hash is: 43ec769 |
@zw963 OK can you raise a separate bug for this. The C-x C-s save behaviour is a little hokey - basically we close the existing session to update the text area and then immediately re-open a new session to continue editing. You might find C-u M-x edit-server-start will give you more indication of what is going on. |
@stsquad , hi, i add new issue for |
Please release a version to https://addons.mozilla.org/de/firefox/. |
I'm happy for @dakra to upload to the store as he knows about the process. |
I just checked the availability of the extension on https://addons.mozilla.org/de/firefox/ – it is still not available. |
Maybe forgot to upload ... |
@DirkSchmitt sorry, only show stopper is busy Christmas times ;) |
@DirkSchmitt @zw963 https://addons.mozilla.org/en-US/firefox/addon/edit-with-emacs1/ I think invoking the edit via the context menu is somewhat buggy.. I always use Don't think I have time this year to investigate further. Also I want to change the addon slug to only 'edit-with-emacs', |
me too. always use M-Enter. |
So here is the fixes from the other PR #129 rebased and without the formatting changes.
You can pick and choose any commit you want if you want to update in smaller steps.
It's all not heavily tested. More a 'works for me in Firefox', so please test first.