Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions zeppelin-web/src/app/app.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,24 @@

var init = function() {
$scope.asIframe = (($window.location.href.indexOf('asIframe') > -1) ? true : false);

$scope.paragrapScrollTimeout = 0;

$scope.$on('$includeContentLoaded', function() {
if ($scope.paragrapScrollTimeout !== 0) {
clearTimeout($scope.paragrapScrollTimeout);
}

$scope.paragrapScrollTimeout = setTimeout(function() {
var paraID = window.location.href.match(/paragraph=([^&#]+)/);
var para = jQuery('#' + paraID[1] + '_container');

if (para.length > 0) {
para[0].scrollIntoView(true);
window.scrollBy(0, -120);
}
}, 1000);
});
};

init();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,10 @@
{{paragraph.config.enabled ? "Disable" : "Enable"}} run</a>
</li>
<li>
<a ng-click="goToSingleParagraph()"><span class="icon-share-alt"></span> Link this paragraph</a>
<a ng-click="linkToParagraphInContext()"><span class="icon-link"></span> Link to paragrapgh in context</a>
</li>
<li>
<a ng-click="goToSingleParagraph()"><span class="icon-share-alt"></span> Link single paragraph</a>
</li>
<li>
<a ng-click="clearParagraphOutput(paragraph)"><span class="fa fa-eraser"></span> Clear output</a>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -813,6 +813,13 @@
};

/** Utility function */
$scope.linkToParagraphInContext = function() {
var noteId = $route.current.pathParams.noteId;
var paragraphUrl = location.protocol + '//' + location.host + location.pathname + '#/notebook/' + noteId +
'/?paragraph=' + $scope.paragraph.id;
$window.prompt('Copy url to clipboard: Ctrl+C, Enter', paragraphUrl);
};

$scope.goToSingleParagraph = function() {
var noteId = $route.current.pathParams.noteId;
var redirectToUrl = location.protocol + '//' + location.host + location.pathname + '#/notebook/' + noteId +
Expand Down