mirror of
https://github.com/humhub/humhub.git
synced 2025-04-22 16:11:55 +02:00
Reset backuped content after submit form (#6128)
* Reset backuped content after submit form * Update CHANGELOG.md
This commit is contained in:
parent
0d5689edd7
commit
d9986f4429
@ -9,6 +9,7 @@ HumHub Changelog
|
||||
- Fix #6103: Fix null passing to parse_str()
|
||||
- Fix #6108: Fix log time in the `date()` function
|
||||
- Fix #6122: Fix deleting a content with empty reason
|
||||
- Fix #6128: Reset backuped content after submit form
|
||||
|
||||
1.13.1 (January 25, 2023)
|
||||
-------------------------
|
||||
|
@ -2,7 +2,7 @@
|
||||
/**
|
||||
* This file is generated by the "yii asset" command.
|
||||
* DO NOT MODIFY THIS FILE DIRECTLY.
|
||||
* @version 2022-11-29 14:04:39
|
||||
* @version 2023-02-27 09:01:41
|
||||
*/
|
||||
return [
|
||||
'app' => [
|
||||
|
@ -10,6 +10,7 @@ humhub.module('ui.richtext.prosemirror', function(module, require, $) {
|
||||
var client = require('client');
|
||||
var Widget = require('ui.widget').Widget;
|
||||
var additions = require('ui.additions');
|
||||
var event = require('event');
|
||||
|
||||
var MarkdownEditor = prosemirror.MarkdownEditor;
|
||||
var MentionProvider = prosemirror.MentionProvider;
|
||||
@ -74,9 +75,8 @@ humhub.module('ui.richtext.prosemirror', function(module, require, $) {
|
||||
})
|
||||
|
||||
if (this.options.backupInterval) {
|
||||
setInterval(function () {
|
||||
that.backup();
|
||||
}, this.options.backupInterval * 1000);
|
||||
setInterval(() => this.backup(), this.options.backupInterval * 1000);
|
||||
event.on('humhub:content:afterSubmit', () => this.resetBackup());
|
||||
}
|
||||
};
|
||||
|
||||
@ -101,11 +101,14 @@ humhub.module('ui.richtext.prosemirror', function(module, require, $) {
|
||||
return {};
|
||||
}
|
||||
|
||||
RichTextEditor.prototype.backup = function() {
|
||||
RichTextEditor.prototype.backup = function(currentValue) {
|
||||
var inputId = this.getInput().attr('id');
|
||||
var currentValue = this.editor.serialize();
|
||||
var isBackuped = typeof this.backupedValue !== 'undefined';
|
||||
|
||||
if (typeof currentValue === 'undefined') {
|
||||
currentValue = this.editor.serialize();
|
||||
}
|
||||
|
||||
if (!isBackuped && currentValue === '') {
|
||||
// Don't back up first empty value
|
||||
return;
|
||||
@ -132,6 +135,10 @@ humhub.module('ui.richtext.prosemirror', function(module, require, $) {
|
||||
}
|
||||
};
|
||||
|
||||
RichTextEditor.prototype.resetBackup = function() {
|
||||
this.backup('');
|
||||
}
|
||||
|
||||
RichTextEditor.prototype.focus = function() {
|
||||
this.editor.view.focus();
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user