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

add create tool and service

parent e6214ff5
No related branches found
No related tags found
1 merge request!330Gap question
Showing
with 82 additions and 13 deletions
import { injectable } from 'inversify';
import { Tools } from 'wax-prosemirror-services';
@injectable()
class CreateGap extends Tools {
title = 'Create Gap Option';
label = 'Create Gap';
name = 'Create Gap';
get run() {
return (state, dispatch) => {};
}
get active() {
return state => {};
}
select = (state, activeViewId) => {};
get enable() {
return state => {};
}
}
export default CreateGap;
import { Service } from 'wax-prosemirror-services';
import CreateGap from './CreateGap';
class FillTheGapQuestionService extends Service {
register() {
this.container.bind('CreateGap').to(CreateGap);
}
}
export default FillTheGapQuestionService;
import { injectable } from 'inversify'; import { injectable } from 'inversify';
import { wrapIn } from 'prosemirror-commands'; import { wrapIn } from 'prosemirror-commands';
import { Tools } from 'wax-prosemirror-services'; import { Tools } from 'wax-prosemirror-services';
@injectable() @injectable()
class FillTheGapQuestion extends Tools { class FillTheGapQuestion extends Tools {
title = 'Add Fill The Gap Question'; title = 'Add Fill The Gap Question';
......
...@@ -2,6 +2,7 @@ import { Service } from 'wax-prosemirror-services'; ...@@ -2,6 +2,7 @@ import { Service } from 'wax-prosemirror-services';
import FillTheGapQuestion from './FillTheGapQuestion'; import FillTheGapQuestion from './FillTheGapQuestion';
import fillTheGapContainerNode from './schema/fillTheGapContainerNode'; import fillTheGapContainerNode from './schema/fillTheGapContainerNode';
import fillTheGapNode from './schema/fillTheGapNode'; import fillTheGapNode from './schema/fillTheGapNode';
import CreateGapService from './CreateGapService/CreateGapService';
class FillTheGapQuestionService extends Service { class FillTheGapQuestionService extends Service {
register() { register() {
...@@ -13,6 +14,7 @@ class FillTheGapQuestionService extends Service { ...@@ -13,6 +14,7 @@ class FillTheGapQuestionService extends Service {
fill_the_gap_container: fillTheGapContainerNode, fill_the_gap_container: fillTheGapContainerNode,
}); });
} }
dependencies = [new CreateGapService()];
} }
export default FillTheGapQuestionService; export default FillTheGapQuestionService;
...@@ -4,9 +4,12 @@ import { ToolGroup } from 'wax-prosemirror-services'; ...@@ -4,9 +4,12 @@ import { ToolGroup } from 'wax-prosemirror-services';
@injectable() @injectable()
class FillTheGap extends ToolGroup { class FillTheGap extends ToolGroup {
tools = []; tools = [];
constructor(@inject('FillTheGapQuestion') FillTheGapQuestion) { constructor(
@inject('FillTheGapQuestion') FillTheGapQuestion,
@inject('CreateGap') CreateGap,
) {
super(); super();
this.tools = [FillTheGapQuestion]; this.tools = [FillTheGapQuestion, CreateGap];
} }
} }
......
...@@ -345,4 +345,33 @@ export default css` ...@@ -345,4 +345,33 @@ export default css`
padding: 5px 5px 0 5px; padding: 5px 5px 0 5px;
} }
} }
/* -- Fill The Gap ---------------------------------- */
.fill-the-gap {
border: 3px solid #f5f5f7;
margin-bottom: 30px;
margin-top: 30px;
padding: 3px;
&:before {
background-color: #fff;
bottom: 22px;
color: #535e76;
content: 'Fill The Gap';
height: 10px;
left: -1px;
position: relative;
width: 30px;
}
p {
bottom: 22px;
position: relative;
}
p:last-child {
margin-bottom: -1em;
}
}
`; `;
import Service from "../Service"; import Service from '../Service';
import BaseServices from "./index"; import BaseServices from './index';
class BaseService extends Service { class BaseService extends Service {
dependencies = BaseServices; dependencies = BaseServices;
......
import Service from "../Service"; import Service from '../Service';
import InlineServices from "./index"; import InlineServices from './index';
class InlineAnnotationsService extends Service { class InlineAnnotationsService extends Service {
dependencies = InlineServices; dependencies = InlineServices;
......
import Service from "../Service"; import Service from '../Service';
import ListsServices from "./index"; import ListsServices from './index';
class ListsService extends Service { class ListsService extends Service {
dependencies = ListsServices; dependencies = ListsServices;
......
import Service from "../Service"; import Service from '../Service';
import TablesServices from "./index"; import TablesServices from './index';
class TablesService extends Service { class TablesService extends Service {
dependencies = TablesServices; dependencies = TablesServices;
......
import Service from "../Service"; import Service from '../Service';
import TextServices from "./index"; import TextServices from './index';
class TextBlockLevelService extends Service { class TextBlockLevelService extends Service {
dependencies = TextServices; dependencies = TextServices;
......
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