File tree Expand file tree Collapse file tree 3 files changed +20
-3
lines changed Expand file tree Collapse file tree 3 files changed +20
-3
lines changed Original file line number Diff line number Diff line change 3
3
https://github.com/josdejong/jsoneditor
4
4
5
5
6
+ ## not yet published, version 9.7.0
7
+
8
+ - Implement #1413 : show color indicator on readonly fields.
9
+
10
+
6
11
## 2022-01-13, version 9.6.0
7
12
8
13
- Pass a new property ` value ` along with the ` onNodeName ` callback, see #1409 .
Original file line number Diff line number Diff line change @@ -1785,8 +1785,7 @@ export class Node {
1785
1785
}
1786
1786
1787
1787
// show color picker when value is a color
1788
- if ( this . editable . value &&
1789
- this . editor . options . colorPicker &&
1788
+ if ( this . editor . options . colorPicker &&
1790
1789
typeof value === 'string' &&
1791
1790
isValidColor ( value ) ) {
1792
1791
if ( ! this . dom . color ) {
@@ -1802,6 +1801,11 @@ export class Node {
1802
1801
1803
1802
// update styling of value and color background
1804
1803
addClassName ( this . dom . value , 'jsoneditor-color-value' )
1804
+ if ( ! this . editable . value ) {
1805
+ addClassName ( this . dom . color , 'jsoneditor-color-readonly' )
1806
+ } else {
1807
+ removeClassName ( this . dom . color , 'jsoneditor-color-readonly' )
1808
+ }
1805
1809
this . dom . color . style . backgroundColor = value
1806
1810
} else {
1807
1811
// cleanup color picker when displayed
@@ -2536,7 +2540,11 @@ export class Node {
2536
2540
}
2537
2541
}
2538
2542
2539
- if ( type === 'click' && ( event . target === node . dom . tdColor || event . target === node . dom . color ) ) {
2543
+ if (
2544
+ type === 'click' &&
2545
+ ( event . target === node . dom . tdColor || event . target === node . dom . color ) &&
2546
+ this . editable . value
2547
+ ) {
2540
2548
this . _showColorPicker ( )
2541
2549
}
2542
2550
Original file line number Diff line number Diff line change @@ -185,6 +185,10 @@ div {
185
185
margin : 4px ;
186
186
border : 1px solid $jse-readonly ;
187
187
cursor : pointer ;
188
+
189
+ & .jsoneditor-color-readonly {
190
+ cursor : inherit ;
191
+ }
188
192
}
189
193
& .jsoneditor-date {
190
194
background : $jse-date ;
You can’t perform that action at this time.
0 commit comments