the-grid / ed Goto Github PK
View Code? Open in Web Editor NEWText editing with media widgets
Home Page: https://the-grid.github.io/ed/#fixture
Text editing with media widgets
Home Page: https://the-grid.github.io/ed/#fixture
Using ed 0.0.35 and this flow:
setContent
(placeholder is displayed correctly)PUT /item/<id>
to save placeholder block to APIPOST /share
into the placeholder blocksetContent
This is the item (I do ed.setContent(item.content)
): https://gist.github.com/hannesstruss/819ab983c52cca26251c
This is the error (the index in Failed to resolve path %d
is the index of the block about to be replaced +1, when counting 0-based):
Not sure how related they are and can't reproduce, but I also encountered these errors (might have happened during just editing):
(Sorry for screenshots, but I can't seem to copy/paste stacktraces from Chrome devtools)
Currently makes a new uuid.
Need some minimal check so widgets can only update their own block.
Currently, when sharing URLs, Ed creates the placeholder. For sharing images, there is ed.insertBlocks(index, blocks)
, which requires the app to create the placeholders itself.
I think for consistency it should only be one component's responsibility to actually construct placeholder blocks. Currently, the knowledge about placeholder construction, the placeholder block's internal structure (metadata.status
etc.) is spread across app and Ed. Since Ed has to interpret placeholder blocks anyway, it should be the single source of construction as well. I'd encapsulate that behind a more narrowly scoped API like (a less verbose version of) ed.createPlaceholdersForImages(originalPlaceholderBlockId, numberOfPlaceholders)
which could return an array of placeholder block IDs to share into.
Let's discuss that in the meeting suggested in #editor!
cc @nickvelloff
Need clarification from API (@bergie) about a consistent way to save that for all types that can have a cover.
I started AttributionEditor with it, but I am not terribly attached to xml.
using pros:
export default React.createFactory(X)
to use X without jsxcons:
1 code style / linting setup to keep in mind
const props = { /* js stuff here */ }
then <div {...props} ></div>
... could just be el('div', props)
hint for simple sys: https://github.com/ProseMirror/prosemirror/blob/35e5d866e8f4d5228dfba6b29d3460d6e9b85441/src/dom/index.js#L69-L84
Discussion welcome... could do all js styles...
Verified on PM demo.
Filed upstream ProseMirror/prosemirror#224
Cut and del work on the divs if selected around, but paste and undo don't restore them. Once that is fixed widget should restore itself.
Given the following scenario:
PUT
s item without placeholdered.setContent
API might append the share block to the end of the content array if it doesn't find the placeholder. But Ed would just ignore that block, as the merging strategy only replaces placeholders.
As long as the App does a final PUT
without placeholder or shared block, things are okay though.
Right now the popover toolbar clashes with the native selection bars on mobile platforms. It would be better to use a position: fixed
toolbar on the bottom of the screen for those.
file
event for grid-chromedetails
event to trigger modalUncaught TypeError: Cannot read property 'value' of undefined
Uncaught TypeError: Cannot read property 'node' of undefined
Uncaught Error: Position 4:1 is not valid in current document
Something gets thrown off π if typing while setContent is hit (like new share progress in demo).
I like that you can tap in the blank space now to create a new block!
There's a slight inconvenience on Android though. When long pressing on an empty block that is not the last empty block, the in-place context menu for pasting doesn't pop up. Instead, an action mode overlay shows from which people can paste.
Definitely an Android bug, but we might be able to work around that by not leaving empty blocks at the end of the content array. What do you think?
Here's a path that could work without API changes.
/gif
on a new line in the editorgrid-type="placeholder" grid-widget="gif"
(this placeholder
block could get saved to API without making anybody π’)image
(or video
) that API can then do normal Caliper stuff withgrid-type="code"
, widget sys will do restwith tooltip to trigger meta modal, to make it work as it does now
Related PM discussion: https://discuss.prosemirror.net/t/prosemirror-ready-for-widgets-islands-of-non-editable-content/12/8?u=forresto
Should work as it does now if not specified.
p
s before, between, and after media.We need a way to handle failures when sharing. Currently, sharing works like this:
{blockId, url}
(in case of URL sharing)
ed.setContent
ed.getContent()
, PUT /item/<id>
and POST /share
GET /item/<id>
, then ed.setContent(blocks)
Possible fail cases (ignoring programmer errors):
PUT /item/<id>
failsPOST /share
fails
POST /share
calls succeedPOST /share
succeeds, but the app isn't notified, or the share job takes a long time api-sideGET /item/<id>
failsQuestions:
ed.shareFailed(placeholderBlockId)
.n
images, so we don't have to remove them again.The sets overlap: https://github.com/the-grid/ed/blob/master/src/menu/ed-menu.js
Maybe PM shouldn't concat those?
"window.ed.setContent(\(contentString));
the new item dataSteps to reproduce:
onShareUrl
callback is called (we don't do anything with it for now)onShareUrl
is called againGOTO 4
I'm not sure this is a real-world-problem. But what if I want a block that just contains a plain-text url without sharing it?
We have easily spec-able code in there that's important to not break. Good place to start.
Console output:
Uncaught IndexSizeError: Failed to execute 'setEnd' on 'Range': The offset 23 is larger than or equal to the node's length (22).
23
changes depending on where the caret is while typing
Needed for gh-pages preview and packaged versions for Grid apps to consume. Hopefully easy with a dash of webpack magic.
They work now
https://discuss.prosemirror.net/t/the-grid-ed-overlay-widgets/150/4?u=forresto
Can we construct the editor object with a configuration?
3 come to mind:
When user adds a paragraph that only contains a URL, we should make a /share
API call on that.
Same as #2, the placeholder blocks that we have when user shares an image or link should not have their contents editable.
Updating to today's PM gives
Uncaught TypeError: (0 , _prosemirrorSrcMenuMenu.commandGroups) is not a function
so @d4tocchini will need to rehack that for us to update PM.
& keep deploying the demo to gh-pages
potential to reduce thrash http://prosemirror.net/ref.html#UpdateScheduler
π
We need to build "the fold" into Ed.
hr
equivalent visually denotes fold]Ed should have initial option and method to toggle collapsed
(only show above the fold) state.
Initial content should infer fold from starred blocks.
ed.getContent
should build content array with blocks "above the fold" starred.
This makes Ed not-insignificantly more complex, but has advantage of working with current API.
Good thing PM has versions now. Using that in widget plugin.
ProseMirror/prosemirror@578a030
BREAKING CHANGE: The 'flushed' event is no longer fired.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. πππ
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google β€οΈ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.