How to add translator to CKEditor - javascript

I am using CKEditor in my rails 5 application. I would like to have a support of Internationalizationin my CKEditor means I will select language and when I am typing content should change to that language. Is it possible to add this feature to my CKEditor. Please tell me the possibilities on how to achieve this.
Thanks in Advance.

As a proof of concept, you can try two approaches:
If you need translation on the fly, you will need to use third party services with a JS made requests.
You`ll have to learn the API of ,for example, Bing translation service. And add some JS to send the text to it and replace the CKEditor content with the result.
You can also translate on server side using gems like this. So you can push text from ckeditor to your own backoffice, utilize the gem to send it to API. And render the form with the result.

Related

How can I use a CMS with my custom website

I'm going to develop a custom site (my own html/css/js, maybe using vueJS) for a client. She wants to be able to edit the content of her site after, add/delete/update images and text.
If I code the site by myself instead of using visual builders inside wordpress, is she going to be able to edit her site with the wordpress built-in tools or I'm the one that will have to make the changes whenever she needs?
Usually you would wrap your custom part of the wordpress website into a custom plugin. I'm assuming you can wrap a vuejs app, but I haven't done/ tried that yet. But definitely an inspiring question. I would give that a try.
This tutorial should get you started: Tutorial to create a custom plugin
Implementing the Vuejs SPA afterwards into that plugin should be manageable...

Localization for Arabic language

I want to translate all static element to my web page in Arabic by using angular.js, What all concept I can use. I have tried by using
Its making my whole page to mirror image.
You should be able to implement localization on angular apps with ng-i18next. Check github repo at https://github.com/i18next/ng-i18next for more details.
Try to use angular-localization wich is the official way to do it https://github.com/doshprompt/angular-localization

How to modify bigcommerce frontend with api (add js code in app)

I am writing and app for biggommerce which should a bit of code JS to the header. Does bigcommerce allow to do something like that? (something like ScriptTag in Shopify)
Best Regards
Vahe Abelyan
There is no way to access/edit template files thru the Bigcommerce API. It would just be best to guide the user to pasting the JS into their header (as most apps already do).
Rob is correct, however, depending on how complex you want to get you could technically write an app that would fetch or put a file into the theme's template structure using WebDAV.
Basically
if /template/panels/htmlhead.html exists find it, add your script code before , then post file back to webdav
if /template/panels/htmlhead.html does not exist, allow user to upload the default one from their theme, and then have you app do the same thing.
However I'd recommend sticking with the easy way, just provide instructions for a user to place the code into the file themselves. If you want a great example of this, see YOTPO's installation instructions.

Attach PDF to PDF as attachment (not as a page) via Javascript in HTML (not in Acrobat)

I would like to generate a PDF portfolio using JS from an HTML/CSS page on a local machine. I would use a PDF template file which includes a PDF portfolio Navigator in SWF form. I have successfully accomplished this using C# and a command line program, but can not identify the proper Javascipt components to do this browser-side or pseuo-server with Node.js. Basically, I am looking for something which will allow me to append a PDF to a new or existing PDF via configuration choices and an 'assemble' action using a JS or HTML button. iTextSharp provides the required PDF interaction functionality, but I can not figure out to run this inside an HTML to allow configuration via the HTML/CSS DOM (i.e. checkboxes, text field desciptors, etc...). Does a library with this type of functionality exist?
So you want to create a PDF using JavaScript?
On a quick google search, I found what appears to be a javascript library for creating and manipulating PDFs call jsPDF
If you want information on how to upload files with JavaScript alone, here is an article on how to do that. It also shows you how to use the file element.
For style, I recommend using a CSS Framework is you don't know much about CSS. I personally use Twitter Bootstrap for quickly prototyping things. It's quick and easy, and has good documentation. You can also use this to see how to make a form in HTML. I haven't got any good starter tutorials for HTML off the top of my list, sorry.
If you don't know much about JavaScript, when it comes to getting the options from the form, so that you can use them as configuration options, I'd suggest using the jQuery framework. It'll help you get up and running quickly enough
Note, all of this shouldn't replace basic training in JavaScript and HTML/CSS. Frameworks make things simpler, but if you don't know how to do something without a framework, you're going to have a hard time with a lot of the more complicated things. This goes for every language

rich text editing, prevent embeded javascript code

I made a website using the famous symfony framework. I wanted to add rich editing feature to it. And I found TinyMCE editor. But there comed a problem: how about the user embed some javascript code into the content? such as alert('hello world').
I tested wordpress, which is a very famous blog software. It faces the same problem. example.
It is no big deal if some one embed an alert script. But what if they embed some dangerous code? Have you encountered the same problem? Should I use markdown instead of html? Any good widget for markdown editing?
It's a good idea to use an existing library to clean out your user input, the html purifier project: http://htmlpurifier.org/ seems maintained and well made.
Don't allow any embedded javascript in your user input. This is easy to clean out either on the client or the server. Have a "white list" of HTML tags you support, and remove any event listener attributes from whatever you do allow.

Categories

Resources