|
Lines 172-177
orion.editor.ContentAssist = (function() {
Link Here
|
| 172 |
} |
172 |
} |
| 173 |
if (child === node) { |
173 |
if (child === node) { |
| 174 |
child.className = "selected"; |
174 |
child.className = "selected"; |
|
|
175 |
child.focus(); |
| 176 |
if (child.offsetTop < this.contentAssistPanel.scrollTop) { |
| 177 |
// The child element is "above" the view |
| 178 |
child.scrollIntoView(true); |
| 179 |
} else if ((child.offsetTop + child.offsetHeight + 20) > (this.contentAssistPanel.scrollTop + this.contentAssistPanel.offsetHeight)) { |
| 180 |
// The child element is "below" the bottom of the view |
| 181 |
// Note: 20 in the condition is for the horizontal scrollbar height |
| 182 |
child.scrollIntoView(false); |
| 183 |
} |
| 175 |
} |
184 |
} |
| 176 |
} |
185 |
} |
| 177 |
}, |
186 |
}, |
|
Lines 286-291
orion.editor.ContentAssist = (function() {
Link Here
|
| 286 |
this.contentAssistPanel.style.left = caretLocation.x + "px"; |
295 |
this.contentAssistPanel.style.left = caretLocation.x + "px"; |
| 287 |
this.contentAssistPanel.style.top = caretLocation.y + "px"; |
296 |
this.contentAssistPanel.style.top = caretLocation.y + "px"; |
| 288 |
this.contentAssistPanel.style.display = "block"; |
297 |
this.contentAssistPanel.style.display = "block"; |
|
|
298 |
this.contentAssistPanel.scrollTop = 0; |
| 299 |
|
| 300 |
// Make sure that the panel is never outside the viewport |
| 301 |
if (caretLocation.y + this.contentAssistPanel.offsetHeight > dojo.window.getBox().h) { |
| 302 |
this.contentAssistPanel.style.top = (caretLocation.y - this.contentAssistPanel.offsetHeight - this.textView.getLineHeight()) + "px"; |
| 303 |
} |
| 304 |
if (caretLocation.x + this.contentAssistPanel.offsetWidth > dojo.window.getBox().w) { |
| 305 |
this.contentAssistPanel.style.left = (dojo.window.getBox().w - this.contentAssistPanel.offsetWidth) + "px"; |
| 306 |
} |
| 307 |
|
| 289 |
if (!this.listenerAdded) { |
308 |
if (!this.listenerAdded) { |
| 290 |
this.textView.addEventListener("ModelChanged", this, this.contentAssistListener.onModelChanged); |
309 |
this.textView.addEventListener("ModelChanged", this, this.contentAssistListener.onModelChanged); |
| 291 |
this.textView.addEventListener("Scroll", this, this.contentAssistListener.onScroll); |
310 |
this.textView.addEventListener("Scroll", this, this.contentAssistListener.onScroll); |