Fix sticky and text (#234)

This commit is contained in:
Steve Ruiz 2021-11-10 12:07:01 +00:00 committed by GitHub
parent 8b3c963a08
commit 2fe646c2c7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 2 deletions

View file

@ -235,8 +235,11 @@ export class StickyUtil extends TLDrawShapeUtil<T, E> {
const PADDING = 16
const MIN_CONTAINER_HEIGHT = 200
const fixNewLines = /\r?\n|\r/g
const fixSpaces = / /g
function normalizeText(text: string) {
return text.replace(/\r?\n|\r/g, '\n')
return text.replace(fixNewLines, '\n').replace(fixSpaces, '\u00a0')
}
const StyledStickyContainer = styled('div', {

View file

@ -280,8 +280,11 @@ export class TextUtil extends TLDrawShapeUtil<T, E> {
const LETTER_SPACING = -1.5
const fixNewLines = /\r?\n|\r/g
const fixSpaces = / /g
function normalizeText(text: string) {
return text.replace(/\r?\n|\r/g, '\n')
return text.replace(fixNewLines, '\n').replace(fixSpaces, '\u00a0')
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any