Files
releases/docs/book/node_modules/gitbook-plugin-ace/assets/ace.js
T
Torin Sandall fa9ae9437c Vendor node_modules for gitbook
The gitbook install has been incredibly flaky due to it's dependency on
npm. This commit simply vendors the node_modules so that each time we
build the site the process doesn't have to re-run gitbook install.

Signed-off-by: Torin Sandall <torinsandall@gmail.com>
2018-11-26 15:10:14 -08:00

36 lines
823 B
JavaScript

require(["gitbook", "jquery"], function (gitbook, $) {
var init = function () {
var aceCount = 0;
$('.ace').each(function () {
var $ace = $(this).children('.aceCode');
var config = $ace.data('config');
var id = 'ace' + (aceCount++);
$ace.attr('id', id);
var editor = ace.edit(id);
editor.setOptions({
autoScrollEditorIntoView: true,
maxLines: 100
});
if (!config.edit)
editor.setReadOnly(true);
if (!config.theme)
editor.setTheme('ace/theme/chrome');
else
editor.setTheme('ace/theme/' + config.theme);
if (!config.check)
editor.session.setOption("useWorker", false);
editor.getSession().setMode('ace/mode/' + config.lang);
});
};
gitbook.events.bind("page.change", init);
});