mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
feat: Make library local to given excalidraw instance and allow consumer to control it (#3451)
* feat: dnt share library & attach to the excalidraw instance * fix * Add addToLibrary, resetLibrary and libraryItems in initialData * remove comment * handle errors & improve types * remove resetLibrary and addToLibrary and add onLibraryChange prop * set library cache to empty arrary on reset * Add i18n for remove/add library * Update src/locales/en.json Co-authored-by: David Luzar <luzar.david@gmail.com> * update docs * Assign unique ID to each excalidraw component and remove csrfToken from library as its not needed * tweaks Co-authored-by: David Luzar <luzar.david@gmail.com> * update * tweak Co-authored-by: dwelle <luzar.david@gmail.com>
This commit is contained in:
parent
46624cc953
commit
37d513ad59
15 changed files with 189 additions and 77 deletions
|
@ -9,17 +9,17 @@ const { h } = window;
|
|||
|
||||
describe("library", () => {
|
||||
beforeEach(async () => {
|
||||
h.library.resetLibrary();
|
||||
await render(<ExcalidrawApp />);
|
||||
h.app.library.resetLibrary();
|
||||
});
|
||||
|
||||
it("import library via drag&drop", async () => {
|
||||
expect(await h.library.loadLibrary()).toEqual([]);
|
||||
expect(await h.app.library.loadLibrary()).toEqual([]);
|
||||
await API.drop(
|
||||
await API.loadFile("./fixtures/fixture_library.excalidrawlib"),
|
||||
);
|
||||
await waitFor(async () => {
|
||||
expect(await h.library.loadLibrary()).toEqual([
|
||||
expect(await h.app.library.loadLibrary()).toEqual([
|
||||
[expect.objectContaining({ id: "A" })],
|
||||
]);
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue