* Process paste of single Block tool content * * @param {PasteData} dataToInsert - data of Block to insert
(dataToInsert: PasteData)
| 742 | * @param {PasteData} dataToInsert - data of Block to insert |
| 743 | */ |
| 744 | private async processSingleBlock(dataToInsert: PasteData): Promise<void> { |
| 745 | const { Caret, BlockManager } = this.Editor; |
| 746 | const { currentBlock } = BlockManager; |
| 747 | |
| 748 | /** |
| 749 | * If pasted tool isn`t equal current Block or if pasted content contains block elements, insert it as new Block |
| 750 | */ |
| 751 | if ( |
| 752 | !currentBlock || |
| 753 | dataToInsert.tool !== currentBlock.name || |
| 754 | !$.containsOnlyInlineElements(dataToInsert.content.innerHTML) |
| 755 | ) { |
| 756 | this.insertBlock(dataToInsert, currentBlock?.tool.isDefault && currentBlock.isEmpty); |
| 757 | |
| 758 | return; |
| 759 | } |
| 760 | |
| 761 | Caret.insertContentAtCaretPosition(dataToInsert.content.innerHTML); |
| 762 | } |
| 763 | |
| 764 | /** |
| 765 | * Process paste to single Block: |
no test coverage detected