<!-- Appears on Tiny Blueprint (https://www.tiny.cloud/blog/) in articles:
 - TinyMCE readonly mode-->
<textarea><h2 style="text-align: center;">👽<br />THE EVE OF THE WAR</h2>
<p>No one would have believed in the last years of the nineteenth century that this world was being watched keenly and closely by intelligences greater than man&rsquo;s and yet as mortal as his own; that as men busied themselves about their various concerns they were scrutinised and studied, perhaps almost as narrowly as a man with a microscope might scrutinise the transient creatures that swarm and multiply in a drop of water.</p></textarea>

<br><br>
<label class="container">Editable ("design") mode
  <input type="checkbox" checked onclick="toggleEditorMode(this.checked); return true;">
  <span class="checkmark"></span>
</label>
<br>
Use the checkbox to toggle between the "design" and "readonly" modes.
@import url('https://fonts.googleapis.com/css2?family=Warnes&family=Roboto:wght@300&display=swap');

body {
  margin: 2rem;
  background-color: #2f3742;
  font-family: 'Roboto', sans-serif;
  color: #DFE0E4;
}

/* Customize the label (the container) */
.container {
  display: block;
  position: relative;
  padding-left: 50px;
  margin-bottom: 12px;
  cursor: pointer;
  font-size: 22px;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

/* Hide the browser's default checkbox */
.container input {
  position: absolute;
  opacity: 0;
  cursor: pointer;
  height: 0;
  width: 0;
}

/* Create a custom checkbox */
.checkmark {
  position: absolute;
  top: 0;
  left: 0;
  height: 25px;
  width: 25px;
  background-color: #DFE0E4;
}

/* On mouse-over, add a grey background color */
.container:hover input ~ .checkmark {
  background-color: #ccc;
}

/* When the checkbox is checked, add a blue background */
.container input:checked ~ .checkmark {
  background-color: #FFFFFF;
  box-shadow: 0 0 5px #fff, 0 0 10px #fff, 0 0 15px #0073e6, 0 0 20px #0073e6, 0 0 25px #0073e6, 0 0 30px #0073e6, 0 0 35px #0073e6;
}

/* Create the checkmark/indicator (hidden when not checked) */
.checkmark:after {
  content: "";
  position: absolute;
  display: none;
}

/* Show the checkmark when checked */
.container input:checked ~ .checkmark:after {
  display: block;
}

/* Style the checkmark/indicator */
.container .checkmark:after {
  left: 9px;
  top: 5px;
  width: 5px;
  height: 10px;
  border: solid #0073e6;
  border-width: 0 3px 3px 0;
  -webkit-transform: rotate(45deg);
  -ms-transform: rotate(45deg);
  transform: rotate(45deg);
}
tinymce.init({
  selector: "textarea",
  plugins: "code",
  height: 410,
  skin: "oxide-dark",
  content_style: `
@import url('https://fonts.googleapis.com/css2?family=Warnes&family=Roboto:wght@300&display=swap');

body {
    background-color: #2f3742;
    color: #dfe0e4;
}

p {
    font-family: 'Roboto', sans-serif;
}

h2 {
    font-size: 32px;
    text-align: center;
    font-family: 'Warnes', cursive;
    color: #fff;
    text-shadow: 0 0 5px #fff, 0 0 10px #fff, 0 0 15px #0073e6, 0 0 20px #0073e6, 0 0 25px #0073e6, 0 0 30px #0073e6, 0 0 35px #0073e6;
}
  `
});

function toggleEditorMode(mode) {
  if (mode) {
    tinymce.activeEditor.mode.set("design");
  } else {
    tinymce.activeEditor.mode.set("readonly");
  }
}

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

  1. https://cdn.tiny.cloud/1/qagffr3pkuv17a8on1afax661irst1hbr4e6tbv888sz91jc/tinymce/5/tinymce.min.js