OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
Save changes to FormattableEditField on destroy
Oliver Güntherc0926da07515
diff --git a/frontend/src/app/shared/components/fields/edit/field-types/formattable-edit-field/formattable-edit-field.component.ts b/frontend/src/app/shared/components/fields/edit/field-types/formattable-edit-field/formattable-edit-field.component.tsindex be85b42abad..f1e2fe29753 100644--- a/frontend/src/app/shared/components/fields/edit/field-types/formattable-edit-field/formattable-edit-field.component.ts+++ b/frontend/src/app/shared/components/fields/edit/field-types/formattable-edit-field/formattable-edit-field.component.ts@@ -26,7 +26,11 @@// ++import {- ChangeDetectionStrategy, Component, OnInit, ViewChild,+ ChangeDetectionStrategy,+ Component,+ OnDestroy,+ OnInit,+ ViewChild,} from '@angular/core';import { EditFieldComponent } from 'core-app/shared/components/fields/edit/edit-field.component';import { OpCkeditorComponent } from 'core-app/shared/components/editor/components/ckeditor/op-ckeditor.component';@@ -40,7 +44,7 @@ import isNewResource from 'core-app/features/hal/helpers/is-new-resource';templateUrl: './formattable-edit-field.component.html',changeDetection: ChangeDetectionStrategy.OnPush,})-export class FormattableEditFieldComponent extends EditFieldComponent implements OnInit {+export class FormattableEditFieldComponent extends EditFieldComponent implements OnInit, OnDestroy {public readonly field = this;// Detect when inner component could not be initialized@@ -77,6 +81,16 @@ export class FormattableEditFieldComponent extends EditFieldComponent implements};}+ ngOnDestroy():void {+ super.ngOnDestroy();++ try {+ this.rawValue = this.editor?.getRawData();+ } catch (e) {+ console.error(`Failed to save CKEditor state on destroy: ${e as string}.`);+ }+ }+public onCkeditorSetup(editor:ICKEditorInstance):void {if (!isNewResource(this.resource)) {setTimeout(() => editor.editing.view.focus());