[PR #14098] [CLOSED] feat: Bypass file creation with CTRL + SHIFT + V #62240

Closed
opened 2026-05-06 06:15:31 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/open-webui/open-webui/pull/14098
Author: @Classic298
Created: 5/20/2025
Status: ❌ Closed

Base: dev ← Head: CTRLSHIFTVfeature


📝 Commits (2)

📊 Changes

3 files changed (+85 additions, -31 deletions)

View changed files

📝 src/lib/components/chat/MessageInput.svelte (+56 -21)
📝 src/lib/components/chat/ShortcutsModal.svelte (+21 -0)
📝 src/lib/components/common/RichTextInput.svelte (+8 -10)

📄 Description

Pull Request Checklist

Before submitting, make sure you've checked the following:

  • Target branch: Please verify that the pull request targets the dev branch.
  • Description: Provide a concise description of the changes made in this pull request.
  • Changelog: Ensure a changelog entry following the format of Keep a Changelog is added at the bottom of the PR description.
  • Documentation: Have you updated relevant documentation Open WebUI Docs, or other documentation sources? (Assuming no for this change, but double-check if any internal docs on shortcuts/paste handling exist).
  • Dependencies: Are there any new dependencies? Have you updated the dependency versions in the documentation?
  • Testing: Have you written and run sufficient tests to validate the changes? (Manual testing confirmed functionality).
  • Code review: Have you performed a self-review of your code, addressing any coding standard issues and ensuring adherence to the project's coding standards?
  • Prefix: To clearly categorize this pull request, prefix the pull request title using one of the following:
    • feat: Introduces a new feature or enhancement to the codebase

Related issue/discussion: https://github.com/open-webui/open-webui/issues/13577


Changelog Entry

Description

  • This pull request enhances the "paste large text as file" feature. Users can now bypass the file creation and paste text directly using CTRL+SHIFT+V (or CMD+SHIFT+V), if the "paste large text as file" setting is enabled. This provides more flexibility when pasting large content. The implementation involves tracking modifier key states globally within MessageInput.svelte to reliably detect the bypass shortcut, as direct event properties from the rich text editor's paste event were found to be inconsistent. An insertPlainText function was added to RichTextInput.svelte to allow MessageInput.svelte to programmatically insert text when the bypass is triggered. Additionally, a new entry for this shortcut has been added to the Keyboard Shortcuts modal. A minor refactor in RichTextInput.svelte combined image paste detection logic.
  • Related issue / Feature request: https://github.com/open-webui/open-webui/issues/13577

Added

  • Functionality to bypass "paste large text as file" by using CTRL+SHIFT+V (or CMD+SHIFT+V) to paste as plain text.
  • Global modifier key state tracking (isShiftPressed, isCtrlMetaPressed) in MessageInput.svelte for robust shortcut detection.
  • Exported insertPlainText method in RichTextInput.svelte to enable programmatic text insertion by its parent.
  • Keyboard shortcut entry in ShortcutsModal.svelte for "Paste as plaintext" (Ctrl/⌘ + Shift + V).

Changed

  • Modified on:paste handler in MessageInput.svelte for RichTextInput to use globally tracked modifier key states for bypass detection and to call RichTextInput.insertPlainText() when bypassed.
  • Simplified paste handler in RichTextInput.svelte to always dispatch to MessageInput.svelte for long text when largeTextAsFile is enabled, delegating bypass logic to the parent.
  • Refactored image paste detection in RichTextInput.svelte to a single conditional block for hasImageFile || hasImageItem.
    • I did not want to create a new PR just for this small refac, please forgive me.

Additional Information

  • The primary challenge was the unreliable reporting of modifier key states in the paste event object emitted by the RichTextInput component (Tiptap/ProseMirror). The solution involves MessageInput.svelte listening to global keydown and keyup events to maintain an accurate state of modifier keys, which is then consulted when a paste event is received from RichTextInput.
  • The translation key for the new shortcut in ShortcutsModal.svelte is 'Paste as plaintext'. This will need to be added to localization files.

Contributor License Agreement

By submitting this pull request, I confirm that I have read and fully agree to the Contributor License Agreement (CLA), and I am providing my contributions under its terms.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/open-webui/open-webui/pull/14098 **Author:** [@Classic298](https://github.com/Classic298) **Created:** 5/20/2025 **Status:** ❌ Closed **Base:** `dev` ← **Head:** `CTRLSHIFTVfeature` --- ### 📝 Commits (2) - [`cf75ffd`](https://github.com/open-webui/open-webui/commit/cf75ffdce6fd86e0340e5fe3691203124885c369) Ctrlshiftv (#2) - [`3a27df5`](https://github.com/open-webui/open-webui/commit/3a27df55152aaa74dfa146deea11c0f5ec68a404) Ctrlshiftv (#3) ### 📊 Changes **3 files changed** (+85 additions, -31 deletions) <details> <summary>View changed files</summary> 📝 `src/lib/components/chat/MessageInput.svelte` (+56 -21) 📝 `src/lib/components/chat/ShortcutsModal.svelte` (+21 -0) 📝 `src/lib/components/common/RichTextInput.svelte` (+8 -10) </details> ### 📄 Description # Pull Request Checklist **Before submitting, make sure you've checked the following:** - [X] **Target branch:** Please verify that the pull request targets the `dev` branch. - [X] **Description:** Provide a concise description of the changes made in this pull request. - [X] **Changelog:** Ensure a changelog entry following the format of [Keep a Changelog](https://keepachangelog.com/) is added at the bottom of the PR description. - [ ] **Documentation:** Have you updated relevant documentation [Open WebUI Docs](https://github.com/open-webui/docs), or other documentation sources? *(Assuming no for this change, but double-check if any internal docs on shortcuts/paste handling exist).* - [ ] **Dependencies:** Are there any new dependencies? Have you updated the dependency versions in the documentation? - [X] **Testing:** Have you written and run sufficient tests to validate the changes? *(Manual testing confirmed functionality).* - [X] **Code review:** Have you performed a self-review of your code, addressing any coding standard issues and ensuring adherence to the project's coding standards? - [X] **Prefix:** To clearly categorize this pull request, prefix the pull request title using one of the following: - **feat**: Introduces a new feature or enhancement to the codebase Related issue/discussion: https://github.com/open-webui/open-webui/issues/13577 --- # Changelog Entry ### Description - This pull request enhances the "paste large text as file" feature. Users can now bypass the file creation and paste text directly using `CTRL+SHIFT+V` (or `CMD+SHIFT+V`), if the "paste large text as file" setting is enabled. This provides more flexibility when pasting large content. The implementation involves tracking modifier key states globally within `MessageInput.svelte` to reliably detect the bypass shortcut, as direct event properties from the rich text editor's paste event were found to be inconsistent. An `insertPlainText` function was added to `RichTextInput.svelte` to allow `MessageInput.svelte` to programmatically insert text when the bypass is triggered. Additionally, a new entry for this shortcut has been added to the Keyboard Shortcuts modal. A minor refactor in `RichTextInput.svelte` combined image paste detection logic. - Related issue / Feature request: https://github.com/open-webui/open-webui/issues/13577 ### Added - Functionality to bypass "paste large text as file" by using `CTRL+SHIFT+V` (or `CMD+SHIFT+V`) to paste as plain text. - Global modifier key state tracking (`isShiftPressed`, `isCtrlMetaPressed`) in `MessageInput.svelte` for robust shortcut detection. - Exported `insertPlainText` method in `RichTextInput.svelte` to enable programmatic text insertion by its parent. - Keyboard shortcut entry in `ShortcutsModal.svelte` for "Paste as plaintext" (`Ctrl/⌘ + Shift + V`). ### Changed - Modified `on:paste` handler in `MessageInput.svelte` for `RichTextInput` to use globally tracked modifier key states for bypass detection and to call `RichTextInput.insertPlainText()` when bypassed. - Simplified `paste` handler in `RichTextInput.svelte` to always dispatch to `MessageInput.svelte` for long text when `largeTextAsFile` is enabled, delegating bypass logic to the parent. - Refactored image paste detection in `RichTextInput.svelte` to a single conditional block for `hasImageFile || hasImageItem`. - **I did not want to create a new PR just for this small refac, please forgive me.** --- ### Additional Information - The primary challenge was the unreliable reporting of modifier key states in the `paste` event object emitted by the `RichTextInput` component (Tiptap/ProseMirror). The solution involves `MessageInput.svelte` listening to global `keydown` and `keyup` events to maintain an accurate state of modifier keys, which is then consulted when a paste event is received from `RichTextInput`. - The translation key for the new shortcut in `ShortcutsModal.svelte` is `'Paste as plaintext'`. This will need to be added to localization files. --- ### Contributor License Agreement By submitting this pull request, I confirm that I have read and fully agree to the [Contributor License Agreement (CLA)](/CONTRIBUTOR_LICENSE_AGREEMENT), and I am providing my contributions under its terms. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-05-06 06:15:31 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#62240