question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

RFC: New package @remirror/extension-image

See original GitHub issue

Detailed Description

This issue is to track discussion for an image extension. The extension should follow the given RemirrorExtension api (subject to change).

Borrowed configuration structure from https://github.com/pqina/filepond. Will possibly use filepond under the hood.

<RemirrorExtension<ImageExtensionOptions>
    Constructor={Image}
    Provider={() => ({process, revert, load, restore, fetch})} />

Possible Implementation

Constructor would handle the prosemirror schema logic.

Provider expects a configuration function on how to perform the network tasks necessary for the image to save the image and pass the resolved image object back to the extension to save in the document.

Image would save to the schema like:

{
    type: "image",
    attrs: {
        id: "testId", // can supply an id or a url.
        url: "https://provider.url/testId.png", 
        width: 300,
        height: 200,
        alt: "optional alt tag"
     }
}

Provider API (short version)

The provider configuration would seek to emulate (if not fork) https://pqina.nl/filepond/docs/patterns/api/server/#advanced

  • Process: Handles uploading an image to the server and passes the id or url to remirror to save in the document. Passes the resulting file object to the extension. Also passes optional parameters to the other lifecycle methods.
  • Revert: Custom revert methods receive the unique server file id and a load and error callback.
  • Load: Custom load methods receive the local file source, and the callback methods: load, error, abort, and headers.
  • Restore: Custom restore methods used to restore an image from the server back into the editor. Useful when storing drafts or editing saved documents.
  • Fetch: The custom fetch method receives the url to fetch and passes a file object to the extension

Edit: Jun-20-2019 - Added details on the lifecycle methods

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:2
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
ifiokjrcommented, Jul 28, 2019

Okay, I’m now visiting this.

The API feels stable enough to begin working on a general case @remirror/extension-image package.

1reaction
hennessyevancommented, Oct 29, 2019

Just as an update to this, I know it’s been a while but I’m currently working on this extension internally in an app and will publish as an extension when it’s done 👍

Read more comments on GitHub >

github_iconTop Results From Across the Web

RFC 3782: The NewReno Modification to TCP's Fast ...
RFC 3782 NewReno Modification to Fast Recovery Algorithm April 2004 4) Fast Recovery, continued: Transmit a segment, if allowed by the new value...
Read more >
CRAN - Package RFc
Package 'RFc' was removed from the CRAN repository. Formerly available versions can be obtained from the archive. Archived on 2018-01-04 as requested by...
Read more >
The remirror from remirror - GithubHelp
Open in Web Editor NEW 1.9K 18.0 187.0 66.43 MB ... The packages will be namespaced under @remirror/* ... RFC: New package @remirror/extension-image...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found