library icon indicating copy to clipboard operation
library copied to clipboard

Links on images in Google Docs

Open thomasoide opened this issue 5 years ago • 4 comments

Does Library recognize and render links that are applied to images within Google Docs? I did some testing and noticed links attached to images were stripped after being rendered in Library.

Is there a workaround for this or did I miss something in the docs? Just curious.

thomasoide avatar Jul 30 '19 22:07 thomasoide

Hey @thomasoide, thanks for flagging this. I think this is a bug in the interaction between Library's formatting logic and exported HTML from the Google Drive API. We should investigate how the links are being removed and resolve that to fully support links around images.

In the meantime, Library does have a power user feature that could function as a workaround. It enables the injection of raw HTML from a Google Doc inside <%- %> brackets which would work around this for now, but it's not enabled by default and requires an environment variable to activate.

isaacwhite avatar Jul 31 '19 14:07 isaacwhite

I did some digging in the Google Drive API and this appears to be a bug on their end. The HTML in the response from the API is missing links on images, though the problem does not seem to occur for other MIME types that support links.

alexwgraves avatar Oct 22 '19 03:10 alexwgraves

I've gone ahead and filed a bug report with google here - give it a star if you can!


@leranjun gave thorough steps to reproduce in #287 (closed as dupe):

Context (Environment)

An installation of Library without too much customisation. (I know I'm being vague here, but I think the context should be irrelevant XD)

Expected Behavior

Clicking on an image with a link assigned should take me to the linked site.

Actual Behavior

It does not.

In Google Docs:

Rendered DOM in Library: image

No <a> tags at all.

To Reproduce

  1. Add an image to a Google Doc.
  2. Add a link to the image by selecting the image and going to Insert -> Link.
  3. Click on the image in Google Docs. It should display a pop up to the web page as above.
  4. Click on the image in Library. Nothing happens.

afischer avatar Aug 16 '21 14:08 afischer

Didn't notice there was already an issue! 😄

A temporary workaround I'm using is just wrapping the image in an <a> tag manually, but that requires the inline code feature to be turned on.

rakuzen25 avatar Aug 16 '21 15:08 rakuzen25