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

Impossible to disable server search #8

Open
4rtamis opened this issue Jul 27, 2022 · 2 comments · Fixed by nickolasjadams/link-autocomplete#1 · May be fixed by #9
Open

Impossible to disable server search #8

4rtamis opened this issue Jul 27, 2022 · 2 comments · Fixed by nickolasjadams/link-autocomplete#1 · May be fixed by #9

Comments

@4rtamis
Copy link

4rtamis commented Jul 27, 2022

Hi, thanks a lot for this tool !
While trying to customize the link-autocomplete tool, I wanted to use it without server endpoint.
It appears that, when you do not provide an endpoint in the config, the tool still considers that there is actually an endpoint.

I looked at the code carefully and there is a very simple fix:
in the file src/index.js, the method isServerEnabled() lacks the operator get.

This is why this kind of expression this.isServerEnabled ? DICTIONARY.pasteOrSearch : DICTIONARY.pasteALink always picks DICTIONARY.pasteOrSearch.

I hope this can be useful.
Cheers !

nickolasjadams added a commit to nickolasjadams/link-autocomplete that referenced this issue Sep 4, 2022
Url checking

I noticed that when you don't add a protocol to a url like this
www.hello.world
the url added to the editor attempts to reference a file
file:///path/to/project/www.hello.world

So I took a look at how to require http or https and noticed
Utils.isUrl() is not working properly in another way
due to the regex.

This is passing the regex
www.0.♪┏(・o・)┛♪

This is failing
http://wwwuzzzuppp.com

I've updated the regex to fix the regex issue and require the protocol.
Adding links should be done through the api or absolute urls.

---

closes editor-js#8
Impossible to disable server search Issue editor-js#8
editor-js#8

isServerEnabled method calls lacked parenthesis in index.js. It's
now possible to disable the server calls by removing the endpoint
in the config.

---

closes editor-js#6
Support mailto: URL schema editor-js#6
editor-js#6

I've found myself wishing to to add different tyes of hrefs and
noticed this issue.

I've added 3 URI schemes to check against in Utils.isUrl()

view-source:
mailto:
tel:

It now checks for a URI Scheme and then applies an appropriate
regex to test the remaining url.

The email regex uses control characters so disabled no-control-regex in .eslintrc

---

Url fragments not recongnized as urls.

Utils.isUrl() now also checks if your string starts with "#"

so you can do this `<a href="#lower_in_the_document">`

Which will work great with this plugin.
https://github.com/Aleksst95/header-with-anchor

---

Can't open links in a new tab.

A checkbox has been added to provide the user an option to open the url in a new tab.
You can tab and shift-tab back and forth between the 2 inputs when adding urls.
Clicking the datawrapper will let you know if the link opens in a new tab or the same tab.

---

Finally, I've fixed a couple warnings that were shown when running the linter.
@neSpecc
Copy link
Contributor

neSpecc commented Sep 6, 2023

We have two link tools: without server search (included in a core) and with it. You've decided to use the second one, but do not want a server search. So please, describe your intentions.

@Sozialarchiv
Copy link

@4rtamis Do you want to use the autocomplete with a local function? Like it is described here: #13

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