2018-08-05 12:33:51 +09:00
|
|
|
/**
|
|
|
|
|
* Motion
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
export type TextElementMotion = {
|
|
|
|
|
type: 'motion'
|
|
|
|
|
content: string
|
|
|
|
|
motion: string
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export default function(text: string) {
|
2018-08-05 23:56:08 +09:00
|
|
|
const match = text.match(/^\(\(\((.+?)\)\)\)/) || text.match(/^<motion>(.+?)<\/motion>/);
|
2018-08-05 12:33:51 +09:00
|
|
|
if (!match) return null;
|
|
|
|
|
const motion = match[0];
|
|
|
|
|
return {
|
|
|
|
|
type: 'motion',
|
|
|
|
|
content: motion,
|
|
|
|
|
motion: match[1]
|
|
|
|
|
} as TextElementMotion;
|
|
|
|
|
}
|