mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-08 04:18:52 +00:00
[ticket/13713] Very basic dropdown implementation
PHPBB3-13713
This commit is contained in:
parent
218e6bfcad
commit
86b5fbed38
7 changed files with 43 additions and 9 deletions
|
@ -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();
|
||||
|
|
|
@ -1905,6 +1905,7 @@ $page_data = array(
|
|||
'U_VIEW_TOPIC' => ($mode != 'post') ? append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id") : '',
|
||||
'U_PROGRESS_BAR' => append_sid("{$phpbb_root_path}posting.$phpEx", "f=$forum_id&mode=popup"),
|
||||
'UA_PROGRESS_BAR' => addslashes(append_sid("{$phpbb_root_path}posting.$phpEx", "f=$forum_id&mode=popup")),
|
||||
'UA_MENTION_URL' => $controller_helper->route('phpbb_mention_controller'),
|
||||
|
||||
'S_PRIVMSGS' => false,
|
||||
'S_CLOSE_PROGRESS_WINDOW' => (isset($_POST['add_file'])) ? true : false,
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
var text_name = <!-- IF $SIG_EDIT -->'signature'<!-- ELSE -->'message'<!-- ENDIF -->;
|
||||
var load_draft = false;
|
||||
var upload = false;
|
||||
var mention_url = '{UA_MENTION_URL}';
|
||||
var mention_topic_id = '{S_TOPIC_ID}';
|
||||
|
||||
// Define the bbCode tags
|
||||
var bbcode = new Array();
|
||||
|
@ -25,6 +27,9 @@
|
|||
}
|
||||
}
|
||||
</script>
|
||||
<!-- INCLUDECSS {T_ASSETS_PATH}/css/jquery.atwho.min.css -->
|
||||
<!-- INCLUDEJS {T_ASSETS_PATH}/javascript/jquery.caret.min.js -->
|
||||
<!-- INCLUDEJS {T_ASSETS_PATH}/javascript/jquery.atwho.min.js -->
|
||||
<!-- INCLUDEJS {T_ASSETS_PATH}/javascript/editor.js -->
|
||||
|
||||
<!-- IF S_BBCODE_ALLOWED -->
|
||||
|
|
1
phpbb/assets/css/jquery.atwho.min.css
vendored
Normal file
1
phpbb/assets/css/jquery.atwho.min.css
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
.atwho-view{position:absolute;top:0;left:0;display:none;margin-top:18px;background:#fff;color:#000;border:1px solid #DDD;border-radius:3px;box-shadow:0 0 5px rgba(0,0,0,.1);min-width:120px;z-index:11110!important}.atwho-view .atwho-header{padding:5px;margin:5px;cursor:pointer;border-bottom:solid 1px #eaeff1;color:#6f8092;font-size:11px;font-weight:700}.atwho-view .atwho-header .small{color:#6f8092;float:right;padding-top:2px;margin-right:-5px;font-size:12px;font-weight:400}.atwho-view .atwho-header:hover{cursor:default}.atwho-view .cur{background:#36F;color:#fff}.atwho-view .cur small{color:#fff}.atwho-view strong{color:#36F}.atwho-view .cur strong{color:#fff;font:700}.atwho-view ul{list-style:none;padding:0;margin:auto;max-height:200px;overflow-y:auto}.atwho-view ul li{display:block;padding:5px 10px;border-bottom:1px solid #DDD;cursor:pointer}.atwho-view small{font-size:smaller;color:#777;font-weight:400}
|
1
phpbb/assets/javascript/jquery.atwho.min.js
vendored
Normal file
1
phpbb/assets/javascript/jquery.atwho.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
2
phpbb/assets/javascript/jquery.caret.min.js
vendored
Normal file
2
phpbb/assets/javascript/jquery.caret.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
|
@ -43,10 +43,10 @@ class mention
|
|||
|
||||
public function handle()
|
||||
{
|
||||
// if (!$this->request->is_ajax())
|
||||
// {
|
||||
// redirect(append_sid($this->phpbb_root_path . 'index.' . $this->php_ext));
|
||||
// }
|
||||
if (!$this->request->is_ajax())
|
||||
{
|
||||
redirect(append_sid($this->phpbb_root_path . 'index.' . $this->php_ext));
|
||||
}
|
||||
|
||||
$keyword = $this->request->variable('keyword', '', true);
|
||||
$topic_id = $this->request->variable('topic_id', 0);
|
||||
|
@ -57,6 +57,12 @@ class mention
|
|||
$names = array_merge($names, $source->get($keyword, $topic_id));
|
||||
}
|
||||
|
||||
return new JsonResponse($names);
|
||||
$clean_names = [];
|
||||
foreach ($names as $name)
|
||||
{
|
||||
$clean_names[] = $name['name'];
|
||||
}
|
||||
|
||||
return new JsonResponse($clean_names);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue