mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-29 21:10:31 +02:00
[feature/editor-code-tabs] Check for browser support in function
Check for browser support and valid textarea in function instead of before applying function. PHPBB3-11557
This commit is contained in:
@@ -681,6 +681,10 @@ phpbb.applyCodeEditor = function(textarea) {
|
|||||||
startTagsEnd = ']',
|
startTagsEnd = ']',
|
||||||
endTags = ['[/code]'];
|
endTags = ['[/code]'];
|
||||||
|
|
||||||
|
if (!textarea || typeof textarea.selectionStart !== 'number') {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if ($(textarea).data('code-editor') === true) {
|
if ($(textarea).data('code-editor') === true) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@@ -415,9 +415,6 @@ function getCaretPosition(txtarea) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
textarea = doc.forms[form_name].elements[text_name];
|
textarea = doc.forms[form_name].elements[text_name];
|
||||||
if (!textarea || typeof textarea.selectionStart !== 'number') {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
phpbb.applyCodeEditor(textarea);
|
phpbb.applyCodeEditor(textarea);
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user