Skip to content

Commit 33548e1

Browse files
ahangslebenlresende
authored andcommitted
Upgraded typeahead library. (jupyter#4944)
1 parent f354740 commit 33548e1

File tree

5 files changed

+26
-22
lines changed

5 files changed

+26
-22
lines changed

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"google-caja": "5669",
1313
"jed": "~1.1.1",
1414
"jquery": "components/jquery#~3.4.1",
15-
"jquery-typeahead": "~2.0.0",
15+
"jquery-typeahead": "~2.10.6",
1616
"jquery-ui": "components/jqueryui#~1.12",
1717
"marked": "~0.5",
1818
"MathJax": "^2.7.4",

notebook/static/notebook/js/commandpalette.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,20 +44,20 @@ define([
4444
// typeahead lib need a specific layout with specific class names.
4545
// the following just does that
4646
var form = $('<form/>');
47-
var container = $('<div/>').addClass('typeahead-container');
48-
var field = $('<div/>').addClass('typeahead-field');
47+
var container = $('<div/>').addClass('typeahead__container');
48+
var field = $('<div/>').addClass('typeahead__field');
4949
var input = $('<input/>').attr('type', 'search');
5050

5151
field
5252
.append(
53-
$('<span>').addClass('typeahead-query').append(
53+
$('<span>').addClass('typeahead__query').append(
5454
input
5555
)
5656
)
5757
.append(
58-
$('<span/>').addClass('typeahead-button').append(
58+
$('<span/>').addClass('typeahead__button').append(
5959
$('<button/>').attr('type', 'submit').append(
60-
$('<span/>').addClass('typeahead-search-icon')
60+
$('<span/>').addClass('typeahead__search-icon')
6161
)
6262
)
6363
);
@@ -185,7 +185,9 @@ define([
185185
maxItem: 1e3,
186186
minLength: 0,
187187
hint: true,
188-
group: ["group", "{{group}} command group"],
188+
group: {
189+
template:"{{group}} command group"
190+
},
189191
searchOnFocus: true,
190192
mustSelectItem: true,
191193
template: '<i class="fa fa-icon {{icon}}"></i>{{display}} <div title={{key}} class="pull-right {{mode_shortcut}}">{{shortcut}}</div>',

notebook/static/notebook/js/main.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,13 @@ var bind = function bind(obj) {
1919
};
2020
Function.prototype.bind = Function.prototype.bind || bind ;
2121

22+
requirejs.config({
23+
map: {
24+
"*": {
25+
"typeahead": "jquery-typeahead"
26+
}
27+
}
28+
})
2229

2330
requirejs([
2431
'jquery',

notebook/static/notebook/less/commandpalette.less

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
1-
ul.typeahead-list i{
2-
margin-left: -10px;
3-
width: 18px;
1+
div.typeahead__container {
2+
font: revert;
43
}
54

6-
[dir="rtl"] ul.typeahead-list i {
7-
margin-left: 0;
8-
margin-right: -10px;
5+
ul.typeahead__list i {
6+
width: 18px;
97
}
108

11-
ul.typeahead-list {
9+
ul.typeahead__list {
1210
max-height: 80vh;
1311
overflow:auto;
1412

@@ -19,11 +17,11 @@ ul.typeahead-list {
1917
}
2018
}
2119

22-
ul.typeahead-list & > li > a.pull-right {
20+
ul.typeahead__list & > li > a.pull-right {
2321
.pull-left();
2422
}
2523

26-
[dir="rtl"] .typeahead-list {
24+
[dir="rtl"] .typeahead__list {
2725
text-align : right;
2826
}
2927

tools/build-main.js

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,21 +25,18 @@ var rjs_config = {
2525
moment: 'components/moment/min/moment-with-locales',
2626
codemirror: 'components/codemirror',
2727
xterm: 'components/xterm.js/index',
28-
'xtermjs-fit': 'components/xterm.js-fit/index',
29-
typeahead: 'components/jquery-typeahead/dist/jquery.typeahead',
28+
"xtermjs-fit": 'components/xterm.js-fit/index',
29+
"jquery-typeahead": 'components/jquery-typeahead/dist/jquery.typeahead.min',
3030
contents: 'empty:',
3131
custom: 'empty:',
3232
},
3333
map: { // for backward compatibility
3434
"*": {
3535
"jqueryui": "jquery-ui",
36+
"typeahead": "jquery-typeahead"
3637
}
3738
},
3839
shim: {
39-
typeahead: {
40-
deps: ["jquery"],
41-
exports: "typeahead"
42-
},
4340
underscore: {
4441
exports: '_'
4542
},

0 commit comments

Comments
 (0)