diff --git a/.eslintignore b/.eslintignore
new file mode 100644
index 0000000..7b9ae07
--- /dev/null
+++ b/.eslintignore
@@ -0,0 +1,26 @@
+# Logs
+logs
+*.log
+npm-debug.log*
+yarn-debug.log*
+yarn-error.log*
+pnpm-debug.log*
+lerna-debug.log*
+
+node_modules
+dist
+dist-ssr
+*.local
+
+# Editor directories and files
+.vscode/*
+!.vscode/extensions.json
+.idea
+.DS_Store
+*.suo
+*.ntvs*
+*.njsproj
+*.sln
+*.sw?
+
+public
\ No newline at end of file
diff --git a/.eslintrc.cjs b/.eslintrc.cjs
new file mode 100644
index 0000000..79eb2b3
--- /dev/null
+++ b/.eslintrc.cjs
@@ -0,0 +1,27 @@
+/* eslint-env node */
+require('@rushstack/eslint-patch/modern-module-resolution')
+
+module.exports = {
+ root: true,
+ extends: [
+ 'eslint:recommended',
+ 'plugin:vue/vue3-essential',
+ '@vue/eslint-config-typescript'
+ ],
+ parserOptions: {
+ ecmaVersion: 'latest'
+ },
+ rules: {
+ quotes: ['error', 'single'], // 使用单引号
+ semi: ['error', 'never'], // 禁止在语句末尾使用分号
+ 'space-before-function-paren': ['error', 'always'], // function 左括号之前需要有空格
+ 'arrow-spacing': ['error', { before: true, after: true }], // 箭头函数箭头前后需要有空格
+ 'comma-spacing': ['error', { 'before': false, 'after': true }], // 逗号后面有空格,前面没有空格
+ 'object-curly-spacing': ['error', 'always'], // 大括号左右需要有空格
+ 'space-before-blocks': ['error', 'always'], // 大括号之前需要有空格
+ 'space-infix-ops': 'error', // 运算符周围需要有空格
+ 'key-spacing': ['error', { beforeColon: false, afterColon: true }], // 冒号左边不需要空格,右边需要空格
+ 'indent': ['error', 2], // 缩进为2个空格
+ 'vue/html-indent': ['error', 2, {}], // 模板缩进为2个空格
+ }
+}
diff --git a/.github/workflows/github-deploy.yml b/.github/workflows/github-deploy.yml
new file mode 100644
index 0000000..b4940bf
--- /dev/null
+++ b/.github/workflows/github-deploy.yml
@@ -0,0 +1,37 @@
+name: Build and Deploy
+
+on:
+ pull_request:
+ branches: main
+ push:
+ branches: main
+
+jobs:
+ build-and-deploy:
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout 🛎️
+ uses: actions/checkout@v3
+
+ - name: Node Version Change ➕
+ uses: actions/setup-node@v3
+ with:
+ node-version: 16
+
+ - name: Use Pnpm ➕
+ uses: pnpm/action-setup@v2
+ with:
+ version: 6
+ run_install: false
+
+ - name: Install and Build 🔧
+ run: |
+ pnpm i
+ pnpm run gh-pages
+
+ - name: Deploy 🚀
+ uses: JamesIves/github-pages-deploy-action@v4
+ with:
+ branch: gh-pages
+ token: ${{ secrets.PERSONAL_TOKEN }}
+ folder: dist
\ No newline at end of file
diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml
index 8487ec8..c61e90b 100644
--- a/.github/workflows/npm-publish.yml
+++ b/.github/workflows/npm-publish.yml
@@ -1,50 +1,36 @@
-name: Node.js Package & gh-pages Build
+name: Build and Publish
on:
pull_request:
- branches:
- - main
+ branches: main
+ push:
+ branches: main
jobs:
- publish-npm:
+ build-and-publish:
runs-on: ubuntu-latest
steps:
- - uses: actions/checkout@v3
- - uses: actions/setup-node@v3
+ - name: Checkout 🛎️
+ uses: actions/checkout@v3
+
+ - name: Node Version Change ➕
+ uses: actions/setup-node@v3
with:
node-version: 16
registry-url: https://registry.npmjs.org/
- - uses: pnpm/action-setup@v2
+
+ - name: Use Pnpm ➕
+ uses: pnpm/action-setup@v2
with:
version: 6
run_install: false
- - run: pnpm i
- - run: pnpm run build
- - run: pnpm publish
- env:
- NODE_AUTH_TOKEN: ${{secrets.npm_token}}
-
- create-githubpage:
- # needs: publish-npm
- runs-on: ubuntu-latest
- permissions:
- contents: read
- packages: write
- steps:
- - uses: actions/checkout@v3
- - uses: actions/setup-node@v3
- with:
- node-version: 16
- - uses: pnpm/action-setup@v2
- with:
- version: 6
- run_install: false
- - name: gh-pages build
- run: |
+
+ - name: Install and Build 🔧
+ run: |
pnpm i
- pnpm run gh-pages
- - name: Deploy
- uses: peaceiris/actions-gh-pages@v3
- with:
- personal_token: ${{ secrets.PERSONAL_TOKEN }}
- publish_dir: ./dist
+ pnpm run build
+
+ - name: Publish 🚀
+ run: pnpm publish
+ env:
+ NODE_AUTH_TOKEN: ${{secrets.npm_token}}
\ No newline at end of file
diff --git a/.gitignore b/.gitignore
index 185e663..d2aa069 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,21 +1,4 @@
.DS_Store
node_modules
-/dist
-# local env files
-.env.local
-.env.*.local
-
-# Log files
-npm-debug.log*
-yarn-debug.log*
-yarn-error.log*
-
-# Editor directories and files
-.idea
-.vscode
-*.suo
-*.ntvs*
-*.njsproj
-*.sln
-*.sw*
+dist/*
diff --git a/.vscode/extensions.json b/.vscode/extensions.json
new file mode 100644
index 0000000..c0a6e5a
--- /dev/null
+++ b/.vscode/extensions.json
@@ -0,0 +1,3 @@
+{
+ "recommendations": ["Vue.volar", "Vue.vscode-typescript-vue-plugin"]
+}
diff --git a/.vscode/settings.json b/.vscode/settings.json
new file mode 100644
index 0000000..3e7c0fe
--- /dev/null
+++ b/.vscode/settings.json
@@ -0,0 +1,6 @@
+{
+ "editor.codeActionsOnSave": {
+ "source.fixAll": false,
+ "source.fixAll.eslint": true
+ }
+}
\ No newline at end of file
diff --git a/README.md b/README.md
index 8b6232c..79c1d49 100644
--- a/README.md
+++ b/README.md
@@ -1,8 +1,9 @@
# simple-m-editor
-> A markdown editor with Vue@2.7
+> A markdown editor with Vue@3
-If you want to use it with the eaiser vue version, you can use simple-m-editor@0.4.6
+If you want to use it with vue@2.7, you can use simple-m-editor@2.x.
+If you want to use it with vue@2.6 or older version, you can use simple-m-editor@0.4.
![GitHub package.json version](https://img.shields.io/github/package-json/v/hellomrbigshot/simple-m-editor)
![GitHub](https://img.shields.io/github/license/hellomrbigshot/simple-m-editor)
@@ -28,8 +29,8 @@ pnpm i simple-m-editor
// you can add class "m-editor-preview" to your element to
// use the same style as the editor shows
+