mirror of
https://github.com/streetwriters/notesnook.git
synced 2026-09-02 20:21:19 +02:00
fix table cell and row properties not showing properly
This commit is contained in:
@@ -52,6 +52,7 @@ const GeneralSheet = ({context}) => {
|
||||
gestureEnabled={!dialogData.progress}
|
||||
closeOnTouchBackdrop={!dialogData.progress}
|
||||
onClose={() => {
|
||||
dialogData.onClose && dialogData.onClose();
|
||||
if (!dialogData.progress) {
|
||||
setVisible(false);
|
||||
setDialogData(null);
|
||||
|
||||
@@ -36,6 +36,7 @@ import {
|
||||
IMAGE_TOOLTIP_CONFIG,
|
||||
TABLE_TOOLTIP_CONFIG
|
||||
} from './tiny/toolbar/config';
|
||||
import { focusEditor, reFocusEditor } from './tiny/toolbar/constants';
|
||||
|
||||
export let EditorWebView = createRef();
|
||||
export const editorTitleInput = createRef();
|
||||
@@ -482,20 +483,10 @@ export const _onMessage = async evt => {
|
||||
showTableOptionsTooltip();
|
||||
break;
|
||||
case 'tablecelloptions':
|
||||
eSendEvent('updatecell', message.value);
|
||||
safeKeyboardDismiss();
|
||||
await sleep(100);
|
||||
presentSheet({
|
||||
component: <TableCellProperties data={message.value} />
|
||||
});
|
||||
TableCellProperties.present(message.value);
|
||||
break;
|
||||
case 'tablerowoptions':
|
||||
eSendEvent('updaterow', message.value);
|
||||
safeKeyboardDismiss();
|
||||
await sleep(100);
|
||||
presentSheet({
|
||||
component: <TableRowProperties data={message.value} />
|
||||
});
|
||||
TableRowProperties.present(message.value);
|
||||
break;
|
||||
case 'selectionvalue':
|
||||
eSendEvent('selectionvalue', message.value);
|
||||
|
||||
@@ -7,7 +7,13 @@ import {PressableButton} from '../../components/PressableButton';
|
||||
import Heading from '../../components/Typography/Heading';
|
||||
import Paragraph from '../../components/Typography/Paragraph';
|
||||
import {useTracked} from '../../provider';
|
||||
import {eSubscribeEvent, eUnSubscribeEvent} from '../../services/EventManager';
|
||||
import {
|
||||
eSendEvent,
|
||||
eSubscribeEvent,
|
||||
eUnSubscribeEvent,
|
||||
presentSheet
|
||||
} from '../../services/EventManager';
|
||||
import { editing } from '../../utils';
|
||||
import layoutmanager from '../../utils/layout-manager';
|
||||
import {SIZE} from '../../utils/SizeUtils';
|
||||
import {EditorWebView} from './Functions';
|
||||
@@ -215,7 +221,9 @@ export const TableCellProperties = ({data}) => {
|
||||
title="Body"
|
||||
/>
|
||||
</View>
|
||||
<Heading size={SIZE.md}>Cell background color(${cellOptions.backgroundColor})</Heading>
|
||||
<Heading size={SIZE.md}>
|
||||
Cell background color(${cellOptions.backgroundColor})
|
||||
</Heading>
|
||||
<ScrollView
|
||||
horizontal
|
||||
showsHorizontalScrollIndicator={false}
|
||||
@@ -227,7 +235,7 @@ export const TableCellProperties = ({data}) => {
|
||||
<ColorItem
|
||||
value={item}
|
||||
key={item}
|
||||
checked={item === (rgbToHex(cellOptions.backgroundColor))}
|
||||
checked={item === rgbToHex(cellOptions.backgroundColor)}
|
||||
onCustomPress={color => {
|
||||
tiny.call(
|
||||
EditorWebView,
|
||||
@@ -245,3 +253,25 @@ export const TableCellProperties = ({data}) => {
|
||||
</View>
|
||||
);
|
||||
};
|
||||
TableCellProperties.isPresented = false;
|
||||
TableCellProperties.present = data => {
|
||||
eSendEvent('updaterow', data);
|
||||
if (TableCellProperties.isPresented) return;
|
||||
let refocus = false;
|
||||
if (editing.keyboardState) {
|
||||
tiny.call(EditorWebView, tiny.cacheRange);
|
||||
tiny.call(EditorWebView, tiny.blur);
|
||||
refocus = true;
|
||||
}
|
||||
TableCellProperties.isPresented = true;
|
||||
presentSheet({
|
||||
component: <TableCellProperties data={data} />,
|
||||
onClose: () => {
|
||||
TableCellProperties.isPresented = false;
|
||||
if (!refocus) return;
|
||||
tiny.call(EditorWebView, tiny.focusEditor);
|
||||
tiny.call(EditorWebView, tiny.restoreRange);
|
||||
tiny.call(EditorWebView, tiny.clearRange);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
@@ -4,7 +4,8 @@ import {ScrollView} from 'react-native-gesture-handler';
|
||||
import {Button} from '../../components/Button';
|
||||
import Heading from '../../components/Typography/Heading';
|
||||
import {useTracked} from '../../provider';
|
||||
import {eSubscribeEvent, eUnSubscribeEvent} from '../../services/EventManager';
|
||||
import {eSendEvent, eSubscribeEvent, eUnSubscribeEvent, presentSheet} from '../../services/EventManager';
|
||||
import { editing } from '../../utils';
|
||||
import layoutmanager from '../../utils/layout-manager';
|
||||
import {SIZE} from '../../utils/SizeUtils';
|
||||
import {EditorWebView} from './Functions';
|
||||
@@ -168,3 +169,25 @@ export const TableRowProperties = ({data}) => {
|
||||
</View>
|
||||
);
|
||||
};
|
||||
TableRowProperties.isPresented = false;
|
||||
TableRowProperties.present = data => {
|
||||
eSendEvent('updatecell', data);
|
||||
if (TableRowProperties.isPresented) return;
|
||||
let refocus = false;
|
||||
if (editing.keyboardState) {
|
||||
tiny.call(EditorWebView,tiny.cacheRange);
|
||||
tiny.call(EditorWebView,tiny.blur);
|
||||
refocus = true;
|
||||
}
|
||||
TableRowProperties.isPresented = true;
|
||||
presentSheet({
|
||||
component: <TableRowProperties data={data} />,
|
||||
onClose: () => {
|
||||
TableRowProperties.isPresented = false;
|
||||
if (!refocus) return;
|
||||
tiny.call(EditorWebView,tiny.focusEditor);
|
||||
tiny.call(EditorWebView,tiny.restoreRange);
|
||||
tiny.call(EditorWebView,tiny.clearRange);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user