Skip to content

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

remove margins only on ios in editor

ammarahm-ed07bfa8d5a0df
diff --git a/apps/mobile/html/Web.bundle/site/init.js b/apps/mobile/html/Web.bundle/site/init.js
index c2ad678b9..a86bb50ba 100755
--- a/apps/mobile/html/Web.bundle/site/init.js
+++ b/apps/mobile/html/Web.bundle/site/init.js
@@ -193,11 +193,14 @@ function init_callback(_editor) {
target.classList.add(COLLAPSED_KEY);
}
collapseElement(target);
- editor.getHTML().then(function (html) {
- reactNativeEventHandler('tiny', html);
- }).catch(function(e) {
- reactNativeEventHandler('tinyerror', e.message);
- })
+ editor
+ .getHTML()
+ .then(function (html) {
+ reactNativeEventHandler('tiny', html);
+ })
+ .catch(function (e) {
+ reactNativeEventHandler('tinyerror', e.message);
+ });
});
}
});
@@ -235,12 +238,18 @@ const plugins = [
'media imagetools table paste wordcount autoresize directionality blockescape contenthandler'
];
+let isSafari = navigator.vendor.match(/apple/i);
+
const content_style = `
body {
font-family:"Open Sans";
overflow-x: hidden !important;
- margin-left:12px !important;
- margin-right:12px !important;
+ ${
+ isSafari
+ ? `margin-left:12px !important;
+margin-right:12px !important;`
+ : ''
+ }
}
.mce-content-body h2::before,
@@ -391,7 +400,8 @@ function init_tiny(size) {
content_style: content_style,
browser_spellcheck: true,
autoresize_bottom_margin: 120,
- table_toolbar: 'tcellprops trowprops | tableinsertrowafter tableinsertcolafter tabledeleterow tabledeletecol | tableconfig',
+ table_toolbar:
+ 'tcellprops trowprops | tableinsertrowafter tableinsertcolafter tabledeleterow tabledeletecol | tableconfig',
imagetools_toolbar:
'imagedownload | rotateleft rotateright flipv fliph | imageopts ',
placeholder: 'Start writing your note here',
@@ -491,7 +501,7 @@ function setup_tiny(_editor) {
icon: 'table-row-properties',
tooltip: 'Row properties',
onAction: function (e) {
- tableRowNodeOptions()
+ tableRowNodeOptions();
editor.blur();
}
});
@@ -500,7 +510,7 @@ function setup_tiny(_editor) {
icon: 'table-cell-properties',
tooltip: 'Cell properties',
onAction: function (e) {
- tableCellNodeOptions()
+ tableCellNodeOptions();
editor.blur();
}
});
@@ -614,11 +624,14 @@ const onChange = function (event) {
clearTimeout(changeTimer);
changeTimer = null;
changeTimer = setTimeout(function () {
- editor.getHTML().then(function (html) {
- reactNativeEventHandler('tiny', html);
- }).catch(function(e) {
- reactNativeEventHandler('tinyerror', e.message);
- })
+ editor
+ .getHTML()
+ .then(function (html) {
+ reactNativeEventHandler('tiny', html);
+ })
+ .catch(function (e) {
+ reactNativeEventHandler('tinyerror', e.message);
+ });
onUndoChange();
selectchange();
diff --git a/apps/mobile/src/views/Editor/EditorWrapper.js b/apps/mobile/src/views/Editor/EditorWrapper.js
index db8f5ea8c..df9675509 100644
--- a/apps/mobile/src/views/Editor/EditorWrapper.js
+++ b/apps/mobile/src/views/Editor/EditorWrapper.js
@@ -3,6 +3,7 @@ import {
KeyboardAvoidingView,
LayoutAnimation,
Platform,
+ SafeAreaView,
TextInput,
View
} from 'react-native';
@@ -33,27 +34,33 @@ export const EditorWrapper = ({width, dimensions}) => {
height: '100%',
backgroundColor: state.colors.bg,
borderLeftWidth: 1,
- borderLeftColor: DDS.isTab ? colors.nav : 'transparent',
- paddingTop: Platform.OS === 'ios' ? insets.top : 0,
- paddingBottom: Platform.OS === 'ios' ? insets.bottom : 0
+ borderLeftColor: DDS.isTab ? colors.nav : 'transparent'
+ // paddingTop: Platform.OS === 'ios' ? insets.top : 0,
+ // paddingBottom: Platform.OS === 'ios' ? insets.bottom : 0
}}>
- <KeyboardAvoidingView
- behavior="padding"
+ <SafeAreaView
style={{
- width:'100%',
- height:'100%'
- }}
- enabled={!floating && Platform.OS === 'ios'}>
- <PremiumToast key="toast" context="editor" offset={50 + insets.top} />
- <TextInput
- key="input"
- ref={textInput}
- style={{height: 1, padding: 0, width: 1, position: 'absolute'}}
- blurOnSubmit={false}
- />
- {loading ? null : <Editor key="editor" />}
- <EditorOverlay key="overlay" />
- </KeyboardAvoidingView>
+ width: '100%',
+ height: '100%'
+ }}>
+ <KeyboardAvoidingView
+ behavior="padding"
+ style={{
+ width: '100%',
+ height: '100%'
+ }}
+ enabled={!floating && Platform.OS === 'ios'}>
+ <PremiumToast key="toast" context="editor" offset={50 + insets.top} />
+ <TextInput
+ key="input"
+ ref={textInput}
+ style={{height: 1, padding: 0, width: 1, position: 'absolute'}}
+ blurOnSubmit={false}
+ />
+ {loading ? null : <Editor key="editor" />}
+ <EditorOverlay key="overlay" />
+ </KeyboardAvoidingView>
+ </SafeAreaView>
</View>
);
};
diff --git a/apps/mobile/src/views/Editor/HistoryComponent.js b/apps/mobile/src/views/Editor/HistoryComponent.js
index 530d4ae55..9c5a46044 100644
--- a/apps/mobile/src/views/Editor/HistoryComponent.js
+++ b/apps/mobile/src/views/Editor/HistoryComponent.js
@@ -1,11 +1,11 @@
import React, {useEffect, useState} from 'react';
-import {View} from 'react-native';
+import {Platform, View} from 'react-native';
import {ActionIcon} from '../../components/ActionIcon';
import {useTracked} from '../../provider';
import {eSubscribeEvent, eUnSubscribeEvent} from '../../services/EventManager';
import {SIZE} from '../../utils/SizeUtils';
import {EditorWebView, post} from './Functions';
-import tiny from './tiny/tiny';
+import tiny, {safeKeyboardDismiss} from './tiny/tiny';
const HistoryComponent = () => {
const [state] = useTracked();
@@ -14,6 +14,7 @@ const HistoryComponent = () => {
undo: false,
redo: false
});
+
const onHistoryChange = data => {
setHistoryState(data);
@@ -62,6 +63,23 @@ const HistoryComponent = () => {
tiny.call(EditorWebView, tiny.redo);
}}
/>
+{/*
+ {Platform.OS === 'ios' ? (
+ <ActionIcon
+ name="keyboard-close"
+ disabled={!historyState.undo}
+ color={colors.pri}
+ size={SIZE.lg}
+ customStyle={{
+ width: 35,
+ height: 35
+ }}
+ onPress={() => {
+ safeKeyboardDismiss();
+ }}
+ />
+ ) : null} */}
+
</View>
);
};