set nav bar height fixed and scroll to selection

This commit is contained in:
Meir Rotstein 2017-09-17 00:13:48 +03:00
parent b4e053030b
commit 7899724810
4 changed files with 21 additions and 3 deletions

View File

@ -210,6 +210,11 @@ div.jsoneditor-outer {
box-sizing: border-box; box-sizing: border-box;
} }
div.jsoneditor-menu2 + div.jsoneditor-outer {
margin: -61px 0 0 0;
padding: 61px 0 0 0;
}
textarea.jsoneditor-text, textarea.jsoneditor-text,
.ace-jsoneditor { .ace-jsoneditor {
min-height: 150px; min-height: 150px;

View File

@ -133,7 +133,7 @@ div.jsoneditor-menu a.jsoneditor-poweredBy {
div.jsoneditor-menu2 { div.jsoneditor-menu2 {
width: 100%; width: 100%;
min-height: 24px; height: 26px;
padding: 2px; padding: 2px;
margin: 0; margin: 0;
-moz-box-sizing: border-box; -moz-box-sizing: border-box;

View File

@ -1,7 +1,12 @@
div.jsoneditor-treepath { div.jsoneditor-treepath {
padding: 3px 0 2px 5px; padding: 3px 0 2px 5px;
word-wrap: break-word; overflow: hidden;
}
div.jsoneditor-treepath div.jsoneditor-contextmenu-root {
position: absolute;
left: 0;
} }
div.jsoneditor-treepath span.jsoneditor-treepath-element{ div.jsoneditor-treepath span.jsoneditor-treepath-element{

View File

@ -34,6 +34,7 @@ TreePath.prototype.setPath = function (pathObjs) {
if (pathObjs && pathObjs.length) { if (pathObjs && pathObjs.length) {
pathObjs.forEach(function (pathObj, idx) { pathObjs.forEach(function (pathObj, idx) {
var pathEl = document.createElement('span'); var pathEl = document.createElement('span');
var sepEl;
pathEl.className = 'jsoneditor-treepath-element'; pathEl.className = 'jsoneditor-treepath-element';
pathEl.innerText = pathObj.name; pathEl.innerText = pathObj.name;
pathEl.onclick = _onSegmentClick.bind(me, pathObj); pathEl.onclick = _onSegmentClick.bind(me, pathObj);
@ -41,7 +42,7 @@ TreePath.prototype.setPath = function (pathObjs) {
me.path.appendChild(pathEl); me.path.appendChild(pathEl);
if (pathObj.children.length) { if (pathObj.children.length) {
var sepEl = document.createElement('span'); sepEl = document.createElement('span');
sepEl.className = 'jsoneditor-treepath-seperator'; sepEl.className = 'jsoneditor-treepath-seperator';
sepEl.innerHTML = '≫'; sepEl.innerHTML = '≫';
@ -60,6 +61,13 @@ TreePath.prototype.setPath = function (pathObjs) {
me.path.appendChild(sepEl, me.container); me.path.appendChild(sepEl, me.container);
} }
if(idx === pathObjs.length - 1) {
var leftRectPos = (sepEl || pathEl).getBoundingClientRect().left;
if(me.path.offsetWidth < leftRectPos) {
me.path.scrollLeft = leftRectPos;
}
}
}); });
} }