Skip to content

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

fix editor title in tablets

ammarahm-ed53c5bb6e39de
diff --git a/apps/mobile/src/views/Editor/EditorHeader.js b/apps/mobile/src/views/Editor/EditorHeader.js
index 433ea1cfe..defae4d35 100644
--- a/apps/mobile/src/views/Editor/EditorHeader.js
+++ b/apps/mobile/src/views/Editor/EditorHeader.js
@@ -32,7 +32,7 @@ import {
} from './Functions';
import HistoryComponent from './HistoryComponent';
import tiny from './tiny/tiny';
-import { toolbarRef } from './tiny/toolbar/constants';
+import {toolbarRef} from './tiny/toolbar/constants';
let handleBack;
let tapCount = 0;
@@ -47,12 +47,12 @@ const EditorHeader = () => {
}, [colors.bg]);
const _onBackPress = async () => {
- eSendEvent("showTooltip");
+ eSendEvent('showTooltip');
toolbarRef.current?.scrollTo({
- x:0,
- y:0,
- animated:false
- })
+ x: 0,
+ y: 0,
+ animated: false,
+ });
editing.isFocused = false;
editing.currentlyEditing = false;
if (DDS.isLargeTablet()) {
@@ -104,25 +104,30 @@ const EditorHeader = () => {
marginTop: Platform.OS === 'ios' ? 0 : insets.top,
zIndex: 10,
}}>
- {DDS.isLargeTablet() && !fullscreen ? null : (
- <ActionIcon
- onLongPress={async () => {
- await _onBackPress();
- Navigation.popToTop();
- }}
- testID={notesnook.ids.default.header.buttons.back}
- name="arrow-left"
- color={colors.heading}
- onPress={_onBackPress}
- bottom={5}
- customStyle={{
- marginLeft: -5,
- }}
- />
- )}
-
- {DDS.isLargeTablet() && <EditorTitle />}
-
+ <View
+ style={{
+ flexDirection: 'row',
+ alignItems: 'center',
+ }}>
+ {DDS.isLargeTablet() && !fullscreen ? null : (
+ <ActionIcon
+ onLongPress={async () => {
+ await _onBackPress();
+ Navigation.popToTop();
+ }}
+ testID={notesnook.ids.default.header.buttons.back}
+ name="arrow-left"
+ color={colors.heading}
+ onPress={_onBackPress}
+ bottom={5}
+ customStyle={{
+ marginLeft: -5,
+ }}
+ />
+ )}
+ {fullscreen && <View style={{width: 20}} />}
+ {DDS.isLargeTablet() && <EditorTitle />}
+ </View>
<View
style={{
flexDirection: 'row',
diff --git a/apps/mobile/src/views/Editor/EditorTitle.js b/apps/mobile/src/views/Editor/EditorTitle.js
index 3cc492038..4e6f30058 100644
--- a/apps/mobile/src/views/Editor/EditorTitle.js
+++ b/apps/mobile/src/views/Editor/EditorTitle.js
@@ -6,7 +6,8 @@ import { DDS } from '../../services/DeviceDetection';
import { eSubscribeEvent, eUnSubscribeEvent } from '../../services/EventManager';
import { SIZE } from '../../utils/SizeUtils';
import { sleep } from '../../utils/TimeUtils';
-import { post, _onMessage } from './Functions';
+import { EditorWebView, post, _onMessage } from './Functions';
+import tiny from './tiny/tiny';
const opacityVal = new Animated.Value(0);
const translateY = new Animated.Value(-700);
@@ -23,6 +24,7 @@ export const EditorTitle = () => {
const {colors} = state;
const [title, setTitle] = useState(null);
const onScroll = async (data) => {
+
if (data.visible === undefined || data.visible === null) return;
if (data.visible > 190) {
translateY.setValue(0);
@@ -49,8 +51,8 @@ export const EditorTitle = () => {
<Animated.View
style={{
opacity: opacityVal,
- maxWidth: DDS.isLargeTablet() ? '100%' : '100%',
- paddingLeft:20,
+ maxWidth: '100%',
+ paddingLeft:0,
transform: [
{
translateY: translateY,
@@ -69,6 +71,7 @@ export const EditorTitle = () => {
placeholder="Note title"
onChangeText={(text) => {
setTitle(text);
+ tiny.call(EditorWebView,tiny.setTitle(text));
_onMessage({
nativeEvent: {
data: JSON.stringify({