toeverything / blocksuite

🧩 Content editing tech stack for the web - BlockSuite is a toolkit for building editors and collaborative applications.
https://blocksuite.io
Mozilla Public License 2.0
4.08k stars 352 forks source link

feat(examples): bump to latest blocksuite canary #7455

Closed doodlewind closed 4 days ago

doodlewind commented 4 days ago

Confirmed to work after bumping (usable in dev and build passes):

Other examples only pass build command, they await further PR making them work.

Notable API updates:

Collection init pattern (see #7343):

// prev
const collection = new DocCollection({ schema });

// new
const collection = new DocCollection({ schema });
collection.meta.initialize()

Block collection (see #6737):

// prev
const docs = [...collection!.docs.values()];

// new
docs = [...collection.docs.values()].map(blocks => blocks.getDoc());

Blob source (see #6937):

// prev
function createBlobStorage(): BlobStorage {
  return {
    crud: {
      set: async (key: string, value: Blob): Promise<string> => {
        await client.insertBlob(key, value);
        return key;
      },
      get: async (key: string): Promise<Blob | null> => {
        return client.getBlob(key);
      },
      delete: async (key: string): Promise<void> => {
        await client.deleteBlob(key);
      },
      list: async (): Promise<string[]> => {
        return client.getAllBlobIds();
      },
    },
  };
}

// new
import { type BlobSource } from '@blocksuite/sync';

class ClientBlobSource implements BlobSource {
  readonly = false;
  name = 'client';

  async get(key: string) {
    return client.getBlob(key);
  }

  async set(key: string, value: Blob) {
    await client.insertBlob(key, value);
    return key;
  }

  async delete(key: string) {
    return client.deleteBlob(key);
  }

  async list() {
    return client.getAllBlobIds();
  }
}

Other possible todos in upcoming PRs:

vercel[bot] commented 4 days ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
blocksuite ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 1, 2024 4:28am
1 Ignored Deployment | Name | Status | Preview | Comments | Updated (UTC) | | :--- | :----- | :------ | :------- | :------ | | **blocksuite-docs** | ⬜️ Ignored ([Inspect](https://vercel.com/toeverything/blocksuite-docs/AebiCs8P5trAAAbmsPiJK9YfsBwH)) | [Visit Preview](https://blocksuite-docs-git-doodlexamples-toeverything.vercel.app) | | Jul 1, 2024 4:28am |
graphite-app[bot] commented 4 days ago

Your org has enabled the Graphite merge queue for merging into master

Add the label “merge” to the PR and Graphite will automatically add it to the merge queue when it’s ready to merge.

You must have a Graphite account and log in to Graphite in order to use the merge queue. Sign up using this link.