Skip to content

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

make toolbar compact & fit more items

ammarahm-ede58fbc7719f9
diff --git a/apps/mobile/src/navigation/RootView.js b/apps/mobile/src/navigation/RootView.js
index b950784cb..5a7a91f65 100644
--- a/apps/mobile/src/navigation/RootView.js
+++ b/apps/mobile/src/navigation/RootView.js
@@ -214,7 +214,6 @@ const NativeStack = React.memo(
});
}
if (!needsUpdate) {
- console.log('reposition not needed');
return;
}
setTimeout(() => {
diff --git a/apps/mobile/src/views/Editor/index.js b/apps/mobile/src/views/Editor/index.js
index 173383664..6fa2f0355 100755
--- a/apps/mobile/src/views/Editor/index.js
+++ b/apps/mobile/src/views/Editor/index.js
@@ -9,7 +9,7 @@ import {
eUnSubscribeEvent
} from '../../services/EventManager';
import {getCurrentColors} from '../../utils/Colors';
-import { eOnLoadNote } from '../../utils/Events';
+import {eOnLoadNote} from '../../utils/Events';
import {normalize} from '../../utils/SizeUtils';
import {sleep} from '../../utils/TimeUtils';
import EditorHeader from './EditorHeader';
@@ -71,14 +71,18 @@ const Editor = React.memo(
};
}, []);
+ const androidStyle = Platform.OS == 'android' ? {flexGrow: 1, flex: 1} : {};
+
return resetting ? null : (
<>
<CustomView
- style={{
- height: '100%',
- width: '100%',
- paddingBottom: Platform.OS === 'android' ? normalize(50) + 5 : null
- }}
+ style={[
+ {
+ width: '100%',
+ backgroundColor: 'transparent'
+ },
+ androidStyle
+ ]}
bounces={false}
bouncesZoom={false}
disableScrollViewPanResponder
@@ -126,13 +130,14 @@ const Editor = React.memo(
bounces={false}
allowFileAccess={true}
scalesPageToFit={true}
- renderLoading={() => <View/>}
+ renderLoading={() => <View />}
startInLoadingState
allowingReadAccessToURL={Platform.OS === 'android' ? true : null}
allowFileAccessFromFileURLs={true}
allowUniversalAccessFromFileURLs={true}
originWhitelist={['*']}
source={source}
+ //source={{uri:"http://192.168.10.4:3000/index.html"}}
style={style}
autoManageStatusBarEnabled={false}
onMessage={_onMessage}
@@ -148,5 +153,3 @@ const Editor = React.memo(
export default Editor;
// test uri "http://192.168.10.8:3000/index.html"
-
-
diff --git a/apps/mobile/src/views/Editor/tiny/toolbar/config.js b/apps/mobile/src/views/Editor/tiny/toolbar/config.js
index 75b7ef9e2..4e19cb4b3 100644
--- a/apps/mobile/src/views/Editor/tiny/toolbar/config.js
+++ b/apps/mobile/src/views/Editor/tiny/toolbar/config.js
@@ -62,6 +62,8 @@ export const IMAGE_TOOLTIP_CONFIG = {
};
export const TOOLBAR_CONFIG = [
+
+ 'seperator',
[
{
format: 'bold',
@@ -122,6 +124,7 @@ export const TOOLBAR_CONFIG = [
]
}
],
+ 'seperator',
[
{
format: 'fontsize',
@@ -210,6 +213,8 @@ export const TOOLBAR_CONFIG = [
]
}
],
+
+ 'seperator',
[
{
format: 'ol',
@@ -243,6 +248,8 @@ export const TOOLBAR_CONFIG = [
premium: true
}
],
+
+ 'seperator',
[
{
format: 'dhilitecolor',
@@ -282,6 +289,7 @@ export const TOOLBAR_CONFIG = [
}
],
+ 'seperator',
[
{
format: 'blockquote',
@@ -313,6 +321,8 @@ export const TOOLBAR_CONFIG = [
fullname: 'Inline Code'
}
],
+
+ 'seperator',
[
{
format: 'outdent',
@@ -336,6 +346,8 @@ export const TOOLBAR_CONFIG = [
fullname: 'Subscript'
}
],
+
+ 'seperator',
[
{
format: 'table',
@@ -385,6 +397,8 @@ export const TOOLBAR_CONFIG = [
premium: true
}
],
+
+ 'seperator',
[
/* {
format: 'filepicker',
@@ -407,6 +421,7 @@ export const TOOLBAR_CONFIG = [
}
],
+ 'seperator',
[
{
format: 'ltr',
@@ -419,6 +434,7 @@ export const TOOLBAR_CONFIG = [
fullname: 'Text Direction RTL'
}
],
+ 'seperator',
[
{
format: 'horizontal',
diff --git a/apps/mobile/src/views/Editor/tiny/toolbar/constants.js b/apps/mobile/src/views/Editor/tiny/toolbar/constants.js
index f7200d740..39abe2ac6 100644
--- a/apps/mobile/src/views/Editor/tiny/toolbar/constants.js
+++ b/apps/mobile/src/views/Editor/tiny/toolbar/constants.js
@@ -234,5 +234,7 @@ export const TOOLBAR_ICONS = {
imagefloatnone: 'format-float-none',
'line-break': 'keyboard-return',
code: 'code-tags',
- filepicker:'attachment'
+ filepicker:'attachment',
+ undo:'undo-variant',
+ redo:'redo-variant'
};
diff --git a/apps/mobile/src/views/Editor/tiny/toolbar/group.js b/apps/mobile/src/views/Editor/tiny/toolbar/group.js
index fd6eb3e4b..bd1594372 100644
--- a/apps/mobile/src/views/Editor/tiny/toolbar/group.js
+++ b/apps/mobile/src/views/Editor/tiny/toolbar/group.js
@@ -1,45 +1,38 @@
import React from 'react';
-import { View } from 'react-native';
-import { useTracked } from '../../../../provider';
+import {View} from 'react-native';
+import {useTracked} from '../../../../provider';
import ToolbarItem from './item';
const ToolbarGroup = ({group}) => {
- const [state] = useTracked();
- const {colors} = state;
+ const [state] = useTracked();
+ const {colors} = state;
- return (
- <View
- style={{
- borderRadius: 0,
- flexDirection: 'row',
- alignItems: 'center',
- marginRight:6,
- backgroundColor:colors.bg,
- borderTopRightRadius:5,
- borderTopLeftRadius:5,
- marginTop:5,
- overflow:"hidden"
- }}>
- {group.map((item) => (
- <ToolbarItem
- key={item.format}
- format={item.format}
- formatValue={item.formatValue}
- type={item.type}
- showTitle={item.showTitle}
- premium={item.premium}
- valueIcon={item.valueIcon}
- group={item.group}
- groupType={item.groupType}
- text={item.textValue || item.text}
- fullname={item.fullname}
- />
- ))}
+ return (
+ <View
+ style={{
+ borderRadius: 0,
+ flexDirection: 'row',
+ alignItems: 'center',
+ marginHorizontal: 3,
+ overflow: 'hidden'
+ }}>
+ {group.map(item => (
+ <ToolbarItem
+ key={item.format}
+ format={item.format}
+ formatValue={item.formatValue}
+ type={item.type}
+ showTitle={item.showTitle}
+ premium={item.premium}
+ valueIcon={item.valueIcon}
+ group={item.group}
+ groupType={item.groupType}
+ text={item.textValue || item.text}
+ fullname={item.fullname}
+ />
+ ))}
+ </View>
+ );
+};
-
-
- </View>
- );
- };
-
- export default ToolbarGroup;
\ No newline at end of file
+export default ToolbarGroup;
diff --git a/apps/mobile/src/views/Editor/tiny/toolbar/index.js b/apps/mobile/src/views/Editor/tiny/toolbar/index.js
index 7104bacd8..47cbc761b 100644
--- a/apps/mobile/src/views/Editor/tiny/toolbar/index.js
+++ b/apps/mobile/src/views/Editor/tiny/toolbar/index.js
@@ -1,10 +1,11 @@
-import React, { useEffect } from 'react';
-import { Platform } from 'react-native';
-import { ScrollView, View } from 'react-native';
-import { useTracked } from '../../../../provider';
-import { normalize } from '../../../../utils/SizeUtils';
-import { TOOLBAR_CONFIG } from './config';
-import { properties, toolbarRef } from './constants';
+import React, {useEffect} from 'react';
+import {Platform} from 'react-native';
+import {ScrollView, View} from 'react-native';
+import {useTracked} from '../../../../provider';
+import {normalize} from '../../../../utils/SizeUtils';
+import HistoryComponent from '../../HistoryComponent';
+import {TOOLBAR_CONFIG} from './config';
+import {properties, toolbarRef} from './constants';
import ToolbarGroup from './group';
import Tooltip from './tooltip';
@@ -27,8 +28,7 @@ const EditorToolbar = React.memo(
style={{
width: '100%',
minHeight: normalize(50),
- position:Platform.OS === "android" ? "absolute" : "relative",
- bottom:Platform.OS === "android" ? 0 : null
+ position: 'relative',
}}>
<Tooltip />
<ScrollView
@@ -37,14 +37,12 @@ const EditorToolbar = React.memo(
width: '100%',
maxWidth: '100%',
minHeight: normalize(50),
+ backgroundColor:colors.bg,
paddingLeft: 6,
- backgroundColor:colors.nav,
- borderTopRightRadius:5,
- borderTopLeftRadius:5,
- zIndex:11
+ zIndex: 11
}}
- onScrollBeginDrag={() => {
- //eSendEvent('showTooltip');
+ contentContainerStyle={{
+ alignItems: 'center'
}}
keyboardShouldPersistTaps="always"
keyboardDismissMode="none"
@@ -52,15 +50,27 @@ const EditorToolbar = React.memo(
showsHorizontalScrollIndicator={false}
showsVerticalScrollIndicator={false}
bounces={false}>
- {config.map((item, index) => (
- <ToolbarGroup key={item[0].format} group={item} />
- ))}
+ <HistoryComponent />
+ {config.map((item, index) =>
+ typeof item !== 'string' ? (
+ <ToolbarGroup key={item[0].format} group={item} />
+ ) : (
+ <View
+ style={{
+ height: 30,
+ width: 2,
+ marginHorizontal:2,
+ backgroundColor: colors.nav
+ }}
+ />
+ )
+ )}
</ScrollView>
</View>
</>
);
},
- () => true,
+ () => true
);
export default EditorToolbar;
diff --git a/apps/mobile/src/views/Editor/tiny/toolbar/item.js b/apps/mobile/src/views/Editor/tiny/toolbar/item.js
index d010e8ea5..ec00904ab 100644
--- a/apps/mobile/src/views/Editor/tiny/toolbar/item.js
+++ b/apps/mobile/src/views/Editor/tiny/toolbar/item.js
@@ -324,28 +324,36 @@ const ToolbarItem = ({
focusEditor(format);
editing.tooltip = null;
};
+
+ const isdefaultColorFormat = /^(dhilitecolor|dforecolor)$/.test(format);
+
return (
- <View>
+ <View
+ style={{
+ marginHorizontal: 5,
+ marginRight: isdefaultColorFormat ? 0 : 5
+ }}>
<PressableButton
- type={selected && !color ? 'shade' : 'transparent'}
- customOpacity={0.12}
+ type={selected ? 'grayBg' : 'transparent'}
onLongPress={event => {
showTooltip(event, fullname, TOOLTIP_POSITIONS.TOP);
}}
onPress={e => onPress(e)}
customStyle={{
- borderRadius: 0,
+ borderRadius: 5,
justifyContent: 'center',
alignItems: 'center',
- height: normalize(50),
- minWidth: /^(dhilitecolor|dforecolor)$/.test(format) ? 30 : 60
+ height: isdefaultColorFormat ? normalize(25) : normalize(40),
+ minWidth: isdefaultColorFormat ? 25 : normalize(40),
+ width: isdefaultColorFormat ? 25 : null,
+ overflow: 'hidden'
}}>
{premium && !isPro && (
<Icon
- size={12}
+ size={7}
style={{
position: 'absolute',
- top: 0,
+ top: 2,
alignSelf: 'center'
}}
name="crown"
@@ -353,14 +361,13 @@ const ToolbarItem = ({
/>
)}
- {/^(dhilitecolor|dforecolor)$/.test(format) ? (
+ {isdefaultColorFormat ? (
<View
style={{
backgroundColor: color,
- height: 30,
- width: 30,
- marginLeft: 10,
- borderRadius: 2.5
+ height: 25,
+ width: 25,
+ borderRadius: 5
}}
/>
) : (
@@ -371,7 +378,7 @@ const ToolbarItem = ({
{/^(h1|h2|h3|h4|h5|h6|p)$/.test(format) ? (
<Heading
- size={SIZE.md + 2}
+ size={SIZE.md}
color={selected ? colors.accent : colors.pri}>
{format.slice(0, 1).toUpperCase() + format.slice(1)}
</Heading>
@@ -383,7 +390,7 @@ const ToolbarItem = ({
/>
) : format === 'fontsize' ? (
<Paragraph
- size={SIZE.md}
+ size={SIZE.sm}
color={selected ? colors.accent : colors.pri}>
{formatValue || currentText || '12pt'}
</Paragraph>
@@ -399,7 +406,7 @@ const ToolbarItem = ({
: formatValue
: 'OpenSans-Regular'
}}
- size={text.includes('%') ? SIZE.sm : SIZE.md}>
+ size={text.includes('%') ? SIZE.sm : SIZE.sm}>
{currentText || text}
</Paragraph>
) : (
diff --git a/apps/mobile/src/views/Editor/tiny/toolbar/linkinput.js b/apps/mobile/src/views/Editor/tiny/toolbar/linkinput.js
index 791a3e978..bd9709cff 100644
--- a/apps/mobile/src/views/Editor/tiny/toolbar/linkinput.js
+++ b/apps/mobile/src/views/Editor/tiny/toolbar/linkinput.js
@@ -121,7 +121,7 @@ const ToolbarLinkInput = ({format, value, setVisible}) => {
ref={inputRef}
onBlur={onBlur}
style={{
- height: normalize(50),
+ height: normalize(40),
color: colors.pri,
zIndex: 10,
flexWrap: 'wrap',
@@ -147,8 +147,8 @@ const ToolbarLinkInput = ({format, value, setVisible}) => {
title="Save"
onPress={onSubmit}
height={normalize(40)}
- fontSize={SIZE.md}
- style={{paddingHorizontal: 15}}
+ fontSize={SIZE.sm}
+ style={{paddingHorizontal: 6}}
/>
)}
</>
diff --git a/apps/mobile/src/views/Editor/tiny/toolbar/listformat.js b/apps/mobile/src/views/Editor/tiny/toolbar/listformat.js
index 00c19075e..f4684080a 100644
--- a/apps/mobile/src/views/Editor/tiny/toolbar/listformat.js
+++ b/apps/mobile/src/views/Editor/tiny/toolbar/listformat.js
@@ -67,7 +67,7 @@ const ToolbarListFormat = ({selected, formatValue, format}) => {
<View
style={{
- width: 20,
+ width: 18,
height: 2,
backgroundColor: selected ? colors.accent : colors.pri,
}}
diff --git a/apps/mobile/src/views/Editor/tiny/toolbar/tooltip.js b/apps/mobile/src/views/Editor/tiny/toolbar/tooltip.js
index b3f27d190..8b4cc75b1 100644
--- a/apps/mobile/src/views/Editor/tiny/toolbar/tooltip.js
+++ b/apps/mobile/src/views/Editor/tiny/toolbar/tooltip.js
@@ -1,5 +1,5 @@
import React, {useEffect, useState} from 'react';
-import {ScrollView, View,TouchableOpacity} from 'react-native';
+import {ScrollView, View, TouchableOpacity} from 'react-native';
import Animated, {Easing, timing} from 'react-native-reanimated';
import {PressableButton} from '../../../../components/PressableButton';
import Heading from '../../../../components/Typography/Heading';
@@ -11,7 +11,7 @@ import {
eSubscribeEvent,
eUnSubscribeEvent
} from '../../../../services/EventManager';
-import {editing} from '../../../../utils';
+import {editing, getElevation} from '../../../../utils';
import {normalize, SIZE} from '../../../../utils/SizeUtils';
import {sleep} from '../../../../utils/TimeUtils';
import ColorGroup from './colorgroup';
@@ -63,11 +63,11 @@ const Tooltip = () => {
}
if (!data) return;
- let time = editing.tooltip === 'table' || data.type === 'table' ? 400 : 100;
+ let time = editing.tooltip === 'table' || data.type === 'table' ? 400 : 110;
if (data && editing.tooltip && editing.tooltip !== data.type) {
let translate =
- editing.tooltip === 'table' || data.type === 'table' ? 400 : 70;
+ editing.tooltip === 'table' || data.type === 'table' ? 400 : 80;
animate(translate, time);
await sleep(time);
}
@@ -82,7 +82,7 @@ const Tooltip = () => {
let style = React.useMemo(() => {
return {
- borderRadius: 5,
+ borderRadius: 0,
padding: floating ? 5 : 0,
position: 'absolute',
bottom: 50,
@@ -95,7 +95,7 @@ const Tooltip = () => {
borderColor: floating && colors.nav,
zIndex: 10,
marginBottom: 0,
- paddingHorizontal: 6,
+ paddingHorizontal: 2,
transform: [
{
translateY: translateValue
@@ -114,7 +114,7 @@ const Tooltip = () => {
flexDirection: 'row',
width: '100%',
backgroundColor: colors.bg,
- marginVertical: 5,
+ marginVertical: 2,
borderRadius: 5
}}
children={props.children}></View>
@@ -123,7 +123,7 @@ const Tooltip = () => {
style={{
width: '100%',
backgroundColor: colors.bg,
- marginVertical: 5,
+ marginVertical: 2,
borderRadius: 5,
paddingHorizontal: 0
}}
@@ -149,7 +149,7 @@ const Tooltip = () => {
let rowNumber = Math.floor(index / columnCount);
let columnNumber = index - rowNumber * columnCount;
- return `${rowNumber + 1} x ${columnNumber + 1}`;
+ return `${rowNumber + 1} x ${columnNumber + 1}`;
}
return (
@@ -183,31 +183,8 @@ const Tooltip = () => {
zIndex: 10
}}>
{[
- 1,
- 2,
- 3,
- 4,
- 5,
- 6,
- 7,
- 8,
- 9,
- 10,
- 11,
- 12,
- 13,
- 14,
- 15,
- 16,
- 17,
- 18,
- 19,
- 20,
- 21,
- 22,
- 23,
- 24,
- 25
+ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
+ 20, 21, 22, 23, 24, 25
].map((item, index) => (
<PressableButton
key={item.toString()}