1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-07-13 21:26:28 +02:00

[ticket/13713] Very basic dropdown implementation

PHPBB3-13713
This commit is contained in:
lavigor
2018-05-25 16:31:32 +03:00
committed by Marc Alexander
parent 218e6bfcad
commit 86b5fbed38
7 changed files with 43 additions and 9 deletions

View File

@ -384,11 +384,20 @@ function getCaretPosition(txtarea) {
return caretPos;
}
/**
* Allow to use tab character when typing code
* Keep indentation of last line of code when typing code
*/
(function($) {
function handle_mentions(txtarea) {
$(txtarea).atwho({
at: "@",
callbacks: {
remoteFilter: function(query, callback) {
$.getJSON(mention_url, {keyword: query, topic_id: mention_topic_id}, function (data) {
callback(data)
});
}
}
});
}
$(document).ready(function() {
var doc, textarea;
@ -405,11 +414,20 @@ function getCaretPosition(txtarea) {
textarea = doc.forms[form_name].elements[text_name];
/**
* Allow to use tab character when typing code
* Keep indentation of last line of code when typing code
*/
phpbb.applyCodeEditor(textarea);
if ($('#attach-panel').length) {
phpbb.showDragNDrop(textarea);
}
if (mention_url) {
handle_mentions(textarea);
}
$('textarea').on('keydown', function (e) {
if (e.which === 13 && (e.metaKey || e.ctrlKey)) {
$(this).closest('form').find(':submit').click();