only skip validation for documents

This commit is contained in:
Niels Lyngsø
2024-11-20 10:53:56 +01:00
parent 4cc3a654f9
commit 3ee43e2f1d
2 changed files with 15 additions and 15 deletions

View File

@@ -470,24 +470,11 @@ export abstract class UmbContentDetailWorkspaceContextBase<
}
}
/**
* Request a submit of the workspace, in the case of Content Workspaces the validation does not need to be valid for this to be submitted.
* @returns {Promise<void>} a promise which resolves once it has been completed.
*/
public override requestSubmit() {
return this.#handleSubmit();
}
public override submit() {
return this.#handleSubmit();
return this._handleSubmit();
}
// Because we do not make validation prevent submission this also submits the workspace. [NL]
public override invalidSubmit() {
return this.#handleSubmit();
}
async #handleSubmit() {
protected async _handleSubmit() {
const data = this.getData();
if (!data) {
throw new Error('Data is missing');

View File

@@ -208,6 +208,19 @@ export class UmbDocumentWorkspaceContext
this._data.updateCurrent({ template: { unique: templateUnique } });
}
/**
* Request a submit of the workspace, in the case of Document Workspaces the validation does not need to be valid for this to be submitted.
* @returns {Promise<void>} a promise which resolves once it has been completed.
*/
public override requestSubmit() {
return this._handleSubmit();
}
// Because we do not make validation prevent submission this also submits the workspace. [NL]
public override invalidSubmit() {
return this._handleSubmit();
}
async #handleSaveAndPreview() {
const unique = this.getUnique();
if (!unique) throw new Error('Unique is missing');