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 index 80ce14e..c5bfa0b 100644 --- a/.gitignore +++ b/.gitignore @@ -2,7 +2,8 @@ node_modules # public dist/*.gz -dist/*.map +dist/*.gz +dist/.DS_Store coverage docs/.vuepress/dist # dist diff --git a/.vscode/settings.json b/.vscode/settings.json index b2fc5c0..7ceeda1 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,3 +1,4 @@ { - // "vetur.validation.template": false -} \ No newline at end of file + "vetur.validation.template": false, + "workbench.colorCustomizations": {} +} diff --git a/CHANGELOG.md b/CHANGELOG.md index ba8a4ed..b3ada1c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,26 +2,186 @@ 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.8.1](https://github.com/davidroyer/vue2-editor/compare/v2.8.0-alpha.8...v2.8.1) (2019-06-12) +### [2.10.3](https://github.com/davidroyer/vue2-editor/compare/v2.10.2...v2.10.3) (2021-08-21) + + + +### [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) + + +### Improvements + +* improves code by using `const` instead of `let` ([68d825a](https://github.com/davidroyer/vue2-editor/commit/68d825a)) + + + +### [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) + + +### 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.10.3-ssr.3](https://github.com/davidroyer/vue2-editor/compare/v2.10.3-ssr.2...v2.10.3-ssr.3) (2021-07-29) + + +### Bug Fixes + +* resolves badly merged code ([81185f7](https://github.com/davidroyer/vue2-editor/commit/81185f7)) + + + +### [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.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.10.3-ssr.0](https://github.com/davidroyer/vue2-editor/compare/v2.10.2...v2.10.3-ssr.0) (2021-07-29) + + +### 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 -* :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)) +* 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.7.2](https://github.com/davidroyer/vue2-editor/compare/v2.7.1...v2.7.2) (2019-05-26) +## [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.7.1](https://github.com/davidroyer/vue2-editor/compare/v2.7.0-alpha.21...v2.7.1) (2019-05-26) +## [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) diff --git a/README.md b/README.md index 136b562..21e6cb5 100644 --- a/README.md +++ b/README.md @@ -18,11 +18,11 @@ -# Install +## Install _You can use Yarn or NPM_ -``` bash +```bash npm install vue2-editor ``` @@ -32,7 +32,7 @@ npm install vue2-editor yarn add vue2-editor ``` -# Usage +## Usage ```javascript // Basic Use - Covers most scenarios @@ -42,34 +42,55 @@ 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 ``` -## 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. @@ -102,60 +123,66 @@ You can see below that 3 parameters are passed. 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. @@ -326,7 +353,7 @@ Vue2Editor now exports Quill to assist in this process. 3. Register the custom modules with Quill 4. Add the necessary configuration to the `editorOptions` object -```html +```vue