'{@$__wcf->getPath()}js/3rdParty/redactor2/plugins/WoltLabQuote.js?v={@LAST_UPDATE_TIME}',
'{@$__wcf->getPath()}js/3rdParty/redactor2/plugins/WoltLabSize.js?v={@LAST_UPDATE_TIME}',
'{@$__wcf->getPath()}js/3rdParty/redactor2/plugins/WoltLabSmiley.js?v={@LAST_UPDATE_TIME}',
+ '{@$__wcf->getPath()}js/3rdParty/redactor2/plugins/WoltLabSource.js?v={@LAST_UPDATE_TIME}',
'{@$__wcf->getPath()}js/3rdParty/redactor2/plugins/WoltLabSpoiler.js?v={@LAST_UPDATE_TIME}',
'{@$__wcf->getPath()}js/3rdParty/redactor2/plugins/WoltLabUtils.js?v={@LAST_UPDATE_TIME}'
{else}
'WoltLabQuote',
'WoltLabSize',
'WoltLabSmiley',
+ 'WoltLabSource',
'WoltLabSpoiler',
'WoltLabUtils'
],
return {
init: function() {
- // disable caret position in source mode
- this.source.setCaretOnShow = function () {};
- this.source.setCaretOnHide = function (html) { return html; };
-
require(['WoltLabSuite/Core/Ui/Redactor/Code'], (function (UiRedactorCode) {
new UiRedactorCode(this);
}).bind(this));
--- /dev/null
+$.Redactor.prototype.WoltLabSource = function() {
+ "use strict";
+
+ return {
+ init: function () {
+ // disable caret position in source mode
+ this.source.setCaretOnShow = function () {};
+ this.source.setCaretOnHide = function (html) { return html; };
+
+ var mpHide = this.source.hide;
+ this.source.hide = (function () {
+ mpHide.call(this);
+
+ setTimeout(this.focus.end.bind(this), 100);
+ }).bind(this);
+
+ var textarea = this.source.$textarea[0];
+
+ var mpShow = this.source.show;
+ this.source.show = (function () {
+ mpShow.call(this);
+
+ textarea.selectionStart = textarea.selectionEnd = textarea.value.length;
+ }).bind(this);
+ }
+ };
+};