RFC: New package @remirror/extension-image
See original GitHub issueDetailed 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
orurl
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:
- Created 4 years ago
- Reactions:2
- Comments:7 (3 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Okay, I’m now visiting this.
The API feels stable enough to begin working on a general case
@remirror/extension-image
package.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 👍