Skip to content
Snippets Groups Projects
Commit 2733d692 authored by Ron Lucke's avatar Ron Lucke Committed by Jan-Hendrik Willms
Browse files

fix #2499

Closes #2499

Merge request studip/studip!1710
parent ba7aae64
No related branches found
No related tags found
No related merge requests found
Pipeline #11974 passed
......@@ -14,7 +14,7 @@
<section class="formatted-content" v-html="currentText" ref="content"></section>
</template>
<template v-if="canEdit" #edit>
<ckeditor :editor="editor" v-model="currentText" :config="editorConfig"></ckeditor>
<ckeditor :editor="editor" v-model="currentText" :config="editorConfig" @ready="onReady"></ckeditor>
</template>
<template #info><translate>Informationen zum Text-Block</translate></template>
</courseware-default-block>
......@@ -51,6 +51,18 @@ export default {
text() {
return this.block?.attributes?.payload?.text;
},
ckeToolbarTop() {
const topBar = document.getElementById('top-bar');
const responsiveContentbar = document.getElementById('responsive-contentbar');
let top = topBar.clientHeight + topBar.clientTop;
if (responsiveContentbar) {
top += responsiveContentbar?.clientHeight + responsiveContentbar?.clientTop;
} else {
top += 85;
}
return top;
},
},
mounted() {
this.initCurrent();
......@@ -63,6 +75,10 @@ export default {
this.currentText = this.text;
this.loadMathjax();
},
onReady( editor ) {
editor.ui.viewportOffset = { top: this.ckeToolbarTop };
editor.ui.update();
},
async storeText() {
let attributes = this.block.attributes;
attributes.payload.text = this.currentText;
......@@ -91,7 +107,7 @@ export default {
.catch(() => {
console.log('Warning: Could not load MathJax.');
});
}
},
},
}
};
</script>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment