Skip to content
Snippets Groups Projects
Commit 07fb1004 authored by chris's avatar chris
Browse files

cleanup hhmi

parent b51375a8
No related branches found
No related tags found
1 merge request!392Matching question
...@@ -29,16 +29,11 @@ import { ...@@ -29,16 +29,11 @@ import {
EssayToolGroupService, EssayToolGroupService,
MatchingService, MatchingService,
MatchingToolGroupService, MatchingToolGroupService,
EnterService,
} from 'wax-prosemirror-services'; } from 'wax-prosemirror-services';
import { DefaultSchema } from 'wax-prosemirror-utilities'; import { DefaultSchema } from 'wax-prosemirror-utilities';
import invisibles, { hardBreak } from '@guardian/prosemirror-invisibles'; import invisibles, { hardBreak } from '@guardian/prosemirror-invisibles';
const getContentOnEnter = source => {
console.log('editor content', source);
};
export default { export default {
MenuService: [ MenuService: [
{ {
...@@ -68,14 +63,12 @@ export default { ...@@ -68,14 +63,12 @@ export default {
}, },
], ],
EnterService: { getContentOnEnter },
SchemaService: DefaultSchema, SchemaService: DefaultSchema,
RulesService: [emDash, ellipsis], RulesService: [emDash, ellipsis],
PmPlugins: [columnResizing(), tableEditing(), invisibles([hardBreak()])], PmPlugins: [columnResizing(), tableEditing(), invisibles([hardBreak()])],
services: [ services: [
new EnterService(),
new MatchingService(), new MatchingService(),
new MatchingToolGroupService(), new MatchingToolGroupService(),
new FillTheGapQuestionService(), new FillTheGapQuestionService(),
......
import React, { useCallback, useState } from 'react'; import React, { useState } from 'react';
import { Wax } from 'wax-prosemirror-core'; import { Wax } from 'wax-prosemirror-core';
import styled from 'styled-components'; import styled from 'styled-components';
......
...@@ -51,15 +51,13 @@ export default props => { ...@@ -51,15 +51,13 @@ export default props => {
if (!isList) { if (!isList) {
const serialize = serializer(schema); const serialize = serializer(schema);
props.getContentOnEnter(serialize(content)); props.getContentOnEnter(serialize(content));
const parse = parser(schema);
const WaxOptions = { const WaxOptions = {
doc: {}, doc: parse(''),
schema, schema,
plugins, plugins,
}; };
const parse = parser(schema);
WaxOptions.doc = parse('');
view.updateState(EditorState.create(WaxOptions)); view.updateState(EditorState.create(WaxOptions));
if (view.dispatch) { if (view.dispatch) {
view.dispatch(view.state.tr.setMeta('addToHistory', false)); view.dispatch(view.state.tr.setMeta('addToHistory', false));
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment