Workaround for browser bugs in Range.prototype.getClientRects and Range.prototype.getBoundingClientRect.
In particular:
There are no known issues in Edge. When no issues are detected the library will fall through to native behaviour.
$ npm install rangefix
CommonJS
var RangeFix = require( 'rangefix' );
AMD
define( [ 'rangefix' ], function ( Rangefix ) {
// ...
} );
Browser global
<script src="https://github.com/edg2s/rangefix/raw/0.3.0/path/to/rangefix.js"></script>
API
Replace instances of Range.prototype.getClientRects/getBoundingClientRect with RangeFix.getClientRects/getBoundingClientRect:
var range = document.getSelection().getRangeAt( 0 );
// Before
var rects = range.getClientRects();
var boundingRect = range.getBoundingClientRect();
// After
var rects = RangeFix.getClientRects( range );
var boundingRect = RangeFix.getBoundingClientRect( range );
http://edg2s.github.io/rangefix/
$ claude mcp add rangefix \
-- python -m otcore.mcp_server <graph>