'wcf.editor.code.file.description': '{lang}wcf.editor.code.file.description{/lang}',
'wcf.editor.code.highlighter': '{lang}wcf.editor.code.highlighter{/lang}',
'wcf.editor.code.highlighter.description': '{lang}wcf.editor.code.highlighter.description{/lang}',
+ 'wcf.editor.code.highlighter.detect': '{lang}wcf.editor.code.highlighter.detect{/lang}',
'wcf.editor.code.line': '{lang}wcf.editor.code.line{/lang}',
'wcf.editor.code.line.description': '{lang}wcf.editor.code.line.description{/lang}',
'wcf.editor.code.title': '{lang __literal=true}wcf.editor.code.title{/lang}',
this.observe.load = (function() {
observeLoad.call(this);
- EventHandler.fire('com.woltlab.wcf.redactor', 'observe_load_' + elementId, {
+ EventHandler.fire('com.woltlab.wcf.redactor2', 'observe_load_' + elementId, {
editor: this.$editor[0]
});
}).bind(this);
this._setTitle(pre);
- pre.removeEventListener(WCF_CLICK_EVENT, this._callbackEdit);
pre.addEventListener(WCF_CLICK_EVENT, this._callbackEdit);
// there must be some kind of element after the <pre>
* @protected
*/
_observeLoad: function() {
+ this._editor.events.stopDetectChanges();
+
elBySelAll('pre', this._editor.$editor[0], (function(pre) {
pre.addEventListener(WCF_CLICK_EVENT, this._callbackEdit);
this._setTitle(pre);
}).bind(this));
+
+ this._editor.events.startDetectChanges();
},
/**
_save: function(event) {
event.preventDefault();
+ this._editor.events.stopDetectChanges();
+
var id = 'redactor-code-' + this._elementId;
['file', 'highlighter', 'line'].forEach((function (attr) {
this._setTitle(this._pre);
this._editor.caret.after(this._pre);
+ this._editor.events.startDetectChanges();
+
UiDialog.close(this);
},
//noinspection JSUnresolvedVariable
highlighter = (this._editor.opts.woltlab.highlighters.hasOwnProperty(highlighter)) ? this._editor.opts.woltlab.highlighters[highlighter] : '';
- elData(pre, 'display-value', Language.get('wcf.editor.code.title', {
+ var title = Language.get('wcf.editor.code.title', {
file: file,
highlighter: highlighter
- }));
+ });
+
+ if (elData(pre, 'title') !== title) {
+ elData(pre, 'title', title);
+ }
},
_dialogSetup: function() {
elById(idButtonSave).addEventListener(WCF_CLICK_EVENT, this._save.bind(this));
// set highlighters
- var highlighters = '<option value="">' + Language.get('wcf.global.noSelection') + '</option>';
+ var highlighters = '<option value="">' + Language.get('wcf.editor.code.highlighter.detect') + '</option>';
var value, values = [];
//noinspection JSUnresolvedVariable
* @param {object} editor editor element
*/
initEditor: function(editorId, editor) {
- EventHandler.add('com.woltlab.wcf.redactor', 'observe_load_' + editorId, (function(data) {
+ EventHandler.add('com.woltlab.wcf.redactor2', 'observe_load_' + editorId, (function(data) {
this.observeAll(data.editor);
}).bind(this));
_observe: function(element, updateHeader) {
if (_callbackEdit === null) _callbackEdit = this.edit.bind(this);
- element.removeEventListener(WCF_CLICK_EVENT, _callbackEdit);
element.addEventListener(WCF_CLICK_EVENT, _callbackEdit);
if (updateHeader) this._updateHeader(element);
white-space: pre;
&::before {
- content: attr(data-display-value);
+ content: attr(data-title);
cursor: pointer;
display: block;
font-family: $wcfFontFamily;
<item name="wcf.editor.code.file.description"><![CDATA[Optional: Legen Sie einen anzuzeigenden Dateinamen fest.]]></item>
<item name="wcf.editor.code.highlighter"><![CDATA[Syntax-Hervorhebung]]></item>
<item name="wcf.editor.code.highlighter.description"><![CDATA[Die farbliche Hervorherbung wird im Editor nicht angezeigt.]]></item>
+ <item name="wcf.editor.code.highlighter.detect"><![CDATA[(Automatische Erkennung)]]></item>
<item name="wcf.editor.code.line"><![CDATA[Start-Zeilennummer]]></item>
<item name="wcf.editor.code.line.description"><![CDATA[Optional: Legen Sie den Wert fest, ab dem die Zeilennummierung startet.]]></item>
<item name="wcf.editor.code.title"><![CDATA[{if $highlighter}{$highlighter}{else}Quellcode{/if}{if $file} - {$file}{/if}]]></item>
<item name="wcf.editor.code.file.description"><![CDATA[Optional: Specify the displayed filename.]]></item>
<item name="wcf.editor.code.highlighter"><![CDATA[Syntax Highlighting]]></item>
<item name="wcf.editor.code.highlighter.description"><![CDATA[Highlighting is not displayed within the editor.]]></item>
+ <item name="wcf.editor.code.highlighter.detect"><![CDATA[(Automatically Detect)]]></item>
<item name="wcf.editor.code.line"><![CDATA[Start Line Number]]></item>
<item name="wcf.editor.code.line.description"><![CDATA[Optional: Specify the start for line enumeration.]]></item>
<item name="wcf.editor.code.title"><![CDATA[{if $highlighter}{$highlighter}{else}Code{/if}{if $file} - {$file}{/if}]]></item>