File tree Expand file tree Collapse file tree
src/editors/sharedComponents/TinyMceWidget Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -124,6 +124,8 @@ export const replaceStaticWithAsset = ({
124124
125125 // Check if this is a direct /static/filename.ext pattern (should be converted)
126126 // vs /static/images/filename.ext pattern (should NOT be converted)
127+ // /static/images/ are direct links to images stored in static, not course assets
128+ // we have dummy images there for course content that should not be converted to assets
127129 const isDirectStaticFile = ( isStatic || assetSrc . startsWith ( '/asset' ) ) && ! assetSrc . substring ( 8 ) . includes ( 'images/' ) ;
128130
129131 const staticName = assetSrc . substring ( 8 ) ;
@@ -370,12 +372,18 @@ export const setupCustomBehavior = ({
370372 editor . on ( 'ExecCommand' , /* istanbul ignore next */ ( e ) => {
371373 if ( editorType === 'text' && e . command === 'mceFocus' ) {
372374 const initialContent = editor . getContent ( ) ;
373- // @ts -ignore Some parameters like 'lmsEndpointUrl' were missing here. Fix me?
374375 const newContent = replaceStaticWithAsset ( {
375376 initialContent,
377+ editorType,
378+ lmsEndpointUrl,
376379 learningContextId,
377380 } ) ;
378- if ( newContent ) { editor . setContent ( newContent ) ; }
381+ if ( newContent ) {
382+ // Use setTimeout to ensure the update happens after current execution
383+ setTimeout ( ( ) => {
384+ editor . setContent ( newContent ) ;
385+ } , 0 ) ;
386+ }
379387 }
380388 if ( e . command === 'RemoveFormat' ) {
381389 editor . formatter . remove ( 'blockquote' ) ;
You can’t perform that action at this time.
0 commit comments