fix: insert template note before opening editor menu (#838)

This commit is contained in:
Mo
2022-01-31 11:30:11 -06:00
committed by GitHub
parent 7c41cfc3dc
commit ebd8848b5a
3 changed files with 35 additions and 14 deletions

View File

@@ -7,14 +7,18 @@ import { Icon } from './Icon';
type Props = {
appState: AppState;
className?: string;
onClickPreprocessing?: () => Promise<void>;
};
export const PinNoteButton: FunctionComponent<Props> = observer(
({ appState, className = '' }) => {
({ appState, className = '', onClickPreprocessing }) => {
const notes = Object.values(appState.notes.selectedNotes);
const pinned = notes.some((note) => note.pinned);
const togglePinned = () => {
const togglePinned = async () => {
if (onClickPreprocessing) {
await onClickPreprocessing();
}
if (!pinned) {
appState.notes.setPinSelectedNotes(true);
} else {