Merge pull request #4213 from Nachtalb/na/search-command
Add new "/search query" command to open the search window
This commit is contained in:
commit
fc6c916e7c
@ -183,6 +183,10 @@ export default {
|
|||||||
},
|
},
|
||||||
setInputSize() {
|
setInputSize() {
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
|
if (!this.$refs.input) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const style = window.getComputedStyle(this.$refs.input);
|
const style = window.getComputedStyle(this.$refs.input);
|
||||||
const lineHeight = parseFloat(style.lineHeight, 10) || 1;
|
const lineHeight = parseFloat(style.lineHeight, 10) || 1;
|
||||||
|
|
||||||
|
@ -104,6 +104,10 @@ export default {
|
|||||||
mounted() {
|
mounted() {
|
||||||
this.searchInput = this.$route.query.q;
|
this.searchInput = this.$route.query.q;
|
||||||
this.searchOpened = this.onSearchPage;
|
this.searchOpened = this.onSearchPage;
|
||||||
|
|
||||||
|
if (!this.searchInput) {
|
||||||
|
this.$refs.searchInputField.focus();
|
||||||
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
closeSearch() {
|
closeSearch() {
|
||||||
|
@ -673,6 +673,15 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="help-item">
|
||||||
|
<div class="subject">
|
||||||
|
<code>/search query</code>
|
||||||
|
</div>
|
||||||
|
<div class="description">
|
||||||
|
<p>Search for messages in the current channel / user</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="help-item">
|
<div class="help-item">
|
||||||
<div class="subject">
|
<div class="subject">
|
||||||
<code>/topic [newtopic]</code>
|
<code>/topic [newtopic]</code>
|
||||||
|
20
client/js/commands/search.js
Normal file
20
client/js/commands/search.js
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
"use strict";
|
||||||
|
|
||||||
|
import store from "../store";
|
||||||
|
import {router} from "../router";
|
||||||
|
|
||||||
|
function input(args) {
|
||||||
|
router.push({
|
||||||
|
name: "SearchResults",
|
||||||
|
params: {
|
||||||
|
id: store.state.activeChannel.channel.id,
|
||||||
|
},
|
||||||
|
query: {
|
||||||
|
q: args.join(" "),
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default {input};
|
@ -1,4 +1,4 @@
|
|||||||
const clientSideCommands = ["/collapse", "/expand"];
|
const clientSideCommands = ["/collapse", "/expand", "/search"];
|
||||||
|
|
||||||
const passThroughCommands = [
|
const passThroughCommands = [
|
||||||
"/as",
|
"/as",
|
||||||
|
Loading…
Reference in New Issue
Block a user