mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2025-02-25 22:14:29 -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
|
.executed
|
||||||
background-color: rgba(110, 110, 110, 0.12)
|
background-color: rgba(110, 110, 110, 0.12)
|
||||||
|
|
||||||
|
.locked-code
|
||||||
|
border: 1px dashed rgba(53, 45, 34, 0.5)
|
||||||
|
|
||||||
+keyframes(pulseRedBackground)
|
+keyframes(pulseRedBackground)
|
||||||
from
|
from
|
||||||
background-color: rgba(255, 45, 27, 0.4)
|
background-color: rgba(255, 45, 27, 0.4)
|
||||||
|
|
|
@ -293,10 +293,16 @@ module.exports = class SpellView extends CocoView
|
||||||
wrapper => orig.apply obj, args
|
wrapper => orig.apply obj, args
|
||||||
obj[method]
|
obj[method]
|
||||||
|
|
||||||
|
if @lockedCodeMarkerID?
|
||||||
|
@aceSession.removeMarker @lockedCodeMarkerID
|
||||||
|
@lockedCodeMarkerID = null
|
||||||
|
|
||||||
@readOnlyRanges = []
|
@readOnlyRanges = []
|
||||||
lines = @aceDoc.getAllLines()
|
lines = @aceDoc.getAllLines()
|
||||||
lastRow = row for line, row in lines when not /^\s*$/.test(line)
|
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
|
# Override write operations that intersect with default code
|
||||||
interceptCommand @ace, 'onPaste', preventReadonly
|
interceptCommand @ace, 'onPaste', preventReadonly
|
||||||
|
|
Loading…
Reference in a new issue