Add mindmeister support
This commit is contained in:
29
app/embeds/Mindmeister.js
Normal file
29
app/embeds/Mindmeister.js
Normal 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
|
||||
/>
|
||||
);
|
||||
}
|
||||
}
|
40
app/embeds/Mindmeister.test.js
Normal file
40
app/embeds/Mindmeister.test.js
Normal 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);
|
||||
});
|
||||
});
|
@ -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,
|
||||
|
Reference in New Issue
Block a user