Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: rename src to avatarUrl in collaborator #5177

Merged
merged 3 commits into from May 11, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/actions/actionNavigate.tsx
Expand Up @@ -50,7 +50,7 @@ export const actionGoToCollaborator = register({
border={stroke}
onClick={() => updateData(collaborator.pointer)}
name={collaborator.username || ""}
src={collaborator.src}
src={collaborator.avatarUrl}
/>
);
},
Expand Down
7 changes: 6 additions & 1 deletion src/components/Avatar.tsx
Expand Up @@ -19,7 +19,12 @@ export const Avatar = ({ color, border, onClick, name, src }: AvatarProps) => {
return (
<div className="Avatar" style={style} onClick={onClick}>
{src ? (
<img className="Avatar-img" src={src} alt={shortName} />
<img
className="Avatar-img"
src={src}
alt={shortName}
referrerPolicy="no-referrer"
/>
) : (
shortName
)}
Expand Down
2 changes: 1 addition & 1 deletion src/packages/excalidraw/CHANGELOG.md
Expand Up @@ -25,7 +25,7 @@ Please add the latest change on the top under the correct section.

- Exported [`loadSceneOrLibraryFromBlob`](https://github.com/excalidraw/excalidraw/blob/master/src/packages/excalidraw/README.md#loadSceneOrLibraryFromBlob) function [#5057](https://github.com/excalidraw/excalidraw/pull/5057).
- Export [`MIME_TYPES`](https://github.com/excalidraw/excalidraw/blob/master/src/constants.ts#L92) supported by Excalidraw [#5135](https://github.com/excalidraw/excalidraw/pull/5135).
- Support [`src`](https://github.com/excalidraw/excalidraw/blob/master/src/types.ts#L50) for collaborators. Now onwards host can pass `src` to render the customized avatar for collaborators [#5114](https://github.com/excalidraw/excalidraw/pull/5114).
- Support [`avatarUrl`](https://github.com/excalidraw/excalidraw/blob/master/src/types.ts#L50) for collaborators. Now onwards host can pass `avatarUrl` to render the customized avatar for collaborators [#5114](https://github.com/excalidraw/excalidraw/pull/5114), renamed in [#5177](https://github.com/excalidraw/excalidraw/pull/5177).
- Support `libraryItems` argument in `initialData.libraryItems` and `updateScene({ libraryItems })` to be a Promise resolving to `LibraryItems`, and support functional update of `libraryItems` in [`updateScene({ libraryItems })`](https://github.com/excalidraw/excalidraw/blob/master/src/packages/excalidraw/README.md#updateScene). [#5101](https://github.com/excalidraw/excalidraw/pull/5101).
- Expose util [`mergeLibraryItems`](https://github.com/excalidraw/excalidraw/blob/master/src/packages/excalidraw/README.md#mergeLibraryItems) [#5101](https://github.com/excalidraw/excalidraw/pull/5101).
- Expose util [`exportToClipboard`](https://github.com/excalidraw/excalidraw/blob/master/src/packages/excalidraw/README.md#exportToClipboard) which allows to copy the scene contents to clipboard as `svg`, `png` or `json` [#5103](https://github.com/excalidraw/excalidraw/pull/5103).
Expand Down
6 changes: 3 additions & 3 deletions src/packages/excalidraw/example/App.js
Expand Up @@ -487,15 +487,15 @@ export default function App() {
const collaborators = new Map();
collaborators.set("id1", {
username: "Doremon",
src: "doremon.png",
avatarUrl: "doremon.png",
});
collaborators.set("id2", {
username: "Excalibot",
src: "https://avatars.githubusercontent.com/excalibot",
avatarUrl: "excalibot.png",
});
collaborators.set("id3", {
username: "Pika",
src: "pika.jpeg",
avatarUrl: "pika.jpeg",
});
excalidrawRef.current.updateScene({ collaborators });
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/types.ts
Expand Up @@ -47,7 +47,7 @@ export type Collaborator = {
};
// The url of the collaborator's avatar, defaults to username intials
// if not present
src?: string;
avatarUrl?: string;
};

export type DataURL = string & { _brand: "DataURL" };
Expand Down