michelson / dante2

A complete rewrite of dante editor in draft-js
https://michelson.github.io/dante2/
Other
912 stars 121 forks source link

Trying to configure tooltips is not very clear #215

Open juniorbatistadev opened 4 years ago

juniorbatistadev commented 4 years ago

The documentation show I can do this: < Dante content ={null} tooltips ={[DanteInlineTooltipConfig()]}

But It's doesn't clarify where to import DanteInlineToolTipConfig from.

I assumed I should export it from like this import { DanteInlineTooltipConfig } from "Dante2/package/es/components/popovers/addButton.js

This is my React Component:

import React from "react";
import FlexColumn from "../../components/common/FlexColumn";
import Title from "../../components/common/Title";
import Dante from "Dante2";
import { DanteInlineTooltipConfig } from "Dante2/package/es/components/popovers/addButton.js";
import styles from "./index.module.css";

function PostPage() {
  return (
    <FlexColumn margin="10px">
      <Title text="Crear Post" />
      <Dante
        tooltips={[DanteInlineTooltipConfig({ widget_options: { aa: "oo" } })]}
      />
    </FlexColumn>
  );
}

export default PostPage;

`

And this is the error I'm getting:

`TypeError: this.props.item.icon is not a function
InlineTooltipItem.render
  356 |     style: {
  357 |       fontSize: '21px'
  358 |     }
 359 |   }, React.createElement("span", {
      | ^  360 |     className: 'tooltip-icon'
  361 |   }, this.props.item.icon()));
  362 | }`
michelson commented 4 years ago

please tell us which version of dante are you using and check the tooltips.mdx file for documentation