Skip to content

Commit b82a966

Browse files
author
Cerem Cem ASLAN
committed
json-edit is moved back into debug-obj component
1 parent eb2b74e commit b82a966

File tree

4 files changed

+26
-69
lines changed

4 files changed

+26
-69
lines changed

components/debug-obj/index.ls

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,28 @@
1+
Ractive.components['json-edit'] = Ractive.extend do
2+
template: require('./json-edit.pug')
3+
isolated: true
4+
data: ->
5+
objStr: null
6+
objFormatted: null
7+
computed:
8+
objFormatted:
9+
get: ->
10+
if @get \objTmp
11+
return that
12+
else
13+
return JSON.stringify @get('value'), null, 2
14+
15+
set: (objStr) ->
16+
try
17+
obj = JSON.parse(objStr)
18+
@set('value', obj)
19+
@set('objTmp', null)
20+
catch
21+
return @set 'objTmp', objStr
22+
123
Ractive.components['debug-obj'] = Ractive.extend do
224
template: require('./index.pug')
325
data: ->
4-
obj: undefined
26+
obj: null
527
title: null
628
public: false

components/debug-obj/json-edit.pug

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.ui.form
2+
.field
3+
textarea(style="white-space: pre-wrap") {{ objFormatted }}

vendor2/ractive-plugins/json-edit.js

Lines changed: 0 additions & 67 deletions
This file was deleted.

vendor2/ractive-plugins/plugins.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,4 @@ https://cdn.jsdelivr.net/npm/ractive-transitions-fade
22
https://cdn.jsdelivr.net/npm/ractive-transitions-slide
33
https://cdn.jsdelivr.net/npm/ractive-transitions-fly
44
https://cdn.jsdelivr.net/npm/ractive-events-keys@0.2.1/dist/ractive-events-keys.min.js
5-
https://cdn.jsdelivr.net/gh/ceremcem/ractive-components@v0.11/components/json-edit.js
65
https://raw.githubusercontent.com/ceremcem/ractive-modal/prevent-bg-scroll/dist/ractive-modal.js

0 commit comments

Comments
 (0)