From 9e5ff29f114ddb248f9169e04d65e6e487fd813a Mon Sep 17 00:00:00 2001
From: rhenck <richard.henck@iqb.hu-berlin.de>
Date: Mon, 3 Jun 2024 11:04:35 +0200
Subject: [PATCH] Move MessageService to Editor project

This is only used by the Editor. It was in common while the
SanitizationService was used by the Player which then could display
errors. Sanitization has been refactored and this is no longer needed.
---
 projects/common/services/sanitization.service.ts       |  2 +-
 projects/common/shared.module.ts                       |  9 ---------
 projects/editor/src/app/app.module.ts                  | 10 ++++++++--
 .../element-properties-panel.component.ts              |  2 +-
 .../ele-specific/drop-list-properties.component.ts     |  2 +-
 .../src/app}/components/reference-list.component.ts    |  0
 .../unit-view/canvas/section-menu.component.ts         |  4 ++--
 .../app/components/unit-view/page-menu.component.ts    |  2 +-
 projects/editor/src/app/services/id.service.ts         |  2 +-
 .../src/app}/services/message.service.ts               |  0
 .../src/app/services/unit-services/element.service.ts  |  2 +-
 .../src/app/services/unit-services/page.service.ts     |  2 +-
 .../src/app/services/unit-services/unit.service.ts     |  2 +-
 13 files changed, 18 insertions(+), 21 deletions(-)
 rename projects/{common => editor/src/app}/components/reference-list.component.ts (100%)
 rename projects/{common => editor/src/app}/services/message.service.ts (100%)

diff --git a/projects/common/services/sanitization.service.ts b/projects/common/services/sanitization.service.ts
index baa6e9d6b..bb7e2b5e2 100644
--- a/projects/common/services/sanitization.service.ts
+++ b/projects/common/services/sanitization.service.ts
@@ -23,7 +23,7 @@ import { Page } from 'common/models/page';
 import { Section } from 'common/models/section';
 import { RadioButtonGroupComplexElement } from 'common/models/elements/input-elements/radio-button-group-complex';
 import { RadioButtonGroupElement } from 'common/models/elements/input-elements/radio-button-group';
-import { MessageService } from 'common/services/message.service';
+import { MessageService } from 'editor/src/app/services/message.service';
 import { IDService } from 'editor/src/app/services/id.service';
 import {
   BasicStyles,
diff --git a/projects/common/shared.module.ts b/projects/common/shared.module.ts
index 5a8e449a0..e889bbfc4 100644
--- a/projects/common/shared.module.ts
+++ b/projects/common/shared.module.ts
@@ -81,11 +81,6 @@ import { SpinnerComponent } from './components/spinner/spinner.component';
 import { GetValuePipe, MathFieldComponent } from './components/input-elements/math-field.component';
 import { MeasurePipe } from './pipes/measure.pipe';
 import { TextImagePanelComponent } from './components/text-image-panel.component';
-import { ReferenceListComponent } from './components/reference-list.component';
-import {
-  FixedReferencesSnackbarComponent,
-  ReferenceListSnackbarComponent
-} from './services/message.service';
 import { UnitDefErrorDialogComponent } from './components/unit-def-error-dialog.component';
 import { MathTableComponent } from './components/input-elements/math-table.component';
 
@@ -167,9 +162,6 @@ import { DraggableDirective } from './components/input-elements/drop-list/dragga
     DynamicRowsDirective,
     MeasurePipe,
     TextImagePanelComponent,
-    ReferenceListComponent,
-    ReferenceListSnackbarComponent,
-    FixedReferencesSnackbarComponent,
     UnitDefErrorDialogComponent,
     TooltipComponent,
     TooltipEventTooltipDirective,
@@ -221,7 +213,6 @@ import { DraggableDirective } from './components/input-elements/drop-list/dragga
     MathFieldComponent,
     MeasurePipe,
     TextImagePanelComponent,
-    ReferenceListComponent,
     TextAreaMathComponent,
     MathTableComponent
   ]
diff --git a/projects/editor/src/app/app.module.ts b/projects/editor/src/app/app.module.ts
index ba704c7c9..bc0a3a3a6 100644
--- a/projects/editor/src/app/app.module.ts
+++ b/projects/editor/src/app/app.module.ts
@@ -67,7 +67,9 @@ import { StaticCanvasOverlayComponent } from
 import { DynamicCanvasOverlayComponent } from
     'editor/src/app/components/unit-view/canvas/section-dynamic/dynamic-canvas-overlay.component';
 import { EditorTranslateLoader } from './editor-translate-loader';
