diff options
author | Andrew Dolgov <[email protected]> | 2021-12-16 09:00:50 +0300 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2021-12-16 09:00:50 +0300 |
commit | eba619289d8a33451312a11b913e9f663ac002aa (patch) | |
tree | de0c9c9b601390a3f0a935402ff53e0a289a462e | |
parent | 617c94efcd123c0ba3e7ff4b8acb4f0914c4e8cb (diff) |
switch to HOOK_HEADLINE_TOOLBAR_SELECT_MENU_ITEM2
-rw-r--r-- | init.js | 27 | ||||
-rw-r--r-- | init.php | 6 |
2 files changed, 24 insertions, 9 deletions
@@ -1,6 +1,14 @@ -/* global Plugins, Headlines, xhr, dojo, fox, __ */ +/* global require, PluginHost, Plugins, Headlines, xhr, dojo, fox, __ */ Plugins.Mailto = { + init: function() { + PluginHost.register(PluginHost.HOOK_HEADLINE_TOOLBAR_SELECT_MENU_ITEM2, (action) => { + if (action == "Plugins.Mailto.send()") + this.send(); + + return true; + }); + }, send: function (id) { if (!id) { const ids = Headlines.getSelected(); @@ -31,9 +39,16 @@ Plugins.Mailto = { } }; -// override default hotkey action if enabled -Plugins.Mail = Plugins.Mail || {}; +require(['dojo/_base/kernel', 'dojo/ready'], function (dojo, ready, script) { + ready(function() { -Plugins.Mail.onHotkey = function(id) { - Plugins.Mailto.send(id); -}; + // override default hotkey action if enabled + Plugins.Mail = Plugins.Mail || {}; + + Plugins.Mail.onHotkey = function(id) { + Plugins.Mailto.send(id); + }; + + Plugins.Mailto.init(); + }) +}); @@ -9,11 +9,11 @@ class MailTo extends Plugin { function init($host) { $host->add_hook($host::HOOK_ARTICLE_BUTTON, $this); - $host->add_hook($host::HOOK_HEADLINE_TOOLBAR_SELECT_MENU_ITEM, $this); + $host->add_hook($host::HOOK_HEADLINE_TOOLBAR_SELECT_MENU_ITEM2, $this); } - function hook_headline_toolbar_select_menu_item($feed_id, $is_cat) { - return "<div dojoType='dijit.MenuItem' onclick='Plugins.Mailto.send()'>".__('Forward by email (mailto:)')."</div>"; + function hook_headline_toolbar_select_menu_item2($feed_id, $is_cat) { + return "<option value='Plugins.Mailto.send()'>".__('Forward by email (mailto:)')."</option>"; } function get_js() { |