Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make link placeholder change possible #1107

Open
subarroca opened this issue Nov 11, 2016 · 9 comments
Open

Make link placeholder change possible #1107

subarroca opened this issue Nov 11, 2016 · 9 comments

Comments

@subarroca
Copy link

Make link placeholder change possible

Expected behavior:
Being able to set a different placeholder for links

Actual behavior:
quilljs.com is shown

Version:
1.1.3

@benbro
Copy link
Contributor

benbro commented Nov 11, 2016

The link placeholder is hard coded here.

Temp workaround:

var quill = new Quill('#editor-container', {
  modules: {
    toolbar: [
      [{ header: [1, 2, false] }],
      ['bold', 'italic', 'underline'],
      ['image', 'code-block', 'link']
    ]
  },
  placeholder: 'Compose an epic...',
  theme: 'snow'  // or 'bubble'
});
// change the link placeholder to www.github.com
var tooltip = quill.theme.tooltip;
var input = tooltip.root.querySelector("input[data-link]");
input.dataset.link = 'www.github.com';

@diiq
Copy link

diiq commented Dec 17, 2016

The ability to change it would be amazing -- and even then, the default should have a 'http://' in front, please! Right now it is a incorrect example, and users that follow it will make broken links.

@alexkrolick
Copy link
Contributor

Is defaulting to relative links considered a feature or a bug here? I have a lot of people complaining about this in our app and I'm wondering if we should patch locally or upstream.

jhchen added a commit that referenced this issue Apr 17, 2017
@jhchen
Copy link
Member

jhchen commented Apr 18, 2017

This particular issue is about the default placeholder text, which the ability to customize is more a feature than a bug. I did just make a change to add https:// in front of the placeholder text as well.

Interpreting what the user enters as a link or not, relative or absolute is already customizable: #550.

@bobbyflowstate
Copy link

Has this been added? I can't seem to find a way to customize the link placeholder..

@andys8
Copy link

andys8 commented Aug 30, 2021

Would it be an option to make the default value an empty text or https://example.com (a domain created for this purpose)?

@Webbrother
Copy link

Webbrother commented Sep 24, 2021

This is absolutely weird and ridiculous to add https://quilljs.com as a placeholder for users who are not developers and never knew about it.

@alex-sourceandsummit
Copy link

@benbro's workaround didn't quite work for me (using react-quill), so here is an alternative workaround using Quill's extension API, for anyone still looking:

const SnowTheme = Quill.import('themes/snow');

class SnowThemeFix extends SnowTheme {
  extendToolbar(toolbar) {
    super.extendToolbar(toolbar);
    this.tooltip.textbox.dataset.link = ""; // you can set the placeholder to whatever you want here
  }
}

Quill.register('themes/snow', SnowThemeFix, true);

@newdisease
Copy link

newdisease commented Dec 29, 2024

I updated the placeholders in react-quill using ref. It's not an ideal solution, but it works for me. It also has a benefit as it isn't globally overridden as in the example above.

Something like this:

  ...
  const quillRef = useRef<ReactQuill>(null);
  const quillInstance = quillRef.current?.getEditor();
  const tooltip = quillInstance.theme?.tooltip;
  tooltip.textbox.setAttribute("data-link", "https://...");
  ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

10 participants