quill icon indicating copy to clipboard operation
quill copied to clipboard

Allow link editing in Bubble theme

Open eamodio opened this issue 7 years ago • 16 comments

Currently you can't edit a link in the Bubble theme -- the tooltip appears clickable (shows pointer cursor -- not sure why exactly as I don't see in the the CSS). So currently with Bubble you can't edit a link at all -- since if you reselect the link text and click the link button it will just remove the link.

Steps for Reproduction

  1. Using the Bubble theme, add text, select it, turn it into a link
  2. Click on the newly linkified text

Expected behavior: Tooltip with link url shows, but is editable

Actual behavior: Tooltip with link url shows

Platforms: Chrome 57

Version: 1.2.2

eamodio avatar Mar 28 '17 17:03 eamodio

@jhchen although the edit feature will be cool. Users would expect clicking the tooltip would open the link in a new window with the pointer displaying. Currently, it doesn't. Is this a bug or simply a display tooltip? I tried clicking all over the tooltip. Snow theme works as expected.

bribar avatar Jun 07 '17 18:06 bribar

This is simply a display tooltip at the moment.

jhchen avatar Jun 08 '17 07:06 jhchen

@jhchen I would love to take this up, what should be the behavior of the tooltip should it be just clickable or should it have edit options as well? Any pointers from your end?

saralnigam avatar Aug 06 '17 19:08 saralnigam

Behavior-wise it should work like Medium's.

jhchen avatar Aug 07 '17 08:08 jhchen

Any update on this?

For behaviour I would expect clicking the actual link going to the link destination. The on-hover tooltip could have an edit link if needed, most important thing is that links actually work.

mfjordvald avatar Nov 07 '17 08:11 mfjordvald

Reiterating @mfjordvald's sentiment, any updates on this feature?

annezhou920 avatar Dec 14 '17 21:12 annezhou920

Yes, please !!! <3

fxmontigny avatar May 17 '18 14:05 fxmontigny

@mfjordvald @eamodio @annezhou920 made it work with custom solution, no theme updates required, check the gif below. I can share my solution if anyone is interested ezgif com-crop 1

ghost avatar Nov 10 '18 17:11 ghost

@DenisBun can you please share your solution? I am interested in. Thanks in advance

dnp1204 avatar Nov 20 '18 18:11 dnp1204

@dnp1204 it requires some event manipulations, u may check my repo https://github.com/DenisBun/react-text-editor (src/Editor.js)

ghost avatar Nov 23 '18 16:11 ghost

@jhchen Is there any update on this feature? When can we expect this to be coming?

Anyone has any update on this feature?

anumysore5 avatar Jun 04 '19 20:06 anumysore5

I ended up creating this link module extension to allow link editing.

Default Quill behavior: Clicking the link icon while linked text is selected will simply remove the link. New behavior: Clicking the link icon while linked text is selected will behave more like a link editor. To remove the link, just delete the url text and hit enter.

  const toolbar = quill.getModule('toolbar');
  toolbar.addHandler('link', formatTextToLink => {
    if (formatTextToLink) {
      quill.theme.tooltip.edit();
    } else {
      quill.theme.tooltip.edit('link', quill.getFormat().link);
    }
  });

cmditch avatar Dec 13 '19 19:12 cmditch

I actually just used the snow theme, and absolute positioned the toolbar, hid it, then positioned the toolbar and made it display when selection change. Pulled logic inspiration from the bubble source code.

This way i got the minimalism of the bubble theme, with the link friendliness of the snow theme. Yay.

So this is the snow theme with the customizations: image image

alexparker avatar May 09 '21 21:05 alexparker

I actually just used the snow theme, and absolute positioned the toolbar, hid it, then positioned the toolbar and made it display when selection change. Pulled logic inspiration from the bubble source code.

This way i got the minimalism of the bubble theme, with the link friendliness of the snow theme. Yay.

So this is the snow theme with the customizations: image image

Hi Can you share your code ?

imran-momin4041 avatar May 16 '21 10:05 imran-momin4041

Another method would be to add a simple onclick event to the main editor's container to intercept clicks on anchor elements:

onclick="if(event.target.tagName=='A'&&event.target.rel=='noopener noreferrer'){event.target.href=window.prompt('URL:', event.target.href)??event.target.href;}"

Example:

image

sjoerdvanderhoorn avatar Apr 24 '22 19:04 sjoerdvanderhoorn

@dnp1204 it requires some event manipulations, u may check my repo https://github.com/DenisBun/react-text-editor (src/Editor.js)

could you pinpoint the exact line of code

mohanraj31521 avatar Sep 22 '22 06:09 mohanraj31521

I was only able to hide the toolbar. globals.css: .ql-toolbar.ql-snow { position: absolute; display: none; }

But I could not write the appearance of the toolbar at the moment of selection. I think you need to understand this part of source code: https://github.com/quilljs/quill/blob/develop/packages/quill/src/themes/bubble.ts And it's still hard to me to understand it. I think I have to use snow theme. And, of course, I have to start learning TS.

sergomen avatar Dec 19 '23 19:12 sergomen