-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: allow overriding comment icons (#7937)
* feat: add comment icon interface * feat: have blocks construct comment icons from registry * chore: add tests for setCommentText * fix: typeguard
- Loading branch information
Showing
4 changed files
with
147 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/** | ||
* @license | ||
* Copyright 2024 Google LLC | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
import {IconType} from '../icons.js'; | ||
import {IIcon, isIcon} from './i_icon.js'; | ||
import {Size} from '../utils/size.js'; | ||
import {IHasBubble, hasBubble} from './i_has_bubble.js'; | ||
|
||
export interface ICommentIcon extends IIcon, IHasBubble { | ||
setText(text: string): void; | ||
|
||
getText(): string; | ||
|
||
setBubbleSize(size: Size): void; | ||
|
||
getBubbleSize(): Size; | ||
} | ||
|
||
/** Checks whether the given object is an ICommentIcon. */ | ||
export function isCommentIcon(obj: Object): obj is ICommentIcon { | ||
return ( | ||
isIcon(obj) && | ||
hasBubble(obj) && | ||
(obj as any)['setText'] !== undefined && | ||
(obj as any)['getText'] !== undefined && | ||
(obj as any)['setBubbleSize'] !== undefined && | ||
(obj as any)['getBubbleSize'] !== undefined && | ||
obj.getType() === IconType.COMMENT | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters