docstring_tokens
stringlengths
18
16.9k
code_tokens
stringlengths
75
1.81M
html_url
stringlengths
74
116
file_name
stringlengths
3
311
keep keep keep add keep keep keep keep
<mask> "versionNotAvailable": "", <mask> "width": "Bredde" <mask> }, <mask> "toast": { <mask> "copyStyles": "Kopieret stilarter.", <mask> "copyToClipboard": "Kopieret til klippebord.", <mask> "copyToClipboardAsPng": "Kopieret {{exportSelection}} til klippebord som PNG\n({{exportColorScheme}})", <mask> "fileSaved": "Fil gemt.", </s> chore: Update translations from Crowdin (#4258) </s> add "addedToLibrary": "Lagt til i biblioteket", </s> add "addedToLibrary": "", </s> add "addedToLibrary": "Tillagd i biblioteket", </s> add "addedToLibrary": "", </s> add "addedToLibrary": "", </s> add "addedToLibrary": "",
https://github.com/excalidraw/excalidraw/commit/ca1f3aa09439dbc9e1de6d9bcc08c2b36d83b463
src/locales/da-DK.json
keep keep add keep keep keep keep keep keep
<mask> "width": "Ancho" <mask> }, <mask> "toast": { <mask> "copyStyles": "Estilos copiados.", <mask> "copyToClipboard": "Copiado en el portapapeles.", <mask> "copyToClipboardAsPng": "Copiado {{exportSelection}} al portapapeles como PNG\n({{exportColorScheme}})", <mask> "fileSaved": "Archivo guardado.", <mask> "fileSavedToFilename": "Guardado en {filename}", <mask> "canvas": "lienzo", </s> chore: Update translations from Crowdin (#4258) </s> add "addedToLibrary": "", </s> add "addedToLibrary": "", </s> remove "copyToClipboardAsPng": "", </s> add "copyToClipboardAsPng": "Skopiowano {{exportSelection}} do schowka jako PNG\n({{exportColorScheme}})", </s> add "addedToLibrary": "Lagt til i biblioteket", </s> add "addedToLibrary": "", </s> add "addedToLibrary": "Tillagd i biblioteket",
https://github.com/excalidraw/excalidraw/commit/ca1f3aa09439dbc9e1de6d9bcc08c2b36d83b463
src/locales/es-ES.json
keep add keep keep keep keep
<mask> "invalidSceneUrl": "", <mask> "resetLibrary": "", <mask> "invalidEncryptionKey": "" <mask> }, <mask> "errors": { <mask> "unsupportedFileType": "", </s> chore: Update translations from Crowdin (#4258) </s> add "removeItemsFromsLibrary": "", </s> add "removeItemsFromsLibrary": "", </s> add "removeItemsFromsLibrary": "", </s> add "removeItemsFromsLibrary": "", </s> add "removeItemsFromsLibrary": "", </s> add "removeItemsFromsLibrary": "Hapus {{count}} item dari pustaka?",
https://github.com/excalidraw/excalidraw/commit/ca1f3aa09439dbc9e1de6d9bcc08c2b36d83b463
src/locales/hi-IN.json
keep keep keep keep replace keep keep keep keep keep
<mask> "toggleExportColorScheme": "Ubah skema warna ekspor", <mask> "share": "Bagikan", <mask> "showStroke": "Tampilkan garis pengambil warna", <mask> "showBackground": "Tampilkan latar pengambil warna", <mask> "toggleTheme": "Ubah tema" <mask> }, <mask> "buttons": { <mask> "clearReset": "Setel Ulang Kanvas", <mask> "exportJSON": "Ekspor ke file", <mask> "exportImage": "Simpan gambar", </s> chore: Update translations from Crowdin (#4258) </s> remove "toggleTheme": "" </s> add "toggleTheme": "", "personalLib": "", "excalidrawLib": "" </s> remove "toggleTheme": "" </s> add "toggleTheme": "", "personalLib": "", "excalidrawLib": "" </s> remove "toggleTheme": "" </s> add "toggleTheme": "", "personalLib": "", "excalidrawLib": "" </s> remove "toggleTheme": "" </s> add "toggleTheme": "", "personalLib": "", "excalidrawLib": "" </s> remove "toggleTheme": "Cambia tema" </s> add "toggleTheme": "Cambia tema", "personalLib": "Libreria Personale", "excalidrawLib": "Libreria di Excalidraw" </s> remove "toggleTheme": "Veksle tema" </s> add "toggleTheme": "Veksle tema", "personalLib": "", "excalidrawLib": ""
https://github.com/excalidraw/excalidraw/commit/ca1f3aa09439dbc9e1de6d9bcc08c2b36d83b463
src/locales/id-ID.json
keep keep keep keep replace keep keep keep keep keep
<mask> "lightMode": "Mode terang", <mask> "zenMode": "Mode zen", <mask> "exitZenMode": "Keluar dari mode zen", <mask> "cancel": "Batal", <mask> "clear": "Hapus" <mask> }, <mask> "alerts": { <mask> "clearReset": "Ini akan menghapus semua yang ada dikanvas. Apakah kamu yakin ?", <mask> "couldNotCreateShareableLink": "Tidak bisa membuat tautan yang bisa dibagikan", <mask> "couldNotCreateShareableLinkTooBig": "Tidak dapat membuat tautan yang dapat dibagikan: pemandangan terlalu besar", </s> chore: Update translations from Crowdin (#4258) </s> add "removeItemsFromsLibrary": "Hapus {{count}} item dari pustaka?", </s> remove "clear": "" </s> add "clear": "", "remove": "", "publishLibrary": "", "submit": "", "confirm": "" </s> remove "clear": "" </s> add "clear": "", "remove": "", "publishLibrary": "", "submit": "", "confirm": "" </s> remove "clear": "" </s> add "clear": "", "remove": "", "publishLibrary": "", "submit": "", "confirm": "" </s> remove "clear": "" </s> add "clear": "", "remove": "", "publishLibrary": "", "submit": "", "confirm": "" </s> remove "placeImage": "Klik untuk tempatkan gambar, atau klik dan jatuhkan untuk tetapkan ukuran secara manual" </s> add "placeImage": "Klik untuk tempatkan gambar, atau klik dan jatuhkan untuk tetapkan ukuran secara manual", "publishLibrary": "Terbitkan pustaka Anda"
https://github.com/excalidraw/excalidraw/commit/ca1f3aa09439dbc9e1de6d9bcc08c2b36d83b463
src/locales/id-ID.json
keep add keep keep keep keep keep
<mask> "invalidSceneUrl": "Tidak dapat impor pemandangan dari URL. Kemungkinan URL itu rusak atau tidak berisi data JSON Excalidraw yang valid.", <mask> "resetLibrary": "Ini akan menghapus pustaka Anda. Anda yakin?", <mask> "invalidEncryptionKey": "Sandi enkripsi harus 22 karakter. Kolaborasi langsung dinonaktifkan." <mask> }, <mask> "errors": { <mask> "unsupportedFileType": "Tipe file tidak didukung.", <mask> "imageInsertError": "Tidak dapat menyisipkan gambar. Coba lagi nanti...", </s> chore: Update translations from Crowdin (#4258) </s> remove "clear": "Hapus" </s> add "clear": "Hapus", "remove": "Hapus", "publishLibrary": "Terbitkan", "submit": "Kirimkan", "confirm": "Konfirmasi" </s> add "removeItemsFromsLibrary": "", </s> add "removeItemsFromsLibrary": "", </s> add "removeItemsFromsLibrary": "", </s> add "removeItemsFromsLibrary": "", </s> remove "placeImage": "Klik untuk tempatkan gambar, atau klik dan jatuhkan untuk tetapkan ukuran secara manual" </s> add "placeImage": "Klik untuk tempatkan gambar, atau klik dan jatuhkan untuk tetapkan ukuran secara manual", "publishLibrary": "Terbitkan pustaka Anda"
https://github.com/excalidraw/excalidraw/commit/ca1f3aa09439dbc9e1de6d9bcc08c2b36d83b463
src/locales/id-ID.json
keep keep keep keep replace keep keep keep keep keep
<mask> "rotate": "Anda dapat menjaga sudut dengan menahan SHIFT sambil memutar", <mask> "lineEditor_info": "Klik ganda atau tekan Enter untuk mengedit titik", <mask> "lineEditor_pointSelected": "Tekan Delete untuk menghapus titik, Ctrl/Cmd + D untuk menduplikasi, atau seret untuk memindahkan", <mask> "lineEditor_nothingSelected": "Pilih sebuah titik untuk memindah atau menghapus, atau tekan Alt dan klik untuk menambahkan titik baru", <mask> "placeImage": "Klik untuk tempatkan gambar, atau klik dan jatuhkan untuk tetapkan ukuran secara manual" <mask> }, <mask> "canvasError": { <mask> "cannotShowPreview": "Tidak dapat menampilkan pratinjau", <mask> "canvasTooBig": "Kanvas mungkin terlalu besar.", <mask> "canvasTooBigTip": "Tip: coba pindahkan elemen-terjauh lebih dekat bersama." </s> chore: Update translations from Crowdin (#4258) </s> remove "placeImage": "" </s> add "placeImage": "", "publishLibrary": "" </s> remove "placeImage": "" </s> add "placeImage": "", "publishLibrary": "" </s> remove "placeImage": "" </s> add "placeImage": "", "publishLibrary": "" </s> remove "placeImage": "" </s> add "placeImage": "", "publishLibrary": "" </s> remove "placeImage": "" </s> add "placeImage": "", "publishLibrary": "" </s> add "removeItemsFromsLibrary": "Hapus {{count}} item dari pustaka?",
https://github.com/excalidraw/excalidraw/commit/ca1f3aa09439dbc9e1de6d9bcc08c2b36d83b463
src/locales/id-ID.json
keep keep add keep keep keep keep
<mask> "width": "Lebar" <mask> }, <mask> "toast": { <mask> "copyStyles": "Gaya tersalin.", <mask> "copyToClipboard": "Tersalin ke papan klip.", <mask> "copyToClipboardAsPng": "Tersalin {{exportSelection}} ke clipboard sebagai PNG\n({{exportColorScheme}})", <mask> "fileSaved": "File tersimpan.", </s> chore: Update translations from Crowdin (#4258) </s> add "addedToLibrary": "Aggiunto alla libreria", </s> add "addedToLibrary": "", </s> add "addedToLibrary": "", </s> add "addedToLibrary": "", </s> remove "copyToClipboardAsPng": "", </s> add "copyToClipboardAsPng": "Skopiowano {{exportSelection}} do schowka jako PNG\n({{exportColorScheme}})", </s> add "addedToLibrary": "Lagt til i biblioteket",
https://github.com/excalidraw/excalidraw/commit/ca1f3aa09439dbc9e1de6d9bcc08c2b36d83b463
src/locales/id-ID.json
keep keep keep keep replace keep keep keep keep keep
<mask> "toggleExportColorScheme": "Cambia lo schema di colori in esportazione", <mask> "share": "Condividi", <mask> "showStroke": "Mostra selettore colore del tratto", <mask> "showBackground": "Mostra selettore colore di sfondo", <mask> "toggleTheme": "Cambia tema" <mask> }, <mask> "buttons": { <mask> "clearReset": "Svuota la tela", <mask> "exportJSON": "Esporta su file", <mask> "exportImage": "Salva come immagine", </s> chore: Update translations from Crowdin (#4258) </s> remove "toggleTheme": "Ubah tema" </s> add "toggleTheme": "Ubah tema", "personalLib": "Pustaka Pribadi", "excalidrawLib": "Pustaka Excalidraw" </s> remove "toggleTheme": "" </s> add "toggleTheme": "", "personalLib": "", "excalidrawLib": "" </s> remove "toggleTheme": "" </s> add "toggleTheme": "", "personalLib": "", "excalidrawLib": "" </s> remove "toggleTheme": "" </s> add "toggleTheme": "", "personalLib": "", "excalidrawLib": "" </s> remove "toggleTheme": "" </s> add "toggleTheme": "", "personalLib": "", "excalidrawLib": "" </s> remove "toggleTheme": "Veksle tema" </s> add "toggleTheme": "Veksle tema", "personalLib": "", "excalidrawLib": ""
https://github.com/excalidraw/excalidraw/commit/ca1f3aa09439dbc9e1de6d9bcc08c2b36d83b463
src/locales/it-IT.json
keep add keep keep keep keep
<mask> }, <mask> "toast": { <mask> "copyStyles": "Stili copiati.", <mask> "copyToClipboard": "Copiato negli appunti.", <mask> "copyToClipboardAsPng": "{{exportSelection}} copiato negli appunti come PNG\n({{exportColorScheme}})", <mask> "fileSaved": "File salvato.", </s> chore: Update translations from Crowdin (#4258) </s> add "addedToLibrary": "Tambahkan ke pustaka", </s> add "addedToLibrary": "", </s> remove "copyToClipboardAsPng": "", </s> add "copyToClipboardAsPng": "Skopiowano {{exportSelection}} do schowka jako PNG\n({{exportColorScheme}})", </s> add "addedToLibrary": "", </s> add "addedToLibrary": "", </s> add "addedToLibrary": "Tillagd i biblioteket",
https://github.com/excalidraw/excalidraw/commit/ca1f3aa09439dbc9e1de6d9bcc08c2b36d83b463
src/locales/it-IT.json
keep keep keep keep replace keep keep keep keep keep
<mask> "toggleExportColorScheme": "", <mask> "share": "", <mask> "showStroke": "", <mask> "showBackground": "", <mask> "toggleTheme": "" <mask> }, <mask> "buttons": { <mask> "clearReset": "", <mask> "exportJSON": "", <mask> "exportImage": "", </s> chore: Update translations from Crowdin (#4258)
https://github.com/excalidraw/excalidraw/commit/ca1f3aa09439dbc9e1de6d9bcc08c2b36d83b463
src/locales/kk-KZ.json
keep keep keep keep replace keep keep keep keep keep
<mask> "lightMode": "", <mask> "zenMode": "", <mask> "exitZenMode": "", <mask> "cancel": "", <mask> "clear": "" <mask> }, <mask> "alerts": { <mask> "clearReset": "", <mask> "couldNotCreateShareableLink": "", <mask> "couldNotCreateShareableLinkTooBig": "", </s> chore: Update translations from Crowdin (#4258)
https://github.com/excalidraw/excalidraw/commit/ca1f3aa09439dbc9e1de6d9bcc08c2b36d83b463
src/locales/kk-KZ.json
keep keep keep keep replace keep keep keep keep keep
<mask> "rotate": "", <mask> "lineEditor_info": "", <mask> "lineEditor_pointSelected": "", <mask> "lineEditor_nothingSelected": "", <mask> "placeImage": "" <mask> }, <mask> "canvasError": { <mask> "cannotShowPreview": "", <mask> "canvasTooBig": "", <mask> "canvasTooBigTip": "" </s> chore: Update translations from Crowdin (#4258)
https://github.com/excalidraw/excalidraw/commit/ca1f3aa09439dbc9e1de6d9bcc08c2b36d83b463
src/locales/kk-KZ.json
keep add keep keep keep keep keep
<mask> }, <mask> "toast": { <mask> "copyStyles": "", <mask> "copyToClipboard": "", <mask> "copyToClipboardAsPng": "", <mask> "fileSaved": "", <mask> "fileSavedToFilename": "", </s> chore: Update translations from Crowdin (#4258) </s> add "addedToLibrary": "", </s> add "addedToLibrary": "", </s> add "addedToLibrary": "", </s> add "addedToLibrary": "", </s> remove "copyToClipboardAsPng": "", </s> add "copyToClipboardAsPng": "Skopiowano {{exportSelection}} do schowka jako PNG\n({{exportColorScheme}})", </s> add "addedToLibrary": "",
https://github.com/excalidraw/excalidraw/commit/ca1f3aa09439dbc9e1de6d9bcc08c2b36d83b463
src/locales/my-MM.json
keep keep keep add keep keep keep keep keep keep
<mask> "versionNotAvailable": "Versjon ikke tilgjengelig", <mask> "width": "Bredde" <mask> }, <mask> "toast": { <mask> "copyStyles": "Kopierte stiler.", <mask> "copyToClipboard": "Kopiert til utklippstavlen.", <mask> "copyToClipboardAsPng": "Kopierte {{exportSelection}} til utklippstavlen som PNG\n({{exportColorScheme}})", <mask> "fileSaved": "Fil lagret.", <mask> "fileSavedToFilename": "Lagret til {filename}", <mask> "canvas": "lerret", </s> chore: Update translations from Crowdin (#4258) </s> add "addedToLibrary": "", </s> add "addedToLibrary": "", </s> add "addedToLibrary": "Tillagd i biblioteket", </s> add "addedToLibrary": "", </s> add "addedToLibrary": "", </s> remove "copyToClipboardAsPng": "", </s> add "copyToClipboardAsPng": "Skopiowano {{exportSelection}} do schowka jako PNG\n({{exportColorScheme}})",
https://github.com/excalidraw/excalidraw/commit/ca1f3aa09439dbc9e1de6d9bcc08c2b36d83b463
src/locales/nb-NO.json
keep keep keep keep replace keep keep keep keep keep
<mask> "toggleExportColorScheme": "Kleurenschema exporteren aan/uit", <mask> "share": "Deel", <mask> "showStroke": "Toon lijn kleur kiezer", <mask> "showBackground": "Toon achtergrondkleur kiezer", <mask> "toggleTheme": "Thema aan/uit" <mask> }, <mask> "buttons": { <mask> "clearReset": "Canvas opnieuw instellen", <mask> "exportJSON": "Exporteren naar bestand", <mask> "exportImage": "Als afbeelding opslaan", </s> chore: Update translations from Crowdin (#4258) </s> remove "toggleTheme": "" </s> add "toggleTheme": "", "personalLib": "", "excalidrawLib": "" </s> remove "toggleTheme": "" </s> add "toggleTheme": "", "personalLib": "", "excalidrawLib": "" </s> remove "toggleTheme": "" </s> add "toggleTheme": "", "personalLib": "", "excalidrawLib": "" </s> remove "toggleTheme": "" </s> add "toggleTheme": "", "personalLib": "", "excalidrawLib": "" </s> remove "toggleTheme": "Veksle tema" </s> add "toggleTheme": "Veksle tema", "personalLib": "", "excalidrawLib": "" </s> remove "toggleTheme": "Ubah tema" </s> add "toggleTheme": "Ubah tema", "personalLib": "Pustaka Pribadi", "excalidrawLib": "Pustaka Excalidraw"
https://github.com/excalidraw/excalidraw/commit/ca1f3aa09439dbc9e1de6d9bcc08c2b36d83b463
src/locales/nl-NL.json
keep keep add keep keep keep keep keep keep
<mask> "width": "Breedte" <mask> }, <mask> "toast": { <mask> "copyStyles": "Stijlen gekopieerd.", <mask> "copyToClipboard": "Gekopieerd naar het klembord.", <mask> "copyToClipboardAsPng": "{{exportSelection}} naar klembord gekopieerd als PNG\n({{exportColorScheme}})", <mask> "fileSaved": "Bestand opgeslagen.", <mask> "fileSavedToFilename": "Opgeslagen als {filename}", <mask> "canvas": "canvas", </s> chore: Update translations from Crowdin (#4258) </s> add "addedToLibrary": "", </s> add "addedToLibrary": "", </s> remove "copyToClipboardAsPng": "", </s> add "copyToClipboardAsPng": "Skopiowano {{exportSelection}} do schowka jako PNG\n({{exportColorScheme}})", </s> add "addedToLibrary": "Lagt til i biblioteket", </s> add "addedToLibrary": "", </s> add "addedToLibrary": "Aggiunto alla libreria",
https://github.com/excalidraw/excalidraw/commit/ca1f3aa09439dbc9e1de6d9bcc08c2b36d83b463
src/locales/nl-NL.json
keep keep keep keep replace keep keep keep keep keep
<mask> "toggleExportColorScheme": "Veksle eksport av fargepalett", <mask> "share": "Del", <mask> "showStroke": "Vis fargeveljar for linjer", <mask> "showBackground": "Vis fargeveljar for bakgrunn", <mask> "toggleTheme": "Veksle tema" <mask> }, <mask> "buttons": { <mask> "clearReset": "Tilbakestill lerretet", <mask> "exportJSON": "Eksporter til fil", <mask> "exportImage": "Lagre som bilete", </s> chore: Update translations from Crowdin (#4258) </s> remove "toggleTheme": "" </s> add "toggleTheme": "", "personalLib": "", "excalidrawLib": "" </s> remove "toggleTheme": "" </s> add "toggleTheme": "", "personalLib": "", "excalidrawLib": "" </s> remove "toggleTheme": "" </s> add "toggleTheme": "", "personalLib": "", "excalidrawLib": "" </s> remove "toggleTheme": "" </s> add "toggleTheme": "", "personalLib": "", "excalidrawLib": "" </s> remove "toggleTheme": "Ubah tema" </s> add "toggleTheme": "Ubah tema", "personalLib": "Pustaka Pribadi", "excalidrawLib": "Pustaka Excalidraw" </s> remove "toggleTheme": "Cambia tema" </s> add "toggleTheme": "Cambia tema", "personalLib": "Libreria Personale", "excalidrawLib": "Libreria di Excalidraw"
https://github.com/excalidraw/excalidraw/commit/ca1f3aa09439dbc9e1de6d9bcc08c2b36d83b463
src/locales/nn-NO.json
keep keep add keep keep keep keep keep keep
<mask> "width": "Breidde" <mask> }, <mask> "toast": { <mask> "copyStyles": "Kopierte stilane.", <mask> "copyToClipboard": "Kopiert til utklippstavla.", <mask> "copyToClipboardAsPng": "Kopierte {{exportSelection}} til utklippstavla som PNG\n({{exportColorScheme}})", <mask> "fileSaved": "Fila er lagra.", <mask> "fileSavedToFilename": "Lagra som {filename}", <mask> "canvas": "lerret", </s> chore: Update translations from Crowdin (#4258) </s> add "addedToLibrary": "Lagt til i biblioteket", </s> add "addedToLibrary": "", </s> add "addedToLibrary": "Tillagd i biblioteket", </s> add "addedToLibrary": "", </s> remove "copyToClipboardAsPng": "", </s> add "copyToClipboardAsPng": "Skopiowano {{exportSelection}} do schowka jako PNG\n({{exportColorScheme}})", </s> add "addedToLibrary": "",
https://github.com/excalidraw/excalidraw/commit/ca1f3aa09439dbc9e1de6d9bcc08c2b36d83b463
src/locales/nn-NO.json
keep replace replace keep replace replace replace keep keep keep keep
<mask> { <mask> "ar-SA": 98, <mask> "bg-BG": 66, <mask> "bn-BD": 0, <mask> "ca-ES": 88, <mask> "cs-CZ": 28, <mask> "da-DK": 19, <mask> "de-DE": 100, <mask> "el-GR": 96, <mask> "en": 100, <mask> "es-ES": 100, </s> chore: Update translations from Crowdin (#4258) </s> remove "el-GR": 96, </s> add "el-GR": 88, </s> remove "es-ES": 100, "fa-IR": 75, </s> add "es-ES": 88, "fa-IR": 66, </s> remove "ja-JP": 100, "kab-KAB": 93, "kk-KZ": 27, "ko-KR": 66, </s> add "ja-JP": 99, "kab-KAB": 82, "kk-KZ": 24, "ko-KR": 58, </s> remove "he-IL": 95, "hi-IN": 66, "hu-HU": 58, </s> add "he-IL": 84, "hi-IN": 58, "hu-HU": 52, </s> remove "my-MM": 55, </s> add "my-MM": 49,
https://github.com/excalidraw/excalidraw/commit/ca1f3aa09439dbc9e1de6d9bcc08c2b36d83b463
src/locales/percentages.json
keep keep replace keep replace replace keep keep keep keep
<mask> "da-DK": 19, <mask> "de-DE": 100, <mask> "el-GR": 96, <mask> "en": 100, <mask> "es-ES": 100, <mask> "fa-IR": 75, <mask> "fi-FI": 100, <mask> "fr-FR": 100, <mask> "he-IL": 95, <mask> "hi-IN": 66, </s> chore: Update translations from Crowdin (#4258) </s> remove "he-IL": 95, "hi-IN": 66, "hu-HU": 58, </s> add "he-IL": 84, "hi-IN": 58, "hu-HU": 52, </s> remove "ca-ES": 88, "cs-CZ": 28, "da-DK": 19, </s> add "ca-ES": 78, "cs-CZ": 25, "da-DK": 17, </s> remove "ar-SA": 98, "bg-BG": 66, </s> add "ar-SA": 86, "bg-BG": 59, </s> remove "ja-JP": 100, "kab-KAB": 93, "kk-KZ": 27, "ko-KR": 66, </s> add "ja-JP": 99, "kab-KAB": 82, "kk-KZ": 24, "ko-KR": 58, </s> remove "my-MM": 55, </s> add "my-MM": 49,
https://github.com/excalidraw/excalidraw/commit/ca1f3aa09439dbc9e1de6d9bcc08c2b36d83b463
src/locales/percentages.json
keep keep keep replace replace replace keep keep replace replace replace replace keep keep keep
<mask> "fa-IR": 75, <mask> "fi-FI": 100, <mask> "fr-FR": 100, <mask> "he-IL": 95, <mask> "hi-IN": 66, <mask> "hu-HU": 58, <mask> "id-ID": 100, <mask> "it-IT": 100, <mask> "ja-JP": 100, <mask> "kab-KAB": 93, <mask> "kk-KZ": 27, <mask> "ko-KR": 66, <mask> "lv-LV": 100, <mask> "my-MM": 55, <mask> "nb-NO": 100, </s> chore: Update translations from Crowdin (#4258) </s> remove "es-ES": 100, "fa-IR": 75, </s> add "es-ES": 88, "fa-IR": 66, </s> remove "my-MM": 55, </s> add "my-MM": 49, </s> remove "nl-NL": 98, "nn-NO": 98, "oc-FR": 98, "pa-IN": 95, "pl-PL": 68, "pt-BR": 100, "pt-PT": 98, </s> add "nl-NL": 93, "nn-NO": 87, "oc-FR": 99, "pa-IN": 84, "pl-PL": 97, "pt-BR": 99, "pt-PT": 87, </s> remove "el-GR": 96, </s> add "el-GR": 88, </s> remove "ca-ES": 88, "cs-CZ": 28, "da-DK": 19, </s> add "ca-ES": 78, "cs-CZ": 25, "da-DK": 17,
https://github.com/excalidraw/excalidraw/commit/ca1f3aa09439dbc9e1de6d9bcc08c2b36d83b463
src/locales/percentages.json
keep keep replace keep replace replace replace replace replace replace replace keep keep keep
<mask> "ko-KR": 66, <mask> "lv-LV": 100, <mask> "my-MM": 55, <mask> "nb-NO": 100, <mask> "nl-NL": 98, <mask> "nn-NO": 98, <mask> "oc-FR": 98, <mask> "pa-IN": 95, <mask> "pl-PL": 68, <mask> "pt-BR": 100, <mask> "pt-PT": 98, <mask> "ro-RO": 100, <mask> "ru-RU": 97, <mask> "si-LK": 4, </s> chore: Update translations from Crowdin (#4258) </s> remove "ru-RU": 97, "si-LK": 4, "sk-SK": 100, </s> add "ru-RU": 86, "si-LK": 9, "sk-SK": 99, </s> remove "ja-JP": 100, "kab-KAB": 93, "kk-KZ": 27, "ko-KR": 66, </s> add "ja-JP": 99, "kab-KAB": 82, "kk-KZ": 24, "ko-KR": 58, </s> remove "ta-IN": 97, "tr-TR": 88, "uk-UA": 97, "zh-CN": 100, "zh-HK": 33, </s> add "ta-IN": 98, "tr-TR": 78, "uk-UA": 85, "zh-CN": 92, "zh-HK": 29, </s> remove "ca-ES": 88, "cs-CZ": 28, "da-DK": 19, </s> add "ca-ES": 78, "cs-CZ": 25, "da-DK": 17, </s> remove "ar-SA": 98, "bg-BG": 66, </s> add "ar-SA": 86, "bg-BG": 59,
https://github.com/excalidraw/excalidraw/commit/ca1f3aa09439dbc9e1de6d9bcc08c2b36d83b463
src/locales/percentages.json
keep keep keep replace replace replace keep replace replace replace replace replace
<mask> "pt-BR": 100, <mask> "pt-PT": 98, <mask> "ro-RO": 100, <mask> "ru-RU": 97, <mask> "si-LK": 4, <mask> "sk-SK": 100, <mask> "sv-SE": 99, <mask> "ta-IN": 97, <mask> "tr-TR": 88, <mask> "uk-UA": 97, <mask> "zh-CN": 100, <mask> "zh-HK": 33, </s> chore: Update translations from Crowdin (#4258) </s> remove "nl-NL": 98, "nn-NO": 98, "oc-FR": 98, "pa-IN": 95, "pl-PL": 68, "pt-BR": 100, "pt-PT": 98, </s> add "nl-NL": 93, "nn-NO": 87, "oc-FR": 99, "pa-IN": 84, "pl-PL": 97, "pt-BR": 99, "pt-PT": 87, </s> remove "ja-JP": 100, "kab-KAB": 93, "kk-KZ": 27, "ko-KR": 66, </s> add "ja-JP": 99, "kab-KAB": 82, "kk-KZ": 24, "ko-KR": 58, </s> remove "el-GR": 96, </s> add "el-GR": 88, </s> remove "ca-ES": 88, "cs-CZ": 28, "da-DK": 19, </s> add "ca-ES": 78, "cs-CZ": 25, "da-DK": 17, </s> remove "es-ES": 100, "fa-IR": 75, </s> add "es-ES": 88, "fa-IR": 66,
https://github.com/excalidraw/excalidraw/commit/ca1f3aa09439dbc9e1de6d9bcc08c2b36d83b463
src/locales/percentages.json
keep keep keep keep replace keep keep keep keep keep
<mask> }, <mask> "toast": { <mask> "copyStyles": "Skopiowano style.", <mask> "copyToClipboard": "Skopiowano do schowka.", <mask> "copyToClipboardAsPng": "", <mask> "fileSaved": "Zapisano plik.", <mask> "fileSavedToFilename": "Zapisano jako {filename}", <mask> "canvas": "", <mask> "selection": "" <mask> }, </s> chore: Update translations from Crowdin (#4258) </s> add "addedToLibrary": "", </s> add "addedToLibrary": "", </s> add "addedToLibrary": "", </s> add "addedToLibrary": "", </s> add "addedToLibrary": "", </s> add "addedToLibrary": "",
https://github.com/excalidraw/excalidraw/commit/ca1f3aa09439dbc9e1de6d9bcc08c2b36d83b463
src/locales/pl-PL.json
keep keep keep keep replace keep keep keep keep keep
<mask> "toggleExportColorScheme": "", <mask> "share": "", <mask> "showStroke": "", <mask> "showBackground": "", <mask> "toggleTheme": "" <mask> }, <mask> "buttons": { <mask> "clearReset": "", <mask> "exportJSON": "", <mask> "exportImage": "", </s> chore: Update translations from Crowdin (#4258)
https://github.com/excalidraw/excalidraw/commit/ca1f3aa09439dbc9e1de6d9bcc08c2b36d83b463
src/locales/si-LK.json
keep keep keep keep replace keep keep keep keep keep
<mask> "lightMode": "", <mask> "zenMode": "", <mask> "exitZenMode": "", <mask> "cancel": "", <mask> "clear": "" <mask> }, <mask> "alerts": { <mask> "clearReset": "", <mask> "couldNotCreateShareableLink": "", <mask> "couldNotCreateShareableLinkTooBig": "", </s> chore: Update translations from Crowdin (#4258)
https://github.com/excalidraw/excalidraw/commit/ca1f3aa09439dbc9e1de6d9bcc08c2b36d83b463
src/locales/si-LK.json
keep add keep keep keep keep keep
<mask> "invalidSceneUrl": "", <mask> "resetLibrary": "", <mask> "invalidEncryptionKey": "" <mask> }, <mask> "errors": { <mask> "unsupportedFileType": "", <mask> "imageInsertError": "", </s> chore: Update translations from Crowdin (#4258)
https://github.com/excalidraw/excalidraw/commit/ca1f3aa09439dbc9e1de6d9bcc08c2b36d83b463
src/locales/si-LK.json
keep keep keep keep replace keep keep keep keep keep
<mask> "rotate": "", <mask> "lineEditor_info": "", <mask> "lineEditor_pointSelected": "", <mask> "lineEditor_nothingSelected": "", <mask> "placeImage": "" <mask> }, <mask> "canvasError": { <mask> "cannotShowPreview": "", <mask> "canvasTooBig": "", <mask> "canvasTooBigTip": "" </s> chore: Update translations from Crowdin (#4258)
https://github.com/excalidraw/excalidraw/commit/ca1f3aa09439dbc9e1de6d9bcc08c2b36d83b463
src/locales/si-LK.json
keep keep keep add keep keep keep keep keep keep
<mask> "versionNotAvailable": "", <mask> "width": "" <mask> }, <mask> "toast": { <mask> "copyStyles": "", <mask> "copyToClipboard": "", <mask> "copyToClipboardAsPng": "", <mask> "fileSaved": "", <mask> "fileSavedToFilename": "", <mask> "canvas": "", </s> chore: Update translations from Crowdin (#4258) </s> add "addedToLibrary": "", </s> add "addedToLibrary": "", </s> add "addedToLibrary": "", </s> add "addedToLibrary": "", </s> add "addedToLibrary": "", </s> remove "copyToClipboardAsPng": "", </s> add "copyToClipboardAsPng": "Skopiowano {{exportSelection}} do schowka jako PNG\n({{exportColorScheme}})",
https://github.com/excalidraw/excalidraw/commit/ca1f3aa09439dbc9e1de6d9bcc08c2b36d83b463
src/locales/si-LK.json
keep add keep keep keep keep keep
<mask> }, <mask> "toast": { <mask> "copyStyles": "Kopierade stilar.", <mask> "copyToClipboard": "Kopierad till urklipp.", <mask> "copyToClipboardAsPng": "Kopierade {{exportSelection}} till urklipp som PNG\n({{exportColorScheme}})", <mask> "fileSaved": "Fil sparad.", <mask> "fileSavedToFilename": "Sparad till {filename}", </s> chore: Update translations from Crowdin (#4258) </s> add "addedToLibrary": "Lagt til i biblioteket", </s> add "addedToLibrary": "", </s> add "addedToLibrary": "", </s> remove "copyToClipboardAsPng": "", </s> add "copyToClipboardAsPng": "Skopiowano {{exportSelection}} do schowka jako PNG\n({{exportColorScheme}})", </s> add "addedToLibrary": "", </s> add "addedToLibrary": "",
https://github.com/excalidraw/excalidraw/commit/ca1f3aa09439dbc9e1de6d9bcc08c2b36d83b463
src/locales/sv-SE.json
keep add keep keep keep keep keep
<mask> "invalidSceneUrl": "", <mask> "resetLibrary": "", <mask> "invalidEncryptionKey": "" <mask> }, <mask> "errors": { <mask> "unsupportedFileType": "", <mask> "imageInsertError": "", </s> chore: Update translations from Crowdin (#4258)
https://github.com/excalidraw/excalidraw/commit/ca1f3aa09439dbc9e1de6d9bcc08c2b36d83b463
src/locales/zh-HK.json
keep keep keep add keep keep keep keep keep
<mask> "versionNotAvailable": "", <mask> "width": "" <mask> }, <mask> "toast": { <mask> "copyStyles": "", <mask> "copyToClipboard": "", <mask> "copyToClipboardAsPng": "", <mask> "fileSaved": "", <mask> "fileSavedToFilename": "", </s> chore: Update translations from Crowdin (#4258) </s> add "addedToLibrary": "", </s> add "addedToLibrary": "", </s> add "addedToLibrary": "", </s> add "addedToLibrary": "", </s> add "addedToLibrary": "", </s> remove "copyToClipboardAsPng": "", </s> add "copyToClipboardAsPng": "Skopiowano {{exportSelection}} do schowka jako PNG\n({{exportColorScheme}})",
https://github.com/excalidraw/excalidraw/commit/ca1f3aa09439dbc9e1de6d9bcc08c2b36d83b463
src/locales/zh-HK.json
keep keep keep keep replace keep keep keep keep keep
<mask> import clsx from "clsx"; <mask> import oc from "open-color"; <mask> import { useEffect, useRef, useState } from "react"; <mask> import { useDevice } from "../components/App"; <mask> import { exportToSvg } from "../scene/export"; <mask> import { LibraryItem } from "../types"; <mask> import "./LibraryUnit.scss"; <mask> import { CheckboxItem } from "./CheckboxItem"; <mask> import { PlusIcon } from "./icons"; <mask> </s> fix: exporting labelled arrows via export utils (#6443) * fix: exporting labelled arrows via export utils * add comments * lint * update changelog * fix lint * initialize scene in the utils so it can be availabe in the helper functions * fix library rendering * add comments </s> remove await copyToClipboard(opts.elements, appState, opts.files); </s> add await copyToClipboard(scene.getNonDeletedElements(), appState, opts.files); </s> remove getNonDeletedElements(restoredElements), </s> add scene.getNonDeletedElements(), </s> add // The helper methods getContainerElement and getBoundTextElement are // dependent on Scene which will not be available // when these pure utils are called outside Excalidraw or even if called // from inside Excalidraw when Scene isn't available eg when using library items from store, as a result the element cannot be extracted // hence initailizing a new scene with the elements // so its always available to helper methods const scene = new Scene(); scene.replaceAllElements(opts.elements); </s> remove const canvas = await exportToCanvas(opts); </s> add // The helper methods getContainerElement and getBoundTextElement are // dependent on Scene which will not be available // when these pure utils are called outside Excalidraw or even if called // from inside Excalidraw when Scene isn't available eg when using library items from store, as a result the element cannot be extracted // hence initailizing a new scene with the elements // so its always available to helper methods const scene = new Scene(); scene.replaceAllElements(opts.elements); const canvas = await exportToCanvas({ ...opts, elements: scene.getNonDeletedElements(), }); </s> remove getNonDeletedElements(restoredElements), </s> add scene.getNonDeletedElements(), </s> remove opts.elements, </s> add scene.getNonDeletedElements(),
https://github.com/excalidraw/excalidraw/commit/ca3be2c678dfc5fae50d005fdcfe3b8c84fc2544
src/components/LibraryUnit.tsx
keep keep keep keep replace keep keep keep keep keep
<mask> null, <mask> ); <mask> const { exportBackground, viewBackgroundColor } = restoredAppState; <mask> return _exportToCanvas( <mask> getNonDeletedElements(restoredElements), <mask> { ...restoredAppState, offsetTop: 0, offsetLeft: 0, width: 0, height: 0 }, <mask> files || {}, <mask> { exportBackground, exportPadding, viewBackgroundColor }, <mask> (width: number, height: number) => { <mask> const canvas = document.createElement("canvas"); </s> fix: exporting labelled arrows via export utils (#6443) * fix: exporting labelled arrows via export utils * add comments * lint * update changelog * fix lint * initialize scene in the utils so it can be availabe in the helper functions * fix library rendering * add comments </s> remove await copyToClipboard(opts.elements, appState, opts.files); </s> add await copyToClipboard(scene.getNonDeletedElements(), appState, opts.files); </s> remove getNonDeletedElements(restoredElements), </s> add scene.getNonDeletedElements(), </s> remove opts.elements, </s> add scene.getNonDeletedElements(), </s> remove const canvas = await exportToCanvas(opts); </s> add // The helper methods getContainerElement and getBoundTextElement are // dependent on Scene which will not be available // when these pure utils are called outside Excalidraw or even if called // from inside Excalidraw when Scene isn't available eg when using library items from store, as a result the element cannot be extracted // hence initailizing a new scene with the elements // so its always available to helper methods const scene = new Scene(); scene.replaceAllElements(opts.elements); const canvas = await exportToCanvas({ ...opts, elements: scene.getNonDeletedElements(), }); </s> add // The helper methods getContainerElement and getBoundTextElement are // dependent on Scene which will not be available // when these pure utils are called outside Excalidraw or even if called // from inside Excalidraw when Scene isn't available eg when using library items from store, as a result the element cannot be extracted // hence initailizing a new scene with the elements // so its always available to helper methods const scene = new Scene(); scene.replaceAllElements(restoredElements); </s> add // The helper methods getContainerElement and getBoundTextElement are // dependent on Scene which will not be available // when these pure utils are called outside Excalidraw or even if called // from inside Excalidraw when Scene isn't available eg when using library items from store, as a result the element cannot be extracted // hence initailizing a new scene with the elements // so its always available to helper methods const scene = new Scene(); scene.replaceAllElements(opts.elements);
https://github.com/excalidraw/excalidraw/commit/ca3be2c678dfc5fae50d005fdcfe3b8c84fc2544
src/packages/utils.ts
keep keep keep keep replace replace keep keep keep keep keep
<mask> appState: { ...opts.appState, exportBackground: true }, <mask> }; <mask> } <mask> <mask> const canvas = await exportToCanvas(opts); <mask> <mask> quality = quality ? quality : /image\/jpe?g/.test(mimeType) ? 0.92 : 0.8; <mask> <mask> return new Promise((resolve, reject) => { <mask> canvas.toBlob( <mask> async (blob) => { </s> fix: exporting labelled arrows via export utils (#6443) * fix: exporting labelled arrows via export utils * add comments * lint * update changelog * fix lint * initialize scene in the utils so it can be availabe in the helper functions * fix library rendering * add comments </s> remove getNonDeletedElements(restoredElements), </s> add scene.getNonDeletedElements(), </s> remove await copyToClipboard(opts.elements, appState, opts.files); </s> add await copyToClipboard(scene.getNonDeletedElements(), appState, opts.files); </s> add // The helper methods getContainerElement and getBoundTextElement are // dependent on Scene which will not be available // when these pure utils are called outside Excalidraw or even if called // from inside Excalidraw when Scene isn't available eg when using library items from store, as a result the element cannot be extracted // hence initailizing a new scene with the elements // so its always available to helper methods const scene = new Scene(); scene.replaceAllElements(opts.elements); </s> remove import { exportToSvg } from "../scene/export"; </s> add import { exportToSvg } from "../packages/utils"; </s> remove opts.elements, </s> add scene.getNonDeletedElements(), </s> remove getNonDeletedElements(restoredElements), </s> add scene.getNonDeletedElements(),
https://github.com/excalidraw/excalidraw/commit/ca3be2c678dfc5fae50d005fdcfe3b8c84fc2544
src/packages/utils.ts
keep keep keep keep replace keep keep keep keep keep
<mask> ) { <mask> blob = await encodePngMetadata({ <mask> blob, <mask> metadata: serializeAsJSON( <mask> opts.elements, <mask> opts.appState, <mask> opts.files || {}, <mask> "local", <mask> ), <mask> }); </s> fix: exporting labelled arrows via export utils (#6443) * fix: exporting labelled arrows via export utils * add comments * lint * update changelog * fix lint * initialize scene in the utils so it can be availabe in the helper functions * fix library rendering * add comments </s> remove getNonDeletedElements(restoredElements), </s> add scene.getNonDeletedElements(), </s> remove const canvas = await exportToCanvas(opts); </s> add // The helper methods getContainerElement and getBoundTextElement are // dependent on Scene which will not be available // when these pure utils are called outside Excalidraw or even if called // from inside Excalidraw when Scene isn't available eg when using library items from store, as a result the element cannot be extracted // hence initailizing a new scene with the elements // so its always available to helper methods const scene = new Scene(); scene.replaceAllElements(opts.elements); const canvas = await exportToCanvas({ ...opts, elements: scene.getNonDeletedElements(), }); </s> add // The helper methods getContainerElement and getBoundTextElement are // dependent on Scene which will not be available // when these pure utils are called outside Excalidraw or even if called // from inside Excalidraw when Scene isn't available eg when using library items from store, as a result the element cannot be extracted // hence initailizing a new scene with the elements // so its always available to helper methods const scene = new Scene(); scene.replaceAllElements(opts.elements); </s> remove import { exportToSvg } from "../scene/export"; </s> add import { exportToSvg } from "../packages/utils"; </s> add // The helper methods getContainerElement and getBoundTextElement are // dependent on Scene which will not be available // when these pure utils are called outside Excalidraw or even if called // from inside Excalidraw when Scene isn't available eg when using library items from store, as a result the element cannot be extracted // hence initailizing a new scene with the elements // so its always available to helper methods const scene = new Scene(); scene.replaceAllElements(restoredElements); </s> remove getNonDeletedElements(restoredElements), </s> add scene.getNonDeletedElements(),
https://github.com/excalidraw/excalidraw/commit/ca3be2c678dfc5fae50d005fdcfe3b8c84fc2544
src/packages/utils.ts
keep add keep keep keep keep keep keep
<mask> null, <mask> ); <mask> return _exportToSvg( <mask> scene.getNonDeletedElements(), <mask> { <mask> ...restoredAppState, <mask> exportPadding, <mask> }, </s> fix: exporting labelled arrows via export utils (#6443) * fix: exporting labelled arrows via export utils * add comments * lint * update changelog * fix lint * initialize scene in the utils so it can be availabe in the helper functions * fix library rendering * add comments </s> remove getNonDeletedElements(restoredElements), </s> add scene.getNonDeletedElements(), </s> remove getNonDeletedElements(restoredElements), </s> add scene.getNonDeletedElements(), </s> remove opts.elements, </s> add scene.getNonDeletedElements(), </s> remove const canvas = await exportToCanvas(opts); </s> add // The helper methods getContainerElement and getBoundTextElement are // dependent on Scene which will not be available // when these pure utils are called outside Excalidraw or even if called // from inside Excalidraw when Scene isn't available eg when using library items from store, as a result the element cannot be extracted // hence initailizing a new scene with the elements // so its always available to helper methods const scene = new Scene(); scene.replaceAllElements(opts.elements); const canvas = await exportToCanvas({ ...opts, elements: scene.getNonDeletedElements(), }); </s> add // The helper methods getContainerElement and getBoundTextElement are // dependent on Scene which will not be available // when these pure utils are called outside Excalidraw or even if called // from inside Excalidraw when Scene isn't available eg when using library items from store, as a result the element cannot be extracted // hence initailizing a new scene with the elements // so its always available to helper methods const scene = new Scene(); scene.replaceAllElements(opts.elements); </s> remove import { exportToSvg } from "../scene/export"; </s> add import { exportToSvg } from "../packages/utils";
https://github.com/excalidraw/excalidraw/commit/ca3be2c678dfc5fae50d005fdcfe3b8c84fc2544
src/packages/utils.ts
keep keep keep keep replace keep keep keep keep keep
<mask> null, <mask> null, <mask> ); <mask> return _exportToSvg( <mask> getNonDeletedElements(restoredElements), <mask> { <mask> ...restoredAppState, <mask> exportPadding, <mask> }, <mask> files, </s> fix: exporting labelled arrows via export utils (#6443) * fix: exporting labelled arrows via export utils * add comments * lint * update changelog * fix lint * initialize scene in the utils so it can be availabe in the helper functions * fix library rendering * add comments </s> remove getNonDeletedElements(restoredElements), </s> add scene.getNonDeletedElements(), </s> add // The helper methods getContainerElement and getBoundTextElement are // dependent on Scene which will not be available // when these pure utils are called outside Excalidraw or even if called // from inside Excalidraw when Scene isn't available eg when using library items from store, as a result the element cannot be extracted // hence initailizing a new scene with the elements // so its always available to helper methods const scene = new Scene(); scene.replaceAllElements(restoredElements); </s> add // The helper methods getContainerElement and getBoundTextElement are // dependent on Scene which will not be available // when these pure utils are called outside Excalidraw or even if called // from inside Excalidraw when Scene isn't available eg when using library items from store, as a result the element cannot be extracted // hence initailizing a new scene with the elements // so its always available to helper methods const scene = new Scene(); scene.replaceAllElements(opts.elements); </s> remove import { exportToSvg } from "../scene/export"; </s> add import { exportToSvg } from "../packages/utils"; </s> remove const canvas = await exportToCanvas(opts); </s> add // The helper methods getContainerElement and getBoundTextElement are // dependent on Scene which will not be available // when these pure utils are called outside Excalidraw or even if called // from inside Excalidraw when Scene isn't available eg when using library items from store, as a result the element cannot be extracted // hence initailizing a new scene with the elements // so its always available to helper methods const scene = new Scene(); scene.replaceAllElements(opts.elements); const canvas = await exportToCanvas({ ...opts, elements: scene.getNonDeletedElements(), }); </s> remove opts.elements, </s> add scene.getNonDeletedElements(),
https://github.com/excalidraw/excalidraw/commit/ca3be2c678dfc5fae50d005fdcfe3b8c84fc2544
src/packages/utils.ts
keep keep keep add keep keep keep keep
<mask> quality?: number; <mask> type: "png" | "svg" | "json"; <mask> }, <mask> ) => { <mask> if (opts.type === "svg") { <mask> const svg = await exportToSvg(opts); <mask> await copyTextToSystemClipboard(svg.outerHTML); <mask> } else if (opts.type === "png") { </s> fix: exporting labelled arrows via export utils (#6443) * fix: exporting labelled arrows via export utils * add comments * lint * update changelog * fix lint * initialize scene in the utils so it can be availabe in the helper functions * fix library rendering * add comments </s> remove getNonDeletedElements(restoredElements), </s> add scene.getNonDeletedElements(), </s> remove opts.elements, </s> add scene.getNonDeletedElements(), </s> remove const canvas = await exportToCanvas(opts); </s> add // The helper methods getContainerElement and getBoundTextElement are // dependent on Scene which will not be available // when these pure utils are called outside Excalidraw or even if called // from inside Excalidraw when Scene isn't available eg when using library items from store, as a result the element cannot be extracted // hence initailizing a new scene with the elements // so its always available to helper methods const scene = new Scene(); scene.replaceAllElements(opts.elements); const canvas = await exportToCanvas({ ...opts, elements: scene.getNonDeletedElements(), }); </s> remove await copyToClipboard(opts.elements, appState, opts.files); </s> add await copyToClipboard(scene.getNonDeletedElements(), appState, opts.files); </s> remove import { exportToSvg } from "../scene/export"; </s> add import { exportToSvg } from "../packages/utils"; </s> add // The helper methods getContainerElement and getBoundTextElement are // dependent on Scene which will not be available // when these pure utils are called outside Excalidraw or even if called // from inside Excalidraw when Scene isn't available eg when using library items from store, as a result the element cannot be extracted // hence initailizing a new scene with the elements // so its always available to helper methods const scene = new Scene(); scene.replaceAllElements(restoredElements);
https://github.com/excalidraw/excalidraw/commit/ca3be2c678dfc5fae50d005fdcfe3b8c84fc2544
src/packages/utils.ts
keep keep keep keep replace keep keep keep keep keep
<mask> height: 0, <mask> ...getDefaultAppState(), <mask> ...opts.appState, <mask> }; <mask> await copyToClipboard(opts.elements, appState, opts.files); <mask> } else { <mask> throw new Error("Invalid export type"); <mask> } <mask> }; <mask> </s> fix: exporting labelled arrows via export utils (#6443) * fix: exporting labelled arrows via export utils * add comments * lint * update changelog * fix lint * initialize scene in the utils so it can be availabe in the helper functions * fix library rendering * add comments </s> remove getNonDeletedElements(restoredElements), </s> add scene.getNonDeletedElements(), </s> remove const canvas = await exportToCanvas(opts); </s> add // The helper methods getContainerElement and getBoundTextElement are // dependent on Scene which will not be available // when these pure utils are called outside Excalidraw or even if called // from inside Excalidraw when Scene isn't available eg when using library items from store, as a result the element cannot be extracted // hence initailizing a new scene with the elements // so its always available to helper methods const scene = new Scene(); scene.replaceAllElements(opts.elements); const canvas = await exportToCanvas({ ...opts, elements: scene.getNonDeletedElements(), }); </s> remove import { exportToSvg } from "../scene/export"; </s> add import { exportToSvg } from "../packages/utils"; </s> add // The helper methods getContainerElement and getBoundTextElement are // dependent on Scene which will not be available // when these pure utils are called outside Excalidraw or even if called // from inside Excalidraw when Scene isn't available eg when using library items from store, as a result the element cannot be extracted // hence initailizing a new scene with the elements // so its always available to helper methods const scene = new Scene(); scene.replaceAllElements(opts.elements); </s> remove getNonDeletedElements(restoredElements), </s> add scene.getNonDeletedElements(), </s> remove opts.elements, </s> add scene.getNonDeletedElements(),
https://github.com/excalidraw/excalidraw/commit/ca3be2c678dfc5fae50d005fdcfe3b8c84fc2544
src/packages/utils.ts
keep keep keep keep replace keep keep keep keep keep
<mask> }, <mask> })); <mask> } <mask> <mask> renderAction = (name: ActionName) => { <mask> if (this.actions[name] && "PanelComponent" in this.actions[name]) { <mask> const action = this.actions[name]; <mask> const PanelComponent = action.PanelComponent!; <mask> const updateData = (formState?: any) => { <mask> this.updater( </s> Add user list component + snap to user functionality (#1749) </s> remove const { background } = colorsForClientId(socketId); </s> add const { background } = getClientColors(socketId); </s> remove const { background, stroke } = colorsForClientId(clientId); </s> add const { background, stroke } = getClientColors(clientId); </s> remove const colorsForClientId = (clientId: string) => { // Naive way of getting an integer out of the clientId const sum = clientId.split("").reduce((a, str) => a + str.charCodeAt(0), 0); // Skip transparent background. const backgrounds = colors.elementBackground.slice(1); const strokes = colors.elementStroke.slice(1); return { background: backgrounds[sum % backgrounds.length], stroke: strokes[sum % strokes.length], }; }; </s> add </s> add // TODO: Extend tooltip component and use here. </s> add import { UserList } from "./UserList"; </s> remove <div /> </s> add <UserList className={`zen-mode-transition ${ zenModeEnabled && "transition-right" }`} > {Array.from(appState.collaborators) // Collaborator is either not initialized or is actually the current user. .filter(([_, client]) => Object.keys(client).length !== 0) .map(([clientId, client]) => ( <Tooltip label={client.username || "Unknown user"} key={clientId} > {actionManager.renderAction("goToCollaborator", clientId)} </Tooltip> ))} </UserList>
https://github.com/excalidraw/excalidraw/commit/ca87ca6fe902530bd317718bac7f9113a9c5a98e
src/actions/manager.tsx
keep keep add keep keep keep keep keep keep
<mask> elements={this.getElementsIncludingDeleted()} <mask> appState={this.getAppState()} <mask> updateData={updateData} <mask> /> <mask> ); <mask> } <mask> <mask> return null; <mask> }; </s> Add user list component + snap to user functionality (#1749) </s> remove const { background } = colorsForClientId(socketId); </s> add const { background } = getClientColors(socketId); </s> add export type Collaborator = { pointer?: { x: number; y: number; }; button?: "up" | "down"; selectedElementIds?: AppState["selectedElementIds"]; username?: string | null; }; </s> remove collaborators: Map< string, { pointer?: { x: number; y: number; }; button?: "up" | "down"; selectedElementIds?: AppState["selectedElementIds"]; username?: string | null; } >; </s> add collaborators: Map<string, Collaborator>; </s> remove const colorsForClientId = (clientId: string) => { // Naive way of getting an integer out of the clientId const sum = clientId.split("").reduce((a, str) => a + str.charCodeAt(0), 0); // Skip transparent background. const backgrounds = colors.elementBackground.slice(1); const strokes = colors.elementStroke.slice(1); return { background: backgrounds[sum % backgrounds.length], stroke: strokes[sum % strokes.length], }; }; </s> add </s> remove <div /> </s> add <UserList className={`zen-mode-transition ${ zenModeEnabled && "transition-right" }`} > {Array.from(appState.collaborators) // Collaborator is either not initialized or is actually the current user. .filter(([_, client]) => Object.keys(client).length !== 0) .map(([clientId, client]) => ( <Tooltip label={client.username || "Unknown user"} key={clientId} > {actionManager.renderAction("goToCollaborator", clientId)} </Tooltip> ))} </UserList> </s> add import { UserList } from "./UserList";
https://github.com/excalidraw/excalidraw/commit/ca87ca6fe902530bd317718bac7f9113a9c5a98e
src/actions/manager.tsx
keep keep keep keep replace keep keep keep keep keep
<mask> | "changeTextAlign" <mask> | "toggleFullScreen" <mask> | "toggleShortcuts" <mask> | "group" <mask> | "ungroup"; <mask> <mask> export interface Action { <mask> name: ActionName; <mask> PanelComponent?: React.FC<{ <mask> elements: readonly ExcalidrawElement[]; </s> Add user list component + snap to user functionality (#1749) </s> add export type Collaborator = { pointer?: { x: number; y: number; }; button?: "up" | "down"; selectedElementIds?: AppState["selectedElementIds"]; username?: string | null; }; </s> remove collaborators: Map< string, { pointer?: { x: number; y: number; }; button?: "up" | "down"; selectedElementIds?: AppState["selectedElementIds"]; username?: string | null; } >; </s> add collaborators: Map<string, Collaborator>; </s> add id?: string; </s> add import { Tooltip } from "./Tooltip"; </s> add import { UserList } from "./UserList"; </s> remove const { background } = colorsForClientId(socketId); </s> add const { background } = getClientColors(socketId);
https://github.com/excalidraw/excalidraw/commit/ca87ca6fe902530bd317718bac7f9113a9c5a98e
src/actions/types.ts
keep keep add keep keep keep keep
<mask> elements: readonly ExcalidrawElement[]; <mask> appState: AppState; <mask> updateData: (formData?: any) => void; <mask> }>; <mask> perform: ActionFn; <mask> keyPriority?: number; <mask> keyTest?: ( </s> Add user list component + snap to user functionality (#1749) </s> remove | "ungroup"; </s> add | "ungroup" | "goToCollaborator"; </s> add import { Tooltip } from "./Tooltip"; </s> add import { UserList } from "./UserList"; </s> add // TODO: Extend tooltip component and use here. </s> add export type Collaborator = { pointer?: { x: number; y: number; }; button?: "up" | "down"; selectedElementIds?: AppState["selectedElementIds"]; username?: string | null; }; </s> remove renderAction = (name: ActionName) => { </s> add // Id is an attribute that we can use to pass in data like keys. // This is needed for dynamically generated action components // like the user list. We can use this key to extract more // data from app state. This is an alternative to generic prop hell! renderAction = (name: ActionName, id?: string) => {
https://github.com/excalidraw/excalidraw/commit/ca87ca6fe902530bd317718bac7f9113a9c5a98e
src/actions/types.ts
keep keep add keep keep keep keep keep
<mask> import { Island } from "./Island"; <mask> import Stack from "./Stack"; <mask> import { FixedSideContainer } from "./FixedSideContainer"; <mask> import { LockIcon } from "./LockIcon"; <mask> import { ExportDialog, ExportCB } from "./ExportDialog"; <mask> import { LanguageList } from "./LanguageList"; <mask> import { t, languages, setLanguage } from "../i18n"; <mask> import { HintViewer } from "./HintViewer"; </s> Add user list component + snap to user functionality (#1749) </s> add import { UserList } from "./UserList"; </s> remove import colors from "../colors"; </s> add import { getClientColors } from "../clients"; </s> add import { Tooltip } from "./Tooltip"; </s> remove const { background } = colorsForClientId(socketId); </s> add const { background } = getClientColors(socketId); </s> add z-index: 2; </s> remove renderAction = (name: ActionName) => { </s> add // Id is an attribute that we can use to pass in data like keys. // This is needed for dynamically generated action components // like the user list. We can use this key to extract more // data from app state. This is an alternative to generic prop hell! renderAction = (name: ActionName, id?: string) => {
https://github.com/excalidraw/excalidraw/commit/ca87ca6fe902530bd317718bac7f9113a9c5a98e
src/components/LayerUI.tsx
keep keep add keep keep keep keep keep keep
<mask> import { CLASSES } from "../constants"; <mask> import { shield } from "./icons"; <mask> import { GitHubCorner } from "./GitHubCorner"; <mask> <mask> import "./LayerUI.scss"; <mask> <mask> interface LayerUIProps { <mask> actionManager: ActionManager; <mask> appState: AppState; </s> Add user list component + snap to user functionality (#1749) </s> add import { UserList } from "./UserList"; </s> add import { UserList } from "./UserList"; </s> remove import colors from "../colors"; </s> add import { getClientColors } from "../clients"; </s> remove const { background } = colorsForClientId(socketId); </s> add const { background } = getClientColors(socketId); </s> add z-index: 2; </s> remove renderAction = (name: ActionName) => { </s> add // Id is an attribute that we can use to pass in data like keys. // This is needed for dynamically generated action components // like the user list. We can use this key to extract more // data from app state. This is an alternative to generic prop hell! renderAction = (name: ActionName, id?: string) => {
https://github.com/excalidraw/excalidraw/commit/ca87ca6fe902530bd317718bac7f9113a9c5a98e
src/components/LayerUI.tsx
keep add keep keep keep keep
<mask> const isMobile = useIsMobile(); <mask> <mask> const renderEncryptedIcon = () => ( <mask> <a <mask> className={`encrypted-icon tooltip zen-mode-visibility ${ <mask> zenModeEnabled ? "zen-mode-visibility--hidden" : "" </s> Add user list component + snap to user functionality (#1749) </s> remove <div /> </s> add <UserList className={`zen-mode-transition ${ zenModeEnabled && "transition-right" }`} > {Array.from(appState.collaborators) // Collaborator is either not initialized or is actually the current user. .filter(([_, client]) => Object.keys(client).length !== 0) .map(([clientId, client]) => ( <Tooltip label={client.username || "Unknown user"} key={clientId} > {actionManager.renderAction("goToCollaborator", clientId)} </Tooltip> ))} </UserList> </s> remove const colorsForClientId = (clientId: string) => { // Naive way of getting an integer out of the clientId const sum = clientId.split("").reduce((a, str) => a + str.charCodeAt(0), 0); // Skip transparent background. const backgrounds = colors.elementBackground.slice(1); const strokes = colors.elementStroke.slice(1); return { background: backgrounds[sum % backgrounds.length], stroke: strokes[sum % strokes.length], }; }; </s> add </s> remove const { background, stroke } = colorsForClientId(clientId); </s> add const { background, stroke } = getClientColors(clientId); </s> remove const { background } = colorsForClientId(socketId); </s> add const { background } = getClientColors(socketId); </s> remove renderAction = (name: ActionName) => { </s> add // Id is an attribute that we can use to pass in data like keys. // This is needed for dynamically generated action components // like the user list. We can use this key to extract more // data from app state. This is an alternative to generic prop hell! renderAction = (name: ActionName, id?: string) => { </s> add id?: string;
https://github.com/excalidraw/excalidraw/commit/ca87ca6fe902530bd317718bac7f9113a9c5a98e
src/components/LayerUI.tsx
keep keep keep keep replace keep keep keep keep keep
<mask> </Stack.Row> <mask> </Stack.Col> <mask> )} <mask> </Section> <mask> <div /> <mask> </div> <mask> { <mask> <div <mask> className={`App-menu App-menu_bottom zen-mode-transition ${ <mask> zenModeEnabled && "App-menu_bottom--transition-left" </s> Add user list component + snap to user functionality (#1749) </s> add // TODO: Extend tooltip component and use here. </s> add id={id} </s> remove renderAction = (name: ActionName) => { </s> add // Id is an attribute that we can use to pass in data like keys. // This is needed for dynamically generated action components // like the user list. We can use this key to extract more // data from app state. This is an alternative to generic prop hell! renderAction = (name: ActionName, id?: string) => { </s> add import { UserList } from "./UserList"; </s> remove const { background } = colorsForClientId(socketId); </s> add const { background } = getClientColors(socketId); </s> remove import colors from "../colors"; </s> add import { getClientColors } from "../clients";
https://github.com/excalidraw/excalidraw/commit/ca87ca6fe902530bd317718bac7f9113a9c5a98e
src/components/LayerUI.tsx
keep keep add keep keep keep keep keep keep
<mask> import { SCROLLBAR_WIDTH, SCROLLBAR_MARGIN } from "../scene/scrollbars"; <mask> import { LockIcon } from "./LockIcon"; <mask> import { LoadingMessage } from "./LoadingMessage"; <mask> <mask> type MobileMenuProps = { <mask> appState: AppState; <mask> actionManager: ActionManager; <mask> exportButton: React.ReactNode; <mask> setAppState: any; </s> Add user list component + snap to user functionality (#1749) </s> add import { Tooltip } from "./Tooltip"; </s> add import { UserList } from "./UserList"; </s> remove import colors from "../colors"; </s> add import { getClientColors } from "../clients"; </s> remove const { background } = colorsForClientId(socketId); </s> add const { background } = getClientColors(socketId); </s> add z-index: 2; </s> remove const colorsForClientId = (clientId: string) => { // Naive way of getting an integer out of the clientId const sum = clientId.split("").reduce((a, str) => a + str.charCodeAt(0), 0); // Skip transparent background. const backgrounds = colors.elementBackground.slice(1); const strokes = colors.elementStroke.slice(1); return { background: backgrounds[sum % backgrounds.length], stroke: strokes[sum % strokes.length], }; }; </s> add
https://github.com/excalidraw/excalidraw/commit/ca87ca6fe902530bd317718bac7f9113a9c5a98e
src/components/MobileMenu.tsx
keep keep keep add keep keep keep keep keep keep
<mask> <mask> .github-corner { <mask> position: fixed; <mask> top: 0; <mask> :root[dir="ltr"] & { <mask> right: 0; <mask> } <mask> :root[dir="rtl"] & { <mask> left: 0; <mask> } </s> Add user list component + snap to user functionality (#1749) </s> add import { UserList } from "./UserList"; </s> remove import colors from "../colors"; </s> add import { getClientColors } from "../clients"; </s> add import { Tooltip } from "./Tooltip"; </s> remove const { background } = colorsForClientId(socketId); </s> add const { background } = getClientColors(socketId); </s> add import { UserList } from "./UserList"; </s> remove const { background, stroke } = colorsForClientId(clientId); </s> add const { background, stroke } = getClientColors(clientId);
https://github.com/excalidraw/excalidraw/commit/ca87ca6fe902530bd317718bac7f9113a9c5a98e
src/css/styles.scss
keep keep keep keep replace keep keep keep keep keep
<mask> "name": "Name", <mask> "yourName": "Your name", <mask> "madeWithExcalidraw": "Made with Excalidraw", <mask> "group": "Group selection", <mask> "ungroup": "Ungroup selection" <mask> }, <mask> "buttons": { <mask> "clearReset": "Reset the canvas", <mask> "export": "Export", <mask> "exportToPng": "Export to PNG", </s> Add user list component + snap to user functionality (#1749) </s> remove renderAction = (name: ActionName) => { </s> add // Id is an attribute that we can use to pass in data like keys. // This is needed for dynamically generated action components // like the user list. We can use this key to extract more // data from app state. This is an alternative to generic prop hell! renderAction = (name: ActionName, id?: string) => { </s> remove const colorsForClientId = (clientId: string) => { // Naive way of getting an integer out of the clientId const sum = clientId.split("").reduce((a, str) => a + str.charCodeAt(0), 0); // Skip transparent background. const backgrounds = colors.elementBackground.slice(1); const strokes = colors.elementStroke.slice(1); return { background: backgrounds[sum % backgrounds.length], stroke: strokes[sum % strokes.length], }; }; </s> add </s> remove <div /> </s> add <UserList className={`zen-mode-transition ${ zenModeEnabled && "transition-right" }`} > {Array.from(appState.collaborators) // Collaborator is either not initialized or is actually the current user. .filter(([_, client]) => Object.keys(client).length !== 0) .map(([clientId, client]) => ( <Tooltip label={client.username || "Unknown user"} key={clientId} > {actionManager.renderAction("goToCollaborator", clientId)} </Tooltip> ))} </UserList> </s> add import { UserList } from "./UserList"; </s> remove const { background } = colorsForClientId(socketId); </s> add const { background } = getClientColors(socketId); </s> remove import colors from "../colors"; </s> add import { getClientColors } from "../clients";
https://github.com/excalidraw/excalidraw/commit/ca87ca6fe902530bd317718bac7f9113a9c5a98e
src/locales/en.json
keep keep keep keep replace keep keep keep keep keep
<mask> } from "../scene/scrollbars"; <mask> import { getSelectedElements } from "../scene/selection"; <mask> <mask> import { renderElement, renderElementToSvg } from "./renderElement"; <mask> import colors from "../colors"; <mask> import { isLinearElement } from "../element/typeChecks"; <mask> import { LinearElementEditor } from "../element/linearElementEditor"; <mask> import { <mask> isSelectedViaGroup, <mask> getSelectedGroupIds, </s> Add user list component + snap to user functionality (#1749) </s> add import { UserList } from "./UserList"; </s> add import { UserList } from "./UserList"; </s> add import { Tooltip } from "./Tooltip"; </s> remove const { background } = colorsForClientId(socketId); </s> add const { background } = getClientColors(socketId); </s> add z-index: 2; </s> remove renderAction = (name: ActionName) => { </s> add // Id is an attribute that we can use to pass in data like keys. // This is needed for dynamically generated action components // like the user list. We can use this key to extract more // data from app state. This is an alternative to generic prop hell! renderAction = (name: ActionName, id?: string) => {
https://github.com/excalidraw/excalidraw/commit/ca87ca6fe902530bd317718bac7f9113a9c5a98e
src/renderer/renderScene.ts
keep keep keep keep replace replace replace replace replace replace replace replace replace replace replace replace replace keep keep keep keep keep
<mask> } from "../groups"; <mask> <mask> type HandlerRectanglesRet = keyof ReturnType<typeof handlerRectangles>; <mask> <mask> const colorsForClientId = (clientId: string) => { <mask> // Naive way of getting an integer out of the clientId <mask> const sum = clientId.split("").reduce((a, str) => a + str.charCodeAt(0), 0); <mask> <mask> // Skip transparent background. <mask> const backgrounds = colors.elementBackground.slice(1); <mask> const strokes = colors.elementStroke.slice(1); <mask> return { <mask> background: backgrounds[sum % backgrounds.length], <mask> stroke: strokes[sum % strokes.length], <mask> }; <mask> }; <mask> <mask> const strokeRectWithRotation = ( <mask> context: CanvasRenderingContext2D, <mask> x: number, <mask> y: number, <mask> width: number, </s> Add user list component + snap to user functionality (#1749) </s> remove renderAction = (name: ActionName) => { </s> add // Id is an attribute that we can use to pass in data like keys. // This is needed for dynamically generated action components // like the user list. We can use this key to extract more // data from app state. This is an alternative to generic prop hell! renderAction = (name: ActionName, id?: string) => { </s> remove const { background } = colorsForClientId(socketId); </s> add const { background } = getClientColors(socketId); </s> remove const { background, stroke } = colorsForClientId(clientId); </s> add const { background, stroke } = getClientColors(clientId); </s> add // TODO: Extend tooltip component and use here. </s> add export type Collaborator = { pointer?: { x: number; y: number; }; button?: "up" | "down"; selectedElementIds?: AppState["selectedElementIds"]; username?: string | null; }; </s> add import { UserList } from "./UserList";
https://github.com/excalidraw/excalidraw/commit/ca87ca6fe902530bd317718bac7f9113a9c5a98e
src/renderer/renderScene.ts
keep keep keep keep replace keep keep keep keep keep
<mask> // remote users <mask> if (sceneState.remoteSelectedElementIds[element.id]) { <mask> selectionColors.push( <mask> ...sceneState.remoteSelectedElementIds[element.id].map((socketId) => { <mask> const { background } = colorsForClientId(socketId); <mask> return background; <mask> }), <mask> ); <mask> } <mask> if (selectionColors.length) { </s> Add user list component + snap to user functionality (#1749) </s> remove renderAction = (name: ActionName) => { </s> add // Id is an attribute that we can use to pass in data like keys. // This is needed for dynamically generated action components // like the user list. We can use this key to extract more // data from app state. This is an alternative to generic prop hell! renderAction = (name: ActionName, id?: string) => { </s> remove const colorsForClientId = (clientId: string) => { // Naive way of getting an integer out of the clientId const sum = clientId.split("").reduce((a, str) => a + str.charCodeAt(0), 0); // Skip transparent background. const backgrounds = colors.elementBackground.slice(1); const strokes = colors.elementStroke.slice(1); return { background: backgrounds[sum % backgrounds.length], stroke: strokes[sum % strokes.length], }; }; </s> add </s> remove const { background, stroke } = colorsForClientId(clientId); </s> add const { background, stroke } = getClientColors(clientId); </s> add import { UserList } from "./UserList"; </s> add import { UserList } from "./UserList"; </s> remove import colors from "../colors"; </s> add import { getClientColors } from "../clients";
https://github.com/excalidraw/excalidraw/commit/ca87ca6fe902530bd317718bac7f9113a9c5a98e
src/renderer/renderScene.ts
keep keep keep keep replace keep keep keep keep keep
<mask> x = Math.min(x, normalizedCanvasWidth - width); <mask> y = Math.max(y, 0); <mask> y = Math.min(y, normalizedCanvasHeight - height); <mask> <mask> const { background, stroke } = colorsForClientId(clientId); <mask> <mask> const strokeStyle = context.strokeStyle; <mask> const fillStyle = context.fillStyle; <mask> const globalAlpha = context.globalAlpha; <mask> context.strokeStyle = stroke; </s> Add user list component + snap to user functionality (#1749) </s> remove const colorsForClientId = (clientId: string) => { // Naive way of getting an integer out of the clientId const sum = clientId.split("").reduce((a, str) => a + str.charCodeAt(0), 0); // Skip transparent background. const backgrounds = colors.elementBackground.slice(1); const strokes = colors.elementStroke.slice(1); return { background: backgrounds[sum % backgrounds.length], stroke: strokes[sum % strokes.length], }; }; </s> add </s> remove const { background } = colorsForClientId(socketId); </s> add const { background } = getClientColors(socketId); </s> remove renderAction = (name: ActionName) => { </s> add // Id is an attribute that we can use to pass in data like keys. // This is needed for dynamically generated action components // like the user list. We can use this key to extract more // data from app state. This is an alternative to generic prop hell! renderAction = (name: ActionName, id?: string) => { </s> add // TODO: Extend tooltip component and use here. </s> add export type Collaborator = { pointer?: { x: number; y: number; }; button?: "up" | "down"; selectedElementIds?: AppState["selectedElementIds"]; username?: string | null; }; </s> add import { UserList } from "./UserList";
https://github.com/excalidraw/excalidraw/commit/ca87ca6fe902530bd317718bac7f9113a9c5a98e
src/renderer/renderScene.ts
keep add keep keep keep keep keep
<mask> export type Point = Readonly<RoughPoint>; <mask> <mask> export type AppState = { <mask> isLoading: boolean; <mask> errorMessage: string | null; <mask> draggingElement: NonDeletedExcalidrawElement | null; <mask> resizingElement: NonDeletedExcalidrawElement | null; </s> Add user list component + snap to user functionality (#1749) </s> remove collaborators: Map< string, { pointer?: { x: number; y: number; }; button?: "up" | "down"; selectedElementIds?: AppState["selectedElementIds"]; username?: string | null; } >; </s> add collaborators: Map<string, Collaborator>; </s> remove | "ungroup"; </s> add | "ungroup" | "goToCollaborator"; </s> add id={id} </s> add import { UserList } from "./UserList"; </s> remove const colorsForClientId = (clientId: string) => { // Naive way of getting an integer out of the clientId const sum = clientId.split("").reduce((a, str) => a + str.charCodeAt(0), 0); // Skip transparent background. const backgrounds = colors.elementBackground.slice(1); const strokes = colors.elementStroke.slice(1); return { background: backgrounds[sum % backgrounds.length], stroke: strokes[sum % strokes.length], }; }; </s> add </s> remove const { background, stroke } = colorsForClientId(clientId); </s> add const { background, stroke } = getClientColors(clientId);
https://github.com/excalidraw/excalidraw/commit/ca87ca6fe902530bd317718bac7f9113a9c5a98e
src/types.ts
keep keep keep keep replace replace replace replace replace replace replace replace replace replace replace replace keep keep keep keep keep
<mask> openMenu: "canvas" | "shape" | null; <mask> lastPointerDownWith: PointerType; <mask> selectedElementIds: { [id: string]: boolean }; <mask> previousSelectedElementIds: { [id: string]: boolean }; <mask> collaborators: Map< <mask> string, <mask> { <mask> pointer?: { <mask> x: number; <mask> y: number; <mask> }; <mask> button?: "up" | "down"; <mask> selectedElementIds?: AppState["selectedElementIds"]; <mask> username?: string | null; <mask> } <mask> >; <mask> shouldCacheIgnoreZoom: boolean; <mask> showShortcutsDialog: boolean; <mask> zenModeEnabled: boolean; <mask> <mask> /** top-most selected groups (i.e. does not include nested groups) */ </s> Add user list component + snap to user functionality (#1749) </s> add export type Collaborator = { pointer?: { x: number; y: number; }; button?: "up" | "down"; selectedElementIds?: AppState["selectedElementIds"]; username?: string | null; }; </s> remove | "ungroup"; </s> add | "ungroup" | "goToCollaborator"; </s> add id={id} </s> remove const colorsForClientId = (clientId: string) => { // Naive way of getting an integer out of the clientId const sum = clientId.split("").reduce((a, str) => a + str.charCodeAt(0), 0); // Skip transparent background. const backgrounds = colors.elementBackground.slice(1); const strokes = colors.elementStroke.slice(1); return { background: backgrounds[sum % backgrounds.length], stroke: strokes[sum % strokes.length], }; }; </s> add </s> add import { UserList } from "./UserList"; </s> remove import colors from "../colors"; </s> add import { getClientColors } from "../clients";
https://github.com/excalidraw/excalidraw/commit/ca87ca6fe902530bd317718bac7f9113a9c5a98e
src/types.ts
keep keep keep keep replace replace replace replace replace replace replace keep keep keep keep keep
<mask> }); <mask> <mask> describe("Test bounded text", () => { <mask> let rectangle: any; <mask> const { <mask> h, <mask> }: { <mask> h: { <mask> elements: any; <mask> }; <mask> } = window; <mask> <mask> const DUMMY_HEIGHT = 240; <mask> const DUMMY_WIDTH = 160; <mask> const APPROX_LINE_HEIGHT = 25; <mask> const INITIAL_WIDTH = 10; </s> feat: Sync local storage state across tabs when out of sync (#4545) Co-authored-by: dwelle <[email protected]> </s> add import { isBrowserStorageStateNewer, updateBrowserStateVersion, } from "./data/tabSync"; </s> remove export const STORAGE_KEYS = { LOCAL_STORAGE_ELEMENTS: "excalidraw", LOCAL_STORAGE_APP_STATE: "excalidraw-state", LOCAL_STORAGE_COLLAB: "excalidraw-collab", LOCAL_STORAGE_KEY_COLLAB_FORCE_FLAG: "collabLinkForceLoadFlag", LOCAL_STORAGE_LIBRARY: "excalidraw-library", }; </s> add import { updateBrowserStateVersion } from "./tabSync"; import { STORAGE_KEYS } from "../app_constants"; </s> add this.contextValue.setUsername = this.setUsername; </s> add export const SYNC_BROWSER_TABS_TIMEOUT = 50; </s> remove await new Promise((r) => setTimeout(r, 0)); </s> add </s> remove onUsernameChange = (username: string) => { </s> add setUsername = (username: string) => {
https://github.com/excalidraw/excalidraw/commit/ca89d47d4c8c92e8e720e54cd28cbeb2d04e84c3
src/element/textWysiwyg.test.tsx
keep keep keep add keep keep keep keep
<mask> }); <mask> <mask> beforeEach(async () => { <mask> await render(<ExcalidrawApp />); <mask> <mask> rectangle = UI.createElement("rectangle", { <mask> x: 10, <mask> y: 20, </s> feat: Sync local storage state across tabs when out of sync (#4545) Co-authored-by: dwelle <[email protected]> </s> remove onUsernameChange = (username: string) => { </s> add setUsername = (username: string) => { </s> remove expect(h.elements[1].fontFamily).toEqual(FONT_FAMILY.Cascadia); </s> add expect( (h.elements[1] as ExcalidrawTextElementWithContainer).fontFamily, ).toEqual(FONT_FAMILY.Cascadia); </s> add }; onUsernameChange = (username: string) => { this.setUsername(username); </s> remove await new Promise((r) => setTimeout(r, 0)); </s> add </s> add await new Promise((r) => setTimeout(r, 0)); </s> remove expect(h.elements[1].fontFamily).toEqual(FONT_FAMILY.Virgil); </s> add expect( (h.elements[1] as ExcalidrawTextElementWithContainer).fontFamily, ).toEqual(FONT_FAMILY.Virgil);
https://github.com/excalidraw/excalidraw/commit/ca89d47d4c8c92e8e720e54cd28cbeb2d04e84c3
src/element/textWysiwyg.test.tsx
keep keep keep keep replace replace keep keep keep keep keep
<mask> const editor = document.querySelector( <mask> ".excalidraw-textEditorContainer > textarea", <mask> ) as HTMLTextAreaElement; <mask> <mask> await new Promise((r) => setTimeout(r, 0)); <mask> <mask> fireEvent.change(editor, { target: { value: "Hello World!" } }); <mask> editor.blur(); <mask> expect(rectangle.boundElements).toStrictEqual([ <mask> { id: text.id, type: "text" }, <mask> ]); </s> feat: Sync local storage state across tabs when out of sync (#4545) Co-authored-by: dwelle <[email protected]> </s> add await new Promise((r) => setTimeout(r, 0)); </s> remove Keyboard.withModifierKeys({}, () => { Keyboard.keyPress(KEYS.ENTER); }); </s> add expect(h.elements.length).toBe(1); </s> remove expect(h.elements[1].fontFamily).toEqual(FONT_FAMILY.Cascadia); </s> add expect( (h.elements[1] as ExcalidrawTextElementWithContainer).fontFamily, ).toEqual(FONT_FAMILY.Cascadia); </s> add Keyboard.keyDown(KEYS.ENTER); </s> remove const { h, }: { h: { elements: any; }; } = window; </s> add const { h } = window; </s> remove try { data.scene.libraryItems = JSON.parse( localStorage.getItem(STORAGE_KEYS.LOCAL_STORAGE_LIBRARY) as string, ) || []; } catch (error: any) { console.error(error); } </s> add data.scene.libraryItems = getLibraryItemsFromStorage();
https://github.com/excalidraw/excalidraw/commit/ca89d47d4c8c92e8e720e54cd28cbeb2d04e84c3
src/element/textWysiwyg.test.tsx
keep keep keep add keep keep keep keep
<mask> ".excalidraw-textEditorContainer > textarea", <mask> ) as HTMLTextAreaElement; <mask> <mask> fireEvent.change(editor, { target: { value: "Hello World!" } }); <mask> editor.blur(); <mask> expect(rectangle.boundElements).toStrictEqual([ <mask> { id: text.id, type: "text" }, <mask> ]); </s> feat: Sync local storage state across tabs when out of sync (#4545) Co-authored-by: dwelle <[email protected]> </s> remove await new Promise((r) => setTimeout(r, 0)); </s> add </s> remove Keyboard.withModifierKeys({}, () => { Keyboard.keyPress(KEYS.ENTER); }); </s> add expect(h.elements.length).toBe(1); </s> add Keyboard.keyDown(KEYS.ENTER); </s> remove expect(h.elements[1].fontFamily).toEqual(FONT_FAMILY.Cascadia); </s> add expect( (h.elements[1] as ExcalidrawTextElementWithContainer).fontFamily, ).toEqual(FONT_FAMILY.Cascadia); </s> remove try { data.scene.libraryItems = JSON.parse( localStorage.getItem(STORAGE_KEYS.LOCAL_STORAGE_LIBRARY) as string, ) || []; } catch (error: any) { console.error(error); } </s> add data.scene.libraryItems = getLibraryItemsFromStorage(); </s> remove expect(h.elements[1].fontFamily).toEqual(FONT_FAMILY.Virgil); </s> add expect( (h.elements[1] as ExcalidrawTextElementWithContainer).fontFamily, ).toEqual(FONT_FAMILY.Virgil);
https://github.com/excalidraw/excalidraw/commit/ca89d47d4c8c92e8e720e54cd28cbeb2d04e84c3
src/element/textWysiwyg.test.tsx
keep add keep keep keep keep keep
<mask> <mask> it("should update font family correctly on undo/redo by selecting bounded text when font family was updated", async () => { <mask> mouse.doubleClickAt( <mask> rectangle.x + rectangle.width / 2, <mask> rectangle.y + rectangle.height / 2, <mask> ); <mask> mouse.down(); </s> feat: Sync local storage state across tabs when out of sync (#4545) Co-authored-by: dwelle <[email protected]> </s> remove expect(h.elements[1].fontFamily).toEqual(FONT_FAMILY.Cascadia); </s> add expect( (h.elements[1] as ExcalidrawTextElementWithContainer).fontFamily, ).toEqual(FONT_FAMILY.Cascadia); </s> remove const { h, }: { h: { elements: any; }; } = window; </s> add const { h } = window; </s> remove Keyboard.withModifierKeys({}, () => { Keyboard.keyPress(KEYS.ENTER); }); </s> add expect(h.elements.length).toBe(1); </s> add updateBrowserStateVersion(STORAGE_KEYS.VERSION_DATA_STATE); </s> remove onUsernameChange = (username: string) => { </s> add setUsername = (username: string) => { </s> add }; onUsernameChange = (username: string) => { this.setUsername(username);
https://github.com/excalidraw/excalidraw/commit/ca89d47d4c8c92e8e720e54cd28cbeb2d04e84c3
src/element/textWysiwyg.test.tsx
keep keep keep keep replace keep keep keep keep keep
<mask> fireEvent.click(screen.getByTitle(/code/i)); <mask> <mask> await new Promise((r) => setTimeout(r, 0)); <mask> editor.blur(); <mask> expect(h.elements[1].fontFamily).toEqual(FONT_FAMILY.Cascadia); <mask> <mask> //undo <mask> Keyboard.withModifierKeys({ ctrl: true }, () => { <mask> Keyboard.keyPress(KEYS.Z); <mask> }); </s> feat: Sync local storage state across tabs when out of sync (#4545) Co-authored-by: dwelle <[email protected]> </s> remove expect(h.elements[1].fontFamily).toEqual(FONT_FAMILY.Virgil); </s> add expect( (h.elements[1] as ExcalidrawTextElementWithContainer).fontFamily, ).toEqual(FONT_FAMILY.Virgil); </s> add await new Promise((r) => setTimeout(r, 0)); </s> remove expect(h.elements[1].fontFamily).toEqual(FONT_FAMILY.Cascadia); </s> add expect( (h.elements[1] as ExcalidrawTextElementWithContainer).fontFamily, ).toEqual(FONT_FAMILY.Cascadia); </s> remove await new Promise((r) => setTimeout(r, 0)); </s> add </s> add h.elements = []; </s> remove onUsernameChange = (username: string) => { </s> add setUsername = (username: string) => {
https://github.com/excalidraw/excalidraw/commit/ca89d47d4c8c92e8e720e54cd28cbeb2d04e84c3
src/element/textWysiwyg.test.tsx
keep keep keep keep replace keep keep keep keep keep
<mask> //undo <mask> Keyboard.withModifierKeys({ ctrl: true }, () => { <mask> Keyboard.keyPress(KEYS.Z); <mask> }); <mask> expect(h.elements[1].fontFamily).toEqual(FONT_FAMILY.Virgil); <mask> <mask> //redo <mask> Keyboard.withModifierKeys({ ctrl: true, shift: true }, () => { <mask> Keyboard.keyPress(KEYS.Z); <mask> }); </s> feat: Sync local storage state across tabs when out of sync (#4545) Co-authored-by: dwelle <[email protected]> </s> remove expect(h.elements[1].fontFamily).toEqual(FONT_FAMILY.Cascadia); </s> add expect( (h.elements[1] as ExcalidrawTextElementWithContainer).fontFamily, ).toEqual(FONT_FAMILY.Cascadia); </s> remove expect(h.elements[1].fontFamily).toEqual(FONT_FAMILY.Cascadia); </s> add expect( (h.elements[1] as ExcalidrawTextElementWithContainer).fontFamily, ).toEqual(FONT_FAMILY.Cascadia); </s> remove onUsernameChange = (username: string) => { </s> add setUsername = (username: string) => { </s> add }; onUsernameChange = (username: string) => { this.setUsername(username); </s> add await new Promise((r) => setTimeout(r, 0)); </s> remove await new Promise((r) => setTimeout(r, 0)); </s> add
https://github.com/excalidraw/excalidraw/commit/ca89d47d4c8c92e8e720e54cd28cbeb2d04e84c3
src/element/textWysiwyg.test.tsx
keep keep keep keep replace keep keep keep keep keep
<mask> //redo <mask> Keyboard.withModifierKeys({ ctrl: true, shift: true }, () => { <mask> Keyboard.keyPress(KEYS.Z); <mask> }); <mask> expect(h.elements[1].fontFamily).toEqual(FONT_FAMILY.Cascadia); <mask> }); <mask> <mask> it("should wrap text and vertcially center align once text submitted", async () => { <mask> jest <mask> .spyOn(textElementUtils, "measureText") </s> feat: Sync local storage state across tabs when out of sync (#4545) Co-authored-by: dwelle <[email protected]> </s> remove expect(h.elements[1].fontFamily).toEqual(FONT_FAMILY.Virgil); </s> add expect( (h.elements[1] as ExcalidrawTextElementWithContainer).fontFamily, ).toEqual(FONT_FAMILY.Virgil); </s> remove expect(h.elements[1].fontFamily).toEqual(FONT_FAMILY.Cascadia); </s> add expect( (h.elements[1] as ExcalidrawTextElementWithContainer).fontFamily, ).toEqual(FONT_FAMILY.Cascadia); </s> add expect(h.elements.length).toBe(1); </s> remove Keyboard.withModifierKeys({}, () => { Keyboard.keyPress(KEYS.ENTER); }); </s> add expect(h.elements.length).toBe(1); </s> remove onUsernameChange = (username: string) => { </s> add setUsername = (username: string) => { </s> add }; onUsernameChange = (username: string) => { this.setUsername(username);
https://github.com/excalidraw/excalidraw/commit/ca89d47d4c8c92e8e720e54cd28cbeb2d04e84c3
src/element/textWysiwyg.test.tsx
keep keep keep keep replace replace replace keep keep keep keep keep
<mask> baseline, <mask> }; <mask> }); <mask> <mask> Keyboard.withModifierKeys({}, () => { <mask> Keyboard.keyPress(KEYS.ENTER); <mask> }); <mask> <mask> let text = h.elements[1] as ExcalidrawTextElementWithContainer; <mask> let editor = document.querySelector( <mask> ".excalidraw-textEditorContainer > textarea", <mask> ) as HTMLTextAreaElement; </s> feat: Sync local storage state across tabs when out of sync (#4545) Co-authored-by: dwelle <[email protected]> </s> add Keyboard.keyDown(KEYS.ENTER); </s> remove await new Promise((r) => setTimeout(r, 0)); </s> add </s> add await new Promise((r) => setTimeout(r, 0)); </s> remove const { h, }: { h: { elements: any; }; } = window; </s> add const { h } = window; </s> remove expect(h.elements[1].fontFamily).toEqual(FONT_FAMILY.Cascadia); </s> add expect( (h.elements[1] as ExcalidrawTextElementWithContainer).fontFamily, ).toEqual(FONT_FAMILY.Cascadia); </s> remove onUsernameChange = (username: string) => { </s> add setUsername = (username: string) => {
https://github.com/excalidraw/excalidraw/commit/ca89d47d4c8c92e8e720e54cd28cbeb2d04e84c3
src/element/textWysiwyg.test.tsx
keep add keep keep keep keep keep keep
<mask> expect(h.elements.length).toBe(1); <mask> <mask> let text = h.elements[1] as ExcalidrawTextElementWithContainer; <mask> let editor = document.querySelector( <mask> ".excalidraw-textEditorContainer > textarea", <mask> ) as HTMLTextAreaElement; <mask> <mask> // mock scroll height </s> feat: Sync local storage state across tabs when out of sync (#4545) Co-authored-by: dwelle <[email protected]> </s> remove Keyboard.withModifierKeys({}, () => { Keyboard.keyPress(KEYS.ENTER); }); </s> add expect(h.elements.length).toBe(1); </s> remove await new Promise((r) => setTimeout(r, 0)); </s> add </s> add await new Promise((r) => setTimeout(r, 0)); </s> remove const { h, }: { h: { elements: any; }; } = window; </s> add const { h } = window; </s> remove expect(h.elements[1].fontFamily).toEqual(FONT_FAMILY.Cascadia); </s> add expect( (h.elements[1] as ExcalidrawTextElementWithContainer).fontFamily, ).toEqual(FONT_FAMILY.Cascadia); </s> add expect(h.elements.length).toBe(1);
https://github.com/excalidraw/excalidraw/commit/ca89d47d4c8c92e8e720e54cd28cbeb2d04e84c3
src/element/textWysiwyg.test.tsx
keep add keep keep keep keep keep
<mask> export const LOAD_IMAGES_TIMEOUT = 500; <mask> export const SYNC_FULL_SCENE_INTERVAL_MS = 20000; <mask> <mask> export const FILE_UPLOAD_MAX_BYTES = 3 * 1024 * 1024; // 3 MiB <mask> // 1 year (https://stackoverflow.com/a/25201898/927631) <mask> export const FILE_CACHE_MAX_AGE_SEC = 31536000; <mask> </s> feat: Sync local storage state across tabs when out of sync (#4545) Co-authored-by: dwelle <[email protected]> </s> remove export const STORAGE_KEYS = { LOCAL_STORAGE_ELEMENTS: "excalidraw", LOCAL_STORAGE_APP_STATE: "excalidraw-state", LOCAL_STORAGE_COLLAB: "excalidraw-collab", LOCAL_STORAGE_KEY_COLLAB_FORCE_FLAG: "collabLinkForceLoadFlag", LOCAL_STORAGE_LIBRARY: "excalidraw-library", }; </s> add import { updateBrowserStateVersion } from "./tabSync"; import { STORAGE_KEYS } from "../app_constants"; </s> remove const { h, }: { h: { elements: any; }; } = window; </s> add const { h } = window; </s> add // before we use `storage` event synchronization, let's update the flag // optimistically. Hopefully nothing fails, and an IDB read executed // before an IDB write finishes will read the latest value. updateBrowserStateVersion(STORAGE_KEYS.VERSION_FILES); </s> add import { isBrowserStorageStateNewer, updateBrowserStateVersion, } from "./data/tabSync"; </s> add this.contextValue.setUsername = this.setUsername; </s> remove await new Promise((r) => setTimeout(r, 0)); </s> add
https://github.com/excalidraw/excalidraw/commit/ca89d47d4c8c92e8e720e54cd28cbeb2d04e84c3
src/excalidraw-app/app_constants.ts
keep keep keep add keep keep keep keep
<mask> FIREBASE_STORAGE_PREFIXES, <mask> INITIAL_SCENE_UPDATE_TIMEOUT, <mask> LOAD_IMAGES_TIMEOUT, <mask> SCENE, <mask> SYNC_FULL_SCENE_INTERVAL_MS, <mask> } from "../app_constants"; <mask> import { <mask> generateCollaborationLinkData, </s> feat: Sync local storage state across tabs when out of sync (#4545) Co-authored-by: dwelle <[email protected]> </s> add STORAGE_KEYS, SYNC_BROWSER_TABS_TIMEOUT, </s> remove export const STORAGE_KEYS = { LOCAL_STORAGE_ELEMENTS: "excalidraw", LOCAL_STORAGE_APP_STATE: "excalidraw-state", LOCAL_STORAGE_COLLAB: "excalidraw-collab", LOCAL_STORAGE_KEY_COLLAB_FORCE_FLAG: "collabLinkForceLoadFlag", LOCAL_STORAGE_LIBRARY: "excalidraw-library", }; </s> add import { updateBrowserStateVersion } from "./tabSync"; import { STORAGE_KEYS } from "../app_constants"; </s> remove import { STORAGE_KEYS } from "../excalidraw-app/data/localStorage"; </s> add import { STORAGE_KEYS } from "../excalidraw-app/app_constants"; </s> remove STORAGE_KEYS, </s> add </s> remove STORAGE_KEYS, </s> add </s> add getLibraryItemsFromStorage,
https://github.com/excalidraw/excalidraw/commit/ca89d47d4c8c92e8e720e54cd28cbeb2d04e84c3
src/excalidraw-app/collab/CollabWrapper.tsx
keep keep keep keep replace keep keep keep keep keep
<mask> } from "../data/firebase"; <mask> import { <mask> importUsernameFromLocalStorage, <mask> saveUsernameToLocalStorage, <mask> STORAGE_KEYS, <mask> } from "../data/localStorage"; <mask> import Portal from "./Portal"; <mask> import RoomDialog from "./RoomDialog"; <mask> import { createInverseContext } from "../../createInverseContext"; <mask> import { t } from "../../i18n"; </s> feat: Sync local storage state across tabs when out of sync (#4545) Co-authored-by: dwelle <[email protected]> </s> remove STORAGE_KEYS, </s> add </s> add getLibraryItemsFromStorage, </s> add importUsernameFromLocalStorage, </s> remove import { STORAGE_KEYS } from "../excalidraw-app/data/localStorage"; </s> add import { STORAGE_KEYS } from "../excalidraw-app/app_constants"; </s> add import { isBrowserStorageStateNewer, updateBrowserStateVersion, } from "./data/tabSync"; </s> add isTestEnv,
https://github.com/excalidraw/excalidraw/commit/ca89d47d4c8c92e8e720e54cd28cbeb2d04e84c3
src/excalidraw-app/collab/CollabWrapper.tsx
keep keep add keep keep keep keep keep
<mask> reconcileElements as _reconcileElements, <mask> } from "./reconciliation"; <mask> import { decryptData } from "../../data/encryption"; <mask> <mask> interface CollabState { <mask> modalIsShown: boolean; <mask> errorMessage: string; <mask> username: string; </s> feat: Sync local storage state across tabs when out of sync (#4545) Co-authored-by: dwelle <[email protected]> </s> remove import { STORAGE_KEYS } from "../excalidraw-app/data/localStorage"; </s> add import { STORAGE_KEYS } from "../excalidraw-app/app_constants"; </s> remove STORAGE_KEYS, </s> add </s> remove STORAGE_KEYS, </s> add </s> add getLibraryItemsFromStorage, </s> add import { isBrowserStorageStateNewer, updateBrowserStateVersion, } from "./data/tabSync"; </s> add importUsernameFromLocalStorage,
https://github.com/excalidraw/excalidraw/commit/ca89d47d4c8c92e8e720e54cd28cbeb2d04e84c3
src/excalidraw-app/collab/CollabWrapper.tsx
keep add keep keep keep keep
<mask> broadcastElements: CollabInstance["broadcastElements"]; <mask> fetchImageFilesFromFirebase: CollabInstance["fetchImageFilesFromFirebase"]; <mask> } <mask> <mask> interface Props { <mask> excalidrawAPI: ExcalidrawImperativeAPI; </s> feat: Sync local storage state across tabs when out of sync (#4545) Co-authored-by: dwelle <[email protected]> </s> add import { resetBrowserStateVersions } from "../data/tabSync"; </s> remove import { STORAGE_KEYS } from "../excalidraw-app/data/localStorage"; </s> add import { STORAGE_KEYS } from "../excalidraw-app/app_constants"; </s> remove STORAGE_KEYS, </s> add </s> add import { isBrowserStorageStateNewer, updateBrowserStateVersion, } from "./data/tabSync"; </s> add getLibraryItemsFromStorage, </s> remove STORAGE_KEYS, </s> add
https://github.com/excalidraw/excalidraw/commit/ca89d47d4c8c92e8e720e54cd28cbeb2d04e84c3
src/excalidraw-app/collab/CollabWrapper.tsx
keep keep add keep keep keep keep
<mask> <mask> this.saveCollabRoomToFirebase(); <mask> if (window.confirm(t("alerts.collabStopOverridePrompt"))) { <mask> window.history.pushState({}, APP_NAME, window.location.origin); <mask> this.destroySocketClient(); <mask> trackEvent("share", "room closed"); <mask> </s> feat: Sync local storage state across tabs when out of sync (#4545) Co-authored-by: dwelle <[email protected]> </s> remove import { STORAGE_KEYS } from "../excalidraw-app/data/localStorage"; </s> add import { STORAGE_KEYS } from "../excalidraw-app/app_constants"; </s> add import { isBrowserStorageStateNewer, updateBrowserStateVersion, } from "./data/tabSync"; </s> remove STORAGE_KEYS, </s> add </s> remove export const STORAGE_KEYS = { LOCAL_STORAGE_ELEMENTS: "excalidraw", LOCAL_STORAGE_APP_STATE: "excalidraw-state", LOCAL_STORAGE_COLLAB: "excalidraw-collab", LOCAL_STORAGE_KEY_COLLAB_FORCE_FLAG: "collabLinkForceLoadFlag", LOCAL_STORAGE_LIBRARY: "excalidraw-library", }; </s> add import { updateBrowserStateVersion } from "./tabSync"; import { STORAGE_KEYS } from "../app_constants"; </s> remove onUsernameChange = (username: string) => { </s> add setUsername = (username: string) => { </s> add getLibraryItemsFromStorage,
https://github.com/excalidraw/excalidraw/commit/ca89d47d4c8c92e8e720e54cd28cbeb2d04e84c3
src/excalidraw-app/collab/CollabWrapper.tsx
keep keep keep keep replace keep keep keep keep keep
<mask> handleClose = () => { <mask> this.setState({ modalIsShown: false }); <mask> }; <mask> <mask> onUsernameChange = (username: string) => { <mask> this.setState({ username }); <mask> saveUsernameToLocalStorage(username); <mask> }; <mask> <mask> onCollabButtonClick = () => { </s> feat: Sync local storage state across tabs when out of sync (#4545) Co-authored-by: dwelle <[email protected]> </s> add }; onUsernameChange = (username: string) => { this.setUsername(username); </s> remove Keyboard.withModifierKeys({}, () => { Keyboard.keyPress(KEYS.ENTER); }); </s> add expect(h.elements.length).toBe(1); </s> remove const { h, }: { h: { elements: any; }; } = window; </s> add const { h } = window; </s> remove export const STORAGE_KEYS = { LOCAL_STORAGE_ELEMENTS: "excalidraw", LOCAL_STORAGE_APP_STATE: "excalidraw-state", LOCAL_STORAGE_COLLAB: "excalidraw-collab", LOCAL_STORAGE_KEY_COLLAB_FORCE_FLAG: "collabLinkForceLoadFlag", LOCAL_STORAGE_LIBRARY: "excalidraw-library", }; </s> add import { updateBrowserStateVersion } from "./tabSync"; import { STORAGE_KEYS } from "../app_constants"; </s> add h.elements = []; </s> add setUsername: (username: string) => void;
https://github.com/excalidraw/excalidraw/commit/ca89d47d4c8c92e8e720e54cd28cbeb2d04e84c3
src/excalidraw-app/collab/CollabWrapper.tsx
keep keep keep add keep keep keep keep
<mask> }; <mask> <mask> setUsername = (username: string) => { <mask> this.setState({ username }); <mask> saveUsernameToLocalStorage(username); <mask> }; <mask> <mask> onCollabButtonClick = () => { </s> feat: Sync local storage state across tabs when out of sync (#4545) Co-authored-by: dwelle <[email protected]> </s> remove onUsernameChange = (username: string) => { </s> add setUsername = (username: string) => { </s> remove export const STORAGE_KEYS = { LOCAL_STORAGE_ELEMENTS: "excalidraw", LOCAL_STORAGE_APP_STATE: "excalidraw-state", LOCAL_STORAGE_COLLAB: "excalidraw-collab", LOCAL_STORAGE_KEY_COLLAB_FORCE_FLAG: "collabLinkForceLoadFlag", LOCAL_STORAGE_LIBRARY: "excalidraw-library", }; </s> add import { updateBrowserStateVersion } from "./tabSync"; import { STORAGE_KEYS } from "../app_constants"; </s> add setUsername: (username: string) => void; </s> remove Keyboard.withModifierKeys({}, () => { Keyboard.keyPress(KEYS.ENTER); }); </s> add expect(h.elements.length).toBe(1); </s> remove const { h, }: { h: { elements: any; }; } = window; </s> add const { h } = window; </s> add h.elements = [];
https://github.com/excalidraw/excalidraw/commit/ca89d47d4c8c92e8e720e54cd28cbeb2d04e84c3
src/excalidraw-app/collab/CollabWrapper.tsx
keep keep add keep keep keep keep keep
<mask> this.contextValue.broadcastElements = this.broadcastElements; <mask> this.contextValue.fetchImageFilesFromFirebase = <mask> this.fetchImageFilesFromFirebase; <mask> return this.contextValue; <mask> }; <mask> <mask> render() { <mask> const { modalIsShown, username, errorMessage, activeRoomLink } = this.state; </s> feat: Sync local storage state across tabs when out of sync (#4545) Co-authored-by: dwelle <[email protected]> </s> remove const { h, }: { h: { elements: any; }; } = window; </s> add const { h } = window; </s> remove export const STORAGE_KEYS = { LOCAL_STORAGE_ELEMENTS: "excalidraw", LOCAL_STORAGE_APP_STATE: "excalidraw-state", LOCAL_STORAGE_COLLAB: "excalidraw-collab", LOCAL_STORAGE_KEY_COLLAB_FORCE_FLAG: "collabLinkForceLoadFlag", LOCAL_STORAGE_LIBRARY: "excalidraw-library", }; </s> add import { updateBrowserStateVersion } from "./tabSync"; import { STORAGE_KEYS } from "../app_constants"; </s> add import { isBrowserStorageStateNewer, updateBrowserStateVersion, } from "./data/tabSync"; </s> add }; onUsernameChange = (username: string) => { this.setUsername(username); </s> remove onUsernameChange = (username: string) => { </s> add setUsername = (username: string) => { </s> remove try { data.scene.libraryItems = JSON.parse( localStorage.getItem(STORAGE_KEYS.LOCAL_STORAGE_LIBRARY) as string, ) || []; } catch (error: any) { console.error(error); } </s> add data.scene.libraryItems = getLibraryItemsFromStorage();
https://github.com/excalidraw/excalidraw/commit/ca89d47d4c8c92e8e720e54cd28cbeb2d04e84c3
src/excalidraw-app/collab/CollabWrapper.tsx
keep keep keep keep replace replace replace replace replace replace replace replace keep keep keep keep keep
<mask> clearAppStateForLocalStorage, <mask> getDefaultAppState, <mask> } from "../../appState"; <mask> import { clearElementsForLocalStorage } from "../../element"; <mask> <mask> export const STORAGE_KEYS = { <mask> LOCAL_STORAGE_ELEMENTS: "excalidraw", <mask> LOCAL_STORAGE_APP_STATE: "excalidraw-state", <mask> LOCAL_STORAGE_COLLAB: "excalidraw-collab", <mask> LOCAL_STORAGE_KEY_COLLAB_FORCE_FLAG: "collabLinkForceLoadFlag", <mask> LOCAL_STORAGE_LIBRARY: "excalidraw-library", <mask> }; <mask> <mask> export const saveUsernameToLocalStorage = (username: string) => { <mask> try { <mask> localStorage.setItem( <mask> STORAGE_KEYS.LOCAL_STORAGE_COLLAB, </s> feat: Sync local storage state across tabs when out of sync (#4545) Co-authored-by: dwelle <[email protected]> </s> add export const SYNC_BROWSER_TABS_TIMEOUT = 50; </s> add import { isBrowserStorageStateNewer, updateBrowserStateVersion, } from "./data/tabSync"; </s> add }; onUsernameChange = (username: string) => { this.setUsername(username); </s> remove import { STORAGE_KEYS } from "../excalidraw-app/data/localStorage"; </s> add import { STORAGE_KEYS } from "../excalidraw-app/app_constants"; </s> remove onUsernameChange = (username: string) => { </s> add setUsername = (username: string) => { </s> remove const { h, }: { h: { elements: any; }; } = window; </s> add const { h } = window;
https://github.com/excalidraw/excalidraw/commit/ca89d47d4c8c92e8e720e54cd28cbeb2d04e84c3
src/excalidraw-app/data/localStorage.ts
keep keep keep add keep keep keep keep
<mask> localStorage.setItem( <mask> STORAGE_KEYS.LOCAL_STORAGE_APP_STATE, <mask> JSON.stringify(clearAppStateForLocalStorage(appState)), <mask> ); <mask> } catch (error: any) { <mask> // Unable to access window.localStorage <mask> console.error(error); <mask> } </s> feat: Sync local storage state across tabs when out of sync (#4545) Co-authored-by: dwelle <[email protected]> </s> remove try { data.scene.libraryItems = JSON.parse( localStorage.getItem(STORAGE_KEYS.LOCAL_STORAGE_LIBRARY) as string, ) || []; } catch (error: any) { console.error(error); } </s> add data.scene.libraryItems = getLibraryItemsFromStorage(); </s> remove export const STORAGE_KEYS = { LOCAL_STORAGE_ELEMENTS: "excalidraw", LOCAL_STORAGE_APP_STATE: "excalidraw-state", LOCAL_STORAGE_COLLAB: "excalidraw-collab", LOCAL_STORAGE_KEY_COLLAB_FORCE_FLAG: "collabLinkForceLoadFlag", LOCAL_STORAGE_LIBRARY: "excalidraw-library", }; </s> add import { updateBrowserStateVersion } from "./tabSync"; import { STORAGE_KEYS } from "../app_constants"; </s> add // hack to ensure that we prefer we disregard any new browser state // that could have been saved in other tabs while we were collaborating resetBrowserStateVersions(); </s> remove import { STORAGE_KEYS } from "../excalidraw-app/data/localStorage"; </s> add import { STORAGE_KEYS } from "../excalidraw-app/app_constants"; </s> remove STORAGE_KEYS, </s> add </s> add getLibraryItemsFromStorage,
https://github.com/excalidraw/excalidraw/commit/ca89d47d4c8c92e8e720e54cd28cbeb2d04e84c3
src/excalidraw-app/data/localStorage.ts
keep keep keep add keep keep keep keep keep
<mask> } from "../types"; <mask> import { <mask> debounce, <mask> getVersion, <mask> preventUnload, <mask> ResolvablePromise, <mask> resolvablePromise, <mask> } from "../utils"; <mask> import { </s> feat: Sync local storage state across tabs when out of sync (#4545) Co-authored-by: dwelle <[email protected]> </s> remove import { STORAGE_KEYS } from "../excalidraw-app/data/localStorage"; </s> add import { STORAGE_KEYS } from "../excalidraw-app/app_constants"; </s> remove STORAGE_KEYS, </s> add </s> remove STORAGE_KEYS, </s> add </s> add getLibraryItemsFromStorage, </s> add import { isBrowserStorageStateNewer, updateBrowserStateVersion, } from "./data/tabSync"; </s> add importUsernameFromLocalStorage,
https://github.com/excalidraw/excalidraw/commit/ca89d47d4c8c92e8e720e54cd28cbeb2d04e84c3
src/excalidraw-app/index.tsx
keep add keep keep keep keep keep
<mask> FIREBASE_STORAGE_PREFIXES, <mask> SAVE_TO_LOCAL_STORAGE_TIMEOUT, <mask> } from "./app_constants"; <mask> import CollabWrapper, { <mask> CollabAPI, <mask> CollabContext, <mask> CollabContextConsumer, </s> feat: Sync local storage state across tabs when out of sync (#4545) Co-authored-by: dwelle <[email protected]> </s> add STORAGE_KEYS, </s> remove import { STORAGE_KEYS } from "../excalidraw-app/data/localStorage"; </s> add import { STORAGE_KEYS } from "../excalidraw-app/app_constants"; </s> remove STORAGE_KEYS, </s> add </s> remove STORAGE_KEYS, </s> add </s> add getLibraryItemsFromStorage, </s> add import { isBrowserStorageStateNewer, updateBrowserStateVersion, } from "./data/tabSync";
https://github.com/excalidraw/excalidraw/commit/ca89d47d4c8c92e8e720e54cd28cbeb2d04e84c3
src/excalidraw-app/index.tsx
keep keep add keep keep keep keep
<mask> import { LanguageList } from "./components/LanguageList"; <mask> import { exportToBackend, getCollaborationLinkData, loadScene } from "./data"; <mask> import { <mask> importFromLocalStorage, <mask> importUsernameFromLocalStorage, <mask> saveToLocalStorage, <mask> } from "./data/localStorage"; </s> feat: Sync local storage state across tabs when out of sync (#4545) Co-authored-by: dwelle <[email protected]> </s> remove STORAGE_KEYS, </s> add </s> add importUsernameFromLocalStorage, </s> remove STORAGE_KEYS, </s> add </s> remove import { STORAGE_KEYS } from "../excalidraw-app/data/localStorage"; </s> add import { STORAGE_KEYS } from "../excalidraw-app/app_constants"; </s> add import { isBrowserStorageStateNewer, updateBrowserStateVersion, } from "./data/tabSync"; </s> add isTestEnv,
https://github.com/excalidraw/excalidraw/commit/ca89d47d4c8c92e8e720e54cd28cbeb2d04e84c3
src/excalidraw-app/index.tsx
keep add keep keep keep keep keep
<mask> getLibraryItemsFromStorage, <mask> importFromLocalStorage, <mask> saveToLocalStorage, <mask> } from "./data/localStorage"; <mask> import CustomStats from "./CustomStats"; <mask> import { restoreAppState, RestoredDataState } from "../data/restore"; <mask> import { Tooltip } from "../components/Tooltip"; </s> feat: Sync local storage state across tabs when out of sync (#4545) Co-authored-by: dwelle <[email protected]> </s> remove STORAGE_KEYS, </s> add </s> add getLibraryItemsFromStorage, </s> remove import { STORAGE_KEYS } from "../excalidraw-app/data/localStorage"; </s> add import { STORAGE_KEYS } from "../excalidraw-app/app_constants"; </s> remove STORAGE_KEYS, </s> add </s> add import { isBrowserStorageStateNewer, updateBrowserStateVersion, } from "./data/tabSync"; </s> add isTestEnv,
https://github.com/excalidraw/excalidraw/commit/ca89d47d4c8c92e8e720e54cd28cbeb2d04e84c3
src/excalidraw-app/index.tsx
keep keep keep keep replace keep keep keep keep keep
<mask> import { exportToBackend, getCollaborationLinkData, loadScene } from "./data"; <mask> import { <mask> importFromLocalStorage, <mask> saveToLocalStorage, <mask> STORAGE_KEYS, <mask> } from "./data/localStorage"; <mask> import CustomStats from "./CustomStats"; <mask> import { restoreAppState, RestoredDataState } from "../data/restore"; <mask> import { Tooltip } from "../components/Tooltip"; <mask> import { shield } from "../components/icons"; </s> feat: Sync local storage state across tabs when out of sync (#4545) Co-authored-by: dwelle <[email protected]> </s> add importUsernameFromLocalStorage, </s> add getLibraryItemsFromStorage, </s> remove STORAGE_KEYS, </s> add </s> remove import { STORAGE_KEYS } from "../excalidraw-app/data/localStorage"; </s> add import { STORAGE_KEYS } from "../excalidraw-app/app_constants"; </s> add import { isBrowserStorageStateNewer, updateBrowserStateVersion, } from "./data/tabSync"; </s> add isTestEnv,
https://github.com/excalidraw/excalidraw/commit/ca89d47d4c8c92e8e720e54cd28cbeb2d04e84c3
src/excalidraw-app/index.tsx
keep keep add keep keep keep keep keep
<mask> import { newElementWith } from "../element/mutateElement"; <mask> import { isInitializedImageElement } from "../element/typeChecks"; <mask> import { loadFilesFromFirebase } from "./data/firebase"; <mask> <mask> const filesStore = createStore("files-db", "files-store"); <mask> <mask> const clearObsoleteFilesFromIndexedDB = async (opts: { <mask> currentFileIds: FileId[]; </s> feat: Sync local storage state across tabs when out of sync (#4545) Co-authored-by: dwelle <[email protected]> </s> remove export const STORAGE_KEYS = { LOCAL_STORAGE_ELEMENTS: "excalidraw", LOCAL_STORAGE_APP_STATE: "excalidraw-state", LOCAL_STORAGE_COLLAB: "excalidraw-collab", LOCAL_STORAGE_KEY_COLLAB_FORCE_FLAG: "collabLinkForceLoadFlag", LOCAL_STORAGE_LIBRARY: "excalidraw-library", }; </s> add import { updateBrowserStateVersion } from "./tabSync"; import { STORAGE_KEYS } from "../app_constants"; </s> remove import { STORAGE_KEYS } from "../excalidraw-app/data/localStorage"; </s> add import { STORAGE_KEYS } from "../excalidraw-app/app_constants"; </s> remove STORAGE_KEYS, </s> add </s> remove STORAGE_KEYS, </s> add </s> add getLibraryItemsFromStorage, </s> add importUsernameFromLocalStorage,
https://github.com/excalidraw/excalidraw/commit/ca89d47d4c8c92e8e720e54cd28cbeb2d04e84c3
src/excalidraw-app/index.tsx
keep add keep keep keep keep
<mask> const erroredFiles = new Map<FileId, true>(); <mask> <mask> await Promise.all( <mask> [...addedFiles].map(async ([id, fileData]) => { <mask> try { <mask> await set(id, fileData, filesStore); </s> feat: Sync local storage state across tabs when out of sync (#4545) Co-authored-by: dwelle <[email protected]> </s> remove await new Promise((r) => setTimeout(r, 0)); </s> add </s> remove expect(h.elements[1].fontFamily).toEqual(FONT_FAMILY.Cascadia); </s> add expect( (h.elements[1] as ExcalidrawTextElementWithContainer).fontFamily, ).toEqual(FONT_FAMILY.Cascadia); </s> add await new Promise((r) => setTimeout(r, 0)); </s> add h.elements = []; </s> remove export const STORAGE_KEYS = { LOCAL_STORAGE_ELEMENTS: "excalidraw", LOCAL_STORAGE_APP_STATE: "excalidraw-state", LOCAL_STORAGE_COLLAB: "excalidraw-collab", LOCAL_STORAGE_KEY_COLLAB_FORCE_FLAG: "collabLinkForceLoadFlag", LOCAL_STORAGE_LIBRARY: "excalidraw-library", }; </s> add import { updateBrowserStateVersion } from "./tabSync"; import { STORAGE_KEYS } from "../app_constants"; </s> remove const { h, }: { h: { elements: any; }; } = window; </s> add const { h } = window;
https://github.com/excalidraw/excalidraw/commit/ca89d47d4c8c92e8e720e54cd28cbeb2d04e84c3
src/excalidraw-app/index.tsx
keep keep keep keep replace replace replace replace replace replace replace replace keep keep keep keep keep
<mask> clearObsoleteFilesFromIndexedDB({ currentFileIds: fileIds }); <mask> } <mask> } <mask> <mask> try { <mask> data.scene.libraryItems = <mask> JSON.parse( <mask> localStorage.getItem(STORAGE_KEYS.LOCAL_STORAGE_LIBRARY) as string, <mask> ) || []; <mask> } catch (error: any) { <mask> console.error(error); <mask> } <mask> }; <mask> <mask> initializeScene({ collabAPI }).then((data) => { <mask> loadImages(data, /* isInitialLoad */ true); <mask> initialStatePromiseRef.current.promise.resolve(data.scene); </s> feat: Sync local storage state across tabs when out of sync (#4545) Co-authored-by: dwelle <[email protected]> </s> add updateBrowserStateVersion(STORAGE_KEYS.VERSION_DATA_STATE); </s> remove export const STORAGE_KEYS = { LOCAL_STORAGE_ELEMENTS: "excalidraw", LOCAL_STORAGE_APP_STATE: "excalidraw-state", LOCAL_STORAGE_COLLAB: "excalidraw-collab", LOCAL_STORAGE_KEY_COLLAB_FORCE_FLAG: "collabLinkForceLoadFlag", LOCAL_STORAGE_LIBRARY: "excalidraw-library", }; </s> add import { updateBrowserStateVersion } from "./tabSync"; import { STORAGE_KEYS } from "../app_constants"; </s> add import { isBrowserStorageStateNewer, updateBrowserStateVersion, } from "./data/tabSync"; </s> add await new Promise((r) => setTimeout(r, 0)); </s> remove import { STORAGE_KEYS } from "../excalidraw-app/data/localStorage"; </s> add import { STORAGE_KEYS } from "../excalidraw-app/app_constants"; </s> remove await new Promise((r) => setTimeout(r, 0)); </s> add
https://github.com/excalidraw/excalidraw/commit/ca89d47d4c8c92e8e720e54cd28cbeb2d04e84c3
src/excalidraw-app/index.tsx
keep keep keep add keep keep keep keep
<mask> <mask> window.addEventListener(EVENT.HASHCHANGE, onHashChange, false); <mask> window.addEventListener(EVENT.UNLOAD, onBlur, false); <mask> window.addEventListener(EVENT.BLUR, onBlur, false); <mask> return () => { <mask> window.removeEventListener(EVENT.HASHCHANGE, onHashChange, false); <mask> window.removeEventListener(EVENT.UNLOAD, onBlur, false); <mask> window.removeEventListener(EVENT.BLUR, onBlur, false); </s> feat: Sync local storage state across tabs when out of sync (#4545) Co-authored-by: dwelle <[email protected]> </s> add window.removeEventListener(EVENT.FOCUS, syncData, false); document.removeEventListener(EVENT.VISIBILITY_CHANGE, syncData, false); </s> add this.contextValue.setUsername = this.setUsername; </s> remove onUsernameChange = (username: string) => { </s> add setUsername = (username: string) => { </s> add }; onUsernameChange = (username: string) => { this.setUsername(username); </s> remove expect(h.elements[1].fontFamily).toEqual(FONT_FAMILY.Virgil); </s> add expect( (h.elements[1] as ExcalidrawTextElementWithContainer).fontFamily, ).toEqual(FONT_FAMILY.Virgil); </s> remove expect(h.elements[1].fontFamily).toEqual(FONT_FAMILY.Cascadia); </s> add expect( (h.elements[1] as ExcalidrawTextElementWithContainer).fontFamily, ).toEqual(FONT_FAMILY.Cascadia);
https://github.com/excalidraw/excalidraw/commit/ca89d47d4c8c92e8e720e54cd28cbeb2d04e84c3
src/excalidraw-app/index.tsx
keep add keep keep keep keep keep
<mask> window.removeEventListener(EVENT.UNLOAD, onBlur, false); <mask> window.removeEventListener(EVENT.BLUR, onBlur, false); <mask> clearTimeout(titleTimeout); <mask> }; <mask> }, [collabAPI, excalidrawAPI]); <mask> <mask> useEffect(() => { </s> feat: Sync local storage state across tabs when out of sync (#4545) Co-authored-by: dwelle <[email protected]> </s> add document.addEventListener(EVENT.VISIBILITY_CHANGE, syncData, false); window.addEventListener(EVENT.FOCUS, syncData, false); </s> add }; onUsernameChange = (username: string) => { this.setUsername(username); </s> remove expect(h.elements[1].fontFamily).toEqual(FONT_FAMILY.Virgil); </s> add expect( (h.elements[1] as ExcalidrawTextElementWithContainer).fontFamily, ).toEqual(FONT_FAMILY.Virgil); </s> remove onUsernameChange = (username: string) => { </s> add setUsername = (username: string) => { </s> remove expect(h.elements[1].fontFamily).toEqual(FONT_FAMILY.Cascadia); </s> add expect( (h.elements[1] as ExcalidrawTextElementWithContainer).fontFamily, ).toEqual(FONT_FAMILY.Cascadia); </s> add await new Promise((r) => setTimeout(r, 0));
https://github.com/excalidraw/excalidraw/commit/ca89d47d4c8c92e8e720e54cd28cbeb2d04e84c3
src/excalidraw-app/index.tsx
keep keep keep keep replace keep keep keep keep keep
<mask> } from "@testing-library/react"; <mask> <mask> import * as toolQueries from "./queries/toolQueries"; <mask> import { ImportedDataState } from "../data/types"; <mask> import { STORAGE_KEYS } from "../excalidraw-app/data/localStorage"; <mask> <mask> import { SceneData } from "../types"; <mask> import { getSelectedElements } from "../scene/selection"; <mask> import { ExcalidrawElement } from "../element/types"; <mask> </s> feat: Sync local storage state across tabs when out of sync (#4545) Co-authored-by: dwelle <[email protected]> </s> add isTestEnv, </s> remove STORAGE_KEYS, </s> add </s> remove STORAGE_KEYS, </s> add </s> remove export const STORAGE_KEYS = { LOCAL_STORAGE_ELEMENTS: "excalidraw", LOCAL_STORAGE_APP_STATE: "excalidraw-state", LOCAL_STORAGE_COLLAB: "excalidraw-collab", LOCAL_STORAGE_KEY_COLLAB_FORCE_FLAG: "collabLinkForceLoadFlag", LOCAL_STORAGE_LIBRARY: "excalidraw-library", }; </s> add import { updateBrowserStateVersion } from "./tabSync"; import { STORAGE_KEYS } from "../app_constants"; </s> add getLibraryItemsFromStorage, </s> add import { isBrowserStorageStateNewer, updateBrowserStateVersion, } from "./data/tabSync";
https://github.com/excalidraw/excalidraw/commit/ca89d47d4c8c92e8e720e54cd28cbeb2d04e84c3
src/tests/test-utils.ts
keep add keep keep keep keep keep keep
<mask> export function getDefaultAppState(): AppState { <mask> return { <mask> draggingElement: null, <mask> resizingElement: null, <mask> multiElement: null, <mask> editingElement: null, <mask> elementType: "selection", <mask> elementLocked: false, </s> Add loading state (#1027) * add loading state * update snapshots * add border radius * fix comment breaking build jsx </s> add } </s> add "isLoading": false, </s> add "isLoading": false, </s> add "isLoading": false, </s> add "isLoading": false, </s> add "isLoading": false,
https://github.com/excalidraw/excalidraw/commit/cac2dda5ac4b8e2bd73742cd37bf3bb67eaa83c9
src/appState.ts
keep keep keep add keep keep keep keep
<mask> selectionElement, <mask> isResizing, <mask> collaborators, <mask> isCollaborating, <mask> ...exportedState <mask> } = appState; <mask> return exportedState; <mask> } </s> Add loading state (#1027) * add loading state * update snapshots * add border radius * fix comment breaking build jsx </s> add } </s> remove case "MOUSE_LOCATION": </s> add } case "MOUSE_LOCATION": { </s> add import { LoadingMessage } from "./LoadingMessage"; </s> remove const searchParams = new URLSearchParams(window.location.search); const id = searchParams.get("id"); if (id) { // Backwards compatibility with legacy url format const scene = await loadScene(id); this.syncActionResult(scene); } const jsonMatch = window.location.hash.match( /^#json=([0-9]+),([a-zA-Z0-9_-]+)$/, ); if (jsonMatch) { const scene = await loadScene(jsonMatch[1], jsonMatch[2]); this.syncActionResult(scene); return; } const roomMatch = getCollaborationLinkData(window.location.href); if (roomMatch) { this.initializeSocketClient(); return; } const scene = await loadScene(null); this.syncActionResult(scene); </s> add this.initializeScene(); </s> remove private initializeSocketClient = () => { </s> add private initializeSocketClient = (opts: { showLoadingState: boolean }) => { </s> remove this.initializeSocketClient(); </s> add this.initializeSocketClient({ showLoadingState: true });
https://github.com/excalidraw/excalidraw/commit/cac2dda5ac4b8e2bd73742cd37bf3bb67eaa83c9
src/appState.ts
keep keep add keep keep keep keep keep
<mask> <mask> actionManager: ActionManager; <mask> canvasOnlyActions = ["selectAll"]; <mask> constructor(props: any) { <mask> super(props); <mask> this.actionManager = new ActionManager( <mask> this.syncActionResult, <mask> () => this.state, </s> Add loading state (#1027) * add loading state * update snapshots * add border radius * fix comment breaking build jsx </s> remove this.socketInitialized = true; </s> add initialize(); </s> add private onUnload = () => { this.destroySocketClient(); this.onBlur(); }; </s> add import { LoadingMessage } from "./LoadingMessage"; </s> remove public state: AppState = getDefaultAppState(); </s> add </s> remove private initializeSocketClient = () => { </s> add private initializeSocketClient = (opts: { showLoadingState: boolean }) => { </s> remove this.setState({ isCollaborating: true, }); </s> add const initialize = () => { this.socketInitialized = true; clearTimeout(initializationTimer); if (this.state.isLoading && !this.unmounted) { this.setState({ isLoading: false }); } }; // fallback in case you're not alone in the room but still don't receive // initial SCENE_UPDATE message const initializationTimer = setTimeout(initialize, 5000);
https://github.com/excalidraw/excalidraw/commit/cac2dda5ac4b8e2bd73742cd37bf3bb67eaa83c9
src/components/App.tsx
keep add keep keep keep keep keep keep
<mask> file?.name.endsWith(".excalidraw") <mask> ) { <mask> loadFromBlob(file) <mask> .then(({ elements, appState }) => <mask> this.syncActionResult({ <mask> elements, <mask> appState: { <mask> ...(appState || this.state), </s> Add loading state (#1027) * add loading state * update snapshots * add border radius * fix comment breaking build jsx </s> remove appState, </s> add appState: { ...(appState || this.state), isLoading: false, }, </s> remove private initializeSocketClient = () => { </s> add private initializeSocketClient = (opts: { showLoadingState: boolean }) => { </s> remove .catch((error) => console.error(error)); </s> add .catch((error) => { console.error(error); this.setState({ isLoading: false }); }); </s> remove case "SCENE_UPDATE": </s> add case "SCENE_UPDATE": { </s> add import { LoadingMessage } from "./LoadingMessage"; </s> add import { LoadingMessage } from "./LoadingMessage";
https://github.com/excalidraw/excalidraw/commit/cac2dda5ac4b8e2bd73742cd37bf3bb67eaa83c9
src/components/App.tsx
keep keep keep keep replace keep keep keep replace keep
<mask> loadFromBlob(file) <mask> .then(({ elements, appState }) => <mask> this.syncActionResult({ <mask> elements, <mask> appState, <mask> commitToHistory: false, <mask> }), <mask> ) <mask> .catch((error) => console.error(error)); <mask> } </s> Add loading state (#1027) * add loading state * update snapshots * add border radius * fix comment breaking build jsx </s> add this.setState({ isLoading: true }); </s> remove private initializeSocketClient = () => { </s> add private initializeSocketClient = (opts: { showLoadingState: boolean }) => { </s> add } </s> remove this.socketInitialized = true; </s> add initialize(); </s> remove case "MOUSE_LOCATION": </s> add } case "MOUSE_LOCATION": {
https://github.com/excalidraw/excalidraw/commit/cac2dda5ac4b8e2bd73742cd37bf3bb67eaa83c9
src/components/App.tsx
keep keep keep keep replace keep keep keep keep keep
<mask> }); <mask> <mask> // Lifecycle <mask> <mask> private onUnload = withBatchedUpdates(() => { <mask> isHoldingSpace = false; <mask> this.saveDebounced(); <mask> this.saveDebounced.flush(); <mask> }); <mask> </s> Add loading state (#1027) * add loading state * update snapshots * add border radius * fix comment breaking build jsx </s> add private onUnload = () => { this.destroySocketClient(); this.onBlur(); }; </s> add this.setState({ isCollaborating: true, isLoading: opts.showLoadingState ? true : this.state.isLoading, }); </s> remove this.setState({ isCollaborating: true, }); </s> add const initialize = () => { this.socketInitialized = true; clearTimeout(initializationTimer); if (this.state.isLoading && !this.unmounted) { this.setState({ isLoading: false }); } }; // fallback in case you're not alone in the room but still don't receive // initial SCENE_UPDATE message const initializationTimer = setTimeout(initialize, 5000); </s> remove public state: AppState = getDefaultAppState(); </s> add </s> remove private initializeSocketClient = () => { </s> add private initializeSocketClient = (opts: { showLoadingState: boolean }) => { </s> remove this.initializeSocketClient(); </s> add this.initializeSocketClient({ showLoadingState: true });
https://github.com/excalidraw/excalidraw/commit/cac2dda5ac4b8e2bd73742cd37bf3bb67eaa83c9
src/components/App.tsx
keep add keep keep keep keep keep
<mask> }); <mask> <mask> private disableEvent: EventHandlerNonNull = (event) => { <mask> event.preventDefault(); <mask> }; <mask> <mask> private initializeScene = async () => { </s> Add loading state (#1027) * add loading state * update snapshots * add border radius * fix comment breaking build jsx </s> add this.setState({ isCollaborating: true, isLoading: opts.showLoadingState ? true : this.state.isLoading, }); </s> remove public state: AppState = getDefaultAppState(); </s> add </s> remove private initializeSocketClient = () => { </s> add private initializeSocketClient = (opts: { showLoadingState: boolean }) => { </s> remove private onUnload = withBatchedUpdates(() => { </s> add private onBlur = withBatchedUpdates(() => { </s> remove this.initializeSocketClient(); </s> add this.initializeSocketClient({ showLoadingState: false }); </s> remove this.setState({ isCollaborating: true, }); </s> add const initialize = () => { this.socketInitialized = true; clearTimeout(initializationTimer); if (this.state.isLoading && !this.unmounted) { this.setState({ isLoading: false }); } }; // fallback in case you're not alone in the room but still don't receive // initial SCENE_UPDATE message const initializationTimer = setTimeout(initialize, 5000);
https://github.com/excalidraw/excalidraw/commit/cac2dda5ac4b8e2bd73742cd37bf3bb67eaa83c9
src/components/App.tsx
keep keep keep keep replace keep keep keep keep keep
<mask> document.addEventListener("keyup", this.onKeyUp, { passive: true }); <mask> document.addEventListener("mousemove", this.updateCurrentCursorPosition); <mask> window.addEventListener("resize", this.onResize, false); <mask> window.addEventListener("unload", this.onUnload, false); <mask> window.addEventListener("blur", this.onUnload, false); <mask> window.addEventListener("dragover", this.disableEvent, false); <mask> window.addEventListener("drop", this.disableEvent, false); <mask> <mask> // Safari-only desktop pinch zoom <mask> document.addEventListener( </s> Add loading state (#1027) * add loading state * update snapshots * add border radius * fix comment breaking build jsx </s> remove window.removeEventListener("blur", this.onUnload, false); </s> add window.removeEventListener("blur", this.onBlur, false); </s> remove const searchParams = new URLSearchParams(window.location.search); const id = searchParams.get("id"); if (id) { // Backwards compatibility with legacy url format const scene = await loadScene(id); this.syncActionResult(scene); } const jsonMatch = window.location.hash.match( /^#json=([0-9]+),([a-zA-Z0-9_-]+)$/, ); if (jsonMatch) { const scene = await loadScene(jsonMatch[1], jsonMatch[2]); this.syncActionResult(scene); return; } const roomMatch = getCollaborationLinkData(window.location.href); if (roomMatch) { this.initializeSocketClient(); return; } const scene = await loadScene(null); this.syncActionResult(scene); </s> add this.initializeScene(); </s> add this.setState({ isCollaborating: true, isLoading: opts.showLoadingState ? true : this.state.isLoading, }); </s> remove this.initializeSocketClient(); </s> add this.initializeSocketClient({ showLoadingState: true }); </s> remove private onUnload = withBatchedUpdates(() => { </s> add private onBlur = withBatchedUpdates(() => { </s> add this.setState({ isLoading: true });
https://github.com/excalidraw/excalidraw/commit/cac2dda5ac4b8e2bd73742cd37bf3bb67eaa83c9
src/components/App.tsx
keep keep keep keep replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace keep keep keep keep keep
<mask> ); <mask> document.addEventListener("gestureend", this.onGestureEnd as any, false); <mask> window.addEventListener("beforeunload", this.beforeUnload); <mask> <mask> const searchParams = new URLSearchParams(window.location.search); <mask> const id = searchParams.get("id"); <mask> <mask> if (id) { <mask> // Backwards compatibility with legacy url format <mask> const scene = await loadScene(id); <mask> this.syncActionResult(scene); <mask> } <mask> <mask> const jsonMatch = window.location.hash.match( <mask> /^#json=([0-9]+),([a-zA-Z0-9_-]+)$/, <mask> ); <mask> if (jsonMatch) { <mask> const scene = await loadScene(jsonMatch[1], jsonMatch[2]); <mask> this.syncActionResult(scene); <mask> return; <mask> } <mask> <mask> const roomMatch = getCollaborationLinkData(window.location.href); <mask> if (roomMatch) { <mask> this.initializeSocketClient(); <mask> return; <mask> } <mask> <mask> const scene = await loadScene(null); <mask> this.syncActionResult(scene); <mask> } <mask> <mask> public componentWillUnmount() { <mask> this.unmounted = true; <mask> this.removeSceneCallback!(); </s> Add loading state (#1027) * add loading state * update snapshots * add border radius * fix comment breaking build jsx </s> remove private initializeSocketClient = () => { </s> add private initializeSocketClient = (opts: { showLoadingState: boolean }) => { </s> remove this.setState({ isCollaborating: true, }); </s> add const initialize = () => { this.socketInitialized = true; clearTimeout(initializationTimer); if (this.state.isLoading && !this.unmounted) { this.setState({ isLoading: false }); } }; // fallback in case you're not alone in the room but still don't receive // initial SCENE_UPDATE message const initializationTimer = setTimeout(initialize, 5000); </s> remove case "SCENE_UPDATE": </s> add case "SCENE_UPDATE": { </s> remove case "MOUSE_LOCATION": </s> add } case "MOUSE_LOCATION": { </s> remove this.socketInitialized = true; </s> add initialize(); </s> remove this.initializeSocketClient(); </s> add this.initializeSocketClient({ showLoadingState: true });
https://github.com/excalidraw/excalidraw/commit/cac2dda5ac4b8e2bd73742cd37bf3bb67eaa83c9
src/components/App.tsx
keep keep keep keep replace keep keep keep keep keep
<mask> ); <mask> document.removeEventListener("keyup", this.onKeyUp); <mask> window.removeEventListener("resize", this.onResize, false); <mask> window.removeEventListener("unload", this.onUnload, false); <mask> window.removeEventListener("blur", this.onUnload, false); <mask> window.removeEventListener("dragover", this.disableEvent, false); <mask> window.removeEventListener("drop", this.disableEvent, false); <mask> <mask> document.removeEventListener( <mask> "gesturestart", </s> Add loading state (#1027) * add loading state * update snapshots * add border radius * fix comment breaking build jsx </s> remove window.addEventListener("blur", this.onUnload, false); </s> add window.addEventListener("blur", this.onBlur, false); </s> remove const searchParams = new URLSearchParams(window.location.search); const id = searchParams.get("id"); if (id) { // Backwards compatibility with legacy url format const scene = await loadScene(id); this.syncActionResult(scene); } const jsonMatch = window.location.hash.match( /^#json=([0-9]+),([a-zA-Z0-9_-]+)$/, ); if (jsonMatch) { const scene = await loadScene(jsonMatch[1], jsonMatch[2]); this.syncActionResult(scene); return; } const roomMatch = getCollaborationLinkData(window.location.href); if (roomMatch) { this.initializeSocketClient(); return; } const scene = await loadScene(null); this.syncActionResult(scene); </s> add this.initializeScene(); </s> add } </s> remove this.initializeSocketClient(); </s> add this.initializeSocketClient({ showLoadingState: false }); </s> add "isLoading": false, </s> add {appState.isLoading && <LoadingMessage />}
https://github.com/excalidraw/excalidraw/commit/cac2dda5ac4b8e2bd73742cd37bf3bb67eaa83c9
src/components/App.tsx