Repository: ianstormtaylor/slate
File: packages/slate-react/src/components/editable.tsx (TypeScript)

Code before:
              if (
                hasEditableTarget(editor, event.target) &&
                !isEventHandled(event, attributes.onCompositionStart)
              ) {
                const { selection, marks } = editor
                if (selection) {
                  if (Range.isExpanded(selection)) {
                    Editor.deleteFragment(editor)
                  } else {
                    const inline = Editor.above(editor, {
                      match: n => Editor.isInline(editor, n),
                      mode: 'highest',
                    })
                    if (inline) {
                      const [, inlinePath] = inline
                      if (Editor.isEnd(editor, selection.anchor, inlinePath)) {
                        const point = Editor.after(editor, inlinePath)!
                        Transforms.setSelection(editor, {
                          anchor: point,
                          focus: point,
                        })
                      }
                    }
                    // insert new node in advance to ensure composition text will insert
                    // along with final input text
                    // and add prefix text to avoid this node removed by normalize
                    if (marks) {
                      state.hasInsertPrefixInCompositon = true
                      Transforms.insertNodes(
                        editor,
                        {
                          text: '\uFEFF',
                          ...marks,
                        },
                        {
                          select: true,
                        }
                      )
                    }
                  }
                }
              }
            },
            [attributes.onCompositionStart]
          )}
          onCopy={useCallback(
            (event: React.ClipboardEvent<HTMLDivElement>) => {
              if (
                hasEditableTarget(editor, event.target) &&
                !isEventHandled(event, attributes.onCopy)
              ) {

Review comment (suggestion):
```suggestion
                    // add Unicode BOM prefix to avoid normalize removing this node
```

Code after:
              if (
                hasEditableTarget(editor, event.target) &&
                !isEventHandled(event, attributes.onCompositionStart)
              ) {
                const { selection, marks } = editor
                if (selection) {
                  if (Range.isExpanded(selection)) {
                    Editor.deleteFragment(editor)
                    return
                  }
                  const inline = Editor.above(editor, {
                    match: n => Editor.isInline(editor, n),
                    mode: 'highest',
                  })
                  if (inline) {
                    const [, inlinePath] = inline
                    if (Editor.isEnd(editor, selection.anchor, inlinePath)) {
                      const point = Editor.after(editor, inlinePath)!
                      Transforms.setSelection(editor, {
                        anchor: point,
                        focus: point,
                      })
                    }
                  }
                  // insert new node in advance to ensure composition text will insert
                  // along with final input text
                  // add Unicode BOM prefix to avoid normalize removing this node
                  if (marks) {
                    state.hasInsertPrefixInCompositon = true
                    Transforms.insertNodes(
                      editor,
                      {
                        text: '\uFEFF',
                        ...marks,
                      },
                      {
                        select: true,
                      }
                    )
                  }
                }
              }
            },
            [attributes.onCompositionStart]
          )}
          onCopy={useCallback(
            (event: React.ClipboardEvent<HTMLDivElement>) => {
              if (
                hasEditableTarget(editor, event.target) &&
                !isEventHandled(event, attributes.onCopy)
              ) {