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
Amend editor dismiss strategy to be less eager
Kabiru Mwenjabc62ffbf2bd4
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 7c69cf4385d..0d0fc718a38 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@@ -84,6 +84,8 @@ export class CkeditorAugmentedTextareaComponent extends UntilDestroyedMixin impl// Output save requests (ctrl+enter and cmd+enter)@Output() saveRequested = new EventEmitter<string>();+ @Output() editorEscape = new EventEmitter<string>();+// Output keyup events@Output() editorKeyup = new EventEmitter<void>();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 93476d85c55..52b8504577a 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@@ -5,6 +5,7 @@(initializeDone)="setup($event)"(contentChanged)="syncToTextarea()"(saveRequested)="saveForm()"+ (editorEscape)="editorEscape.emit()"(editorKeyup)="editorKeyup.emit()"(editorBlur)="editorBlur.emit()"(editorFocus)="editorFocus.emit()"diff --git a/frontend/src/app/shared/components/editor/components/ckeditor/op-ckeditor.component.ts b/frontend/src/app/shared/components/editor/components/ckeditor/op-ckeditor.component.tsindex 51843b2f83b..eafa2d6e27a 100644--- a/frontend/src/app/shared/components/editor/components/ckeditor/op-ckeditor.component.ts+++ b/frontend/src/app/shared/components/editor/components/ckeditor/op-ckeditor.component.ts@@ -71,6 +71,8 @@ export class OpCkeditorComponent extends UntilDestroyedMixin implements OnInit,// Output save requests (ctrl+enter and cmd+enter)@Output() saveRequested = new EventEmitter<string>();+ @Output() editorEscape = new EventEmitter<string>();+// Output key up events@Output() editorKeyup = new EventEmitter<string>();@@ -274,6 +276,11 @@ export class OpCkeditorComponent extends UntilDestroyedMixin implements OnInit,this.saveRequested.emit();evt.stop();}++ if (data.keyCode === KeyCodes.ESCAPE) {+ debugLog('Sending escape request from CKEditor.');+ this.editorEscape.emit();+ }},{ priority: 'highest' },);diff --git a/frontend/src/stimulus/controllers/dynamic/work-packages/activities-tab/index.controller.ts b/frontend/src/stimulus/controllers/dynamic/work-packages/activities-tab/index.controller.tsindex aef60de58ac..47f5153e52a 100644--- a/frontend/src/stimulus/controllers/dynamic/work-packages/activities-tab/index.controller.ts+++ b/frontend/src/stimulus/controllers/dynamic/work-packages/activities-tab/index.controller.ts@@ -88,6 +88,7 @@ export default class IndexController extends Controller {private rescueEditorContentBound:EventListener;private onSubmitBound:EventListener;+ private onEscapeEditorBound:EventListener;private adjustMarginBound:EventListener;private onBlurEditorBound:EventListener;private onFocusEditorBound:EventListener;@@ -544,6 +545,7 @@ export default class IndexController extends Controller {private addEventListenersToCkEditorInstance() {this.onSubmitBound = () => { void this.onSubmit(); };+ this.onEscapeEditorBound = () => { void this.onEscapeEditor(); };this.adjustMarginBound = () => { void this.adjustJournalContainerMargin(); };this.onBlurEditorBound = () => { void this.onBlurEditor(); };this.onFocusEditorBound = () => {@@ -556,6 +558,7 @@ export default class IndexController extends Controller {const editorElement = this.getCkEditorElement();if (editorElement) {editorElement.addEventListener('saveRequested', this.onSubmitBound);+ editorElement.addEventListener('editorEscape', this.onEscapeEditorBound);editorElement.addEventListener('editorKeyup', this.adjustMarginBound);editorElement.addEventListener('editorBlur', this.onBlurEditorBound);editorElement.addEventListener('editorFocus', this.onFocusEditorBound);@@ -720,20 +723,30 @@ export default class IndexController extends Controller {}}- onBlurEditor() {- const ckEditorInstance = this.getCkEditorInstance();-- if (ckEditorInstance && ckEditorInstance.getData({ trim: false }).length === 0) {+ onEscapeEditor() {+ if (this.isEditorEmpty()) {this.hideEditor();} else {this.adjustJournalContainerMargin();}}+ onBlurEditor() {+ if (!this.isEditorEmpty()) {+ this.adjustJournalContainerMargin();+ }+ }+onFocusEditor() {this.adjustJournalContainerMargin();}+ private isEditorEmpty():boolean {+ const ckEditorInstance = this.getCkEditorInstance();++ return !!(ckEditorInstance && ckEditorInstance.getData({ trim: false }).length === 0);+ }+async onSubmit(event:Event | null = null) {event?.preventDefault();