Add migration for horizontal alignment (#1443)

This adds a migration to migrate existing alignment options to their
legacy counter parts (`start` -> `start-legacy`, `end` -> `end-legacy`,
`middle` -> `middle-legacy`).

With this change the legacy options don't show any align as active in
the Styles panel:
![CleanShot 2023-05-23 at 19 53
45](https://github.com/tldraw/tldraw/assets/2523721/4017e03a-9492-4a02-b991-ac206f40ae17)

I think this is probably what we want.

### Change Type

- [x] `patch` — Bug Fix

### Test Plan

1. Use some old preview link to create Geo and Note shapes with old
alignment options. You can use this one:
https://examples-kzwtf68jr-tldraw.vercel.app/
2. Copy and paste these shapes over to staging. Nothing should change
visually.
3. Also try out exporting to svg (with both old and new alignment
options)

- [x] Unit Tests
- [ ] Webdriver tests

### Release Notes

- Add support for legacy alignment options.

---------

Co-authored-by: Steve Ruiz <steveruizok@gmail.com>
This commit is contained in:
Mitja Bezenšek 2023-05-24 13:34:13 +02:00 committed by GitHub
parent 89428edffc
commit 787eab75d6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 216 additions and 10 deletions

View file

@ -1090,15 +1090,18 @@ input,
opacity: 0;
}
.tl-text-label[data-align='start'] {
.tl-text-label[data-align='start'],
.tl-text-label[data-align='start-legacy'] {
text-align: left;
}
.tl-text-label[data-align='middle'] {
.tl-text-label[data-align='middle'],
.tl-text-label[data-align='middle-legacy'] {
text-align: center;
}
.tl-text-label[data-align='end'] {
.tl-text-label[data-align='end'],
.tl-text-label[data-align='end-legacy'] {
text-align: right;
}