Overview
Comment:Warn before closing if something was changed
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk | stable
Files: files | file ages | folders
SHA3-256: 67ec1d5e2ae3aee31782c4715addfb78e1ef36366a1cdac854f0fdb373194e50
User & Date: bohwaz on 2023-04-11 15:02:14
Other Links: manifest | tags
Context
2023-04-14
20:51
Fix warning when saving check-in: 6d89abfad3 user: bohwaz tags: trunk, stable
2023-04-11
15:02
Warn before closing if something was changed check-in: 67ec1d5e2a user: bohwaz tags: trunk, stable
2023-04-08
18:18
Fix .htaccess check-in: d0bf35c790 user: bohwaz tags: trunk, stable, 1.2.8
Changes

Modified src/www/admin/static/scripts/code_editor.js from [8da523e07f] to [8c9eba9097].

25
26
27
28
29
30
31











32
33
34
35
36
37
38

		code.resetFile = function (e)
		{
			if (this.textarea.value == this.origValue) return;
			if (!window.confirm("Le fichier a été modifié, abandonner les modifications ?")) return;
			this.textarea.form.reset();
		};












		var help = document.createElement('div');
		help.className = 'sk_help';

		code.parent.appendChild(help);

		var toolbar = document.createElement('nav');







>
>
>
>
>
>
>
>
>
>
>







25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49

		code.resetFile = function (e)
		{
			if (this.textarea.value == this.origValue) return;
			if (!window.confirm("Le fichier a été modifié, abandonner les modifications ?")) return;
			this.textarea.form.reset();
		};

		// Warn before closing window if content was changed
		window.addEventListener('beforeunload', (e) => {
			if (code.textarea.value == code.textarea.defaultValue) {
				return;
			}

			e.preventDefault();
			e.returnValue = '';
			return true;
		}, { capture: true });

		var help = document.createElement('div');
		help.className = 'sk_help';

		code.parent.appendChild(help);

		var toolbar = document.createElement('nav');

Modified src/www/admin/static/scripts/web_editor.js from [aed47c8703] to [ad937511ec].

30
31
32
33
34
35
36











37
38
39
40
41
42
43
		var config = {
			fullscreen: t.textarea.getAttribute('data-fullscreen') == 1,
			attachments: t.textarea.getAttribute('data-attachments') == 1,
			savebtn: t.textarea.getAttribute('data-savebtn'),
			preview_url: t.textarea.getAttribute('data-preview-url'),
			format: t.textarea.getAttribute('data-format')
		};












		// Cancel Escape to close.value
		if (window.parent && window.parent.g.dialog) {
			// Always fullscreen in dialogs
			config.fullscreen = true;

			window.parent.g.dialog.preventClose = () => {







>
>
>
>
>
>
>
>
>
>
>







30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
		var config = {
			fullscreen: t.textarea.getAttribute('data-fullscreen') == 1,
			attachments: t.textarea.getAttribute('data-attachments') == 1,
			savebtn: t.textarea.getAttribute('data-savebtn'),
			preview_url: t.textarea.getAttribute('data-preview-url'),
			format: t.textarea.getAttribute('data-format')
		};

		// Warn before closing window if content was changed
		window.addEventListener('beforeunload', (e) => {
			if (t.textarea.value == t.textarea.defaultValue) {
				return;
			}

			e.preventDefault();
			e.returnValue = '';
			return true;
		}, { capture: true });

		// Cancel Escape to close.value
		if (window.parent && window.parent.g.dialog) {
			// Always fullscreen in dialogs
			config.fullscreen = true;

			window.parent.g.dialog.preventClose = () => {