You've already forked matrix-react-sdk
mirror of
https://github.com/matrix-org/matrix-react-sdk.git
synced 2025-11-08 21:42:24 +03:00
Minimal house cleaning
This commit is contained in:
@@ -21,6 +21,15 @@ const STYLES = {
|
|||||||
UNDERLINE: 'u'
|
UNDERLINE: 'u'
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const MARKDOWN_REGEX = {
|
||||||
|
LINK: /(?:\[([^\]]+)\]\(([^\)]+)\))|\<(\w+:\/\/[^\>]+)\>/g,
|
||||||
|
ITALIC: /([\*_])([\w\s]+?)\1/g,
|
||||||
|
BOLD: /([\*_])\1([\w\s]+?)\1\1/g
|
||||||
|
};
|
||||||
|
|
||||||
|
const USERNAME_REGEX = /@\S+:\S+/g;
|
||||||
|
const ROOM_REGEX = /#\S+:\S+/g;
|
||||||
|
|
||||||
export function contentStateToHTML(contentState: ContentState): string {
|
export function contentStateToHTML(contentState: ContentState): string {
|
||||||
return contentState.getBlockMap().map((block) => {
|
return contentState.getBlockMap().map((block) => {
|
||||||
let elem = BLOCK_RENDER_MAP.get(block.getType()).element;
|
let elem = BLOCK_RENDER_MAP.get(block.getType()).element;
|
||||||
@@ -46,9 +55,6 @@ export function HTMLtoContentState(html: string): ContentState {
|
|||||||
return ContentState.createFromBlockArray(convertFromHTML(html));
|
return ContentState.createFromBlockArray(convertFromHTML(html));
|
||||||
}
|
}
|
||||||
|
|
||||||
const USERNAME_REGEX = /@\S+:\S+/g;
|
|
||||||
const ROOM_REGEX = /#\S+:\S+/g;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a composite decorator which has access to provided scope.
|
* Returns a composite decorator which has access to provided scope.
|
||||||
*/
|
*/
|
||||||
@@ -108,12 +114,6 @@ export function getScopedMDDecorators(scope: any): CompositeDecorator {
|
|||||||
return markdownDecorators;
|
return markdownDecorators;
|
||||||
}
|
}
|
||||||
|
|
||||||
const MARKDOWN_REGEX = {
|
|
||||||
LINK: /(?:\[([^\]]+)\]\(([^\)]+)\))|\<(\w+:\/\/[^\>]+)\>/g,
|
|
||||||
ITALIC: /([\*_])([\w\s]+?)\1/g,
|
|
||||||
BOLD: /([\*_])\1([\w\s]+?)\1\1/g
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Utility function that looks for regex matches within a ContentBlock and invokes {callback} with (start, end)
|
* Utility function that looks for regex matches within a ContentBlock and invokes {callback} with (start, end)
|
||||||
* From https://facebook.github.io/draft-js/docs/advanced-topics-decorators.html
|
* From https://facebook.github.io/draft-js/docs/advanced-topics-decorators.html
|
||||||
|
|||||||
Reference in New Issue
Block a user