0.0.9-alpha2 • Published 4 months ago

cw-editor v0.0.9-alpha2

Weekly downloads
-
License
-
Repository
github
Last release
4 months ago

CW Editor

preview

npm version

This is a wrapper for the Monaco Editor, which is a browser-based code editor. It is a component that can be used in any web application. It is based on the Monaco Editor. The Monaco Editor is the code editor that powers Visual Studio Code.

This was created to be used in courses delivered by CodeWorks, but can be used in any web application. It is a simple wrapper that allows you to easily add a code editor to your web application.

It even supports loading files directly from github, or any other URL that returns an array of files in the following format.

[
  {
    "name": "filename.ext",
    "content": "file content"
  }
]

You can customize the editor by passing in options to the <Editor /> component.

Installation

npm install cw-editor

Usage

<script setup>
import { Editor } from 'cw-editor'

</script>

<template>
  <Editor src="" />
</template>

Props

NameTypeDefaultDescription
srcString""The URL to load the files from
filesArray[]An array of files to load into the editor
projectNameString"localstorage-key"saves and loads from localstorage
defaultFilesArray'readme.md'Files to show in the file explorer
hiddenFilesArray[]Files to hide from the file explorer
sizesArray10, 70, 30The sizes of the file explorer, editor, and output window

Events

NameDescription
saveEmitted when the user saves a file
changeEmitted when the user changes the file
0.0.9-alpha2

4 months ago

0.0.9-alpha1

4 months ago

0.0.9-alpha0

4 months ago

0.0.9

10 months ago

0.0.8

10 months ago

0.0.7

10 months ago

0.0.6

10 months ago

0.0.5

10 months ago

0.0.4

10 months ago

0.0.3

10 months ago

0.0.2

10 months ago

0.0.1

10 months ago