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

hyperlink not changing #14

Open
vishal-kushwaha-itorix opened this issue Sep 3, 2021 · 6 comments
Open

hyperlink not changing #14

vishal-kushwaha-itorix opened this issue Sep 3, 2021 · 6 comments

Comments

@vishal-kushwaha-itorix
Copy link

hyper link not changing only rel and target updating
https://user-images.githubusercontent.com/85753351/131978528-e60b210f-a79a-4297-a86e-c5d5cfd2a8ba.mov

@Aerofusical
Copy link

Having the same issue and confirmed it is present in 1.0.5 and 1.0.6
@trinhtam are you able to address this?

@khanakia
Copy link

I have the same issue. Please fix it asap it's affecting our production

@mattmilburn
Copy link

Hi there 👋🏻 Also having the same issue. I'm testing through it today and will post any findings I have.

@mattmilburn
Copy link

@vishal-kushwaha-itorix @Aerofusical @khanakia I do have a fix if you're still interested in forking the repo in your own project.

@trinhtam This is a one-liner fix in case you are interested in having me submit a pull request 👍🏻

There is an insertLink method in src/Hyperlink.js. I modified one line of code in this method to set the href value based on the input value and the issue seems to fix the issue where the link URL will not update once the link is created.

insertLink(link, target='', rel='') {
  let anchorTag = this.selection.findParentTag('A');
  if (anchorTag) {
    this.selection.expandToTag(anchorTag);
  }else{
    document.execCommand(this.commandLink, false, link);
    anchorTag = this.selection.findParentTag('A');
  }
  if(anchorTag) {
+   anchorTag['href'] = link;
+
    if(!!target) {
    anchorTag['target'] = target;
    }else{
    anchorTag.removeAttribute('target');
    }
    if(!!rel) {
      anchorTag['rel'] = rel;
    }else{
      anchorTag.removeAttribute('rel');
    }
  }
}

@maykel-esser
Copy link

+1 please support this fix asap

@joancifo
Copy link

Based on @mattmilburn fix, I have uploaded to a repo with the bundle.js: https://github.com/joancifo/editorjs-hyperlink

You can install and use it until @trinhtam merges the PR:

npm i https://github.com/joancifo/editorjs-hyperlink.git

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

No branches or pull requests

6 participants