return false;
});
- key('ctrl+a', function () {
+ this.key('ctrl+a', function () {
+
$this.selectAll();
return false;
});
- key('del', function () {
+ this.key('del', function () {
$this.deleteSelection();
});
- key('left', function () {
+ this.key('left', function () {
$this.offsetSelectedLinks('left', -1);
});
- key('ctrl+left', function () {
+ this.key('ctrl+left', function () {
$this.offsetSelectedLinks('left', -10);
});
- key('right', function () {
+ this.key('right', function () {
$this.offsetSelectedLinks('left', 1);
});
- key('ctrl+right', function () {
+ this.key('ctrl+right', function () {
$this.offsetSelectedLinks('left', 10);
});
- key('up', function () {
+ this.key('up', function () {
$this.offsetSelectedLinks('top', -1);
});
- key('ctrl+up', function () {
+ this.key('ctrl+up', function () {
$this.offsetSelectedLinks('top', -10);
});
- key('down', function () {
+ this.key('down', function () {
$this.offsetSelectedLinks('top', 1);
});
- key('ctrl+down', function () {
+ this.key('ctrl+down', function () {
$this.offsetSelectedLinks('top', 10);
});
- key('pageup', function () {
+ this.key('pageup', function () {
$this.selectPreviousLink();
});
- key('pagedown', function () {
+ this.key('pagedown', function () {
$this.selectNextLink();
});
- key('ctrl+l', function () {
+ this.key('ctrl+l', function () {
$this.openImageLink();
return false;
});
- key('enter', function () {
+ this.key('enter', function () {
if ($(document.activeElement).is('input[name="to"]')) {
$this.selectNextLink();
return false;
}, 250);
},
+ key: function (shortcut, scope) {
+ var $this = this;
+ key(shortcut, function (event, handler) {
+ if ($this.allowsKeyboardShortcut(shortcut)) {
+ scope(event, handler);
+ }
+ })
+ },
+
+ allowsKeyboardShortcut: function (shortcut) {
+ if (shortcut === 'pageup' || shortcut === 'pagedown' || shortcut === 'enter') {
+ return true;
+ }
+ return !$(document.activeElement).is('input,textarea,select');
+ },
+
openImageLink: function () {
let selection = $(".link[fb-type=6].selected");
if (selection.length !== 1 || selection.attr('fb-alternative') == '') {
},
createLinkDrag: function () {
- var link = this.duplicateLinkClick({width: 0, height: 0});
+ var link = this.duplicateLinkDrag({width: 0, height: 0});
$(link).addClass('pendingCreate');
this.startResizeLink('se');
this.linkeditor.form.updateLinkForm();
});
},
- duplicateLinkClick: function (overwriteData) {
+ _duplicateLink: function () {
var data = this.lastSelectedLinkData;
+ data.page = this.linkeditor.currentPage;
var pos = this.linkeditor.globalToFluidbook(this.linkeditor.mx, this.linkeditor.my, this.linkeditor.single);
data.left = pos.x;
data.top = pos.y;
- data.page = this.linkeditor.currentPage;
+ delete data.uid;
+ return data;
+ },
+
+ duplicateLinkClick: function () {
+ var data = this._duplicateLink();
+
+ let link = this.addLink(data);
+
+ this.deselectAllLinks();
+ this.selectLink($(link));
+ this.linkeditor.form.updateFormData();
+
+ return $(link);
+ },
+
+ duplicateLinkDrag(overwriteData) {
+ var data = this._duplicateLink();
if (overwriteData !== undefined) {
$.extend(data, overwriteData);
}
- delete data.uid;
let link = this.addLink(data);
+
this.deselectAllLinks();
this.selectLink($(link));
this.linkeditor.form.updateFormData();