diff --git a/phpBB/assets/javascript/core.js b/phpBB/assets/javascript/core.js index ba76ba8c10..1a8beb8224 100644 --- a/phpBB/assets/javascript/core.js +++ b/phpBB/assets/javascript/core.js @@ -681,6 +681,10 @@ phpbb.applyCodeEditor = function(textarea) { startTagsEnd = ']', endTags = ['[/code]']; + if (!textarea || typeof textarea.selectionStart !== 'number') { + return; + } + if ($(textarea).data('code-editor') === true) { return; } diff --git a/phpBB/styles/prosilver/template/editor.js b/phpBB/styles/prosilver/template/editor.js index 6eb8c1e0c4..235cc0025b 100644 --- a/phpBB/styles/prosilver/template/editor.js +++ b/phpBB/styles/prosilver/template/editor.js @@ -415,9 +415,6 @@ function getCaretPosition(txtarea) { } textarea = doc.forms[form_name].elements[text_name]; - if (!textarea || typeof textarea.selectionStart !== 'number') { - return; - } phpbb.applyCodeEditor(textarea); });