diff --git a/editors/demo/src/HHMI/config/config.js b/editors/demo/src/HHMI/config/config.js index d5f40e10da41329d275dba5fc252f4cae6c615be..b96e5e31f28699afb71d877ae9ba7d4a686b740a 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 c9a0296f1365ff793c2970cb5260b31a3e2a6165..745b52ca82c9e0b1bde15254a74c24a36ad2e970 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 63096466e9a2d7c7d4a6956714b7c58f35e16684..e8e7389866a9c5a42ab09bb39fdb1ab37e9139f5 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 fb9d17a612b5786d42dd0f23bef769fbc76bef80..d86df4e7336eb349d60e5eb73769ee77e4d8af7d 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 328194cb83bfe2eb22533067957a555209626e79..0000000000000000000000000000000000000000 --- 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 0000000000000000000000000000000000000000..0a28e8bfe665366da59287ea05ee4706e1bbf001 --- /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;