2018-04-21 11:59:16 +02:00
|
|
|
/**
|
|
|
|
* Search
|
|
|
|
*/
|
|
|
|
|
2018-06-17 12:55:39 +02:00
|
|
|
export type TextElementSearch = {
|
|
|
|
type: "search"
|
|
|
|
content: string
|
|
|
|
query: string
|
|
|
|
};
|
|
|
|
|
|
|
|
export default function(text: string) {
|
2018-04-21 11:59:16 +02:00
|
|
|
const match = text.match(/^(.+?) 検索(\n|$)/);
|
|
|
|
if (!match) return null;
|
|
|
|
return {
|
|
|
|
type: 'search',
|
|
|
|
content: match[0],
|
|
|
|
query: match[1]
|
|
|
|
};
|
2018-06-17 12:55:39 +02:00
|
|
|
}
|