Code Monkey home page Code Monkey logo

splendid's Introduction

Splendid

Splendid is a simple jQuery textbox editor. It isn't a WYSIWYG so if that's what you're after then leave now. Splendid allows you to replace text with things like BBCode, Markdown, Textile or whatever you fancy. Simply create some custom mappings and you're away.

Maps

Splendid uses maps to associate different items with specific actions. Let's take a look at an example map.

bold: {
	placeholder: 'Bold',
	before: '**',
	after: '**',
	class: 'bold'
}

The name for this property is 'bold', and we assign an object to this property. The object can have a number of different properties, the most basic is shown.

placeholder

Placeholder text is inserted when no text is selected. After the placeholder is inserted it is then selected so users can begin editing the text as quickly as possible.

before

This is the text to be placed before the selected text, or before the cursor if no text is selected.

after

This is the text to be placed after the selected text, or after the cursor if no text is selected.

replace

This is the text that will replace the selected text, or just insert at the cursors current position.

class

Each item can be assigned a unique class to assist with styling.

Custom Prompts

It's often nice to request input from the user, say for example when inserting a hyperlink. Splendid allows simple prompts to be displayed to users asking for input. The syntax is as follows.

[@Title:default]

Example:

[@URL:http://]

Examples

Inserting a markdown styled hyperlink at the current cursor position.

link: {
	placeholder: 'Link',
	before: '[',
	after: ']([@URL:http://] "[@Title]")',
	class: 'link'
}

Inserting a BBCode styled hyperlink at the current cursor position.

link: {
	placeholder: 'Link',
	before: '[url=[@URL:http://]]',
	after: '[/url]',
	class: 'link'
}

splendid's People

Contributors

jasonlewis avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

mnishihan

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.