mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-02-22 23:23:54 +08:00
fix(react-remote): Do not cancel key events, check for floating point bounding sizes
This commit is contained in:
parent
66d3d89979
commit
9f3600b9eb
2 changed files with 24 additions and 11 deletions
4
src/react-remote/react-remote-child.js
vendored
4
src/react-remote/react-remote-child.js
vendored
|
@ -95,6 +95,8 @@ events.forEach(function(type) {
|
|||
|
||||
var remote = require('remote');
|
||||
ipc.send("from-react-remote-window", {windowId: remote.getCurrentWindow().id, event: representation});
|
||||
event.preventDefault();
|
||||
if ((event.type != 'keydown') && (event.type != 'keypress') && (event.type != 'keyup')) {
|
||||
event.preventDefault();
|
||||
}
|
||||
}, true);
|
||||
});
|
||||
|
|
31
src/react-remote/react-remote-parent.js
vendored
31
src/react-remote/react-remote-parent.js
vendored
|
@ -273,20 +273,31 @@ var openWindowForComponent = function(Component, options) {
|
|||
}
|
||||
// Weirdly, this returns an array of [width, height] and not a hash
|
||||
var size = thinWindow.getContentSize();
|
||||
var containerSize = container.getBoundingClientRect();
|
||||
var changed = false;
|
||||
if ((!options.height) && (size[1] != containerSize.height)) {
|
||||
size[1] = containerSize.height;
|
||||
changed = true;
|
||||
}
|
||||
if ((!options.width) && (size[0] != containerSize.width)) {
|
||||
size[0] = containerSize.width;
|
||||
changed = true;
|
||||
}
|
||||
if (containerSize.height == 0) {
|
||||
|
||||
var containerSize = container.getBoundingClientRect();
|
||||
var containerWidth = Math.ceil(containerSize.width);
|
||||
var containerHeight = Math.ceil(containerSize.height);
|
||||
|
||||
if (containerHeight == 0) {
|
||||
containerHeight = 100;
|
||||
debugger;
|
||||
}
|
||||
if (containerWidth == 0) {
|
||||
containerWidth = 400;
|
||||
debugger;
|
||||
}
|
||||
|
||||
if ((!options.height) && (size[1] != containerHeight)) {
|
||||
size[1] = containerHeight;
|
||||
changed = true;
|
||||
}
|
||||
if ((!options.width) && (size[0] != containerWidth)) {
|
||||
size[0] = containerWidth;
|
||||
changed = true;
|
||||
}
|
||||
if (changed) {
|
||||
console.log(size[0], size[1]);
|
||||
thinWindow.setContentSize(size[0], size[1]);
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue