File tree Expand file tree Collapse file tree 2 files changed +21
-1
lines changed Expand file tree Collapse file tree 2 files changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ class CodeBlockContainer extends Container {
15
15
16
16
code ( index , length ) {
17
17
const text = this . children
18
- . map ( child => ( child . length ( ) <= 1 ? '' : child . domNode . innerText ) )
18
+ . map ( child => ( child . length ( ) <= 1 ? '' : child . domNode . textContent ) )
19
19
. join ( '\n' )
20
20
. slice ( index , index + length ) ;
21
21
return escapeText ( text ) ;
Original file line number Diff line number Diff line change @@ -856,5 +856,25 @@ describe('Quill', function() {
856
856
857
857
expect ( instance . getSemanticHTML ( ) ) . toEqual ( expected ) ;
858
858
} ) ;
859
+
860
+ it ( 'should correctly convert hidden code blocks' , function ( ) {
861
+ const instance = this . initialize (
862
+ Quill ,
863
+ `<p>123</p>
864
+ <pre>ab</pre>
865
+ <p>45</p>` ,
866
+ this . container ,
867
+ {
868
+ modules : {
869
+ table : true ,
870
+ } ,
871
+ } ,
872
+ ) ;
873
+ const expected = '<p>123</p><pre>\nab\n</pre><p>45</p>' ;
874
+ this . container . style . visibility = 'hidden' ;
875
+
876
+ expect ( instance . getSemanticHTML ( ) ) . toEqual ( expected ) ;
877
+ this . container . style . visibility = '' ;
878
+ } ) ;
859
879
} ) ;
860
880
} ) ;
You can’t perform that action at this time.
0 commit comments