6ec4ffc4ce8622568f9468ac957107a347cce6d5
1 $.Redactor
.prototype.WoltLabKeydown = function() {
8 this.keydown
.onArrowDown
= (function() {
9 var tags
= this.WoltLabKeydown
._getBlocks();
11 for (var i
= 0; i
< tags
.length
; i
++) {
13 this.keydown
.insertAfterLastElement(tags
[i
]);
19 this.keydown
.onArrowUp
= (function() {
20 var tags
= this.WoltLabKeydown
._getBlocks();
22 for (var i
= 0; i
< tags
.length
; i
++) {
24 this.keydown
.insertBeforeFirstElement(tags
[i
]);
30 var mpOnEnter
= this.keydown
.onEnter
;
31 this.keydown
.onEnter
= (function(e
) {
32 var isBlockquote
= this.keydown
.blockquote
;
33 if (isBlockquote
) this.keydown
.blockquote
= false;
35 mpOnEnter
.call(this, e
);
37 if (isBlockquote
) this.keydown
.blockquote
= isBlockquote
;
40 var mpOnTab
= this.keydown
.onTab
;
41 this.keydown
.onTab
= (function(e
, key
) {
42 if (!this.keydown
.pre
&& $(this.selection
.current()).closest('ul, ol', this.core
.editor()[0]).length
=== 0) {
46 return mpOnTab
.call(this, e
, key
);
49 require(['Core', 'Environment'], (function (Core
, Environment
) {
50 if (Environment
.platform() !== 'desktop') {
51 // ignore mobile devices
55 var container
= this.$editor
[0].closest('form, .message');
56 if (container
=== null) return;
58 var formSubmit
= elBySel('.formSubmit', container
);
59 if (formSubmit
=== null) return;
61 var submitButton
= elBySel('input[type="submit"], button[data-type="save"], button[accesskey="s"]', formSubmit
);
64 submitButton
.removeAttribute('accesskey');
66 // mimic the same behavior which will also work with more
67 // than one editor instance on the page
68 this.WoltLabEvent
.register('keydown', (function (data
) {
70 if (data
.event
.which
=== 83) {
73 if (window
.navigator
.platform
.match(/^Mac/)) {
74 if (data
.event
.ctrlKey
&& data
.event
.altKey
) {
78 else if (data
.event
.altKey
&& !data
.event
.ctrlKey
) {
85 Core
.triggerEvent(submitButton
, WCF_CLICK_EVENT
);
94 register: function (tag
) {
95 if (_tags
.indexOf(tag
) === -1) {
100 _getBlocks: function () {
101 var tags
= [this.keydown
.blockquote
, this.keydown
.pre
, this.keydown
.figcaption
];
103 for (var i
= 0, length
= _tags
.length
; i
< length
; i
++) {
104 tags
.push(this.utils
.isTag(this.keydown
.current
, _tags
[i
]))