summaryrefslogtreecommitdiffstats
path: root/client
diff options
context:
space:
mode:
authorLauri Ojansivu <x@xet7.org>2020-03-31 23:17:58 +0300
committerLauri Ojansivu <x@xet7.org>2020-03-31 23:17:58 +0300
commit033d6710470b2ecd7a0ec0b2f0741ff459e68b32 (patch)
tree7020a1ee4e23cb6dfb5db70ed7eb9abe67752b95 /client
parent6ef3f8a1c8e6a454926133f54bd2e7858aee444a (diff)
downloadwekan-033d6710470b2ecd7a0ec0b2f0741ff459e68b32.tar.gz
wekan-033d6710470b2ecd7a0ec0b2f0741ff459e68b32.tar.bz2
wekan-033d6710470b2ecd7a0ec0b2f0741ff459e68b32.zip
Fix richer editor submit did not clear edit area.
Thanks to xet7 !
Diffstat (limited to 'client')
-rwxr-xr-xclient/components/main/editor.js28
1 files changed, 15 insertions, 13 deletions
diff --git a/client/components/main/editor.js b/client/components/main/editor.js
index 86c0078f..081c6521 100755
--- a/client/components/main/editor.js
+++ b/client/components/main/editor.js
@@ -114,12 +114,11 @@ Template.editor.onRendered(() => {
callbacks: {
onInit(object) {
const originalInput = this;
- $(originalInput).on('input', function() {
+ $(originalInput).on('submitted', function() {
// when comment is submitted, the original textarea will be set to '', so shall we
if (!this.value) {
const sn = getSummernote(this);
- sn && sn.summernote('reset');
- object && object.editingArea.find('.note-placeholder').show();
+ sn && sn.summernote('code', '');
}
});
const jEditor = object && object.editable;
@@ -223,7 +222,7 @@ Template.editor.onRendered(() => {
// == Fix End ==
const original = someNote.summernote('code');
const cleaned = cleanPastedHTML(original); //this is where to call whatever clean function you want. I have mine in a different file, called CleanPastedHTML.
- someNote.summernote('reset'); //clear original
+ someNote.summernote('code', ''); //clear original
someNote.summernote('pasteHTML', cleaned); //this sets the displayed content editor to the cleaned pasted code.
};
setTimeout(function() {
@@ -290,7 +289,8 @@ Blaze.Template.registerHelper(
let currentMention;
while ((currentMention = mentionRegex.exec(content)) !== null) {
- const [fullMention, username] = currentMention;
+ const [fullMention, quoteduser, simple] = currentMention;
+ const username = quoteduser || simple;
const knowedUser = _.findWhere(knowedUsers, { username });
if (!knowedUser) {
continue;
@@ -330,14 +330,7 @@ Template.viewer.events({
// the corresponding text). Clicking a link shouldn't fire these actions, stop
// we stop these event at the viewer component level.
'click a'(event, templateInstance) {
- event.stopPropagation();
-
- // XXX We hijack the build-in browser action because we currently don't have
- // `_blank` attributes in viewer links, and the transformer function is
- // handled by a third party package that we can't configure easily. Fix that
- // by using directly `_blank` attribute in the rendered HTML.
- event.preventDefault();
-
+ let prevent = true;
const userId = event.currentTarget.dataset.userid;
if (userId) {
Popup.open('member').call({ userId }, event, templateInstance);
@@ -347,5 +340,14 @@ Template.viewer.events({
window.open(href, '_blank');
}
}
+ if (prevent) {
+ event.stopPropagation();
+
+ // XXX We hijack the build-in browser action because we currently don't have
+ // `_blank` attributes in viewer links, and the transformer function is
+ // handled by a third party package that we can't configure easily. Fix that
+ // by using directly `_blank` attribute in the rendered HTML.
+ event.preventDefault();
+ }
},
});