@kaitify/core 0.0.1-beta.21 → 0.0.1-beta.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3240,11 +3240,8 @@ const onComposition = async function(e) {
3240
3240
  } else if (event2.type == "compositionend") {
3241
3241
  const realSelection = window.getSelection();
3242
3242
  const range = realSelection.getRangeAt(0);
3243
- let element2 = range.endContainer;
3244
- if (element2.nodeType != 3) {
3245
- element2 = range.endContainer.childNodes[range.endOffset > 0 ? range.endOffset - 1 : range.endOffset];
3246
- }
3247
- const parentElement = element2.parentNode;
3243
+ const element2 = range.endContainer.nodeType == 3 ? range.endContainer : range.endContainer.childNodes[range.endOffset > 0 ? range.endOffset - 1 : 0];
3244
+ const parentElement = element2.parentElement;
3248
3245
  const parentNode = this.findNode(parentElement);
3249
3246
  if (parentNode.isText() && parentNode.textContent != element2.textContent) {
3250
3247
  const textContent = parentNode.textContent || "";