Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
Advanced Search
  • 0

Embed-block: How do I disable text selection?


Arandano

Question

My site uses v7.0. I was successful in blocking text selection for the whole site by injecting this code to "Code Injection":

Quote

<script>
  function disableselect(e) {
    return false;
  }

  function reEnable() {
    return true;
  }

  document.onselectstart = new Function("return false");

  if (window.sidebar) {
    document.onmousedown = disableselect;
    document.onclick = reEnable;
  }
</script>

However, this did not work for the embedded Google Docs document and I was able to select the text inside both the code block and the embed block.

I've also tried finding a solution from the Google Docs side, but there doesn't seem to be a way to stop this.

Any suggestions?

Link to post
  • Answers 2
  • Created
  • Last Reply

Top Posters For This Question

Top Posters For This Question

Posted Images

2 answers to this question

Recommended Posts

  • 0

1. Add this to ”Custom CSS”:

.disable-select { -webkit-touch-callout: none; user-select: none; }

2. Add this class to the embed code (iframe tag), should look something like this:

<iframe class=”disable-select”>

Let me know if it works😊

- Rasmus Myhrberg, Maker of Spark

Spark plugin – Get superpowers in Squarespace

Link to post
  • 0
Posted (edited)

Hi Rasmus, thanks for your answer. I tried it, but it didn't have the wanted effect. user-select is active, but I can still select the text inside the embedded code block.

262196789_DevTools-CSSclassdisable-select.thumb.png.a8a0075c519294cd185ec851d7cfdeb7.png

Edited by Arandano
Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment


×
×
  • Create New...