Skip to content

Commit

Permalink
fbobjc/Libraries/Lexical
Browse files Browse the repository at this point in the history
Reviewed By: wasdkhan

Differential Revision: D52997293

fbshipit-source-id: 340edc8ce5d1e580f2ad9e884fdccaab899286dd
  • Loading branch information
generatedunixname89002005287564 authored and facebook-github-bot committed Jan 23, 2024
1 parent 9c1e256 commit 31839cb
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
7 changes: 3 additions & 4 deletions Lexical/Core/Selection/SelectionUtils.swift
Original file line number Diff line number Diff line change
Expand Up @@ -585,7 +585,7 @@ private func resolveSelectionPointOnBoundary(
point.offset = prevSibling.getTextContent().lengthAsNSString()
}
} else if
(isCollapsed || !isBackward),
isCollapsed || !isBackward,
prevSibling == nil,
let parent,
parent.isInline() {
Expand All @@ -604,12 +604,11 @@ private func resolveSelectionPointOnBoundary(
point.offset = 0
point.type = .element
} else if
(isCollapsed || isBackward),
isCollapsed || isBackward,
nextSibling == nil,
let parent,
parent.isInline(),
!parent.canInsertTextAfter()
{
!parent.canInsertTextAfter() {
let parentSibling = parent.getNextSibling()
if let parentSibling = parentSibling as? TextNode {
point.key = parentSibling.key
Expand Down
2 changes: 1 addition & 1 deletion Lexical/Helper/SelectionHelpers.swift
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ public func cloneContents(selection: RangeSelection) throws -> (
var nodesLength = nodes.count
let firstNode = nodes[0]
if let firstNodeParent = firstNode.getParent(),
(!firstNodeParent.canBeEmpty() || isRootNode(node: firstNodeParent)) {
!firstNodeParent.canBeEmpty() || isRootNode(node: firstNodeParent) {
let parentChildren = firstNodeParent.children
let parentChildrenLength = parentChildren.count
if parentChildrenLength == nodesLength {
Expand Down
2 changes: 1 addition & 1 deletion Lexical/TextKit/RangeCache.swift
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ private func updateNodeLocationFor(nodeKey: NodeKey, nodeIsAfterChangedNode: Boo

var isAfterChangedNode = nodeIsAfterChangedNode

if let elementNode = getNodeByKey(key: nodeKey) as? ElementNode, (isAfterChangedNode || changedNodeParents.contains(nodeKey)) {
if let elementNode = getNodeByKey(key: nodeKey) as? ElementNode, isAfterChangedNode || changedNodeParents.contains(nodeKey) {
for child in elementNode.getChildren() {
updateNodeLocationFor(nodeKey: child.getKey(), nodeIsAfterChangedNode: isAfterChangedNode, changedNodeKey: changedNodeKey, changedNodeParents: changedNodeParents, delta: delta)
if child.getKey() == changedNodeKey || changedNodeParents.contains(child.getKey()) {
Expand Down

0 comments on commit 31839cb

Please sign in to comment.