question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Best strategy in producing a "read-only" output?

See original GitHub issue

Great project!

Might be a silly question here, but what is the best strategy in rendering a read only view? Should I be considering a serialize call using the Html serializer?

Thanks!

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:9 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
ianstormtaylorcommented, Jul 17, 2016

Ah interesting @mathieudutour! What do the islands contain? I’m down to discuss it in another issue and see if there’s a nice solution.

I’ve just added a readOnly property to editor that renders it in read-only mode. (Released in 0.1.14!)

1reaction
ianstormtaylorcommented, Jul 17, 2016

Hey @ctrlplusb, good question! I think it depends on the use case.

I think there’s a definite use case for having the Slate editor itself render in “readonly” mode, for example when a user should be able to see an existing document in the editing environment, but not edit it (like in Google Docs). For that, I just opened a new issue here: https://github.com/ianstormtaylor/slate/issues/108

And then there’s another use case, which is rendering content created in an editor elsewhere (like you’d do in a CMS). In this case, the editor is really “creating” the read-only output, so you’d want to use one of the serializers to save it somewhere, and then render that serialized state however. (The Html serializer would be a good option here.)

Hope that makes sense! I’ll look into adding the read-only mode soon.

Read more comments on GitHub >

github_iconTop Results From Across the Web

read-only - CSS: Cascading Style Sheets - MDN Web Docs
The :read-only pseudo-class is used to remove all the styling that makes the inputs look like clickable fields, making them look more like ......
Read more >
What are the benefits to marking a field as `readonly` in C ...
The readonly keyword compiles down to . initonly which is verifiable by the CLR. The real advantage of this keyword is to generate...
Read more >
How to add readonly attribute to an input tag in JavaScript
Use setAttribute() Method to add the readonly attribute to the form input field using JavaScript. setAttribute() Method: This method adds the ...
Read more >
Best practices for writing Dockerfiles - Docker Documentation
Best practices for writing Dockerfiles. This document covers recommended best practices and methods for building efficient images.
Read more >
Write safe and efficient C# code | Microsoft Learn
Use the in parameter modifier. Use ref readonly return statements. Use ref struct types. Use nint and nuint types.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found