Fix: Relock locked groups/layers #188
Open
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.
Issue
The script contains duplicate definitions for the
unlockObject()function:As a result, unlocked layers and groups are not relocked when the script finishes running.
The second definition was introduced in version 0.115.2 in order to fix a rare error that occurred when the script attempts to hide special text blocks (
ai2html-settings,ai2html-css) overlapping artboards, if one of their ancestors is locked. Parsing of special text blocks happens before layers and groups are unlocked.Proposed fix
unlockContainer()function already recursively unlocks all sublayers and descendant groups, and it is called on all top-level layers;