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 🙏

© 2025 – Pkg Stats / Ryan Hefner

grapesjs-script-monaco-editor

v2.0.4

Published

GrapesJS Script Editor with Monaco Editor Integration

Readme

GrapesJS Script Editor with Monaco Editor

Attach script to selected component with Monaco Editor integration

This plugin adds the possibility to attach JavaScript code to any component with the powerful Monaco Editor (the same editor that powers VS Code).

DEMO

Features

  • Zero External Dependencies - Monaco Editor loads automatically from CDN
  • Instant Setup - Just add the plugin to GrapesJS and you're ready to go
  • No Manual Configuration - Monaco Editor initializes seamlessly
  • Single Package - Everything you need in one plugin
  • Rich Syntax Highlighting - JavaScript syntax highlighting with error detection
  • IntelliSense - Intelligent code completion and validation
  • Themes - Multiple built-in themes (VS Dark, VS Light, High Contrast)
  • Advanced Editing - Multi-cursor support, find and replace, code folding, and more
  • Performance - Optimized for large files and better rendering performance
  • Accessibility - Better screen reader support and keyboard navigation

Requires GrapesJS v0.14.25 or higher

Quick Start

// That's it! Monaco Editor loads automatically
grapesjs.init({
  container: '#gjs',
  plugins: ['grapesjs-script-monaco-editor']
});

HTML

<link href="https://unpkg.com/grapesjs/dist/css/grapes.min.css" rel="stylesheet">
<script src="https://unpkg.com/grapesjs"></script>
<script src="dist/grapesjs-script-monaco-editor.min.js"></script>

<div id="gjs"></div>

JS

const editor = grapesjs.init({
  container: '#gjs',
  height: '100%',
  fromElement: true,
  storageManager: false,
  plugins: ['grapesjs-script-monaco-editor'],
  pluginsOpts: {
    'grapesjs-script-monaco-editor': {
      // Monaco Editor loads automatically with these options
      monacoOptions: {
        theme: 'vs-dark', // 'vs', 'vs-dark', 'hc-black'
        fontSize: 14,
        wordWrap: 'on',
        minimap: { enabled: false },
        folding: true,
        lineNumbers: 'on'
      },
      // Monaco Loader configuration (optional)
      monacoLoaderOptions: {
        version: '0.54.0'  // Specify Monaco Editor version
      }
    }
  }
});

CSS

body, html {
  margin: 0;
  height: 100%;
}

Summary

  • Plugin name: grapesjs-script-monaco-editor
  • Integrates Monaco Editor with automatic CDN loading
  • Commands
    • edit-script

Features

Monaco Editor Integration: Full-featured code editor with syntax highlighting, IntelliSense, and error detection
🎨 Multiple Themes: Support for VS Code themes (vs, vs-dark, hc-black)
🔍 Smart Features: Code completion, bracket matching, folding, and find/replace
Real-time Validation: JavaScript syntax validation with inline error highlighting
📱 Responsive: Automatic layout adjustment and mobile-friendly design
🚀 CDN Loading: Automatic Monaco Editor loading from CDN without manual setup

Options

| Option | Description | Default | |-|-|- | starter | Starter code | let el = this | | toolbarIcon | Toolbar icon for opening script modal | <i class="fa fa-file-code-o"></i> | | scriptTypesSupport | Component types to allow script editing | ['default', 'wrapper', 'text', 'textnode', 'image', 'video', 'svg'] | | toolbarBtnCustomScript | Options to pass when extending toolbar | {} | | onRun | Logic to run if debug is successful | () => console.log('valid syntax') | | onError | Logic to run if debug finds errors | err => console.log('error:',err) | | modalTitle | Title for script modal | Script | | monacoOptions | New: Monaco Editor specific options (see below) | { theme: 'vs-dark', language: 'javascript', ... } | | monacoLoaderOptions | New: Monaco Editor loading configuration | { version: '0.54.0' } | | buttonLabel | Label for the default save button | Save | | commandAttachScript | Object to extend the default edit-script command | {} |

Monaco Editor Options (monacoOptions)

| Option | Description | Default | |-|-|- | theme | Editor theme: 'vs', 'vs-dark', 'hc-black' | 'vs-dark' | | fontSize | Font size in pixels | 14 | | wordWrap | Word wrap: 'on', 'off', 'wordWrapColumn', 'bounded' | 'on' | | minimap.enabled | Show/hide minimap | false | | folding | Enable code folding | true | | lineNumbers | Show line numbers: 'on', 'off', 'relative', 'interval' | 'on' | | automaticLayout | Automatically adjust layout | true | | scrollBeyondLastLine | Allow scrolling beyond last line | false | | tabSize | Tab size | 2 |

Monaco Loader Options (monacoLoaderOptions)

| Option | Description | Default | |-|-|- | version | Monaco Editor version to load from CDN | '0.54.0' | | baseUrl | Custom base URL for Monaco Editor | https://unpkg.com/monaco-editor@{version}/min/vs |

Development

Build

npm run build

Start Development Server

npm start

Dependencies

This plugin now uses grapesjs-cli for building and development, following the same pattern as other modern GrapesJS plugins. Monaco Editor is loaded automatically from CDN, eliminating the need for webpack configuration or monaco-editor-webpack-plugin.