diff --git a/src/lib/catalog/pages.ts b/src/lib/catalog/pages.ts new file mode 100644 index 00000000..0fbe7061 --- /dev/null +++ b/src/lib/catalog/pages.ts @@ -0,0 +1,23 @@ +import type { VolumeData, Page } from '$lib/types'; + +/** + * Get the current working version of pages. + * Returns edited version if it exists, otherwise original. + */ +export function getCurrentPages(volumeData: VolumeData): Page[] { + return volumeData.edited_pages ?? volumeData.pages; +} + +/** + * Check if volume has edits + */ +export function hasEdits(volumeData: VolumeData): boolean { + return volumeData.edited_pages !== undefined; +} + +/** + * Get original pages (for reference in editor) + */ +export function getOriginalPages(volumeData: VolumeData): Page[] { + return volumeData.pages; +} diff --git a/src/lib/components/Editor/EditCanvas.svelte b/src/lib/components/Editor/EditCanvas.svelte new file mode 100644 index 00000000..5c0c335d --- /dev/null +++ b/src/lib/components/Editor/EditCanvas.svelte @@ -0,0 +1,127 @@ + + +
+
+ + Manga page + + + {#each workingBlocks as block, index (index)} + handleSelect(index)} + onUpdate={(updatedBlock) => updateBlock(index, updatedBlock)} + onDelete={() => deleteBlock(index)} + onClone={() => cloneBlock(index)} + bind:selectedIndex + /> + {/each} + + + +
+
diff --git a/src/lib/components/Editor/EditToolbar.svelte b/src/lib/components/Editor/EditToolbar.svelte new file mode 100644 index 00000000..568a55f3 --- /dev/null +++ b/src/lib/components/Editor/EditToolbar.svelte @@ -0,0 +1,121 @@ + + + + + + +
+ Page {pageIndex + 1} / {totalPages} +
+ + + + + +
+ + {:else} +
+ {#each block.lines as line} +

{line}

+ {/each} +
+ {/if} + + {#if isSelected} + + + + + + + + + + + + {/if} +
+ + diff --git a/src/lib/components/Reader/QuickActions.svelte b/src/lib/components/Reader/QuickActions.svelte index 1db31971..c52ccca3 100644 --- a/src/lib/components/Reader/QuickActions.svelte +++ b/src/lib/components/Reader/QuickActions.svelte @@ -1,5 +1,8 @@ + + + Edit Page {pageIndex + 1} + + +{#if isLoading} +
+ +
+{:else if volumeData && pageData} + navigatePage(pageIndex - 1)} + onNext={() => navigatePage(pageIndex + 1)} + onSave={saveEdits} + onExport={exportMokuro} + onExit={exitToReader} + onRevert={revertToOriginal} + onAddBox={addTextbox} + onZoomChange={(mode) => (zoomMode = mode)} + /> + + + + +
+

+ You have unsaved changes. Save before leaving? +

+
+ + + +
+
+
+ + + {#if isMounted && showSaveSuccess} + + {#snippet icon()} + + {/snippet} + Edits saved successfully + + {/if} + + + {#if isMounted && showSaveError} + + {#snippet icon()} + + {/snippet} + Failed to save: {saveErrorMessage} + + {/if} + + + {#if isMounted && showRevertSuccess} + + {#snippet icon()} + + {/snippet} + Reverted to original + + {/if} +{:else} +
+

Failed to load page data

+
+{/if}