aboutsummaryrefslogtreecommitdiff
path: root/resources
diff options
context:
space:
mode:
authorElmar Ludwig <elmar.ludwig@uni-osnabrueck.de>2023-03-31 15:41:57 +0000
committerElmar Ludwig <elmar.ludwig@uni-osnabrueck.de>2023-03-31 15:41:57 +0000
commit5f672304ede842c789852c8f15198d18c8bbe9e5 (patch)
treef0447c938bdb0026bb5cae38c350b6f1ed08bfd5 /resources
parent20ec014289a2c5c191ee910ac3f987f00a4d443f (diff)
allow HTML comments and add HTML marker to content, fixes #2495
Closes #2495 Merge request studip/studip!1685
Diffstat (limited to 'resources')
-rw-r--r--resources/assets/javascripts/chunks/wysiwyg.js2
-rw-r--r--resources/assets/javascripts/lib/wysiwyg.js4
2 files changed, 5 insertions, 1 deletions
diff --git a/resources/assets/javascripts/chunks/wysiwyg.js b/resources/assets/javascripts/chunks/wysiwyg.js
index be47e39..5ab81d6 100644
--- a/resources/assets/javascripts/chunks/wysiwyg.js
+++ b/resources/assets/javascripts/chunks/wysiwyg.js
@@ -14,6 +14,7 @@ import FontColor from '@ckeditor/ckeditor5-font/src/fontcolor.js';
import GeneralHtmlSupport from '@ckeditor/ckeditor5-html-support/src/generalhtmlsupport';
import HeadingPlugin from '@ckeditor/ckeditor5-heading/src/heading';
import HorizontalLine from '@ckeditor/ckeditor5-horizontal-line/src/horizontalline';
+import HtmlComment from '@ckeditor/ckeditor5-html-support/src/htmlcomment';
import ImagePlugin from '@ckeditor/ckeditor5-image/src/image';
import ImageUploadPlugin from '@ckeditor/ckeditor5-image/src/imageupload';
import ImageCaptionPlugin from '@ckeditor/ckeditor5-image/src/imagecaption';
@@ -73,6 +74,7 @@ ClassicEditor.builtinPlugins = [
GeneralHtmlSupport,
HeadingPlugin,
HorizontalLine,
+ HtmlComment,
ImageCaptionPlugin,
ImagePlugin,
ImageResizePlugin,
diff --git a/resources/assets/javascripts/lib/wysiwyg.js b/resources/assets/javascripts/lib/wysiwyg.js
index eacd509..c54581d 100644
--- a/resources/assets/javascripts/lib/wysiwyg.js
+++ b/resources/assets/javascripts/lib/wysiwyg.js
@@ -173,7 +173,8 @@ function replaceTextarea(textarea) {
// make sure HTML marker is always set, in
// case contents are cut-off by the backend
$textarea.closest('form').submit(() => {
- ckeditor.sourceElement.value = wysiwyg.markAsHtml(ckeditor.getData());
+ ckeditor.setData(wysiwyg.markAsHtml(ckeditor.getData()));
+ ckeditor.updateSourceElement();
});
// focus the editor if requested
@@ -183,6 +184,7 @@ function replaceTextarea(textarea) {
ckeditor.ui.focusTracker.on('change:isFocused', (evt, name, isFocused) => {
if (!isFocused) {
+ ckeditor.setData(wysiwyg.markAsHtml(ckeditor.getData()));
ckeditor.updateSourceElement();
}
});