File tree Expand file tree Collapse file tree 2 files changed +17
-2
lines changed
apps/chrome-extension/src Expand file tree Collapse file tree 2 files changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -155,6 +155,10 @@ const initButtons = (): void => {
155155 right,
156156 bottom : startBottom + 2 * itemHeight ,
157157 } ,
158+ {
159+ right,
160+ bottom : startBottom + 3 * itemHeight ,
161+ } ,
158162 ]
159163 }
160164
Original file line number Diff line number Diff line change @@ -95,8 +95,8 @@ const main = async () => {
9595
9696 previewWindow . document . title = 'Markdown Preview'
9797
98- // Wait until the new window’s document is ready
99- previewWindow . onload = ( ) => {
98+ // prepare markdown preview for document
99+ const writeViewContent = ( ) => {
100100 const doc = previewWindow . document
101101
102102 const style = doc . createElement ( 'style' )
@@ -127,6 +127,17 @@ const main = async () => {
127127 doc . body . appendChild ( pre )
128128 }
129129
130+ if (
131+ previewWindow . document . readyState === 'complete' ||
132+ document . readyState === 'interactive'
133+ ) {
134+ writeViewContent ( )
135+ } else {
136+ previewWindow . onload = ( ) => {
137+ writeViewContent ( )
138+ }
139+ }
140+
130141 if ( tokens . length > 0 ) {
131142 const isSuccess = await makePublicUrlEffective (
132143 Object . fromEntries ( tokens ) as Record < string , string > ,
You can’t perform that action at this time.
0 commit comments