-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
BREAKING fix(Text): styles onInput
#9096
Closed
Closed
Changes from all commits
Commits
Show all changes
42 commits
Select commit
Hold shift + click to select a range
dc10071
checkout
ShaMan123 867246a
Update StyledText.ts
ShaMan123 639bef4
Update StyledText.ts
ShaMan123 6e9c7ae
Update ITextKeyBehavior.ts
ShaMan123 b1e8c75
BERAKING: rm `get2DCursorLocation`
ShaMan123 1f80e84
restore onInput
ShaMan123 df3ec23
update CHANGELOG.md
github-actions[bot] 0222e0a
BREAKING: rm unused methods
ShaMan123 5928fdb
Merge branch 'fix-text-styles!' of https://github.com/fabricjs/fabric…
ShaMan123 7c8d943
Update CHANGELOG.md
ShaMan123 7d9f668
goldens
ShaMan123 a1ca9f3
update CHANGELOG.md
github-actions[bot] 0722748
Squashed commit of the following:
ShaMan123 c01c5d6
update CHANGELOG.md
github-actions[bot] 46911e4
Merge branch 'fix-text-styles!' of https://github.com/fabricjs/fabric…
ShaMan123 d596268
almost
ShaMan123 88cc93c
better
ShaMan123 92b2552
Update Text.ts
ShaMan123 996426e
FIX!@#
ShaMan123 098575b
Update ITextKeyBehavior.ts
ShaMan123 5be1fde
Update StyledText.ts
ShaMan123 3709b71
Squashed commit of the following:
ShaMan123 75d1db3
squash => `getStyleDeclaration`
ShaMan123 e125566
Update StyledText.ts
ShaMan123 34ce049
cleanup
ShaMan123 73e88ec
?? verfiy
ShaMan123 8906638
Update Text.ts
ShaMan123 48382e4
Create bug.spec.ts
ShaMan123 9f30006
tests
ShaMan123 01e7264
goldens
ShaMan123 9735e7d
rm dead tests
ShaMan123 7c42559
Update drag_image.png
ShaMan123 52a0ee7
Update types.ts
ShaMan123 c6431f5
extract logic
ShaMan123 fd08e64
Update InputEventDiff.ts
ShaMan123 6d2e058
Merge branch 'master' into fix-text-styles!
ShaMan123 88ceba5
Update StyledText.ts
ShaMan123 10ca00f
Update Text.spec.ts
ShaMan123 c2bc332
update CHANGELOG.md
github-actions[bot] d23aa43
Merge branch 'master' into fix-text-styles!
ShaMan123 7d199e8
test
ShaMan123 f972808
resize
ShaMan123 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,156 @@ | ||
import { expect, test } from '@playwright/test'; | ||
|
||
import '../../../setup'; | ||
|
||
test('test', async ({ page }) => { | ||
const canvas = page.locator('canvas.upper-canvas'); | ||
await canvas.click({ | ||
position: { | ||
x: 156, | ||
y: 65, | ||
}, | ||
delay: 200, | ||
}); | ||
await canvas.click({ | ||
position: { | ||
x: 176, | ||
y: 152, | ||
}, | ||
delay: 200, | ||
}); | ||
await page.mouse.down(); | ||
await page.mouse.move(60, 66, { steps: 40 }); | ||
await page.mouse.up(); | ||
await canvas.press('Control+c'); | ||
await canvas.click({ | ||
position: { | ||
x: 176, | ||
y: 152, | ||
}, | ||
delay: 200, | ||
}); | ||
await canvas.press('Enter'); | ||
await canvas.press('Enter'); | ||
await canvas.press('Control+v'); | ||
await canvas.click({ | ||
position: { | ||
x: 246, | ||
y: 371, | ||
}, | ||
}); | ||
await canvas.press('Enter'); | ||
await canvas.press('Enter'); | ||
await canvas.press('x'); | ||
await canvas.click({ | ||
position: { | ||
x: 144, | ||
y: 202, | ||
}, | ||
}); | ||
await canvas.press('Enter'); | ||
await canvas.press('Enter'); | ||
await canvas.press('Enter'); | ||
await canvas.press('Enter'); | ||
await canvas.press('Backspace'); | ||
await canvas.press('Backspace'); | ||
await canvas.press('ArrowUp'); | ||
await canvas.press('ArrowUp'); | ||
await canvas.press('Delete'); | ||
await canvas.click({ | ||
position: { | ||
x: 170, | ||
y: 203, | ||
}, | ||
}); | ||
await canvas.press('Enter'); | ||
await canvas.click({ | ||
position: { | ||
x: 136, | ||
y: 336, | ||
}, | ||
}); | ||
await canvas.press('#'); | ||
await canvas.click({ | ||
position: { | ||
x: 103, | ||
y: 334, | ||
}, | ||
}); | ||
await canvas.press('#'); | ||
await canvas.click({ | ||
position: { | ||
x: 238, | ||
y: 423, | ||
}, | ||
}); | ||
await canvas.press('#'); | ||
await canvas.click({ | ||
position: { | ||
x: 52, | ||
y: 480, | ||
}, | ||
}); | ||
await canvas.press('#'); | ||
await canvas.click({ | ||
position: { | ||
x: 81, | ||
y: 231, | ||
}, | ||
}); | ||
await canvas.press('#'); | ||
await canvas.click({ | ||
position: { | ||
x: 91, | ||
y: 265, | ||
}, | ||
}); | ||
await canvas.press('#'); | ||
await canvas.click({ | ||
position: { | ||
x: 182, | ||
y: 158, | ||
}, | ||
}); | ||
await canvas.press('#'); | ||
await canvas.click({ | ||
position: { | ||
x: 79, | ||
y: 146, | ||
}, | ||
}); | ||
await canvas.press('#'); | ||
await canvas.click({ | ||
position: { | ||
x: 137, | ||
y: 65, | ||
}, | ||
}); | ||
await canvas.press('#'); | ||
await canvas.click({ | ||
position: { | ||
x: 131, | ||
y: 265, | ||
}, | ||
}); | ||
await expect(await canvas.screenshot()).toMatchSnapshot(); | ||
await canvas.press('Enter'); | ||
await canvas.press('Enter'); | ||
await canvas.press('#'); | ||
await canvas.press('Backspace'); | ||
await canvas.press('Backspace'); | ||
await canvas.press('Backspace'); | ||
await canvas.press('Backspace'); | ||
await canvas.press('Backspace'); | ||
await canvas.press('Backspace'); | ||
await canvas.press('Backspace'); | ||
await canvas.press('Backspace'); | ||
await canvas.press('Delete'); | ||
await canvas.press('Delete'); | ||
await canvas.press('Delete'); | ||
await canvas.press('Enter'); | ||
await canvas.press('Enter'); | ||
await canvas.press('Backspace'); | ||
await canvas.press('ArrowUp'); | ||
await canvas.press('Delete'); | ||
await expect(await canvas.screenshot()).toMatchSnapshot(); | ||
}); |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,30 @@ | ||
import * as fabric from 'fabric'; | ||
import { beforeAll } from 'test'; | ||
|
||
beforeAll( | ||
(canvas) => { | ||
const textValue = 'fabric.js sandbox'; | ||
const text = new fabric.Textbox(textValue, { | ||
originX: 'center', | ||
splitByGrapheme: true, | ||
width: 200, | ||
top: 20, | ||
styles: fabric.util.stylesFromArray( | ||
[ | ||
{ | ||
style: { | ||
fontWeight: 'bold', | ||
fontSize: 64, | ||
}, | ||
start: 0, | ||
end: 9, | ||
}, | ||
], | ||
textValue | ||
), | ||
}); | ||
canvas.add(text); | ||
canvas.centerObjectH(text); | ||
}, | ||
{ width: 300, height: 700 } | ||
); |
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 |
---|---|---|
@@ -1,9 +1,10 @@ | ||
import type { TextStyleDeclaration } from '../../fabric'; | ||
import type { GLProbe } from '../filters/GLProbes/GLProbe'; | ||
import type { DOMWindow } from 'jsdom'; | ||
|
||
export type TCopyPasteData = { | ||
copiedText?: string; | ||
copiedStyle?: Record<string, string>; | ||
copiedTextStyle?: TextStyleDeclaration[]; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @asturur this bug was not fixed in your PR, was it? |
||
}; | ||
export type TFabricEnv = { | ||
document: Document; | ||
|
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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add to #8299