1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2025-08-09 10:22:51 +03:00

Enabled custom HTML head content to work within editors

Closes #562
This commit is contained in:
Dan Brown
2017-12-08 11:52:43 +00:00
parent 56d5af1336
commit d7edc389a6
6 changed files with 35 additions and 5 deletions

View File

@@ -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);