From cd42b5e23f69ca1327153f4a420bcffe0059086e Mon Sep 17 00:00:00 2001 From: Andrew Simachev Date: Thu, 5 Jun 2025 14:41:15 +0200 Subject: [PATCH] src/ts/app.tsx --- src/ts/app.tsx | 7 ++++--- src/ts/component/page/auth/select.tsx | 11 +++++++++-- src/ts/component/vault/index.tsx | 4 ++-- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/src/ts/app.tsx b/src/ts/app.tsx index c6d28483d1..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)); @@ -599,7 +599,7 @@ class App extends React.Component { // Find the first occurrence of the misspelled word in the value const wordIndex = value.indexOf(misspelledWord); - if (wordIndex !== -1) { + if (wordIndex >= 0) { U.Data.blockInsertText( rootId, focused, @@ -607,9 +607,10 @@ class App extends React.Component { 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,