Conversation
- 修正 Romanizer (Romaine) 複製功能會拿忒斷行个問題 - 在複製前將 <br> 標籤轉做 \n - 更新正規表示式以淨清理水平空白,保留換行符號 Co-authored-by: Aiuanyu <93833368+Aiuanyu@users.noreply.github.com>
Deploying hakspring with
|
| Latest commit: |
e9a721c
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://fe0edb33.hakspring.pages.dev |
| Branch Preview URL: | https://jules-5232764111664409179-7f.hakspring.pages.dev |
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
|
Code review for PR 224 - see full review in next comment |
|
Overall: Clean, well-targeted fix. Approach is correct, changes are minimal. What is done well: (1) Correct approach - Cloning the DOM and replacing br elements with newlines before reading textContent is the right way to preserve line breaks. (2) Regex fix is accurate - the pattern /[^\S\r\n]+/g correctly collapses only horizontal whitespace while leaving newlines intact, better than the previous /\s+/g which erased newlines. (3) Minimal footprint - only touches what is needed. Edge cases to consider: (1) Multiple consecutive br tags will produce multiple newlines (blank lines). If the romanizer can emit adjacent br elements, consider capping: textToCopy.replace(/\n{3,}/g, '\n\n'). Minor polish, not a blocker. (2) .trim() strips leading/trailing newlines - generally correct for clipboard content, just confirming it is intentional. (3) The \r in the regex is a safe no-op since textContent returns \n not \r\n in the DOM. Verdict: Correctly addresses issue 223. No security, performance, or correctness concerns. Recommend approval. |
This change modifies the
copyRomanizerResultfunction injs/romanizer.jsto ensure that line breaks are preserved when the user copies the conversion results. It replaces<br>elements with newlines in the cloned DOM node and updates the whitespace cleaning regex to only collapse horizontal whitespace, preserving existing\ncharacters.Fixes #223
PR created automatically by Jules for task 5232764111664409179 started by @Aiuanyu