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
Don't set pageState = edited on internal callback, rather on editor focus (#19800)
Oliver Güntherbe736464ed3e
diff --git a/frontend/src/app/shared/components/editor/components/ckeditor-augmented-textarea/ckeditor-augmented-textarea.component.ts b/frontend/src/app/shared/components/editor/components/ckeditor-augmented-textarea/ckeditor-augmented-textarea.component.tsindex 1945e3949ad..5e7d63ebfa7 100644--- a/frontend/src/app/shared/components/editor/components/ckeditor-augmented-textarea/ckeditor-augmented-textarea.component.ts+++ b/frontend/src/app/shared/components/editor/components/ckeditor-augmented-textarea/ckeditor-augmented-textarea.component.ts@@ -122,6 +122,8 @@ export class CkeditorAugmentedTextareaComponent extends UntilDestroyedMixin implattachments: this.I18n.t('js.label_attachments'),};+ private focused = false;+// Reference to the actual ckeditor instance component@ViewChild(OpCkeditorComponent, { static: true }) private ckEditorInstance:OpCkeditorComponent;@@ -184,6 +186,16 @@ export class CkeditorAugmentedTextareaComponent extends UntilDestroyedMixin impl});}+ public editorFocused():void {+ this.focused = true;+ this.editorFocus.emit();+ }++ public editorBlurred():void {+ this.focused = false;+ this.editorBlur.emit();+ }+public async saveForm(evt?:SubmitEvent):Promise<void> {if (CkeditorAugmentedTextareaComponent.inFlight.has(this.formElement)) {return;@@ -232,9 +244,17 @@ export class CkeditorAugmentedTextareaComponent extends UntilDestroyedMixin implreturn editor;}- public syncToTextarea() {- window.OpenProject.pageState = 'edited';+ public updateContent(value:string) {+ // Update the page state to edited+ // but only if we're focused in the editor+ if (this.focused) {+ window.OpenProject.pageState = 'edited';+ }+ this.wrappedTextArea.value = value;+ }++ public syncToTextarea() {try {this.wrappedTextArea.value = this.ckEditorInstance.getTransformedContent(true);} catch (e) {diff --git a/frontend/src/app/shared/components/editor/components/ckeditor-augmented-textarea/ckeditor-augmented-textarea.html b/frontend/src/app/shared/components/editor/components/ckeditor-augmented-textarea/ckeditor-augmented-textarea.htmlindex 52b8504577a..f500dbd90f6 100644--- a/frontend/src/app/shared/components/editor/components/ckeditor-augmented-textarea/ckeditor-augmented-textarea.html+++ b/frontend/src/app/shared/components/editor/components/ckeditor-augmented-textarea/ckeditor-augmented-textarea.html@@ -3,12 +3,12 @@[context]="context"[content]="initialContent"(initializeDone)="setup($event)"- (contentChanged)="syncToTextarea()"+ (contentChanged)="updateContent($event)"(saveRequested)="saveForm()"(editorEscape)="editorEscape.emit()"(editorKeyup)="editorKeyup.emit()"- (editorBlur)="editorBlur.emit()"- (editorFocus)="editorFocus.emit()"+ (editorBlur)="editorBlurred()"+ (editorFocus)="editorFocused()"></op-ckeditor></div>