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

Added source code view/set button

This commit is contained in:
Dan Brown
2022-01-19 11:31:02 +00:00
parent 7125530e55
commit b2283106fc
10 changed files with 175 additions and 9 deletions

View File

@ -22,6 +22,17 @@ export function docToHtml(doc) {
return renderDoc.body.innerHTML;
}
/**
* @param {PmEditorState} state
* @return {String}
*/
export function stateToHtml(state) {
const fragment = DOMSerializer.fromSchema(schema).serializeFragment(state.doc.content);
const renderDoc = document.implementation.createHTMLDocument();
renderDoc.body.appendChild(fragment);
return renderDoc.body.innerHTML;
}
/**
* @class KeyedMultiStack
* Holds many stacks, seperated via a key, with a simple