+ {t('sidebar.importWorkSelectDesc') + .replace('{count}', chapters.length) + .replace('{words}', totalWords.toLocaleString())} +
+ +),段内换行用
,去掉多余空行
+ */
+function textToHtml(lines) {
+ const normalized = lines.join('\n').trim();
+ if (!normalized) return '';
+
+ // 按空行(连续换行)分段
+ const blocks = normalized.split(/\n\n+/);
+ return blocks
+ .map(block => {
+ const blockLines = block.split('\n').map(l => l.trimEnd()).filter(l => l);
+ if (blockLines.length === 0) return '';
+ return `
${blockLines.join('
')}