Skip to content

Commit

Permalink
Merge pull request #501 from metabrainz/replace-simplemde
Browse files Browse the repository at this point in the history
Replace SimpleMDE library with EasyMDE
  • Loading branch information
MonkeyDo authored Oct 31, 2023
2 parents 16dc198 + 48beef7 commit 1ff9d6e
Show file tree
Hide file tree
Showing 7 changed files with 2,952 additions and 2,898 deletions.
5 changes: 3 additions & 2 deletions critiquebrainz/frontend/static/scripts/wysiwyg-editor.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
var SimpleMDE = require('simplemde');
window.SimpleMDE = SimpleMDE;
import '../../../../node_modules/easymde/dist/easymde.min.css';
var EasyMDE = require('easymde');
window.EasyMDE = EasyMDE;
2 changes: 1 addition & 1 deletion critiquebrainz/frontend/templates/common.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{% set rating_script %}
<link rel="stylesheet" href="https://cdn.jsdelivr.net/simplemde/latest/simplemde.min.css"/>
<link rel="stylesheet" href="{{ get_static_path('wysiwyg-editor.css') }}"/>
<script>
$(document).ready(function () {
$("#ratestars").click(function (e) {
Expand Down
10 changes: 5 additions & 5 deletions critiquebrainz/frontend/templates/review/entity/comments.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
</a>
<button class="comment-edit-button btn btn-primary btn-xs"
title="{{ _('Edit this comment') }}">
<span class="glyphicon glyphicon-edit"></span>
<span class="glyphicon glyphicon-edit"></span>
</button>
{% endif %}
<span style="float:right;">
Expand Down Expand Up @@ -48,12 +48,12 @@


{% block scripts %}
<link rel="stylesheet" href="https://cdn.jsdelivr.net/simplemde/latest/simplemde.min.css"/>
<link rel="stylesheet" href="{{ get_static_path('wysiwyg-editor.css') }}"/>
<script src="{{ get_static_path('wysiwyg-editor.js') }}"></script>
<script>
$(document).ready(function() {
commentMdes = {};
commentMdes["commentAddForm"] = new SimpleMDE({
commentMdes["commentAddForm"] = new EasyMDE({
element: $("#comment-add-form").find(".comment-text")[0],
spellChecker: false
});
Expand Down Expand Up @@ -92,8 +92,8 @@
commentContentDiv.toggle();

if (!commentMdes[commentDivId]) {
// if no simplemde object is created for this comment, create it
commentMdes[commentDivId] = new SimpleMDE({
// if no EasyMDE object is created for this comment, create it
commentMdes[commentDivId] = new EasyMDE({
element: commentText,
spellChecker: false
});
Expand Down
6 changes: 3 additions & 3 deletions critiquebrainz/frontend/templates/review/modify/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,11 @@

{% block scripts %}
{{ super() }}
<link rel="stylesheet" href="https://cdn.jsdelivr.net/simplemde/latest/simplemde.min.css"/>
<link rel="stylesheet" href="{{ get_static_path('wysiwyg-editor.css') }}"/>
<script src="{{ get_static_path('wysiwyg-editor.js') }}"></script>
<script>
$(document).ready(function() {
reviewContentEditor = new SimpleMDE({
reviewContentEditor = new EasyMDE({
element: $('#review-content')[0],
spellChecker: false
});
Expand All @@ -84,7 +84,7 @@
oldReviewLength = reviewContentEditor.value().length
languageSelector = $('#review-language')[0]
// Detect the language of the review on change
// codemirror is the underlying editor behind SimpleMDE.
// codemirror is the underlying editor behind EasyMDE.
reviewContentEditor.codemirror.on("change", function() {
const MIN_DIFFERENCE = 10

Expand Down
Loading

0 comments on commit 1ff9d6e

Please sign in to comment.