JiHong88 / suneditor

Pure javascript based WYSIWYG html editor, with no dependencies.
http://suneditor.com
MIT License
1.75k stars 312 forks source link

Working with an image link #1079

Open Rygat opened 2 years ago

Rygat commented 2 years ago

How can I programmatically work with an image link (add, edit, check etc.)? suneditor

JiHong88 commented 2 years ago

Can you give me an example?

Rygat commented 2 years ago

I want to work with the link when adding an image. For example:

suneditor.onImageUploadBefore = function (files, info, core, uploadHandler) {
if(files[0].link == null)
    {
        files[0].link.url = "http://bigimage"
    }
    ...
};
JiHong88 commented 2 years ago
suneditor.onImageUploadBefore = function (files, info, core, uploadHandler) {
  if(!info.anchor)
    info.anchor = core.util.createElement("A");
    info.anchor.src = "...";
  };
  return true;
}