Add mindmeister support

This commit is contained in:
Tom Moor
2019-02-18 11:32:21 -08:00
parent 15bc0e7629
commit fbd311d352
3 changed files with 71 additions and 0 deletions

29
app/embeds/Mindmeister.js Normal file
View File

@ -0,0 +1,29 @@
// @flow
import * as React from 'react';
import Frame from './components/Frame';
const URL_REGEX = new RegExp(
'^https://([w.-]+.)?mindmeister.com(/maps/public_map_shell)?/(\\d+)(/.*)?$'
);
type Props = {
url: string,
matches: string[],
};
export default class Mindmeister extends React.Component<Props> {
static ENABLED = [URL_REGEX];
render() {
console.log(this.props.matches);
const chartId = this.props.matches[3];
return (
<Frame
src={`https://www.mindmeister.com/maps/public_map_shell/${chartId}`}
title="Mindmeister Embed"
border
/>
);
}
}

View File

@ -0,0 +1,40 @@
/* eslint-disable flowtype/require-valid-file-annotation */
import embeds from '.';
const { Mindmeister } = embeds;
describe('Mindmeister', () => {
const match = Mindmeister.ENABLED[0];
test('to be enabled on embed link', () => {
expect(
'https://www.mindmeister.com/maps/public_map_shell/326377934/paper-digital-or-online-mind-mapping'.match(
match
)
).toBeTruthy();
});
test('to be enabled on public link', () => {
expect(
'https://www.mindmeister.com/326377934/paper-digital-or-online-mind-mapping'.match(
match
)
).toBeTruthy();
});
test('to be enabled without www', () => {
expect(
'https://mindmeister.com/326377934/paper-digital-or-online-mind-mapping'.match(
match
)
).toBeTruthy();
});
test('to be enabled without slug', () => {
expect('https://mindmeister.com/326377934'.match(match)).toBeTruthy();
});
test('to not be enabled elsewhere', () => {
expect('https://mindmeister.com'.match(match)).toBe(null);
expect('https://www.mindmeister.com/pricing'.match(match)).toBe(null);
});
});

View File

@ -9,6 +9,7 @@ import InVision from './InVision';
import Loom from './Loom';
import Lucidchart from './Lucidchart';
import Marvel from './Marvel';
import Mindmeister from './Mindmeister';
import ModeAnalytics from './ModeAnalytics';
import Numeracy from './Numeracy';
import Prezi from './Prezi';
@ -30,6 +31,7 @@ export default {
Loom,
Lucidchart,
Marvel,
Mindmeister,
ModeAnalytics,
Numeracy,
Prezi,