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

vue-editor-mar

v1.0.3

Published

vue 编辑器

Downloads

10

Readme

vue 编辑器

目前是代码类编辑器,在线代码编辑器

支持高亮,语法提示等


安装使用

1.引入

yarn add vue-editor-mar
<!-- 编辑器引用 -->
<VueEditorMar
  ref="VueEditorMar"
  :content="content"
  :config="config"
/>
import VueEditorMar from 'vue-editor-mar';
import 'vue-editor-mar/lib/theme-chalk/index.css';

Vue.use(VueEditorMar);

// vue
data() {
  return {
    // 编辑器文本
    content: 'Hello w2222orld!',
    // 配置对象
    config: {
      wordType: {
        keyword: ['keyworda', 'keywordb'],
        condition: ['if', 'else'],
        operator: ['>', '='],
        split: [';'],
        function: ['add'],
      },
    },
  };
},

//ref方法调用
this.$refs['VueEditorMar'].getContent();

2.默认config配置

{
  wordType:{
    keyword: [
      'function', 'SELECT', 'DISTINCT',
      'FROM', 'AS', 'ON', 'INNER', 'JOIN', 'LEFT',
      'WHERE', 'IS', 'NOT', 'NULL', 'ORDER', 'BY',
      'PARTITION', 'over', 'DESC', 'type', 'this', 'const',
    ],
    condition: [
      'if', 'else', 'while',
    ],
    operator: [
      '+', '-', '*', '/', '>', '<', '=', '(', ')', '{', '}', '[', ']',
    ],
    split: [
      '.', ';', ',',
    ],
    function : []
  },
}

3.method

getContent: 获取编辑器内文本内容

4.说明

当需要在外部高级自定义源码级别操作编辑器,调用编辑器api时,可以将内置的 dataController 外置即可。

<!-- 编辑器引用 -->
<VueEditorMar
  :data-controller="ruleDataController"
/>
this.ruleDataController = new this.$EditorDataController.DataController({
})

本地测试

  1. 执行 test.sh
  2. 修改src/index.js为
// import 'styles';
// import VueEditorMar from './packages';
import VueEditorMar from 'vue-editor-mar';
import 'vue-editor-mar/lib/theme-chalk/index.css';

本地调试

  1. src/index.js修改VueEditorMar引用为./packages
import 'styles';
import VueEditorMar from './packages';
// import VueEditorMar from 'vue-editor-mar';
// import 'vue-editor-mar/lib/theme-chalk/index.css';
  1. yarn start

编译发布

  1. yarn dist 编译生成lib目录
  2. 修改package.json版本
  3. npm login marjoven *****
  4. npm publish

问题记录

需要增加编译css功能 以及单独的编辑器组件npm发布 内置编辑器datacontro

参考elementui的内容

1.elementui的build流程

{
  "build:file": `
                node build/bin/iconInit.js &
                node build/bin/build-entry.js &
                node build/bin/i18n.js &
                node build/bin/version.js
                `,
  // 生成全部js 和 css文件
  "dist": `
          npm run clean &&
          npm run build:file &&
          npm run lint &&
          webpack --config build/webpack.conf.js &&
          webpack --config build/webpack.common.js &&
          webpack --config build/webpack.component.js &&
          npm run build:utils &&
          npm run build:umd &&
          npm run build:theme
          `,
  // css生成
  "build:theme": "node build/bin/gen-cssfile && gulp build --gulpfile src/packages/theme-chalk/gulpfile.js && cp-cli src/packages/theme-chalk/lib lib/theme-chalk",

}
  • build/bin/build-entry

通过模版生成src/index.js