FIX: Uploads cannot be mapped due to the cook-text's element attr being null (PR #10136)


@eviltrout The cook-text component will always fail to resolve upload URLs because the tagName is always “”

const CookText = Component.extend({
  tagName: "",
  cooked: null,


I suspect this started happening after this commit:

@romanrizzi can you explain a little more? In particular I’m not sure why a missing <div> would cause uploads not to resolve?

I just noticed that I linked the wrong commit, sorry. I was talking about this one:

To resolve the upload’s URL, we pass this.element to the module:

next(() =>
          .resolveAllShortUrls(ajax, this.siteSettings, this.element)

this.element is always null because we explicitly set tagName to be "" by default. It wasn’t a problem before the commit I linked because we used to search the whole document if there was no element.

If we keep this default, the cook-text component will always fail to resolve uploads unless a tagName gets passed to it. IMO, this could lead to unexpected behavior. We should set a different default for this component or fallback to searching the whole document as we used to.

Maybe we should remove tagName: "" from the cook-text component? Now that I look at my PR ( it makes no sense for it to be tagless by default because it won’t work… :grimacing:

If the assumption is we need a tag we should add it back.

Removing the tagName: "" also does the trick. It also solves the issue of manually having to set it every time the component is called. It seems better than searching the whole document. What do you think, @eviltrout?

Yes that’s what I was suggesting, we add the div back by removing tagName.

Oh, I thought you were talking about searching the whole document by default. I’ll do that then!

:+1: (as long as there are no CSS issues :stuck_out_tongue:)