diff --git a/.eslintrc.js b/.eslintrc.js new file mode 100644 index 0000000..4ed04c5 --- /dev/null +++ b/.eslintrc.js @@ -0,0 +1,19 @@ +module.exports = { + root: true, + env: { + node: true + }, + extends: ["plugin:vue/recommended", "@vue/prettier"], + rules: { + "no-console": process.env.NODE_ENV === "production" ? "error" : "off", + "no-debugger": process.env.NODE_ENV === "production" ? "error" : "off" + }, + parserOptions: { + parser: "babel-eslint" + } +}; + +// "plugin:vue/recommended", +// "eslint:recommended", +// "prettier/vue", +// "plugin:prettier/recommended" diff --git a/.github/workflows/CLOSE_STALE.yml b/.github/workflows/CLOSE_STALE.yml new file mode 100644 index 0000000..2c15bb5 --- /dev/null +++ b/.github/workflows/CLOSE_STALE.yml @@ -0,0 +1,23 @@ +name: Close inactive issues +on: + schedule: + - cron: "0 8 * * *" + workflow_dispatch: + +jobs: + close-issues: + runs-on: ubuntu-latest + permissions: + issues: write + pull-requests: write + steps: + - uses: actions/stale@v4 + with: + operations-per-run: '100' + days-before-issue-stale: 60 + days-before-issue-close: 7 + stale-issue-label: "stale" + stale-issue-message: "This issue is stale because it has been open for 60 days with no activity." + close-issue-message: "This issue was closed because it has been + inactive for 7 days since being marked as stale." + repo-token: ${{ secrets.GITHUB }} diff --git a/.github/workflows/manual.yml b/.github/workflows/manual.yml new file mode 100644 index 0000000..47f24e1 --- /dev/null +++ b/.github/workflows/manual.yml @@ -0,0 +1,30 @@ +# This is a basic workflow that is manually triggered + +name: Manual workflow + +# Controls when the action will run. Workflow runs when manually triggered using the UI +# or API. +on: + workflow_dispatch: + # Inputs the workflow accepts. + inputs: + name: + # Friendly description to be shown in the UI instead of 'name' + description: 'Person to greet' + # Default value if no value is explicitly provided + default: 'World' + # Input has to be provided for the workflow to run + required: true + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + # This workflow contains a single job called "greet" + greet: + # The type of runner that the job will run on + runs-on: ubuntu-latest + + # Steps represent a sequence of tasks that will be executed as part of the job + steps: + # Runs a single command using the runners shell + - name: Send greeting + run: echo "Hello ${{ github.event.inputs.name }}" diff --git a/.gitignore b/.gitignore old mode 100755 new mode 100644 index a2222bb..c5bfa0b --- a/.gitignore +++ b/.gitignore @@ -1,19 +1,31 @@ -.idea/ -node_modules/ -demo/ -.npmignore .DS_Store -npm-debug.log +node_modules +# public +dist/*.gz +dist/*.gz +dist/.DS_Store +coverage +docs/.vuepress/dist +# dist +# local env files +.env.local +.env.*.local -*.log -**/**/.DS_Store - -# produced by vbuild -dist -dist-example - -dev/cloudinary.vue -dev/Backup-App.vue -NOTES.md +# related test files +/tests/e2e/reports +/tests/e2e/videos +/tests/e2e/screenshots +# editor directories and files +.idea +.vscode +*.suo +*.ntvs* +*.njsproj +*.sln +*.sw* +# Backups .BACKUP +.STORAGE + +public-demos \ No newline at end of file diff --git a/.release-it.json b/.release-it.json deleted file mode 100644 index b5da5a9..0000000 --- a/.release-it.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "non-interactive": true, - "pkgFiles": ["package.json"], - "increment": "conventional:angular", - "beforeChangelogCommand": "conventional-changelog -p angular -i CHANGELOG.md -s", - "changelogCommand": "conventional-changelog -p angular | tail -n +3", - "safeBump": false, - "requireUpstream": false, - "github": { - "release": true, - "tokenRef": "GITHUB_TOKEN" - }, - "buildCommand": "npm run build" -} diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..7ceeda1 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,4 @@ +{ + "vetur.validation.template": false, + "workbench.colorCustomizations": {} +} diff --git a/CHANGELOG.md b/CHANGELOG.md index 7b091f2..b3ada1c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,55 +1,506 @@ - -## [2.6.6](https://github.com/davidroyer/vue2-editor/compare/2.6.5...2.6.6) (2018-08-04) +# Changelog +All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. +### [2.10.3](https://github.com/davidroyer/vue2-editor/compare/v2.10.2...v2.10.3) (2021-08-21) - -## [2.6.5](https://github.com/davidroyer/vue2-editor/compare/2.6.4...2.6.5) (2018-08-04) +### [2.10.3-ssr.5](https://github.com/davidroyer/vue2-editor/compare/v2.10.3-ssr.4...v2.10.3-ssr.5) (2021-08-19) - -## [2.6.4](https://github.com/davidroyer/vue2-editor/compare/2.6.3...2.6.4) (2018-08-04) +### Improvements +* improves code by using `const` instead of `let` ([68d825a](https://github.com/davidroyer/vue2-editor/commit/68d825a)) - -## [2.6.3](https://github.com/davidroyer/vue2-editor/compare/2.6.2...2.6.3) (2018-08-04) +### [2.10.3-ssr.4](https://github.com/davidroyer/vue2-editor/compare/v2.10.3-ssr.3...v2.10.3-ssr.4) (2021-08-18) - -## [2.6.2](https://github.com/davidroyer/vue2-editor/compare/2.4.2...2.6.2) (2018-08-04) +### Refactoring +* now using `npm` in script ([435e558](https://github.com/davidroyer/vue2-editor/commit/435e558)) +* reverts to original code ([e738762](https://github.com/davidroyer/vue2-editor/commit/e738762)) - -## [2.6.1](https://github.com/davidroyer/vue2-editor/compare/2.4.2...2.6.1) (2018-08-03) +### [2.10.3-ssr.3](https://github.com/davidroyer/vue2-editor/compare/v2.10.3-ssr.2...v2.10.3-ssr.3) (2021-07-29) - -## [2.4.2](https://github.com/davidroyer/vue2-editor/compare/v2.4.1...2.4.2) (2018-02-04) +### Bug Fixes +* resolves badly merged code ([81185f7](https://github.com/davidroyer/vue2-editor/commit/81185f7)) - -## [2.4.1](https://github.com/davidroyer/vue2-editor/compare/v2.5.0...v2.4.1) (2018-02-04) +### [2.10.3-ssr.2](https://github.com/davidroyer/vue2-editor/compare/v2.10.3-ssr.1...v2.10.3-ssr.2) (2021-07-29) - -# [2.5.0](https://github.com/davidroyer/vue2-editor/compare/2.4.0...v2.5.0) (2018-02-04) +### [2.10.3-ssr.1](https://github.com/davidroyer/vue2-editor/compare/v2.10.3-ssr.0...v2.10.3-ssr.1) (2021-07-29) - -# [2.4.0](https://github.com/davidroyer/vue2-editor/compare/2.0.0...2.4.0) (2018-01-29) +### [2.10.3-ssr.0](https://github.com/davidroyer/vue2-editor/compare/v2.10.2...v2.10.3-ssr.0) (2021-07-29) - -# 2.0.0 (2017-04-06) + +### Bug Fixes + +* fixes dev issue not working ([76d5701](https://github.com/davidroyer/vue2-editor/commit/76d5701)) + + + +### [2.10.2](https://github.com/davidroyer/vue2-editor/compare/v2.10.1...v2.10.2) (2019-08-23) + + + +### [2.10.1](https://github.com/davidroyer/vue2-editor/compare/v2.10.0...v2.10.1) (2019-08-23) + + +### Bug Fixes + +* Fixes emitted names. Closes [#152](https://github.com/davidroyer/vue2-editor/issues/152). ([6ef96c2](https://github.com/davidroyer/vue2-editor/commit/6ef96c2)) + + + +## [2.10.0](https://github.com/davidroyer/vue2-editor/compare/v2.9.1...v2.10.0) (2019-08-05) + + +### Features + +* **imageRemoved:** new emitter for deleted images ([eecc696](https://github.com/davidroyer/vue2-editor/commit/eecc696)) + + + +### [2.9.1](https://github.com/davidroyer/vue2-editor/compare/v2.9.0...v2.9.1) (2019-07-03) + + + +## [2.9.0](https://github.com/davidroyer/vue2-editor/compare/v2.9.0-next.10...v2.9.0) (2019-07-03) + + + +## [2.9.0-next.10](https://github.com/davidroyer/vue2-editor/compare/v2.9.0-next.9...v2.9.0-next.10) (2019-07-03) + + + +## [2.9.0-next.9](https://github.com/davidroyer/vue2-editor/compare/v2.9.0-next.8...v2.9.0-next.9) (2019-06-30) + + + +## [2.9.0-next.8](https://github.com/davidroyer/vue2-editor/compare/v2.9.0-next.7...v2.9.0-next.8) (2019-06-23) + + +### Bug Fixes + +* fixes build with update vplugin ([f7c0a23](https://github.com/davidroyer/vue2-editor/commit/f7c0a23)) + + + +## [2.9.0-next.7](https://github.com/davidroyer/vue2-editor/compare/v2.9.0-next.6...v2.9.0-next.7) (2019-06-23) + + +### Refactoring + +* **releases:** updates scripts ([ef1aadb](https://github.com/davidroyer/vue2-editor/commit/ef1aadb)) + + + +## [2.9.0-next.6](https://github.com/davidroyer/vue2-editor/compare/v2.9.0-next.5...v2.9.0-next.6) (2019-06-21) + + + +## [2.9.0-next.5](https://github.com/davidroyer/vue2-editor/compare/v2.9.0-next.4...v2.9.0-next.5) (2019-06-21) + + +### Documentation + +* adds to notes ([0ebaf48](https://github.com/davidroyer/vue2-editor/commit/0ebaf48)) +* adds to notes ([86d5244](https://github.com/davidroyer/vue2-editor/commit/86d5244)) + + + +## [2.9.0-next.4](https://github.com/davidroyer/vue2-editor/compare/v2.9.0-next.3...v2.9.0-next.4) (2019-06-21) + + + +## [2.9.0-next.3](https://github.com/davidroyer/vue2-editor/compare/v2.9.0-next.2...v2.9.0-next.3) (2019-06-21) + + +### Documentation + +* **notes:** adds to `NOTES.md` ([d420988](https://github.com/davidroyer/vue2-editor/commit/d420988)) + + + +## [2.9.0-next.2](https://github.com/davidroyer/vue2-editor/compare/v2.9.0-next.1...v2.9.0-next.2) (2019-06-21) + + +### Documentation + +* add NOTES and TODO's ([1c43b1c](https://github.com/davidroyer/vue2-editor/commit/1c43b1c)) + + + +## [2.9.0-next.1](https://github.com/davidroyer/vue2-editor/compare/v2.9.0-next.0...v2.9.0-next.1) (2019-06-21) + + +### Bug Fixes + +* **build:** updates build compand for modular ([f450a61](https://github.com/davidroyer/vue2-editor/commit/f450a61)) + + + +## [2.9.0-next.0](https://github.com/davidroyer/vue2-editor/compare/v2.8.1...v2.9.0-next.0) (2019-06-21) + + +### Documentation + +* :pencil: updates another example to import ([2e7fb3a](https://github.com/davidroyer/vue2-editor/commit/2e7fb3a)) + + +### Features + +* **modular build:** :zap: adds modular build ([75aa89d](https://github.com/davidroyer/vue2-editor/commit/75aa89d)) + + + +## [2.8.0-alpha.9](https://github.com/davidroyer/vue2-editor/compare/v2.8.0-alpha.8...v2.8.0-alpha.9) (2019-06-12) + + + +### [2.8.1](https://github.com/davidroyer/vue2-editor/compare/v2.8.0-alpha.8...v2.8.1) (2019-06-12) + + +## [2.8.0-alpha.9](https://github.com/davidroyer/vue2-editor/compare/v2.8.0-alpha.8...v2.8.0-alpha.9) (2019-06-12) + +### Documentation + +* :pencil: moving examples to be imported ([6a49a96](https://github.com/davidroyer/vue2-editor/commit/6a49a96)) +* clean up `config.js` ([a02efbf](https://github.com/davidroyer/vue2-editor/commit/a02efbf)) +* fixes install command code ([3603060](https://github.com/davidroyer/vue2-editor/commit/3603060)) +* removes unused declarations ([60f1845](https://github.com/davidroyer/vue2-editor/commit/60f1845)) + +## [2.8.0-alpha.8](https://github.com/davidroyer/vue2-editor/compare/v2.8.0-alpha.7...v2.8.0-alpha.8) (2019-06-12) + + +### Documentation + +* sets fenced code blocks to `vue` ([6f66647](https://github.com/davidroyer/vue2-editor/commit/6f66647)) + + + +## [2.8.0-alpha.7](https://github.com/davidroyer/vue2-editor/compare/v2.8.0-alpha.6...v2.8.0-alpha.7) (2019-06-12) + + +### Bug Fixes + +* fixes analytics ([3dd8b8d](https://github.com/davidroyer/vue2-editor/commit/3dd8b8d)) +* **build:** removes `dist` from `.gitignore` ([c8747c6](https://github.com/davidroyer/vue2-editor/commit/c8747c6)) + + +### Documentation + +* fixes assets error ([7411501](https://github.com/davidroyer/vue2-editor/commit/7411501)) +* fixes styles ([4e97781](https://github.com/davidroyer/vue2-editor/commit/4e97781)) +* removes unwanted text ([c5b6ced](https://github.com/davidroyer/vue2-editor/commit/c5b6ced)) +* testing demo-code and snippets ([a42b0a0](https://github.com/davidroyer/vue2-editor/commit/a42b0a0)) +* updates docs to current version ([69e470d](https://github.com/davidroyer/vue2-editor/commit/69e470d)) + + + +## [2.8.0-alpha.6](https://github.com/davidroyer/vue2-editor/compare/v2.8.0-alpha.5...v2.8.0-alpha.6) (2019-06-11) + + +### Refactoring + +* removes `src` from files property ([7d7f350](https://github.com/davidroyer/vue2-editor/commit/7d7f350)) + + + +## [2.8.0-alpha.5](https://github.com/davidroyer/vue2-editor/compare/v2.8.0-alpha.4...v2.8.0-alpha.5) (2019-06-11) + + +### Documentation + +* :pencil: fixes docs ([5746f2c](https://github.com/davidroyer/vue2-editor/commit/5746f2c)) +* begins to bring in current content ([be246c0](https://github.com/davidroyer/vue2-editor/commit/be246c0)) + + + +## [2.8.0-alpha.4](https://github.com/davidroyer/vue2-editor/compare/v2.8.0-alpha.3...v2.8.0-alpha.4) (2019-06-08) + + + +## [2.8.0-alpha.3](https://github.com/davidroyer/vue2-editor/compare/v2.8.0-alpha.2...v2.8.0-alpha.3) (2019-06-08) + + +### Bug Fixes + +* :hammer: adds vplugin as dev dependency ([cfe874a](https://github.com/davidroyer/vue2-editor/commit/cfe874a)) + + +### Documentation + +* :books: adds initial customization ([0695594](https://github.com/davidroyer/vue2-editor/commit/0695594)) + + +### Improvements + +* :ballot_box_with_check: eslint config ([e6f8f84](https://github.com/davidroyer/vue2-editor/commit/e6f8f84)) + + +### Refactoring + +* adds vuepress to eslint and removes demo ([bb6eadd](https://github.com/davidroyer/vue2-editor/commit/bb6eadd)) + + + +## [2.8.0-alpha.2](https://github.com/davidroyer/vue2-editor/compare/v2.8.0-alpha.1...v2.8.0-alpha.2) (2019-06-07) + + +### Build System + +* :wrench: scripts to better handle releases ([41d6968](https://github.com/davidroyer/vue2-editor/commit/41d6968)) + + + +## [2.8.0-alpha.1](https://github.com/davidroyer/vue2-editor/compare/v2.8.0-alpha.0...v2.8.0-alpha.1) (2019-06-07) + + + +## [2.8.0-alpha.0](https://github.com/davidroyer/vue2-editor/compare/v2.7.0-alpha.21...v2.8.0-alpha.0) (2019-06-07) +### Features +* :fire: uses Rollup for build ([f469753](https://github.com/davidroyer/vue2-editor/commit/f469753)) + +### [2.7.2](https://github.com/davidroyer/vue2-editor/compare/v2.7.1...v2.7.2) (2019-05-26) + + + +### [2.7.1](https://github.com/davidroyer/vue2-editor/compare/v2.7.0-alpha.21...v2.7.1) (2019-05-26) + + + +## [2.7.0](https://github.com/davidroyer/vue2-editor/compare/v2.7.0-alpha.21...v2.7.0) (2019-05-26) + + + +## [2.7.0-alpha.21](https://github.com/davidroyer/vue2-editor/compare/v2.7.0-alpha.20...v2.7.0-alpha.21) (2019-05-26) + + +### Bug Fixes + +* removes wrong cli option for \`build:demos\`' ([ece166c](https://github.com/davidroyer/vue2-editor/commit/ece166c)) +* **demos:** removes ex. with 2 duplicate editors ([5948223](https://github.com/davidroyer/vue2-editor/commit/5948223)) + + + +## [2.7.0-alpha.20](https://github.com/davidroyer/vue2-editor/compare/v2.7.0-alpha.19...v2.7.0-alpha.20) (2019-05-26) + + + +## [2.7.0-alpha.19](https://github.com/davidroyer/vue2-editor/compare/v2.7.0-alpha.18...v2.7.0-alpha.19) (2019-05-26) + + + +## [2.7.0-alpha.18](https://github.com/davidroyer/vue2-editor/compare/v2.7.0-alpha.17...v2.7.0-alpha.18) (2019-05-26) + + + +## [2.7.0-alpha.17](https://github.com/davidroyer/vue2-editor/compare/v2.7.0-alpha.16...v2.7.0-alpha.17) (2019-05-26) + + + +## [2.7.0-alpha.16](https://github.com/davidroyer/vue2-editor/compare/v2.7.0-alpha.15...v2.7.0-alpha.16) (2019-05-26) + + +### Bug Fixes + +* reduces bundle size ([bf1b8b8](https://github.com/davidroyer/vue2-editor/commit/bf1b8b8)) + + + +## [2.7.0-alpha.15](https://github.com/davidroyer/vue2-editor/compare/v2.7.0-alpha.14...v2.7.0-alpha.15) (2019-05-26) + + +### Bug Fixes + +* **package.json:** removes src from files property ([108f1be](https://github.com/davidroyer/vue2-editor/commit/108f1be)) + + + +## [2.7.0-alpha.14](https://github.com/davidroyer/vue2-editor/compare/v2.7.1-alpha.0...v2.7.0-alpha.14) (2019-05-26) + + + +### [2.7.1-alpha.0](https://github.com/davidroyer/vue2-editor/compare/v2.7.0...v2.7.1-alpha.0) (2019-05-26) + + + +## [2.7.0](https://github.com/davidroyer/vue2-editor/compare/v2.7.0-alpha.13...v2.7.0) (2019-05-26) + + +### Bug Fixes + +* removes unused and non-working config option ([61098d7](https://github.com/davidroyer/vue2-editor/commit/61098d7)) + + + +## [2.7.0-alpha.13](https://github.com/davidroyer/vue2-editor/compare/v2.7.0-alpha.12...v2.7.0-alpha.13) (2019-05-24) + + +### Bug Fixes + +* **scripts:** removes unused config option ([09b303e](https://github.com/davidroyer/vue2-editor/commit/09b303e)) + + + +## [2.7.0-alpha.12](https://github.com/davidroyer/vue2-editor/compare/v2.7.0-alpha.11...v2.7.0-alpha.12) (2019-05-24) + + +### Bug Fixes + +* fixes libraryName ([8cfb6fd](https://github.com/davidroyer/vue2-editor/commit/8cfb6fd)) + + + +## [2.7.0-alpha.11](https://github.com/davidroyer/vue2-editor/compare/v2.7.0-alpha.10...v2.7.0-alpha.11) (2019-05-24) + + + +## [2.7.0-alpha.10](https://github.com/davidroyer/vue2-editor/compare/v2.7.0-alpha.9...v2.7.0-alpha.10) (2019-05-24) + + + +## [2.7.0-alpha.9](https://github.com/davidroyer/vue2-editor/compare/v2.7.0-alpha.8...v2.7.0-alpha.9) (2019-05-16) + + +### Bug Fixes + +* fixes changed package file names ([1209d94](https://github.com/davidroyer/vue2-editor/commit/1209d94)) + + + +## [2.7.0-alpha.8](https://github.com/davidroyer/vue2-editor/compare/v2.7.0-alpha.7...v2.7.0-alpha.8) (2019-05-16) + + +### Bug Fixes + +* fixes name for browser field ([3851164](https://github.com/davidroyer/vue2-editor/commit/3851164)) + + + +## [2.7.0-alpha.7](https://github.com/davidroyer/vue2-editor/compare/v2.7.0-alpha.6...v2.7.0-alpha.7) (2019-05-15) + + + +## [2.7.0-alpha.6](https://github.com/davidroyer/vue2-editor/compare/v2.7.0-alpha.5...v2.7.0-alpha.6) (2019-05-15) + + +### Bug Fixes + +* adds `files` property ([11fd1ad](https://github.com/davidroyer/vue2-editor/commit/11fd1ad)) + + + +## [2.7.0-alpha.5](https://github.com/davidroyer/vue2-editor/compare/v2.7.0-alpha.4...v2.7.0-alpha.5) (2019-05-15) + + + +## [2.7.0-alpha.4](https://github.com/davidroyer/vue2-editor/compare/v2.7.0-alpha.3...v2.7.0-alpha.4) (2019-05-15) + + + +## [2.7.0-alpha.3](https://github.com/davidroyer/vue2-editor/compare/v2.7.0-alpha.2...v2.7.0-alpha.3) (2019-05-15) + + + +## [2.7.0-alpha.2](https://github.com/davidroyer/vue2-editor/compare/v2.7.0-alpha.1...v2.7.0-alpha.2) (2019-05-15) + + +### Bug Fixes + +* fixes README layout ([6f95733](https://github.com/davidroyer/vue2-editor/commit/6f95733)) + + +### Tests + +* **git:** testing new lines ([a312d19](https://github.com/davidroyer/vue2-editor/commit/a312d19)) + + + +## [2.7.0-alpha.1](https://github.com/davidroyer/vue2-editor/compare/v2.7.0-alpha.0...v2.7.0-alpha.1) (2019-05-15) + +## [2.7.0-alpha.0](https://github.com/davidroyer/vue2-editor/compare/v2.4.1...v2.7.0-alpha.0) (2019-05-14) + +### Features + +- **builds:** now using bili.js & standard-version ([fb9ebc8](https://github.com/davidroyer/vue2-editor/commit/fb9ebc8)) + +### 2.6.6 (2018-08-04) + +### Build System + +- **package.json:** Needed to add `publishConfig` property to _npm_ and set it as the `registry` ([63c066f](https://github.com/davidroyer/vue2-editor/commit/63c066f)) + +### 2.6.5 (2018-08-04) + +### 2.6.4 (2018-08-04) + +### 2.6.3 (2018-08-04) + +### 2.6.2 (2018-08-04) + +### Build System + +- **package.json:** Added `commitizen` and changelog dependencies ([a11f2d8](https://github.com/davidroyer/vue2-editor/commit/a11f2d8)) + +### 2.4.2 (2018-02-04) + + + +## [2.6.6](https://github.com/davidroyer/vue2-editor/compare/2.6.5...2.6.6) (2018-08-04) + + + +## [2.6.5](https://github.com/davidroyer/vue2-editor/compare/2.6.4...2.6.5) (2018-08-04) + + + +## [2.6.4](https://github.com/davidroyer/vue2-editor/compare/2.6.3...2.6.4) (2018-08-04) + + + +## [2.6.3](https://github.com/davidroyer/vue2-editor/compare/2.6.2...2.6.3) (2018-08-04) + + + +## [2.6.2](https://github.com/davidroyer/vue2-editor/compare/2.4.2...2.6.2) (2018-08-04) + + + +## [2.6.1](https://github.com/davidroyer/vue2-editor/compare/2.4.2...2.6.1) (2018-08-03) + + + +## [2.4.2](https://github.com/davidroyer/vue2-editor/compare/v2.4.1...2.4.2) (2018-02-04) + + + +## [2.4.1](https://github.com/davidroyer/vue2-editor/compare/v2.5.0...v2.4.1) (2018-02-04) + + + +# [2.5.0](https://github.com/davidroyer/vue2-editor/compare/2.4.0...v2.5.0) (2018-02-04) + + + +# [2.4.0](https://github.com/davidroyer/vue2-editor/compare/2.0.0...2.4.0) (2018-01-29) + + + +# 2.0.0 (2017-04-06) diff --git a/LICENSE b/LICENSE index 548517e..2b80834 100755 --- a/LICENSE +++ b/LICENSE @@ -1,21 +1,20 @@ The MIT License (MIT) -Copyright (c) 2017. David Royer +Copyright (c) 2019 David Royer -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/README.md b/README.md index 59fa2c5..21e6cb5 100644 --- a/README.md +++ b/README.md @@ -1,20 +1,29 @@ # Vue2Editor +> An easy-to-use but yet powerful and customizable rich text editor powered by Quill.js and Vue.js +

