Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Copy paste image in visual editor doesn't work - no attachment saved. #102

Open
pr-dtakac opened this issue Jan 9, 2023 · 0 comments
Open

Comments

@pr-dtakac
Copy link

Hi,
when I paste image in visual editor, image is broken and there is no attachment after issue save.
I found the bug in javascript, where only inputs from dynamic edit field are submitted.
After this change it works. Can you check it and fix it? Thanks a lot.

--- a/assets/javascripts/issue_dynamic_edit.js
+++ b/assets/javascripts/issue_dynamic_edit.js
@@ -235,9 +235,13 @@ document.querySelector('body').addEventListener('click', function(e){
 	if(e.target.matches('.dynamicEditField .action.valid') || e.target.closest('.dynamicEditField .action.valid')){
 		e.preventDefault();
 		let inputs = e.target.closest('.dynamicEditField').querySelectorAll('*[name]');
+		let fileInputs = document.querySelectorAll('#new-attachments .attachments_fields *[name]');
+		let allInputs = [];
+		allInputs.push.apply(allInputs, inputs);
+		allInputs.push.apply(allInputs, fileInputs);
 		let formData = [];
 		let existingIndex = [];
-		inputs.forEach(elt => {
+		allInputs.forEach(elt => {
 			let not_multiple = !elt.matches('input[type="radio"]') && !elt.matches('input[type="checkbox"]');
 			if(elt.matches('input[type="radio"]:checked') || elt.matches('input[type="checkbox"]:checked') || not_multiple){
 				if(!existingIndex.includes(elt.getAttribute('name'))){
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant