From 2dbf7465a175e6df5b3849e0bd8d6de71dea25d9 Mon Sep 17 00:00:00 2001
From: chris <kokosias@yahoo.gr>
Date: Sun, 6 Jun 2021 01:20:52 +0300
Subject: [PATCH] add custom btn

---
 .../MultipleChoiceQuestion.js                          | 10 ++++++++++
 .../components/ToolBarBtn.js                           |  2 +-
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/editors/demo/src/HHMI/MultipleChoiceQuestionService/MultipleChoiceQuestion.js b/editors/demo/src/HHMI/MultipleChoiceQuestionService/MultipleChoiceQuestion.js
index 2dcdbfec0..be76ca3d9 100644
--- a/editors/demo/src/HHMI/MultipleChoiceQuestionService/MultipleChoiceQuestion.js
+++ b/editors/demo/src/HHMI/MultipleChoiceQuestionService/MultipleChoiceQuestion.js
@@ -1,7 +1,10 @@
+import React from 'react';
+import { isEmpty } from 'lodash';
 import { injectable } from 'inversify';
 import { Tools } from 'wax-prosemirror-services';
 import { Fragment } from 'prosemirror-model';
 import { v4 as uuidv4 } from 'uuid';
+import ToolBarBtn from './components/ToolBarBtn';
 
 const createQuestion = (state, dispatch, tr) => {
   const { empty, $from, $to } = state.selection;
@@ -63,6 +66,13 @@ class MultipleChoiceQuestion extends Tools {
   get enable() {
     return state => {};
   }
+
+  renderTool(view) {
+    if (isEmpty(view)) return null;
+    return this._isDisplayed ? (
+      <ToolBarBtn key={uuidv4()} item={this.toJSON()} view={view} />
+    ) : null;
+  }
 }
 
 export default MultipleChoiceQuestion;
diff --git a/editors/demo/src/HHMI/MultipleChoiceQuestionService/components/ToolBarBtn.js b/editors/demo/src/HHMI/MultipleChoiceQuestionService/components/ToolBarBtn.js
index 9e21a5e6d..175b0b771 100644
--- a/editors/demo/src/HHMI/MultipleChoiceQuestionService/components/ToolBarBtn.js
+++ b/editors/demo/src/HHMI/MultipleChoiceQuestionService/components/ToolBarBtn.js
@@ -2,7 +2,7 @@
 import React, { useContext, useMemo } from 'react';
 import { WaxContext } from 'wax-prosemirror-core';
 import styled, { css } from 'styled-components';
-import MenuButton from 'wax-prosemirror-components';
+import { MenuButton } from 'wax-prosemirror-components';
 
 const activeStyles = css`
   pointer-events: none;
-- 
GitLab