-
Notifications
You must be signed in to change notification settings - Fork 39
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: 表格第一个回车编辑器无法正常展示 #517
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -173,7 +173,7 @@ function withTable<T extends IDomEditor>(editor: T): T { | |
|
||
if (selectedNode != null) { | ||
// 选中了 table ,则在 cell 内换行 | ||
newEditor.insertText('\n\r') | ||
newEditor.insertText('\n') | ||
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. Ensure consistent line break handling The insertion now uses Consider updating the deletion logic to match the new line break format: function isHalfBreak(newEditor: IDomEditor, location: Point): boolean {
const offset = location.offset
if (offset === 0) { return false }
const node = Editor.node(newEditor, location)
if (!Text.isText(node[0])) { return false }
const text = Node.string((node[0]))
if (offset >= text.length) { return false }
- return text[offset - 1] === '\n' && text[offset] === '\r'
+ return text[offset - 1] === '\n'
} Similar updates would be needed in Also applies to: 31-108 💡 Codebase verification Add tests for line break handling in table cells The existing tests in
Location requiring tests:
🔗 Analysis chainAdd tests for line break handling This change fixes a bug with line breaks, but there are no corresponding test updates. Please add tests to verify:
Let's check existing tests: 🏁 Scripts executedThe following scripts were executed for the analysis: Script: #!/bin/bash
# Search for table-related tests
echo "Searching for table-related test files..."
fd -t f "table.*test.*\.(ts|js|tsx|jsx)$"
# Search for line break tests within these files
echo "Searching for line break tests..."
rg -l "insertBreak|\\\\n|\\\\r" $(fd -t f "table.*test.*\.(ts|js|tsx|jsx)$")
Length of output: 636 Script: #!/bin/bash
# Search for cell-related test files
echo "Searching for cell-related test files..."
fd -t f "(cell|edit|content).*test.*\.(ts|js|tsx|jsx)$" packages/table-module/
# Search with broader patterns
echo "Searching for line break related tests with broader patterns..."
rg -l "newEditor\.insert|lineBreak|\\n|\\r|enter|newline" packages/table-module/__tests__/
Length of output: 591 Script: #!/bin/bash
# Search for editor-related tests with proper escaping
echo "Searching test content..."
rg -U "newEditor|insertText|'\\\\n'|\"\\\\n\"|lineBreak|newline" packages/table-module/__tests__/
Length of output: 1025 |
||
return | ||
} | ||
|
||
|
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.
不知道之前是出于什么原因
\n
后还加了个\r
,没去看这个有什么用了,删掉\r
看起来一切正常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.
216e61e
这一块改动和这个 pr 相关,具体改动的牵连还得再看看。
#264