From b307edac048152f6317904443e4b3b71e900aa64 Mon Sep 17 00:00:00 2001 From: OhKanghoon Date: Wed, 30 Jan 2019 11:48:57 +0900 Subject: [PATCH] Fix Invalid Merge Issue --- Example/VEditorKit.xcodeproj/project.pbxproj | 2 +- VEditorKit/Classes/VEditorNode.swift | 14 +++++++------- VEditorKit/Classes/VEditorParser.swift | 4 ++-- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Example/VEditorKit.xcodeproj/project.pbxproj b/Example/VEditorKit.xcodeproj/project.pbxproj index 21938e5..bb77ffe 100644 --- a/Example/VEditorKit.xcodeproj/project.pbxproj +++ b/Example/VEditorKit.xcodeproj/project.pbxproj @@ -71,7 +71,7 @@ 607FACEB1AFB9204008FA782 /* VEditorParserSpec.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VEditorParserSpec.swift; sourceTree = ""; }; 678C76B2ADE22C77779D368C /* LICENSE */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; name = LICENSE; path = ../LICENSE; sourceTree = ""; }; 9B3036D921F4162D00489340 /* UIImage+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIImage+Extension.swift"; sourceTree = ""; }; - 9B3036E121F41BAF00489340 /* MockService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = MockService.swift; path = /Users/vingle/Desktop/VEditorKit/Example/VEditorKit/Services/MockService.swift; sourceTree = ""; }; + 9B3036E121F41BAF00489340 /* MockService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MockService.swift; sourceTree = ""; }; 9B3036E421F41BBE00489340 /* XMLViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = XMLViewController.swift; sourceTree = ""; }; 9B3036E621F41BC800489340 /* EditorOpenGraphPlaceholder.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = EditorOpenGraphPlaceholder.swift; sourceTree = ""; }; 9B3036EA21F41C3800489340 /* VImageContent.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VImageContent.swift; sourceTree = ""; }; diff --git a/VEditorKit/Classes/VEditorNode.swift b/VEditorKit/Classes/VEditorNode.swift index dcfd61e..7d0c83e 100644 --- a/VEditorKit/Classes/VEditorNode.swift +++ b/VEditorKit/Classes/VEditorNode.swift @@ -198,9 +198,9 @@ open class VEditorNode: ASDisplayNode, ASTableDelegate, ASTableDataSource { .subscribe(onNext: { [weak self] indexPath in self?.editorContents.remove(at: indexPath.row) self?.tableNode.deleteRows(at: [indexPath], with: .automatic) - self?.mergeTextContents(target: .init(row: indexPath.row - 1, - section: indexPath.section), - to: indexPath, + self?.mergeTextContents(target: indexPath, + to: .init(row: indexPath.row - 1, + section: indexPath.section), animated: false) }) .disposed(by: cellNode.disposeBag) @@ -589,12 +589,12 @@ open class VEditorNode: ASDisplayNode, ASTableDelegate, ASTableDataSource { } // NOTE: make merged attributedText - var mutableAttrText = NSMutableAttributedString(attributedString: targetAttributedText) + var mutableAttrText = NSMutableAttributedString(attributedString: sourceAttributedText) var newlineAttribute = self.editorRule.defaultAttribute() newlineAttribute[VEditorAttributeKey] = [self.editorRule.defaultStyleXMLTag] mutableAttrText.append(NSAttributedString.init(string: "\n", attributes: newlineAttribute)) - mutableAttrText.append(sourceAttributedText) + mutableAttrText.append(targetAttributedText) // NOTE: update editor self.editorContents.remove(at: target.row) @@ -629,8 +629,8 @@ open class VEditorNode: ASDisplayNode, ASTableDelegate, ASTableDataSource { .nodeForRow(at: .init(row: indexPath.row, section: indexPath.section)) as? VEditorTextCellNode - guard let target = beforeCell?.indexPath, - let to = currentCell?.indexPath else { + guard let target = currentCell?.indexPath, + let to = beforeCell?.indexPath else { return } diff --git a/VEditorKit/Classes/VEditorParser.swift b/VEditorKit/Classes/VEditorParser.swift index 6165d65..6d75712 100644 --- a/VEditorKit/Classes/VEditorParser.swift +++ b/VEditorKit/Classes/VEditorParser.swift @@ -146,11 +146,11 @@ public final class VEditorParser: NSObject, XMLStyler { Editor Content Parser General pattern would be: - xml:

hello world

done>

+ xml:

hello world

done

will convert to - [0]:

hello world

- [1]: VEditorMediaContent - - [2]:

done>

+ - [2]:

done

*/ internal class VEditorContentParser: NSObject, XMLParserDelegate {