mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-06-14 12:02:31 +03:00
Comments: Split out page comment reference logic to own component
Started support for editor view. Moved comment elements to be added relative to content area instad of specific target reference element. Added relocating on screen size change.
This commit is contained in:
@ -10,6 +10,10 @@ export class EditorToolbox extends Component {
|
||||
this.toggleButton = this.$refs.toggle;
|
||||
this.editorWrapEl = this.container.closest('.page-editor');
|
||||
|
||||
// State
|
||||
this.open = false;
|
||||
this.tab = '';
|
||||
|
||||
this.setupListeners();
|
||||
|
||||
// Set the first tab as active on load
|
||||
@ -34,6 +38,8 @@ export class EditorToolbox extends Component {
|
||||
const isOpen = this.container.classList.contains('open');
|
||||
this.toggleButton.setAttribute('aria-expanded', isOpen ? 'true' : 'false');
|
||||
this.editorWrapEl.classList.toggle('toolbox-open', isOpen);
|
||||
this.open = isOpen;
|
||||
this.emitState();
|
||||
}
|
||||
|
||||
setActiveTab(tabName, openToolbox = false) {
|
||||
@ -54,6 +60,13 @@ export class EditorToolbox extends Component {
|
||||
if (openToolbox && !this.container.classList.contains('open')) {
|
||||
this.toggle();
|
||||
}
|
||||
|
||||
this.tab = tabName;
|
||||
this.emitState();
|
||||
}
|
||||
|
||||
emitState() {
|
||||
this.$emit('change', {tab: this.tab, open: this.open});
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user