mirror of
https://github.com/anyproto/anytype-ts.git
synced 2025-06-07 21:47:02 +09:00
fix: replace misspelled word with correct spelling at correct position in spellcheck context menu
This commit is contained in:
parent
4dd52a38f2
commit
d6555dac7d
1 changed files with 13 additions and 3 deletions
|
@ -596,10 +596,20 @@ class App extends React.Component<object, State> {
|
|||
const value = String(obj.get(0).innerText || '');
|
||||
|
||||
S.Block.updateContent(rootId, focused, { text: value });
|
||||
U.Data.blockInsertText(rootId, focused, item.id, range.from, range.to);
|
||||
|
||||
focus.set(focused, { from: range.from, to: range.from + item.id.length });
|
||||
focus.apply();
|
||||
// Find the first occurrence of the misspelled word in the value
|
||||
const wordIndex = value.indexOf(misspelledWord);
|
||||
if (wordIndex !== -1) {
|
||||
U.Data.blockInsertText(
|
||||
rootId,
|
||||
focused,
|
||||
item.id,
|
||||
wordIndex,
|
||||
wordIndex + misspelledWord.length
|
||||
);
|
||||
focus.set(focused, { from: wordIndex, to: wordIndex + item.id.length });
|
||||
focus.apply();
|
||||
}
|
||||
} else
|
||||
if (isInput || isTextarea || isEditable) {
|
||||
let value = '';
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue