profile
viewpoint
If you are wondering where the data of this site comes from, please visit https://api.github.com/users/jhchen/events. GitMemory does not store any data, but only uses NGINX to cache data for a period of time. The idea behind GitMemory is simply to give users a better reading experience.

jhchen/fast-diff 476

A fast Javascript string diff

jhchen/ansize 280

Convert images to binary ANSI art

dbackowski/socket.io-rails 57

Rails asset pipeline wrapper for socket.io

jhchen/grunt-haml2html 26

Compile Haml to HTML

jhchen/Search-Engine-Blacklist 6

Easily blacklist spam sites from ever appearing in your Google search results again.

dbackowski/async-rails 2

Rails asset pipeline wrapper for async.js

swwu/tzconverter 1

Simple webpage that converts time across timezones/gives offsets

anurag/quill 0

Quill is a modern WYSIWYG editor built for compatibility and extensibility.

jhchen/algolia-elixir 0

Elixir implementation of Algolia search API

jhchen/echo-server 0

An HTTP and WebSocket "echo" server for testing proxies and HTTP clients.

pull request commentquilljs/delta

Remove `package-lock.json`

You can see in the commit history it is not an accident. I agree with the top commenter on that blog post who is a maintainer of yarn that one should always commit package-lock.json for the reason he gives. This is also in addition to official NPM docs which that blog posts tries to spin as a source of confusion.

alecgibson

comment created time in 4 days

issue closedquilljs/delta

Feature request: Delta interface

It would be nice to have a Delta interface in addition to the class. That way, we could describe existing serialized data accurately, without having to create class instances.

As far as I understand this; such an interface could be as simple as:

interface QuillDelta {
 ops: Op[];
}

Does this exist somewhere already?

closed time in 7 days

dsebastien

issue commentquilljs/delta

Feature request: Delta interface

This is too small of an interface (we even just inline in delta.ts) to be helpful enough to support and maintain.

dsebastien

comment created time in 7 days

PR closed quilljs/delta

Remove `package-lock.json`

package-lock.json is not published, so it shouldn't be committed in packages, since running a build with a lockfile will not give a true representation of how a consumer would be installing dependencies.

+2 -5544

2 comments

3 changed files

alecgibson

pr closed time in 7 days

pull request commentquilljs/delta

Remove `package-lock.json`

I don't believe this is best practice. Please cite sources to the contrary.

alecgibson

comment created time in 7 days

push eventquilljs/delta

Jason Chen

commit sha d7a3be9292e92ba3837803b49e482b96487ae7a9

update syntax

view details

push time in 9 days

issue commentquilljs/delta

Circular dependency between Op and Iterator

https://github.com/quilljs/delta/pull/58 was manually merged

stigi

comment created time in 9 days

issue closedquilljs/delta

Circular dependency between Op and Iterator

Hi there,

I'm using quill-delta (version 4.2.2) in a react native app (version 0.62.2), as a format for rich text editing.

During bundle time I'm getting the following warning:

Require cycle: node_modules/quill-delta/dist/Op.js -> node_modules/quill-delta/dist/Iterator.js -> node_modules/quill-delta/dist/Op.js

And looking at the code it's clear to see that the two files are importing from each other.

Would it be possible to get rid of Op.iterator and calling new Iterator(ops) directly from delta.ts?

closed time in 9 days

stigi

PR closed quilljs/delta

Preventing cyclic dependency by inlining Op.iterator

Fixes #57 by inlining Op.iterator.

This PR also extracts the iterator tests into their own file.

One question open question: Delta.Op.Iterator was part of the public API of this module, even though not mentioned in the Readme. It got replaced by Delta.Iterator, but not sure if this is considered a breaking change. I checked the main quill sources wether it's been accessed and also did a GitHub Search, and only one place turned up, so I guess we're pretty safe.

Testplan

npm run testnpm run lint

+113 -114

3 comments

4 changed files

stigi

pr closed time in 9 days

pull request commentquilljs/delta

