mirror of
https://github.com/BookStackApp/BookStack.git
synced 2024-10-29 23:22:34 +01:00
parent
56d5af1336
commit
d7edc389a6
@ -54,6 +54,7 @@ class HomeController extends Controller
|
||||
/**
|
||||
* Get a js representation of the current translations
|
||||
* @return \Illuminate\Contracts\Routing\ResponseFactory|\Symfony\Component\HttpFoundation\Response
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function getTranslations() {
|
||||
$locale = app()->getLocale();
|
||||
@ -86,4 +87,13 @@ class HomeController extends Controller
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get custom head HTML, Used in ajax calls to show in editor.
|
||||
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
*/
|
||||
public function customHeadContent()
|
||||
{
|
||||
return view('partials/custom-head-content');
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -97,6 +97,17 @@ function registerEditorShortcuts(editor) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Load custom HTML head content from the settings into the editor.
|
||||
* @param editor
|
||||
*/
|
||||
function loadCustomHeadContent(editor) {
|
||||
window.$http.get(window.baseUrl('/custom-head-content')).then(resp => {
|
||||
if (!resp.data) return;
|
||||
let head = editor.getDoc().querySelector('head');
|
||||
head.innerHTML += resp.data;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Create and enable our custom code plugin
|
||||
@ -322,6 +333,9 @@ module.exports = {
|
||||
args.content = '';
|
||||
}
|
||||
},
|
||||
init_instance_callback: function(editor) {
|
||||
loadCustomHeadContent(editor);
|
||||
},
|
||||
setup: function (editor) {
|
||||
|
||||
editor.on('init ExecCommand change input NodeChange ObjectResized', editorChange);
|
||||
|
@ -63,9 +63,10 @@
|
||||
padding: 0 $-m 0;
|
||||
margin-left: -1px;
|
||||
overflow-y: scroll;
|
||||
.page-content {
|
||||
margin: 0 auto;
|
||||
}
|
||||
}
|
||||
.markdown-display.page-content {
|
||||
margin: 0 auto;
|
||||
max-width: 100%;
|
||||
}
|
||||
}
|
||||
.editor-toolbar {
|
||||
|
@ -97,8 +97,7 @@
|
||||
<div class="editor-toolbar">
|
||||
<div class="">{{ trans('entities.pages_md_preview') }}</div>
|
||||
</div>
|
||||
<div class="markdown-display">
|
||||
<div class="page-content"></div>
|
||||
<div class="markdown-display page-content">
|
||||
</div>
|
||||
</div>
|
||||
<input type="hidden" name="html"/>
|
||||
|
5
resources/views/partials/custom-head-content.blade.php
Normal file
5
resources/views/partials/custom-head-content.blade.php
Normal file
@ -0,0 +1,5 @@
|
||||
@if(setting('app-custom-head', false))
|
||||
<!-- Custom user content -->
|
||||
{!! setting('app-custom-head') !!}
|
||||
<!-- End custom user content -->
|
||||
@endif
|
@ -135,6 +135,7 @@ Route::group(['middleware' => 'auth'], function () {
|
||||
// Other Pages
|
||||
Route::get('/', 'HomeController@index');
|
||||
Route::get('/home', 'HomeController@index');
|
||||
Route::get('/custom-head-content', 'HomeController@customHeadContent');
|
||||
|
||||
// Settings
|
||||
Route::group(['prefix' => 'settings'], function() {
|
||||
|
Loading…
Reference in New Issue
Block a user