michelson / dante2

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

Added custom inline block on Tooltip #225

Open indigofa opened 4 years ago

indigofa commented 4 years ago

Hi there,

I have added successfuly custom inline block on Tooltip and the HTML is rendered correctly on when I use convertToHTML

                            styleToHTML: style => {
                              if (style === "STRIKE") {
                                return (
                                  <span
                                    style={{ textDecoration: "line-through" }}
                                  />
                                )
                              }

But when I click the editor itself is not showing the text with line-through, but it is correct on convertToHTML this is from <p><span style="text-decoration:line-through">asd</span></p>, can someone guide me what I'm missing, How can I make the editor to render that text line-through

This is tooltip config

tooltips={[
                          DanteTooltipConfig({
                            widget_options: {
                              block_types: [
                                {
                                  label: "h1",
                                  style: "header-one",
                                  type: "block",
                                  icon: Icons.h1,
                                },
                                {
                                  label: "strike",
                                  style: "STRIKE",
                                  type: "inline",
                                  icon: Icons.italic,
                                },
                              ],
                            },
                          }),
                        ]}

Thanks

indigofa commented 4 years ago

@michelson I just readed this from the docs but is not clear, can you tell me where is BOLD or ITALIC component defined so I can take a look and make the same with text-align: line-through

Tooltips are another kind of components that will be not rendered in your editor content but will interact with it, and will be rendered over it, like the tooltips you see when you hover links, or select words to toggle BOLD or ITALIC. The tooltips option is an array.

indigofa commented 4 years ago

Anyone from contributors can help with clarification, I'm lost here

ghost commented 4 years ago

@indigofa I am trying to accomplish the same. Pls let me know if you were able to figure it out.