mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-28 01:55:38 -05:00
Highlight locked default code
This commit is contained in:
parent
5aefd5ffa2
commit
bd797e8cfd
2 changed files with 10 additions and 1 deletions
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue