Skip to content
Grav 2.0 is officially stable. Read the announcement →

Community guidelines

Please keep discussions civil and on-topic. Repeated violations may lead to a temporary ban.

Plugins

Plugin tinymce-editor - image linking

plugins

Started by Markus 6 years ago · 2 replies · 940 views
6 years ago

Hi all,
for maintaining images I use a folder as suggested in https://learn.getgrav.org/16/content/image-linking
-> user/pages/images
Within this folder is an image test.jpg. If I reference it in tinymce like it is defined in the former linked learning-section (using absolute links) it is done by
/images/test.jpg
In frontend, this picture is shown properly - but not within tinymce. To show it in tinymce, the link has to be set to
/grav-admin/user/pages/images/test.jpg
which - of course - does not work in frontend.

Is it possible to define a base-url for tinymce to add the missing /grav-admin/user/pages for tinymce but disregarding it in frontend?

I took a look at https://www.tiny.cloud/docs/configure/integration-and-setup/#base_url and adapted it to
base_url: 'http://localhost/grav-admin/user/pages'
within tinymce-editor.yaml but it does not work. Neither the url within tinymce is affected, nor the frontend-url of this image.

Thanks a lot for some hints,

Markus

last edited 06/23/20 by Markus
6 years ago

Hi @pamtbaau,
thank your for the links - shame on me, I did not have a look there... Well, I tested tinymce with the supposed development version 1.3.0, where in changelog it's said:

v1.3.0

XX-09-2019

    • Deprecated the semi-absolute media path handling in favor of fully relative paths - previously inserted media will keep working

So I changed the url to my image from an absolute
/images/test.jpg
to a directory relative
../images/test.jpg
and it works in tinymce and in frontend. So far so good, but the downside is, that you will have to correct this image-url if you move the page in which the image is implemented. Therefor I would prefer absolute urls. Besides absolute urls are easier for editors to write, because you always have the same path - it does not matter at which level your page is. Perhaps there is a possibility to use base_url within tinymce - but to evaluate this I don't have the knowledge needed, I think.

cc: @newbthenewbd

last edited 06/23/20 by Markus

Suggested topics

Topic Participants Replies Views Activity
Plugins · by Rene, 1 week ago
2 47 1 week ago
Plugins · by Xavier, 4 weeks ago
2 56 4 weeks ago
Plugins · by Luka Prinčič, 7 years ago
3 1182 1 month ago
Plugins · by Sebastian van de Meer, 1 month ago
1 50 1 month ago
Plugins · by PIERROT Alain, 2 months ago
3 74 2 months ago