Overview
Comment:Rename pasted file name to avoid overwriting
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk | stable
Files: files | file ages | folders
SHA3-256: 7999b97d74d2e27ec792dcd32716431ca87fa7f05eaaba4189b5f5b9d41e872d
User & Date: bohwaz on 2021-11-12 13:56:01
Other Links: manifest | tags
Context
2021-11-14
15:50
Fix install process error check-in: 6bcb85b72d user: bohwaz tags: trunk, stable
14:50
Create new branch named "emails" check-in: b62fc8b2fa user: bohwaz tags: emails
14:45
Merge trunk check-in: b74facc72e user: bohwaz tags: templates
2021-11-12
13:56
Rename pasted file name to avoid overwriting check-in: 7999b97d74 user: bohwaz tags: trunk, stable
13:47
Support image paste in file upload forms! check-in: 120573e20b user: bohwaz tags: trunk, stable
Changes

Modified src/www/admin/static/scripts/file_input.js from [e93fe558f3] to [c1bd753cc3].

194
195
196
197
198
199
200
201



202
203
204
205
206
207
208
209
210
211
212
213
214
			const IMAGE_MIME_REGEX = /^image\/(p?jpeg|gif|png)$/i;

			document.addEventListener('paste', (e) => {
				let items = e.clipboardData.items;

				for (var i = 0; i < items.length; i++) {
					if (IMAGE_MIME_REGEX.test(items[i].type)) {
						addItem(items[i].getAsFile());



						return;
					}
				}

				e.preventDefault();
			});
		}
	};

	document.querySelectorAll('input[type=file][data-enhanced]').forEach((e) => {
		enhanceFileInput(e);
	});
}());







|
>
>
>













194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
			const IMAGE_MIME_REGEX = /^image\/(p?jpeg|gif|png)$/i;

			document.addEventListener('paste', (e) => {
				let items = e.clipboardData.items;

				for (var i = 0; i < items.length; i++) {
					if (IMAGE_MIME_REGEX.test(items[i].type)) {
						let f = items[i].getAsFile();
						let name = f.name.replace(/\./, '-' + (+(new Date)) + '.');
						let f2 = new File([f], name, {type: f.type});
						addItem(f2);
						return;
					}
				}

				e.preventDefault();
			});
		}
	};

	document.querySelectorAll('input[type=file][data-enhanced]').forEach((e) => {
		enhanceFileInput(e);
	});
}());