File tree Expand file tree Collapse file tree 5 files changed +26
-19
lines changed
app/code/Magento/PageBuilder/view/adminhtml/web
template/content-type/slide Expand file tree Collapse file tree 5 files changed +26
-19
lines changed Original file line number Diff line number Diff line change 22
22
attr ="data.content.attributes "
23
23
ko-style ="data.content.style "
24
24
css ="data.content.css "
25
- event ="mousedown: stopEvent "
26
- afterRender ="initWysiwyg ">
25
+ event ="mousedown: stopEvent, click: activateEditor "
26
+ contenteditable ="true "
27
+ afterRender ="afterRenderWysiwyg ">
27
28
< div html ="data.content.html "> </ div >
28
29
</ div >
29
30
< div if ="!data.content.html() && isWysiwygSupported() "
Original file line number Diff line number Diff line change 24
24
attr ="data.content.attributes "
25
25
ko-style ="data.content.style "
26
26
css ="data.content.css "
27
- event ="mousedown: stopEvent "
28
- afterRender ="initWysiwyg ">
27
+ event ="mousedown: stopEvent, click: activateEditor "
28
+ contenteditable ="true "
29
+ afterRender ="afterRenderWysiwyg ">
29
30
< div html ="data.content.html "> </ div >
30
31
</ div >
31
32
< div if ="!data.content.html() && isWysiwygSupported() "
Original file line number Diff line number Diff line change 22
22
attr ="data.content.attributes "
23
23
ko-style ="data.content.style "
24
24
css ="data.content.css "
25
- event ="mousedown: stopEvent "
26
- afterRender ="initWysiwyg ">
25
+ event ="mousedown: stopEvent, click: activateEditor "
26
+ contenteditable ="true "
27
+ afterRender ="afterRenderWysiwyg ">
27
28
< div html ="data.content.html "> </ div >
28
29
</ div >
29
30
< div if ="!data.content.html() && isWysiwygSupported() "
Original file line number Diff line number Diff line change @@ -401,12 +401,14 @@ export default class Preview extends BasePreview {
401
401
* @returns {HTMLElement }
402
402
*/
403
403
private findTextNode ( element : HTMLElement , text : string ) : HTMLElement {
404
- const textSearch = $ ( element ) . find ( ":contains(\"" + text . trim ( ) + "\")" ) ;
405
- if ( textSearch . length > 0 ) {
406
- // Search for the #text node within the element for the new range
407
- return textSearch . last ( ) . contents ( ) . filter ( function ( ) {
408
- return this . nodeType === Node . TEXT_NODE && text === this . nodeValue ;
409
- } ) [ 0 ] ;
404
+ if ( text && text . trim ( ) . length > 0 ) {
405
+ const textSearch = $ ( element ) . find ( ":contains(\"" + text . trim ( ) + "\")" ) ;
406
+ if ( textSearch . length > 0 ) {
407
+ // Search for the #text node within the element for the new range
408
+ return textSearch . last ( ) . contents ( ) . filter ( function ( ) {
409
+ return this . nodeType === Node . TEXT_NODE && text === this . nodeValue ;
410
+ } ) [ 0 ] ;
411
+ }
410
412
}
411
413
}
412
414
}
You can’t perform that action at this time.
0 commit comments