fix focus and too many <p>s after a Event>Quote in RT mode
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>pull/21833/head
							parent
							
								
									6a0182a653
								
							
						
					
					
						commit
						020e714b85
					
				|  | @ -387,17 +387,28 @@ export default class MessageComposerInput extends React.Component { | |||
|                     const anchorText = editorState.anchorText; | ||||
|                     if ((!anchorText || anchorText.text === '') && editorState.anchorBlock.nodes.size === 1) { | ||||
|                         // replace the current block rather than split the block
 | ||||
|                         // XXX: this destroys our focus by deleting the thing we are anchored/focused on
 | ||||
|                         change = change.replaceNodeByKey(editorState.anchorBlock.key, quote); | ||||
|                     } | ||||
|                     else { | ||||
|                     } else { | ||||
|                         // insert it into the middle of the block (splitting it)
 | ||||
|                         change = change.insertBlock(quote); | ||||
|                     } | ||||
|                     change = change.insertFragmentByKey(quote.key, 0, fragment.document) | ||||
|                                    .focus(); | ||||
| 
 | ||||
|                     // XXX: heuristic to strip out wrapping <p> which breaks quoting in RT mode
 | ||||
|                     if (fragment.document.nodes.size && fragment.document.nodes.get(0).type === DEFAULT_NODE) { | ||||
|                         change = change.insertFragmentByKey(quote.key, 0, fragment.document.nodes.get(0)); | ||||
|                     } else { | ||||
|                         change = change.insertFragmentByKey(quote.key, 0, fragment.document); | ||||
|                     } | ||||
| 
 | ||||
|                     // XXX: this is to bring back the focus in a sane place and add a paragraph after it
 | ||||
|                     change = change.select({ | ||||
|                         anchorKey: quote.key, | ||||
|                         focusKey: quote.key, | ||||
|                     }).collapseToEndOfBlock().insertBlock(Block.create(DEFAULT_NODE)).focus(); | ||||
| 
 | ||||
|                     this.onChange(change); | ||||
|                 } | ||||
|                 else { | ||||
|                 } else { | ||||
|                     let fragmentChange = fragment.change(); | ||||
|                     fragmentChange.moveToRangeOf(fragment.document) | ||||
|                                   .wrapBlock(quote); | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	 Michael Telatynski
						Michael Telatynski