Giter Club home page Giter Club logo

medium-editor-multi-placeholders-plugin's Introduction

MediumEditorMultiPlaceholders Plugin

A plugin that allows you to setup multiple placeholders with MediumEditor

NPM

Travis Build Status Dependency Status devDependency Status

Demo

Demo

Try at Demo page

Basic usage

Installation

Via npm:

Run in your console:

npm install medium-editor-multi-placeholders-plugin

Then build the project by running

grunt

Via bower:

bower install medium-editor-multi-placeholders-plugin

Usage

First thing: don't forget to load the plugin after MediumEditor

<script src="dist/medium-editor-multi-placeholders-plugin.min.js"></script>

Now when you create MediumEditor instance, just disable normal placeholder and specify the extension and placeholder options:

var editor = new MediumEditor('#editor', {
      placeholder: false,
      extensions: {
        'multi_placeholder': new MediumEditorMultiPlaceholders({
          placeholders: [
              {
                tag: 'h1',
                text: 'Title'
              },
              {
                tag: 'p',
                text: 'Tell your story...'
              }
          ]
        })
      }
    });

Plugin Options

The plugin itself only takes one option: placeholders which is an array of placeholder objects. Each placeholder object is in the format { tag: 'HTMLTag', text: 'Placeholder Text' }.

var multiPlaceholders = new MediumEditorMultiPlaceholders({
    placeholders: [
	    /* Your place holders goes here
	       You can have as many placeholders as you want!
	       Example: { tag: 'h1', text: 'Title' } */
    ]
});

Known Issues

Conflicts with MediumEditor Insert Plugin, because placeholder: false doesn't work with the some version of the it.

License

MIT: https://github.com/smiled0g/medium-editor-multi-placeholders-plugin/blob/master/LICENSE

medium-editor-multi-placeholders-plugin's People

Contributors

smiled0g avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

medium-editor-multi-placeholders-plugin's Issues

placeholders doesnt work in a right way

subj :)

So, we are on demo page. Put focus into a editor field on last placeholder and keydown backspace.
All placeholders wiil remove one by one, and there is no way to return they back

Typed text appears above placeholder text in Firefox

I initially thought that this was an error on my own site, but I can actually reproduce it without any playing around with the code on the demo site. Essentially, when using Firefox (tested on both 54.0.1 64-bit and 55.0.2 64-bit), when you click in a bit of placeholder text and start typing, the text you enter appears above the placeholder text, outside of the markup tags. If I switch over to Chrome however; everything works as intended.

Pressing enter after placeholder inserts new block

In the demo, type in the first row. instead of pressing down-arrow to get to the next line, press enter.
On the next line you are typing in whatever the default block object is for that browser. In chrome and safari it's a p. In Firefox it's a div.

On the last entry pressing enter duplicates the item, which may or may not be intended (in my case I like it, but it's also reported as an issue).

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.