Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
decker
decker
Commits
cf329583
Commit
cf329583
authored
May 18, 2021
by
Mario Botsch
Browse files
polish search plugin
parent
101f79e2
Changes
1
Hide whitespace changes
Inline
Side-by-side
resource/support/plugins/search/search.js
View file @
cf329583
...
@@ -170,12 +170,17 @@ function Hilitor(id, tag)
...
@@ -170,12 +170,17 @@ function Hilitor(id, tag)
searchElement
.
id
=
"
searchinputdiv
"
;
searchElement
.
id
=
"
searchinputdiv
"
;
searchElement
.
classList
.
add
(
'
searchdiv
'
);
searchElement
.
classList
.
add
(
'
searchdiv
'
);
searchElement
.
style
.
position
=
'
absolute
'
;
searchElement
.
style
.
position
=
'
absolute
'
;
searchElement
.
style
.
top
=
'
10px
'
;
searchElement
.
style
.
right
=
'
10px
'
;
// MARIO: adjust position, size, color
searchElement
.
style
.
top
=
"
calc(var(--whiteboard-icon-size) * 0.25)
"
;
searchElement
.
style
.
left
=
"
calc(var(--whiteboard-icon-size) * 2.25)
"
;
searchElement
.
style
.
padding
=
"
calc(var(--whiteboard-icon-size) * 0.5)
"
;
searchElement
.
style
.
fontSize
=
"
var(--whiteboard-icon-size)
"
;
searchElement
.
style
.
color
=
"
var(--whiteboard-active-color)
"
;
searchElement
.
style
.
zIndex
=
10
;
searchElement
.
style
.
zIndex
=
10
;
// MARIO: adjust border color and search icon (requires font-awesome)
// MARIO: adjust border color and search icon (requires font-awesome)
searchElement
.
innerHTML
=
'
<span
><input type="search" id="searchinput" class
="search
input
" style="
vertical-align: top; border: 2px solid #2a9ddf;"/><i class="fas fa-search searchicon" id
="search
button
" style="
vertical-align: top; margin-top: -1px; color: #2a9ddf; font-size: 16px; padding: 4px"></i
></span>
'
;
searchElement
.
innerHTML
=
'
<span
style="display:flex; align-items:center;"><i class="fas fa-search searchicon" id
="search
button
" style="
padding-right: 10px;"></i><input type="search" id="searchinput" class
="search
input
" style="
border: 3px solid var(--whiteboard-active-color); border-radius:4px;"/
></span>
'
;
dom
.
wrapper
.
appendChild
(
searchElement
);
dom
.
wrapper
.
appendChild
(
searchElement
);
}
}
...
@@ -205,13 +210,20 @@ function Hilitor(id, tag)
...
@@ -205,13 +210,20 @@ function Hilitor(id, tag)
},
false
);
},
false
);
document
.
addEventListener
(
'
keydown
'
,
function
(
event
)
{
document
.
addEventListener
(
'
keydown
'
,
function
(
event
)
{
if
(
event
.
key
==
"
F
"
&&
(
event
.
ctrlKey
||
event
.
metaKey
)
)
{
//Control+Shift+f
// MARIO: use standard search shortcut
// if( event.key == "F" && (event.ctrlKey || event.metaKey) ) { //Control+Shift+f
if
(
event
.
key
==
"
f
"
&&
(
event
.
ctrlKey
||
event
.
metaKey
)
)
{
//Control+Shift+f
event
.
preventDefault
();
event
.
preventDefault
();
toggleSearch
();
toggleSearch
();
}
}
},
false
);
},
false
);
if
(
window
.
Reveal
)
Reveal
.
registerKeyboardShortcut
(
'
CTRL + Shift + F
'
,
'
Search
'
);
// MARIO: use standard search shortcut
if
(
window
.
Reveal
)
Reveal
.
registerKeyboardShortcut
(
'
CTRL/CMD + F
'
,
'
Search
'
);
// if( window.Reveal ) Reveal.registerKeyboardShortcut( 'CTRL + Shift + F', 'Search' );
closeSearch
();
closeSearch
();
// MARIO: also export toggle
// MARIO: also export toggle (will be used in menu plugin)
return
{
open
:
openSearch
,
toggle
:
toggleSearch
};
return
{
open
:
openSearch
,
toggle
:
toggleSearch
};
})();
})();
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment