@@ -527,6 +527,43 @@ define([
527
527
setTimeout ( function ( ) { me . txtLabel . _input && me . txtLabel . _input . select ( ) ; } , 1 ) ;
528
528
} ) ;
529
529
530
+ this . btnSelectImage = new Common . UI . Button ( {
531
+ parentEl : $markup . findById ( '#form-btn-replace' ) ,
532
+ cls : 'btn-text-menu-default' ,
533
+ caption : this . textSelect ,
534
+ style : "width:100%;" ,
535
+ menu : new Common . UI . Menu ( {
536
+ style : 'min-width: 90px;' ,
537
+ maxHeight : 200 ,
538
+ items : [
539
+ { caption : this . textFromFile , value : 0 } ,
540
+ { caption : this . textFromUrl , value : 1 } ,
541
+ { caption : this . textFromStorage , value : 2 }
542
+ ]
543
+ } ) ,
544
+ dataHint : '1' ,
545
+ dataHintDirection : 'bottom' ,
546
+ dataHintOffset : 'big'
547
+ } ) ;
548
+ this . lockedControls . push ( this . btnSelectImage ) ;
549
+ this . btnSelectImage . menu . on ( 'item:click' , _ . bind ( this . onImageSelect , this ) ) ;
550
+ if ( this . mode . canRequestInsertImage || this . mode . fileChoiceUrl && this . mode . fileChoiceUrl . indexOf ( "{documentType}" ) > - 1 ) {
551
+ Common . NotificationCenter . on ( 'storage:image-insert' , _ . bind ( this . insertImageFromStorage , this ) ) ;
552
+ } else
553
+ this . btnSelectImage . menu . items [ 2 ] . setVisible ( false ) ;
554
+
555
+ this . btnClear = new Common . UI . Button ( {
556
+ parentEl : $markup . findById ( '#form-btn-clear' ) ,
557
+ cls : 'btn-text-default' ,
558
+ style : "width:100%;" ,
559
+ caption : this . textClear ,
560
+ dataHint : '1' ,
561
+ dataHintDirection : 'left' ,
562
+ dataHintOffset : 'small'
563
+ } ) ;
564
+ this . btnClear . on ( 'click' , _ . bind ( this . onImageClear , this ) ) ;
565
+ this . lockedControls . push ( this . btnClear ) ;
566
+
530
567
this . chFit = new Common . UI . CheckBox ( {
531
568
el : $markup . findById ( '#form-chb-fit' ) ,
532
569
labelText : this . textFitBounds ,
@@ -900,6 +937,42 @@ define([
900
937
}
901
938
} ,
902
939
940
+ onImageClear : function ( ) {
941
+ if ( this . api && ! this . _noApply ) {
942
+ this . _originalSpecProps && this . _originalSpecProps . put_ImageUrl ( null , this . _state . State ) ;
943
+ }
944
+ } ,
945
+
946
+ insertImageFromStorage : function ( data ) {
947
+ if ( data && data . _urls && data . c == 'control' ) {
948
+ this . _originalSpecProps && this . _originalSpecProps . put_ImageUrl ( data . _urls [ 0 ] , this . _state . State ) ;
949
+ }
950
+ } ,
951
+
952
+ onImageSelect : function ( menu , item ) {
953
+ if ( item . value == 1 ) {
954
+ var me = this ;
955
+ ( new Common . Views . ImageFromUrlDialog ( {
956
+ handler : function ( result , value ) {
957
+ if ( result == 'ok' ) {
958
+ if ( me . _originalSpecProps ) {
959
+ var checkUrl = value . replace ( / / g, '' ) ;
960
+ if ( ! _ . isEmpty ( checkUrl ) ) {
961
+ me . _originalSpecProps . put_ImageUrl ( checkUrl , me . _state . State ) ;
962
+ }
963
+ }
964
+ }
965
+ me . fireEvent ( 'editcomplete' , me ) ;
966
+ }
967
+ } ) ) . show ( ) ;
968
+ } else if ( item . value == 2 ) {
969
+ Common . NotificationCenter . trigger ( 'storage:image-load' , 'control' ) ;
970
+ } else {
971
+ this . _originalSpecProps && this . _originalSpecProps . showFileDialog ( this . _state . State ) ;
972
+ this . fireEvent ( 'editcomplete' , this ) ;
973
+ }
974
+ } ,
975
+
903
976
onChFit : function ( field , newValue , oldValue , eOpts ) {
904
977
if ( this . api && ! this . _noApply ) {
905
978
this . api . SetButtonFieldFitBounds ( field . getValue ( ) === 'checked' ) ;
@@ -1205,6 +1278,8 @@ define([
1205
1278
}
1206
1279
1207
1280
if ( layout !== AscPDF . Api . Types . position . textOnly ) {
1281
+ specProps . put_DivId ( 'form-icon-img' ) ;
1282
+
1208
1283
val = specProps . asc_getScaleWhen ( ) ;
1209
1284
if ( this . _state . Scale !== val ) {
1210
1285
this . cmbScale . setValue ( val , '' ) ;
0 commit comments