Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CB-461: Replace SimpleMDE library with EasyMDE #501

Merged
merged 2 commits into from
Oct 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading