Feature: Convert to Markdown button at editor of Card Description and Comment. Useful when there is no WYSIWYG editor.

Thanks to BabyFnord and xet7 !

Fixes #5012,
fixes #3003,
fixes #3399,
fixes #2968,
fixes #2933
This commit is contained in:
Lauri Ojansivu 2023-10-03 06:38:15 -04:00
parent 0e902d73a8
commit 069e2c69b2
6 changed files with 26 additions and 78 deletions

View file

@ -1,4 +1,5 @@
import { ReactiveCache } from '/imports/reactiveCache';
var converter = require('@wekanteam/html-to-markdown');
const specialHandles = [
{userId: 'board_members', username: 'board_members'},
@ -49,7 +50,8 @@ BlazeComponent.extendComponent({
autosize($textarea);
$textarea.escapeableTextComplete(mentions);
};
if (Meteor.settings.public.RICHER_CARD_COMMENT_EDITOR !== false) {
/*
if (Meteor.settings.public.RICHER_CARD_COMMENT_EDITOR === true || Meteor.settings.public.RICHER_CARD_COMMENT_EDITOR === 'true') {
const isSmall = Utils.isMiniScreen();
const toolbar = isSmall
? [
@ -269,6 +271,8 @@ BlazeComponent.extendComponent({
} else {
enableTextarea();
}
*/
enableTextarea();
},
events() {
return [
@ -280,6 +284,10 @@ BlazeComponent.extendComponent({
const $tooltip = this.$('.copied-tooltip');
Utils.showCopied(promise, $tooltip);
},
'click a.fa.fa-brands.fa-markdown'(event) {
const $editor = this.$('textarea.editor');
$editor[0].value = converter.convert($editor[0].value);
},
}
]
}