You need to be logged in to post in the forum - Log In

An active JCE Pro Subscription is required to post in the forum - Buy a Subscription

Support is currently Offline

Official support hours:
Monday To Friday
From 09:00 To 17:00 Europe/London (BST)

Please post your question in the Forum and we will get back to you as soon as we can.

  Friday, 16 July 2021
  2 Replies
  757 Visits
Hi

I have the problem with jce editor to show the logo image with the following link:
{sitepath}/images/web4/logo.jpg

With the ArkEditor it was possible.

Is it possible. Because inside RSform the absolute url is not working while generating a pdf from form.
Bildschirmfoto 2021-07-16 um 12.55.24.png Bildschirmfoto 2021-07-16 um 12.59.26.png

Is there any work around?
Many thx
Nadine
more than a month ago
·
#108325
Accepted Answer
There is nothing to prevent you from adding {sitepath} in the URL, but the image won't display in the editor when you do, as the URL would be invalid.

A workaround coul be the following:

Create a file called editor.js in media/jce/js and add the following:


(function () {
tinyMCE.onAddEditor.add(function (mgr, ed) {
ed.onPreInit.add(function () {
ed.parser.addAttributeFilter('src', function (nodes, name) {
var i = nodes.length, node;

while (i--) {
node = nodes[i];

if (node.name != 'img') {
continue;
}

var src = node.attr('src');

if (!src) {
continue;
}

if (src.indexOf('{sitepath}') !== 0) {
continue;
}

var orig = src.substr(11);

node.attr('src', orig);
node.attr('data-mce-src', src);
}
});
});
});
})();


This will allow the image to display correctly in the editor, and keep the {sitepath} "variable". This will not work however if you update the image using the Image Manager after you have inserted it.

Just because you're not paranoid doesn't mean everybody isn't out to get you.

more than a month ago
·
#108325
Accepted Answer
There is nothing to prevent you from adding {sitepath} in the URL, but the image won't display in the editor when you do, as the URL would be invalid.

A workaround coul be the following:

Create a file called editor.js in media/jce/js and add the following:


(function () {
tinyMCE.onAddEditor.add(function (mgr, ed) {
ed.onPreInit.add(function () {
ed.parser.addAttributeFilter('src', function (nodes, name) {
var i = nodes.length, node;

while (i--) {
node = nodes[i];

if (node.name != 'img') {
continue;
}

var src = node.attr('src');

if (!src) {
continue;
}

if (src.indexOf('{sitepath}') !== 0) {
continue;
}

var orig = src.substr(11);

node.attr('src', orig);
node.attr('data-mce-src', src);
}
});
});
});
})();


This will allow the image to display correctly in the editor, and keep the {sitepath} "variable". This will not work however if you update the image using the Image Manager after you have inserted it.

Just because you're not paranoid doesn't mean everybody isn't out to get you.

more than a month ago
·
#108338
Quite perfect. Thank you!
web4studio selected the reply #108325 as the answer for this post — 1 month ago
  • Page :
  • 1
There are no replies made for this post yet.
Be one of the first to reply to this post!