-
Notifications
You must be signed in to change notification settings - Fork 245
attaching metadata to text blocks #366
Comments
So what we did at Refinery29 was model our editor after medium.com, we have text sections then also asset sections which shows a thumbnail and list details on the asset and what kind it is, it'll sit between your text sections. This is managed through an external asset editor. |
We've talked about it but we haven't done it yet. Would it be helpful to have an "official" place for the model data for the HTML? |
@rrees yes please! The Grid would appreciate any guidance. I have not quite figured out how to cleanly manage synchronization between our input (html+metadata) and Scribe's output html. |
@rrees Any pointers where to start hacking this in now, before there is an official place? |
We're discussing have a state that is controlled by the Scribe event emitter but thinking about a dirty hack that would work then create an Immutable Map during Scribe initialisation and a function that rewrites and reads the state and you should be able to hack something together than shouldn't be too painful to rewrite later. My view is that Scribe needs to expose a read-safe state object to the plugins to drive their behaviour and the real discussion is who gets to change that state object and how |
I'm ½ following you. I have an empty Scribe instance, and start to add blocks of html from my data structure. The only hook out of Scribe that I see is the It would help me if I could associate an id with each block added, that would get output with the A placeholder block (empty div with dimensions) would make it possible to overlay media outside of the Scribe el that could still be selected, cut, paste, etc. So, where should I look to hook in deeper than |
@rrees what do you think of the above request? Would there be any pitfalls to adding |
@forresto when we save our data the first time around they're assigned id's via the backend and it's loaded and re-saved that way. Any new blocks in an existing post have data id's assigned to them upon save. There are many different options to saving this data, really depends on what your goals are. If we're on the same page I can put a demo together, but would be a few weeks till I'd have time. |
@JeSuis that sounds similar to what I'm going to try. Will ask for help if I can't get it working in a few days. |
@forresto do you still need help on this? I can start messing around with some demos, or maybe people are interested in general. |
I patched something together with a hydrate / dehydrate functions that keep
the DOM in sync with the data model. It works, but feels a bit fragile.
Would like to see other takes.
|
Ok I'll try to throw something together by the end of this weekend. |
So here's the idea I was having if I was understanding you correctly. You'll have your p blocks with some kinda of data attached to them.
but with each being assigned its own unique id on save But with non text blocks, like a video
Then you use that asset id to pull in asset info I think it's going to be a bit too crazy to have the actual embed in the text flow and you're better off having the asset open in a modal. After all the text content loads on the page I insert a div after every p block that when hovered on, you can choose to insert your assets. Just like the medium editor. On save you'll have to strip those out and I put the content into json, but on the backend its processed to save each block individually. |
Any updates on this? I am trying to find a way to sign every p tag with a random digest, either adding id, or adding a data-attribute, but unfortunately can't get my head around it. |
It should be pretty simple to bind to the content-changed event and updated On 5 August 2015 at 12:46, Boris notifications@github.com wrote:
Visit theguardian.com. On your mobile and tablet, download the Guardian This e-mail and all attachments are confidential and may also be Guardian News & Media Limited is a member of Guardian Media Group plc. Registered |
@jesteracer you're trying to do it on creation of the dom elements while working in the editor or when loading the content from your data source? Either way it shouldn't be complicated, just a matter of which route to take. |
Just chiming in here: wouldn't a DOM observer be more appropriate in this case? There is already one at work in event.js, it could easily trigger events when nodes are added/removed and provide a fine-grained control over the content of There is a problem though, as I guess what I want to say is that, from what I understand, an efficient/elegant solution to this problem will be hard to reach as long as scribe relies on |
There was always a plan to use virtual-dom for all mutations and only apply the changes as patches, which would retain element identity in many cases (though cannot always be relied on). This hasn't been implemented yet unfortunately. |
@JeSuis I was wondering if you ever got around to writing the demo you offered above? :) I am in a similar situation as yours, wherein I am trying to resemble Medium-like behavior but then trying to convert the content from the editor into a json through a normalizer plugin (which will scan for tags and a Seeing your demo would really help, if you have a moment. Thanks so much! |
@oyeanuj I hadn't cause he was basically already doing the same thing |
@JeSuis Thanks for the quick response! I am working on React/Redux/Rails-API stack but happy to see any stack code, even pseudo-code that explains your thinking :) |
@oyeanuj |
Are there any examples of:
?
forked from #89 conversation
The text was updated successfully, but these errors were encountered: