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