ScrapboxのCursorオブジェクトを取得する
吐き出せやオラッするやつ
code:script.js
export function getCursor() {
const textarea = document.getElementById("text-input");
const reactKey = Object.keys(textarea)
.find((key) => key.startsWith("__reactFiber"));
const input = textareareactKey.return.return.stateNode; const cursor = input._stores.find((obj) => obj.constructor.name === "Cursor");
const selection = input._stores.find((obj) =>
obj.constructor.name === "Selection"
);
const mobileSelection = input._stores.find((obj) =>
obj.constructor.name === "MobileSelection"
);
return {
cursor,
selection,
mobileSelection,
};
}