File tree Expand file tree Collapse file tree 2 files changed +31
-1
lines changed
js/__internal/ui/html_editor/modules
testing/tests/DevExpress.ui.widgets.htmlEditor/htmlEditorParts Expand file tree Collapse file tree 2 files changed +31
-1
lines changed Original file line number Diff line number Diff line change @@ -113,7 +113,7 @@ if (Quill) {
113113 }
114114
115115 selectionChangedHandler ( e ) {
116- if ( this . _popup . option ( 'visible' ) ) {
116+ if ( this . _popup . option ( 'visible' ) && e . addedItems . length ) {
117117 this . _popup . hide ( ) ;
118118
119119 this . insertEmbedContent ( e ) ;
Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ const INPUT_CLASS = 'dx-texteditor-input';
2020const DIALOG_CLASS = 'dx-formdialog' ;
2121const DIALOG_FORM_CLASS = 'dx-formdialog-form' ;
2222const BUTTON_CLASS = 'dx-button' ;
23+ const SUGGESTION_LIST_CLASS = 'dx-suggestion-list' ;
2324const LIST_ITEM_CLASS = 'dx-list-item' ;
2425
2526const BLACK_PIXEL = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVQYGWNgYmL6DwABFgEGpP/tHAAAAABJRU5ErkJggg==' ;
@@ -1000,5 +1001,34 @@ export default function() {
10001001 $ ( '.dx-suggestion-list .dx-list-item' ) . trigger ( 'dxclick' ) ;
10011002 this . clock . tick ( 10 ) ;
10021003 } ) ;
1004+
1005+ test ( 'Click on variable toolbar format button before popup is hidden after variable select should not add a undefined variable (T1278577)' , function ( assert ) {
1006+ fx . off = false ;
1007+ const expectedValue = '<p><span class="dx-variable" data-var-start-esc-char="%" data-var-end-esc-char="%" data-var-value="test"><span contenteditable="false">%test%</span></span></p>' ;
1008+
1009+ const editor = $ ( '#htmlEditor' ) . dxHtmlEditor ( {
1010+ toolbar : { items : [ 'variable' ] } ,
1011+ variables : {
1012+ dataSource : [ 'test' ] ,
1013+ escapeChar : '%'
1014+ } ,
1015+ } ) . dxHtmlEditor ( 'instance' ) ;
1016+
1017+ $ ( '#htmlEditor' )
1018+ . find ( `.${ TOOLBAR_FORMAT_WIDGET_CLASS } ` )
1019+ . trigger ( 'dxclick' ) ;
1020+
1021+ $ ( `.${ SUGGESTION_LIST_CLASS } .${ LIST_ITEM_CLASS } ` ) . trigger ( 'dxclick' ) ;
1022+
1023+ $ ( '#htmlEditor' )
1024+ . find ( `.${ TOOLBAR_FORMAT_WIDGET_CLASS } ` )
1025+ . trigger ( 'dxclick' ) ;
1026+
1027+ this . clock . tick ( 10 ) ;
1028+
1029+ const value = editor . option ( 'value' ) ;
1030+
1031+ assert . strictEqual ( prepareEmbedValue ( value ) , expectedValue ) ;
1032+ } ) ;
10031033 } ) ;
10041034}
You can’t perform that action at this time.
0 commit comments