【文件属性】:
文件名称:get-selection-range-from-elm
文件大小:4KB
文件格式:ZIP
更新时间:2021-05-18 02:53:13
JavaScript
从榆木获得选择范围
window.getSelection()。rangeAt(0),但前提是它存在且在元素内
安装
如果尚未下载node,请从下载并安装。
npm install get-selection-range-from-elm --save
用法
import getSelectionRangeFromElm from 'get-selection-range-from-elm' ;
const range = getSelectionRangeFromElm ( document . querySelector ( '#foo' ) ) ;
console . log ( 'range is set if selection is within the element #foo' ) ;
console . log ( range . startContainer ) ;
【文件预览】:
get-selection-range-from-elm-master
----.gitignore(29B)
----.babelrc(28B)
----package.json(1KB)
----test.js(3KB)
----example.js(247B)
----lib()
--------index.js(298B)
----readme.md(2KB)
----.npmignore(34B)