diff --git a/app/styles/play/level/tome/spell.sass b/app/styles/play/level/tome/spell.sass index b7d2b3169..964288585 100644 --- a/app/styles/play/level/tome/spell.sass +++ b/app/styles/play/level/tome/spell.sass @@ -107,6 +107,9 @@ .executed background-color: rgba(110, 110, 110, 0.12) + .locked-code + border: 1px dashed rgba(53, 45, 34, 0.5) + +keyframes(pulseRedBackground) from background-color: rgba(255, 45, 27, 0.4) diff --git a/app/views/play/level/tome/SpellView.coffee b/app/views/play/level/tome/SpellView.coffee index fa5610bda..06d948f6d 100644 --- a/app/views/play/level/tome/SpellView.coffee +++ b/app/views/play/level/tome/SpellView.coffee @@ -293,10 +293,16 @@ module.exports = class SpellView extends CocoView wrapper => orig.apply obj, args obj[method] + if @lockedCodeMarkerID? + @aceSession.removeMarker @lockedCodeMarkerID + @lockedCodeMarkerID = null + @readOnlyRanges = [] lines = @aceDoc.getAllLines() lastRow = row for line, row in lines when not /^\s*$/.test(line) - @readOnlyRanges.push new Range 0, 0, lastRow, lines[lastRow].length - 1 if lastRow? + if lastRow? + @readOnlyRanges.push new Range 0, 0, lastRow, lines[lastRow].length - 1 + @lockedCodeMarkerID = @aceSession.addMarker @readOnlyRanges[0], 'locked-code', 'fullLine' # Override write operations that intersect with default code interceptCommand @ace, 'onPaste', preventReadonly