Repository navigation
fix(sender): improve multiline placeholder wrapping and prevent IME input loss #472
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
Merged
gene9831
merged 8 commits into
opentiny:release/v1.0.x
from
SonyLeo:fix/sender-multiple-placeholder
Oct 28, 2026
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
52434a0
docs: enhance input prefix placeholder demo with improved text and de…
SonyLeo b46577b
fix(sender): add check for composing state in submit shortcut logic
SonyLeo b04c4e7
fix(sender): enhance layout and slot handling for single and multi-li…
SonyLeo 0dd6589
fix(sender): improve handling of composition events and keyboard shor…
SonyLeo 1715abe
fix(sender): implement IME handling to improve keyboard event management
SonyLeo 907cf50
fix(sender): enhance actions-inline slot to support scoped props and …
SonyLeo 0d956a8
fix(sender): improve model synchronization and enhance clear content …
SonyLeo 9de0693
Merge robot/release/v1.0.x into fix/sender-issues
SonyLeo 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,49 @@ | ||
| import { Extension } from '@tiptap/core' | ||
| import { Plugin, PluginKey } from '@tiptap/pm/state' | ||
| import type { Transaction } from '@tiptap/pm/state' | ||
| import type { EditorProps, EditorView } from '@tiptap/pm/view' | ||
|
|
||
| export function isImeKeyEvent(event: KeyboardEvent, view?: EditorView): boolean { | ||
| return Boolean(view?.composing || event.isComposing || event.keyCode === 229) | ||
| } | ||
|
|
||
| export function hasCompositionTransaction(transactions: readonly Transaction[]): boolean { | ||
| return transactions.some((tr) => tr.getMeta('composition') !== undefined) | ||
| } | ||
|
|
||
| export const ImeGuard = Extension.create({ | ||
| name: 'senderImeGuard', | ||
| priority: 1000, | ||
|
|
||
| addProseMirrorPlugins() { | ||
| return [ | ||
| new Plugin({ | ||
| key: new PluginKey('senderImeGuard'), | ||
| props: { | ||
| handleDOMEvents: { | ||
| // 只跳过编辑器快捷键,保留输入法的原生按键行为。 | ||
| keydown: (view, event) => isImeKeyEvent(event, view), | ||
| }, | ||
| }, | ||
| view(view) { | ||
| const originalSomeProp = view.someProp | ||
| const someProp = originalSomeProp.bind(view) | ||
| // 组合期间的合成 Backspace 仍会进入快捷键链,空事务会破坏输入法维护的文本范围。 | ||
| view.someProp = (<PropName extends keyof EditorProps, Result>( | ||
| propName: PropName, | ||
| callback?: (value: NonNullable<EditorProps[PropName]>) => Result, | ||
| ) => { | ||
| if (propName === 'handleKeyDown' && callback && view.composing) return undefined | ||
| return callback ? someProp(propName, callback) : someProp(propName) | ||
| }) as typeof view.someProp | ||
|
|
||
| return { | ||
| destroy() { | ||
| view.someProp = originalSomeProp | ||
| }, | ||
| } | ||
| }, | ||
| }), | ||
| ] | ||
| }, | ||
| }) |
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.
Uh oh!
There was an error while loading. Please reload this page.