Preventing cyclic dependency by inlining Op.iterator

This has been merged https://github.com/quilljs/delta/commit/8c4d16ea7e8c8480d103694f3ddc15d06f04598b - thanks!

stigi

comment created time in 9 days

push eventquilljs/delta

Ullrich Schäfer

commit sha 8bd415359560382cc89d2f3186d91d5f14d1a8b1

Inlining Op.iterator

view details

Ullrich Schäfer

commit sha 8c4d16ea7e8c8480d103694f3ddc15d06f04598b

Extracting iterator tests

view details

Jason Chen

commit sha 94459620d67dc3e5fe1a5f6dbb5cb9a7641783cd

rename Iterator to OpIterator no longer scoped to Op

view details

push time in 9 days

PR closed quilljs/delta

Support complex / deep / nested attributes

This change adds support for complex attributes, which might have arbitrarily nested properties:

{
  "insert": "some text",
  "attributes": {
    "complexAttribute": {
      "prop1": {
        "subPropA": "a",
        "subPropB": 2
      },
      "prop2": true
    }
  }
}

Motivation

The particular use case with which this was written in mind is the addition of comments to Quill. That is, the ability to select part of a document, and add some extra information about that selection.

Comments can be applied to arbitrary content, so cannot be represented as an embed (for example). They naturally belong to the attributes:

{
  "insert": "This text is commented",
  "attributes": {
    "comment": "comment-id"
  }
}

The issue with comments is that multiple comments may exist on the same range:

{
  "insert": "this text is commented",
  "attributes": {
    "comment": {
      "comment-id-1": true,
      "comment-id-2": true
    }
  }
}

These cannot be "flattened", because the IDs are arbitrary strings, which:

  • could collide with other attributes who rely on IDs like this
  • does not map neatly to a Quill attributor / blot

Any other metadata-like attributes may also benefit from this sort of deeply nested structure. For example, a naive git-blame-like feature might look like:

{
  "insert": "\n",
  "attributes": {
    "blame": {
      "hash1": {
        "author": "Alec Gibson",
        "timestamp": 1582123032,
      }
    }
  }
}

Implementation

This change adds support to all of compose, diff, invert and transform for complex attributes.

The implementation is recursive, and each depth of attributes is treated similarly to the top level. In particular:

  • null will remove a property
  • an empty object is treated as null
const attributes = {complex: {foo: 123}}
const update = {complex: {foo: null}}
AttributeMap.compose(attributes, update) // => undefined

Arrays

Note that arrays are out-of-scope of this change. Their behaviour is not well defined when composing deltas together, and they are treated as if they are primitive values (ie they directly overwrite one another, rather than attempt a deep change).

Quill integration

Quill will not natively support these changes, and further work will be required if this capability is to be adopted there. Given that Quill v2 is currently in development, this may be a good time to do this work, if desirable.

In particular:

  • format() methods need to compose values rather than simply overwrite
  • merge() methods need to perform deep equality checks, rather than object reference checks

Note that Quill can currently support these complex attributes, but only with blots that override the above methods.

Backwards compatibility

This change is not technically backwards-compatible. If anyone is already using deeply nested attributes and relying on the current all-or-nothing behaviour, then this change will break their code.

+249 -3

5 comments

2 changed files

alecgibson

pr closed time in 9 days

pull request commentquilljs/delta

Support complex / deep / nested attributes

I appreciate the effort here, especially the numerous tests but spec changes should be discussed with alternative solutions considered and weighed. The issues with this proposals at the moment:

  • Unclear what "support" means. Delta attributes can be arbitrary objects. It seems there is some sort of merging behavior that is actually what is desired but this is not specified.
  • Overlapping comments can be implemented already. I've more commonly seen this using arrays but the example {"comment-id-1": true, "comment-id-2": true}. Again some sort of merging behavior seems to be what is actually desired but is unspecified.
alecgibson

comment created time in 9 days

issue closedquilljs/delta

How to find the effective length of a Delta

