mirror of
https://github.com/GitbookIO/gitbook.git
synced 2026-10-12 07:58:49 +00:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 3d9e4c80a2 | |||
| a7f49015c1 | |||
| 68ed2631dc | |||
| 2814fea67e |
@@ -2,6 +2,10 @@
|
|||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
This project adheres to [Semantic Versioning](http://semver.org/).
|
This project adheres to [Semantic Versioning](http://semver.org/).
|
||||||
|
|
||||||
|
## 2.5.2
|
||||||
|
- Fix custom stylesheets for ebook generation
|
||||||
|
- Trigger event `start` before `page.change`
|
||||||
|
|
||||||
## 2.5.1
|
## 2.5.1
|
||||||
- Fix calcul of `gitbook.state.root` when serving HTML index as `/`
|
- Fix calcul of `gitbook.state.root` when serving HTML index as `/`
|
||||||
|
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ Generator.prototype.getPDFTemplate = function(id) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
tpl = juice(tpl, {
|
tpl = juice(tpl, {
|
||||||
extraCss: stylesheets.concat('/n')
|
extraCss: stylesheets.join('\n\n')
|
||||||
});
|
});
|
||||||
|
|
||||||
return tpl;
|
return tpl;
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "gitbook",
|
"name": "gitbook",
|
||||||
"version": "2.5.1",
|
"version": "2.5.2",
|
||||||
"homepage": "https://www.gitbook.com",
|
"homepage": "https://www.gitbook.com",
|
||||||
"description": "Library and cmd utility to generate GitBooks",
|
"description": "Library and cmd utility to generate GitBooks",
|
||||||
"main": "lib/index.js",
|
"main": "lib/index.js",
|
||||||
|
|||||||
@@ -24403,6 +24403,7 @@ function start(config) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
events.trigger('start', config);
|
events.trigger('start', config);
|
||||||
|
navigation.notify();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Export APIs for plugins
|
// Export APIs for plugins
|
||||||
@@ -24581,7 +24582,11 @@ function updateNavigationPosition() {
|
|||||||
$('.navigation-next').css('margin-right', (bodyInnerWidth - pageWrapperWidth) + 'px');
|
$('.navigation-next').css('margin-right', (bodyInnerWidth - pageWrapperWidth) + 'px');
|
||||||
}
|
}
|
||||||
|
|
||||||
function preparePage() {
|
function notifyPageChange() {
|
||||||
|
events.trigger('page.change');
|
||||||
|
}
|
||||||
|
|
||||||
|
function preparePage(notify) {
|
||||||
var $bookBody = $('.book-body');
|
var $bookBody = $('.book-body');
|
||||||
var $bookInner = $bookBody.find('.body-inner');
|
var $bookInner = $bookBody.find('.body-inner');
|
||||||
var $pageWrapper = $bookInner.find('.page-wrapper');
|
var $pageWrapper = $bookInner.find('.page-wrapper');
|
||||||
@@ -24597,7 +24602,7 @@ function preparePage() {
|
|||||||
$bookBody.scrollTop(0);
|
$bookBody.scrollTop(0);
|
||||||
|
|
||||||
// Notify
|
// Notify
|
||||||
events.trigger('page.change');
|
if (notify !== false) notifyPageChange();
|
||||||
}
|
}
|
||||||
|
|
||||||
function isLeftClickEvent(e) {
|
function isLeftClickEvent(e) {
|
||||||
@@ -24656,13 +24661,14 @@ function init() {
|
|||||||
$(window).resize(updateNavigationPosition);
|
$(window).resize(updateNavigationPosition);
|
||||||
|
|
||||||
// Prepare current page
|
// Prepare current page
|
||||||
preparePage();
|
preparePage(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
init: init,
|
init: init,
|
||||||
goNext: goNext,
|
goNext: goNext,
|
||||||
goPrev: goPrev
|
goPrev: goPrev,
|
||||||
|
notify: notifyPageChange
|
||||||
};
|
};
|
||||||
|
|
||||||
},{"./events":12,"./loading":15,"./state":19,"jquery":8,"url":7}],17:[function(require,module,exports){
|
},{"./events":12,"./loading":15,"./state":19,"jquery":8,"url":7}],17:[function(require,module,exports){
|
||||||
@@ -24916,7 +24922,7 @@ function updateButton(opts) {
|
|||||||
// Create button
|
// Create button
|
||||||
var $btn = $('<a>', {
|
var $btn = $('<a>', {
|
||||||
'class': 'btn',
|
'class': 'btn',
|
||||||
'text': opts.text,
|
'text': opts.text? ' ' + opts.text : '',
|
||||||
'aria-label': opts.label,
|
'aria-label': opts.label,
|
||||||
'href': '#'
|
'href': '#'
|
||||||
});
|
});
|
||||||
@@ -24955,6 +24961,8 @@ function updateButton(opts) {
|
|||||||
$result = $btn;
|
$result = $btn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$result.addClass('js-toolbar-action');
|
||||||
|
|
||||||
if (_.isNumber(opts.index) && opts.index >= 0) {
|
if (_.isNumber(opts.index) && opts.index >= 0) {
|
||||||
insertAt($toolbar, '.btn, .dropdown, h1', opts.index, $result);
|
insertAt($toolbar, '.btn, .dropdown, h1', opts.index, $result);
|
||||||
} else {
|
} else {
|
||||||
@@ -24964,6 +24972,7 @@ function updateButton(opts) {
|
|||||||
|
|
||||||
// Update all buttons
|
// Update all buttons
|
||||||
function updateAllButtons() {
|
function updateAllButtons() {
|
||||||
|
$('.js-toolbar-action').remove();
|
||||||
_.each(buttons, updateButton);
|
_.each(buttons, updateButton);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ function start(config) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
events.trigger('start', config);
|
events.trigger('start', config);
|
||||||
|
navigation.notify();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Export APIs for plugins
|
// Export APIs for plugins
|
||||||
|
|||||||
@@ -75,7 +75,11 @@ function updateNavigationPosition() {
|
|||||||
$('.navigation-next').css('margin-right', (bodyInnerWidth - pageWrapperWidth) + 'px');
|
$('.navigation-next').css('margin-right', (bodyInnerWidth - pageWrapperWidth) + 'px');
|
||||||
}
|
}
|
||||||
|
|
||||||
function preparePage() {
|
function notifyPageChange() {
|
||||||
|
events.trigger('page.change');
|
||||||
|
}
|
||||||
|
|
||||||
|
function preparePage(notify) {
|
||||||
var $bookBody = $('.book-body');
|
var $bookBody = $('.book-body');
|
||||||
var $bookInner = $bookBody.find('.body-inner');
|
var $bookInner = $bookBody.find('.body-inner');
|
||||||
var $pageWrapper = $bookInner.find('.page-wrapper');
|
var $pageWrapper = $bookInner.find('.page-wrapper');
|
||||||
@@ -91,7 +95,7 @@ function preparePage() {
|
|||||||
$bookBody.scrollTop(0);
|
$bookBody.scrollTop(0);
|
||||||
|
|
||||||
// Notify
|
// Notify
|
||||||
events.trigger('page.change');
|
if (notify !== false) notifyPageChange();
|
||||||
}
|
}
|
||||||
|
|
||||||
function isLeftClickEvent(e) {
|
function isLeftClickEvent(e) {
|
||||||
@@ -150,11 +154,12 @@ function init() {
|
|||||||
$(window).resize(updateNavigationPosition);
|
$(window).resize(updateNavigationPosition);
|
||||||
|
|
||||||
// Prepare current page
|
// Prepare current page
|
||||||
preparePage();
|
preparePage(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
init: init,
|
init: init,
|
||||||
goNext: goNext,
|
goNext: goNext,
|
||||||
goPrev: goPrev
|
goPrev: goPrev,
|
||||||
|
notify: notifyPageChange
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -117,7 +117,7 @@ function updateButton(opts) {
|
|||||||
// Create button
|
// Create button
|
||||||
var $btn = $('<a>', {
|
var $btn = $('<a>', {
|
||||||
'class': 'btn',
|
'class': 'btn',
|
||||||
'text': opts.text,
|
'text': opts.text? ' ' + opts.text : '',
|
||||||
'aria-label': opts.label,
|
'aria-label': opts.label,
|
||||||
'href': '#'
|
'href': '#'
|
||||||
});
|
});
|
||||||
@@ -156,6 +156,8 @@ function updateButton(opts) {
|
|||||||
$result = $btn;
|
$result = $btn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$result.addClass('js-toolbar-action');
|
||||||
|
|
||||||
if (_.isNumber(opts.index) && opts.index >= 0) {
|
if (_.isNumber(opts.index) && opts.index >= 0) {
|
||||||
insertAt($toolbar, '.btn, .dropdown, h1', opts.index, $result);
|
insertAt($toolbar, '.btn, .dropdown, h1', opts.index, $result);
|
||||||
} else {
|
} else {
|
||||||
@@ -165,6 +167,7 @@ function updateButton(opts) {
|
|||||||
|
|
||||||
// Update all buttons
|
// Update all buttons
|
||||||
function updateAllButtons() {
|
function updateAllButtons() {
|
||||||
|
$('.js-toolbar-action').remove();
|
||||||
_.each(buttons, updateButton);
|
_.each(buttons, updateButton);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user