Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <textarea id="mytextarea">Hello, World!</textarea>
              
            
!

CSS

              
                .mce-floatpanel {
  min-width: 425px;
  max-height: 100%;
  overflow-x: hidden;
  overflow-y: scroll;
}

              
            
!

JS

              
                tinymce.PluginManager.add("example_widgets", function (editor, url) {
  editor.addButton("example_widgets", {
    text: "All Widgets",
    title: "Click to view widgets",
    onclick: function () {
      editor.windowManager.open({
        title: "Example Widgets",
        body: [
          {
            type: "textbox",
            name: "textbox",
            label: "textbox",
            tooltip: "Some nice tooltip to use",
            value: "default value"
          },
          {
            type: "textbox",
            name: "textbox multiline",
            label: "textbox multiline",
            multiline: true,
            value: "default value\non another line"
          },
          {
            type: "listbox",
            name: "listbox",
            label: "listbox",
            values: [
              { text: "Test", value: "test" },
              { text: "Test2", value: "test2", selected: true }
            ]
          },
          {
            type: "combobox",
            name: "combobox",
            label: "combobox",
            values: [
              { text: "Test", value: "test" },
              { text: "Test2", value: "test2" }
            ]
          },
          {
            type: "tooltip",
            name: "tooltip",
            label: "tooltip",
            text: "Tooltip"
          },
          {
            type: "button",
            name: "button",
            label: "button",
            text: "My Button",
            onclick: function (e) {
              alert("Click");
            }
          },
          {
            type: "buttongroup",
            name: "buttongroup",
            label: "buttongroup",
            items: [
              {
                text: "Button 1",
                value: "button1",
                onclick: function (e) {
                  alert("Click");
                }
              },
              { text: "Button 2", value: "button2", tooltip: "A button" }
            ]
          },
          {
            type: "checkbox",
            name: "checkbox",
            label: "checkbox",
            text: "My Checkbox",
            checked: true
          },
          {
            type: "colorpicker",
            name: "colorpicker",
            label: "colorpicker"
          }
        ]
      });
    }
  });
});
tinymce.PluginManager.add("zz_tc_simple", function (editor, url) {
  editor.addButton("zz_tc_simple", {
    text: "Simple",
    onclick: function () {
      editor.insertContent("Just some simple text");
    }
  });
});
tinymce.PluginManager.add("zz_tc_button", function (editor, url) {
  editor.addButton("zz_tc_button", {
    text: "ZZ Button",
    title: "Insert Button",
    onclick: function () {
      editor.windowManager.open({
        title: "Insert Button",
        width: 500,
        height: 300,
        body: [
          {
            type: "textbox",
            name: "url",
            label: "URL"
          },
          {
            type: "textbox",
            name: "label",
            label: "Link Text"
          },
          {
            type: "checkbox",
            name: "newtab",
            label: " ",
            text: "Open link in new tab",
            checked: true
          },
          {
            type: "listbox",
            name: "style",
            label: "Button Style",
            values: [
              { text: "Primary", value: "default" },
              { text: "Secondary", value: "secondary" },
              { text: "Disabled", value: "disabled" }
            ]
          }
        ],
        onsubmit: function (e) {
          let $content =
            '<a href="' +
            e.data.url +
            '" class="btn' +
            (e.data.style !== "default" ? " " + e.data.style : "") +
            '"' +
            (!!e.data.newtab ? ' target="_blank"' : "") +
            ">" +
            e.data.label +
            "</a>";
          editor.insertContent($content);
        }
      });
    }
  });
});
tinymce.PluginManager.add("zz_tc_list", function (editor, url) {
  editor.addButton("zz_tc_list", {
    text: "ZZ List",
    title: "Insert List",
    onclick: function () {
      editor.windowManager.open({
        title: "Insert List",
        width: 500,
        height: 300,
        body: [
          {
            type: "container",
            label: "Instructions",
            html:
              "&nbsp;<br /><i>Choose the type of list and the number of<br /> columns that will display on desktop.<br /></i>&nbsp;"
          },
          {
            type: "listbox",
            name: "type",
            label: "List Type",
            tooltip: "Choose type of list.",
            values: [
              { text: "Bulleted List", value: "ul" },
              { text: "Numbered List", value: "ol" }
            ]
          },
          {
            type: "listbox",
            name: "cols",
            label: "Number of Columns",
            tooltip:
              "Choose the number of columns that will display on the website on desktop.",
            values: [
              { text: "1", value: "1" },
              { text: "2", value: "2" },
              { text: "3", value: "3" },
              { text: "4", value: "4" }
            ]
          }
        ],
        onsubmit: function (e) {
          let i,
            $lipsum = "",
            $content = "";
          for (i = 0; i < e.data.cols; i++) {
            $lipsum += "<li>Lorem ipsum dolor sit amet</li>";
          }

          $content =
            "<" +
            e.data.type +
            ' class="cols-' +
            e.data.cols +
            '">' +
            $lipsum +
            "</" +
            e.data.type +
            ">";
          editor.insertContent($content);
        }
      });
    }
  });
});

tinymce.init({
  selector: "#mytextarea",
  plugins: "example_widgets zz_tc_simple zz_tc_button zz_tc_list",
  toolbar: "example_widgets zz_tc_simple zz_tc_button zz_tc_list"
});

              
            
!
999px

Console