Conform more code to strict null checking (#10169)

* Conform more code to strict null checking

* delint

* Iterate

* delint

* Fix bad test
This commit is contained in:
Michael Telatynski 2023-02-16 09:38:44 +00:00 committed by GitHub
parent 5123d7e641
commit e8b92b308b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
85 changed files with 283 additions and 287 deletions

View file

@ -190,6 +190,8 @@ function getTextAndOffsetToNode(editor: HTMLDivElement, selectionNode: Node): {
// get text value of text node, ignoring ZWS if it's a caret node
function getTextNodeValue(node: Node): string {
const nodeText = node.nodeValue;
if (!nodeText) return "";
// filter out ZWS for caret nodes
if (isCaretNode(node.parentElement)) {
// typed in the caret node, so there is now something more in it than the ZWS
@ -200,9 +202,9 @@ function getTextNodeValue(node: Node): string {
// only contains ZWS, which is ignored, so return empty string
return "";
}
} else {
return nodeText;
}
return nodeText;
}
export function getRangeForSelection(editor: HTMLDivElement, model: EditorModel, selection: Selection): Range {