We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Saving on browser back or refresh

Thread ID:

Created:

Updated:

Platform:

Replies:

149290 Nov 20,2019 07:18 PM UTC Nov 21,2019 11:50 AM UTC Blazor 1
loading
Tags: In-place Editor
Ivan Petrov
Asked On November 20, 2019 07:18 PM UTC

Hello,

How can I save the content of the editor when somebody clicks the browser back or refresh. Currently, when I click outside of the component it saves the new value, however that is not true for the mentioned cases.

Krasimir

Pandiyaraj Muniyandi [Syncfusion]
Replied On November 21, 2019 11:50 AM UTC

Hi Krasimir, 
 
Greetings from Syncfusion support. 
 
We have validated your requirement and its default functionality of browser. We can achieve this requirement from application end by calling In-place Editor - save() public method in JavaScript window.onbeforeunload event callback as follows. 
 
 
Note: onbeforeunload trigger when leaving from current page (refresh too). 
 
Index.js 
 
Add index.js file with below code blocks and save it in wwwroot folder of your application. Then add this JS file reference into _host.cshtml 
 
 
window.onbeforeunload = function () { 
    var editorObj = document.getElementById('TextEditor').ej2_instances[0]; 
    if (editorObj.enableEditMode) { // To ensure whether editor in ediable mode 
        editorObj.save(); // Save the editor current value 
    } 
}; 
 
 
We have prepared sample for your reference, get it from below link 
 
Regards, 
Pandiyaraj 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon