Coder Social home page Coder Social logo

tinymce-placeholder's Introduction

Placeholder text plugin for TinyMCE

This plugin brings HTML5 placeholder attribute functionality for the TinyMCE editor.

Usage

  • Add the plugin script to the page
  • Add "placeholder" to tinymce config plugins array.
  • Add a placeholder attribute to the textarea as usual or set placeholder property in editor settings.

Note: This plugin is not compatible with TinyMCE inline mode. It only works in classic mode.

Installation with bower

To install plugin using bower use command bower install tinymce-placeholder-attribute

Example

Tinymce Plugins Array: plugins: "fullscreen placeholder"

Textarea: <textarea class="tinymce" placeholder="Hello World!"></textarea>

Styling the placeholder label

By default, this plugin styles the placeholder with the following attributes:

{
  style: {
    position: 'absolute',
    top:'5px',
    left:0,
    color: '#888',
    padding: '1%',
    width:'98%',
    overflow: 'hidden',
    'white-space': 'pre-wrap'
  }
}

You can replace this styling by providing a placeholder_attrs section in your TinyMCE config...

tinyMCE.init({
  plugins: 'placeholder',
  placeholder_attrs: // (new value for the above object...)
});

Or alternatively, you can override specific properties of the default CSS by providing the !important directive along in your CSS property for the label...

.mce-edit-area {
  label {
    color: #A9A9A9 !important; /* Override text color */
    left: 5px !important; /* Override left positioning */
  }
}

tinymce-placeholder's People

Contributors

mohansandesh avatar aguynamedben avatar radicalsauce avatar kiwka avatar elnino3800 avatar afzalh avatar gappc avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.