-import { SectionMenuComponent } from 'editor/src/app/components/unit-view/canvas/section-menu.component';
+import {
+  SectionMenuComponent,
+} from 'editor/src/app/components/unit-view/canvas/section-menu.component';
 import { SectionStaticComponent } from 'editor/src/app/components/unit-view/canvas/section-static/section-static.component';
 import { SectionDynamicComponent } from 'editor/src/app/components/unit-view/canvas/section-dynamic/section-dynamic.component';
 import { RichTextEditorComponent } from './text-editor/rich-text-editor.component';
@@ -125,6 +127,8 @@ import {
 } from 'editor/src/app/components/properties-panel/model-properties-tab/input-groups/ele-specific-props.component';
 import { PageMenu } from 'editor/src/app/components/unit-view/page-menu.component';
 import { MAT_TOOLTIP_DEFAULT_OPTIONS, MatTooltipDefaultOptions } from '@angular/material/tooltip';
+import { ReferenceListComponent } from 'editor/src/app/components/reference-list.component';
+import { ElementListComponent } from 'editor/src/app/components/element-list.component';
 
 /** Custom options the configure the tooltip's default show/hide delays. */
 export const myCustomTooltipDefaults: MatTooltipDefaultOptions = {
@@ -231,7 +235,9 @@ export const myCustomTooltipDefaults: MatTooltipDefaultOptions = {
     IsInputElementPipe,
     OptionListPanelComponent,
     EleSpecificPropsComponent,
-    PageMenu
+    PageMenu,
+    ReferenceListComponent,
+    ElementListComponent
   ],
   providers: [
     { provide: APIService, useExisting: VeronaAPIService },
diff --git a/projects/editor/src/app/components/properties-panel/element-properties-panel.component.ts b/projects/editor/src/app/components/properties-panel/element-properties-panel.component.ts
index 5a39cea83..081ec4b22 100644
--- a/projects/editor/src/app/components/properties-panel/element-properties-panel.component.ts
+++ b/projects/editor/src/app/components/properties-panel/element-properties-panel.component.ts
@@ -5,7 +5,7 @@ import { DomSanitizer } from '@angular/platform-browser';
 import { Subject } from 'rxjs';
 import { takeUntil } from 'rxjs/operators';
 import { TranslateService } from '@ngx-translate/core';
-import { MessageService } from 'common/services/message.service';
+import { MessageService } from 'editor/src/app/services/message.service';
 import { UIElement } from 'common/models/elements/element';
 import { LikertRowElement } from 'common/models/elements/compound-elements/likert/likert-row';
 import { UnitService } from '../../services/unit-services/unit.service';
diff --git a/projects/editor/src/app/components/properties-panel/model-properties-tab/input-groups/ele-specific/drop-list-properties.component.ts b/projects/editor/src/app/components/properties-panel/model-properties-tab/input-groups/ele-specific/drop-list-properties.component.ts
index 48b73eaec..cdd1069c7 100644
--- a/projects/editor/src/app/components/properties-panel/model-properties-tab/input-groups/ele-specific/drop-list-properties.component.ts
+++ b/projects/editor/src/app/components/properties-panel/model-properties-tab/input-groups/ele-specific/drop-list-properties.component.ts
@@ -6,7 +6,7 @@ import { TranslateModule, TranslateService } from '@ngx-translate/core';
 import { moveItemInArray } from '@angular/cdk/drag-drop';
 import { MatSelect, MatSelectModule } from '@angular/material/select';
 import { MatOption } from '@angular/material/core';
-import { MessageService } from 'common/services/message.service';
+import { MessageService } from 'editor/src/app/services/message.service';
 import { CombinedProperties } from 'editor/src/app/components/properties-panel/element-properties-panel.component';
 import { IDService } from 'editor/src/app/services/id.service';
 import { DragNDropValueObject, TextImageLabel } from 'common/models/elements/label-interfaces';
diff --git a/projects/common/components/reference-list.component.ts b/projects/editor/src/app/components/reference-list.component.ts
similarity index 100%
rename from projects/common/components/reference-list.component.ts
rename to projects/editor/src/app/components/reference-list.component.ts
diff --git a/projects/editor/src/app/components/unit-view/canvas/section-menu.component.ts b/projects/editor/src/app/components/unit-view/canvas/section-menu.component.ts
index a4cc1636e..ba2cafed8 100644
--- a/projects/editor/src/app/components/unit-view/canvas/section-menu.component.ts
+++ b/projects/editor/src/app/components/unit-view/canvas/section-menu.component.ts
@@ -4,8 +4,8 @@ import {
 import { Subject } from 'rxjs';
 import { takeUntil } from 'rxjs/operators';
 import { Clipboard } from '@angular/cdk/clipboard';
-import { MessageService } from 'common/services/message.service';
-import { CompoundElement, UIElement } from 'common/models/elements/element';
+import { MessageService } from 'editor/src/app/services/message.service';
+import { CompoundElement, Measurement, UIElement } from 'common/models/elements/element';
 import { Section } from 'common/models/section';
 import { DropListElement } from 'common/models/elements/input-elements/drop-list';
 import { IDService } from 'editor/src/app/services/id.service';
diff --git a/projects/editor/src/app/components/unit-view/page-menu.component.ts b/projects/editor/src/app/components/unit-view/page-menu.component.ts
index 8b4809dba..478aefafa 100644
--- a/projects/editor/src/app/components/unit-view/page-menu.component.ts
+++ b/projects/editor/src/app/components/unit-view/page-menu.component.ts
@@ -13,7 +13,7 @@ import { TranslateModule } from '@ngx-translate/core';
 import { Page } from 'common/models/page';
 import { SelectionService } from 'editor/src/app/services/selection.service';
 import { UnitService } from 'editor/src/app/services/unit-services/unit.service';
-import { MessageService } from 'common/services/message.service';
+import { MessageService } from 'editor/src/app/services/message.service';
 import { Subject } from 'rxjs';
 import { MatTooltipModule } from '@angular/material/tooltip';
 import { PageService } from 'editor/src/app/services/unit-services/page.service';
diff --git a/projects/editor/src/app/services/id.service.ts b/projects/editor/src/app/services/id.service.ts
index e5ae9701e..5e910c588 100644
--- a/projects/editor/src/app/services/id.service.ts
+++ b/projects/editor/src/app/services/id.service.ts
@@ -2,7 +2,7 @@ import { Injectable } from '@angular/core';
 import { Unit } from 'common/models/unit';
 import { UIElement } from 'common/models/elements/element';
 import { DropListElement } from 'common/models/elements/input-elements/drop-list';
-import { MessageService } from 'common/services/message.service';
+import { MessageService } from 'editor/src/app/services/message.service';
 import { TranslateService } from '@ngx-translate/core';
 
 @Injectable({
diff --git a/projects/common/services/message.service.ts b/projects/editor/src/app/services/message.service.ts
similarity index 100%
rename from projects/common/services/message.service.ts
rename to projects/editor/src/app/services/message.service.ts
diff --git a/projects/editor/src/app/services/unit-services/element.service.ts b/projects/editor/src/app/services/unit-services/element.service.ts
index ddcb063b1..c5e93903f 100644
--- a/projects/editor/src/app/services/unit-services/element.service.ts
+++ b/projects/editor/src/app/services/unit-services/element.service.ts
@@ -25,7 +25,7 @@ import {
 import { ElementFactory } from 'common/util/element.factory';
 import { ReferenceManager } from 'editor/src/app/services/reference-manager';
 import { DialogService } from 'editor/src/app/services/dialog.service';
-import { MessageService } from 'common/services/message.service';
+import { MessageService } from 'editor/src/app/services/message.service';
 import { TextElement } from 'common/models/elements/text/text';
 import { ClozeDocument, ClozeElement } from 'common/models/elements/compound-elements/cloze/cloze';
 import { DomSanitizer } from '@angular/platform-browser';
diff --git a/projects/editor/src/app/services/unit-services/page.service.ts b/projects/editor/src/app/services/unit-services/page.service.ts
index 4fcaec7cf..5cdea1226 100644
--- a/projects/editor/src/app/services/unit-services/page.service.ts
+++ b/projects/editor/src/app/services/unit-services/page.service.ts
@@ -1,7 +1,7 @@
 import { Injectable } from '@angular/core';
 import { Page } from 'common/models/page';
 import { UnitService } from 'editor/src/app/services/unit-services/unit.service';
-import { MessageService } from 'common/services/message.service';
+import { MessageService } from 'editor/src/app/services/message.service';
 import { SelectionService } from 'editor/src/app/services/selection.service';
 import { ArrayUtils } from 'common/util/array';
 
diff --git a/projects/editor/src/app/services/unit-services/unit.service.ts b/projects/editor/src/app/services/unit-services/unit.service.ts
index 697d8a7c3..86de02da0 100644
--- a/projects/editor/src/app/services/unit-services/unit.service.ts
+++ b/projects/editor/src/app/services/unit-services/unit.service.ts
@@ -1,7 +1,7 @@
 import { Injectable } from '@angular/core';
 import {  Subject } from 'rxjs';
 import { FileService } from 'common/services/file.service';
-import { MessageService } from 'common/services/message.service';
+import { MessageService } from 'editor/src/app/services/message.service';
 import { Unit, UnitProperties } from 'common/models/unit';
 import { DragNDropValueObject } from 'common/models/elements/label-interfaces';
 import {
-- 
GitLab