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

feat(images): image toolgroup service

parent 845cc420
No related branches found
No related tags found
1 merge request!45Develop
......@@ -10,7 +10,7 @@ export default {
MenuService: [
{
templateArea: "topBar",
toolGroups: ["Base", "Annotations", "Lists", "Tables"]
toolGroups: ["Base", "Annotations", "Lists", "Images", "Tables"]
},
{
templateArea: "leftSideBar",
......
......@@ -16,7 +16,8 @@ import {
TablesService,
TableToolGroupService,
BaseService,
BaseToolGroupService
BaseToolGroupService,
ImageToolGroupService
} from "wax-prosemirror-services";
export default {
......@@ -37,6 +38,7 @@ export default {
new TableToolGroupService(),
new TablesService(),
new BaseService(),
new BaseToolGroupService()
new BaseToolGroupService(),
new ImageToolGroupService()
]
};
......@@ -40,6 +40,10 @@ export {
export {
default as ListToolGroupService
} from "./src/WaxToolGroups/ListToolGroupService/ListToolGroupService";
export {
default as ImageToolGroupService
} from "./src/WaxToolGroups/ImageToolGroupService/ImageToolGroupService";
export {
default as TableToolGroupService
} from "./src/WaxToolGroups/TableToolGroupService/TableToolGroupService";
......@@ -14,8 +14,7 @@ class Annotations extends ToolGroup {
@inject("Subscript") subscript,
@inject("Superscript") superscript,
@inject("Underline") underline,
@inject("Blockquote") blockquote,
@inject("Image") image
@inject("Blockquote") blockquote
) {
super();
this.tools = [
......@@ -28,8 +27,7 @@ class Annotations extends ToolGroup {
subscript,
superscript,
underline,
blockquote,
image
blockquote
];
}
......
import Image from "./Image";
import Images from "./Images";
import Service from "wax-prosemirror-core/src/services/Service";
class ImageToolGroupService extends Service {
name = "ImageToolGroupService";
register() {
this.container.bind("Image").to(Image);
this.container.bind("Images").to(Images);
}
}
......
import { injectable, inject } from "inversify";
import ToolGroup from "../../lib/ToolGroup";
@injectable()
class Images extends ToolGroup {
tools = [];
constructor(@inject("Image") image) {
super();
this.tools = [image];
}
renderTools(view) {
const tools = [];
this.tools.forEach(tool => {
tools.push(tool.renderTool(view));
});
return tools;
}
}
export default Images;
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