File tree Expand file tree Collapse file tree 2 files changed +22
-1
lines changed Expand file tree Collapse file tree 2 files changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -47,6 +47,7 @@ function init(Survey) {
4747 min : question . rangeMin ,
4848 max : question . rangeMax ,
4949 step : question . step ,
50+ enabled : ! question . isReadOnly ,
5051 value : question . value || question . rangeMin
5152 } ) ;
5253
@@ -56,12 +57,20 @@ function init(Survey) {
5657 var updateValueHandler = function ( ) {
5758 slider . setValue ( question . value || question . rangeMin ) ;
5859 } ;
60+ question . readOnlyChangedCallback = function ( ) {
61+ if ( question . isReadOnly ) {
62+ slider . disable ( ) ;
63+ } else {
64+ slider . enable ( ) ;
65+ }
66+ } ;
5967 question . bootstrapSlider = slider ;
6068 question . valueChangedCallback = updateValueHandler ;
6169 } ,
6270 willUnmount : function ( question , el ) {
6371 question . bootstrapSlider . destroy ( ) ;
6472 question . bootstrapSlider = null ;
73+ question . readOnlyChangedCallback = null ;
6574 }
6675 } ;
6776
Original file line number Diff line number Diff line change @@ -25,6 +25,8 @@ function init(Survey) {
2525 config . toolbarCanCollapse = true ;
2626 } ;
2727 var editor = CKEDITOR . replace ( el ) ;
28+ CKEDITOR . instances . editor1 . config . readOnly = question . isReadOnly ;
29+
2830 var isValueChanging = false ;
2931 var updateValueHandler = function ( ) {
3032 if ( isValueChanging ) return ;
@@ -35,10 +37,20 @@ function init(Survey) {
3537 question . value = editor . getData ( ) ;
3638 isValueChanging = false ;
3739 } ) ;
40+
3841 question . valueChangedCallback = updateValueHandler ;
42+ question . readOnlyChangedCallback = function ( ) {
43+ if ( question . isReadOnly ) {
44+ editor . setReadOnly ( true ) ;
45+ } else {
46+ editor . setReadOnly ( false ) ;
47+ }
48+ } ;
3949 updateValueHandler ( ) ;
4050 } ,
41- willUnmount : function ( question , el ) { }
51+ willUnmount : function ( question , el ) {
52+ question . readOnlyChangedCallback = null ;
53+ }
4254 } ;
4355
4456 Survey . CustomWidgetCollection . Instance . addCustomWidget ( widget , "customtype" ) ;
You can’t perform that action at this time.
0 commit comments