-
Notifications
You must be signed in to change notification settings - Fork 396
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to get pure HTML? #523
Comments
By writing your backend to output the blocks as pure HTML - This isn't here to render, build or otherwise output your HTML for you, it's just here to offer a nice way to abstract away the process of creating the content in the first place then letting your sever side code handle the blocks in an appropriate manner (I've plumed this into bootstrap others into angularjs - the choice is yours to make and YMMV) |
@PaulMaly as @SgtOddball says. What programming language are you using to output the data? |
As an example, here is a list of backend implementations for Sir Trevor: https://github.com/madebymany/sir-trevor-js#implementations While most of these are concerned with integrating with a CMS (i.e. rendering the editor and handling the saving of data), the Sir Trevor Rails gem handles rendering the structured data into HTML. We've recently also worked on rendering Sir Trevor data in React Native. I'm hoping we can release this somehow in the future. |
Thanks guys for your answers! Really sad that Sir Trevor can't handle this regular feature. Actually, I don't even know any other WYSIWYG editor which doesn't allow you to get HTML source code, created via it. But if it's design intent - no problem, I can handle it by myself. Thanks! |
Sir Trevor isn't a WYSIWYG editor - it's a content editor (common misconception). So it doesn't fit everybody's needs but for modern responsive or multi device websites should you really be trusting your users with doing the layout themselves? Thats the point of Sir trev |
Well, the main reason for this is that most WYSIWYG editors are HTML editors. And we don't want to be storing HTML blobs — the whole point of a block editor is to produce structured data so you can make reasoned choices about it when rendering it, for example turning it into HTML. |
@SgtOddball I edit something and I see what I'm editing instantly in place. For me it's calling WYSIWYG editor. In this case Sir Trevor can be mapped to this term as well. If what you write and you see at the same time doesn't correspond, then what differs from at once to write using syntax for a structured data? You can just write JSON manually, because you don't even know "what you get". @ilyaporopudas yes, I understand this point and this part is cool, really. But you already have HTML output than you're editing. So, why an editor can't output it as optional feature? Which reason to send it to the server to get HTML which I already see and use? I'm talking not about storing (JSON is good), but about representation in place. |
Using that logic then, notepad is a WYSIWYG editor... which it most emphatically isn't. As for just writing structured data - the end user doesn't want to do that and that what this is for. It's an abstraction to turn blobs of content (referred to as Blocks in Sir Trevor) into a structure of your choosing with out having the limitations of the WYSIWYG editor imposed on you. As for the HTML being used - it's all inline elements wrapped in a block element - even then thats not fixed and can be coded to behave differently. It also means that in a year or two or ten that the data can still be read and outputted to a new site if the design totally changes (which usually ruins a WYSIWYG layout or seriously hampers such progressive moves). |
@SgtOddball Using that logic, Sir Trevor is "What You See Is Not What You Get" editor, right? )))))
Agree, but I believe that user want to write something and instantly see final output. So, WYSIWYG editors is the way for this.
No doubt, that it's a great feature that I can get structured JSON data to store it on my server, but I don't understand why in this case I can't get HTML output "what i see"?
First of all, WYSIWYG is a principle. So if something doesn't work well, it's just a bad implementation of this principle. Sir Trevor already doesn't have many problems of the others WYSIWYG editors, but |
Now that you've established that Sir Trev doesn't work as WYSIWYG editor, please tell me where it ever claimed to be one? |
@PaulMaly Sir Trevor doesn't and never will include html output of the internal representation of the data. What I suggest is you take the output of the editor and render html without your own javascript functions. If you want to provide a repo and make this reusable to others I will happily add it to the docs somewhere such as https://github.com/madebymany/sir-trevor-js#implementations |
Then how to reset JSON data into SirTrevor instance? I need to edit already stored content, so I've JSON like {data: [...]}, how to init SirTrevor instance with this data? |
Sir Trevor is currently linked to a form and textarea element so the way to deal with this for now is: #393 (comment) |
Hello guys! How can I get pure HTML after editing? Thanks!
The text was updated successfully, but these errors were encountered: