[Docs] Change some editor properties to methods (#1553)

This PR changes some App properties into methods, to make them
consistent with everything else.

Closes #1544

Is there any reason why we can't change any of these?

eg:

![image](https://github.com/tldraw/tldraw/assets/15892272/24ef843d-9677-4eca-a756-84fc2188ef17)

### Change Type

- [x] `documentation` — Changes to the documentation only (will not
publish a new version)

### Release Notes

- [docs] Fixed some methods that were incorrectly marked as properties.
This commit is contained in:
Lu Wilson 2023-06-08 11:14:44 +01:00 committed by GitHub
parent b86c751b03
commit 9d87ee9dd8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 10 deletions

View file

@ -368,7 +368,7 @@ export class DrawShapeUtil extends ShapeUtil<TLDrawShape> {
// @public (undocumented)
export class Editor extends EventEmitter<TLEventMap> {
constructor({ store, user, tools, shapes, getContainer, }: TLEditorOptions);
addOpenMenu: (id: string) => this;
addOpenMenu(id: string): this;
alignShapes(operation: 'bottom' | 'center-horizontal' | 'center-vertical' | 'left' | 'right' | 'top', ids?: TLShapeId[]): this;
get allShapesCommonBounds(): Box2d | null;
animateCamera(x: number, y: number, z?: number, opts?: TLAnimationOptions): this;
@ -442,13 +442,13 @@ export class Editor extends EventEmitter<TLEventMap> {
// (undocumented)
get cursor(): TLCursor;
deleteAssets(ids: TLAssetId[]): this;
deleteOpenMenu: (id: string) => this;
deleteOpenMenu(id: string): this;
deletePage(id: TLPageId): void;
deleteShapes(ids?: TLShapeId[]): this;
deselect(...ids: TLShapeId[]): this;
// (undocumented)
get devicePixelRatio(): number;
dispatch: (info: TLEventInfo) => this;
dispatch(info: TLEventInfo): this;
readonly disposables: Set<() => void>;
dispose(): void;
distributeShapes(operation: 'horizontal' | 'vertical', ids?: TLShapeId[]): this;
@ -748,9 +748,9 @@ export class Editor extends EventEmitter<TLEventMap> {
readonly snaps: SnapManager;
get sortedShapesArray(): TLShape[];
stackShapes(operation: 'horizontal' | 'vertical', ids?: TLShapeId[], gap?: number): this;
startFollowingUser: (userId: string) => this | undefined;
startFollowingUser(userId: string): this | undefined;
stopCameraAnimation(): this;
stopFollowingUser: () => this;
stopFollowingUser(): this;
readonly store: TLStore;
stretchShapes(operation: 'horizontal' | 'vertical', ids?: TLShapeId[]): this;
static styles: TLStyleCollections;

View file

@ -564,7 +564,7 @@ export class Editor extends EventEmitter<TLEventMap> {
* ```
* @public
*/
addOpenMenu = (id: string) => {
addOpenMenu(id: string) {
const menus = new Set(this.openMenus)
if (!menus.has(id)) {
menus.add(id)
@ -581,7 +581,7 @@ export class Editor extends EventEmitter<TLEventMap> {
* ```
* @public
*/
deleteOpenMenu = (id: string) => {
deleteOpenMenu(id: string) {
const menus = new Set(this.openMenus)
if (menus.has(id)) {
menus.delete(id)
@ -3659,7 +3659,7 @@ export class Editor extends EventEmitter<TLEventMap> {
* @param info - The event info.
* @public
*/
dispatch = (info: TLEventInfo): this => {
dispatch(info: TLEventInfo): this {
// prevent us from spamming similar event errors if we're crashed.
// todo: replace with new readonly mode?
if (this.crashingError) return this
@ -8634,7 +8634,7 @@ export class Editor extends EventEmitter<TLEventMap> {
* @param userId - The id of the user to follow.
* @public
*/
startFollowingUser = (userId: string) => {
startFollowingUser(userId: string) {
// Currently, we get the leader's viewport page bounds from their user presence.
// This is a placeholder until the ephemeral PR lands.
// After that, we'll be able to get the required data from their instance presence instead.
@ -8758,7 +8758,7 @@ export class Editor extends EventEmitter<TLEventMap> {
*
* @public
*/
stopFollowingUser = () => {
stopFollowingUser() {
this.updateInstanceState({ followingUserId: null }, true)
this.emit('stop-following')
return this