I want to allow the user to paste the contents of one quill editor to another, and the pasted contents is block-quoted with a reference header. The code (typescript in angular) looks like this:

      const header = new Delta().insert('The following is a quote from xxxx\n', 'blockquote');
      const cursor = this.editor.getSelection();
      const start = cursor ? cursor.index : 0;
      const paste = wbe.editor.getContents(wbe.selection.index, wbe.selection.length);
      const delta = new Delta().retain(cursor.index).concat(header).concat(paste);
      this.editor.updateContents(delta, 'api');
      const length = delta.length();    // this is not the right value
      this.editor.setSelection(start, length);
      this.editor.format('blockquote', 'true');

The length() function doesn't return what I want, which is the number of inserted characters. Is there a function that does this or do I have to iterate through the delta to count them?

closed time in 9 days

AlanObject

push eventquilljs/delta

luin

commit sha 493096870a5e2ab08463076fc210714f561026a9

Remove unused lint rules These rules that make linter looser are not used so can just remove them. We can add them back when they become necessary. The only usage of `any` is `AttributeMap`. This PR changes it to `unknown`, which can represent any types like `any` but requires type assertions or control flow based narrowing. It can be considered as a type-safe version of `any` and as a library, it's better to use it instead of `any` to avoid users from writing type-unsafe code. However, this introduces a breaking change for TypeScript users as they have to change their code to either narrowing the types explicitly or using `as any` as we currently do for them.

view details

push time in 15 days

delete branch quilljs/delta

delete branch : zh-remove-unused-rules

delete time in 15 days

PR merged quilljs/delta

Remove unused lint rules

These rules that make linter looser are not used so can just remove them. We can add them back when they become necessary.

Breaking changes

The only usage of any is AttributeMap. This PR changes it to unknown, which can represent any types like any but requires type assertions or control flow based narrowing. It can be considered as a type-safe version of any and as a library, it's better to use it instead of any to avoid users from writing type-unsafe code.

However, this introduces a breaking change for TypeScript users as they have to change their code to either narrowing the types explicitly or using as any as we currently do for them.

Test plan

Make sure lint passes.

+2 -10

1 comment

2 changed files

luin

pr closed time in 15 days

push eventquilljs/delta

luin

commit sha e41f8194880121354624bd7964c02f3e8c80b87d

Set target to ES2015 This is a breaking change as it drops the support for IE 11.

view details

luin

commit sha 2f10d41e913edb6de67e76b95b531cc3705ae483

Use ESM export statement We used `export = Delta` until this change to keep compatible with Node.js. However, this requires `esModuleInterop` to be enabled on the user side. This changes make it use the export statement of ESM/TypeScript, and to keep compatible with Node.js, it also replace to `module` if present. With this change, this module should work with Node.js and TypeScript (no matter the value of `esModuleInterop`).

view details

push time in 15 days

delete branch quilljs/delta

delete branch : zh-target

delete time in 15 days

PR merged quilljs/delta

Set target to ES2015

This is a breaking change as it drops the support for IE 11 and (very) old Node.js versions.

Coverage decreasing was due to the way Coveralls calculates coverage internally so I think can ignore it.

+22 -2

1 comment

4 changed files

luin

pr closed time in 15 days

issue closedquilljs/delta

Release the package as es6 module

I'm using the package in my Angular application and I get this warning during build time:

Warning: C:\Projects\...\my-file.ts depends on 'quill-delta'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

Tools like webpack reasonably prefer es6 module format for packages that are to be used in the browser. It would be nice if quill-delta adhered to that as well.

closed time in 16 days

Maximaximum

push eventquilljs/delta

Zihua Li

commit sha 21bcea633dc5ad85cf276bebaecc259e82676040

