diff --git a/src/pages/OutlinePage.jsx b/src/pages/OutlinePage.jsx index f545bb8..e75d347 100644 --- a/src/pages/OutlinePage.jsx +++ b/src/pages/OutlinePage.jsx @@ -14,7 +14,7 @@ import IqOutlineAttach from '../components/iq/IqOutlineAttach.jsx'; import ShareOutlineSheet from '../components/ShareOutlineSheet.jsx'; import { downloadOutlineDocx, downloadOutlineMarkdown, printOutline } from '../utils/outlineExport.js'; import { - KINDS, STUDY, addAfter, addChild, addRoot, chunkOf, countNodes, flatten, getNode, indent, insertAt, kindLabel, locate, + KINDS, STUDY, buildChunkFromNotes, buildFromNotes, notesBuildCount, addAfter, addChild, addRoot, chunkOf, countNodes, flatten, getNode, indent, insertAt, kindLabel, locate, moveNode, newNode, outdent, outlineFor, outlineToText, removeNode, seedFromChunks, seedFromVerses, timeSummary, updateNode, withOutline, } from '../utils/outline.js'; @@ -73,6 +73,7 @@ export default function OutlinePage() { ? seedFromChunks(project, tree).length - tree.length : seedFromVerses(project, scope, tree).length - tree.length; const seedLabel = scope === STUDY ? 'Add my chunks' : 'Add the verses'; + const fromNotes = notesBuildCount(project, scope, tree); const addMain = () => { const node = newNode(); edit((t) => addRoot(t, node)); setPendingFocus(node.id); }; const addSub = (id) => { const node = newNode(); edit((t) => addChild(t, id, node)); setPendingFocus(node.id); }; @@ -81,6 +82,14 @@ export default function OutlinePage() { edit((t) => (scope === STUDY ? seedFromChunks(project, t) : seedFromVerses(project, scope, t))); toast(`Added ${addable} point${addable === 1 ? '' : 's'}`); }; + // Builds the outline from the Observe / Interpret / Apply and background notes, with an Undo. + const buildFromMyNotes = () => { + const before = tree; + edit((t) => (scope === STUDY ? buildFromNotes(project, t) : buildChunkFromNotes(project, scope, t))); + toast(`Built ${fromNotes} ${scope === STUDY ? `main point${fromNotes === 1 ? '' : 's'} from your chunk notes` : `section${fromNotes === 1 ? '' : 's'} from this chunk's notes`}. Your notes are copied into it, so they appear if you share the outline.`, { + action: { label: 'Undo', onClick: () => edit(() => before) }, + }); + }; const remove = (id) => { const where = locate(tree, id); const gone = getNode(tree, id); @@ -157,6 +166,10 @@ export default function OutlinePage() { title={scope === STUDY ? "Adds a main point for each chunk that isn't in the outline yet" : "Adds a point for each verse of this chunk, with its words"}> {seedLabel}{addable > 0 ? ` (${addable})` : ''} +