'{@$__wcf->getPath()}js/3rdParty/redactor2/plugins/WoltLabEvent.js?v={@LAST_UPDATE_TIME}',
'{@$__wcf->getPath()}js/3rdParty/redactor2/plugins/WoltLabImage.js?v={@LAST_UPDATE_TIME}',
'{@$__wcf->getPath()}js/3rdParty/redactor2/plugins/WoltLabInlineCode.js?v={@LAST_UPDATE_TIME}',
+ '{@$__wcf->getPath()}js/3rdParty/redactor2/plugins/WoltLabKeydown.js?v={@LAST_UPDATE_TIME}',
'{@$__wcf->getPath()}js/3rdParty/redactor2/plugins/WoltLabLink.js?v={@LAST_UPDATE_TIME}',
'{@$__wcf->getPath()}js/3rdParty/redactor2/plugins/WoltLabMedia.js?v={@LAST_UPDATE_TIME}',
'{@$__wcf->getPath()}js/3rdParty/redactor2/plugins/WoltLabMention.js?v={@LAST_UPDATE_TIME}',
linkSize: 0xBADC0DED, // some random value to disable truncating
minHeight: 200,
plugins: [
+ // Imperavi
'alignment',
'source',
'table',
+
+ // WoltLab specials
+ 'WoltLabBlock',
+ 'WoltLabKeydown',
+
+ // WoltLab core
'WoltLabAlignment',
'WoltLabAttachment',
- 'WoltLabBlock',
'WoltLabCode',
'WoltLabColor',
'WoltLabDropdown',
}).bind(this);
},
- register: function(tag) {
+ register: function(tag, arrowKeySupport) {
if (this.block.tags.indexOf(tag) !== -1) {
return;
}
this.block.tags.push(tag);
+ this.opts.paragraphizeBlocks.push(tag);
if (this.opts.blockTags.indexOf(tag) === -1) {
this.opts.blockTags.push(tag);
this.reIsBlock = new RegExp('^(' + this.opts.blockTags.join('|').toUpperCase() + ')$', 'i');
}
+
+ if (arrowKeySupport) {
+ this.WoltLabKeydown.register(tag);
+ }
}
}
};
--- /dev/null
+$.Redactor.prototype.WoltLabKeydown = function() {
+ "use strict";
+
+ var _tags = [];
+
+ return {
+ init: function () {
+ this.keydown.onArrowDown = (function() {
+ var tags = this.WoltLabKeydown._getBlocks();
+
+ for (var i = 0; i < tags.length; i++) {
+ if (tags[i]) {
+ this.keydown.insertAfterLastElement(tags[i]);
+ return false;
+ }
+ }
+ }).bind(this);
+
+ this.keydown.onArrowUp = (function() {
+ var tags = this.WoltLabKeydown._getBlocks();
+
+ for (var i = 0; i < tags.length; i++) {
+ if (tags[i]) {
+ this.keydown.insertBeforeFirstElement(tags[i]);
+ return false;
+ }
+ }
+ }).bind(this);
+ },
+
+ register: function (tag) {
+ if (_tags.indexOf(tag) === -1) {
+ _tags.push(tag);
+ }
+ },
+
+ _getBlocks: function () {
+ var tags = [this.keydown.blockquote, this.keydown.pre, this.keydown.figcaption];
+
+ for (var i = 0, length = _tags.length; i < length; i++) {
+ tags.push(this.utils.isTag(this.keydown.current, _tags[i]))
+ }
+
+ return tags;
+ }
+ }
+};
});
// restore buttons, prevents disabled buttons on back navigation in Opera
- $(window).unload(function() {
+ $(window).on('unload',function() {
$forms.find('.formSubmit input[type=submit]').enable();
});
}
EventHandler.add('com.woltlab.wcf.redactor2', 'observe_load_' + this._elementId, this._observeLoad.bind(this));
// register custom block element
- this._editor.WoltLabBlock.register('woltlab-spoiler');
- this._editor.block.tags.push('woltlab-spoiler');
+ this._editor.WoltLabBlock.register('woltlab-spoiler', true);
// support for active button marking
this._editor.opts.activeButtonsStates['woltlab-spoiler'] = 'woltlabSpoiler';