Hello,
I have implemented functions for the inplace editor so I can save the content on browser close or reload. However, it seems that the newer versions have broken it. The code is the following:
- The component
<SfInPlaceEditor Mode=RenderMode.Inline
ID="TextEditor"
Type=InputType.RTE
EditableOn=EditableType.Click
SubmitOnEnter="true"
EmptyText="No information provided yet."
Name="RTE"
TValue="string"
Model="@RteModel">
<InPlaceEditorEvents TValue="string" OnActionSuccess=@(async e => {
this.Description = e.Value.ToString();
await this.SaveAsync();
})>
</InPlaceEditorEvents>
</SfInPlaceEditor>
-the js code
window.onbeforeunload = function () {
var textEditor = document.getElementById('TextEditor');
if (!textEditor) {
return;
}
var editorObj = textEditor_instances[0];
if (editorObj.enableEditMode) { // To ensure whether editor in editable mode
editorObj.save(); // Save the editor current value
}
};
window.addEventListener('popstate', function (event) {
var editorObj = document.getElementById('TextEditor')_instances[0];
if (editorObj.enableEditMode) { // To ensure whether editor in ediable mode
editorObj.save(); // Save the editor current value
}
}, false);