fix(editor): markdown code preprocessor should handle link correctly (#11671)

Close [BS-3117](https://linear.app/affine-design/issue/BS-3117/代码粘贴后出现多余的-和-符号)
This commit is contained in:
donteatfriedrice
2025-04-14 08:28:42 +00:00
parent efecce9bf2
commit 7aa87de5f7
3 changed files with 77 additions and 8 deletions

View File

@@ -375,4 +375,26 @@ test.describe('paste to code block', () => {
// Verify the pasted code maintains indentation
await verifyCodeBlockContent(page, 0, textWithHtmlTags);
});
test('should not wrap line in brackets when pasting code', async ({
page,
}) => {
await pressEnter(page);
await addCodeBlock(page);
const plainTextCode = [
' model: anthropic("claude-3-7-sonnet-20250219"),',
' prompt: How many people will live in the world in 2040?',
' providerOptions: {',
' anthropic: {',
' thinking: { type: enabled, budgetTokens: 12000 },',
' } satisfies AnthropicProviderOptions,',
' },',
].join('\n');
await pasteContent(page, { 'text/plain': plainTextCode });
await page.waitForTimeout(100);
// Verify the pasted code maintains indentation
await verifyCodeBlockContent(page, 0, plainTextCode);
});
});