ethereum / swarm-dapps

Swarm Đapp Examples
98 stars 202 forks source link

swarm-document-agent: swarm-hosted markdown document handling containing both editor and reader. #6

Open nagydani opened 7 years ago

nagydani commented 7 years ago

This requires some more work to bring it in line with the styles of Ethereum dapps.

alexvandesande commented 7 years ago

I really can't review this as most of the files I have no idea what they do.

I see you added a lot of scss rules. Where does these come from? We use less for our style, did you copy the style from ours or are you just making one of your own?

Wouldn't it be simpler for you to add dapp-styles as a package?

nagydani commented 7 years ago

The dress-up, including adding the style, was done not by me, but by a developer more versed in modern frontend technologies (Dean Vaessen from the copyright note). Originally, I only included the container html with inline scripts and the rendering library verbatim. But both Fabian and Dean told me that it makes it difficult to maintain and develop, so Dean externalized the javascript code into several files that eventually get compiled into a single js loaded by the container html.

I am perfectly willing to add dapp-styles as a package. Would that work without any further change to either the package or the dapp?

nagydani commented 7 years ago

Dapp-style has been added, and it looks much better now. Also, we have a WYSIWYG editor.

frozeman commented 7 years ago

@nagydani the markdown dapp seems overly complictaed. But besides that it has the source code from the CKEDITOR in the files, thats why its so large. This is a npm package and can be simply linked and build on the fly: https://www.npmjs.com/package/ckeditor This would certainly move the file count down to 50. Even this is to much. This seems a not well structured dapp. It makes it very hard to comprehend the code from the outside.

luclu commented 7 years ago

I did play around with this tonight and created a basic split markdown editor (without persistent swarm storage yet). It is basically under 20#L bundled in 5 files not exceeding 1M.

The markdown editor is quite customizable and should suffice as a demo app. It uses simplemde-markdown-editor which in turn uses marked as markdown parser and customizable with many features as it's editor is build upon codemirror.

Currently it uses localStorage for content persistency but it should be easy include web3 and append it's content's manifest hash to the URL.

In conjuction with the new swarm manifest update persistency on swarm could be implemented without a changing content hash in the URL.

Demo at: http://swarm-gateways.net/bzz:/2e21c2915fd2d0e7f602c88f20b6000d380313fe0c816a848ae8bf52f4b218fd/

And a link to the repo: https://github.com/luclu/swarm-markdown-editor

frozeman commented 7 years ago

@luclu that looks great and is a lot more simple. @nagydani what do you think?

frozeman commented 7 years ago

@luclu this i would enable the split view by default.

luclu commented 7 years ago

@luclu this i would enable the split view by default.

@frozeman done (Upstream PR: https://github.com/NextStepWebs/simplemde-markdown-editor/pull/527)

I also updated the demo link with the fix.

nagydani commented 7 years ago

I think that it is indeed nice and simple, but my objective was to have a WYSIWG editor where the user does not even need to be aware of the underlying markdown, if she doesn't want to. Essentially, I would like to replicate the functionality of http://telegra.ph

nagydani commented 7 years ago

Source cleaned up, no external modules in the source.

zelig commented 7 years ago

@nagydani @frozeman please double check the status of this PR and then merge. Thanks

cobordism commented 6 years ago

FWIW, we've deployed the markdown-editor from nagydani:markdown-reader to swarm ages ago. It is already part of our standard demo apps when we showcase swarm.

What it is missing as a default markdown document to display. Currently, when called without an argument (a hash of a markdown doc) it displays an unhelpful error. Better would be a default markdown document that explains the usage of the editor.

see also: https://github.com/ethereum/swarm-dapps/issues/11