diff --git a/wax-prosemirror-services/src/OverlayService/OverlayComponent.js b/wax-prosemirror-services/src/OverlayService/OverlayComponent.js index a02f83a926163e4fc851600baf0b17993257ef92..65c06d28c224426d0b0895426cca46f6ef800563 100644 --- a/wax-prosemirror-services/src/OverlayService/OverlayComponent.js +++ b/wax-prosemirror-services/src/OverlayService/OverlayComponent.js @@ -1,8 +1,15 @@ import React from "react"; +import { markActive } from "../lib/Utils"; + +export default Component => ({ view }) => { + if (!view) return null; + + if (!markActive(view.state.schema.marks.link)(view.state)) { + return null; + } -export default Component => () => { return ( - <div style={{ width: "100px", height: "100px" }}> + <div style={{ position: "relative", width: "100px", height: "100px" }}> Overlay Area <Component /> </div> diff --git a/wax-prosemirror-services/src/OverlayService/OverlayService.js b/wax-prosemirror-services/src/OverlayService/OverlayService.js index 5a38abf2b244970a9d44b13faba1ba5f6f0dd6b6..4a4752a7a6df51f7ea37acd6d4392266129d39b7 100644 --- a/wax-prosemirror-services/src/OverlayService/OverlayService.js +++ b/wax-prosemirror-services/src/OverlayService/OverlayService.js @@ -1,8 +1,6 @@ import Service from "wax-prosemirror-core/src/services/Service"; -import OverlayPlugin from "./pmPlugins/OverlayPlugin"; -import OverlayComponent from "./OverlayComponent"; -const PLUGIN_KEY = "overlay"; +import OverlayComponent from "./OverlayComponent"; export default class OverlayService extends Service { boot() {} @@ -11,7 +9,6 @@ export default class OverlayService extends Service { this.container.bind("CreateOverlay").toFactory(context => { return Component => { const layout = context.container.get("Layout"); - debugger; layout.addComponent("waxOverlays", OverlayComponent(Component)); }; });