A fully open source & end-to-end encrypted note taking alternative to Evernote.
TypeScript asp-net-coredotnet-coreelectronfosshacktoberfestnote-managmentnote-takingnote-taking-appnotebooknotesnotes-appopen-sourceopensourceprivacyproductivityreactreact-nativereactjsself-hosted
fully implement walkthrough for notebooks
ammarahm-ed7674636d4243
diff --git a/apps/mobile/src/components/AddNotebookDialog/index.js b/apps/mobile/src/components/AddNotebookDialog/index.jsindex 0361fd55e..84aa49b63 100644--- a/apps/mobile/src/components/AddNotebookDialog/index.js+++ b/apps/mobile/src/components/AddNotebookDialog/index.js@@ -14,6 +14,7 @@ import { ActionIcon } from '../ActionIcon';import { Button } from '../Button';import DialogHeader from '../Dialog/dialog-header';import Input from '../Input';+import { MoveNotes } from '../MoveNoteDialog/movenote';import Seperator from '../Seperator';import SheetWrapper from '../Sheet';import { Toast } from '../Toast';@@ -162,7 +163,7 @@ export class AddNotebookDialog extends React.Component {this.currentInputValue = null;}}-+ let newNotebookId = null;if (notebook) {if (this.topicsToDelete?.length > 0) {await db.notebooks.notebook(toEdit.id).topics.delete(...this.topicsToDelete);@@ -189,7 +190,7 @@ export class AddNotebookDialog extends React.Component {await db.notebooks.notebook(toEdit.id).topics.add(...nextTopics);} else {- await db.notebooks.add({+ newNotebookId = await db.notebooks.add({title: this.title,description: this.description,topics: prevTopics,@@ -206,6 +207,10 @@ export class AddNotebookDialog extends React.Component {loading: false});this.close();+ await sleep(300);+ if (!notebook) {+ MoveNotes.present(db.notebooks.notebook(newNotebookId).data);+ }};onSubmit = (forward = true) => {diff --git a/apps/mobile/src/components/AppLoader/index.js b/apps/mobile/src/components/AppLoader/index.jsindex 56f6c1d5a..3f0b0f3c0 100644--- a/apps/mobile/src/components/AppLoader/index.js+++ b/apps/mobile/src/components/AppLoader/index.js@@ -1,9 +1,7 @@import React, { useEffect, useRef, useState } from 'react';-import { Appearance, NativeModules, Platform, SafeAreaView, View } from 'react-native';-import { NavigationBar } from 'react-native-bars';+import { NativeModules, Platform, View } from 'react-native';import RNBootSplash from 'react-native-bootsplash';import { checkVersion } from 'react-native-check-version';-import Animated from 'react-native-reanimated';import { useTracked } from '../../provider';import {useFavoriteStore,@@ -12,7 +10,6 @@ import {useSettingStore,useUserStore} from '../../provider/stores';-import Backup from '../../services/Backup';import BiometricService from '../../services/BiometricService';import { DDS } from '../../services/DeviceDetection';import {@@ -24,12 +21,9 @@ import {} from '../../services/EventManager';import { setRateAppMessage } from '../../services/Message';import PremiumService from '../../services/PremiumService';-import SettingsService from '../../services/SettingsService';import { editing } from '../../utils';-import { COLOR_SCHEME_DARK } from '../../utils/Colors';-import { getColorScheme } from '../../utils/ColorUtils';import { db } from '../../utils/database';-import { eOpenAnnouncementDialog, eOpenLoginDialog } from '../../utils/Events';+import { eOpenAnnouncementDialog } from '../../utils/Events';import { MMKV } from '../../utils/mmkv';import { tabBarRef } from '../../utils/Refs';import { SIZE } from '../../utils/SizeUtils';diff --git a/apps/mobile/src/components/Menu/TagsSection.js b/apps/mobile/src/components/Menu/TagsSection.jsindex 5d92b3e0b..38ef16020 100644--- a/apps/mobile/src/components/Menu/TagsSection.js+++ b/apps/mobile/src/components/Menu/TagsSection.js@@ -8,15 +8,14 @@ import Navigation from '../../services/Navigation';import { db } from '../../utils/database';import { eOnNewTopicAdded, refreshNotesPage } from '../../utils/Events';import { normalize, SIZE } from '../../utils/SizeUtils';-import SheetWrapper from '../Sheet';import { Button } from '../Button';-import { ActionSheetEvent } from '../DialogManager/recievers';+import { Notice } from '../Notice';import { PressableButton } from '../PressableButton';+import { Properties } from '../Properties';import Seperator from '../Seperator';+import SheetWrapper from '../Sheet';import Heading from '../Typography/Heading';import Paragraph from '../Typography/Paragraph';-import { Properties } from '../Properties';-import { Notice } from '../Notice';export const TagsSection = () => {const menuPins = useMenuStore(state => state.menuPins);@@ -96,7 +95,7 @@ export const TagsSection = () => {);};-const PinItem = ({ item, index, onPress }) => {+export const PinItem = ({ item, index, onPress, placeholder }) => {const [state, dispatch] = useTracked();const { colors } = state;const setMenuPins = useMenuStore(state => state.setMenuPins);@@ -115,6 +114,7 @@ const PinItem = ({ item, index, onPress }) => {};useEffect(() => {+ if (placeholder) return;eSubscribeEvent('onHeaderStateChange', onHeaderStateChange);return () => {eUnSubscribeEvent('onHeaderStateChange', onHeaderStateChange);@@ -159,6 +159,7 @@ const PinItem = ({ item, index, onPress }) => {<PressableButtontype={headerTextState?.id === item.id ? 'grayBg' : 'gray'}onLongPress={() => {+ if (placeholder) return;Properties.present(item);}}onPress={() => onPress(item)}diff --git a/apps/mobile/src/components/MoveNoteDialog/movenote.tsx b/apps/mobile/src/components/MoveNoteDialog/movenote.tsxindex a75c20a64..4a9b846ff 100644--- a/apps/mobile/src/components/MoveNoteDialog/movenote.tsx+++ b/apps/mobile/src/components/MoveNoteDialog/movenote.tsx@@ -1,5 +1,6 @@-import React, { useState } from 'react';+import React, { RefObject, useState } from 'react';import { View } from 'react-native';+import ActionSheet from 'react-native-actions-sheet';import { FlatList } from 'react-native-gesture-handler';import { useTracked } from '../../provider';import { eSendEvent, presentSheet, ToastEvent } from '../../services/EventManager';@@ -17,7 +18,15 @@ import Seperator from '../Seperator';import Heading from '../Typography/Heading';import Paragraph from '../Typography/Paragraph';-export const MoveNotes = ({ notebook, selectedTopic }: { notebook: any; selectedTopic?: any }) => {+export const MoveNotes = ({+ notebook,+ selectedTopic,+ fwdRef+}: {+ notebook: any;+ selectedTopic?: any;+ fwdRef: RefObject<ActionSheet>;+}) => {const [state] = useTracked();const colors = state.colors;const [currentNotebook, setCurrentNotebook] = useState(notebook);@@ -93,7 +102,7 @@ export const MoveNotes = ({ notebook, selectedTopic }: { notebook: any; selectedselect(item.id);}}}- type={'grayAccent'}+ type={'transparent'}customStyle={{paddingVertical: 12,justifyContent: 'space-between',@@ -189,7 +198,7 @@ export const MoveNotes = ({ notebook, selectedTopic }: { notebook: any; selectedmarginTop: 5}}>- <Paragraph color={colors.accent}>{topic.title}</Paragraph>+ <Paragraph color={colors.accent}>in {topic.title}</Paragraph><Paragraphstyle={{@@ -215,6 +224,10 @@ export const MoveNotes = ({ notebook, selectedTopic }: { notebook: any; selected)}<FlatList+ nestedScrollEnabled+ onMomentumScrollEnd={() => {+ fwdRef.current?.handleChildScrollEnd();+ }}ListEmptyComponent={<Viewstyle={{@@ -236,7 +249,7 @@ export const MoveNotes = ({ notebook, selectedTopic }: { notebook: any; selectedonPress={() => {openAddTopicDialog();}}- title="Add a topic"+ title="Add first topic"type="grayAccent"/>)}@@ -276,6 +289,6 @@ export const MoveNotes = ({ notebook, selectedTopic }: { notebook: any; selectedMoveNotes.present = (notebook: any, topic: any) => {presentSheet({- component: <MoveNotes notebook={notebook} selectedTopic={topic} />+ component: ref => <MoveNotes fwdRef={ref} notebook={notebook} selectedTopic={topic} />});};diff --git a/apps/mobile/src/components/Properties/useActions.js b/apps/mobile/src/components/Properties/useActions.jsindex cf0b32194..0eead6f29 100644--- a/apps/mobile/src/components/Properties/useActions.js+++ b/apps/mobile/src/components/Properties/useActions.js@@ -641,7 +641,7 @@ export const useActions = ({ close = () => {}, item }) => {},{name: 'ReadOnly',- title: 'Read only',+ title: 'Lock editing',icon: 'pencil-lock',func: toggleReadyOnlyMode,on: item.readonlydiff --git a/apps/mobile/src/components/SimpleList/sectionheader.js b/apps/mobile/src/components/SimpleList/sectionheader.jsindex a9a7c728f..fa367ffde 100644--- a/apps/mobile/src/components/SimpleList/sectionheader.js+++ b/apps/mobile/src/components/SimpleList/sectionheader.js@@ -1,6 +1,5 @@import React, { useEffect, useRef, useState } from 'react';import { TouchableOpacity, useWindowDimensions, View } from 'react-native';-import { Popable, usePopable } from 'react-native-popable';import { useTracked } from '../../provider';import { useSettingStore } from '../../provider/stores';import {@@ -16,7 +15,6 @@ import { COLORS_NOTE } from '../../utils/Colors';import { db } from '../../utils/database';import { eOpenJumpToDialog } from '../../utils/Events';import { SIZE } from '../../utils/SizeUtils';-import { sleep } from '../../utils/TimeUtils';import useTooltip, { useTooltipHandler } from '../../utils/use-tooltip';import { ActionIcon } from '../ActionIcon';import { Button } from '../Button';@@ -40,13 +38,13 @@ export const SectionHeader = ({ item, index, type, color, screen }) => {if (!popup) return;switch (popup.id) {case 'sortmenu':- tooltip.show(sortRef, popup.text, 'top');+ tooltip.show(sortRef, popup, 'top');break;case 'jumpto':- tooltip.show(jumpToRef, popup.text, 'top');+ tooltip.show(jumpToRef, popup, 'top');break;case 'compactmode':- tooltip.show(compactModeRef, popup.text, 'top');+ tooltip.show(compactModeRef, popup, 'top');break;}});diff --git a/apps/mobile/src/components/Walkthrough/index.tsx b/apps/mobile/src/components/Walkthrough/index.tsxindex e1cfde340..2f2b764a6 100644--- a/apps/mobile/src/components/Walkthrough/index.tsx+++ b/apps/mobile/src/components/Walkthrough/index.tsx@@ -1,5 +1,6 @@import React, { useState } from 'react';-import { Image, LayoutAnimation, View } from 'react-native';+import { LayoutAnimation, View } from 'react-native';+import { useTracked } from '../../provider';import { eSendEvent, presentSheet } from '../../services/EventManager';import { eCloseProgressDialog } from '../../utils/Events';import { MMKV } from '../../utils/mmkv';@@ -11,6 +12,8 @@ import Paragraph from '../Typography/Paragraph';import walkthroughs, { TStep } from './walkthroughs';export const Walkthrough = ({ steps }: { steps: TStep[] }) => {+ const [state] = useTracked();+ const colors = state.colors;const [step, setStep] = useState<TStep>(steps && steps[0]);const next = () => {@@ -28,16 +31,8 @@ export const Walkthrough = ({ steps }: { steps: TStep[] }) => {paddingBottom: 0}}>- <Image- source={{ uri: step.image }}- style={{- width: '100%',- height: 200,- borderRadius: 10,- alignSelf: 'center',- marginBottom: 10- }}- />+ {step.walkthroughItem(colors)}+<Heading>{step.title}</Heading><Paragraphstyle={{@@ -55,7 +50,7 @@ export const Walkthrough = ({ steps }: { steps: TStep[] }) => {style={{borderRadius: 100,height: 40,- marginTop: 10+ marginTop: 20}}onPress={async () => {switch (step.button?.type) {@@ -77,16 +72,17 @@ export const Walkthrough = ({ steps }: { steps: TStep[] }) => {<Button//@ts-ignorestyle={{- borderRadius: 100,- height: 40,+ height: 30,marginTop: 10}}+ textStyle={{+ textDecorationLine: 'underline'+ }}onPress={async () => {eSendEvent(eCloseProgressDialog);}}- width={250}- title="Skip"- type="grayBg"+ type="gray"+ title="Skip introduction"/></View>);diff --git a/apps/mobile/src/components/Walkthrough/walkthroughs.ts b/apps/mobile/src/components/Walkthrough/walkthroughs.tsdeleted file mode 100644index c05b43c90..000000000--- a/apps/mobile/src/components/Walkthrough/walkthroughs.ts+++ /dev/null@@ -1,51 +0,0 @@-import { eSendEvent } from '../../services/EventManager';-import { eOpenAddNotebookDialog } from '../../utils/Events';--export type TStep = {- text: string;- image: string;- title: string;- button?: {- type: 'next' | 'done';- title: string;- action?: () => void;- };-};--const notebooks: { id: string; steps: TStep[] } = {- id: 'notebooks',- steps: [- {- title: 'Notebooks',- text: 'Organize your notes in a simple and easy way with Notebooks',- image: 'https://picsum.photos/400/500',- button: {- type: 'next',- title: 'Next'- }- },- {- title: 'Topics',- text: 'Notebooks can have unlimited topics.',- image: 'https://picsum.photos/400/500',- button: {- type: 'next',- title: 'Next'- }- },- {- title: 'Quick access',- text: 'You can make shortcuts of topics and notebooks in side menu for quick access',- image: 'https://picsum.photos/400/500',- button: {- type: 'done',- title: 'Add your first notebook',- action: () => {- eSendEvent(eOpenAddNotebookDialog);- }- }- }- ]-};--export default { notebooks };diff --git a/apps/mobile/src/components/Walkthrough/walkthroughs.tsx b/apps/mobile/src/components/Walkthrough/walkthroughs.tsxnew file mode 100644index 000000000..877674789--- /dev/null+++ b/apps/mobile/src/components/Walkthrough/walkthroughs.tsx@@ -0,0 +1,240 @@+import React from 'react';+import { View } from 'react-native';+import Icon from 'react-native-vector-icons/MaterialCommunityIcons';+import { TrackedState, useTracked } from '../../provider';+import { eSendEvent } from '../../services/EventManager';+import { getElevation } from '../../utils';+import { eOpenAddNotebookDialog } from '../../utils/Events';+import { SIZE } from '../../utils/SizeUtils';+import useRotator from '../../utils/use-rotator';+import { PinItem } from '../Menu/TagsSection';+import Heading from '../Typography/Heading';+import Paragraph from '../Typography/Paragraph';++export type TStep = {+ text: string;+ walkthroughItem: (colors: TrackedState['colors']) => React.ReactNode;+ title: string;+ button?: {+ type: 'next' | 'done';+ title: string;+ action?: () => void;+ };+};++const NotebookWelcome = () => {+ const [state] = useTracked();+ const { colors } = state;+ const data = useRotator([+ {+ title: 'Work and office',+ description: 'Everything related to my job',+ count: 2+ },+ {+ title: 'School work',+ description: "I don't like doing this but I have to.",+ count: 5+ },+ {+ title: 'Recipies',+ description: 'I love cooking and collecting recipies',+ count: 10+ }+ ]);++ return (+ <View+ style={{+ width: '100%',+ padding: 12,+ backgroundColor: colors.nav,+ borderRadius: 10+ }}+ >+ <View+ style={{+ padding: 12,+ width: '100%',+ backgroundColor: colors.bg,+ ...getElevation(3),+ borderRadius: 10,+ marginVertical: 12+ }}+ >+ <Heading size={SIZE.md} color={colors.heading}>+ {data?.title}+ </Heading>+ <Paragraph>{data?.description}</Paragraph>++ <Paragraph+ style={{+ marginTop: 5+ }}+ size={SIZE.xs}+ color={colors.icon}+ >+ Notebook - {data?.count} notes+ </Paragraph>+ </View>+ </View>+ );+};++const notebooks: { id: string; steps: TStep[] } = {+ id: 'notebooks',+ steps: [+ {+ title: 'Notebooks',+ text: 'Boost your productivity with Notebooks and organize your notes.',+ walkthroughItem: () => <NotebookWelcome />,+ button: {+ type: 'next',+ title: 'Next'+ }+ },+ {+ title: 'Notebook > Topic > Notes',+ text: 'Every Notebook has various topics which are like sections that hold all your notes.',+ walkthroughItem: (colors: TrackedState['colors']) => (+ <View+ style={{+ width: '100%',+ padding: 12,+ backgroundColor: colors.nav,+ borderRadius: 10+ }}+ >+ <View+ style={{+ padding: 12,+ width: '100%',+ backgroundColor: colors.bg,+ ...getElevation(3),+ borderRadius: 10,+ marginVertical: 12+ }}+ >+ <Heading size={SIZE.md} color={colors.heading}>+ Work and office+ </Heading>+ <Paragraph>Everything related to my job in one place.</Paragraph>++ <Paragraph+ style={{+ marginTop: 5+ }}+ size={SIZE.xs}+ color={colors.icon}+ >+ Notebook - 2 notes+ </Paragraph>+ </View>+ <View+ style={{+ padding: 12,+ width: '90%',+ backgroundColor: colors.bg,+ borderRadius: 10,+ alignSelf: 'flex-end',+ marginBottom: 10+ }}+ >+ <Paragraph color={colors.accent}>+ <Icon color={colors.accent} size={SIZE.sm} name="bookmark" /> Tasks+ </Paragraph>+ </View>+ <View+ style={{+ padding: 12,+ paddingVertical: 12,+ width: '80%',+ backgroundColor: colors.bg,+ borderRadius: 5,+ alignSelf: 'flex-end',+ marginBottom: 10+ }}+ >+ <Paragraph size={SIZE.xs}>+ <Icon color={colors.icon} size={SIZE.sm} name="note" /> Feburary 2022 Week 2+ </Paragraph>+ </View>+ <View+ style={{+ padding: 12,+ width: '80%',+ backgroundColor: colors.bg,+ borderRadius: 5,+ paddingVertical: 12,+ alignSelf: 'flex-end',+ marginBottom: 10+ }}+ >+ <Paragraph size={SIZE.xs}>+ <Icon color={colors.icon} size={SIZE.sm} name="note" /> Feburary 2022 Week 1+ </Paragraph>+ </View>+ <View+ style={{+ padding: 12,+ width: '90%',+ backgroundColor: colors.bg,+ borderRadius: 10,+ alignSelf: 'flex-end',+ marginBottom: 10+ }}+ >+ <Paragraph color={colors.accent}>+ <Icon color={colors.accent} size={SIZE.sm} name="bookmark" /> Meetings+ </Paragraph>+ </View>+ </View>+ ),+ button: {+ type: 'next',+ title: 'Next'+ }+ },+ {+ title: 'Easy access',+ text: 'You can create shortcuts of frequently accessed notebooks or topics in Side Menu',+ walkthroughItem: () => (+ <View+ style={{+ paddingHorizontal: 20,+ paddingVertical: 12+ }}+ >+ <PinItem+ index={0}+ placeholder={true}+ item={{+ title: 'Tasks',+ type: 'topic'+ }}+ onPress={() => {}}+ />++ <PinItem+ index={1}+ placeholder={true}+ item={{+ title: 'Work and office',+ type: 'notebook'+ }}+ onPress={() => {}}+ />+ </View>+ ),+ button: {+ type: 'done',+ title: 'Add your first notebook',+ action: () => {+ eSendEvent(eOpenAddNotebookDialog);+ }+ }+ }+ ]+};++export default { notebooks };diff --git a/apps/mobile/src/navigation/RootView.js b/apps/mobile/src/navigation/RootView.jsindex 3cef74129..b25743f6b 100644--- a/apps/mobile/src/navigation/RootView.js+++ b/apps/mobile/src/navigation/RootView.js@@ -60,9 +60,7 @@ const onChangeTab = async obj => {if (getNote()?.locked) {eSendEvent(eClearEditor);}- setTimeout(() => {- useTooltip.present('sectionheader');- }, 1000);+ useTooltip.present('sectionheader');eSendEvent('showTooltip');editing.movedAway = true;if (editing.currentlyEditing) {diff --git a/apps/mobile/src/provider/index.ts b/apps/mobile/src/provider/index.tsindex 9ee27ff0c..a94ebbc90 100644--- a/apps/mobile/src/provider/index.ts+++ b/apps/mobile/src/provider/index.ts@@ -3,7 +3,7 @@ import { createContainer } from 'react-tracked';import { defaultState } from './DefaultState';import { reducer } from './Reducer';-type TrackedState = typeof defaultState;+export type TrackedState = typeof defaultState;const useValue: () => [TrackedState, React.DispatchWithoutAction] = () =>useReducer(reducer, defaultState);diff --git a/apps/mobile/src/services/SettingsService.js b/apps/mobile/src/services/SettingsService.jsindex 38d00e310..626092b43 100644--- a/apps/mobile/src/services/SettingsService.js+++ b/apps/mobile/src/services/SettingsService.js@@ -5,7 +5,6 @@ import { Actions } from '../provider/Actions';import { useSettingStore } from '../provider/stores';import { AndroidModule } from '../utils';import { getColorScheme } from '../utils/ColorUtils';-import layoutmanager from '../utils/layout-manager';import { MMKV } from '../utils/mmkv';import { scale, updateSize } from '../utils/SizeUtils';import Notifications from './Notifications';@@ -97,7 +96,7 @@ async function init() {const setTheme = async () => {if (settings) {let newColors = await getColorScheme(settings.useSystemTheme);- updateEvent({ type: Actions.THEME, colors: newColors });+ updateEvent({ type: Actions.THEME, colors: { ...newColors } });}};diff --git a/apps/mobile/src/services/tipmanager.ts b/apps/mobile/src/services/tipmanager.tsindex 2933e2ff1..27d9676fd 100644--- a/apps/mobile/src/services/tipmanager.ts+++ b/apps/mobile/src/services/tipmanager.ts@@ -33,15 +33,15 @@ export type TTip = {button?: TipButton;};-type Popup = {+export type Popup = {id: string;text: string;};const destructiveContexts = ['first-note'];-let tipState = {};-let popState = {};+let tipState: { [name: string]: boolean } = {};+let popState: { [name: string]: boolean } = {};export class TipManager {static async init() {@@ -82,10 +82,14 @@ export class TipManager {let pop = popups.find(p => p.id === id);//@ts-ignoreif (popState[id]) return null;++ return pop;+ }++ static markPopupUsed(id: string) {//@ts-ignorepopState[id] = true;MMKV.setItem('popupState', JSON.stringify(popState));- return pop;}static placeholderTip() {@@ -161,6 +165,8 @@ const popups: Popup[] = [];const placeholderTips = [- `Privacy is really important and a must have. Many people take this lightly but remember. Privacy is everything.`,- `Notes can be pinned in notifications from Properties.`+ `Want to remember something? Pin an\nimportant in notifications.`,+ `Privacy is power. What people don't know they cant ruin`,+ `If you read someone else's diary, you get what you deserve. - David Sedaris`,+ 'Take quick notes from notifications. Just enable the option in Settings.'];diff --git a/apps/mobile/src/utils/useRotator.ts b/apps/mobile/src/utils/useRotator.tsnew file mode 100644index 000000000..ac9b715fa--- /dev/null+++ b/apps/mobile/src/utils/useRotator.ts@@ -0,0 +1,25 @@+import { useEffect, useRef, useState } from 'react';++function useRotator<T>(data: T[], interval = 3000): T | null {+ if (!Array.isArray(data)) return null;+ //@ts-ignore+ const [current, setCurrent] = useState<T>(data.sample());+ const intervalRef = useRef<NodeJS.Timer>();++ useEffect(() => {+ intervalRef.current = setInterval(() => {+ //@ts-ignore+ setCurrent(data.sample());+ }, interval);++ return () => {+ if (intervalRef.current) {+ clearInterval(intervalRef.current);+ }+ };+ });++ return current;+}++export default useRotator;diff --git a/apps/mobile/src/utils/useTooltip.ts b/apps/mobile/src/utils/useTooltip.tsindex ddefb0447..a17e07d13 100644--- a/apps/mobile/src/utils/useTooltip.ts+++ b/apps/mobile/src/utils/useTooltip.ts@@ -3,11 +3,14 @@ import { RefObject, useEffect, useRef } from 'react';import RNTooltips from 'react-native-tooltips';import { useTracked } from '../provider';import { eSendEvent, eSubscribeEvent, eUnSubscribeEvent } from '../services/EventManager';+import { Popup, TipManager } from '../services/tip-manager';import { useKeyboard } from './use-keyboard';let currentTargets: number[] = [];+let timers: NodeJS.Timeout[] = [];export const hideAllTooltips = async () => {+ timers.forEach(t => t && clearTimeout(t));for (let target of currentTargets) {if (target) {console.log('dimissing targets', target);@@ -37,23 +40,26 @@ const useTooltip = () => {function show(target: RefObject<any>,- text: string,+ popup: Popup,position: keyof typeof positions,duration: number) {if (!target?.current || !parent?.current) return;target.current && RNTooltips.Dismiss(target.current);currentTargets.push(target.current._nativeTag);- RNTooltips.Show(target.current, parent.current, {- text: text,- tintColor: colors.night ? colors.nav : '#404040',- corner: 80,- textSize: 15,- position: positions[position],- duration: duration || 10000,- clickToHide: true,- shadow: true- });+ timers[timers.length] = setTimeout(() => {+ TipManager.markPopupUsed(popup.id);+ RNTooltips.Show(target.current, parent.current, {+ text: popup.text,+ tintColor: colors.night ? colors.nav : '#404040',+ corner: 80,+ textSize: 15,+ position: positions[position],+ duration: duration || 10000,+ clickToHide: true,+ shadow: true+ });+ }, 1000);}return { parent, show };diff --git a/apps/mobile/src/views/Editor/tiny/tiny.js b/apps/mobile/src/views/Editor/tiny/tiny.jsindex bc391cfd2..1053d10c2 100644--- a/apps/mobile/src/views/Editor/tiny/tiny.js+++ b/apps/mobile/src/views/Editor/tiny/tiny.js@@ -33,8 +33,8 @@ clearNode(".tag-bar");`;const setPlaceholder = placeholder => `-editor.dom.setAttrib(editor.dom.doc.body, 'data-mce-placeholder', '${placeholder}');-editor.dom.setAttrib(editor.dom.doc.body, 'aria-placeholder', '${placeholder}');+editor.dom.setAttrib(editor.dom.doc.body, 'data-mce-placeholder', "${placeholder}");+editor.dom.setAttrib(editor.dom.doc.body, 'aria-placeholder', "${placeholder}");`;const removeMarkdown = `diff --git a/apps/mobile/src/views/Editor/tiny/toolbar/searchreplace.js b/apps/mobile/src/views/Editor/tiny/toolbar/searchreplace.jsindex 6c8f3ab66..3929bad16 100644--- a/apps/mobile/src/views/Editor/tiny/toolbar/searchreplace.js+++ b/apps/mobile/src/views/Editor/tiny/toolbar/searchreplace.js@@ -37,9 +37,8 @@ const SearcReplace = () => {useTooltipHandler('searchreplace', () => {let popup = TipManager.popup('searchreplace');- console.log('showing:', popup);if (popup) {- tooltip.show(switchModeRef, popup.text, 'top');+ tooltip.show(switchModeRef, popup, 'top');}});@@ -216,6 +215,7 @@ const SearcReplace = () => {iconColor={enableReplace ? colors.accent : colors.icon}onPress={() => {if (getNote()?.readonly) return;+ hideAllTooltips();layoutmanager.withSpringAnimation(500);if (enableReplace) {if (focusType === 2) {