-

View Documenation for Vue2Editor

+ +

View Docs

+

-

-![Vue2Editor-Centered](https://www.dropbox.com/s/7com4d32zct44nc/Vue2Editor-Centered.png?raw=1) HTML Editor using [Vue.js](https://vuejs.org) and [Quill](http://quilljs.com/) +![Vue2Editor-Centered](https://www.dropbox.com/s/7com4d32zct44nc/Vue2Editor-Centered.png?raw=1) + +[📖 **Release Notes**](./CHANGELOG.md) + + - + -# Install + + +## Install _You can use Yarn or NPM_ ```bash -$ npm install --save vue2-editor +npm install vue2-editor ``` **OR** @@ -23,7 +32,7 @@ $ npm install --save vue2-editor yarn add vue2-editor ``` -# Usage +## Usage ```javascript // Basic Use - Covers most scenarios @@ -33,124 +42,147 @@ import { VueEditor } from "vue2-editor"; import { VueEditor, Quill } from "vue2-editor"; ``` -# Props +## Nuxt.js + +Add `vue2-editor/nuxt` to modules section of `nuxt.config.js` + +```javascript +{ + modules: ["vue2-editor/nuxt"]; +} +``` + +To avoid seeing warnings from Vue about a mismatch in content, you'll need to +wrap the `VueEditor` component with the `client-only` component Nuxt provides as +shown here: + +```html + + + +``` + +## Props | Name | Type | Default | Description | | --------------------- | ------- | ---------------------------------------------------- | -------------------------------------------------------------------------------------- | -| id | String | quill-container | Set the id (necessary if multiple editors in the same view) | -| v-model | String | - | Set v-model to the the content or data property you wish to bind it to | -| useCustomImageHandler | Boolean | false | Handle image uploading instead of using default conversion to Base64 | -| placeholder | String | - | Placeholder text for the editor | -| disabled | Boolean | false | Set to true to disable editor | | customModules | Array | - | Declare Quill modules to register | Use a custom toolbar | -| editorToolbar | Array | \*\* _Too long for table. See toolbar example below_ | Use a custom toolbar | +| disabled | Boolean | false | Set to true to disable editor | | editorOptions | Object | - | Offers object for merging into default config (add formats, custom Quill modules, ect) | +| editorToolbar | Array | \*\* _Too long for table. See toolbar example below_ | Use a custom toolbar | +| id | String | quill-container | Set the id (necessary if multiple editors in the same view) | +| placeholder | String | - | Placeholder text for the editor | +| useCustomImageHandler | Boolean | false | Handle image uploading instead of using default conversion to Base64 | +| v-model | String | - | Set v-model to the the content or data property you wish to bind it to | ## Events | Name | Parameters | Description | | ---------------- | ---------------------------- | ----------------------------------------------------------------------------------- | -| focus | quill | Emitted on `focus` event | | blur | quill | Emitted on `blur` event | +| focus | quill | Emitted on `focus` event | +| image-added | file, Editor, cursorLocation | Emitted when `useCustomImageHandler` is true and photo is being added to the editor | +| image-removed | file, Editor, cursorLocation | Emitted when `useCustomImageHandler` is true and photo has been deleted | | selection-change | range, oldRange, source | Emitted on Quill's `selection-change` event | | text-change | delta, oldDelta, source | Emitted on Quill's `text-change` event | -| imageAdded | file, Editor, cursorLocation | Emitted when `useCustomImageHandler` is true and photo is being added to the editor | -# Examples +## Examples -## Example - Basic Setup +### Example - Basic Setup -```html +```vue +
+ +
+ - + data() { + return { + content: "

Some initial content

" + }; + } +}; + ``` -## Example - Custom Image Handler +### Example - Custom Image Handler If you choose to use the custom image handler, an event is emitted when a a photo is selected. You can see below that 3 parameters are passed. -1. It passes the file to be handled however you need -2. The Editor instance -3. The cursor position at the time of upload so the image can be inserted at the correct position on success +1. It passes the file to be handled however you need +2. The Editor instance +3. The cursor position at the time of upload so the image can be inserted at the correct position on success -**NOTE** In addition to this example, I have created a [ example repo](https://github.com/davidroyer/vue2editor-images) demonstrating this new feature with an actual server. +**NOTE** In addition to this example, I have created a [example repo](https://github.com/davidroyer/vue2editor-images) demonstrating this new feature with an actual server. -```html +```vue ``` -## Example - Set Contents After Page Load +### Example - Set Contents After Page Load -```html +```vue ``` -## Example - Using Multiple Editors +### Example - Using Multiple Editors -```html +```vue ``` -## Example - Custom Toolbar +### Example - Custom Toolbar -```html +```vue ``` -## Example - Saving The Content +### Example - Saving The Content -```html +```vue ``` -## Example - Use a Live Preview +### Example - Use a Live Preview -```html +```vue ``` -## How To Use Custom Quill Modules +### How To Use Custom Quill Modules -There are 2 ways of using custom modules with Vue2Editor. This is partly because there have been cases in which errors are thrown when importing and attempting to declare custom modules, and partly because I believe it actually separates the concerns nicely. +There are two ways of using custom modules with Vue2Editor. This is partly because there have been cases in which errors are thrown when importing and attempting to declare custom modules, and partly because I believe it actually separates the concerns nicely. -### Version 1 - **_Import and Register Yourself_** +#### Version 1 - **_Import and Register Yourself_** Vue2Editor now exports Quill to assist in this process. -1. When importing VueEditor, also import Quill. -2. Import your custom modules -3. Register the custom modules with Quill -4. Add the necessary configuration to the `editorOptions` object +1. When importing VueEditor, also import Quill. +2. Import your custom modules +3. Register the custom modules with Quill +4. Add the necessary configuration to the `editorOptions` object -```html +```vue - - + + diff --git a/src/helpers/axios.js b/src/helpers/axios.js new file mode 100644 index 0000000..0bfedee --- /dev/null +++ b/src/helpers/axios.js @@ -0,0 +1,24 @@ +import axios from "axios"; +const CLIENT_ID = "993793b1d8d3e2e"; + +// We create our own axios instance and set a custom base URL. +// Note that if we wouldn't set any config here we do not need +// a named export, as we could just `import axios from 'axios'` +export const axiosInstance = axios.create({ + baseURL: `https://api.imgur.com/3/`, + headers: { Authorization: "Client-ID " + CLIENT_ID } +}); +// export default ({ Vue }) => { +// Vue.prototype.$axios = axiosInstance; +// }; + +// Here we define a named export +// that we can later use inside .js files: +// export default axiosInstance; + +// axios({ +// url: "https://api.imgur.com/3/image", +// method: "POST", +// headers: { Authorization: "Client-ID " + CLIENT_ID }, + +// }); diff --git a/src/helpers/default-toolbar.js b/src/helpers/default-toolbar.js old mode 100644 new mode 100755 index 2fb1a4f..8540209 --- a/src/helpers/default-toolbar.js +++ b/src/helpers/default-toolbar.js @@ -1,4 +1,4 @@ -let defaultToolbar = [ +const defaultToolbar = [ [{ header: [false, 1, 2, 3, 4, 5, 6] }], ["bold", "italic", "underline", "strike"], // toggled buttons [ diff --git a/src/helpers/fullToolbar.js b/src/helpers/fullToolbar.js old mode 100644 new mode 100755 index 8ad6bda..2cdc3ec --- a/src/helpers/fullToolbar.js +++ b/src/helpers/fullToolbar.js @@ -1,28 +1,35 @@ var fullToolbar = [ - [{ 'font': [] }], + [{ font: [] }], - [{ 'header': [false, 1, 2, 3, 4, 5, 6, ] }], + [{ header: [false, 1, 2, 3, 4, 5, 6] }], - [{ 'size': ['small', false, 'large', 'huge'] }], + [{ size: ["small", false, "large", "huge"] }], - ['bold', 'italic', 'underline', 'strike'], + ["bold", "italic", "underline", "strike"], - [{'align': ''}, {'align': 'center'}, {'align': 'right'}, {'align': 'justify'}], + [ + { align: "" }, + { align: "center" }, + { align: "right" }, + { align: "justify" } + ], - [{ 'header': 1 }, { 'header': 2 }], + [{ header: 1 }, { header: 2 }], - ['blockquote', 'code-block'], + ["blockquote", "code-block"], - [{ 'list': 'ordered'}, { 'list': 'bullet' }, { 'list': 'check' }], + [{ list: "ordered" }, { list: "bullet" }, { list: "check" }], - [{ 'script': 'sub'}, { 'script': 'super' }], + [{ script: "sub" }, { script: "super" }], - [{ 'indent': '-1'}, { 'indent': '+1' }], + [{ indent: "-1" }, { indent: "+1" }], - [{ 'color': [] }, { 'background': [] }], + [{ color: [] }, { background: [] }], - ['link', 'image', 'video', 'formula'], + ["link", "image", "video", "formula"], - [{ 'direction': 'rtl' }], - ['clean'], -] + [{ direction: "rtl" }], + ["clean"] +]; + +export default fullToolbar; diff --git a/src/helpers/markdown-shortcuts.js b/src/helpers/markdown-shortcuts.js old mode 100644 new mode 100755 index 0d1e351..d8ee89c --- a/src/helpers/markdown-shortcuts.js +++ b/src/helpers/markdown-shortcuts.js @@ -1,38 +1,10 @@ import Quill from "quill"; -let BlockEmbed = Quill.import("blots/block/embed"); +const BlockEmbed = Quill.import("blots/block/embed"); class HorizontalRule extends BlockEmbed {} HorizontalRule.blotName = "hr"; HorizontalRule.tagName = "hr"; Quill.register("formats/horizontal", HorizontalRule); -// Quill.js Plugin - Markdown Shortcuts -// This is a module for the Quill.js WYSIWYG editor (https://quilljs.com/) -// which converts text entered as markdown to rich text. -// -// v0.0.5 -// -// Author: Patrick Lee (me@patricklee.nyc) -// -// (c) Copyright 2017 Patrick Lee (me@patricklee.nyc). -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. -// - class MarkdownShortcuts { constructor(quill, options) { this.quill = quill; @@ -57,7 +29,7 @@ class MarkdownShortcuts { { name: "blockquote", pattern: /^(>)\s/g, - action: (text, selection) => { + action: (_text, selection) => { // Need to defer this action https://github.com/quilljs/quill/issues/1134 setTimeout(() => { this.quill.formatLine(selection.index, 1, "blockquote", true); @@ -68,7 +40,7 @@ class MarkdownShortcuts { { name: "code-block", pattern: /^`{3}(?:\s|\n)/g, - action: (text, selection) => { + action: (_text, selection) => { // Need to defer this action https://github.com/quilljs/quill/issues/1134 setTimeout(() => { this.quill.formatLine(selection.index, 1, "code-block", true); @@ -79,8 +51,8 @@ class MarkdownShortcuts { { name: "bolditalic", pattern: /(?:\*|_){3}(.+?)(?:\*|_){3}/g, - action: (text, selection, pattern, lineStart) => { - let match = pattern.exec(text); + action: (text, _selection, pattern, lineStart) => { + const match = pattern.exec(text); const annotatedText = match[0]; const matchedText = match[1]; @@ -101,8 +73,8 @@ class MarkdownShortcuts { { name: "bold", pattern: /(?:\*|_){2}(.+?)(?:\*|_){2}/g, - action: (text, selection, pattern, lineStart) => { - let match = pattern.exec(text); + action: (text, _selection, pattern, lineStart) => { + const match = pattern.exec(text); const annotatedText = match[0]; const matchedText = match[1]; @@ -120,8 +92,8 @@ class MarkdownShortcuts { { name: "italic", pattern: /(?:\*|_){1}(.+?)(?:\*|_){1}/g, - action: (text, selection, pattern, lineStart) => { - let match = pattern.exec(text); + action: (text, _selection, pattern, lineStart) => { + const match = pattern.exec(text); const annotatedText = match[0]; const matchedText = match[1]; @@ -139,8 +111,8 @@ class MarkdownShortcuts { { name: "strikethrough", pattern: /(?:~~)(.+?)(?:~~)/g, - action: (text, selection, pattern, lineStart) => { - let match = pattern.exec(text); + action: (text, _selection, pattern, lineStart) => { + const match = pattern.exec(text); const annotatedText = match[0]; const matchedText = match[1]; @@ -158,8 +130,8 @@ class MarkdownShortcuts { { name: "code", pattern: /(?:`)(.+?)(?:`)/g, - action: (text, selection, pattern, lineStart) => { - let match = pattern.exec(text); + action: (text, _selection, pattern, lineStart) => { + const match = pattern.exec(text); const annotatedText = match[0]; const matchedText = match[1]; @@ -197,7 +169,8 @@ class MarkdownShortcuts { { name: "asterisk-ul", pattern: /^(\*|\+)\s$/g, - action: (text, selection, pattern) => { + // eslint-disable-next-line no-unused-vars + action: (_text, selection, _pattern) => { setTimeout(() => { this.quill.formatLine(selection.index, 1, "list", "unordered"); this.quill.deleteText(selection.index - 2, 2); @@ -250,7 +223,8 @@ class MarkdownShortcuts { ]; // Handler that looks for insert deltas that match specific characters - this.quill.on("text-change", (delta, oldContents, source) => { + // eslint-disable-next-line no-unused-vars + this.quill.on("text-change", (delta, _oldContents, _source) => { for (let i = 0; i < delta.ops.length; i++) { if (delta.ops[i].hasOwnProperty("insert")) { if (delta.ops[i].insert === " ") { @@ -291,7 +265,7 @@ class MarkdownShortcuts { } onEnter() { - let selection = this.quill.getSelection(); + const selection = this.quill.getSelection(); if (!selection) return; const [line, offset] = this.quill.getLine(selection.index); const text = line.domNode.textContent + " "; diff --git a/src/helpers/merge-deep.js b/src/helpers/merge-deep.js new file mode 100644 index 0000000..248e9c8 --- /dev/null +++ b/src/helpers/merge-deep.js @@ -0,0 +1,28 @@ +/** + * Performs a deep merge of `source` into `target`. + * Mutates `target` only but not its objects and arrays. + * + */ + +export default function mergeDeep(target, source) { + const isObject = obj => obj && typeof obj === "object"; + + if (!isObject(target) || !isObject(source)) { + return source; + } + + Object.keys(source).forEach(key => { + const targetValue = target[key]; + const sourceValue = source[key]; + + if (Array.isArray(targetValue) && Array.isArray(sourceValue)) { + target[key] = targetValue.concat(sourceValue); + } else if (isObject(targetValue) && isObject(sourceValue)) { + target[key] = mergeDeep(Object.assign({}, targetValue), sourceValue); + } else { + target[key] = sourceValue; + } + }); + + return target; +} diff --git a/src/helpers/old-api.js b/src/helpers/old-api.js old mode 100644 new mode 100755 diff --git a/src/index.js b/src/index.js index 90bfb82..f813cd0 100644 --- a/src/index.js +++ b/src/index.js @@ -1,20 +1,35 @@ -/** - * Vue2-Editor - */ -import VueEditor from './VueEditor.vue' -import _Quill from 'quill' -const Quill = window.Quill || _Quill +import Quill from "quill"; +import VueEditor from "@/components/VueEditor.vue"; -const Vue2Editor = { - VueEditor, - install: function(Vue) { - Vue.component(VueEditor.name, VueEditor) - } +const version = "__VERSION__"; + +// Declare install function executed by Vue.use() +export function install(Vue) { + if (install.installed) return; + install.installed = true; + + Vue.component("VueEditor", VueEditor); } -if (typeof window !== 'undefined' && window.Vue) { - window.Vue.use(Vue2Editor) +const VPlugin = { + install, + version, + Quill, + VueEditor +}; + +// Auto-install when vue is found (eg. in browser via