mirror of
https://github.com/wekan/wekan.git
synced 2025-09-22 01:50:48 +02:00
Fix richer editor submit did not clear edit area.
Thanks to xet7 !
This commit is contained in:
parent
6ef3f8a1c8
commit
033d671047
1 changed files with 15 additions and 13 deletions
|
@ -114,12 +114,11 @@ Template.editor.onRendered(() => {
|
||||||
callbacks: {
|
callbacks: {
|
||||||
onInit(object) {
|
onInit(object) {
|
||||||
const originalInput = this;
|
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
|
// when comment is submitted, the original textarea will be set to '', so shall we
|
||||||
if (!this.value) {
|
if (!this.value) {
|
||||||
const sn = getSummernote(this);
|
const sn = getSummernote(this);
|
||||||
sn && sn.summernote('reset');
|
sn && sn.summernote('code', '');
|
||||||
object && object.editingArea.find('.note-placeholder').show();
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
const jEditor = object && object.editable;
|
const jEditor = object && object.editable;
|
||||||
|
@ -223,7 +222,7 @@ Template.editor.onRendered(() => {
|
||||||
// == Fix End ==
|
// == Fix End ==
|
||||||
const original = someNote.summernote('code');
|
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.
|
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.
|
someNote.summernote('pasteHTML', cleaned); //this sets the displayed content editor to the cleaned pasted code.
|
||||||
};
|
};
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
|
@ -290,7 +289,8 @@ Blaze.Template.registerHelper(
|
||||||
|
|
||||||
let currentMention;
|
let currentMention;
|
||||||
while ((currentMention = mentionRegex.exec(content)) !== null) {
|
while ((currentMention = mentionRegex.exec(content)) !== null) {
|
||||||
const [fullMention, username] = currentMention;
|
const [fullMention, quoteduser, simple] = currentMention;
|
||||||
|
const username = quoteduser || simple;
|
||||||
const knowedUser = _.findWhere(knowedUsers, { username });
|
const knowedUser = _.findWhere(knowedUsers, { username });
|
||||||
if (!knowedUser) {
|
if (!knowedUser) {
|
||||||
continue;
|
continue;
|
||||||
|
@ -330,14 +330,7 @@ Template.viewer.events({
|
||||||
// the corresponding text). Clicking a link shouldn't fire these actions, stop
|
// the corresponding text). Clicking a link shouldn't fire these actions, stop
|
||||||
// we stop these event at the viewer component level.
|
// we stop these event at the viewer component level.
|
||||||
'click a'(event, templateInstance) {
|
'click a'(event, templateInstance) {
|
||||||
event.stopPropagation();
|
let prevent = true;
|
||||||
|
|
||||||
// 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();
|
|
||||||
|
|
||||||
const userId = event.currentTarget.dataset.userid;
|
const userId = event.currentTarget.dataset.userid;
|
||||||
if (userId) {
|
if (userId) {
|
||||||
Popup.open('member').call({ userId }, event, templateInstance);
|
Popup.open('member').call({ userId }, event, templateInstance);
|
||||||
|
@ -347,5 +340,14 @@ Template.viewer.events({
|
||||||
window.open(href, '_blank');
|
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();
|
||||||
|
}
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue