Skip to content

fix(editor): allow Enter newline while recording#365

Merged
deepin-bot[bot] merged 1 commit into
linuxdeepin:develop/snipefrom
dengzhongyuan365-dev:bug-fix-6-17
Jun 15, 2026
Merged

fix(editor): allow Enter newline while recording#365
deepin-bot[bot] merged 1 commit into
linuxdeepin:develop/snipefrom
dengzhongyuan365-dev:bug-fix-6-17

Conversation

@dengzhongyuan365-dev

@dengzhongyuan365-dev dengzhongyuan365-dev commented Jun 15, 2026

Copy link
Copy Markdown
Member

Limit voice playback shortcut blocking to selected voice blocks.

将语音播放快捷键拦截限制在选中语音块的场景。

Ignore local npm cache and code graph directories.

忽略本地 npm 缓存和代码图谱目录。

Log: 修复录音时编辑区回车无法换行
PMS: BUG-366061
Influence: 录音过程中,编辑区输入文字按回车可正常换行;选中语音块时仍禁止触发播放,避免录音被播放行为干扰。

Summary by Sourcery

Allow editor Enter key to insert newlines while recording and keep blocking voice playback shortcuts only when a voice block is selected.

Bug Fixes:

  • Fix inability to insert newlines with Enter in the editor while audio recording is active.

Enhancements:

  • Limit keyboard-based voice playback blocking to cases where a voice block is actively selected.

Build:

  • Ignore local npm cache and code graph directories in version control.

Limit voice playback shortcut blocking to selected voice blocks.

将语音播放快捷键拦截限制在选中语音块的场景。

Ignore local npm cache and code graph directories.

忽略本地 npm 缓存和代码图谱目录。

Log: 修复录音时编辑区回车无法换行
PMS: BUG-366061
Influence: 录音过程中,编辑区输入文字按回车可正常换行;选中语音块时仍禁止触发播放,避免录音被播放行为干扰。
@sourcery-ai

sourcery-ai Bot commented Jun 15, 2026

Copy link
Copy Markdown
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Restricts keyboard-triggered voice play/pause to only when a voice block is actively selected so that Enter still inserts newlines during recording, while updating .gitignore to ignore local npm cache and code graph directories.

Sequence diagram for triggerPlayPauseVoice keyboard handling while recording

sequenceDiagram
    participant User
    participant Editor as EditorKeyHandler
    participant Voice as triggerPlayPauseVoice

    User->>Editor: keydown Enter/Space
    Editor->>Voice: triggerPlayPauseVoice(event)
    Voice->>Voice: currentLi = $('.li.active')
    alt active voice block selected
        Voice->>Voice: info = isRangeVoice()
        alt info.flag == 1
            Voice->>event: preventDefault()
            alt global_isRecording == true
                Voice-->>Editor: return false (voice not played)
            else global_isRecording == false
                Voice->>Voice: curPlayback = currentLi.first().find('.voicePlayback')
                Voice->>Voice: handlePlayPauseVoice(curPlayback)
            end
        else no voice range
            Voice-->>Editor: return (no special handling)
        end
    else no active voice block
        Voice-->>Editor: return (Enter inserts newline normally)
    end
Loading

File-Level Changes

Change Details Files
Adjust keyboard shortcut handling so Enter/Space only control voice playback when a voice range is selected, allowing normal newline behavior during recording.
  • Remove global recording-time block at the start of the voice play/pause handler so it no longer intercepts all Enter/Space presses during recording.
  • Check for an active list item and a valid voice selection before preventing the default keyboard behavior.
  • Within the voice-selection branch, prevent the default key behavior, then, if recording is in progress, log a message and abort playback instead of triggering it.
src/web/index.js
Update VCS ignore rules for local development artifacts.
  • Add patterns to ignore local npm cache directories.
  • Add patterns to ignore generated code graph directories.
.gitignore

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@dengzhongyuan365-dev

Copy link
Copy Markdown
Member Author

/forcemerge

@deepin-bot deepin-bot Bot merged commit 80e054c into linuxdeepin:develop/snipe Jun 15, 2026
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants