fix(sheets): allow Save As without edits (#60)
This commit is contained in:
@@ -584,29 +584,6 @@ export async function planCellEditsToXlsx(
|
||||
sparklineAdditions: readonly SheetSparklineAddition[] = [],
|
||||
formulaValues: readonly SheetFormulaValues[] = [],
|
||||
): Promise<MutationPlan> {
|
||||
if (
|
||||
edits.length === 0 &&
|
||||
structuralOps.length === 0 &&
|
||||
chartEdits.length === 0 &&
|
||||
sheetPlan === undefined &&
|
||||
filterStates.length === 0 &&
|
||||
hyperlinkEdits.length === 0 &&
|
||||
cfStates.length === 0 &&
|
||||
dvStates.length === 0 &&
|
||||
sheetProtections.length === 0 &&
|
||||
definedNamesState === null &&
|
||||
visualAdditions.length === 0 &&
|
||||
pageSetupStates.length === 0 &&
|
||||
noteStates.length === 0 &&
|
||||
tableAdditions.length === 0 &&
|
||||
pivotAdditions.length === 0 &&
|
||||
pivotCacheRefreshPaths.length === 0 &&
|
||||
pivotRefreshUpdates.length === 0 &&
|
||||
visualEdits.length === 0 &&
|
||||
sparklineAdditions.length === 0
|
||||
) {
|
||||
throw new Error('There are no edits to save.')
|
||||
}
|
||||
// A pending pivot pins final coordinates for its source and output; shifts
|
||||
// on either sheet, and sheet renames (worksheetSource@sheet), would desync
|
||||
// the recorded ranges. Fail closed, mirroring the table-add guard.
|
||||
|
||||
@@ -1078,7 +1078,8 @@ function parseSaveRequest(input: WorkbookSaveRequest): WorkbookSaveRequest {
|
||||
typeof state.protected !== 'boolean',
|
||||
) ||
|
||||
!isDefinedNamesState(input.definedNamesState) ||
|
||||
(input.edits.length === 0 &&
|
||||
(input.mode !== 'save-as' &&
|
||||
input.edits.length === 0 &&
|
||||
input.structuralOps.length === 0 &&
|
||||
input.chartEdits.length === 0 &&
|
||||
input.visualEdits.length === 0 &&
|
||||
|
||||
@@ -148,7 +148,7 @@ export async function handleSave(
|
||||
visualEdits.length +
|
||||
tableAdditions.length +
|
||||
pivotAdditions.length
|
||||
if (total === 0) {
|
||||
if (total === 0 && mode !== 'save-as') {
|
||||
if (mode !== 'recovery') ctx.setMessage(t('appNoEditsToSave'))
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user