UEditor (1): Cancel the automatic save function

UEditor's auto-save is enabled by default. When editing, will a sentence "local save succeeded" pop up? It's annoying: I don't know where it is automatically saved locally, and it seems that I don't want to cancel this function. It's as simple as the legend says.

 

Searched from the Internet, there are basically three methods:

1. Modify ueditor.config.js, change enableAutoSave to false, and remove the previous comments . By default, this option is commented out, according to UEditor's statement: Commented out features are enabled. Therefore, remove the comment and change it to false, that is, cancel the automatic save function. Tested: this method is invalid ;

 

2. On the basis of the first one, modify ueditor.config.js, change the value of saveInterval a little larger or change it to 0, and remove the previous comments . saveInterval is the time for automatic saving. Setting it to a large value means that the automatic saving time is longer. Setting it to 0 seems to be infinite. But I set it to 0 locally (I have also tested setting a large value), and the result is still not canceled. This method doesn't work either.

 

3. This method is the most talked about on the Internet: modify ueditor.all.js and add code to the first line of the 'contentchange': function () {function: if (!me.getOpt('enableAutoSave')) {return ;} . Don't understand what this means but did. Two cases were tested:

The first one: remove both of the above-mentioned methods, that is, after restoring the initial values ​​of enableAutoSave and saveInterval, add this code (that is, only use this code, and the others remain unchanged ), or the "local" will pop up. Saved successfully" .

The second: remove the comment of enableAutoSave and set it to false, also remove the comment of saveInterval and set it to 0 , then add the above code , and then test, no longer pops up "local save successfully" .

 

So the final solution is:

1. In ueditor.config.js, the comment of enableAutoSave is removed and set to false, and the comment of saveInterval is also removed and set to 0;

2. Modify ueditor.all.js and add code to the first line of the 'contentchange': function () {function:

if (!me.getOpt('enableAutoSave')) {return;}

 

Source: http://1017401036.iteye.com/blog/2302967

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326218087&siteId=291194637