Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi guys,
I've taken a shot at the readonly mode on editors (Briefly discussed in issues 90, 91 and 145) and here's a pull request proposal.
readonly in schema
Each editor can get a
{ readonly: true }
as part of the schema (false by default). Object doesn't have readonliness since it's the subschema which would specify the readonliness for each editor.* readonlyTemplate for each editor*
Each editor has a
readonlyTemplate
, which is rendered if the schema.readonly property is set. This way it is easy to extend an editor to make it appear however we want only by overriding thereadonlyTemplate
.There's one exception: Checkboxes editor. Since the containing
el
is an unordered list<ul>
, we can't achieve readonliness for checkboxes at theel
level. The Checkboxes editor implements readonliness inside the_arrayToHtml
function.* setElAttributes function for tweaking the el*
Instead of having code altering the
el
attributes in theinitialize
function, I've created asetElAttributes
function which can also be called after the readonly template is rendered.That's it, let me know what you think and if the PR is accepted I'll update the Readme.md as well as the fiddles linked in it.