Frontend: Removed the search component entirely
This commit is contained in:
parent
0bd60f4e41
commit
7c871cd886
|
@ -1,59 +0,0 @@
|
|||
<template>
|
||||
<div class="mk-google" @click.stop>
|
||||
<input v-model="query" type="search" :placeholder="q" />
|
||||
<button @click="search">
|
||||
<i class="ph-magnifying-glass ph-bold ph-lg"></i>
|
||||
{{ i18n.ts.searchByGoogle }}
|
||||
</button>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref } from "vue";
|
||||
import { i18n } from "@/i18n";
|
||||
|
||||
const props = defineProps<{
|
||||
q: string;
|
||||
}>();
|
||||
|
||||
const query = ref(props.q);
|
||||
|
||||
const search = () => {
|
||||
window.open(
|
||||
`https://search.annoyingorange.xyz/search?q=${query.value}`,
|
||||
"_blank"
|
||||
);
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.mk-google {
|
||||
display: flex;
|
||||
margin: 8px 0;
|
||||
|
||||
> input {
|
||||
flex-shrink: 1;
|
||||
padding: 10px;
|
||||
width: 100%;
|
||||
height: 40px;
|
||||
font-size: 16px;
|
||||
border: solid 1px var(--divider);
|
||||
border-radius: 4px 0 0 4px;
|
||||
-webkit-appearance: none;
|
||||
-webkit-border-radius: 4px 0 0 4px;
|
||||
}
|
||||
|
||||
> button {
|
||||
flex-shrink: 0;
|
||||
margin: 0;
|
||||
padding: 0 16px;
|
||||
border: solid 1px var(--divider);
|
||||
border-left: none;
|
||||
border-radius: 0 4px 4px 0;
|
||||
|
||||
&:active {
|
||||
box-shadow: 0 2px 4px rgba(#000, 0.15) inset;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
|
@ -8,7 +8,6 @@ import MkEmoji from "@/components/global/MkEmoji.vue";
|
|||
import { concat } from "@/scripts/array";
|
||||
import MkFormula from "@/components/MkFormula.vue";
|
||||
import MkCode from "@/components/MkCode.vue";
|
||||
import MkGoogle from "@/components/MkGoogle.vue";
|
||||
import MkSparkle from "@/components/MkSparkle.vue";
|
||||
import MkA from "@/components/global/MkA.vue";
|
||||
import { host } from "@/config";
|
||||
|
@ -494,25 +493,16 @@ export default defineComponent({
|
|||
}
|
||||
|
||||
case "search": {
|
||||
// Disable "search" keyword
|
||||
// (see the issue #9816 on Codeberg)
|
||||
if (token.props.content.slice(-6).toLowerCase() === "search") {
|
||||
|
||||
const sentinel = "#";
|
||||
let ast2 = (isPlain ? mfm.parseSimple : mfm.parse)(
|
||||
token.props.content.slice(0, -6) + sentinel,
|
||||
token.props.content + sentinel,
|
||||
);
|
||||
if (
|
||||
ast2[ast2.length - 1].type === "text" &&
|
||||
ast2[ast2.length - 1].props.text.endsWith(sentinel)
|
||||
) {
|
||||
ast2[ast2.length - 1].props.text = ast2[
|
||||
ast2.length - 1
|
||||
].props.text.slice(0, -1);
|
||||
} else {
|
||||
// I don't think this scope is reachable
|
||||
console.warn(
|
||||
"Something went wrong while parsing MFM. Please send a bug report, if possible.",
|
||||
);
|
||||
ast2[ast2.length - 1].props.text = ast2[ast2.length - 1].props.text.slice(0, -1);
|
||||
}
|
||||
|
||||
let prefix = "\n";
|
||||
|
@ -531,16 +521,7 @@ export default defineComponent({
|
|||
|
||||
return [
|
||||
prefix,
|
||||
...genEl(ast2),
|
||||
`${token.props.content.slice(-6)}\n`,
|
||||
];
|
||||
}
|
||||
|
||||
return [
|
||||
h(MkGoogle, {
|
||||
key: Math.random(),
|
||||
q: token.props.query,
|
||||
}),
|
||||
...genEl(ast2)
|
||||
];
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue