Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions browser/dom/caret.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export interface CaretInfo {
/** 選択範囲の位置 */ selectionRange: Range;
}

interface ReactInternalInstance {
interface ReactFiber {
return: {
return: {
stateNode: {
Expand All @@ -48,15 +48,15 @@ export function caret(): CaretInfo {
}

const reactKey = Object.keys(textarea)
.find((key) => key.startsWith("__reactInternalInstance"));
.find((key) => key.startsWith("__reactFiber"));
if (!reactKey) {
throw Error(
"div.cursor must has the property whose name starts with `__reactInternalInstance`",
'div.cursor must has the property whose name starts with "__reactFiber"',
);
}

// @ts-ignore DOMを無理矢理objectとして扱っている
return (textarea[
reactKey
] as ReactInternalInstance).return.return.stateNode.props;
] as ReactFiber).return.return.stateNode.props;
}