You've already forked joplin
							
							
				mirror of
				https://github.com/laurent22/joplin.git
				synced 2025-10-31 00:07:48 +02:00 
			
		
		
		
	Clipper: Fixes #2294: Clipping selection in some cases would not work, when that selection contains multiple code blocks
This commit is contained in:
		| @@ -325,9 +325,18 @@ | ||||
|  | ||||
| 			hardcodePreStyles(document); | ||||
| 			preProcessDocument(document); | ||||
| 			const range = window.getSelection().getRangeAt(0); | ||||
|  | ||||
| 			const container = document.createElement('div'); | ||||
| 			container.appendChild(range.cloneContents()); | ||||
| 			const rangeCount = window.getSelection().rangeCount; | ||||
|  | ||||
| 			// Even when the user makes only one selection, Firefox might report multiple selections | ||||
| 			// so we need to process them all. | ||||
| 			// Fixes https://github.com/laurent22/joplin/issues/2294 | ||||
| 			for (let i = 0; i < rangeCount; i++) { | ||||
| 				const range = window.getSelection().getRangeAt(i); | ||||
| 				container.appendChild(range.cloneContents()); | ||||
| 			} | ||||
|  | ||||
| 			const imageSizes = getImageSizes(document, true); | ||||
| 			const imageIndexes = {}; | ||||
| 			cleanUpElement(convertToMarkup, container, imageSizes, imageIndexes); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user