Skip to content

Commit

Permalink
replace ckeditor with tinymce
Browse files Browse the repository at this point in the history
  • Loading branch information
matthias authored and Mewel committed Jan 15, 2025
1 parent 03d931f commit b1fef03
Show file tree
Hide file tree
Showing 9 changed files with 47 additions and 85 deletions.
13 changes: 6 additions & 7 deletions mir-module/GruntFile.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ module.exports = function(grunt) {
},
files : {
'bootstrap/js' : 'bootstrap/dist/js',
'ckeditor4' : 'ckeditor4/',
'ckeditor4/plugins/notification/' : 'ckeditor-notification-plugin',
'ckeditor4/plugins/wordcount/' : 'ckeditor-wordcount-plugin/wordcount',

'tinymce' : 'tinymce',
'tinymce/langs' : 'tinymce-i18n/langs7',

'font-awesome/css' : '@fortawesome/fontawesome-free/css',
'font-awesome/webfonts' : '@fortawesome/fontawesome-free/webfonts',
Expand Down Expand Up @@ -78,19 +78,18 @@ module.exports = function(grunt) {

'<%= globalConfig.moduleDirectory %>/target/classes/META-INF/resources/js/jquery.search-entity.min.js': '<%= globalConfig.moduleDirectory %>/src/main/resources/META-INF/resources/js/jquery.search-entity.js',
'<%= globalConfig.moduleDirectory %>/target/classes/META-INF/resources/js/epusta.min.js': '<%= globalConfig.moduleDirectory %>/src/main/resources/META-INF/resources/js/epusta.js',
'<%= globalConfig.moduleDirectory %>/target/classes/META-INF/assets/ckeditor4/config.min.js': '<%= globalConfig.moduleDirectory %>/src/main/resources/META-INF/resources/js/ckeditor-config.js'
}
}
},
});
grunt.registerTask('copy', function() {
const source = getAbsoluteDir(grunt.option('moduleDirectory'))+'/src/main/resources/META-INF/resources/js/ckeditor-config.js';
const target = getAbsoluteDir(grunt.option('assetsDirectory')) + '/ckeditor4/config.js';
const source = getAbsoluteDir(grunt.option('moduleDirectory'))+'/src/main/resources/META-INF/resources/js/tinymce-config.js';
const target = getAbsoluteDir(grunt.option('assetsDirectory')) + '/tinymce/config.js';
fs.copyFile(source, target, (err) => {
if (err) {
throw err;
}
grunt.log('ckeditor config copied!');
grunt.log('tinymce config copied!');
});
});
grunt.registerTask('none', function() {
Expand Down
5 changes: 2 additions & 3 deletions mir-module/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,8 @@
"video.js": "7.14.3"
},
"dependencies": {
"ckeditor-notification": "^4.11.2",
"ckeditor-wordcount-plugin": "^1.17.12",
"ckeditor4": "~4.22.0",
"tinymce": "^7.6.0",
"tinymce-i18n": "^24.12.9",
"vue": "3.2.13",
"vue3-openlayers": "^1.0.0"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2321,7 +2321,8 @@
src="{$WebApplicationBaseURL}assets/bootstrap-datepicker/locales/bootstrap-datepicker.de.min.js"></script>
<script type="text/javascript" src="{$WebApplicationBaseURL}assets/moment/min/moment.min.js"></script>
<script type="text/javascript" src="{$WebApplicationBaseURL}js/mir/xeditor-form.min.js"></script>
<script type="text/javascript" src="{$WebApplicationBaseURL}assets/ckeditor4/ckeditor.js"></script>
<script type="text/javascript" src="{$WebApplicationBaseURL}assets/tinymce/tinymce.js"></script>
<script type="text/javascript" src="{$WebApplicationBaseURL}assets/tinymce/config.js"></script>
<link rel="stylesheet" type="text/css" href="{$WebApplicationBaseURL}assets/select2/css/select2.min.css"/>
<script type="text/javascript" src="{$WebApplicationBaseURL}assets/select2/js/select2.min.js"/>
<script type="text/javascript" src="{$WebApplicationBaseURL}assets/select2/js/i18n/{$MCR.Metadata.DefaultLang}.js"/>
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@

tinymce.init({
selector: "textarea.tinymce",
license_key: "gpl",
promotion: false,
language: currentLang,
plugins: [
"advlist", "anchor", "autolink", "code", "fullscreen", "help",
"lists", "preview",
"searchreplace", "table", "visualblocks", "wordcount"
],
menubar: false,
toolbar: "undo redo | styles | bold italic underline | remove | code | indent outdent |" +
" alignleft aligncenter alignright alignjustify | bullist numlist | table | hr",
toolbar_mode: "wrap",
entity_encoding: "raw",
valid_elements: JSON.parse(window["MIR.WebConfig.Editor.TinyMCE.HTML.Elements"] || "{}"),
convert_urls: false,
verify_html: false
});
31 changes: 4 additions & 27 deletions mir-module/src/main/resources/config/mir/mycore.properties
Original file line number Diff line number Diff line change
Expand Up @@ -137,34 +137,11 @@ MIR.Editor.HTML.Elements=%MIR.Editor.HTML.Elements% %MIR.Editor.MathML.Elements%
# WebConfig #
#############################################################################

MIR.WebConfig.Editor.CKEditor.Toolbar="[\
{\\"name\\": \\"document\\", \\"items\\": [\\"Source\\"]},\
{\\"name\\": \\"clipboard\\", \\"items\\": [\\"Paste\\", \\"PasteText\\", \\"PasteFromWord\\", \\"-\\", \\"Undo\\", \\"Redo\\"]},\
{\\"name\\": \\"basicstyles\\", \\"items\\": [\\"Bold\\", \\"Italic\\", \\"Underline\\", \\"Strike\\", \\"Subscript\\", \\"Superscript\\", \\"-\\", \\"CopyFormatting\\", \\"RemoveFormat\\"]},\
{\\"name\\": \\"insert\\", \\"items\\": [\\"Table\\", \\"HorizontalRule\\", \\"SpecialChar\\"]},\
{\\"name\\": \\"paragraph\\", \\"items\\": [\\"NumberedList\\", \\"BulletedList\\", \\"-\\", \\"Outdent\\", \\"-\\", \\"Blockquote\\", \\"CreateDiv\\", \\"-\\", \\"JustifyBlock\\", \\"-\\"]},\
{\\"name\\": \\"styles\\", \\"items\\": [\\"Styles\\", \\"Format\\", \\"FontSize\\"]},\
{\\"name\\": \\"about\\", \\"items\\": [\\"About\\"]}\
]"

MIR.WebConfig.Editor.CKEditor.AllowedContent="%MIR.Editor.HTML.Elements%"
MIR.WebConfig.Editor.CKEditor.AutoParagraph=false

MIR.WebConfig.Editor.CKEditor.Wordcount.ShowRemaining=false
MIR.WebConfig.Editor.CKEditor.Wordcount.ShowParagraphs=true
MIR.WebConfig.Editor.CKEditor.Wordcount.ShowWordCount=true
MIR.WebConfig.Editor.CKEditor.Wordcount.ShowCharCount=false
MIR.WebConfig.Editor.CKEditor.Wordcount.CountBytesAsChars=false
MIR.WebConfig.Editor.CKEditor.Wordcount.CountSpacesAsChars=false
MIR.WebConfig.Editor.CKEditor.Wordcount.CountHTML=false
MIR.WebConfig.Editor.CKEditor.Wordcount.CountLineBreaks=false
MIR.WebConfig.Editor.CKEditor.Wordcount.HardLimit=true
MIR.WebConfig.Editor.CKEditor.Wordcount.WarnOnLimitOnly=false
MIR.WebConfig.Editor.CKEditor.Wordcount.MaxParagraphs=-1
MIR.WebConfig.Editor.CKEditor.Wordcount.MaxWordCount=-1
MIR.WebConfig.Editor.CKEditor.Wordcount.MaxCharCount=-1
MIR.WebConfig.Editor.CKEditor.Wordcount.PasteWarningDuration=0
MIR.WebConfig.Editor.TinyMCE.HTML.Elements=p,br,i,strong,em,u,s,sub,sup,table,thead,tr,th,tbody,td,hr,ol,ul,li,blockquote,pre,address,h1,h2,h3,h4,h5,h6,div,q,big,small,code,del
MIR.WebConfig.Editor.TinyMCE.MathML.Elements=math,maction,maligngroup,malignmark,menclose,merror,mfenced,mfrac,mglyph,mi,mlabeledtr,mlongdiv,multiscripts,mn,mo,mover,mpadded,mphantom,mroot,mrow,ms,mscarries,mscarry,msgroup,mstack,msline,mspace,msqrt,msrow,mstyle,msub,msup,msubsup,mtable,mtd,mtext,mtr,munder,munderover
MIR.WebConfig.Editor.TinyMCE.HTML.Elements=%MIR.WebConfig.Editor.TinyMCE.HTML.Elements%,%MIR.WebConfig.Editor.TinyMCE.MathML.Elements%

MIR.WebConfig.Editor.TinyMCE.ValidElements=%MIR.WebConfig.Editor.TinyMCE.HTML.Elements%

#############################################################################
# Configure Owner Strategy #
Expand Down
4 changes: 2 additions & 2 deletions mir-module/src/main/resources/xsl/editor/mir2xeditor.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@
</xed:bind>
</xsl:when>
<xsl:otherwise>
<textarea class="form-control ckeditor">
<textarea class="form-control tinymce">
<xsl:copy-of select="@rows" />
<xsl:copy-of select="@placeholder" />
</textarea>
Expand All @@ -252,7 +252,7 @@
<xed:output i18n="{@label}" />
</label>
<div class="col-md-6">
<textarea class="form-control ckeditor">
<textarea class="form-control tinymce">
<xsl:copy-of select="@rows" />
<xsl:copy-of select="@placeholder" />
</textarea>
Expand Down
25 changes: 10 additions & 15 deletions mir-module/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -561,21 +561,6 @@ chalk@~0.4.0:
has-color "~0.1.0"
strip-ansi "~0.1.0"

ckeditor-notification@^4.11.2:
version "4.11.2"
resolved "https://registry.yarnpkg.com/ckeditor-notification/-/ckeditor-notification-4.11.2.tgz#6f37c1d5e7489d346fd725a3e96d40743588fe6b"
integrity sha512-bQ0lrx8DUkEuZ1vfCSOIcoYPK8R7ozL0baypqu/VLcrmByu8D6cWLjk5yXOA84q/64EhQxfIR4lmHk+PO/5DbA==

ckeditor-wordcount-plugin@^1.17.12:
version "1.17.12"
resolved "https://registry.yarnpkg.com/ckeditor-wordcount-plugin/-/ckeditor-wordcount-plugin-1.17.12.tgz#09452308b460398d7b045efb69b240242a5150f5"
integrity sha512-UU6ZpNoJvo6TQ7LoiV1hcEWboHKwqoLKK0CW951ZXH2QywMX+b4FkYNk3ajdrkCWbe2jVT2kbyMHf/H4FK+u8w==

ckeditor4@~4.22.0:
version "4.22.1"
resolved "https://registry.yarnpkg.com/ckeditor4/-/ckeditor4-4.22.1.tgz#a4e79db1bac2ccb9a672c47e601ba4882afaf455"
integrity sha512-Yj4vTHX5YxHwc48gNqUqTm+KLkRr9tuyb4O2VIABu4oKHWRNVIdLdy6vUNe/XNx+RiTavMejfA1MVOU/MxLjqQ==

cliui@^2.1.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/cliui/-/cliui-2.1.0.tgz#4b475760ff80264c762c3a1719032e91c7fea0d1"
Expand Down Expand Up @@ -2817,6 +2802,16 @@ throttleit@^1.0.0:
resolved "https://registry.yarnpkg.com/throttleit/-/throttleit-1.0.0.tgz#9e785836daf46743145a5984b6268d828528ac6c"
integrity sha1-nnhYNtr0Z0MUWlmEtiaNgoUorGw=

tinymce-i18n@^24.12.9:
version "24.12.9"
resolved "https://registry.yarnpkg.com/tinymce-i18n/-/tinymce-i18n-24.12.9.tgz#1303caffa9c151073dfb628c9a3c224da781b29b"
integrity sha512-G4FTRiyrHLL+YSGAWuuxGsEYvx4WONFpgRkOnVgB2AQbPpJcqyu4IabC2OWLqe9vAmcZs/kE1PJu32aj7qawSg==

tinymce@^7.6.0:
version "7.6.0"
resolved "https://registry.yarnpkg.com/tinymce/-/tinymce-7.6.0.tgz#476069a3e98f46f3f6e7875ca878313d6b3345b9"
integrity sha512-kUrklnD7H8JbpSDEGRh51GKK6Mrf+pR9neSDzUHvXKV+2oRtMB7sqfAtEOnM0/WKdstwaX0qoNCZNo2H1Y0EFA==

[email protected]:
version "0.0.31"
resolved "https://registry.yarnpkg.com/tmp/-/tmp-0.0.31.tgz#8f38ab9438e17315e5dbd8b3657e8bfb277ae4a7"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* This program is free software; you can use it, redistribute it
* and / or modify it under the terms of the GNU General Public License
* (GPL) as published by the Free Software Foundation; either version 2
* of the License or (at your option) any later version.MIR.Editor.HTML.Elements
* of the License or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
Expand Down

0 comments on commit b1fef03

Please sign in to comment.