Skip to content

samvasko/scribe-plugin-image-prompt-command

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Scribe image prompt commmand

Installation

Using npm npm install --save scribe-plugin-image-prompt-command

Using bower bower install --save scribe-plugin-image-prompt-command

I may actually provide a release builds outside of npm/bower if somebody will show an interest.

Usage

Can be required with browserify, used as AMD or included in script. npm version will not work with last two

API

var imagePrompt = require('scribe-plugin-image-prompt-command');

/**
 * Creates simple image. You can pass it a link prompt function
 * that will be called when command is executed. The function should return
 * valid url. So please validate.
 * @optional  {Object}   options Options for created image
 * @optional  {Function} prompt  Function for getting the url
 * @return    {Function}
 */
scribe.use({attributes: {'class': 'post-image'}}, imagePrompt(function() {
    // Show your modal or whatever
    return window.prompt('Url please');

    // or pass extra attributes form modal
    return {attributes: {height: 200}, url: 'someurl'};
}));

// Now can be executed like any other scribe command

About

Simple prompt for creating images in Scribe

Resources

License

Stars

Watchers

Forks

Packages

No packages published