@hocgin/selector-cursor
TypeScript icon, indicating that this package has built-in type declarations

0.0.3 • Public • Published

@hocgin/selector-cursor

可视化光标元素选择器

使用方式

import {useSelectable} from '@hocgin/selector-cursor';

export default () => {
  let selectable = useSelectable();

  return <div>
    <h1>hello world</h1>
    <p>hello world <a id='hocgin' href="https://logspot.hocgin.top">link</a></p>
    <p>hello world</p>
    <hr />
    <h1>control</h1>
    <vis-bug>
      <button onClick={(e) => selectable.disconnect()}>disconnect</button>
      <button onClick={(e) => selectable.connect()}>connect</button>
      <button onClick={selectable.unselect_all}>unselect_all</button>
      <button onClick={() => {
        let elements = selectable.selection();
        alert(`selectable element size:` + elements.length);
      }}>selection
      </button>
      <button onClick={() => {
        let link = document.getElementById("hocgin");
        if (!link) return;
        selectable.select(link)
      }}>select #hocgin
      </button>
    </vis-bug>
  </div>;
}

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
0.0.30latest

Version History

VersionDownloads (Last 7 Days)Published
0.0.30

Package Sidebar

Install

npm i @hocgin/selector-cursor

Weekly Downloads

0

Version

0.0.3

License

MIT

Unpacked Size

136 kB

Total Files

27

Last publish

Collaborators

  • hocgin