tag:blogger.com,1999:blog-10004711011863353532024-03-05T18:43:25.788+01:00The New TerritoryAlfonsohttp://www.blogger.com/profile/18445103211507263059noreply@blogger.comBlogger182125tag:blogger.com,1999:blog-1000471101186335353.post-65611734588927370072020-08-30T20:01:00.001+02:002020-08-30T20:01:55.583+02:00Modifying the generated element in SimpleUploads.<p style="text-align: left;">I think that I've already written about this type of requests, but as I've not been able to quickly find it, it deserved a simple post.<br /><br />Request: after uploading an image with SimpleUploads, wrap it in a link element for use with any type of effect like ColorBox. eg: <br /><br /></p><code><a href="filepath" class="colorbox" target="_blank"><img src="filepath"/></a></code><p><br />This is achieved using the 'simpleuploads.finishedUpload' event, add in your page this code (adjust it according to your needs: </p>
<pre><code>CKEDITOR.on('instanceReady', function(e) {
// the real listener
e.editor.on( 'simpleuploads.finishedUpload' , function(ev) {
var editor = ev.editor;
// CKEditor.dom.element
var element = ev.data.element;
//console.log(element)
var a = document.createElement('a');
a.href = element.getAttribute('src');
a.className = 'colorbox';
a.target = '_blank';
// create a CKEditor.dom.element
var ckLink = new CKEDITOR.dom.element(a);
// replace the image with the link
ckLink.replace(element);
// insert the link into the image
element.appendTo(ckLink);
});
});
</code></pre>Alfonsohttp://www.blogger.com/profile/18445103211507263059noreply@blogger.com1tag:blogger.com,1999:blog-1000471101186335353.post-49045117467767388252018-02-25T22:39:00.001+01:002018-02-25T22:41:28.973+01:00Adding a CKEditor plugin to DotNetNuke 8.0.4<div class="separator" style="clear: both; text-align: center;">
</div>
<div style="margin-left: 1em; margin-right: 1em;">
<br /></div>
<br />
This is a little visual walkthrough to explain how to add a custom plugin to a DNN website. It might not be the optimal way, but it's simple and it works.<br />
<br />
First, you have to extract the plugin to the <span style="font-family: "courier new" , "courier" , monospace;">".\Providers\HtmlEditorProviders\DNNConnect.CKE\js\ckeditor\4.5.3\plugins\"</span> folder, just like it's usually explained for any plugin.<br />
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
Now we must instruct DNN to load it. The js settings come from DNN itself, so go to Site Settings<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhUe_Djl5JwBqKLcujXCAASwm7RWhzfSvAb0XL_yg9LUWNgIUBPAWjcLGfkN0mdgkXr-VVp6t7woweoRWFvm8hXj2towaHIGtG_zQLaRbeltNKr6pgA-2drXeU6wngToMUn4k4PVdnPXd0/s1600/site+settings.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="297" data-original-width="451" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhUe_Djl5JwBqKLcujXCAASwm7RWhzfSvAb0XL_yg9LUWNgIUBPAWjcLGfkN0mdgkXr-VVp6t7woweoRWFvm8hXj2towaHIGtG_zQLaRbeltNKr6pgA-2drXeU6wngToMUn4k4PVdnPXd0/s1600/site+settings.png" /></a></div>
<br />
Now open Site Behavior, More, Open HTML Editor Manager<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjXspgPrXuw_D92jDCGECmx31Cig6EOXQ5NT_635tj7_t1NPOVnSCWWKLysTsknfp_niJVsZJkQwKM2_JJ_hbY1RHvih3jLcTQtkIRI5mwu4gLoBqte4Crascbei0Y7qaSGvDi5kzx0SeE/s1600/site+behavior.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="251" data-original-width="567" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjXspgPrXuw_D92jDCGECmx31Cig6EOXQ5NT_635tj7_t1NPOVnSCWWKLysTsknfp_niJVsZJkQwKM2_JJ_hbY1RHvih3jLcTQtkIRI5mwu4gLoBqte4Crascbei0Y7qaSGvDi5kzx0SeE/s1600/site+behavior.png" /> </a></div>
<div class="separator" style="clear: both; text-align: left;">
Now open the Editor settings tab</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjAg8G_Bp39_0u8c8aKVf5mYbh3uvbgaV5hBhU8atnHYmzxLey26iqYMk4d_7xR1OnbfhGPFwp7QD44H7H7VmCAH7vHlb_6F_wIJMMJA_CzNduSi0qkY6L2LvM-OWJkwjDtjm5iwHFMia4/s1600/editor+settings.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="385" data-original-width="567" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjAg8G_Bp39_0u8c8aKVf5mYbh3uvbgaV5hBhU8atnHYmzxLey26iqYMk4d_7xR1OnbfhGPFwp7QD44H7H7VmCAH7vHlb_6F_wIJMMJA_CzNduSi0qkY6L2LvM-OWJkwjDtjm5iwHFMia4/s1600/editor+settings.png" /> </a></div>
<div class="separator" style="clear: both; text-align: left;">
Scroll down to the ExtraPlugins field, </div>
<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhhHw8Z7-mgkhL6xEBA-8iDcppwefwUXKFNHGJKz3P-4aKkMTEr5zJ5jDnyEzN9mQ08I9HP1liE5Wrrcx540sHbzysxn3YVpp4C0By7ALZ1XZ8bj4wrR_sou86bVYdtaYq9ObLRmZLepw0/s1600/extra+plugins.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="594" data-original-width="536" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhhHw8Z7-mgkhL6xEBA-8iDcppwefwUXKFNHGJKz3P-4aKkMTEr5zJ5jDnyEzN9mQ08I9HP1liE5Wrrcx540sHbzysxn3YVpp4C0By7ALZ1XZ8bj4wrR_sou86bVYdtaYq9ObLRmZLepw0/s1600/extra+plugins.png" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
add the new plugin and save the changes<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiwS7keKqDKkcShMwOFFd6ZV0GIZXmc2CaOh1S9qsinMp-o3CFBco_HtWJx4QOxMDDet5gaiDBBcnqe8uAxDlIJBd2OGHZhieVGQroDQRXPYrJWtJu79_TY-gOlNys2bqi3RzaAkZ516EM/s1600/save+settings.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="432" data-original-width="524" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiwS7keKqDKkcShMwOFFd6ZV0GIZXmc2CaOh1S9qsinMp-o3CFBco_HtWJx4QOxMDDet5gaiDBBcnqe8uAxDlIJBd2OGHZhieVGQroDQRXPYrJWtJu79_TY-gOlNys2bqi3RzaAkZ516EM/s1600/save+settings.png" /></a></div>
<br />
Now the plugin itself is enabled, although the toolbar doesn't show any new button because it uses the customized toolbars from DNN. I haven't been able to find out if there's a way to do this next step better, but what I've found that works is to edit "<span style="font-family: "courier new" , "courier" , monospace;">.\Portals\0\Dnn.CKToolbarButtons.xml</span>" and then add your button(s) following the pattern<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgUvexpxfDf4po-Xh87t1BVvMeVPy7VaBpsEtxouzypWDx32QLViQjWKmc_HYXFDDXb0_SpLxb8RvLxvbOTsjlzfKQY8DyXZrBvevA77UD8-eM3tNrzdXbcRhC0BRJ8JcNLHZF9zxmKDj4/s1600/toolbar+button.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="205" data-original-width="442" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgUvexpxfDf4po-Xh87t1BVvMeVPy7VaBpsEtxouzypWDx32QLViQjWKmc_HYXFDDXb0_SpLxb8RvLxvbOTsjlzfKQY8DyXZrBvevA77UD8-eM3tNrzdXbcRhC0BRJ8JcNLHZF9zxmKDj4/s1600/toolbar+button.png" /></a></div>
In the ToolbarName put the name of the command that you want to use (it should be the CamelCase name of the plugin, but there might be cases where a plugin has more than one plugin, so check that)<br />
For the ToolbarIcon you can either copy it to the Images folder or reference it like I've done directly from the plugin folder<br />
<br />
<br />
<pre> <toolbarbutton>
<toolbarname>ImageMaps</toolbarname>
<toolbaricon>../plugins/imagemaps/icon.png</toolbaricon>
</toolbarbutton></pre>
<br />
Now load the Custom Toolbars tab from in the Editor settings and you should have the new button available for you<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhWOFDZSHYN6Mgxm5jefgKUoYEcVsulbzyk8plbkpcJcjHjc8E5eO-Tc313tPXwp0d8QXqUiWys8l-QkLpWyqx5Te3_1ghK34LYUWaUZAXkVW96CnsjfQ72gk1lN806XYd09bVuiiOnCC0/s1600/toolbar.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="733" data-original-width="530" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhWOFDZSHYN6Mgxm5jefgKUoYEcVsulbzyk8plbkpcJcjHjc8E5eO-Tc313tPXwp0d8QXqUiWys8l-QkLpWyqx5Te3_1ghK34LYUWaUZAXkVW96CnsjfQ72gk1lN806XYd09bVuiiOnCC0/s1600/toolbar.png" /></a></div>
Put the button wherever you think fits better and save it.<br />
Now when you load again the editor, the plugin should be ready to use<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh9HQle8UEblEAy9y7xyC9PTc3KFaXQixEj_XK9PgnVuNjo7MjnS329fOy0spOy6ueyigtjbxL5EzaEVgM_RswWGIFaQzzRsgYK13c067kKftXFtRIsHNmVHLuIV2yao9h6WcYLijZUT9s/s1600/editor.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="273" data-original-width="567" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh9HQle8UEblEAy9y7xyC9PTc3KFaXQixEj_XK9PgnVuNjo7MjnS329fOy0spOy6ueyigtjbxL5EzaEVgM_RswWGIFaQzzRsgYK13c067kKftXFtRIsHNmVHLuIV2yao9h6WcYLijZUT9s/s1600/editor.png" /></a></div>
I hope that this is useful for anyone that is interested.<br />
<br />Alfonsohttp://www.blogger.com/profile/18445103211507263059noreply@blogger.com0tag:blogger.com,1999:blog-1000471101186335353.post-77493571461494449912017-05-08T22:25:00.000+02:002017-05-08T22:25:02.118+02:00Mixing SimpleUploads with other drag&drop scriptsIn the SimpleUploads plugin, one of the features is to provide a way for the users to add files to their content by simply dragging them from their desktop. Of course, there might be more than one editor on the page and so the files are accepted only when they are dropped on an editor.<br />
<br />
But there's a little problem: if the user drops the file outside the editor they may lose their current content because that image is loaded instead (yes, you can use autosave and also prompt them with onBeforeUnload), so in order to prevent data loss or the delay and surprise about having to go back and restore last saved draft, I implemented a little check that rejects any file that it's dropped <b>outside</b> the editor.<br />
<br />
So does this fix all the problems? <br />Not of course!<br />
If you want to provide support to drag&drop in other part of the page, I'm preventing that script to work but the solution is simple:<br />
<br />
In the configuration of your CKEditor, add this extra setting:<br />
simpleuploads_allowDropOutside = true;<br />
<br />
That's all. If the that setting exists I won't touch anything outside the editor and you can keep working as usual. Alfonsohttp://www.blogger.com/profile/18445103211507263059noreply@blogger.com2tag:blogger.com,1999:blog-1000471101186335353.post-30244721041287455202017-05-05T16:22:00.000+02:002017-05-05T16:22:21.102+02:00Should you use Windows S?TL:DR:<br />
No.<br />
<br />
Ok, after clearing that up, let's talk about what's Windows S and why it has a positive value (but maybe not for you).<br />
<br />
Windows has been tied forever with back-compatibility, support for all the legacy apps and APIs that people have been using almost since Win95.<br />
<br />
Every API is an additional support burden and a potential attack vector, and so we find that despite all the years, code review, tests and whatever, new bugs always popup.<br />
<br />
So, is it really strange that Microsoft would like to close the attack surface as much as possible by allowing access only to a very limited API that removes low level calls and the ability to run any program that you get from any source?<br />
<br />
Obviously they can't do it that for most of the people right now because most of the apps use the Win32 API and so the people at their homes would reject outright to even test that Windows if they know that it won't run some app that they use.<br />
<br />
But on the other hand, there's a lot of people quite happy with their iPads and Chromebooks that doesn't run any Windows app at all and they boast how great they are because they don't get virus or malware there, and system administrators at school check the landscape and see one set of computers that are full Windows with all the extra maintenance that they might require and at the other side this restricted versions where everything is locked down, they control what's there and they know that the device won't run the traditional malware that it's sent in emails or injected through an evil ad.<br />
<br />
They are the target of this Windows S, cheap computers that can be managed easily and can run any UWP or Win32 apps distributed through the Windows Store.<br />
<br />
We know that most of the apps that people use aren't in the Store, but this might be the kind of incentive (a whole set of new computers sold to schools by the thousands) to port those apps to UWP and little by little people might found there more and more apps, and so in the future it might be possible for Microsoft to enable an optional lock down of every Windows computer so only approved apps are run there and everyone (except antivirus vendors) will be happy knowing that their computers are safer that way.<br />
<br />
Microsoft currently has to fight an uphill battle to be relevant 5-10 years from now. Most of the people now browse mostly from their phones and tablets and they have lost this first battle to have a mobile OS that people use, and if they give up completely they might end up with a very marginal part of the whole OS.<br />
<br />
So it really makes sense for them to do bold moves like this one and with the current set of existing frameworks to provide cross-platform solutions (Cordova, Electron, React Native, ...) then it wouldn't be surprising to find out that the ones that still aren't able to target UWP get proper support and everybody wins this way.<br />
<br />
<br />Alfonsohttp://www.blogger.com/profile/18445103211507263059noreply@blogger.com0tag:blogger.com,1999:blog-1000471101186335353.post-92174905920054219122017-05-02T21:07:00.001+02:002017-05-02T21:07:55.859+02:00On performance and themesI like to read about the topic of web performance, try to understand how things work and what are the correct patterns to use or avoid on the web. This means that I try to focus on using optimized javascript and css, don't include huge libraries and dead code that it isn't used.<br />
<br />
<br />
But on the other hand it's clear that there are lots of CMS like WordPress, and shops like PrestaShop, both provide support for themes, so designers use Photoshop, slice that up, and generate a ton of Javascript and CSS by picking all the libraries, components and whatever they need.<br />
<br />
There's no worry about file size, page performance or anything like that, it's just a matter of make it look nice, not make it look nice and work in an optimized way. And people prefer a nice looking site even if it takes slightly longer to load that one that has no design or is using outdated styles.<br />
<br />
Recently I looked at some page templates trying to find a nice looking one for a NGO, and after reviewing several ones, I thought that I had found a good one, but my heart felt when I found that it was created by mixing several css files that are loaded on demand and all the responsiveness is achieved with javascript that modifies the DOM and changes the css files loaded according to the resize of the window. Yes, not even a single media query rule, all done with javascript.<br />
<br />
So I threw it all away, started with a clean page and I was able to create my "design" mixing things from here and there, starting with a mobile-first approach for the first time and the outcome is a simple page with the required styles and scripts that I can keep on improving, a fraction of the size of any of those designs that I looked at.<br />
<br />
Obviously the drawback is that in order to do this I had to spent my time, so it's easy to understand why for many sites the answer is to use those kind of themes. It's just a matter of finding the one that you like, pay for it once and you're ready to go, but it would be great if the pages hosting themes could provide some help to highlight themes with good performance and correct use of the new technologies.Alfonsohttp://www.blogger.com/profile/18445103211507263059noreply@blogger.com0tag:blogger.com,1999:blog-1000471101186335353.post-76627438387516636782017-04-09T14:24:00.000+02:002017-04-09T14:24:15.430+02:00Protection against bad SSL certsAgain, trying to use Twitter to express ideas is a bad place, 140 chars is too short and the sentences might get broken.<br />
<br />
Let's start with this <a href="https://twitter.com/brynosaurus/status/850584417378725888">tweet</a> from <a href="https://twitter.com/brynosaurus">Bryan Ford</a>. It links to an article that explains how a band of attackers were able to get full control of a Brazilian bank site thanks to altering the DNS records. They created a copy of the pages and got new SSL certs (we guess that the article is wrong about those 6 month old certificates from Let's Encrypt, that doesn't make sense. They are valid only for 90 days and they could have created them in a few seconds after taking over the DNS)<br />
<br />
So losing control of DNS is really a big problem, even when they realized of the problem, they had to "fight" with NIC.br to recover control of their account and restore the proper DNS.<br />
<br />
So what are possible solutions about this problem?<br />
I think that something along HPKP (<a href="https://tools.ietf.org/html/rfc7469">HTTP Public Key Pinning</a>) is part of the answer. If everything worked correctly, the browsers would have noticed that the cert is wrong and then refused to load the page so visitors wouldn't have entered their credentials.<br />
<br />
Bryan <a href="https://blog.qualys.com/ssllabs/2016/09/06/is-http-public-key-pinning-dead">replied that HPKP has several problems</a> and as you can read, it's hardly used.<br />
So maybe the answer is not HPKP as-is now, but something developed to take into account new attacks.<br />
<br />
Nowadays getting a HTTPS cert is finally easy thanks to Let's Encrypt, but there are still other kind of certs like EV SSL that provides verification of the company that runs the website. They aren't cheap, they require time and effort to get them, so maybe they are the starting point to get extra protection, not just showing a green url bar.<br />
<br />
Let's say that all EV Certs are logged to a central repository (or multiple redundant copies), and that repository is the base for a new HPKP so it can't be abused by people trying to pin a free SSL cert that they got as soon as they took control of your server or your DNS. This new pinning would allow to protect those special sites that have worked and paid for a Cert that provides greater security to their users and the browsers would help to reach that goal.<br />
A second way to use that central repository it would be that any CA should check it before issuing a new Cert. If a company has a EV Cert issued, Why would they want now a free SSL? Have they gone bankrupt? Or maybe they aren't the one requesting the new Cert? So this could close the hole that allows any CA to issue a Cert for an attacked domain.<br />
<br />
<a href="https://twitter.com/acs_ferreira">Carlos Ferreira</a> has replied about <a href="https://ma.ttias.be/caa-checking-becomes-mandatory-ssltls-certificates/">CAA records</a>, but I fail to see how this is useful at all in the long run.<br />
<ol>
<li>The attacker doesn't have control of your server or your DNS. Then this will prevent them to get a SSL Cert, but I don't think that they could really get a Cert from any CA, maybe I'm wrong.</li>
<li>The attacker has control of your server and is able to request new SSL certs. Why would they do that? If they are in your server, then they just can use your existing cert, they don't need to add a new one or create new ones. </li>
<li>The attacker has control of your DNS. Then they can control CAA as they please and there's no protection at all. </li>
</ol>
So that leads to his other reply about watching the DNS records with a tool like DNS Spy. Yeah, that can be useful to notice an attack, but I guess that by the time they got the mail (to a different domain of course) about the modified DNS, the admin of the attacked domain might have already noticed some problems and anyway it's just trying to do damage control instead of getting protection like it would have happened if the attackers wouldn't have been able to get certs for their fake servers. So yes, watching DNS is useful but it's not the solution.<br />
<br />
There are many technologies around web security, some are old and trusted, others are proposals that didn't reach momentum for whatever reason. I'm an outsider so I can't really provide a full list of ways to get proper protection, but I feel that there are ways to get better security like promised by HPKP without risking basic sites. Alfonsohttp://www.blogger.com/profile/18445103211507263059noreply@blogger.com0tag:blogger.com,1999:blog-1000471101186335353.post-37873646066658268402016-07-03T20:27:00.000+02:002016-07-05T19:44:31.010+02:00Getting a Google Maps API KeyOn June 22th <a href="http://googlegeodevelopers.blogspot.com/2016/06/building-for-scale-updates-to-google.html">Google announced</a> that from that day on, every new implementation of the Maps API requires the usage of an <a href="https://developers.google.com/maps/documentation/javascript/get-api-key">API key</a>.<br />
<br />
This is very important for anyone that wants to use my <a href="https://alfonsoml.blogspot.com/p/googlemaps.html">Google Maps plugin for CKEditor</a>, because now you must get your key in order to use it.<br />
The basic usage of the API allows 25.000 free maps loads per day, and you can have one key for each domain that you want to use. From that point you'll have to get a paid license. This is more or less the same, they have adjusted the way that somethings are counted but the important part is that previously the free usage encouraged signing the requests with an API key but now it's a forced requirement.<br />
<br />
Getting an API key isn't too hard because the process has been streamlined and you mostly have to agree to the Terms and Conditions, you can find <a href="https://developers.google.com/maps/documentation/javascript/get-api-key">here their instructions</a>, but I'm gonna provide some screenshots so you can view how easy it is.<br />
<br />
<h3>
Step by step guide</h3>
First, go to <a data-saferedirecturl="https://www.google.com/url?hl=en&q=https://console.developers.google.com/flows/enableapi?apiid%3Dmaps_backend%26keyType%3DCLIENT_SIDE%26reusekey%3Dtrue&source=gmail&ust=1467654653381000&usg=AFQjCNF0x43o3P2C4xuz0nz9X-xXPZYu4Q" href="https://console.developers.google.com/flows/enableapi?apiid=maps_backend&keyType=CLIENT_SIDE&reusekey=true" target="_blank">https://console.developers.<wbr></wbr>google.com/flows/enableapi?<wbr></wbr>apiid=maps_backend&keyType=<wbr></wbr>CLIENT_SIDE&reusekey=true</a><br />
<br />
You'll get a screen like this:<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh1-STs1k3SR8OuUKGfyLxWoHeCrk_JTD6ivV0qtMNYHY0GcziD4MNWkl_vWqbVCZQqcabYi0TZRbWifaIg8b4a11TtzLTYDCE5wumS6N1ZmbkRxckjclv64v-SK27ypAR6o5USfvfG2ew/s1600/CreateProject.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="180" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh1-STs1k3SR8OuUKGfyLxWoHeCrk_JTD6ivV0qtMNYHY0GcziD4MNWkl_vWqbVCZQqcabYi0TZRbWifaIg8b4a11TtzLTYDCE5wumS6N1ZmbkRxckjclv64v-SK27ypAR6o5USfvfG2ew/s400/CreateProject.png" width="400" /></a></div>
As this is probably a new project you just have to click Continue.<br />
Now you'll get some notifications and progress and you'll end up with a screen similar to this one<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEifjYMurZ9gh-0LmjlA7NSq2ibW5eCLyCS5zXvEFLO6jM7UH8IVyzxZWd1lK1PzXosMFL6klQ3DNNxIU2__xOVEQkLJciq5OyLrKznjKME76haj_d2OR4ROkqxLgtaW6M04ReDKDO-25z0/s1600/credentials.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="297" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEifjYMurZ9gh-0LmjlA7NSq2ibW5eCLyCS5zXvEFLO6jM7UH8IVyzxZWd1lK1PzXosMFL6klQ3DNNxIU2__xOVEQkLJciq5OyLrKznjKME76haj_d2OR4ROkqxLgtaW6M04ReDKDO-25z0/s400/credentials.png" width="400" /></a></div>
This doesn't look right, the "You don't have permission to create an API key" message is strange, but the fact is that the "Create" button is enabled and it works, so you can define the allowed Referrer sites, or leave that blank now and adjust it later.<br />
Click "Create" and then you'll get your API key<br />
<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgh91ScDGbtKz10poX2ITdKFmEVgfkYM4mDmStNzSjY-TA3O046KqzWXuud89gYrRw2hAqzK29iqBDD1BufUBR4Eivz-HZHIHpRjs0wEIvcijw7TjB2Pnz94g0CT9hviP3UXfsfKpFRlbg/s1600/apikey.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="197" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgh91ScDGbtKz10poX2ITdKFmEVgfkYM4mDmStNzSjY-TA3O046KqzWXuud89gYrRw2hAqzK29iqBDD1BufUBR4Eivz-HZHIHpRjs0wEIvcijw7TjB2Pnz94g0CT9hviP3UXfsfKpFRlbg/s400/apikey.png" width="400" /></a></div>
Click the Copy icon at its right side and you're almost done. If you have already the Google Maps plugin, then open the CKEditor configuration file, add a new entry "<b>googleMaps_ApiKey</b>" and then assign there the value that you got:<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEilJZYd6TUugNqQOKBHCBKiguxdr-HJEhhezYZ3X7U5mKYVPalHj240LwqnXGpc6gT1nqEkptggHnPa_SEJhUhCpGfJTT08k57GzKx1Svn9I2IrANF-doaTjje3ptbJViautuMZDJYfYMk/s1600/apiconfig.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEilJZYd6TUugNqQOKBHCBKiguxdr-HJEhhezYZ3X7U5mKYVPalHj240LwqnXGpc6gT1nqEkptggHnPa_SEJhUhCpGfJTT08k57GzKx1Svn9I2IrANF-doaTjje3ptbJViautuMZDJYfYMk/s1600/apiconfig.png" /></a></div>
Now if you load CKEditor with the Google Maps plugin, the Maps dialog should work, but the static images will fail, this is because we have enabled the Google Maps API, but you need also to enable the usage of the Static Maps API with this key (and also the Street View API if you want to allow your users to use a StreetView image as the preview)<br />
<br />
So open <a data-saferedirecturl="https://www.google.com/url?hl=en&q=https://console.developers.google.com/apis/api/static_maps_backend?project%3D_&source=gmail&ust=1467654653381000&usg=AFQjCNFO9Vab3jHdWWZcJu0fwbMiNoMfKA" href="https://console.developers.google.com/apis/api/static_maps_backend?project=_" target="_blank">https://console.developers.<wbr></wbr>google.com/apis/api/static_<wbr></wbr>maps_backend?project=_</a> and this time, instead of creating a new project we will use the one that has been created previously:<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEilzHFg29KpImJU68Wcak5mWY04Q9HfBoOmjrs3VHMXWllpYMakR2njAgIA24uwrdoZ3NOHQgNe2YFVOtuH4SJmN5X3sByk6iR0RQYQVx0COwNZP3YkSTNOFlY0Hxps35k3E1HZ0mf7_QE/s1600/selectaproject.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="175" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEilzHFg29KpImJU68Wcak5mWY04Q9HfBoOmjrs3VHMXWllpYMakR2njAgIA24uwrdoZ3NOHQgNe2YFVOtuH4SJmN5X3sByk6iR0RQYQVx0COwNZP3YkSTNOFlY0Hxps35k3E1HZ0mf7_QE/s400/selectaproject.png" width="400" /></a></div>
Then click the Enable button<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhfStwbLFZUshyphenhyphenI-fpomCnL_XM8UebjgIgg82e7wxsOPek8XfWX06t3voTvk5cFXOdwmJQDm7FnmUiVGC0oAOzeOt6GAsok67IbYtyzhmKx3tVTuQkeg1-iM55lZo3vrkgsz0teDbjylyI/s1600/overview.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="178" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhfStwbLFZUshyphenhyphenI-fpomCnL_XM8UebjgIgg82e7wxsOPek8XfWX06t3voTvk5cFXOdwmJQDm7FnmUiVGC0oAOzeOt6GAsok67IbYtyzhmKx3tVTuQkeg1-iM55lZo3vrkgsz0teDbjylyI/s400/overview.png" width="400" /></a></div>
And this step is done, just repeat it for the Street View API in this link:<br />
<a data-saferedirecturl="https://www.google.com/url?hl=en&q=https://console.developers.google.com/apis/api/street_view_image_backend?project%3D_&source=gmail&ust=1467654653381000&usg=AFQjCNFx0jKKPWzQi8ZMFMzZiv5yrXZ64A" href="https://console.developers.google.com/apis/api/street_view_image_backend?project=_" target="_blank">https://console.developers.<wbr></wbr>google.com/apis/api/street_<wbr></wbr>view_image_backend?project=_</a><br />
<br />
Then the Geocoding so the searches also work in the dialog:<br />
<a data-saferedirecturl="https://www.google.com/url?hl=en&q=https://console.developers.google.com/apis/api/geocoding_backend?project%3D_&source=gmail&ust=1467825076582000&usg=AFQjCNGG1S-ttorkoWdUhWlGBFv1tIffAQ" href="https://console.developers.google.com/apis/api/geocoding_backend?project=_" target="_blank">https://console.developers.<wbr></wbr>google.com/apis/api/geocoding_<wbr></wbr>backend?project=_</a><br />
<br />
And this is over! <br />
<br />
<h3>
Summary</h3>
Please, keep in mind that these steps are the current ones as of July 2016, Google might change things or even depending on some settings on your account you might see different things, but the end goal is to get a Google Maps API key, enable also the usage of that key for the Static Maps and then put it in a googleMaps_ApiKey entry in the configuration of your CKEditor instance.<br />
<br />
<h3>
Additional notes</h3>
I think that the first time that you try to get an API key you'll get this screen:<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEirEhESAjPhIuzsnOc0Tpbrz2nk5n4l1y3j2mqQkyENYxua4Kc85WssyqfzNWJOGn_P27mUFqBRa6TDktGMhLzn03GBHRCShLWHKd5aec_4QeuTMobA7kHxaNEtxvongA_RJVLxFCNjw8A/s1600/agree.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="283" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEirEhESAjPhIuzsnOc0Tpbrz2nk5n4l1y3j2mqQkyENYxua4Kc85WssyqfzNWJOGn_P27mUFqBRa6TDktGMhLzn03GBHRCShLWHKd5aec_4QeuTMobA7kHxaNEtxvongA_RJVLxFCNjw8A/s400/agree.png" width="400" /></a></div>
and from them on when you try to get another key for a new domain, the dialog that it's used is the one that I've shown at first.<br />
<br />
Also, at the top of the screen you might get a banner to sign up for Google Cloud, but if you plan to stay within the free plan limits you don't need that.<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEivb-pfw7ltOl-Fr9yzDkks5KHOhzcw6ZUxhPPniYQLmhCRFLasKK7vOIfH2s5pOsH9kd004dz6h_J-mOOdgzOPbPolEAMiUyFmWd4qidzU14rrEWWQmgg3lvL1ovzi2_Nw_2ukDr39OXo/s1600/cloud.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="40" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEivb-pfw7ltOl-Fr9yzDkks5KHOhzcw6ZUxhPPniYQLmhCRFLasKK7vOIfH2s5pOsH9kd004dz6h_J-mOOdgzOPbPolEAMiUyFmWd4qidzU14rrEWWQmgg3lvL1ovzi2_Nw_2ukDr39OXo/s640/cloud.png" width="640" /></a></div>
<br />
<br />Alfonsohttp://www.blogger.com/profile/18445103211507263059noreply@blogger.com0tag:blogger.com,1999:blog-1000471101186335353.post-12166400551537294262016-05-23T23:37:00.003+02:002016-06-19T22:49:18.202+02:00How to generate unique file names with SimpleUploadsIf for any reason you can't change the server back-end that saves your file uploads in CKEditor and you want to prevent the overwriting of existing files with new ones that have the same file names, you can add this code to your page to generate a unique filename for each upload (adjust it to your tastes)<br />
<br />
<pre><code>CKEDITOR.on('instanceReady', function (e) {
e.editor.on('simpleuploads.startUpload', function (ev) {
var filename = ev.data.name;
//var extension = filename.match(/\.\w+$/)[0];
var newName = CKEDITOR.plugins.simpleuploads.getTimeStampId() + '_' + filename;
ev.data.name = newName;
});
});
</code></pre>
Alfonsohttp://www.blogger.com/profile/18445103211507263059noreply@blogger.com2tag:blogger.com,1999:blog-1000471101186335353.post-57633498400495855062016-05-21T23:41:00.001+02:002016-05-21T23:41:43.499+02:00Debugging client-side and server-sideIn the Google I/O 2016, one of the sessions was dedicated to what's coming to the Chrome Dev Tools.<br />
Besides the improved features in the tools themselves, they also announced that they are planning to enable <a href="https://youtu.be/x8u0n4dT-WI?t=36m36s">debugging of Node.js from Chrome</a>, this way Node developers can use Chrome to debug both the client side as well as the server side once that pull request is accepted.<br />
<br />
On the other side, Microsoft announced on February the ability to <a href="https://code.visualstudio.com/blogs/2016/02/23/introducing-chrome-debugger-for-vs-code">debug Chrome from VSCode</a>. By using the Chrome Debugger protocol, they have created a VSCode extension that connects with Chrome and enables you to debug your script from your editor.<br />
<br />
This reminds me of the feature of VS that integrated with IE11 and below so that when you started debugging a project, besides debugging the server side, the javascript debugger in IE itself was disabled and any error was launched in VS.<br />
<br />
I must confess that I always hated that behavior, when I'm debugging a web page I'm not looking only at the Javascript, I must check the DOM to verify if the elements exist, check their attributes, view how does the page react to changes, etc... so a debugger that only allows me to look at the javascript is a bad option and when I had to debug IE I launched a new instance that wasn't hooked to VS so I could use the F12 tools of IE.<br />
<br />
I guess that this must be useful for some people or they wouldn't have spend the time to make it work with Chrome, but I really can't see how using VSCode for Javascript is any better than using only the Chrome Dev Tools as they are constantly updated and improved and I wouldn't say that they are missing important things to debug JS. To debug client-side I certainly prefer the client-side tools to keep all the context, I'm not looking only at a JS file.<br />
<br />
So going back to debugging Node from Chrome, I guess that it might depend on the quality of your editor (I would say that some people use very bad editors). Until Chrome becomes a full IDE, you're still using another program to write your JS, that includes plugins, it's adjusted to your taste, integrated with other tools... If it's able to debug Node itself, then I think that I would prefer to do that there instead of using Chrome, but obviously this depends on the quality of that debug experience. I can understand that the context provided in this situation can be similar by the editor and Chrome, although on one hand your editor might be able to provide better context and Chrome might have better debugging tools.<br />
<br />
The only fear is that people is focusing too much on Chrome, and so we might see soon that any other browser dies because the web developers don't test them, users find problems and are told to use Chrome instead, then the statistics say that people only use Chrome and more developers focus their testing only on Chrome and we end in IE6 land: A browser monoculture.<br />
<br />
Alfonsohttp://www.blogger.com/profile/18445103211507263059noreply@blogger.com0tag:blogger.com,1999:blog-1000471101186335353.post-60729244053583021212016-03-20T22:30:00.000+01:002016-06-19T22:45:21.770+02:00New plugin for CKEditor: ImageToolbarRecently I've been working in order to create for <a href="http://www.uritec.es/">Uritec </a>a new plugin for <a href="http://ckeditor.com/">CKEditor</a>, it was needed due to the way that the Style system works in CKEditor.<br />
<br />
First the Styles dropdown shows the styles that can be applied to the current element as well as its container(s); look at the <a href="http://ckeditor.com/demo">official demo</a> and select the image, now click on the Styles selector and you'll see there "Object Styles", "Paragraph Styles" and "Character Styles", something that it's not too user friendly if they just want to modify the image. The normal user wants simple things.<br />
<br />
The second main problem is that even if they focus just on the Object Styles, you (as page author/designer) can't restrict the way that the styles work between them, so if you want to use a class to apply a 1px gray border, and a different class to create a slight rotation and shadow, the user can't apply both at the same time (unless you apply inline styles that we all know it's bound to fail).<br />
<br />
So the goal was to allow to apply groups of classes that can be mixed so you set one group of classes to define different types of borders and another one to apply color filters, etc... Also, let's keep in mind that the align center has been disabled in CKEditor for those who prefer to use the classic Image plugin although it's easily done using display:block and margin:* auto, so one obvious group is alignment.<br />
<br />
Putting all those buttons to show up always in the toolbar was considered a bad idea because most of the time they won't be used, and providing instead a "contextual" toolbar that shows only when an image is selected was considered the best option.<br />
<br />
Taking all of that into consideration<b> <a href="http://www.uritec.es/imagetoolbar/"><span style="color: black;">Image</span><span style="color: red;">Toolbar</span></a></b> was born, designed to work in both classic (framed) editor as well as new inline mode, and compatible with the normal Image plugin and the Enhanced Image plugin. You can <a href="http://www.uritec.es/portal/seccion.aspx?N=115">play at its demo</a> with some predefined styles, but you can define whatever you want as long as you're able to do it with CSS classes. Or if you feel lazy today, check the <a href="https://www.youtube.com/watch?v=FZ61z47coo8">1 min. demo on YouTube</a>.<br />
<br />
If you use the Enhanced Image plugin you should know already that the way to define your CSS file requires taking some extra care, we have added some notes about it in a small guide about <a href="http://www.uritec.es/portal/seccion.aspx?N=126">styling images in CKEditor</a>, and due to those widget wrappers and upcast/downcast you'll find that it's much more powerful when you configure <b>Image<span style="color: red;">Toolbar</span></b> with the classic image as you aren't restricted by the "Enhanced image" limitations.<br />
<br />
Lastly, remember that unlike other plugins that claim to be free but then require you a monthly payment, this is a one time payment that will give you any future update.Alfonsohttp://www.blogger.com/profile/18445103211507263059noreply@blogger.com1tag:blogger.com,1999:blog-1000471101186335353.post-54991989875646336752016-02-06T16:18:00.001+01:002016-02-06T16:24:51.439+01:00Deprecation plan of IE8 in SimpleUploadstl:dr<br />
Die IE8, Die.<br />
<h4>
Planned deprecation of support for IE8 in SimpleUploads</h4>
We're already in 2016, Microsoft has stated that old versions of IE are no longer supported, and since some time ago Windows XP is not supported either.<br />
<br />
IE8 is too bad according to any current standard, too limited and lacks too many features, it has bad security track, it's time to put it to rest and everyone of us has to work towards that goal and obviously one thing that we can do is to claim that those old versions aren't supported in our products, so people can realize that they have to change their browser to another one that has all those missing features.<br />
<br />
So by the end of February I'll publish a new version of SimpleUploads just to remove the little parts that tried to add some kind of support for IE8.<br />
<br />
I'll remove right now any claim in its description about support for IE8 and I'll update shortly the demo with the new version without support for any browser that lacks the FormData feature.<br />
<br />
If you have any concern about this change, please comment here or send me an email, but remember that you can keep using your current version as long as you want if you prefer to support IE8 instead of embracing the future.<br />
<br />Alfonsohttp://www.blogger.com/profile/18445103211507263059noreply@blogger.com0tag:blogger.com,1999:blog-1000471101186335353.post-51035420073552708732015-12-08T11:20:00.001+01:002015-12-08T11:21:55.621+01:00Die XP: Another benefit of Let's EncryptThe <a href="https://letsencrypt.org/">Let's Encrypt</a> project is a great initiative to move towards a more secure web, removing the costs to apply a secure certificate to a site and providing an automated client to take care of renewals.<br />
<br />
This means of course huge changes across the whole the web industry:<br />
<br />
Other CA will be forced to drop the price of their equivalent certificates to a bare minimum or make them free also, just to try to keep on some people looking at them.<br />
<br />
Hosting providers will have to allow everyone to use a one click install of a free SSL certificate or at least manually update their certificates unless they want their clients to move to a friendlier hosting that allows setting up SSL without paying huge fees.<br />
<br />
Website owners now will be able to avoid one of the problems (money) to install a SSL and this will be specially important for small websites. Big companies have enough resources that the cost of a certificate is nothing to them, but for a small website it's clear that every Euro counts, so most of the people didn't think at all about paying just to say that their site now can be used with https.<br />
<br />
Hopefully this will mean the end of self-signed certificates or expired certificates, so end users will be able to understand better the difference between a secure site and a non-secure one and so after a while people will reject "old" sites that aren't using SSL, forcing those sites to install one, pushing their hosting companies to allow install of free SSL.<br />
<br />
The government spies will have a harder time trying to track what everyone does, and no, this won't be an improvement for terrorists because they are already able to use secure communications but in Paris it has been clear that they used normal non-secure methods.<br />
<br />
But there's one more benefit: Most of those small sites that now are installing SSL <i>en masse</i> are using shared hosting, so they don't have a unique IP and that means that they rely on <a href="https://en.wikipedia.org/wiki/Server_Name_Indication">SNI</a> to enable https and it turns out that no version of IE under windows XP (as well as old Android 2.x phones) don't support it, so those that still keep using the old IE8 will now face a new problem because they will have constant security warnings whenever they try to visit all these new https sites.<br />
And this is a good thing!!!<br />
<br />
That people keep on using that old IE. I mean, it's old, old, old. Full of bugs, full of problems, a pain for all of us that try to create modern websites if you have to keep supporting it, and now those users will feel a little of that pain (although I guess that they are already suffering from all of us that have left IE8 behind and no longer test it).<br />
<br />
Time to ditch IE 8 and move to a modern browser.<br />
Alfonsohttp://www.blogger.com/profile/18445103211507263059noreply@blogger.com3tag:blogger.com,1999:blog-1000471101186335353.post-59010926180412128002015-10-25T22:27:00.001+01:002015-11-08T19:33:58.428+01:00Updated demo for SimpleUploadsI've uploaded right now an <a href="http://www.martinezdelizarrondo.com/ckplugins/simpleuploads.demo4/">updated demo</a> to show the latest features of <a href="http://alfonsoml.blogspot.com/p/simpleuploads-plugin-for-ckeditor.html">SimpleUploads</a> and its compatibility with CKEditor 4.5<br />
<br />
This post is part of the release as it aims to document the latests additions introduced since the last post about it (full details are in the history.html file).<br />
<ul>
<li>Removed support for CKEditor 3.6. It's not a lot of code, but currently there's no reason at all to keep using a version so old and I doubt that there is anyone interested, so less code and less things to test.</li>
<li>Workaround for the CKEditor 4.5.2 change that prevents dropping files on a dialog</li>
<li>Added ability to handle both the classic response from the upload of the new JSON format </li>
<li>Cleaned up and unified coding style with <a href="http://eslint.org/">EsLint</a></li>
<li>Improved API and integration with other plugins like <a href="http://www.uritec.es/imagecrop/">ImageCrop</a>.</li>
<li>If the Upload Image button is used, launch a file picker showing only the images on your computer</li>
<li>Other minor adjustments and fixing of all the reported issues.</li>
</ul>
I'll finish all the testing and then I'll send the new version to all the clients and then I'll move on to add a feature that has been on my mind for too long<br />
<br />
I also have to review and publish the full documentation about all the configuration options, public methods and events related to the plugin (instead of keep adding it in the plugin.js file or several pages and blog posts) (this will mean probably that I'll add more changes because I'll find some detail that I don't like)<br />
<br />
PS: The current release of MS Edge doesn't support dropping files, but that's a missing feature in the browser, the next version currently available as beta already fixes this issue. You don't have to do anything on your side when it's finally released. Alfonsohttp://www.blogger.com/profile/18445103211507263059noreply@blogger.com0tag:blogger.com,1999:blog-1000471101186335353.post-80569110714718280422015-08-03T19:53:00.001+02:002015-08-03T19:58:23.174+02:00Taking a break to breathe is good and healthyThere's lot of truth on the post by @ppk "<a href="http://www.quirksmode.org/blog/archives/2015/07/stop_pushing_th.html">Stop pushing the web forward</a>", and it has lots of replies, some very insightful and others that don't follow the reasoning. This is my take on it and you can bet that it will be closer to the clueless ones.<br />
<br />
Browsers are adding new features, are constantly trying to find out what's missing and fill those gaps. That's great! we don't really want a whole full stop because we're always wishing than something works better, it's faster, it's doable...<br />
<br />
But the current problem is that there are just too many new experiments, while old problems remain ignored and unfixed. You find a post stating that something is coming to the alpha version of a browser, that they plan to work on new features for the next release, but we're not able to correctly use the previously released features because it fails in some situations or it's implemented only in one browser and so it can't be used on the public web.<br />
<br />
We need that those gaps are solved, we need to be sure that the existing problems are fixed before even more features are added.<br />
For example pasting images into web pages:<br />
Firefox pastes the data as base64, but it won't work on an input. But if you save it as a file in your computer, then you can Copy&Paste it and no other browser allows that.<br />
IE11 won't paste any image unless you're using a contentEditable element, and in that case it even embeds the images included in a MS Word document, this isn't possible in any other browser.<br />
Chrome allows nicely to paste a screenshot into an input, as explained above the other browsers don't allow this.<br />
<br />
So a "basic" feature that users would enjoy across so many sites but that it isn't available in full form in all the browsers, don't you think that this is a good example of something that should be fixed before adding something absolutely new?<br />
<br />
We'll always need better developer tools, tools that allow us to look at the pages and get more information, options to show warnings when something is wrong or we are using deprecated APIs. Don't get me wrong, the current tools are a million times better than what we had a few years ago but they still can be better: I'm in love with the CSS changes pane in IE11, there's no match for the mobile options in Chrome, I enjoy the UI from Firebug. And surely you can tell many things that you miss and wished that they worked better. All of this without new APIs.<br />
<br />
So taking the time to review the bug trackers and clean them up doesn't mean that the web stops, it means that we remove the problems that we have and we can have a better solid future instead of lots of APIs that we can't rely on due to the number of bugs.<br />
<br />Alfonsohttp://www.blogger.com/profile/18445103211507263059noreply@blogger.com2tag:blogger.com,1999:blog-1000471101186335353.post-31158579683129684982015-08-02T20:17:00.000+02:002015-08-02T20:17:00.223+02:00On the font side of -apple-systemIn <a href="http://alfonsoml.blogspot.com.es/2015/07/a-tweet-is-not-enough.html">my previous post</a> I talked about the usage of vendor prefixes in CSS due to <a href="https://www.webkit.org/blog/3709/using-the-system-font-in-web-content/">the introduction from Apple</a> of the new -apple-system value for the font-family property.<br />
<br />
I tried not to talk about the property itself and focus only on the issue of adding more vendor prefixed elements to the open web and today I want to expand that with my point of view about the value itself: -apple-system.<br />
<br />
The theory upon which this new value is introduced is to help designers match the underlaying OS, and so <a href="https://twitter.com/xeenon/status/626041015166570498">we're supposed</a> to treat it in a way similar to listing all the default OS fonts:<br />
<blockquote class="tr_bq">
font-family: system, “Roboto”, -apple-system, “Segoe UI”, sans-serif;</blockquote>
<b>Except that no designer worth their job would ever do that. </b><br />
<br />
I know very little about fonts, but among those little things that I know is that each font has different metrics, so using such a mix of fonts will be a guarantee that the final result will be a disaster as soon as the user loads the page in an OS different than the one where the page has been designed, the carefully designed UI won't fit correctly because some elements will be bigger/smaller than expected, the font-weight won't give the correct feel, etc... using a fallback font is a kind of "last resort" and when you do that you try to suggest alternatives that would fit properly but you don't have that kind of guarantee when you use fonts designed from different OS.<br />
<br />
Furthermore, someone that wants their page to match the system font won't stop just there and they will try to match the rest of the page as much as possible to the target OS and then we end up with only one targetted OS because obviously there's no kind of fallback to say: If you're on El Capitan use these icons, if you're on Android use this set, for Windows users, use this one, etc...<br />
<br />
Even the same set of icons won't fit different versions of the same OS, the same way that they state that it would be incorrect using San Francisco in the previous versions of Mac OS X because that's not the native OS font. Whenever any OS changes their designers update the rules about drop shadows, colors, gradients, rounding of elements.... some times in a radical way, sometimes adjusting and improving the experience, but everyone is able to tell if any app is following the current OS or it has been designed for a previous one.<br />
<br />
In the same way, a web designed to look & feel like a native app will look horrible (kinda like Safari 1.0 did on Windows) in any other OS, taking away the portability and abstraction that the web brought us.<br />
<br />
Using this for embedded apps is absolutely OK, there's no doubt about where such apps will run so it's just natural that they try to match the OS, but the moment that anyone uses this on web apps and the public web it's a kick to the groin of freedom, the ability to load any page with any browser in any OS.<br />
<br />
To see what this is about, load the video from Apple with IE11 for best results: <a href="https://developer.apple.com/videos/wwdc/2015/?id=804">https://developer.apple.com/videos/wwdc/2015/?id=804</a><br />
<br />
<br />Alfonsohttp://www.blogger.com/profile/18445103211507263059noreply@blogger.com0tag:blogger.com,1999:blog-1000471101186335353.post-63330500165060134732015-07-30T23:13:00.000+02:002015-07-30T23:13:05.162+02:00A Tweet is not enoughThis Monday I did read a new blog post in <a href="https://www.webkit.org/blog/3709/using-the-system-font-in-web-content/">Surfin' Safari</a> about a new feature that Apple is introducing to make it easy to use the current system font on web pages. For whatever reason I was a little fed up with so many vendor CSS prefixes so I sent a tweet about it, but obviously it's hard to express things correctly on a tweet specially as I'm not an English native speaker and I'm not able to abbreviate things like all of you do because I'm afraid that then it will be even harder to understand what I say.<br />
<br />
So after fighting only a little to avoid the characters limit <a href="https://twitter.com/AlfonsoML/status/625712628468482049">I sent</a>:<br />
<blockquote class="tr_bq">
The mess caused by vendor prefixes on the wild is not enough, so we have new -apple <a href="https://www.webkit.org/blog/3709/using-the-system-font-in-web-content/" rel="nofollow" target="_blank">webkit.org/blog/3709/using-the-system-font-in-web-content/</a> <a href="https://twitter.com/jonathandavis">@<b>jonathandavis</b></a></blockquote>
I'm not gonna copy each following message and reply as you can try to read it there, but I would like to point out some parts, a better explanation and say thanks to everyone that contributed as I think that it has helped to talk about the problem caused by the current usage of vendor prefixes.<br />
<br />
I'm nobody, I don't work on a big company, I haven't written any book, it takes me too long to write things because I have to try to find the correct words so excuse me if this post has mistakes or it's unreadable, I've tried my best.<br />
<span style="font-size: large;"><br /></span>
<span style="font-size: large;">What did caused me to send that tweet?</span><br />
It's known since quite some time that the current usage of vendor prefixes is causing harm in the interoperability between web browsers. Quite a few years ago we had the first browser wars between IE and Netscape where each one tried to defeat the other introducing new features as fast as possible and we all know that IE6 was the winner, so we had so many websites that took advantage of those proprietary features and the "Best viewed with IE" or "You must use IE to view this site" messages that most of us hated with passion.<br />
<br />
It took many years to fight and reverse that situation, engineers had to work too many hours finding out the way that things worked and reverse-engineering the specifications. We also keep the perpetual "Mozilla" and "like Gecko" in the User-Agent, but currently this is absolutely <a href="http://www.davevoyles.com/microsofts-spartan-browser-uses-chrome-ua-string/">getting out of hand</a>.<br />
<br />
So going again to a browser monoculture is something that I don't want and anything that points in that direction makes me cringe.<br />
<br />
Currently other browsers are trying hard to avoid those same mistakes, experimental features are available only in "Nightly", "beta", toggling a setting in about:flags, using a command line parameter, whatever, ... but the common goal of that approach is to not expose experimental features for broad usage to the public web but the people that want can try it out, give feedback and find out if it solves the problems as expected.<br />
<br />
But Apple is not planning to do that, they <a href="https://twitter.com/xeenon/status/625760306233344000">pointed out</a> that this isn't aimed only at betas (although a day later <a href="https://twitter.com/xeenon/status/626130448888938496">he replied</a> that it's only in beta at the moment, obvious as there's no final release ATM).<br />
<br />
And one part that I found really offensive was <a href="https://twitter.com/xeenon/status/625837301822697473">this tweet</a> about my comment that Apple doesn't remove the prefixed version of anything that they introduce:<br />
<blockquote class="tr_bq">
And we will always support them (unlike some vendors that remove things at will). So what is the issue?</blockquote>
with other comments that I found ... we'll I think that it's better to not say what I'm thinking:<br />
<blockquote class="tr_bq">
You can’t just break sites or apps. Apple doesn’t roll like that. A
number of properties changed from prefixed to unprefixed too.</blockquote>
<blockquote class="tr_bq">
It is what any company should say that cares about developer and user experience. An API is a contract and guarantee.</blockquote>
Just load the Release notes of any <a href="https://developer.apple.com/library/mac/releasenotes/MacOSX/WhatsNewInOSX/Articles/MacOSX10_10.html#//apple_ref/doc/uid/TP40014484-SW1">Mac OSX version</a> and search for Deprecated Frameworks and Removed Frameorks.<br />
<br />
So it's clear that Apple is able to deprecate and remove APIs even if they were the greatest new innovation at the time, but the obvious difference is that they have full control of the OS (if you don't like what we do, here's the door out), but on the Web they are playing the Embrace, Extend, ... game.<br />
<br />
Going back again to the starting point:<br />
<br />
<span style="font-size: large;">Why are vendor-prefixes bad?</span><br />
I'm not the one stating that, please read carefully <a href="http://www.otsukare.info/2015/07/29/vendor-prefixes-market">this great post</a> by Karl Dubost, take a look at what <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=1107378">Mozilla</a> and <a href="https://twitter.com/JustRogDigiTec/status/592086680045129729">Microsoft </a>has been forced to do just to have a chance of people using their browsers, and then tell me if this message from <a href="https://twitter.com/ryosukeniwa/status/626485684732166144">@ryosukeniwa</a> is right or wrong:<br />
<blockquote class="tr_bq">
I don't think proprietary CSS features aren't that bad since they fallback nicely. DOM and JS API are different, ..</blockquote>
But as I said, I'm nobody, please read what Daniel Glazman <a href="http://www.glazman.org/weblog/dotclear/index.php?post/2015/07/30/CSS-Vendor-Prefixes">has to say about the matter</a>. I'm really honored thinking that all of these great people have spent some time reading about my humble tweet, but then I have found out the real reason why I despite vendor prefixes: <a href="http://www.glazman.org/weblog/dotclear/index.php?post/2012/02/09/CALL-FOR-ACTION:-THE-OPEN-WEB-NEEDS-YOU-NOW">The CSS working group asked all of us to stand against them for the Open Web</a> and it seems that the message got deep into my head.<br />
<br />
That's enough for this post, I have many other things to say because there were lots of tweets and I don't want to mix the things here.<br />
<br />
<br />
<br />Alfonsohttp://www.blogger.com/profile/18445103211507263059noreply@blogger.com0tag:blogger.com,1999:blog-1000471101186335353.post-38122969240224506992015-07-19T22:16:00.000+02:002016-06-19T22:56:14.999+02:00Creating a responsive Div with proportional dimensionsWhen you create a responsive layout, you might need sometimes to embed an element (classic example: a YouTube iframe) in a way that it scales down for smaller screens, keeping the aspect ratio.<br />
<br />
The way to do that is to wrap that element in a parent div, and control the dimensions of that Div:<br />
<pre><code><div class="responsive-wrapper">
<iframe></iframe>
</div>
</code></pre>
In the CSS you can then use something like this:
<pre><code>.responsive-wrapper {
width:100%;
padding-bottom:37.5%;
position:relative;
}
.responsive-wrapper iframe {
position:absolute;
left:0;
top:0;
width:100%;
height:100%;
}</code></pre>
The trick is that the .responsive-wrapper is a 0 height div, and it has only a padding-bottom defined as a percentage so that means that its total height is really based on the width of its parent.<br />
<br />
<a href="http://jsfiddle.net/fsmnwefn/">http://jsfiddle.net/fsmnwefn/</a><br />
<br />
Ok, we all have seen that trick, but: what happens when want to limit the width of the embedded element?<br />
If your page has enough width and the embedded element takes 100% width it might look too big, so you might want to limit its width to 800px for example.<br />
<br />
Well, the solution is not really complex after thinking a little: just wrap everything in another div with max-width, that way the total width that .responsive-wrapper will be always limited to our maximum and the height (given by padding-bottom) won't grow as we resize the page.<br />
<br />
<a href="http://jsfiddle.net/fsmnwefn/2/">http://jsfiddle.net/fsmnwefn/2/</a><br />
<br />
Anyway, defining the padding as a percentage ( = desiredHeight * 100 /desiredWidth) doesn't look nice to me, I wanted to be able to use only defined widths and heights.<br />
<br />
What I want is the intrinsic behavior that img has, so that we can define width and height as well as max-width, max-height.<br />
<br />
There's a solution for this using vw units, that way the element will keep the aspect ratio, but it's gonna be messy again to keep a maximum width that works correctly in mobile: if you work only with the .responsive-wrapper and try to set max-width:800px you can add now max-height:300px for example, but if you have set width:100vw then the element will create an horizontal scroll as soon as you keep some margin on its sides.<br />
<br />
So you still need to keep that extra wrapper div.<br />
<br />
But there's another interesting solution, why don't we use an image to give us that ratio automatically? This idea is <a href="http://stackoverflow.com/a/1943820/250294">explained on StackOverflow by Elliot Richerson </a><br />
<br />
It's good to have different options and I find this one interesting, you just need to add an image with the aspect ratio that you want as the first element of .responsive-wrapper and with width:100%, height:auto and then you can apply the max-width/height to .responsive-wrapper itself.<br />
<br />
Obviously this still forces us to add an extra element and now you have an extra http request to download that image, that you have to recreate for every aspect-ratio that you need.<br />
<br />
And then I thought: Would it be possible to create such image on the fly?<br />
At the moment I'm working with javascript (not only static html), so my crazy mind starts to think: I can use a data-url, and even I can try to find out what's the basic structure of a .gif and create a fake one with the dimensions that I want, then base64 encode it and use it as the src of the image.<br />
<br />
Wait a minute man! that's too much work, we're in 2015, you can just create a canvas, set it to the desired size and get its content as data-url without the need to find out how to create a .gif or .png<br />
<br />
But, but...<br />
Yes, I can use a canvas instead!<br />
<br />
so the new trick is to use a <canvas height="300" width="800"> and then in the CSS
<pre><code>.responsive-wrapper {
width:100%;
max-width:800px;
position:relative;
}
.responsive-wrapper iframe {
position:absolute;
left:0;
top:0;
width:100%;
height:100%;
}
.responsive-wrapper canvas{
width:100%;
height:auto;
} </code></pre>
The nice part of this solution is that you can use whatever units you want, and the aspect ratio is defined in the HTML, so you can use this class with different elements and even add other media queries for whatever other effect you might need.<br />
<br />
<a href="http://jsfiddle.net/fsmnwefn/3/">http://jsfiddle.net/fsmnwefn/3/</a><br />
<br />
Alfonsohttp://www.blogger.com/profile/18445103211507263059noreply@blogger.com0tag:blogger.com,1999:blog-1000471101186335353.post-77956136098968604402015-05-21T22:35:00.001+02:002015-05-21T22:36:12.919+02:00Testing DevTools, take 2This is my second day testing Firefox Developer edition.<br />
<br />
Almost right after start, I get a notice that there's an update ready, clicking it a dialog was shown stating that the update was ready to be applied. So I agreed and waited, this should be transparent and done without such dialog, specially when frequent updates are expected due to the usage of the alpha channel.<br />
<br />
The prompt to save passwords has changed, I'm not sure if previously it showed the user name, but now it has a field with the masked password below it that it's absolutely useless, it can't be edited, it doesn't provide any info, Why are they wasting time and effort in things like this?<br />
<br />
So I started working, the first changes were mostly server-side to send new data and modify some JS, then I added two breakpoints to check that it was working as expected, some adjustments, I browsed a little, took a quick look at the network tab, its layout is somewhat different like the Clear button at the bottom right instead of the top left like all the other tools so at first I thought that it wasn't available.<br />
<br />
Then I went back to debugging, but now those two breakpoints no longer work. No matter if I remove and add them again, reload the page..., the script isn't stopped and so I can't use Firefox to debug javascript. After restarting Firefox and adding again the breakpoint at the same place this time worked, but my usual reaction at this point is just to switch to another browser and go back to Firefox only when everything works perfectly in other browsers and I have to review Firefox.<br />
<br />
I want to check as I'm not sure the value of the document.ELEMENT_NODE constant so I type document.EL and as it's already shown in the autocomplete I press Enter and it uses only "document.EL" so it says that it's undefined, so I press Up arrow, Tab and it shows in light gray "<- again="" autocomplete="" br="" english="" exact="" i="" if="" in="" is="" m="" makes="" not="" pressing="" results="" sentence="" so="" spanish="" sure="" tab="" the="" this="" without="" work.="">In Firebug and IE the first Enter does the autocomplete and then pressing it again shows the result. Chrome behaves like Firefox on the first step but after pressing Up arrow no matter how many times you press Tab, the autocomplete doesn't work.<br /><br />Back to CSS, trying to add or edit a pseudo-element like a::before it's not possible, the rest of the tools allow it; Chrome even shows them in the DOM tree.<br /><br />Trying to do some basic testing with Mobile isn't even fair. IE11 has the very minimum, Firefox improves it a little, although not really too much and Chrome is hands down the absolute king. Several features really useful that makes it a non-sense try to use any other tool to start checking for mobile:<br /><b>Touch emulation</b>: the pointer turns into a fingertip and :hover no longer works. Absolutely a must.<br />Device list: instead of a list of sizes, it shows devices by their name, and it also adjust other things like the device pixel ratio, so it's easy to get a good view of how it will be viewed on such screens.<br />Rule with @media rules in the page, good to find the breaks and verify them.<br />Zoom control, nice.<br />Network emulation, so far I haven't used it too much, but it has obvious benefits without the need of using external tools to simulate throttling. I know that I'll use it because otherwise it's impossible to test how a remote server works with different conditions.<br /><br />I've decided to test now the WebIDE to connect to my phone. Yesterday I did a quick test and I gave up. I saw "Chrome on Android" listed and I picked it but nothing happened, and today I realized that then I must go to the left and click on "Open application" and the open tabs are listed there and debugging starts.<br />So then I tried to debug Firefox as I already debugged Firefox on Android some time ago, and then I realized that it's not done automatically and I had to enable the remote debugging on it, this should be hinted more clearly, when an Android device is detected, create an entry linking to how to enable debugging of Firefox.<!-----></-><br />
<br />
One "annoying" thing is that every time that I connect again to Firefox on Android it prompts me to accept the connection, with the only options as "Disable", "Cancel" and "Accept", but not a "Yes, always allow this device", Chrome doesn't do such things.<br />
<br />
When connection to a device Chrome clearly shows the list of open tabs and allows to close, open a new one or change the url, as well as proxying the request to localhost, another must have to be able to test changes without having to upload to a server.<br />
<br />
<br />Alfonsohttp://www.blogger.com/profile/18445103211507263059noreply@blogger.com0tag:blogger.com,1999:blog-1000471101186335353.post-53555244109369980452015-05-20T23:46:00.000+02:002015-05-20T23:47:04.297+02:00Firefox DevTools, a long way to goThis Monday <a href="https://twitter.com/AlfonsoML/status/600024628581560321">I tweeted</a> about the bad state of JS debugging in the current releases of Firefox where both Firebug and DevTools are no longer useful because they ignore most of the breakpoints.<br />
<br />
I got a reply from <a class="account-group js-account-group js-action-profile js-user-profile-link js-nav" data-user-id="14865170" href="https://twitter.com/canuckistani"><b class="fullname js-action-profile-name show-popup-with-id" data-aria-label-part="">Jeff Griffiths</b></a> suggesting me to use the alpha version AKA as Firefox Dev edition, but I pointed him that it's known that it lacks behind all the other tools, so I would prefer to wait until the most obvious bugs are fixed (I linked some that are important for me).<br />
<br />
Yesterday I got another reply suggesting me to give DevEdition another try, and so this evening I've started by opening a document where I've been writing down this experience of installing and trying to use the latest version. It's not from the point of view of a new user because I've tested it a little bit, but I might not be aware of awesome things just because the problems that I find force me to use other tools.<br />
<br />
The first step is instaling the Firefox Dev edition, I picked the custom install and of course I rejected the option to install it as my default browser, that's a non-sense that when you install a new browser you're going to make it the default right from the start (yes I know that everyone does this since Netscape times).<br />
<br />
After launching the first thing that I notice is that the UI lacks the rounded borders of the normal Firefox. I notice also how slow are the UI animations (it feels the same way in the normal Firefox, but I don't see them because I've added the Classic Theme Restorer and that way I don't have to use the hamburger menu). That's a problem with Firefox itself trying to create useless animations, not with the DevEdition.<br />
<br />
Then I try to use it on a site and the obvious first stones appear in my path, the history, autocomplete, credentials, everything is empty so I have to type everything again. Not a big problem, but it will force me to waste my time. It should have prompted me to import such data from Firefox or to use Sync as this seems a sensible use-case. As it didn't offer me to use Sync I'm not sure if that would be a good idea or it's risky to use it with different versions at the same time.<br />
<br />
So let's start testing it.<br />
<br />
I add a new CSS property "max-wi" TAB, now I type 0 and press Arrow UP, it changes to 1 but it's unitless so it doesn't work. Firebug and Chrome correctly change from "0" to "1px", IE11 behaves like Firefox.<br />
<br />
Now it's time to save the changes, I adjusted only one rule but when I try to use the context menu there's no "Copy rule" like Firebug or IE11, I have to manually select the text like in Chrome.<br />
<br />
Extra Bonus points and the main reason that IE11 it's now mostly my prefered tool for CSS adjustment is its Changes pane that shows all the CSS changes made in the page. Certainly it's a little buggy sometimes and it could have several enhancements, but all the rest of developer tools lacks anything like this and it's precious to be sure to know all the adjustments made across different elements.<br />
Chrome seems to have something related with the History pane, but honestly I haven't figured out how to make it work as I want.<br />
<br />
One thing that DevTools doesn't seems to know is that "0" is "0", it's unitless so when I write "margin: 0 auto;" it's wrong to change it to "margin: 0px auto;". Firefox and Chrome respect my 0 and IE11 does it correctly for "margin: 0 auto;" but not for "height: 0;" (test by checking a property written in the stylesheet that way or modifying a property and switch to another element and back to the modified element)<br />
<br />
Other clear sign that these tools aren't ready: Use the context menu and select "Add rule", change the selector or leave it as is, now Tab and you'll find that you're now nowhere, you have to click inside the rule to add a new property. All the other developer tools correctly place you ready to type your new property as that's the only logical thing to do after creating a rule. This breaks the workflow and makes me waste my time moving my hands from the keyboard to the mouse.<br />
<br />
Bonus points go to Firebug because while editing a rule you have a super useful autocompleter based on the parent node names, ids and classes. No other tool has this.<br />
<br />
Trying to work a little with javascript, put a breakpoint, check the DOM, reload the page. All the tools except Firefox DevTools correctly switch the selected pane to the script that has the breakpoint and DevTools just show that tab in green stating that execution is stopped and waiting for you to click.<br />
<br />
Another day I will keep on testing and reporting the differences, but so far I haven't seen anything in Firefox that made me want to use it.Alfonsohttp://www.blogger.com/profile/18445103211507263059noreply@blogger.com0tag:blogger.com,1999:blog-1000471101186335353.post-77176361364363960102014-10-19T17:34:00.000+02:002016-03-20T22:48:10.930+01:00List of plugins for CKEditorThis is a list of the public plugins that I've created for CKEditor, you might find some of them interesting. I've added here a small description and in some cases a suggestion to use it or not, just to help yo understand faster what's the reasoning behind each one.<br />
As you can see most of them are free, so if you want to support my work, you can buy any of the commercial ones and add a note in the payment so I can know that it's worth to keep publishing free stuff. Or at least say "Thanks" in this post or the pages at CKEditor, it's cheap and at least I'll know that someone has used successfully the plugins.<br />
Some plugins are very simple and perform just a basic single operation, others are huge beasts that provides lots of functionality like the HTML buttons or SimpleUploads, take the time to read the linked page for each one.<br />
<h1>
<a href="http://ckeditor.com/addon/allowsave">Allow Save</a></h1>
The default "Save" plugin for CKEditor 4 is quite restrictive and it doesn't enable the button unless you're using the "replace textarea" mode AND you're in Wysiwyg mode. This plugin removes those restrictions and allows you to do whatever you want when the "save" event is fired on the editor. Remove the default "Save" plugin and use this one.<br />
<h1>
<a href="http://ckeditor.com/addon/backgrounds">Background Image for Tables and Cells</a></h1>
Sometimes you have to deal with a client or a project where the final user is supposed to be able to set a background image for tables or cells. You might not want to do it, but if you have to, with this plugin you'll get in those dialogs the options so that they can do whatever they want<br />
<h1>
<a href="http://ckeditor.com/addon/confighelper">Configuration Helper</a></h1>
This plugin simplifies some configuration options in CKEditor like hiding/removing dialog fields, and it also provides a HTML5 like 'placeholder' when the editor is empty (eg: 'Type here the description of the product') that goes away as soon as the user focus the editor<br />
<h1>
<a href="http://ckeditor.com/addon/googlemaps">Google Maps</a></h1>
If you want to insert a Google Maps into your site you can use the simple embed code that they provide. That's fast and free, but other times you want the ability to provide more configuration options, to integrate it better into your site, create an image to send in an email... In those cases you should <a href="http://alfonsoml.blogspot.com.es/p/googlemaps.html">check the Google Maps plugin for CKEditor</a>, because it provides a simple interface to control many options of the Maps without any requirement to understand the underlaying behavior.<br />
<h1>
<a href="http://ckeditor.com/addon/htmlbuttons">HTML Buttons</a></h1>
This is a very powerful plugin as it allows you to create any number of toolbar buttons or even drop down lists to insert whatever piece of HTML that you want into CKEditor or even wrap the current selection with this HTML. If you are searching for a simple way to add a button that inserts a snippet or a combo box with a list of options to insert, then grab this plugin and you'll be able to finish your work in a few minutes without the need to read any complex manual.<br />
<h1>
<a href="http://ckeditor.com/addon/ImageCrop">Image Crop and Resize</a></h1>
This is a plugin that I've created for <a href="http://www.uritec.es/">Uritec SL</a>. It uses the SimpleUploads API to allow the users to perform basic editing (crop and resize to desired set of dimensions) of their pictures before they are uploaded to the server, or even to edit those images after they have been uploaded. For further details, <a href="http://www.uritec.es/imagecrop">check the ImageCrop page</a>. This is a big productivity enhancer because it simplifies so much the process of cutting out the undesired parts of the pictures and then resize the selection to match the image sizes defined for the site, and it's God's sent gift for those users that barely understand how to use any image processing program.<br />
<h1>
<a href="http://ckeditor.com/addon/imagesfromword">Images From Word</a></h1>
Another plugin created for <a href="http://www.uritec.es/">Uritec SL</a>.Whenever your users copy some content from MS Word (because it's an existing document, they prefer to create the content that way, etc...) the embedded images aren't copied along the content unless they use IE11. As not all the people enjoy being forced to use a browser, this plugin enhances the default Paste operation in CKEditor so it just ask the user for a couple of clicks to include the images into the content avoiding this way the frustration caused by the missing feature in Chrome and Firefox.<br />
<h1>
<a href="http://ckeditor.com/addon/imagesfromserver">Images From Server</a></h1>
Another plugin created for <a href="http://www.uritec.es/">Uritec SL</a>. Copying content from one site to another one means that the images use the references to your old server, but with this plugin all the images are copied and your content is updated to use the new URLs automatically. Now you don't depend on the other server, you can edit the images in your server, embed them in your emails, etc...<br />
<h1>
<a href="http://ckeditor.com/addon/imagemaps">Image Maps</a></h1>
This is a plugin built to use the ImgMap library by Adam Maschek into CKEditor. This way your users can mark the active hotspots in any image and create the standard <map> and <area> elements on them that can work on any browser without any special restriction. For further details, look at the <a href="http://alfonsoml.blogspot.com/p/imagemaps.html">ImageMaps page</a>.<br />
<h1>
<a href="http://ckeditor.com/addon/imagepaste">Image Paste</a></h1>
Simple plugin that allows to upload to the server the images pasted from Firefox. You should use this one only as a test case to check that you can install custom plugins into your server and handle uploads, the SimpleUploads plugin covers this use case and many other things.<br />
<h1>
<a href="http://ckeditor.com/addon/imagetoolbar">Images Toolbar</a></h1>
Another plugin created for <a href="http://www.uritec.es/">Uritec SL</a>. With this plugin a floating toolbar will show whenever an image is selected, allowing the user to easily change the styles in anyway that you want, without cluttering the main toolbar or the restrictions imposed by the Styles dropdown.<br />
<h1>
<a href="http://ckeditor.com/addon/noabp">No ABP</a></h1>
This is a very simple plugin that it takes care only of removing the "abp" attributes that the AdBlock Plus extension for IE inserts into the content. It's only a few lines of code and it doesn't do anything special if the user isn't using IE with AdBlock Plus, so you should just install it by default as it will help to avoid garbage.<br />
<h1>
<a href="http://ckeditor.com/addon/nbsp">Non-Breaking Space</a></h1>
It's laughable, but a smart guy provided a vote of 2 because the idea is old. Yes, nothing ground-breaking but at the same time it's the kind of little things that are good to have because we're used to them and CKEditor lacks: Press Ctrl+Space and you get a non-breaking space. Nothing less, nothing more.<br />
<h1>
<a href="http://ckeditor.com/addon/onchange">onChange</a></h1>
Currently you shouldn't use this plugin as is. Since the CKSource team introduced a similar functionality into the core I stopped updating it, although you might want to look at its code to fix the problems that they didn't care about despite the availability of this plugin that shows how to take care of.<br />
<h1>
<a href="http://ckeditor.com/addon/simpleuploads">SimpleUploads (file and image upload options)</a></h1>
This plugin adds a whole set of enhancements and new features so that the users are able to upload files and images from their computer as easy as possible and it provides you as a developer with a full API to go far beyond what it's possible with the default CKEditor API or any other plugin.<br />
With this plugin you'll have the ability to paste files into CKEditor, drop them from your computer, avoid uploads of files that have the wrong extension or are too large, use APIs different than the one suggested by CKEditor, you must read <a href="http://alfonsoml.blogspot.com/p/simpleuploads-plugin-for-ckeditor.html">the SimpleUploads page</a> and the linked posts to get a glimpse of all the things that are possible with this plugin and the API that it provides.<br />
<h1>
<a href="http://ckeditor.com/addon/stylesheetparser-fixed">StyleSheetParser (Fixed)</a></h1>
The current version of the StyleSheetParser has a bug that has been lying around for years and that they don't care enough to fix, so here is the fixed version that works correctly when the cache is empty and it also works with inline-editing. Remove the default StyleSheetParser from your build and add this one instead.<br />
<h1>
<a href="http://ckeditor.com/addon/xmltemplates">XML Templates</a></h1>
The Templates plugin for CKEditor requires that you create the templates data in a JSON format that can be quite hard to create and debug for non-developers. This plugin adds the option to use a XML format just like the old FCKEditor did. This plugin extends the default Templates functionality, you must have both plugins installed together.<br />
<h1>
<a href="http://ckeditor.com/addon/zoom">Zoom</a></h1>
This is a half usability-half sample plugin. I don't see much benefits to use the zoom in a web editor, but others do so here's a simple combo box that changes the zoom of the content. Nothing changes in the content it only provides a control like other desktop word processing editors to zoom-in and -out the content.Alfonsohttp://www.blogger.com/profile/18445103211507263059noreply@blogger.com0tag:blogger.com,1999:blog-1000471101186335353.post-52173251211283809522014-10-18T19:23:00.000+02:002014-10-18T21:38:41.088+02:00Editing images for CKEditor<p>
Besides allowing to upload images to their server, one of the main problems that users have with the images is the size of the pictures. Even for seasoned users, sometimes it's hard to calculate how to correctly crop a part of the image and then resize it to the final desired dimensions.</p>
<p>
Using the features provided by the <a href="http://alfonsoml.blogspot.com/p/simpleuploads-plugin-for-ckeditor.html">SimpleUploads plugin for CKEditor</a>, you can now make this a very simple task so that they upload to the server the images exactly as desired, without any extra images laying around, and without worries that if the image is automatically cropped, the heads will be cut off or any strange thing like that.</p>
<p>
The process is as simple as you can expect, once you have used it you'll never want to go back:</p>
<ol>
<li>
First add the image to the editor, usually the simplest way for the users is to just drop them from another window with the local file system (Explorer, Finder, etc...), but using the toolbar button to launch the file picker works as well.</li>
<li>
Then a dialog launches showing the selected picture and the user is asked to select which preset sizes (that you configure in CKEditor) he/she wants to use.</li>
<li>
Upon clicking on one of them, a selection appears over the image, and that selection can be resized and moved to focus on the interesting parts of the image.</li>
<li>
Now the user can just click OK on the dialog and the image will be saved that way</li>
<li>
Otherwise, if he clicks Crop then the options will ask which image quality should be used, and changing them modifies the preview as well as the size that it's shown that will be used for the new image.</li>
<li>
Clicking OK will work like in step 4, the image is uploaded to the server and inserted into the content.</li>
</ol>
<p>
But there's even more:</p>
<p>
If the image is already on the server, a new context menu option is added to show the same crop&resize dialog, so the user can opt to use existing images on the server and then adjust them when a thumbnail is required for example.</p>
<p>
To get those features, check the <a href="http://www.uritec.es/imagecrop/demo.html">demo for the image crop and resize plugin for CKEditor</a>.</p>
<p>
</p>
Alfonsohttp://www.blogger.com/profile/18445103211507263059noreply@blogger.com0tag:blogger.com,1999:blog-1000471101186335353.post-55362996491889325962014-09-19T23:02:00.000+02:002014-09-20T12:19:17.486+02:00Future plans for SimpleUploads<p>
I've wanted to write this post for a long time, but I'm usually a little busy and things didn't look to be quite ready, and it's better to not scare people out if it isn't needed.</p>
<h2>
The future of SimpleUploads</h2>
<p>
If you follow the development of CKEditor you should know that for a long time they have been planning to add support of <a href="http://dev.ckeditor.com/ticket/11437">image pasting as well as drag and drop</a> in the next version of CKEditor. Initially it was planned for CKEditor 4.4, but soon they realized that it required much more work than originally planned so it was delayed for the next version. CKeditor 4.5 was supposed to be released next week, but they have announced that the whole release will be delayed by an unspecified amount of time.</p>
<p>
I can't state how the planned features will work, as it seems that at the moment it's still a work in progress, but I really expect that their code will make quite hard the upgrade of my <a href="http://alfonsoml.blogspot.com/p/simpleuploads-plugin-for-ckeditor.html">SimpleUploads plugin</a> to keep all its current features because the browsers are quite frail in these kind of operations. The correct solution would be to use the new APIs that they are creating (at least I hope that they provide some API) and add the missing bits to provide again everything that they have skipped.</p>
<p>
But the fact is that like any previous release I expect that it will wreak havoc with my code and it will require lots of changes and some parts might be incompatible with their code so this will require a compromise and I will work to try to bring everything back to work as soon as I can.</p>
<p>
Of course such rewrite will be incompatible with the previous versions of CKEditor, and I plan to provide <strong>two versions</strong> from that point:</p>
<ul>
<li>
The current one, compatible with CKeditor up to 4.5</li>
<li>
Next version, only for CKeditor >= 4.5</li>
</ul>
<p>
The current version is highly polished and I will keep on working on fixing any minor issues that might appear. The focus of my work will be the next version in order to make it work at least as good as the current one.</p>
<p>
Currently drag&drop and pasting are just only a part of the whole feature set of SimpleUploads, so adding them to CKEditor doesn't really mean an end to this plugin, only an adjustment about which parts are handled in CKEditor and how to make the whole upload experience as easy and simple as possible for the end user.</p>
<h3>
What does this means to you?</h3>
<p>
If you're <strong>currently using my plugin,</strong> you should delay the upgrade to CKEditor 4.5 until I release something that works at least with the features that you need. If you don't plan to upgrade to CKEditor 4.5 as soon as it's released then this shouldn't be a problem, afterwards, please check if I've managed to fix everything besides whatever I might write as required changes for the upgrade.</p>
<p>
If you're<strong> interested only about the drag and drop or paste of images</strong> into CKEditor and you're OK with waiting a little while and then using that CKEditor version, then you shouldn't buy my SimpleUploads plugin . Just keep on waiting and you'll be ready to go.</p>
<p>
Of course, waiting might not be an option for you as <strong>you need a solution right now</strong>, or you are already using a version of CKEditor and <strong>you don't plan an upgrade</strong> in the foreseeable future, or more probably, <strong>you want more features</strong> than those available in the plan CKEditor (like single click uploads). In that case you can use my plugin if you're willing to pay just a little money; if you want a free solution my plugin shouldn't be a concern to you: I don't have any plan to release it for free or to drop it. People have paid for it and I will try to support it for as long as I can.</p>
<p>
Please, don't write me in a hurry as soon as CKEditor 4.5 is released, this is my warning that I expect things to break and I will try to put everything into working form again, but I think that it might take at least two weeks until I'm able to release a new version that works and maybe a whole month at least to keep on fixing all the breakage caused by the changes. I have a life and a full time job and even if I don't waste my time with Ingress, time passes flying by and I can't sit the whole day working on these plugins unless I'm on vacation.</p>
<p>
</p>
Alfonsohttp://www.blogger.com/profile/18445103211507263059noreply@blogger.com0tag:blogger.com,1999:blog-1000471101186335353.post-54419452276037919402014-04-06T21:10:00.002+02:002015-02-23T15:15:50.102+01:00Resizing images with SimpleUploads<p>
One of the recent additions to the <a href="http://alfonsoml.blogspot.com/p/simpleuploads-plugin-for-ckeditor.html">SimpleUploads plugin</a> is the ability to process the images on the client before they are uploaded to the server.</p>
<p>
At the moment I've added two options to allow automatic conversion of bmp images as well as rejecting images that are bigger than the defined dimensions, but it's easy to customize your page so that you can for example resize the images on the client and that way it will be much faster. </p>
<p>
Of course this isn't a magical solution: the resizing is done using a canvas, so if any animated image will lose the animation, and I'm not sure about transparency in gif and pngs.</p>
<p>
Anyway, I've created a <a abp="63" href="http://www.martinezdelizarrondo.com/ckplugins/simpleuploads.demo4/resize.html">Sizing demo</a> showing the different options: </p>
<p>
1) Don't restrict the uploads in anyway</p>
<p>
2) Use only a server-side script. If you want to limit the size of images you should always use this kind of setup as a last option so that even if the image isn't resized on the client it's correctly processed and validated on the server.</p>
<p>
3) Check the size and reject them</p>
<p>
4) Reescale the image on the client, that way it's uploaded much faster.</p>
<p>
I might add this option directly in the plugin, but for the momento I think that it's good to have the option to use your own code and that way you can tweak it to better fit your requirements.</p>
<p>
The code itself is simple, this is it:</p>
<pre>
function scaleImage(ev)
{
var data = ev.data,
editor = ev.editor;
var img = data.image;
// maximum size allowed for images
var maxX = 400;
var maxY = 300;
var imgX = img.width;
var imgY = img.height;
if (imgX == 0 || imgY == 0)
{
alert("Ops, the image doesn't seem to be valid");
ev.cancel();
return;
}
// if it's smaller, get out
if (imgX <= maxX && imgY <= maxY)
return;
var ratio = imgX / imgY;
if ((maxX / maxY) > ratio)
maxX = Math.round(maxY * (ratio));
else
maxY = Math.round(maxX / (ratio));
var canvas = document.createElement("canvas");
canvas.width = maxX;
canvas.height = maxY;
var ctx = canvas.getContext('2d');
ctx.drawImage(img, 0, 0, maxX, maxY);
if ( /\.jpe?g$/.test(data.name))
{
// You could adjust here the quality of jpg
evData.file = canvas.toDataURL("image/jpeg", 0.9);
}
else
data.file = canvas.toDataURL("image/png");
}
</pre>
<p>
4 bis) Use a high quality resize as provided by the <a href="http://www.uritec.es/portal/seccion.aspx?N=55">ImageCrop plugin</a> that provides a dialog to allow the user to crop & resize the images before they are uploaded to the server. This plugin also allows to restrict the images to a maximum dimensions in case the user didn't select any sizing option in the dialog
</p>
Alfonsohttp://www.blogger.com/profile/18445103211507263059noreply@blogger.com0tag:blogger.com,1999:blog-1000471101186335353.post-20672289926344055212014-02-15T11:57:00.000+01:002014-02-15T11:57:21.710+01:00How to launch the ImageMaps dialog with your own code<p>
If you have some code outside of CKEditor that inserts an image into its content and then you want to automatically launch the ImageMaps dialog on that image, you can use simply this two lines of code:</p>
<p>
First, select the image using the CKEditor API:</p>
<pre class="brush:jscript;">
editor.getSelection().selectElement(editor.document.getById("myImageID"));</pre>
<p>
"editor" is a reference to the editor instance that contains the image, and "myImageID" is the id attribute assigned to that image.</p>
<p>
It first gets a reference to the element with editor.document.getById and then tells the selection system to select that element.</p>
<p>
Then launch the dialog:</p>
<pre class="brush:jscript;">
editor.openDialog("ImageMaps");</pre>
<div>
It's just that simple, use the name registered for that dialog and tell editor that you want to open it :-)</div>
<div>
</div>
<div>
I hope that this can be helpful for someone.</div>
Alfonsohttp://www.blogger.com/profile/18445103211507263059noreply@blogger.com0tag:blogger.com,1999:blog-1000471101186335353.post-89016146453046026372014-02-08T17:11:00.000+01:002014-02-08T17:11:57.926+01:00How to insert a new "Browse page" button in the ImageMaps plugin of CKEditor<p>
In this post I'll provide a simple code that inserts a new browse button in the ImageMaps dialog that allows the user to browse existing pages in your CMS besides the normal browse button used to browse for files.</p>
<p>
The code can easily be reused for other dialogs like the link or image, you just need to check the name of the elements and then test that it works as expected.</p>
<p>
The main idea is to use the "dialogDefinition" event to modify the definition of the dialog on the fly and then create a new button that we will insert besides the existing one. You can check other uses in the samples folder of your CKEditor, there's an "api_dialog" file that shows some of these ideas.</p>
<p>
The code is as simple as this:</p>
<pre class="brush:jscript;">
CKEDITOR.on( "dialogDefinition", function( ev ) {
// Take the dialog name and its definition from the event data.
var dialogName = ev.data.name;
var dialogDefinition = ev.data.definition;
//Customize "Image Map" dialog
if ( dialogName == "ImageMaps" ) {
var infoTab = dialogDefinition.getContents('info');
// get the existing "browse" button, adjust its position
var browseFile = infoTab.get('browse');
browseFile.style = 'display:inline-block;margin-top:15px; ';
// Create a new "Browse page" button, linking to our custom page browser
var browsePage = {
type : 'button',
id : 'browsePage',
hidden : true,
style: 'display:inline-block;margin-top:15px; ',
filebrowser :
{
action : 'Browse',
target: 'info:url',
url: '../intLinks2.aspx'
},
label : 'Link to CMS Page or Form'
};
// Create a container for the two buttons and replace the existing browse button with this one
var hBox = { type :'hbox', widths: ['120px', '120px'], children : [browsePage] };
infoTab.add( hBox, 'browse' );
infoTab.remove( 'browse' );
infoTab.add( browseFile, 'browsePage' );
// Force a better width for the href field
var txtHref = infoTab.get('href');
txtHref.style = 'width:200px';
}
});</pre>
<p>
I hope that someone finds this useful :-)</p>
Alfonsohttp://www.blogger.com/profile/18445103211507263059noreply@blogger.com7