mirror of
https://github.com/lightpanda-io/browser.git
synced 2026-03-22 04:34:44 +00:00
Merge pull request #1584 from egrs/fix-textarea-selection-insert
fix textarea text insertion to respect selection range
This commit is contained in:
@@ -3131,9 +3131,7 @@ pub fn handleKeydown(self: *Page, target: *Node, event: *Event) !void {
|
||||
else return
|
||||
;
|
||||
// zig fmt: on
|
||||
const current_value = textarea.getValue();
|
||||
const new_value = try std.mem.concat(self.arena, u8, &.{ current_value, append });
|
||||
return textarea.setValue(new_value, self);
|
||||
return textarea.innerInsert(append, self);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3218,13 +3216,11 @@ pub fn insertText(self: *Page, v: []const u8) !void {
|
||||
return;
|
||||
}
|
||||
|
||||
try input.innerInsert(v, self);
|
||||
return input.innerInsert(v, self);
|
||||
}
|
||||
|
||||
if (html_element.is(Element.Html.TextArea)) |textarea| {
|
||||
const current_value = textarea.getValue();
|
||||
const new_value = try std.mem.concat(self.arena, u8, &.{ current_value, v });
|
||||
return textarea.setValue(new_value, self);
|
||||
return textarea.innerInsert(v, self);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user