Online editor - execCommand and download questions - javascript

I'm working on an online editor ,and I've got some of the basic functions(B,I,U and so on) but I can't understand how
richTextField.document.execCommand("InsertOrderedList",false,newUL);
and
richTextField.document.execCommand("InsertUnorderedList",false,newUL);
work.
Neither highlighting the text/simply clicking the button worked .
The other question is : is it possible to display the browser's "Save" window when clicking on a button?For exapmle ,the one when we save an image from the webpage.

Related

Dropdown button not working on some pages

We built our website using Adobe Muse, which has since become obsolete, but since beginning to manually amend the code outside of Adobe Muse, the dropdown button on our navbar has decided to stop working on some pages.
Please see the 'Depots' button on the below URL:
https://stc-uk.com/dropdown.html
When hovering, a list of our depots is displayed.
The same code is present on the below page, but the button doesn't do anything when hovering:
https://stc-uk.com/stc.html
We have tried to copy and paste the code but this doesn't work.
It's not a simple html/css dropdown button, as we generated the button through an Adobe Muse widget. We've tried to re-create the button just using html/css but it doesn't fit in correctly.

A "save to file" method in Javascript works remotely but not locally

I found on stackoverflow a link to a FileSaver.js demo :
https://eligrey.com/demos/FileSaver.js/
It works on that site. You can write some text in a field, click on "Save", and a dialog box opens up, asking you where you want to save the file.
I copied the page source locally. I doesn't work. No buttons to click, and the field where the text to be saved should be entered displays the javascript code instead.
There are three parts in that code. One for saving a picture, one for saving plain text, one for saving formatted text.
If I delete the first two parts, the third part at least displays properly. But if I click "Save", no dialog box appears. Firefox briefly says it is connecting (to what?), and then nothing.
There are additional libraries, but they are all fully linked (I mean, no local links such as ./something.js - they are linked with their full url).
Anyway, I tried downloading them and using local links, the result is the same.
It is not a matter of browser, because I'm visiting the remote site and my local copy with the same Firefox.
It is not a matter of security, because obviously locally creating a text file and saving it on my own computer cannot be more insecure than doing the same thing via somebody else's server.
Can someone please tell me what I've missed? How can I get this code to function locally?

jQuery - How to get Print Screen image

I am trying to make a jQuery code to save a screenshot in my web page. I found a lot of plugins that take screenshot of pages.
But this is what I want:
1- The user takes a Print Screen of a issue in the desktop(not in the browser)
2- The user clicks on a Button 'save' in my web page
3- jQuery gets that image and saves into a folder
All the ways I found was to take a WebPage Screenshot.
Is there a way to get the Image that the user toke?
I don't know it may help you,http://codepen.io/reynard2007/pen/xfwoK , i remember long a go i see one codepen is doing the function you want,that is pasting the image in to a canvas

Wordpress tinyMCE edit link dialog not working

I have a problem regarding Wordpress/tinyMCE.
Wordpress is 4.5.2 version, and is managed by hosting, so I can not edit tinyMCE files or replace it with different version but default one.
The problem appears in front end only, while it workt normally in admin part of the WP.
When I click on "insert link" button in the toolbar, no dialog appears, and selected text gets the "a" tag, with href pointing to "_wp_link_placeholder".
TinyMCE is initialized using wp_editor() function from the PHP code.
Thanks in advance!

WordPress : how to add an image upload button to the edit form?

I want to add an image upload button to the WordPress edit form and retrieve the ID of the uploaded media.
If it is possible, I want the user to click the button, choose his image on his computer and then display a tag containing the ID of the media in the textarea. Do you know a way to do that?
Thanks
I found by myself how to add and use a media button. If someone else is searching for that, I wrote a tutorial about doing this on SitePoint. You can also find a French version on my blog.
Basically, it uses the action media_buttons which is currently not listed on the WordPress Codex. This action is called when media buttons are displayed in the WordPress editor: all you have to do is displaying your own button with a dedicated function.
Then, you can open a media window and retrieve the user's selection thanks to a good (but hidden!) API.

Categories