├── .babelrc ├── .gitignore ├── example ├── index.js └── App.vue ├── .editorconfig ├── src ├── index.js └── TrixVue.vue ├── index.html ├── webpack.config.js ├── example.config.js ├── package.json ├── LICENSE └── README.md /.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": [ 3 | "es2015" 4 | ] 5 | } 6 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | .npmignore 3 | .DS_Store 4 | npm-debug.log 5 | *.log 6 | -------------------------------------------------------------------------------- /example/index.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue'; 2 | import App from './App.vue'; 3 | 4 | new Vue({ 5 | el: '#app', 6 | render: h => h(App) 7 | }) 8 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | indent_style = space 5 | indent_size = 2 6 | end_of_line = lf 7 | charset = utf-8 8 | trim_trailing_whitespace = true 9 | insert_final_newline = true 10 | 11 | [*.md] 12 | trim_trailing_whitespace = false 13 | -------------------------------------------------------------------------------- /src/index.js: -------------------------------------------------------------------------------- 1 | import TrixVue from './TrixVue.vue' 2 | 3 | const TrixVueEditor = { 4 | TrixVue, 5 | install: function(Vue) { 6 | Vue.component(TrixVue.name, TrixVue) 7 | } 8 | } 9 | 10 | export default TrixVueEditor 11 | export { TrixVue } 12 | -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | TrixVue Editor 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /example/App.vue: -------------------------------------------------------------------------------- 1 | 16 | 17 | 26 | 27 | 29 | -------------------------------------------------------------------------------- /src/TrixVue.vue: -------------------------------------------------------------------------------- 1 | 8 | 9 | 36 | 37 | 41 | -------------------------------------------------------------------------------- /webpack.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | entry: './src/index.js', 3 | output: { 4 | filename: './dist/index.js' 5 | }, 6 | module: { 7 | rules: [ 8 | { 9 | test: /\.js?$/, 10 | loader: "babel-loader", 11 | exclude: /node_modules/ 12 | }, 13 | { 14 | test: /\.vue$/, 15 | loader: "vue-loader" 16 | }, 17 | { 18 | test: /\.css$/, 19 | loader: 'style-loader!css-loader' 20 | }, 21 | { 22 | test: /\.(eot|svg|ttf|woff|woff2)(\?\S*)?$/, 23 | loader: 'file-loader' 24 | }, 25 | { 26 | test: /\.(png|jpe?g|gif|svg)(\?\S*)?$/, 27 | loader: 'file-loader', 28 | query: { 29 | name: '[name].[ext]?[hash]' 30 | } 31 | } 32 | ] 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /example.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | entry: './example/index.js', 3 | output: { 4 | filename: './example/bundle.js' 5 | }, 6 | module: { 7 | rules: [ 8 | { 9 | test: /\.js?$/, 10 | loader: "babel-loader", 11 | exclude: /node_modules/ 12 | }, 13 | { 14 | test: /\.vue$/, 15 | loader: "vue-loader" 16 | }, 17 | { 18 | test: /\.css$/, 19 | loader: 'style-loader!css-loader' 20 | }, 21 | { 22 | test: /\.(eot|svg|ttf|woff|woff2)(\?\S*)?$/, 23 | loader: 'file-loader' 24 | }, 25 | { 26 | test: /\.(png|jpe?g|gif|svg)(\?\S*)?$/, 27 | loader: 'file-loader', 28 | query: { 29 | name: '[name].[ext]?[hash]' 30 | } 31 | } 32 | ] 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "trix-vue2", 3 | "version": "1.0.1", 4 | "description": "Trix Editor with Vuejs 2", 5 | "main": "index.js", 6 | "scripts": { 7 | "build": "webpack --progress --watch --optimize-minimize" 8 | }, 9 | "keywords": [ 10 | "vue", 11 | "vue-component", 12 | "trix", 13 | "html editor", 14 | "text editor" 15 | ], 16 | "author": "Long Nguyen ", 17 | "repository": { 18 | "type": "git", 19 | "url": "https://github.com/kimquy/trix-vue2" 20 | }, 21 | "main": "dist/index.js", 22 | "license": "MIT", 23 | "dependencies": { 24 | "trix": "^0.10.1", 25 | "vue": "^2.2.6" 26 | }, 27 | "devDependencies": { 28 | "babel-core": "^6.24.0", 29 | "babel-loader": "^6.4.1", 30 | "babel-preset-es2015": "^6.24.0", 31 | "css-loader": "^0.28.0", 32 | "file-loader": "^0.11.1", 33 | "style-loader": "^0.16.1", 34 | "vue-loader": "^11.3.4", 35 | "vue-template-compiler": "^2.2.6", 36 | "webpack": "^2.3.3" 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2017. Long Nguyen 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # TrixVue Editor 2 | 3 | ![trix vue](https://cloud.githubusercontent.com/assets/2282642/25186952/e09adc1c-254b-11e7-9489-a6fe9f49129e.png) 4 | 5 | # Install 6 | _You can use Yarn or NPM_ 7 | 8 | ```bash 9 | $ npm install --save trix-vue2 10 | ``` 11 | **OR** 12 | ```bash 13 | yarn add trix-vue2 14 | ``` 15 | 16 | # Usage 17 | 18 | ```javascript 19 | import { TrixVue } from 'trix-vue2' 20 | 21 | //... your code 22 | ``` 23 | 24 | # Props 25 | 26 | Name | Type | Default | Description 27 | -------------- | ------ | -------------------------------------------------- | ---------------------------------------------------------------------- 28 | id | String | trix-container | Set the id (necessary if multiple editors in the same view) 29 | inputId | String | - | Set inputId when you want to embed trix editor inside a form. 30 | 31 | 32 | ## Example 33 | **_Basic Setup_** 34 | 35 | ```html 36 | 45 | 46 | 55 | ``` 56 | 57 | **_Use inside a form_** 58 | 59 | ```html 60 | 72 | 73 | 82 | ``` 83 | 84 | # License 85 | 86 | MIT 87 | --------------------------------------------------------------------------------