aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan-Hendrik Willms <tleilax+studip@gmail.com>2025-05-19 09:41:23 +0200
committerJan-Hendrik Willms <tleilax+studip@gmail.com>2025-05-19 09:41:23 +0200
commit34577a2a0bd594a10106eec13c2328c70b1867ee (patch)
tree818b3cfab2e4c309ff19a3a7f3ac72d9c9d6bde9
parent6b2ec2a25459ee69465fa8dff052353e1fce2bc3 (diff)
strictly separate wysiwyg and display content, fixes #5604, fixes #5608issue-4710
Closes #5604 and #5608 Merge request studip/studip!4232
-rw-r--r--app/controllers/course/wiki.php1
-rw-r--r--app/controllers/jsupdater.php4
-rw-r--r--resources/vue/apps/WikiEditor.vue18
3 files changed, 16 insertions, 7 deletions
diff --git a/app/controllers/course/wiki.php b/app/controllers/course/wiki.php
index fb4431f..83d3f3f 100644
--- a/app/controllers/course/wiki.php
+++ b/app/controllers/course/wiki.php
@@ -492,6 +492,7 @@ class Course_WikiController extends AuthenticatedController
'editing' => (bool) $online_user->editing,
'enable-autosave' => $user->getConfiguration()->getValue('WIKI_ENABLE_AUTOSAVE'),
'page-content' => $page->content,
+ 'page-html' => wikiReady($page->content, true, $page->range_id, $page->id),
'page-id' => (int) $page->id,
'save-url' => $this->saveURL($page),
'users' => $page->getOnlineUsers(),
diff --git a/app/controllers/jsupdater.php b/app/controllers/jsupdater.php
index bde2059..ab52c32 100644
--- a/app/controllers/jsupdater.php
+++ b/app/controllers/jsupdater.php
@@ -327,8 +327,8 @@ class JsupdaterController extends AuthenticatedController
$page->isReadable()
&& $page->chdate >= Request::int('server_timestamp')
) {
- $data['content'] = wikiReady($page->content, true, $page->range_id, $page->id);
- $data['wysiwyg'] = $page->content;
+ $data['html'] = wikiReady($page->content, true, $page->range_id, $page->id);
+ $data['content'] = $page->content;
$data['chdate'] = date('c', $page->chdate);
}
diff --git a/resources/vue/apps/WikiEditor.vue b/resources/vue/apps/WikiEditor.vue
index 1191c1a..214dd86 100644
--- a/resources/vue/apps/WikiEditor.vue
+++ b/resources/vue/apps/WikiEditor.vue
@@ -15,7 +15,7 @@
ref="wiki_editor"
data-editor="extraPlugins=WikiLink"
name="content"
- v-model="content"
+ :value="content"
></textarea>
<div></div>
@@ -55,7 +55,7 @@
</form>
<div v-if="!isEditing">
- <div v-html="content"></div>
+ <div v-html="html"></div>
<div data-dialog-button>
<button
class="button"
@@ -118,6 +118,10 @@ export default {
type: String,
default: '',
},
+ pageHtml: {
+ type: String,
+ default: '',
+ },
pageId: {
type: Number,
required: true,
@@ -140,6 +144,7 @@ export default {
autosave: this.enableAutosave,
content: this.pageContent,
editor: null,
+ html: this.pageHtml,
isChanged: false,
isEditing: this.editing,
lastFocussedDate: null,
@@ -205,7 +210,7 @@ export default {
};
if (this.autosave && this.isChanged) {
- data.content = this.editor.getData();
+ data.content = this.content;
this.isChanged = false;
}
@@ -229,7 +234,10 @@ export default {
STUDIP.wysiwyg.replace(textarea).then((editor) => {
editor.model.document.on('change:data', () => {
- this.isChanged = editor.getData() !== this.content;
+ const currentData = editor.getData();
+
+ this.isChanged = currentData !== this.content;
+ this.content = currentData;
});
if (this.isEditing) {
@@ -250,7 +258,7 @@ export default {
}
if ('content' in content) {
- this.content = content.content;
+ this.html = content.content;
}
if (!this.isEditing && 'wysiwyg' in content) {