GithubHelp home page GithubHelp logo

rangee's People

Contributors

lukasrada avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

codedem asjir

rangee's Issues

Does not work with Vite and incorrectly spelled functions in production build

When I try to import this package with Vite, I get the following error:

[plugin:vite:import-analysis] Failed to resolve entry for package "rangee". The package may have incorrect
main/module/exports specified in its package.json: Failed to resolve entry for package "rangee". The package may have
incorrect main/module/exports specified in its package.json.

Correct npm publish

For using in production environment is needed to have clean & useable output (/dist).

Is webpack really need? Maybe only for demo.

Refactor API for different kind of serialization

Serialization of Range is determined by selector value relatively to body element.
Deserialization should return Range with same values (startContainer, startOffset, endContainer, endOffeset).

Moreover there should be serialization of range where no inner range contains any HTML element. Thus range must contains only text nodes. It requires to walk the DOM tree and to array these atomic ranges.

Thus: Atomic range => range only with text nodes.

Then these atomic ranges can be serialized and deserialized back.

Better compression

When serializing content of the demo atomic:
xZrBjtowEIbfJadWYqV4PHG8HPIwYFagIkK7caUV5d2XLRzqgMgl3/SSQxTN78znsX9ncqreq+Xp61Kt+vTRvW/Ww64/LA/D9qV/exk+jptv8r1Lu9/FLb2/dXlqK9WiWlfLelH1l+t5UW2o4Nqez39OMw7+GlyAkf8b+XXmUXdHMONFbBdk9rF3K3L0ZfSmgVIvYOqvsR0y1RWb6spM9X4PzpYyuPPzD77b79Dxj+K3kcq/kPkXMv8PZyuH44mcqx2FR0k8aobH2+Ip5ZpA0QkknWBGR23p6Kh4hMITSTzRDE9ji6eUE4yOQ7d+V5vxCbZ8SrlWMT6oNXDMEYpbl4tFuZ476Zm0wxm2wxm2w3fx5z/+ZdIOZ9gOZ1s7PCXXYnSUpKNmdLwtnVIuKkUnkHSCGR21pTNywy5QeCKJJ5rhaWzxNLDbyqgbzrQbzrZueEruFasehzoD1A1HzA1HyA1vPdl68uXnhwZJOlLPRej5u092FvKZlG/pF2M7VU/FtLWhJnbUrlJC1RHXxIUW3W6179c/fuZ+2IDT7LGIU89Q4PqLt9DAJiJ269lTLQ8x4b5y3ULDO4y322E8/E17rGa4w4zFvBE1saN2W6cNqP0vBzShrY0NU7VjquDPMI478dxCz97vP/4izcIoujhl/rfjzjxSQy4hkY2XBDde0r5LQ5feDug7PNAQR3EQkoOAHBLMILH/gyWyxZLgFsvfOXp3ky+LCUmHUQokpUBWiZ3DmpLzStGJJJ1oVkPevobuJV1LUXLolu9qsyrytlVUyoWLE/gE
That is 796 chars.

I think it should be better.

Fails when Range starts at top of the HTML body

Fails when range.commonAncestorContainer == range.startContainer in index.ts. startFound is always False.

An example of when this happens is selecting the range at the top of this page to the end.

<html>
   <head>
      <meta content="text/html; charset=UTF-8" http-equiv="content-type">
      <script src="script.js" type="module"></script>
   </head>
   <body class="whatever">
      <br/>
      <br/>
      start
      <span>end</span>
   </body>
</html>

Naive fix: (not sure if there are side effects, still testing)

Change:

let node: Node | null;
while (node = treeWalker.nextNode()) {
...
}

To:

let node = treeWalker.root;
do {
...
} while (node = treeWalker.nextNode());

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.