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.

Prevent editing some components

See original GitHub issue

I would like to prevent users from editing the internal components of specific components.

IE lets say I have an element called Drupal-Block

<div data-block>
... html inside ..
</div>

I want to prevent the users from editing the … html inside… bit

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:30 (8 by maintainers)

github_iconTop GitHub Comments

4reactions
artfcommented, Oct 17, 2017

Yeah, @MichaelKlemersson is right currently you have to set them manually on any element. Another trick would be to update all children via model

const updateAll = model => {
    model.set({editable: false, ...});
    model.get('components').each(model => updateAll(model));
}
updateAll(component);

But what I think would be the best it’s some kind of property which propagates (suggestions for a better term are welcome) properties from the parent to its children, eg.

<div data-gjs-editable="false" data-gjs-propagate="['editable', ...]">
     <!-- this will be not editable too and the same for its children -->
     <div>...</div>
     
    <!-- possibility to overwrite and 'break' the chain -->
     <div data-gjs-editable="true" data-gjs-propagate=""></div>
</div>

what do you think?

2reactions
artfcommented, Oct 20, 2017

An example you can use in the demo

  1. Select an element (eg. some section)
  2. Execute this in console
editor.getSelected().append(`
<div data-gjs-removable="false" data-gjs-draggable="false" data-gjs-propagate='["removable", "draggable"]' style="color:blue">
  <div>Comp01</div>
	<div>
    <div>Comp11</div>
    <div data-gjs-stop="1" data-gjs-removable="true" data-gjs-draggable="true" data-gjs-propagate='["stop"]' style="color:red">
      <div>Comp21</div>
      <div>Comp22</div>
    </div>
    <div>
      <div>Comp31</div>
      <div>Comp32</div>
    </div>
  </div>
  <div>Comp03</div>
</div>
`)
Read more comments on GitHub >

github_iconTop Results From Across the Web

Allow changes to parts of a protected document
Protect a document and mark the parts that can be changed · On the Review tab, in the Protect group, click Restrict Editing....
Read more >
How to Protect Parts of a Word Document from ... - groovyPost
Newer versions of Microsoft Word allow you to restrict edits to some or all sections of a document. Here's how.
Read more >
How to Protect Parts of a Word Document from ... - How-To Geek
The “Restrict Editing” pane will appear on the right side of Word. Here, tick the “Allow only this type of editing in the...
Read more >
How to Restrict Editing to Parts of a Word Document –
Step 1: With your document open, click the ribbon's Review tab and then click the Restrict Editing button as shown below. Step 2:...
Read more >
How to Protect Your Microsoft Word Documents | PCMag
1. Read-Only Mode 2. Password Encryption 3. Restrict Format Editing
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