Some more fixes around #558

This commit is contained in:
jos 2018-08-02 10:43:12 +02:00
parent 21199eb9e0
commit 46593c24c5
2 changed files with 9 additions and 12 deletions

View File

@ -272,7 +272,7 @@ treemode.getName = function () {
* - to the first button in the top menu
*/
treemode.focus = function () {
var input = this.content.querySelector('[contenteditable=true]');
var input = this.scrollableContent.querySelector('[contenteditable=true]');
if (input) {
input.focus();
}
@ -505,7 +505,7 @@ treemode.refresh = function () {
*/
treemode.startAutoScroll = function (mouseY) {
var me = this;
var content = this.content;
var content = this.scrollableContent;
var top = util.getAbsoluteTop(content);
var height = content.clientHeight;
var bottom = top + height;
@ -569,9 +569,9 @@ treemode.setDomSelection = function (selection) {
return;
}
if ('scrollTop' in selection && this.content) {
if ('scrollTop' in selection && this.scrollableContent) {
// TODO: animated scroll
this.content.scrollTop = selection.scrollTop;
this.scrollableContent.scrollTop = selection.scrollTop;
}
if (selection.nodes) {
// multi-select
@ -604,7 +604,7 @@ treemode.getDomSelection = function () {
dom: this.focusTarget,
range: range,
nodes: this.multiselection.nodes.slice(0),
scrollTop: this.content ? this.content.scrollTop : 0
scrollTop: this.scrollableContent ? this.scrollableContent.scrollTop : 0
};
};

View File

@ -6,9 +6,6 @@
<link href="../dist/jsoneditor.css" rel="stylesheet" type="text/css">
<script src="../dist/jsoneditor.js"></script>
<!--<script src="https://unpkg.com/mobius1-selectr@2.4.1/dist/selectr.min.js"></script>-->
<!--<link rel="stylesheet" type="text/css" href="https://unpkg.com/mobius1-selectr@2.4.1/dist/selectr.min.css">-->
<style type="text/css">
body {
font: 10.5pt arial;