-
-
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
fix(): Text broken when doing inputs #8775
Merged
Changes from 5 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
91e9516
no animation default
asturur 24b8bea
prettier
asturur d6da248
correct changelog
asturur 0e65825
add tests
asturur 0c6f8d5
vscode wont every work for me
asturur ffeee29
didntmean to change
asturur 3394213
also set as dirty
asturur aeae93a
prettier
asturur cbb0c62
Merge branch 'master' into fix-text
asturur 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
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 |
---|---|---|
|
@@ -174,6 +174,19 @@ export abstract class ITextKeyBehavior< | |
if (!this.isEditing) { | ||
return; | ||
} | ||
const updateAndFire = () => { | ||
this.updateFromTextArea(); | ||
this.fire('changed'); | ||
if (this.canvas) { | ||
this.canvas.fire('text:changed', { target: this }); | ||
this.canvas.requestRenderAll(); | ||
} | ||
}; | ||
if (this.hiddenTextarea.value === '') { | ||
this.styles = {}; | ||
updateAndFire(); | ||
return; | ||
} | ||
// decisions about style changes. | ||
const nextText = this._splitTextIntoLines( | ||
this.hiddenTextarea.value | ||
|
@@ -188,16 +201,6 @@ export abstract class ITextKeyBehavior< | |
charDiff = nextCharCount - charCount, | ||
removeFrom, | ||
removeTo; | ||
if (this.hiddenTextarea.value === '') { | ||
this.styles = {}; | ||
this.updateFromTextArea(); | ||
this.fire('changed'); | ||
if (this.canvas) { | ||
this.canvas.fire('text:changed', { target: this }); | ||
this.canvas.requestRenderAll(); | ||
} | ||
return; | ||
} | ||
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. moved this up since it doesn't depend from any of the let/const. |
||
|
||
const textareaSelection = this.fromStringToGraphemeSelection( | ||
this.hiddenTextarea.selectionStart, | ||
|
@@ -265,12 +268,7 @@ export abstract class ITextKeyBehavior< | |
} | ||
this.insertNewStyleBlock(insertedText, selectionStart, copiedStyle); | ||
} | ||
this.updateFromTextArea(); | ||
this.fire('changed'); | ||
if (this.canvas) { | ||
this.canvas.fire('text:changed', { target: this }); | ||
this.canvas.requestRenderAll(); | ||
} | ||
Comment on lines
-268
to
-273
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. deduped this |
||
updateAndFire(); | ||
} | ||
|
||
/** | ||
|
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
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.
Is there a reason for removing the animation? I thought it is good as a showcase but it is annoying when developing
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.
that is also an internal tool, not a showcase thing.
I needed to test text, i started with my first experience with something movinng that i couldn't click, when i managed to click it i figured out it wasn't editable.
I trashed it.
There is also the issue that when running it invalidates the cache every frame and is just more work on a laptop that is rebuilding the library in the background and rebuilding the next pages.
Everyone will use the template to add something that is needed in that occasion, maybe the best default is a rect, not even a textbox