mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-09-19 18:59:42 +00:00
551ebdc005
We now use a fake DOM implementation on the server to let us share more rendering code between the text output vs. DOM output paths.
32 lines
851 B
JavaScript
32 lines
851 B
JavaScript
/*\
|
|
title: $:/core/modules/widgets/list/listviews/scroller.js
|
|
type: application/javascript
|
|
module-type: listview
|
|
|
|
A list view that scrolls to newly inserted elements
|
|
|
|
\*/
|
|
(function(){
|
|
|
|
/*jslint node: true, browser: true */
|
|
/*global $tw: false */
|
|
"use strict";
|
|
|
|
var ScrollerListView = function(listWidget) {
|
|
this.listWidget = listWidget;
|
|
}
|
|
|
|
ScrollerListView.prototype.navigateTo = function(historyInfo) {
|
|
var listElementIndex = this.listWidget.findListElementByTitle(0,historyInfo.title),
|
|
listElementNode = this.listWidget.children[listElementIndex],
|
|
targetElement = listElementNode.domNode;
|
|
// Scroll the node into view
|
|
var scrollEvent = this.listWidget.renderer.renderTree.document.createEvent("Event");
|
|
scrollEvent.initEvent("tw-scroll",true,true);
|
|
targetElement.dispatchEvent(scrollEvent);
|
|
};
|
|
|
|
exports.scroller = ScrollerListView;
|
|
|
|
})();
|