mirror of
https://github.com/streetwriters/notesnook.git
synced 2025-12-22 22:49:45 +01:00
close tooltip and scroll toolbar to start on closing
This commit is contained in:
@@ -57,6 +57,7 @@ const onChangeTab = async (obj) => {
|
||||
if (getNote()?.locked) {
|
||||
eSendEvent(eClearEditor);
|
||||
}
|
||||
eSendEvent("showTooltip");
|
||||
editing.movedAway = true;
|
||||
tiny.call(EditorWebView, tiny.blur);
|
||||
}
|
||||
|
||||
@@ -32,6 +32,7 @@ import {
|
||||
} from './Functions';
|
||||
import HistoryComponent from './HistoryComponent';
|
||||
import tiny from './tiny/tiny';
|
||||
import { toolbarRef } from './tiny/toolbar/constants';
|
||||
|
||||
let handleBack;
|
||||
let tapCount = 0;
|
||||
@@ -46,23 +47,12 @@ const EditorHeader = () => {
|
||||
}, [colors.bg]);
|
||||
|
||||
const _onBackPress = async () => {
|
||||
if (sideMenuRef.current === null) {
|
||||
if (tapCount > 0) {
|
||||
tapCount = 0;
|
||||
setIntent(false);
|
||||
editing.currentlyEditing = false;
|
||||
await clearEditor();
|
||||
RNExitApp.exitApp();
|
||||
} else {
|
||||
await saveNote();
|
||||
tapCount = 1;
|
||||
setTimeout(() => {
|
||||
tapCount = 0;
|
||||
}, 3000);
|
||||
ToastEvent.show('Note saved, press back again to exit app.', 'success');
|
||||
}
|
||||
return true;
|
||||
}
|
||||
eSendEvent("showTooltip");
|
||||
toolbarRef.current?.scrollTo({
|
||||
x:0,
|
||||
y:0,
|
||||
animated:false
|
||||
})
|
||||
editing.isFocused = false;
|
||||
editing.currentlyEditing = false;
|
||||
if (DDS.isLargeTablet()) {
|
||||
|
||||
@@ -28,6 +28,7 @@ import {
|
||||
saveNote,
|
||||
setIntent,
|
||||
} from './Functions';
|
||||
import { toolbarRef } from './tiny/toolbar/constants';
|
||||
|
||||
let handleBack;
|
||||
let tapCount = 0;
|
||||
@@ -95,23 +96,12 @@ const EditorRoot = () => {
|
||||
};
|
||||
|
||||
const _onBackPress = async () => {
|
||||
if (sideMenuRef.current === null) {
|
||||
if (tapCount > 0) {
|
||||
tapCount = 0;
|
||||
setIntent(false);
|
||||
editing.currentlyEditing = false;
|
||||
await clearEditor();
|
||||
RNExitApp.exitApp();
|
||||
} else {
|
||||
await saveNote();
|
||||
tapCount = 1;
|
||||
setTimeout(() => {
|
||||
tapCount = 0;
|
||||
}, 3000);
|
||||
ToastEvent.show('Note saved, press back again to exit app.', 'success');
|
||||
}
|
||||
return true;
|
||||
}
|
||||
eSendEvent("showTooltip");
|
||||
toolbarRef.current?.scrollTo({
|
||||
x:0,
|
||||
y:0,
|
||||
animated:false
|
||||
})
|
||||
editing.currentlyEditing = false;
|
||||
if (DDS.isLargeTablet()) {
|
||||
if (fullscreen) {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { createRef } from 'react';
|
||||
import {Platform} from 'react-native';
|
||||
import { eSendEvent } from '../../../../services/EventManager';
|
||||
import {EditorWebView} from '../../Functions';
|
||||
@@ -10,6 +11,8 @@ export const properties = {
|
||||
userBlur: false,
|
||||
};
|
||||
|
||||
export const toolbarRef = createRef();
|
||||
|
||||
export function formatSelection(command) {
|
||||
EditorWebView.current?.injectJavaScript(command);
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ import {ScrollView} from 'react-native';
|
||||
import {useTracked} from '../../../../provider';
|
||||
import {eSendEvent} from '../../../../services/EventManager';
|
||||
import {TOOLBAR_CONFIG} from './config';
|
||||
import {properties} from './constants';
|
||||
import {properties, toolbarRef} from './constants';
|
||||
import ToolbarGroup from './group';
|
||||
import Tooltip from './tooltip';
|
||||
|
||||
@@ -29,6 +29,7 @@ const EditorToolbar = React.memo(
|
||||
}}>
|
||||
<Tooltip />
|
||||
<ScrollView
|
||||
ref={toolbarRef}
|
||||
style={{
|
||||
width: '100%',
|
||||
maxWidth: '100%',
|
||||
|
||||
Reference in New Issue
Block a user