0
0
Fork 0
mirror of https://github.com/BookStackApp/BookStack.git synced 2025-05-17 05:42:06 +00:00

Added md editor ui dropdown options & their back-end storage

Still need to perform actual in-editor functionality for those controls.
This commit is contained in:
Dan Brown 2022-11-27 20:30:14 +00:00
parent 3995b01399
commit 9fd5190c70
No known key found for this signature in database
GPG key ID: 46D9F943C24A2EF9
6 changed files with 59 additions and 1 deletions
resources/js/components

View file

@ -14,6 +14,7 @@ export class MarkdownEditor extends Component {
this.display = this.$refs.display;
this.input = this.$refs.input;
this.settingContainer = this.$refs.settingContainer;
this.editor = null;
initEditor({
@ -74,6 +75,15 @@ export class MarkdownEditor extends Component {
toolbarLabel.closest('.markdown-editor-wrap').classList.add('active');
});
// Setting changes
this.settingContainer.addEventListener('change', e => {
const actualInput = e.target.parentNode.querySelector('input[type="hidden"]');
const name = actualInput.getAttribute('name');
const value = actualInput.getAttribute('value');
window.$http.patch('/preferences/update-boolean', {name, value});
// TODO - Update state locally
});
// Refresh CodeMirror on container resize
const resizeDebounced = debounce(() => this.editor.cm.refresh(), 100, false);
const observer = new ResizeObserver(resizeDebounced);