diff --git a/app/views/course/forum/index/_new_entry.php b/app/views/course/forum/index/_new_entry.php index 64f1c142c0d5f67927fc9b71014044d67e1b5074..d9d14ea61a294462aa501379fd924eace0e209fc 100644 --- a/app/views/course/forum/index/_new_entry.php +++ b/app/views/course/forum/index/_new_entry.php @@ -34,7 +34,7 @@ <? endif; ?> <label> - <textarea class="add_toolbar wysiwyg size-l" data-textarea="new_entry" name="content" required tabindex="3" + <textarea class="add_toolbar wysiwyg size-l" data-editor="extraPlugins=StudipBlockQuote" data-textarea="new_entry" name="content" required tabindex="3" placeholder="<?= _('Schreiben Sie hier Ihren Beitrag.') ?>"></textarea> </label> diff --git a/app/views/course/forum/index/_post.php b/app/views/course/forum/index/_post.php index d21b4ef508f2edf2d4ba68876c2fb2291b7a4323..aae845385eb6a2f6631050239ac042a085472630 100644 --- a/app/views/course/forum/index/_post.php +++ b/app/views/course/forum/index/_post.php @@ -86,7 +86,7 @@ <!-- Postinginhalt --> <div class="content"> <span data-edit-topic="<?= $post['topic_id'] ?>" <?= $edit_posting == $post['topic_id'] ? '' : 'style="display: none;"' ?>> - <textarea data-textarea="<?= $post['topic_id'] ?>" data-reset="<?= wysiwygReady($post['content_raw']) ?>" name="content" class="add_toolbar wysiwyg"><?= wysiwygReady($post['content_raw']) ?></textarea> + <textarea data-textarea="<?= $post['topic_id'] ?>" data-reset="<?= wysiwygReady($post['content_raw']) ?>" name="content" class="add_toolbar wysiwyg" data-editor="extraPlugins=StudipBlockQuote"><?= wysiwygReady($post['content_raw']) ?></textarea> </span> <span data-show-topic="<?= $post['topic_id'] ?>" data-topic-content="<?= $post['topic_id'] ?>" <?= $edit_posting != $post['topic_id'] ? '' : 'style="display: none;"' ?>> diff --git a/app/views/course/scm/edit.php b/app/views/course/scm/edit.php index 87ad30f046e6a51628a7cc32c53eb0695eaa0680..931aef77dfac1a7ca03f6720bbec36a36f51d43a 100644 --- a/app/views/course/scm/edit.php +++ b/app/views/course/scm/edit.php @@ -38,6 +38,7 @@ <?= _('Inhalt') ?> <?= I18N::textarea('content', $scm->content, [ 'class' => 'add_toolbar wysiwyg size-l', + 'data-editor' => 'extraPlugins=FindAndReplace', ]) ?> </label> </fieldset> diff --git a/resources/assets/javascripts/cke/builtin-plugins.js b/resources/assets/javascripts/cke/builtin-plugins.js index 3b285df7deb6543447fd0ca2a742f57bdc240bd7..71fc3428c2be0f60850bdcf10c1950f9daa36b2e 100644 --- a/resources/assets/javascripts/cke/builtin-plugins.js +++ b/resources/assets/javascripts/cke/builtin-plugins.js @@ -7,7 +7,6 @@ import CodeBlock from '@ckeditor/ckeditor5-code-block/src/codeblock'; import EasyImagePlugin from '@ckeditor/ckeditor5-easy-image/src/easyimage'; import EssentialsPlugin from '@ckeditor/ckeditor5-essentials/src/essentials'; import FileRepository from '@ckeditor/ckeditor5-upload/src/filerepository'; -import FindAndReplace from '@ckeditor/ckeditor5-find-and-replace/src/findandreplace'; import FontBackgroundColor from '@ckeditor/ckeditor5-font/src/fontbackgroundcolor.js'; import FontColor from '@ckeditor/ckeditor5-font/src/fontcolor.js'; import GeneralHtmlSupport from '@ckeditor/ckeditor5-html-support/src/generalhtmlsupport'; @@ -49,9 +48,7 @@ import Underline from '@ckeditor/ckeditor5-basic-styles/src/underline.js'; import Mathematics from 'ckeditor5-math/src/math'; /* ckeditor elan */ import StudipA11YDialog, { updateVoiceLabel } from '../cke/studip-a11y-dialog/a11y-dialog.js'; -import StudipBlockQuote from '../cke/studip-quote/StudipBlockQuote.js'; import StudipUpload from '../cke/StudipUpload.js'; -import StudipWikiLink from '../cke/wiki-link/wiki-link.js'; import SpecialCharactersSmiley from '../cke/special_characters/SpecialCharactersSmiley.js'; import SpecialCharactersGreek from '../cke/special_characters/SpecialCharactersGreek.js'; @@ -65,7 +62,6 @@ const builtinPlugins = [ BoldPlugin, CodeBlock, EssentialsPlugin, - FindAndReplace, FontColor, FontBackgroundColor, GeneralHtmlSupport, @@ -95,7 +91,6 @@ const builtinPlugins = [ SpecialCharactersMathematical, SpecialCharactersText, Strikethrough, - StudipBlockQuote, StudipUpload, Subscript, Superscript, diff --git a/resources/assets/javascripts/cke/classic-editor.js b/resources/assets/javascripts/cke/classic-editor.js index 0e21c0a21ab7d906e628000ad3358c127655a61c..09369f643c4e04431149226a62f42f97ec1f4d09 100644 --- a/resources/assets/javascripts/cke/classic-editor.js +++ b/resources/assets/javascripts/cke/classic-editor.js @@ -15,12 +15,15 @@ ClassicEditor.defaultConfig = { 'redo', 'findAndReplace', '|', + 'heading', 'bold', 'italic', 'underline', 'strikethrough', 'subscript', 'superscript', + 'fontColor', + 'fontBackgroundColor', '|', 'removeFormat', '|', @@ -34,10 +37,6 @@ ClassicEditor.defaultConfig = { 'alignment:right', 'alignment:center', 'alignment:justify', - '-', - 'heading', - 'fontColor', - 'fontBackgroundColor', '|', 'link', 'insertTable', diff --git a/resources/assets/javascripts/lib/wysiwyg.js b/resources/assets/javascripts/lib/wysiwyg.js index 978328bb050f30300d10b806954349677b03a07e..00f453d59f0ef65f1120bcde3a91706719284464 100644 --- a/resources/assets/javascripts/lib/wysiwyg.js +++ b/resources/assets/javascripts/lib/wysiwyg.js @@ -2,6 +2,8 @@ * wysiwyg.js - Replace HTML textareas with WYSIWYG editor. */ import parseOptions from './parse_options.js'; +import FindAndReplace from '@ckeditor/ckeditor5-find-and-replace/src/findandreplace'; +import StudipBlockQuote from '../cke/studip-quote/StudipBlockQuote.js'; import WikiLink from '../cke/wiki-link/wiki-link.js'; const wysiwyg = { @@ -131,7 +133,7 @@ function parseEditorOptions(data) { } if (parsed.extraPlugins) { - const pluginMap = { WikiLink }; + const pluginMap = { FindAndReplace, StudipBlockQuote, WikiLink }; result.options.extraPlugins = parsed.extraPlugins.split(',').reduce((memo, plugin) => { return plugin in pluginMap ? [...memo, pluginMap[plugin]] : memo; }, []); @@ -153,12 +155,8 @@ function getToolbarOptions(parsed) { removeItems: [ 'undo', 'redo', - 'findAndReplace', 'strikethrough', 'horizontalLine', - 'insertBlockQuote', - 'splitBlockQuote', - 'removeBlockQuote', ], }; } else if (parsed.toolbar === 'minimal') { @@ -169,15 +167,14 @@ function getToolbarOptions(parsed) { 'underline', 'subscript', 'superscript', + 'fontColor', + 'fontBackgroundColor', '|', 'removeFormat', '|', 'bulletedList', 'numberedList', '|', - 'fontColor', - 'fontBackgroundColor', - '|', 'link', 'math', 'specialCharacters', diff --git a/resources/vue/components/courseware/CoursewareTextBlock.vue b/resources/vue/components/courseware/CoursewareTextBlock.vue index df376c52fdf6df3863448961e2136817fb7979c7..ba9fa93fb32bf114344ce20e87c670c0a35858ff 100644 --- a/resources/vue/components/courseware/CoursewareTextBlock.vue +++ b/resources/vue/components/courseware/CoursewareTextBlock.vue @@ -23,6 +23,7 @@ <script> import CoursewareDefaultBlock from './CoursewareDefaultBlock.vue'; +import FindAndReplace from '@ckeditor/ckeditor5-find-and-replace/src/findandreplace'; import { blockMixin } from './block-mixin.js'; import { ClassicEditor, BalloonEditor } from '@/assets/javascripts/chunks/wysiwyg' import { mapActions } from 'vuex'; @@ -44,6 +45,7 @@ export default { editor: ClassicEditor, editorConfig: { // The configuration of the editor. + extraPlugins: [FindAndReplace], } }; }, diff --git a/templates/wiki/edit.php b/templates/wiki/edit.php index 3e42108a39d5f2ebbce11b9442e6cda1efe94d40..0aa428bf2deb545e3fea4d3c33a2ee9bdd33ae3e 100644 --- a/templates/wiki/edit.php +++ b/templates/wiki/edit.php @@ -11,8 +11,7 @@ <input type="hidden" name="submit" value="true"> <input type="hidden" name="cmd" value="show"> - <br> - <textarea name="body" class="wiki-editor add_toolbar wysiwyg size-l" data-editor="extraPlugins=WikiLink" + <textarea name="body" class="wiki-editor add_toolbar wysiwyg size-l" data-editor="extraPlugins=FindAndReplace,WikiLink" ><?= wysiwygReady($body) ?></textarea> </fieldset>