Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions ai2html.js
Original file line number Diff line number Diff line change
Expand Up @@ -1460,6 +1460,15 @@ function initSpecialTextBlocks() {
// An error will be thrown if trying to hide a text frame inside a
// locked layer. Solution: unlock any locked parent layers.
if (objectIsLocked(thisFrame)) {
var parent = thisFrame.parent;
var lockedAncestors = [];
while (parent && parent.typename != 'Document') {
if (parent.locked) {
lockedAncestors.unshift(parent);
}
parent = parent.parent;
}
forEach(lockedAncestors, unlockObject);
unlockObject(thisFrame);
}
hideTextFrame(thisFrame);
Expand Down Expand Up @@ -2238,14 +2247,6 @@ function objectIsLocked(obj) {
return false;
}

function unlockObject(obj) {
// unlock parent first, to avoid "cannot be modified" error
if (obj && obj.typename != "Document") {
unlockObject(obj.parent);
obj.locked = false;
}
}

function getComputedOpacity(obj) {
var opacity = 1;
while (obj && obj.typename != "Document") {
Expand Down