T44d Web · Stories stand alone: nested ones surface, hidden ones drop their demos, early themes land, pastes arrive
This commit is contained in:
1 parent
edab58e91a
commit
2463bb0ac9
22 files changed
+352
-172
No files matched your search
@@ -82,7 +82,6 @@ pub(crate) fn bind_keys(cx: &mut App) {
|
||||
KeyBinding::new("secondary-a", SelectAll, Some(CONTEXT)),
|
||||
KeyBinding::new("secondary-c", Copy, Some(CONTEXT)),
|
||||
KeyBinding::new("secondary-x", Cut, Some(CONTEXT)),
|
||||
KeyBinding::new("secondary-v", Paste, Some(CONTEXT)),
|
||||
KeyBinding::new("secondary-z", Undo, Some(CONTEXT)),
|
||||
KeyBinding::new("secondary-shift-z", Redo, Some(CONTEXT)),
|
||||
KeyBinding::new("enter", Enter, Some(CONTEXT)),
|
||||
@@ -90,6 +89,10 @@ pub(crate) fn bind_keys(cx: &mut App) {
|
||||
KeyBinding::new("secondary-enter", Submit, Some(CONTEXT)),
|
||||
KeyBinding::new("secondary-enter", Submit, Some(FORM_CONTEXT)),
|
||||
];
|
||||
// The browser's paste event carries the clipboard to the input handler.
|
||||
if !cfg!(target_family = "wasm") {
|
||||
bindings.push(KeyBinding::new("secondary-v", Paste, Some(CONTEXT)));
|
||||
}
|
||||
if cfg!(target_os = "macos") {
|
||||
bindings.extend([
|
||||
KeyBinding::new("cmd-left", Home, Some(CONTEXT)),
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
use std::ops::Range;
|
||||
|
||||
use gpui::{Bounds, Context, EntityInputHandler, Pixels, Point, UTF16Selection, Window};
|
||||
use gpui::{
|
||||
Bounds, ClipboardItem, Context, EntityInputHandler, Pixels, Point, UTF16Selection, Window,
|
||||
};
|
||||
|
||||
use super::{
|
||||
TextInput,
|
||||
@@ -18,6 +20,12 @@ impl TextInput {
|
||||
}
|
||||
|
||||
impl EntityInputHandler for TextInput {
|
||||
fn paste(&mut self, item: ClipboardItem, _: &mut Window, cx: &mut Context<Self>) {
|
||||
if let Some(text) = item.text() {
|
||||
self.replace(self.selection.clone(), &text, false, cx);
|
||||
}
|
||||
}
|
||||
|
||||
fn text_for_range(
|
||||
&mut self,
|
||||
range_utf16: Range<usize>,
|
||||
|
||||
Reference in new issue
Block a user