File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -44,6 +44,7 @@ const createRichEditor = ({
4444 isEmbedded = false ,
4545 mentionSearch = undefined ,
4646 openLink = undefined ,
47+ noLazyImages = false ,
4748} = { } ) => {
4849 return new Editor ( {
4950 editorProps,
@@ -54,6 +55,7 @@ const createRichEditor = ({
5455 isEmbedded,
5556 mentionSearch,
5657 openLink,
58+ noLazyImages,
5759 } ) ,
5860 FocusTrap ,
5961 ...extensions ,
Original file line number Diff line number Diff line change @@ -219,6 +219,10 @@ export default defineComponent({
219219 type: Boolean ,
220220 default: false ,
221221 },
222+ noLazyImages: {
223+ type: Boolean ,
224+ default: false ,
225+ },
222226 },
223227
224228 setup (props ) {
@@ -255,6 +259,7 @@ export default defineComponent({
255259 isEmbedded: props .isEmbedded ,
256260 mentionSearch,
257261 openLink: openLinkHandler .openLink ,
262+ noLazyImages: props .noLazyImages ,
258263 })
259264 : createPlainEditor ({ language, extensions })
260265 provideEditor (editor)
Original file line number Diff line number Diff line change @@ -79,6 +79,10 @@ export default {
7979 type: Boolean ,
8080 default: true ,
8181 },
82+ noLazyImages: {
83+ type: Boolean ,
84+ default: false ,
85+ },
8286 },
8387 emits: [' update:content' ],
8488
@@ -88,6 +92,7 @@ export default {
8892 RichText .configure ({
8993 extensions: [UndoRedo],
9094 openLink: openLinkHandler .openLink ,
95+ noLazyImages: props .noLazyImages ,
9196 }),
9297 FocusTrap,
9398 ]
Original file line number Diff line number Diff line change @@ -251,6 +251,7 @@ window.OCA.Text.createEditor = async function ({
251251 props : null ,
252252 } ,
253253 menubarLinkCustomAction = undefined ,
254+ noLazyImages = false ,
254255
255256 onCreate = ( { markdown } ) => { } ,
256257 onLoaded = ( ) => { } ,
@@ -324,6 +325,7 @@ window.OCA.Text.createEditor = async function ({
324325 mime : 'text/markdown' ,
325326 active : true ,
326327 autofocus,
328+ noLazyImages,
327329 } ,
328330 scopedSlots,
329331 } )
@@ -334,6 +336,7 @@ window.OCA.Text.createEditor = async function ({
334336 relativePath : filePath ,
335337 shareToken,
336338 readOnly : data . readOnly ,
339+ noLazyImages,
337340 } ,
338341 scopedSlots,
339342 } )
Original file line number Diff line number Diff line change @@ -62,6 +62,7 @@ export default Extension.create({
6262 isEmbedded : false ,
6363 mentionSearch : undefined ,
6464 openLink : undefined ,
65+ noLazyImages : false ,
6566 }
6667 } ,
6768
@@ -96,8 +97,8 @@ export default Extension.create({
9697 isEmbedded : this . options . isEmbedded ,
9798 } ) ,
9899 Underline ,
99- Image ,
100- ImageInline ,
100+ Image . configure ( { noLazyImages : this . options . noLazyImages } ) ,
101+ ImageInline . configure ( { noLazyImages : this . options . noLazyImages } ) ,
101102 Dropcursor . configure ( {
102103 color : 'var(--color-primary-element)' ,
103104 width : 2 ,
Original file line number Diff line number Diff line change @@ -49,6 +49,7 @@ const Image = TiptapImage.extend({
4949 addOptions ( ) {
5050 return {
5151 ...this . parent ?. ( ) ,
52+ noLazyImages : false ,
5253 }
5354 } ,
5455
Original file line number Diff line number Diff line change @@ -44,6 +44,7 @@ const ImageInline = TiptapImage.extend({
4444 addOptions ( ) {
4545 return {
4646 ...this . parent ?. ( ) ,
47+ noLazyImages : false ,
4748 inline : true ,
4849 }
4950 } ,
Original file line number Diff line number Diff line change @@ -273,6 +273,12 @@ export default {
273273 this .loadAttachmentMetadata ()
274274 this .setupResizeObserver ()
275275
276+ // Load image directly if lazy loading is disabled
277+ if (this .extension ? .options ? .noLazyImages === true ) {
278+ this .loadPreview ().catch (this .onImageLoadFailure )
279+ return
280+ }
281+
276282 this .$nextTick (() => {
277283 // nextTick is necessary, intersection detection is slightly unreliable without it
278284 const options = {
You can’t perform that action at this time.
0 commit comments