Skip to content

Commit

Permalink
Add a selectBulkImportDialogExportContent
Browse files Browse the repository at this point in the history
Part of #688.
  • Loading branch information
jkomoros committed Apr 7, 2024
1 parent f93da62 commit 25ac8e3
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 2 deletions.
8 changes: 7 additions & 1 deletion src/contenteditable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ import {

import {
HTMLTagMap,
HTMLTagName
HTMLTagName,
ProcessedCard
} from './types.js';

import {
Expand Down Expand Up @@ -464,4 +465,9 @@ export const importBodiesFromGoogleDocs = (content : string, mode : 'bulleted' |
result.push(body);
}
return result;
};

export const exportContentForCards = (cards : ProcessedCard[]) : string => {
//TODO: convert markup.
return cards.map(card => card.body).join('\n');
};
19 changes: 18 additions & 1 deletion src/selectors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,10 +160,17 @@ import {
Filters
} from './types.js';

import {
exportContentForCards
} from './contenteditable.js';

import {
TypedObject
} from './typed_object.js';
import { Timestamp } from 'firebase/firestore';

import {
Timestamp
} from 'firebase/firestore';

const selectState = (state : State) : State => state;

Expand Down Expand Up @@ -1812,4 +1819,14 @@ export const selectMultiEditCardDiff = createSelector(
if (todoDisablements.length) result.auto_todo_overrides_disablements = todoDisablements;
return result;
}
);

export const selectBulkImportDialogExportContent = createSelector(
selectBulkImportDialogOpen,
selectBulKimportDialogMode,
selectActiveCollectionCards,
(open, mode, cards) => {
if (!open || mode != 'export') return '';
return exportContentForCards(cards);
}
);

0 comments on commit 25ac8e3

Please sign in to comment.