You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by wa...@apache.org on 2022/11/06 08:28:29 UTC
[echarts-examples] branch gh-pages updated: fix(editor): no prompt if the code is not changed
This is an automated email from the ASF dual-hosted git repository.
wangzx pushed a commit to branch gh-pages
in repository https://gitbox.apache.org/repos/asf/echarts-examples.git
The following commit(s) were added to refs/heads/gh-pages by this push:
new 1abe2b4a fix(editor): no prompt if the code is not changed
1abe2b4a is described below
commit 1abe2b4a3c5d0c449360d9d34ddcf35f2f1d006a
Author: plainheart <yh...@all-my-life.cn>
AuthorDate: Sun Nov 6 16:27:17 2022 +0800
fix(editor): no prompt if the code is not changed
---
src/editor/Editor.vue | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/src/editor/Editor.vue b/src/editor/Editor.vue
index 14d622fb..cc0beccc 100644
--- a/src/editor/Editor.vue
+++ b/src/editor/Editor.vue
@@ -282,8 +282,11 @@ export default {
});
window.addEventListener('beforeunload', (e) => {
- // no repeated prompt if already confirmed
- if (window.__EDITOR_NO_LEAVE_CONFIRMATION__) {
+ // no repeated prompt if already confirmed or the code is not changed
+ if (
+ window.__EDITOR_NO_LEAVE_CONFIRMATION__ ||
+ store.sourceCode === this.initialCode
+ ) {
return;
}
// prevent the code from being lost accidentally due to refreshing or closing the page
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org