TinyMce + Ajax File Manager + Codeigniter = Little Problem - browser

OK, I'm using the following:
TinyMCE, CodeIgniter, and the TinyMCE Ajax File Manager. I can upload correctly and it looks pretty good. However, when I view the HTML (from TinyMCE), this is what I get.
<img src="../../../data/page/verde_enfemera.jpg" alt="" />
What I need to be getting is the following:
<img src="http://localhost/http/data/page/verde_enfemera.jpg" alt="" />
Can someone help?
EDIT: I changed the code in the HTML editor of Tinymce, then I saved it. When I re-opened it, the code was reverted back to the original "../.../../data", etc. please, help, someone.

insert convert_urls : false

Change the "relative_urls : true" to "relative_urls : false" under the options for tinymce. I'm a dummy.

Force TinyMCE to use absolute urls instead of relative urls by setting relative_urls, remove_script_host and convert_urls to false in the tinymce.init like this:
tinymce.init({
...
...
relative_urls : false,
remove_script_host : false,
convert_urls : false,
...
...
});

Related

Local images no loading on React

When i'm trying to display an image <img src = {require(path)}/> I dont know why, i dont get that images when i start the react app, althogh my partner on his computer can see the images. And I have deleted and installed all from his files.
The images on browser appears as <img src = [Object Module]/>. I've done some research, and it seems to be some problem with webpack or url-loader, but i dont understand why on my computers isnt working and in my parnert is.
If someone have an idea. Please help.
Thank you.
Try to import the image first like this:
import image from '../image.jpg'
const App = () => {
return (
<img src={image} alt='image' />
)
}
You might wanna wrap the src value in braces
<img src={require(path)} />

Why is jbox('Image' no longer working as documented?

I have upgraded my version of jBox from "old, 2016ish" to 0.4.9 today and checked if my code was still working - and noticed that Image seems to behave differently now. Investigating this in more detail I have build this fiddle which uses essentially the same code as Stephan's sample (plus a bit of harmless CSS) and still fails - so if even Stephan's example does not work I believe there must a bug in jBox, not in my code...
Fiddle: here
HTML:
<img src="https://stephanwagner.me/img/jBox/demo-img/CIMG4778_small.jpg" alt="">
<img src="https://stephanwagner.me/img/jBox/demo-img/CIMG4547_small.jpg" alt="">
JS:
new jBox('Image');
BTW, I have also experimented with $(function(){new jBox("Image");});but that did not help.
Remember to initialise jBox when your DOM is ready: https://jsfiddle.net/StephanWagner/q8cv1Lqg/
$(document).ready(function() {
new jBox("Image");
});
It turned out I had not loaded plugins/Image/jBox.Image.css and plugins/Image/jBox.Image.js

fixed urls on polymer

I'm working with polymer and I'm testing all in my local environment and all is working as expected, but the problem is when I'll move it into production, where the url shouldn't be the same as in my local. In node.js I can set it via the config.json file and catch it with app.get('config') or something like that, but in polymer I cant get it, and the only chance I have is to create another endpoint with all the config.json config file, but, and here is the best part, I should hardcode this url in polymer!! (so annoying). There is some way or library or component or something that I'm missing ?
Thanks in advance guys! StackOverflow and the users helped my a lot!
UPDATE
The thing is that I'm using custom elements (because I had handlebars too and there is a little problem with the {{}}) so, in the custom elements that I created I have this (for example in the core-ajax call):
<core-ajax id="login" auto="false" method="POST" contentType="application/json" url="/app/middle/login" ....></core-ajax>
as you can see the url is a little bit hardcoded, I want to use something like this (this is what I have on the node.js endpoint application):
router.post(endpoint.login, function (req, res) {
and I want to got something like that over polymer
<core-ajax id="login" auto="false" method="POST" contentType="application/json" url="{{login}}" ... ></core-ajax>
<script>
Polymer('log-form', {
login: endpoint.login,
ready: function () {
....
})
});
</script>
I'ts more clear now? I'm not so strong on english language.
Thanks Guys, for all!

Angular.JS + Jade = angular not processing jade's embedding iframe

So I am trying to embed a video using jade and angular.js. I try using the following code in jade, but angular didn't process it, while when i type p {{video.updated_time}} there is no problem, but the following code does not work
iframe(ng-src="{{video.embedLink}}")
I also tried writing an angular directive. This is the code of the directive
app.directive('embedDirective', function() {
return {
restrict: 'A',
template: '<div style="height:315px;width:560px;"><iframe class="video" style="overflow:hidden;height:100%;width:100%" width="100%" height="100%" src="{{url}}" frameborder="0" allowfullscreen></iframe></div>'
};
});
And I use this in my jade file: div(embed-directive, url="video.embedLink") . None of the solutions seem to work for me. Only difference is that when I use a directive, no error for failed embed processing is shown in the console, but the src in the iframe is empty. No brackets no equation mark, just src in the middle of the iframe. Also in the iframe there seem to be html, head and body tags, which DO NOT exist in my directive. I am pretty confused
It seems like angular is trying to protect the application from foreign link, therefore one will need to 'trustify' a link. This is what I found the easiest. Simply add this function in the controller
$scope.trustSrc = function(src) {
return $sce.trustAsResourceUrl(src);
}
and then this is how one should use a <iframe></iframe> with jade
iframe(ng-src="{{trustSrc(video.embedLink)}}", src="", widht="560", height="315", frameborder="0", allowfullscreen)
Of course, $sce should be in the controller dependencies.

Jade-lang add manifest file

I would like to know how to add the manifest file to node.js site with jade-lang and express. I found this as an issue 239 in github. My question is how can I add some data into the buffer without while we wait for the resolution of the issue.
Thank's!
There's a simple way to do this in jade:
Just try this
html(manifest=_condition_ ? "cache.manifest" : undefined)
This code checks if condition is true. If it is, manifest is set to "cache.manifest". Otherwise it'll be set to undefined and dropped.
I'm going to need this in one of my projects soon, so I was curious to give it a try. There is effectively a problem if you try to do it in a single file:
!!! 5
if useManifest
html(lang="en", manifest="cache.manifest")
else
html(lang="en")
head
title sample title
body
p some content...
This renders a messed up HTML. However, the following seems to work just fine (it's definitely a workaround):
In routes\index.js :
exports.index = function(req, res){
res.render('testJade', { layout: false, useManifest: true })
};
In views\testJadeInclude.jade:
!!!5
if useManifest
html(lang="en", manifest="cache.manifest")
block content
else
html(lang="en")
block content
And finally, in views\testJade.jade:
include testJadeInclude
block append content
head
title sample title
body
p some content
Then based on whatever you wish (such as if the client is a mobile browser, or whatever), you set useManifest to true or false.
And I just tested another possibility, which is kind of the other way around. Instead of including the doctype and html tag in your content file (via a block append), you include the content file in the doctype-html file, so it looks like this:
!!! 5
if useManifest
html(lang="en", manifest="cache.manifest")
include contentFile
else
html(lang="en")
include contentFile

Resources