Skip to content

Commit

Permalink
Merge master
Browse files Browse the repository at this point in the history
  • Loading branch information
adam-p committed May 13, 2017
2 parents bc0739c + 5308e78 commit cc143a6
Show file tree
Hide file tree
Showing 6 changed files with 78 additions and 40 deletions.
10 changes: 10 additions & 0 deletions src/_locales/en/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,16 @@
"description": "Text shown on the context menu.",
"inMozDTD": true
},
"moz_options_dlg_title": {
"message": "Markdown Here Options",
"description": "In Thunderbird, in order to open the options tab we first have to open a temporary dialog box. This is the title for that box.",
"inMozDTD": true
},
"moz_options_dlg_instruction": {
"message": "Click the 'OK' button to open the Markdown Here Options tab",
"description": "In Thunderbird, in order to open the options tab we first have to open a temporary dialog box. This is the text in that box telling the user what to do. Please use the same translation for 'OK' that the application uses.",
"inMozDTD": true
},
"invalid_field": {
"message": "The selected field is not valid for Markdown rendering. Please use a rich editor.",
"description": "Shown in an alert dialog if the user tries to render a field that cannot be rendered"
Expand Down
5 changes: 5 additions & 0 deletions src/common/CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
Change Log
==========

2017-xx-yy: v2.13.0
--------------------

* [Fixed bug # 369](https://github.com/adam-p/markdown-here/issues/369): Clicking Markdown Here's "Options" button in Firefox and Thunderbird (version 48+) causes the client application to hang.
- Thanks to [Sam Estep](https://github.com/samestep), [r2evans](https://github.com/r2evans), [happyconfident](https://github.com/happyconfident), [Juan Salvador Aleixandre](https://github.com/juaalta), [haililihai](https://github.com/haililihai), [Shi Liang](https://github.com/shiliang-hust), [jjroper](https://github.com/jjroper), [Linxzh](https://github.com/l0o0).

2015-09-07: v2.12.0
--------------------
Expand Down
57 changes: 57 additions & 0 deletions src/firefox/chrome/content/options.xul
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE overlay SYSTEM "chrome://markdown_here/locale/strings.dtd">

<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>

<prefwindow id="markdown-here-options-intermediate"
title="&moz_options_dlg_title;"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
buttons="accept"
ondialogaccept="openOptionsTab()">

<script>
function openOptionsTab() {
var optionsUrl = 'resource://markdown_here_common/options.html';
var windowMediator = Components.classes['@mozilla.org/appshell/window-mediator;1']
.getService(Components.interfaces.nsIWindowMediator);

if (navigator.userAgent.indexOf('Thunderbird') >= 0 ||
navigator.userAgent.indexOf('Icedove') >= 0) {
windowMediator.getMostRecentWindow('mail:3pane')
.document.getElementById('tabmail')
.openTab('contentTab', {contentPage: optionsUrl});
}
else if (navigator.userAgent.indexOf('Postbox') >= 0) {
/* Haven't yet figured out how to open a tab in Postbox */
var prompts = Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
.getService(Components.interfaces.nsIPromptService);
prompts.alert(null, 'Markdown Here', 'Sorry, the options page is not supported for Postbox.');
}
else if (navigator.userAgent.indexOf('Zotero') >= 0) {
var prompts = Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
.getService(Components.interfaces.nsIPromptService);
prompts.alert(null, 'Markdown Here', 'Sorry, the options page is not supported for Zotero.');

/* This code does open the options page in a separate window,
but the page can't communicate with the background services
to get and set the options, so it's effectively unsupported. */
/*
var win = windowMediator.getMostRecentWindow('navigator:browser');
win.open(optionsUrl, "Markdown-Here-Options");
*/
}
else {
var win = windowMediator.getMostRecentWindow('navigator:browser');
win.gBrowser.selectedTab = win.gBrowser.addTab(optionsUrl);
}
}
</script>

<prefpane>
<hbox align="center">
<text value="&moz_options_dlg_instruction;"
style="font-weight:bold"/>
</hbox>
</prefpane>

</prefwindow>
2 changes: 2 additions & 0 deletions src/firefox/chrome/locale/en/strings.dtd
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
<!ENTITY context_menu_item "Markdown Toggle">
<!ENTITY forgot_to_render_back_button "Back">
<!ENTITY forgot_to_render_send_button "Send">
<!ENTITY moz_options_dlg_instruction "Click the 'OK' button to open the Markdown Here Options tab">
<!ENTITY moz_options_dlg_title "Markdown Here Options">
<!ENTITY toggle_button_text "MD Toggle">
<!ENTITY toggle_button_tooltip "Click to toggle Markdown rendering">
<!ENTITY toggle_button_tooltip_disabled "The selected field is not valid for Markdown rendering">
2 changes: 2 additions & 0 deletions src/firefox/chrome/locale/en/strings.properties
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ forgot_to_render_prompt_question=Send it anyway?
forgot_to_render_prompt_title=Forget to toggle Markdown?
forgot_to_render_send_button=Send
invalid_field=The selected field is not valid for Markdown rendering. Please use a rich editor.
moz_options_dlg_instruction=Click the 'OK' button to open the Markdown Here Options tab
moz_options_dlg_title=Markdown Here Options
new_changelist_items=NEW
nothing_to_render=Nothing found to render or revert
options_page__advanced_title=Advanced and Miscellaneous
Expand Down
42 changes: 2 additions & 40 deletions src/install.rdf
Original file line number Diff line number Diff line change
Expand Up @@ -152,46 +152,8 @@
<em:iconURL>resource://markdown_here_common/images/icon128.png</em:iconURL>
<em:homepageURL>https://github.com/adam-p/markdown-here</em:homepageURL>

<em:optionsURL>
javascript:
/* This is a pretty convoluted way of getting a tab to open with
our options page. */
var windowMediator = Components.classes['@mozilla.org/appshell/window-mediator;1']
.getService(Components.interfaces.nsIWindowMediator);
var optionsUrl = 'resource://markdown_here_common/options.html';
if (navigator.userAgent.indexOf('Thunderbird') >= 0 ||
navigator.userAgent.indexOf('Icedove') >= 0) {
windowMediator.getMostRecentWindow('mail:3pane')
.document.getElementById('tabmail')
.openTab('contentTab', {contentPage: optionsUrl});
}
else if (navigator.userAgent.indexOf('Postbox') >= 0) {
/* Haven't yet figured out how to open a tab in Postbox */
var prompts = Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
.getService(Components.interfaces.nsIPromptService);
prompts.alert(null, 'Markdown Here', 'Sorry, the options page is not supported for Postbox.');
}
else if (navigator.userAgent.indexOf('Zotero') >= 0) {
var prompts = Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
.getService(Components.interfaces.nsIPromptService);
prompts.alert(null, 'Markdown Here', 'Sorry, the options page is not supported for Zotero.');

/* This code does open the options page in a separate window,
but the page can't communicate with the background services
to get and set the options, so it's effectively unsupported. */
/*
var win = windowMediator.getMostRecentWindow('navigator:browser');
win.open(optionsUrl, "Markdown-Here-Options");
*/
}
else {
var win = windowMediator.getMostRecentWindow('navigator:browser');
win.gBrowser.selectedTab = win.gBrowser.addTab(optionsUrl);
}
/* Close the stub prefs dialog that will have opened. */
window.close();
</em:optionsURL>

<em:optionsType>1</em:optionsType>
<em:optionsURL>chrome://markdown_here/content/options.xul</em:optionsURL>

</Description>
</RDF>

0 comments on commit cc143a6

Please sign in to comment.