Note link tweaks
- Send modifier keys through to loadURI() when clicking Open Link in notes - Open link in parent window from external note window - Don't show both menus on right-click Follow-up from #450
This commit is contained in:
parent
2f9c7fd839
commit
a6ab904cd0
3 changed files with 38 additions and 5 deletions
|
@ -140,7 +140,10 @@
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'openlink':
|
case 'openlink':
|
||||||
ZoteroPane.loadURI(event.target.href);
|
var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"]
|
||||||
|
.getService(Components.interfaces.nsIWindowMediator);
|
||||||
|
win = wm.getMostRecentWindow('navigator:browser');
|
||||||
|
win.ZoteroPane.loadURI(event.target.href, event.modifierKeys);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -26,9 +26,18 @@
|
||||||
|
|
||||||
// add editor command to open links through zoteroHandleEvent
|
// add editor command to open links through zoteroHandleEvent
|
||||||
ed.addCommand('openlink', function(command) {
|
ed.addCommand('openlink', function(command) {
|
||||||
var node = tinyMCE.activeEditor.selection.getNode();
|
var ed = tinyMCE.activeEditor;
|
||||||
|
var node = ed.selection.getNode();
|
||||||
if (node.nodeName == 'A') {
|
if (node.nodeName == 'A') {
|
||||||
zoteroHandleEvent({ type: 'openlink', target: node });
|
zoteroHandleEvent({
|
||||||
|
type: 'openlink',
|
||||||
|
target: node,
|
||||||
|
// We don't seem to be able to access the click event that triggered this
|
||||||
|
// command in order to check the modifier keys used, so instead we save
|
||||||
|
// the keys on every menu click in tiny_mce.js and pass them on here
|
||||||
|
// for use by loadURI().
|
||||||
|
modifierKeys: ed.lastClickModifierKeys
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -46,9 +55,20 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
showMenu = ed.onClick.add(function(ed, e) {
|
showMenu = ed.onClick.add(function(ed, e) {
|
||||||
// only show when <a> node + Block TinyMCE menu on ctrlKey and work around Safari issue
|
// Only show on left-click
|
||||||
if (e.target.nodeName != 'A' || ((realCtrlKey !== 0 ? realCtrlKey : e.ctrlKey) && !contextmenuNeverUseNative))
|
if (e.button != 0) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Only show when <a> node
|
||||||
|
if (e.target.nodeName != 'A') {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Block TinyMCE menu on ctrlKey and work around Safari issue
|
||||||
|
if ((realCtrlKey !== 0 ? realCtrlKey : e.ctrlKey) && !contextmenuNeverUseNative) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Event.cancel(e);
|
Event.cancel(e);
|
||||||
|
|
||||||
|
|
10
resource/tinymce/tiny_mce.js
vendored
10
resource/tinymce/tiny_mce.js
vendored
|
@ -11646,6 +11646,16 @@ tinymce.create('tinymce.ui.Separator:tinymce.ui.Control', {
|
||||||
t.mouseClickFunc = Event.add(co, 'click', function(e) {
|
t.mouseClickFunc = Event.add(co, 'click', function(e) {
|
||||||
var m;
|
var m;
|
||||||
|
|
||||||
|
// Added by Zotero
|
||||||
|
//
|
||||||
|
// Record the modifier keys used with the last menu click -- used by linksmenu plugin
|
||||||
|
tinymce.activeEditor.lastClickModifierKeys = {
|
||||||
|
altKey: e.altKey,
|
||||||
|
ctrlKey: e.ctrlKey,
|
||||||
|
metaKey: e.metaKey,
|
||||||
|
shiftKey: e.shiftKey
|
||||||
|
};
|
||||||
|
|
||||||
e = e.target;
|
e = e.target;
|
||||||
|
|
||||||
if (e && (e = DOM.getParent(e, 'tr')) && !DOM.hasClass(e, cp + 'ItemSub')) {
|
if (e && (e = DOM.getParent(e, 'tr')) && !DOM.hasClass(e, cp + 'ItemSub')) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue