add simple error handler

This commit is contained in:
ammarahm-ed
2021-12-29 12:54:49 +05:00
parent 42339d96a4
commit e78d5d7e61
4 changed files with 19 additions and 6 deletions

File diff suppressed because one or more lines are too long

View File

@@ -195,7 +195,9 @@ function init_callback(_editor) {
collapseElement(target);
editor.getHTML().then(function (html) {
reactNativeEventHandler('tiny', html);
});
}).catch(function(e) {
reactNativeEventHandler('tinyerror', e.message);
})
});
}
});
@@ -612,7 +614,10 @@ const onChange = function (event) {
changeTimer = setTimeout(function () {
editor.getHTML().then(function (html) {
reactNativeEventHandler('tiny', html);
});
}).catch(function(e) {
reactNativeEventHandler('tinyerror', e.message);
})
onUndoChange();
selectchange();
}, delay());

View File

@@ -7,7 +7,8 @@ import {
eSendEvent,
eSubscribeEvent,
eUnSubscribeEvent,
presentSheet
presentSheet,
ToastEvent
} from '../../services/EventManager';
import Navigation from '../../services/Navigation';
import PremiumService from '../../services/PremiumService';
@@ -459,6 +460,13 @@ export const _onMessage = async evt => {
}
switch (message.type) {
case 'tinyerror':
ToastEvent.show({
heading: 'An error occured',
message: message.value,
type: 'error'
});
break;
case 'tableconfig':
showTableOptionsTooltip();
break;

View File

@@ -119,8 +119,8 @@ const Editor = React.memo(
allowFileAccessFromFileURLs={true}
allowUniversalAccessFromFileURLs={true}
originWhitelist={['*']}
source={source}
//source={{uri:"http://192.168.10.13:5000/index.html"}}
//source={source}
source={{uri:"http://192.168.10.7:3000/index.html"}}
style={style}
autoManageStatusBarEnabled={false}
onMessage={_onMessage}