npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

codemirror-advanceddialog

v1.1.9

Published

A more advanced dialog for CodeMirror allowing for multiple inputs and buttons.

Downloads

134

Readme

CodeMirror-AdvancedDialog

A more advanced dialog for CodeMirror allowing for multiple inputs and buttons.

To create a new dialog, use the following command:

cm.openAdvancedDialog(template, opts);

The first parameter is an html template or DOM node much like the vanilla dialog, and the second is an options object with the following properties:

  • shrinkEditor (bool) - If set to true, the editor will shrink to make room for the dialog in order to prevent the dialog obscuring any text.
  • inputBehaviours (object) - an object with behaviours for each input in the order that they appear in the template.
    • closeOnEnter (bool) - if true, the dialog will close if the user hits enter when this field has focus
    • closeOnBlur (bool) - if true, the dialog will close if this field loses focus
    • callback (function) - a callback function that will be executed if the user hits enter when this field has focus. The function receives two parameters - the first is an array of the input fields in the dialog and the second is the DOM event.
  • buttonBehaviours (object) - an object with behaviours for each button in the order that they appear in the template.
    • callback (function) - a callback function that will be executed if the user hits enter when this field has focus. The function receives two parameters - the first is an array of the input fields in the dialog and the second is the DOM event.
    • onClose (function) - a callback that is fired after the dialog is closed. It is passed a single parameter, which is a reference to the dialog DOM element (after is is removed from the DOM).

To install

You can install either manually or via npm. The latter is very simple:

npm install --save codemirror-advancedsearch

If you want to install manually, however, you will need to include both dist/advanced-dialog.js and dist/dialog.css in your page.

Dependencies

Obviously you need to include CodeMirror in the page. You also need to include addons/display/panel.js from the CodeMirror default installation.

Notable Changes

v1.1.3 - 2017-04-19

Implemented a build step using Babel to make the addon compatible with browsers that don't yet support ES6 features. The correct file to include is now dist/advanced-dialog.js.

v1.1.0 - 2017-04-12

The onInput, onKeyDown and onKeyUp behaviours for input boxes now match the signature of the callback, in that they each are passed two parameters: an array of the inputs in the dialog, and the DOM event that triggered the function call.