From 5aa5214a898ea4dc03a1842e00ee5d56df86162b Mon Sep 17 00:00:00 2001
From: chris <kokosias@yahoo.gr>
Date: Mon, 21 Mar 2022 13:30:11 +0200
Subject: [PATCH] rename service

---
 editors/demo/src/HHMI/config/config.js            |  6 +++---
 wax-prosemirror-plugins/index.js                  |  2 +-
 .../{ChatPlugin.js => GetContentOnEnterPlugin.js} |  4 ++--
 wax-prosemirror-services/index.js                 |  2 +-
 .../src/ChatService/ChatService.js                | 12 ------------
 .../src/EnterService/EnterService.js              | 15 +++++++++++++++
 6 files changed, 22 insertions(+), 19 deletions(-)
 rename wax-prosemirror-plugins/src/{ChatPlugin.js => GetContentOnEnterPlugin.js} (94%)
 delete mode 100644 wax-prosemirror-services/src/ChatService/ChatService.js
 create mode 100644 wax-prosemirror-services/src/EnterService/EnterService.js

diff --git a/editors/demo/src/HHMI/config/config.js b/editors/demo/src/HHMI/config/config.js
index d5f40e10d..b96e5e31f 100644
--- a/editors/demo/src/HHMI/config/config.js
+++ b/editors/demo/src/HHMI/config/config.js
@@ -29,7 +29,7 @@ import {
   EssayToolGroupService,
   MatchingService,
   MatchingToolGroupService,
-  ChatService,
+  EnterService,
 } from 'wax-prosemirror-services';
 
 import { DefaultSchema } from 'wax-prosemirror-utilities';
@@ -68,14 +68,14 @@ export default {
     },
   ],
 
-  ChatService: { getContentOnEnter },
+  EnterService: { getContentOnEnter },
   SchemaService: DefaultSchema,
   RulesService: [emDash, ellipsis],
 
   PmPlugins: [columnResizing(), tableEditing(), invisibles([hardBreak()])],
 
   services: [
-    // new ChatService(),
+    new EnterService(),
     new MatchingService(),
     new MatchingToolGroupService(),
     new FillTheGapQuestionService(),
diff --git a/wax-prosemirror-plugins/index.js b/wax-prosemirror-plugins/index.js
index c9a0296f1..745b52ca8 100644
--- a/wax-prosemirror-plugins/index.js
+++ b/wax-prosemirror-plugins/index.js
@@ -11,4 +11,4 @@ export { default as mathSelectPlugin } from './src/math/math-select';
 export { default as FindAndReplacePlugin } from './src/findAndReplace/FindAndReplacePlugin';
 export { default as PlaceHolderPlugin } from './src/images/placeHolderPlugin';
 export { default as captionPlugin } from './src/images/captionPlugin';
-export { default as ChatPlugin } from './src/ChatPlugin';
+export { default as GetContentOnEnterPlugin } from './src/GetContentOnEnterPlugin';
diff --git a/wax-prosemirror-plugins/src/ChatPlugin.js b/wax-prosemirror-plugins/src/GetContentOnEnterPlugin.js
similarity index 94%
rename from wax-prosemirror-plugins/src/ChatPlugin.js
rename to wax-prosemirror-plugins/src/GetContentOnEnterPlugin.js
index 63096466e..e8e738986 100644
--- a/wax-prosemirror-plugins/src/ChatPlugin.js
+++ b/wax-prosemirror-plugins/src/GetContentOnEnterPlugin.js
@@ -2,7 +2,7 @@ import { EditorState, Plugin, PluginKey } from 'prosemirror-state';
 // eslint-disable-next-line import/no-extraneous-dependencies
 import { DOMSerializer, DOMParser } from 'prosemirror-model';
 
-const chatPlugin = new PluginKey('chatPlugin');
+const getContentOnEnterPlugin = new PluginKey('getContentOnEnterPlugin');
 
 const serializer = schema => {
   const WaxSerializer = DOMSerializer.fromSchema(schema);
@@ -26,7 +26,7 @@ const parser = schema => {
 
 export default props => {
   return new Plugin({
-    key: chatPlugin,
+    key: getContentOnEnterPlugin,
     state: {
       init: (_, state) => {},
       apply(tr, prev, _, newState) {},
diff --git a/wax-prosemirror-services/index.js b/wax-prosemirror-services/index.js
index fb9d17a61..d86df4e73 100644
--- a/wax-prosemirror-services/index.js
+++ b/wax-prosemirror-services/index.js
@@ -50,7 +50,7 @@ export { default as TrueFalseQuestionService } from './src/MultipleChoiceQuestio
 export { default as FillTheGapQuestionService } from './src/FillTheGapQuestionService/FillTheGapQuestionService';
 export { default as EssayService } from './src/EssayService/EssayService';
 export { default as MatchingService } from './src/MatchingService/MatchingService';
-export { default as ChatService } from './src/ChatService/ChatService';
+export { default as EnterService } from './src/EnterService/EnterService';
 /*
 ToolGroups
 */
diff --git a/wax-prosemirror-services/src/ChatService/ChatService.js b/wax-prosemirror-services/src/ChatService/ChatService.js
deleted file mode 100644
index 328194cb8..000000000
--- a/wax-prosemirror-services/src/ChatService/ChatService.js
+++ /dev/null
@@ -1,12 +0,0 @@
-import { ChatPlugin } from 'wax-prosemirror-plugins';
-import Service from '../Service';
-
-class ChatService extends Service {
-  name = 'ChatService';
-
-  boot() {
-    this.app.PmPlugins.add('chatPlugin', ChatPlugin(this.config));
-  }
-}
-
-export default ChatService;
diff --git a/wax-prosemirror-services/src/EnterService/EnterService.js b/wax-prosemirror-services/src/EnterService/EnterService.js
new file mode 100644
index 000000000..0a28e8bfe
--- /dev/null
+++ b/wax-prosemirror-services/src/EnterService/EnterService.js
@@ -0,0 +1,15 @@
+import { GetContentOnEnterPlugin } from 'wax-prosemirror-plugins';
+import Service from '../Service';
+
+class EnterService extends Service {
+  name = 'EnterService';
+
+  boot() {
+    this.app.PmPlugins.add(
+      'getContentOnEnterPlugin',
+      GetContentOnEnterPlugin(this.config),
+    );
+  }
+}
+
+export default EnterService;
-- 
GitLab