Migrate to GitHub actions (#71)

view details

push time in 16 days

PR merged quilljs/delta

Migrate to GitHub actions

Migrate to GitHub actions as it looks promising. Also, Travis shut down .org version.

+30 -806

1 comment

5 changed files

luin

pr closed time in 16 days

push eventquilljs/delta

Jason Chen

commit sha 7e630a0874d44607e2ce20df563da97d7fa56e2b

move inserts before deletes in examples delta normally will do this automatically

view details

push time in 17 days

pull request commentquilljs/delta

Updating dependencies to resolve vulnerabilities

Thanks for the PR!

andyjdavis

comment created time in 17 days

PR merged quilljs/delta

Updating dependencies to resolve vulnerabilities

When I installed this locally npm reported this '25 vulnerabilities (10 low, 2 moderate, 11 high, 2 critical)'

After updating all dependencies the situation has improved. '10 vulnerabilities (1 low, 2 moderate, 5 high, 2 critical)'

All of the remaining vulnerabilities are due to Istanbul. It appears Istanbul is deprecated and is no longer maintained https://www.npmjs.com/package/istanbul

I have added a second commit that replaces istanbul with nyc which provides similar code coverage output.

istanbul

=============================== Coverage summary ===============================
Statements   : 98.58% ( 418/424 )
Branches     : 95.67% ( 287/300 )
Functions    : 100% ( 55/55 )
Lines        : 99.03% ( 408/412 )
================================================================================

nyc

-----------------|---------|----------|---------|---------|-------------------
File             | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s
-----------------|---------|----------|---------|---------|-------------------
All files        |   98.97 |    96.32 |     100 |   98.96 |
 AttributeMap.ts |    93.1 |       90 |     100 |    93.1 | 15,18,42,45
 Delta.ts        |     100 |    97.75 |     100 |     100 | 330,370,376,434
 Iterator.ts     |     100 |      100 |     100 |     100 |
 Op.ts           |     100 |      100 |     100 |     100 |
-----------------|---------|----------|---------|---------|-------------------

'npm audit' now gives Delta a clean bill of health. The tests pass both before and after these changes.

UPDATE: I realized I had broken linting. That is now fixed. I had to make a few code changes to get a tick from the linter.

+1615 -949

3 comments

6 changed files

andyjdavis

pr closed time in 17 days

push eventquilljs/delta

Andrew Davis

commit sha 4781b453c6f6ce43dc955271a8c6e086a61fb91d

Updating dependencies

view details

Andrew Davis

commit sha c0ed0b10dbab6b65d6ee4ea38e6a3b411dfe8ee4

replace dev dependency istanbul with nyc

view details

Andrew Davis

commit sha c5c0e0b7b83f2c59d8d797e3fb434aff3fef0660

Fixing linting after dependency upgrade

view details

Andrew Davis

commit sha 3e354e907a6dfc3f93f421f28c0d46091ae62ac7

Use latest stable Node during TravisCI

view details

Andrew Davis

commit sha e3fd2d92e449de01247a2b2e55c960588d0ea448

Updating dependencies

view details

luin

commit sha 7ae664798a7e8e27b1a83bf2ec2eddb76b191fda

Update dependencies

view details

luin

commit sha 179322686ec772c5e5b6060eed7462f83e61f870

Remove prettier in extends ...as it's included in plugin:prettier/recommended

view details

luin

commit sha af5611679927efde6f62e5409e4cac4a2008a61d

Ignore nyc output

view details

Jason Chen

commit sha 179db11c3816fcd6ff9910ea595c37da084eeec4

update @typescript-eslint

view details

Jason Chen

commit sha d3ac9c2a6970861e7ace890d72ba2ae7a6022271

Merge branch 'andyjdavis-vulnerableDependencies'

view details

push time in 17 days

create barnchquilljs/quill

branch : jc-travis

created branch time in a month

push eventquilljs/quill

Jason Chen

commit sha d2bd71d758dd0bb707801ca3e07b9919ece748ca

update to travis-ci.com

view details

push time in a month

push eventquilljs/quill

Jason Chen

commit sha ead3355fc9c6248035406bfc8e510a29b03f3030

fix mixed html/file test and handle image only case

view details

push time in a month