bug fix on chapter reordering of description-template-editor toc
This commit is contained in:
parent
a13d1a4000
commit
79005d70c4
|
@ -66,8 +66,6 @@ export class DescriptionTemplateTableOfContents extends BaseComponent implements
|
|||
if (this._dragStartedAt) {
|
||||
const timeNow = new Date().getTime();
|
||||
if (timeNow - this._dragStartedAt > this.VALID_DROP_TIME) {
|
||||
// console.log('timenow: ', timeNow);
|
||||
// console.log('timestarted', this._dragStartedAt);
|
||||
this._dragStartedAt = null;
|
||||
|
||||
} else {
|
||||
|
@ -113,9 +111,7 @@ export class DescriptionTemplateTableOfContents extends BaseComponent implements
|
|||
switch (element.type) {
|
||||
case ToCEntryType.FieldSet: {
|
||||
if (targetContainer.type != this.tocEntryType.Section) {
|
||||
// const message = 'Fieldset can only be child of Subsections';
|
||||
const message = this.language.instant('DESCRIPTION-TEMPLATE-EDITOR.STEPS.FORM.TABLE-OF-CONTENTS.ERROR-MESSAGES.FIELDSET-MUST-HAVE-PARENT-SECTION');
|
||||
// console.error(message);
|
||||
this.notifyUser(message)
|
||||
this.dataNeedsRefresh.emit();
|
||||
return;
|
||||
|
@ -123,10 +119,8 @@ export class DescriptionTemplateTableOfContents extends BaseComponent implements
|
|||
|
||||
//check if target container has no sections
|
||||
if ((targetContainer.form.get('sections') as UntypedFormArray).length) {
|
||||
// const message = 'Cannot have inputs and sections on the same level';
|
||||
const message = this.language.instant('DESCRIPTION-TEMPLATE-EDITOR.STEPS.FORM.TABLE-OF-CONTENTS.ERROR-MESSAGES.INPUT-SECTION-SAME-LEVEL');
|
||||
this.notifyUser(message);
|
||||
// console.error(message);
|
||||
this.dataNeedsRefresh.emit();
|
||||
return;
|
||||
}
|
||||
|
@ -201,10 +195,8 @@ export class DescriptionTemplateTableOfContents extends BaseComponent implements
|
|||
|
||||
if (targetContainer.type == ToCEntryType.Section) {
|
||||
if ((targetContainer.form.get('fieldSets') as UntypedFormArray).length) {
|
||||
// const message = 'Cannot have inputs and sections on the same level';
|
||||
const message = this.language.instant('DESCRIPTION-TEMPLATE-EDITOR.STEPS.FORM.TABLE-OF-CONTENTS.ERROR-MESSAGES.INPUT-SECTION-SAME-LEVEL');;
|
||||
this.notifyUser(message);
|
||||
// console.info(message);
|
||||
this.dataNeedsRefresh.emit();
|
||||
return;
|
||||
}
|
||||
|
@ -267,7 +259,6 @@ export class DescriptionTemplateTableOfContents extends BaseComponent implements
|
|||
} else if (targetContainer.type === ToCEntryType.Page) {
|
||||
|
||||
const rootform = targetContainer.form;
|
||||
// const rootform = targetContainer.form.root;
|
||||
const sectionForm = element.form;
|
||||
const parentSections = sectionForm.parent as UntypedFormArray;
|
||||
|
||||
|
@ -333,10 +324,8 @@ export class DescriptionTemplateTableOfContents extends BaseComponent implements
|
|||
targetSectionsArray.push(sectionForm);
|
||||
|
||||
} else {
|
||||
// const message = 'Drag not support to specific container';
|
||||
const message = this.language.instant('DESCRIPTION-TEMPLATE-EDITOR.STEPS.FORM.TABLE-OF-CONTENTS.ERROR-MESSAGES.DRAG-NOT-SUPPORTED');
|
||||
this.notifyUser(message);
|
||||
// console.info(message);
|
||||
this.dataNeedsRefresh.emit();
|
||||
return;
|
||||
}
|
||||
|
@ -348,10 +337,8 @@ export class DescriptionTemplateTableOfContents extends BaseComponent implements
|
|||
}
|
||||
case ToCEntryType.Page: {
|
||||
if (targetId != this.ROOT_ID) {
|
||||
// const message = 'A page element can only be at top level';
|
||||
const message = this.language.instant('DESCRIPTION-TEMPLATE-EDITOR.STEPS.FORM.TABLE-OF-CONTENTS.ERROR-MESSAGES.PAGE-ELEMENT-ONLY-TOP-LEVEL');
|
||||
this.notifyUser(message);
|
||||
// console.info(message);
|
||||
this.dataNeedsRefresh.emit();
|
||||
return;
|
||||
}
|
||||
|
@ -364,7 +351,7 @@ export class DescriptionTemplateTableOfContents extends BaseComponent implements
|
|||
}
|
||||
|
||||
|
||||
const pages = rootForm.get('pages') as UntypedFormArray;
|
||||
const pages = rootForm.get('definition')?.get('pages') as UntypedFormArray;
|
||||
const pageForm = element.form;
|
||||
|
||||
let index = -1;
|
||||
|
|
Loading…
Reference in New Issue