Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export const renderEditor = <
GPlainMarks extends Array>,
GPlainNodes extends Array>,
GAttrMarks extends Array>,
GAttrNodes extends Array>,
GOthers extends Array>,
GReturn extends CreateTestEditorReturn,
GExtension extends GenericExtension,
GPlainMarkNames extends GetNames,
GAttrMarkNames extends GetNames,
GAttrNodeNames extends GetNames,
GPlainNodeNames extends GetNames | BaseExtensionNodeNames
>(
{
plainMarks = Cast([]),
plainNodes = Cast([]),
attrMarks = Cast([]),
attrNodes = Cast([]),
others = Cast([]),
}: Partial<
CreateTestEditorExtensions
> = Object.create(null),
props: Partial, 'manager'>> = Object.create(null),
): GReturn => {
const innerNodeExtensions = nodeExtensions.filter(({ name }) => !plainNodes.some(ext => ext.name === name));
const extensions = [
...innerNodeExtensions,
...others,
...plainMarks,
...plainNodes,
...attrMarks,
...attrNodes,
getAttrs: node => ({
href: Cast<element>(node).getAttribute('href'),
...this.getExtraAttrs(Cast<element>(node)),
}),
},</element></element>
getAttrs: node => ({
href: Cast<element>(node).getAttribute('href'),
...this.getExtraAttrs(Cast<element>(node)),
}),
},</element></element>
getAttrs: node => ({
href: Cast<element>(node).getAttribute('href'),
...this.getExtraAttrs(Cast<element>(node)),
}),
},</element></element>
import DefaultStyled, { CreateStyled } from '@emotion/styled';
import { Cast } from '@remirror/core';
export const styled = Cast>(DefaultStyled);
export type MarkdownEditorTheme = typeof markdownEditorTheme;
export type ButtonState = 'default' | 'active-default' | 'inverse' | 'active-inverse';
const buttonColors: Record = {
default: '#aaa',
'active-default': 'black',
inverse: '#aaa',
'active-inverse': 'white',
};
export const markdownEditorTheme = {
colors: {
primary: '#1DA1F2',
warn: '#FFAD1F',
error: '#E0245E',
return returnValue;
};
return updateContent();
};
const { schema } = view.state;
const nodesWithAttrs: NodeWithAttrs = Object.create(null);
attrNodes.filter(isNodeExtension).forEach(({ name }) => {
nodesWithAttrs[name as GAttrNodeNames] = (attrs: Attrs = Object.create(null)) =>
nodeFactory({ name, schema, attrs });
});
const nodesWithoutAttrs: NodeWithoutAttrs = Cast({
p: nodeFactory({ name: 'paragraph', schema }),
});
[...plainNodes, ...innerNodeExtensions].filter(isNodeExtension).forEach(({ name }) => {
nodesWithoutAttrs[name as GPlainNodeNames] = nodeFactory({ name, schema });
});
const marksWithAttrs: MarkWithAttrs = Object.create(null);
attrMarks.filter(isMarkExtension).forEach(({ name }) => {
marksWithAttrs[name as GAttrMarkNames] = (attrs: Attrs = Object.create(null)) =>
markFactory({ name, schema, attrs });
});
const marksWithoutAttrs: MarkWithoutAttrs = Object.create(null);
plainMarks.filter(isMarkExtension).forEach(({ name }) => {
marksWithoutAttrs[name as GPlainMarkNames] = markFactory({ name, schema });
});
getAttrs: node => ({
href: Cast<element>(node).getAttribute('href'),
...this.getExtraAttrs(Cast<element>(node)),
}),
},</element></element>
getAttrs: node => ({
order: Cast<element>(node).hasAttribute('start')
? +Cast<element>(node).getAttribute('start')!
: 1,
}),
},</element></element>