newbthenewbd / grav-plugin-tinymce-editor

TinyMCE Editor Integration Plugin for Grav
Other
60 stars 10 forks source link

Incorrect Image Path on Non-Routable Modular Page Component #10

Closed thekenshow closed 6 years ago

thekenshow commented 6 years ago

I have a modular page with non-routable (e.g., 06._mycontent) components. When I click a page media image to insert it, TinyMCE populates the relative path of "_mycontent/my-attached-image.png". That displays in TinyMCE but fails to load on the rendered site page.

The Markdown version of this operation inserts "" in the editing field but renders the absolute path "/user/pages/01.home/06._mycontent/my-attached-image.png". Is there a way for TinyMCE to determine the required path type?

newbthenewbd commented 6 years ago

Indeed, overlooked the modular pages. Will push a fix soon.

Thanks for reporting!

newbthenewbd commented 6 years ago

One would've thought it's easy to detect modular pages from within JavaScript... Fixed in v1.1.3, hopefully.

thekenshow commented 6 years ago

Thanks for the quick turnaround! But, after running bin/gpm update the TinyMCE editor no longer appears at all in the editing field. Tested on latest Firefox and Safari with Grav v1.3.10 + Admin v1.6.7. The Plugins page shows TinyMCE Editor Integration v1.1.3 enabled. Tried:

Still no sign of TinyMCE editor.

Firefox Console shows variation of this when loading an editing page:

TypeError: $(...).attr(...).contains is not a function _mycontent:297:145

Reverting to 1.1.2 restores normal operation.

newbthenewbd commented 6 years ago

Ouch. Apparently contains() isn't nearly as popular as I thought. Fixin' ASAP.

newbthenewbd commented 6 years ago

Fixed in v1.1.4.

thekenshow commented 6 years ago

I updated to v1.1.5, cleared the cache, and page media insert function still produces the non-routable relative path. For example, my rendered page shows something like:

<img src="_mycontent/my-attached-image.png" alt="" width="633" height="356">

No JS errors of any kind.

newbthenewbd commented 6 years ago

Fixed in v1.1.6, was probably caused by the theme not using the word "modular" in the modular template name. Better it work right this time, otherwise I probably won't be able to provide more fixes in anyhow similarly timely manner.

thekenshow commented 6 years ago

Thanks - I appreciate all your quick responses to this. I tested 1.1.6 and it works. You're right about the naming of my modular template being different.

BTW, Grav Admin & bin/gpm are not showing your 1.1.6 update, so I had to download it manually.

Tamriel commented 6 years ago

I have the same problem, with the current version. The image is not shown when using the template partials/blog_item.html.twig, which in turns is rendered as part of modular/blog.html.twig.