diff --git a/src/ts/app.tsx b/src/ts/app.tsx index aae9c30eb7..e98c00054f 100644 --- a/src/ts/app.tsx +++ b/src/ts/app.tsx @@ -566,7 +566,7 @@ class App extends React.Component { keyboard.disableContextOpen(true); - const { focused, range } = focus.state; + const { focused } = focus.state; const win = $(window); const options: any = dictionarySuggestions.map(it => ({ id: it, name: it })); const element = $(document.elementFromPoint(x, y)); @@ -596,10 +596,21 @@ class App extends React.Component { 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 >= 0) { + 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 = ''; diff --git a/src/ts/component/page/auth/select.tsx b/src/ts/component/page/auth/select.tsx index 1566757cb1..7576544105 100644 --- a/src/ts/component/page/auth/select.tsx +++ b/src/ts/component/page/auth/select.tsx @@ -13,16 +13,23 @@ const PageAuthSelect = forwardRef<{}, I.PageComponent>((props, ref) => { }; const onRegister = () => { + const { account } = S.Auth; + const cb = () => U.Router.go('/auth/onboard', {}); + + if (account) { + cb(); + return; + }; + registerRef.current.setLoading(true); U.Data.accountCreate(error => { registerRef.current.setLoading(false); setError(error); - }, () => Animation.from(() => U.Router.go('/auth/onboard', {}))); + }, () => Animation.from(cb)); }; useEffect(() => { - S.Auth.clearAll(); S.Common.getRef('mainAnimation')?.create(); Animation.to(() => { diff --git a/src/ts/component/vault/index.tsx b/src/ts/component/vault/index.tsx index faa3721c3c..0aa2e1d5c7 100644 --- a/src/ts/component/vault/index.tsx +++ b/src/ts/component/vault/index.tsx @@ -37,7 +37,7 @@ const Vault = observer(forwardRef((props, ref) => { const itemsWithCounterIds = itemsWithCounter.map(it => it.id); const itemsWithoutCounter = items.filter(it => !itemsWithCounterIds.includes(it.id)); const itemAdd = { id: 'add', name: translate('commonNewSpace'), isButton: true }; - const itemSettings = { ...profile, id: 'settings', name: translate('commonAppSettings'), layout: I.ObjectLayout.Human }; + const itemSettings = { ...profile, id: 'settings', tooltip: translate('commonAppSettings'), layout: I.ObjectLayout.Human }; const canCreate = U.Space.canCreateSpace(); const cn = [ 'vault' ]; @@ -335,7 +335,7 @@ const Vault = observer(forwardRef((props, ref) => { const element = node.find(`#item-${item.id}`); Preview.tooltipShow({ - text: U.Common.htmlSpecialChars(item.name), + text: U.Common.htmlSpecialChars(item.tooltip || item.name), element, className: 'fromVault', typeX: I.MenuDirection.Left,