Skip to content
Snippets Groups Projects
Commit 5f672304 authored by Elmar Ludwig's avatar Elmar Ludwig
Browse files

allow HTML comments and add HTML marker to content, fixes #2495

Closes #2495

Merge request studip/studip!1685
parent 20ec0142
No related branches found
No related tags found
No related merge requests found
...@@ -14,6 +14,7 @@ import FontColor from '@ckeditor/ckeditor5-font/src/fontcolor.js'; ...@@ -14,6 +14,7 @@ import FontColor from '@ckeditor/ckeditor5-font/src/fontcolor.js';
import GeneralHtmlSupport from '@ckeditor/ckeditor5-html-support/src/generalhtmlsupport'; import GeneralHtmlSupport from '@ckeditor/ckeditor5-html-support/src/generalhtmlsupport';
import HeadingPlugin from '@ckeditor/ckeditor5-heading/src/heading'; import HeadingPlugin from '@ckeditor/ckeditor5-heading/src/heading';
import HorizontalLine from '@ckeditor/ckeditor5-horizontal-line/src/horizontalline'; 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 ImagePlugin from '@ckeditor/ckeditor5-image/src/image';
import ImageUploadPlugin from '@ckeditor/ckeditor5-image/src/imageupload'; import ImageUploadPlugin from '@ckeditor/ckeditor5-image/src/imageupload';
import ImageCaptionPlugin from '@ckeditor/ckeditor5-image/src/imagecaption'; import ImageCaptionPlugin from '@ckeditor/ckeditor5-image/src/imagecaption';
...@@ -73,6 +74,7 @@ ClassicEditor.builtinPlugins = [ ...@@ -73,6 +74,7 @@ ClassicEditor.builtinPlugins = [
GeneralHtmlSupport, GeneralHtmlSupport,
HeadingPlugin, HeadingPlugin,
HorizontalLine, HorizontalLine,
HtmlComment,
ImageCaptionPlugin, ImageCaptionPlugin,
ImagePlugin, ImagePlugin,
ImageResizePlugin, ImageResizePlugin,
......
...@@ -173,7 +173,8 @@ function replaceTextarea(textarea) { ...@@ -173,7 +173,8 @@ function replaceTextarea(textarea) {
// make sure HTML marker is always set, in // make sure HTML marker is always set, in
// case contents are cut-off by the backend // case contents are cut-off by the backend
$textarea.closest('form').submit(() => { $textarea.closest('form').submit(() => {
ckeditor.sourceElement.value = wysiwyg.markAsHtml(ckeditor.getData()); ckeditor.setData(wysiwyg.markAsHtml(ckeditor.getData()));
ckeditor.updateSourceElement();
}); });
// focus the editor if requested // focus the editor if requested
...@@ -183,6 +184,7 @@ function replaceTextarea(textarea) { ...@@ -183,6 +184,7 @@ function replaceTextarea(textarea) {
ckeditor.ui.focusTracker.on('change:isFocused', (evt, name, isFocused) => { ckeditor.ui.focusTracker.on('change:isFocused', (evt, name, isFocused) => {
if (!isFocused) { if (!isFocused) {
ckeditor.setData(wysiwyg.markAsHtml(ckeditor.getData()));
ckeditor.updateSourceElement(); ckeditor.updateSourceElement();
} }
}); });
......
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