Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

disable auto showing tooltips for now

ammarahm-ed981b88844644
diff --git a/apps/mobile/src/components/SimpleList/notebookheader.js b/apps/mobile/src/components/SimpleList/notebookheader.js
index 05e66fcf3..3c2ee929a 100644
--- a/apps/mobile/src/components/SimpleList/notebookheader.js
+++ b/apps/mobile/src/components/SimpleList/notebookheader.js
@@ -1,13 +1,11 @@
-import React, { useEffect, useRef, useState } from 'react';
+import React, { useRef, useState } from 'react';
import { View } from 'react-native';
import { useTracked } from '../../provider';
import { useMenuStore } from '../../provider/stores';
import { ToastEvent } from '../../services/EventManager';
-import { TipManager } from '../../services/tip-manager';
import { getTotalNotes } from '../../utils';
import { db } from '../../utils/database';
import { SIZE } from '../../utils/SizeUtils';
-import useTooltip, { useTooltipHandler } from '../../utils/use-tooltip';
import { ActionIcon } from '../ActionIcon';
import Heading from '../Typography/Heading';
import Paragraph from '../Typography/Paragraph';
@@ -18,20 +16,8 @@ export const NotebookHeader = ({ notebook, onEditNotebook }) => {
const [isPinnedToMenu, setIsPinnedToMenu] = useState(db.settings.isPinned(notebook.id));
const setMenuPins = useMenuStore(state => state.setMenuPins);
const totalNotes = getTotalNotes(notebook);
- const tooltip = useTooltip();
const shortcutRef = useRef();
- useTooltipHandler('notebookshortcut', () => {
- const popup = TipManager.popup('notebookshortcut');
- if (popup) {
- tooltip.show(shortcutRef, popup, 'top');
- }
- });
-
- useEffect(() => {
- useTooltip.present('notebookshortcut');
- }, []);
-
const onPinNotebook = async () => {
try {
if (isPinnedToMenu) {
@@ -50,7 +36,6 @@ export const NotebookHeader = ({ notebook, onEditNotebook }) => {
return (
<View
- ref={tooltip.parent}
style={{
marginBottom: 5,
padding: 0,
diff --git a/apps/mobile/src/components/SimpleList/sectionheader.js b/apps/mobile/src/components/SimpleList/sectionheader.js
index dae7ca62a..8714d70a2 100644
--- a/apps/mobile/src/components/SimpleList/sectionheader.js
+++ b/apps/mobile/src/components/SimpleList/sectionheader.js
@@ -9,13 +9,11 @@ import {
presentSheet
} from '../../services/EventManager';
import SettingsService from '../../services/SettingsService';
-import { TipManager } from '../../services/tip-manager';
import { GROUP } from '../../utils';
import { COLORS_NOTE } from '../../utils/Colors';
import { db } from '../../utils/database';
import { eOpenJumpToDialog } from '../../utils/Events';
import { SIZE } from '../../utils/SizeUtils';
-import useTooltip, { useTooltipHandler } from '../../utils/use-tooltip';
import { ActionIcon } from '../ActionIcon';
import { Button } from '../Button';
import Sort from '../Sort';
@@ -27,28 +25,10 @@ export const SectionHeader = ({ item, index, type, color, screen }) => {
const { fontScale } = useWindowDimensions();
const [groupOptions, setGroupOptions] = useState(db.settings?.getGroupOptions(type));
let groupBy = Object.keys(GROUP).find(key => GROUP[key] === groupOptions.groupBy);
- const tooltip = useTooltip();
const jumpToRef = useRef();
const sortRef = useRef();
const compactModeRef = useRef();
- useTooltipHandler('sectionheader', () => {
- let popup =
- TipManager.popup('sortmenu') || TipManager.popup('jumpto') || TipManager.popup('compactmode');
- if (!popup) return;
- switch (popup.id) {
- case 'sortmenu':
- tooltip.show(sortRef, popup, 'top');
- break;
- case 'jumpto':
- tooltip.show(jumpToRef, popup, 'top');
- break;
- case 'compactmode':
- tooltip.show(compactModeRef, popup, 'top');
- break;
- }
- });
-
const settings = useSettingStore(state => state.settings);
const listMode = type === 'notebooks' ? settings.notebooksListMode : settings.notesListMode;
@@ -69,7 +49,6 @@ export const SectionHeader = ({ item, index, type, color, screen }) => {
return (
<View
- ref={tooltip.parent}
style={{
flexDirection: 'row',
alignItems: 'center',
diff --git a/apps/mobile/src/navigation/NavigatorStack.js b/apps/mobile/src/navigation/NavigatorStack.js
index e57e037c6..38c9d8d15 100644
--- a/apps/mobile/src/navigation/NavigatorStack.js
+++ b/apps/mobile/src/navigation/NavigatorStack.js
@@ -9,6 +9,7 @@ import Navigation from '../services/Navigation';
import { history } from '../utils';
import { MMKV } from '../utils/mmkv';
import { rootNavigatorRef } from '../utils/Refs';
+import { hideAllTooltips } from '../utils/use-tooltip';
import Favorites from '../views/Favorites';
import Folders from '../views/Folders';
import Home from '../views/Home';
@@ -32,6 +33,7 @@ export const NavigatorStack = React.memo(
if (history.selectionMode) {
clearSelection(true);
}
+ hideAllTooltips();
eSendEvent('navigate');
});
diff --git a/apps/mobile/src/navigation/RootView.js b/apps/mobile/src/navigation/RootView.js
index 4077e2cdf..62401e5ac 100644
--- a/apps/mobile/src/navigation/RootView.js
+++ b/apps/mobile/src/navigation/RootView.js
@@ -60,9 +60,6 @@ const onChangeTab = async obj => {
if (getNote()?.locked) {
eSendEvent(eClearEditor);
}
- setTimeout(() => {
- useTooltip.present('sectionheader');
- }, 300);
eSendEvent('showTooltip');
editing.movedAway = true;
if (editing.currentlyEditing) {
diff --git a/apps/mobile/src/services/tipmanager.ts b/apps/mobile/src/services/tipmanager.ts
index 7d5198628..9d46b7665 100644
--- a/apps/mobile/src/services/tipmanager.ts
+++ b/apps/mobile/src/services/tipmanager.ts
@@ -83,7 +83,7 @@ export class TipManager {
static popup(id: string) {
let pop = popups.find(p => p.id === id);
//@ts-ignore
- if (popState[id]) return null;
+ // if (popState[id]) return null;
return pop;
}
diff --git a/apps/mobile/src/utils/useTooltip.ts b/apps/mobile/src/utils/useTooltip.ts
index 236497637..9e0e8d6ca 100644
--- a/apps/mobile/src/utils/useTooltip.ts
+++ b/apps/mobile/src/utils/useTooltip.ts
@@ -49,7 +49,7 @@ const useTooltip = () => {
target.current && RNTooltips.Dismiss(target.current);
currentTargets.push(target.current._nativeTag);
timers[timers.length] = setTimeout(() => {
- TipManager.markPopupUsed(popup.id);
+ //TipManager.markPopupUsed(popup.id);
console.log('tooltip showing', popup.text);
RNTooltips.Show(target.current, parent.current, {
text: popup.text,
@@ -72,11 +72,13 @@ type TTooltipIdentifiers = 'sectionheader' | 'searchreplace' | 'notebookshortcut
export const useTooltipHandler = (id: TTooltipIdentifiers, callback: () => void) => {
useEffect(() => {
+ if (!id) return;
eSubscribeEvent(id, callback);
return () => {
eUnSubscribeEvent(id, callback);
};
}, []);
+ return null;
};
useTooltip.present = (id: TTooltipIdentifiers) => {
diff --git a/apps/mobile/src/views/Editor/Functions.js b/apps/mobile/src/views/Editor/Functions.js
index 2620a8f85..921b1b066 100644
--- a/apps/mobile/src/views/Editor/Functions.js
+++ b/apps/mobile/src/views/Editor/Functions.js
@@ -314,6 +314,7 @@ export const loadNote = async item => {
requestedReload = true;
updateSessionStatus();
tiny.call(EditorWebView, tiny.notLoading);
+ tiny.call(EditorWebView, tiny.toogleReadMode('design'));
} else {
if (id === item.id && !item.forced) {
console.log('note is already opened in editor');
@@ -973,7 +974,6 @@ const loadNoteInEditor = async (keepHistory = true) => {
if (note?.id) {
eSendEvent('updateTags');
post('title', title);
- tiny.call(EditorWebView, tiny.toogleReadMode(note.readonly ? 'readonly' : 'design'));
if (!content || !content.data || content?.data?.length === 0) {
tiny.call(
@@ -1005,6 +1005,7 @@ const loadNoteInEditor = async (keepHistory = true) => {
tiny.call(EditorWebView, tiny.updateDateEdited(timeConverter(note.dateEdited)));
tiny.call(EditorWebView, tiny.updateSavingState('Saved'));
} else {
+ tiny.call(EditorWebView, tiny.toogleReadMode('design'));
await restoreEditorState();
}
diff --git a/apps/mobile/src/views/Editor/tiny/tiny.js b/apps/mobile/src/views/Editor/tiny/tiny.js
index f430d64a9..b20f80b84 100644
--- a/apps/mobile/src/views/Editor/tiny/tiny.js
+++ b/apps/mobile/src/views/Editor/tiny/tiny.js
@@ -11,7 +11,7 @@ const toogleReadMode = mode => `
tinymce.activeEditor.mode.set('${mode}')
setTimeout(() => {
document.getElementById("titleInput").readOnly = ${mode === 'design' ? 'false' : 'true'};
-},1000);
+},300);
`;
const reset = id => `
diff --git a/apps/mobile/src/views/Editor/tiny/toolbar/searchreplace.js b/apps/mobile/src/views/Editor/tiny/toolbar/searchreplace.js
index d7114d70f..586b8093f 100644
--- a/apps/mobile/src/views/Editor/tiny/toolbar/searchreplace.js
+++ b/apps/mobile/src/views/Editor/tiny/toolbar/searchreplace.js
@@ -32,16 +32,8 @@ const SearcReplace = () => {
replace: null
});
const switchModeRef = useRef();
- const tooltip = useTooltip();
const valueChangeTimer = useRef();
- useTooltipHandler('searchreplace', () => {
- let popup = TipManager.popup('searchreplace');
- if (popup) {
- tooltip.show(switchModeRef, popup, 'top');
- }
- });
-
async function searchWithSelection() {
values.current.find = searchSelection;
findRef.current?.setNativeProps({
@@ -54,13 +46,6 @@ const SearcReplace = () => {
searchWithSelection();
}, [searchSelection]);
- useEffect(() => {
- setTimeout(() => {
- findRef.current?.focus();
- setTimeout(() => useTooltip.present('searchreplace'), 1000);
- }, 300);
- }, []);
-
function find() {
if (!values.current?.find) return;
tiny.call(
@@ -188,7 +173,6 @@ const SearcReplace = () => {
return (
<View
- ref={tooltip.parent}
style={{
width: '100%',
backgroundColor: colors.bg,