File tree 1 file changed +9
-5
lines changed
1 file changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -106,13 +106,17 @@ export function renderArticle (content) {
106
106
if ( ! OPTIONS . sidebar && ! OPTIONS . loadSidebar ) renderSidebar ( )
107
107
108
108
if ( content && typeof Vue !== 'undefined' ) {
109
- const script = content . match ( '<script[^>]*?>([^<]+)</script>' )
110
-
111
- script && document . body . querySelector ( 'article script' ) . remove ( )
112
109
CACHE . vm && CACHE . vm . $destroy ( )
113
- CACHE . vm = script
114
- ? new Function ( `return ${ script [ 1 ] . trim ( ) } ` ) ( )
110
+
111
+ const script = [ ] . slice . call (
112
+ document . body . querySelectorAll ( 'article>script' ) )
113
+ . filter ( script => ! / t e m p l a t e / . test ( script . type )
114
+ ) [ 0 ]
115
+
116
+ CACHE . vm = script && script . remove ( )
117
+ ? new Function ( `return ${ script . innerText . trim ( ) } ` ) ( )
115
118
: new Vue ( { el : 'main' } ) // eslint-disable-line
119
+
116
120
CACHE . vm && CACHE . vm . $nextTick ( _ => event . scrollActiveSidebar ( ) )
117
121
}
118
122
if ( OPTIONS . auto2top ) setTimeout ( ( ) => event . scroll2Top ( OPTIONS . auto2top ) , 0 )
You can’t perform that action at this time.
0 commit comments