GithubHelp home page GithubHelp logo

link's People

Contributors

dependabot[bot] avatar gohabereg avatar goldenjaden avatar khaydarov avatar konstantinkudelko avatar nespecc avatar polinashneider avatar ranemihir avatar robonetphy avatar talyguryn avatar tatianafomina avatar y-hiraoka avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

link's Issues

Output format: Which properties (if any) can be null omitted?

For a valid link block, can any of the link or meta properties under any circumstances (now or in the future) be null or omitted? For the meta object, I assume any of its elements can be omitted, but for the meta.image object, will url always be present and non-null? Are any of the aforementioned properties guaranteed to always be present and non-null for this block to be valid?

Context: I'm a back-end .NET developer needing to parse Editor.js documents. The readme lists all of the aforementioned properties but does not explicitly guarantee that they will always be present and non-null. Back-end deserialization/parsing in strongly typed languages would be easier with some guarantees about which properties can and can not be null/omitted. (Ideally, any such guarantees should be added to the readme to ensure they are formalized and kept in the future.)

Update link from backend response (when redirects)

For example I entered url http://kripipasta.com/story/9630
It redirects to https://kripipasta.com/story/9630-276-j-kilometr.html

So I want to add url to meta data:

{
    "success": 1,
    "meta": {
        "url": "https://kripipasta.com/story/9630-276-j-kilometr.html",
        "title": "276-й километр",
        "description": "Получилось длинно.\r\nЯ работаю на железной дороге, занимаю должность помощника машиниста тепловоза.",
        "image": {
            "url": "https://kripipasta.com/images/gif/42.gif"
        }
    }
}

And I expect the link to be updated.

I want to send url to my backend and get the response just like image tool

const tool = {
image: {
class: Image,
shortcut: 'CMD+I',
config: {
uploader: {
async uploadByFile(file) {
// console.log(file);
const fileData = await FiletoBase64(file);
// console.log(fileData);
const res = await uploadImage({ image: fileData });
if (res.success === 1) {
return res;
}
},
inlineToolbar: true,
},
},
linkTool: {
class: LinkTool,
inlineToolbar: true,

  config: {
   async endpoint(url): await axios.get(`/getMeta/${url_will_be_here_just like_image}`)
  },
},

},
}; ilke this or something

Is there any way to set headers in config?

I am trying something in this way to configure tools.

tools: {
...
linkTool: {
   class: LinkTool,
   config: {
        endpoint: 'http://localhost:8008/fetchUrl',
        headers: {
            common: {
                'X-Org': 1,
              },
         },
    },
}

Migrate to TypeScript

Problem

This tool was built in JavaScript to be a simplest example of Editor.js Tools API usage. Right now further enhancements requires more modern stack.

Task

We need to migrate this project to TypeScript and provide type declarations. Make sure types for the plugin are available when using it in TypeScript project with Editor.js

Can't delete a link block

2021-04-10 22 46 43 editorjs io 688a4e1f03e0

Tested on editorjs.io and my own installatin, some block doesn't have the delete button.

I am digging to discover if it's come from block extension or core.

I have the same behaviour for :

  • raw html
  • code
  • ...

Doesn't Wait To The Response (Quick Timeout!)

I've created a backend API that receives a URL and uses the "url-metadata" tool to get the meat-data from the URL and send it back to your tool.

The thing is when I return a dummy static data from the backend which returns fast. your tool works fine and displays the data normally. check the Image

And you can check my backend response The Static One using this image

However, when I use the tool in the backend it will return the exact same data but it will be late a little bit. (and that convenience, It's an HTTP request after all). your tool gives me "Can not get this link data, try another"

Here is the image for the response data when am using the backend tool - when you give an error
And here is the image for the data when I return a quick static response from the backed - when your tool works fine

Clearly the responses are 100% the same. the time of getting a response is the only difference. So is there any way to change the timeout from your side, because I can't control the response time from the backend nor the internet speed.

Thank you In advance

Couldn't embed url

When I fetch the url editorjs couldn't embed the url

Version: Editor.js 2.18.0

Captura de Pantalla 2020-06-08 a la(s) 9 27 36 p  m

{
"success":1,
"meta":{
 "title":"Editor.js",
 "description":"A block-styled editor with clean JSON output",
 "image":{"url":""}}
}

Selecct from Multiple Layouts

Great software, thank you so much. Just what i need. Better yet, looks like I can change what I need.
When entering a link, I would love a choice of layouts. Maybe a big image above, maybe a caption underneath. Maybe image on the left. A drop down menu to select which layout I want to use.

I will be reading the code more closely in the future. Maybe you even have a collection of layouts I can select from in the config file.

And then the read-only version could display that layout. Maybe eventually the html generators would understand it as well. Unil then, I will be trying to grab the html from the read-only version. Wish me luck.

Error if opengraph image is not existing

If you paste url that don't contains preview image. php backend of editorjs can't validate whole URL block, because url field is empty, but string is required.

add a link URL in the image

add-Media

Image-based media

Will neSpecc be able to add a link URL in the image?

This is helpful.

thank you.

Why not implement validate function ?

Blocks will be generated even if no link is entered:

{
  "type": "linkTool",
  "data": { "link": "", "meta": {} }
}

I think that blocks with no link must not exist.

[Bug] Couldn't parse response due to external API changes

Hi,

The @codexteam/ajax library have changed the way data is returned in ajax.get() method. This is breaking the main functionality of the link pluging. This commit made the change.

Here is the code:

link/src/index.js

Lines 363 to 386 in f076c97

/**
* Link data fetching callback
* @param {UploadResponseFormat} response
*/
onFetch(response) {
if (!response || !response.success) {
this.fetchingFailed(this.api.i18n.t('Couldn\'t get this link data, try the other one'));
return;
}
const metaData = response.meta;
this.data = { meta: metaData };
if (!metaData) {
this.fetchingFailed(this.api.i18n.t('Wrong response format from the server'));
return;
}
this.hideProgress().then(() => {
this.nodes.inputHolder.remove();
this.showLinkPreview(metaData);
});
}

Best.

Is there any reason not to include data fetching logic?

I think that extracting meta data from url could be implemented in this extension.
But according to the guide, users should implement that logic in their own server.
I am just curious that there is some reason like security or something.

Link Tool is showing error

I'm using Next JS 14, but even after using dynamic importing Link Tool is showing this error. All other tools are working fine.

⨯ node_modules\@editorjs\link\dist\link.mjs (289:5) @ window ⨯ ReferenceError: window is not defined

Can you explain request made to the Backend?

How does it makes request to the Backend

Like Example:
https://api.example.com/link?q=https%3A%2F%2Fdomain.com%2Fblog%2Farticle-title
If yes then what is the query param name


OR
https://api.example.com/link/https%3A%2F%2Fdomain.com%2Fblog%2Farticle-title

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.