summaryrefslogtreecommitdiff
path: root/src/mfm/parse/elements
diff options
context:
space:
mode:
authorsyuilo <syuilotan@yahoo.co.jp>2018-09-21 08:33:24 +0900
committersyuilo <syuilotan@yahoo.co.jp>2018-09-21 08:33:24 +0900
commita5f817d8962ff16b68109f0b55267fa021c6d3e8 (patch)
tree631d84752c0dc4a79619a499bb29037e31f5898a /src/mfm/parse/elements
parentfix(package): update websocket to version 1.0.28 (#2746) (diff)
downloadmisskey-a5f817d8962ff16b68109f0b55267fa021c6d3e8.tar.gz
misskey-a5f817d8962ff16b68109f0b55267fa021c6d3e8.tar.bz2
misskey-a5f817d8962ff16b68109f0b55267fa021c6d3e8.zip
Fix #2744
Diffstat (limited to 'src/mfm/parse/elements')
-rw-r--r--src/mfm/parse/elements/quote.ts17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/mfm/parse/elements/quote.ts b/src/mfm/parse/elements/quote.ts
index aa932cbf8d..994ce98ca8 100644
--- a/src/mfm/parse/elements/quote.ts
+++ b/src/mfm/parse/elements/quote.ts
@@ -8,13 +8,20 @@ export type TextElementQuote = {
quote: string
};
-export default function(text: string) {
- const match = text.match(/^"([\s\S]+?)\n"/) || text.match(/^>([\s\S]+?)\n\n/) || text.match(/^\n>([\s\S]+?)\n\n/) || text.match(/^>([\s\S]+?)$/);
+export default function(text: string, index: number) {
+ const match = text.match(/^"([\s\S]+?)\n"/) || text.match(/^\n>([\s\S]+?)(\n\n|$)/) ||
+ (index == 0 ? text.match(/^>([\s\S]+?)(\n\n|$)/) : null);
+
if (!match) return null;
- const quote = match[0];
+
+ const quote = match[1]
+ .split('\n')
+ .map(line => line.replace(/^>+/g, '').trim())
+ .join('\n');
+
return {
type: 'quote',
- content: quote,
- quote: match[1].trim(),
+ content: match[0],
+ quote: quote,
} as TextElementQuote;
}