wiliammbr's blog

Some thoughts on SharePoint and other random stuff

Paste images to SharePoint pages

One thing that I had to face and discuss at least once a month among Clients requests was: an easy way to paste images into SharePoint pages. Although my automatic answer was always “Just upload it through the ribbon, so you can tag and ensure the content quality”, I have to admit this way isn’t THAT user-friendly.

That’s why I decided to develop some JavaScript code to add this functionality to my Web Pages, so the users could be able to add their images faster. Basically, I’ve created a GitHub repository to keep the code, so maybe someone can help me on refactoring it or adding support for others browsers.

https://github.com/wiliammbr/sp-copypasteimages

The project is a SharePoint provider-hosted app that publishes some JavaScript files to your Site Assets library. It was based on some SharePoint projects in the PnP – Patterns and Practices, hosted by Microsoft. Also, it will add ScriptLinks to insert those script files into your pages. In my example, the app was hosted in an Azure Cloud Service.

But if your prefer, it’s possible to add those scripts into your Master Page files, so you don’t need the Provider-hosted App approach.

Copying the image

The functionality will be installed and attached to the Body fields on your pages. So you can just copy an image from your photo viewer or editor.

Pasting the image

Just focus the cursor in the the body of your Page and paste it:

The result

References:
THE DEFINITIVE GUIDE TO COPYING AND PASTING IN JAVASCRIPT
SharePoint – PnP – Patterns and Practices

1 Comment

  1. Sugoi

Leave a Reply

Your email address will not be published.

*

© 2018 wiliammbr's blog

Theme by Anders NorenUp ↑