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

monaco-code

v0.0.2

Published

基于 `monaco-editor` Vue 版本编辑器

Downloads

3

Readme

monaco-code

基于 monaco-editor Vue 版本编辑器

在线示例

请查看

monaco-code

安装

cnpm i monaco-code

使用方法

<template>
  <MonacoCodeEditor :value="...">
</template>

<script>
  import MonacoCode from "monaco-code"
  Vue.use(MonacoCode)
</script>

or

<template>
  <MonacoCodeEditor :value="...">
</template>

<script>
  import { MonacoCodeEditor } from "monaco-code"
  Vue.component("MonacoCodeEditor", MonacoCodeEditor)
</script>

参数说明

value, language, theme 这些参数优先级更高,会覆盖 options 里相同字段

| 参数 | 说明 | 类型 | 默认值 | | -------- | ------ | ------ | -------------------------------------------- | | value | 初始值 | string | | | language | 语言 | string | javascript | json | html 默认 javascript | | height | 初始值 | string | | | width | 初始值 | string | | | theme | 主题 | string | vs | vs-dark | hc-black 默认 vs | | options | 配置项 | object | 参考下文 |

options 参数

| 参数 | 说明 | 类型 | 默认值 | | ----------------------- | ---------------------------- | ------- | ------------------------------------------------------- | | theme | 主题 | string | vs | vs-dark | hc-black 默认 vs | | value | 默认显示值 | string | | | language | 语言 | string | javascript | json | html 默认 javascript | | fontSize | 字体大小 | number | 14 | | folding | 是否折叠 | boolean | true | | foldingHighlight | 折叠等高线 | boolean | true | | foldingStrategy | 折叠方式 | string | auto | indentation 默认 indentation | | showFoldingControls | 是否一直显示折叠 | string | always | mouseover | | disableLayerHinting | 等宽优化 | boolean | true | | emptySelectionClipboard | 空选择剪切板 | boolean | false | | selectionClipboard | 选择剪切板 | boolean | false | | automaticLayout | 自动布局 | boolean | true | | autoIndent | 自动锁进 | boolean | true | | codeLens | 代码镜头 | boolean | false | | scrollBeyondLastLine | 滚动完最后一行后再滚动一屏幕 | boolean | false | | colorDecorators | 颜色装饰器 | boolean | false | | accessibilitySupport | 辅助功能支持 | string | auto | off | on 默认值 off | | selectOnLineNumbers | 显示行号 | boolean | true | | lineNumbers | 行号 | string | on | off | relative | interval | function 默认 on | | lineNumbersMinChars | 行号最小字符 | number | 5 | | enableSplitViewResizing | 自动切换视图 | boolean | false | | readOnly | 是否只读 | boolean | false |

方法说明

可供外部调用的方法

| 方法 | 说明 | 参数 | 返回值 | 备注 | | ------------- | ------------------ | --------------- | ------------------------- | -------- | | mounted | 编辑器创建完成后 | editor:instance | 编辑器实例 | | | setValue | 设置初始值 | value:string | | 暂不支持 | | setTheme | 设置主题 | theme:string | vs | vs-dark | hc-black | 暂不支持 | | getValue | 获取编辑器值 | | value:string | 暂不支持 | | changeOptions | 修改编辑器配置 | options:object | | | | setLanguage | 动态修改编辑器语言 | language:string | | 暂不支持 | | touchTrigger | 主动触发编辑器事件 | action:string | | 暂不支持 |

Vue 插件配置

需要配置插件monaco-editor-webpack-plugin才可以使用

npm i monaco-editor-webpack-plugin -D
const MonacoWebpackPlugin = require("monaco-editor-webpack-plugin")

module.exports = {
  ...
  configureWebpack: {
    plugins: [
      new MonacoWebpackPlugin({
        languages: ["javascript", "css", "html", "typescript", "json", "xml"]
      })
    ]
  }
  ...
}