├── .angular-cli.json ├── .editorconfig ├── .gitignore ├── LICENSE ├── README.md ├── angular.json ├── browserslist ├── dist.tgz ├── karma.conf.js ├── ng-package.json ├── package.json ├── projects ├── jodit-angular-app │ ├── browserslist │ ├── e2e │ │ ├── protractor.conf.js │ │ ├── src │ │ │ ├── app.e2e-spec.ts │ │ │ └── app.po.ts │ │ └── tsconfig.json │ ├── karma.conf.js │ ├── src │ │ ├── app │ │ │ ├── app.component.css │ │ │ ├── app.component.html │ │ │ ├── app.component.spec.ts │ │ │ ├── app.component.ts │ │ │ └── app.module.ts │ │ ├── assets │ │ │ └── .gitkeep │ │ ├── environments │ │ │ ├── environment.prod.ts │ │ │ └── environment.ts │ │ ├── favicon.ico │ │ ├── index.html │ │ ├── main.ts │ │ ├── polyfills.ts │ │ ├── styles.css │ │ └── test.ts │ ├── tsconfig.app.json │ ├── tsconfig.spec.json │ └── tslint.json └── jodit-angular-lib │ ├── README.md │ ├── karma.conf.js │ ├── ng-package.json │ ├── package.json │ ├── src │ ├── lib │ │ ├── Events.ts │ │ ├── jodit-angular.component.spec.ts │ │ ├── jodit-angular.component.ts │ │ └── jodit-angular.module.ts │ ├── public-api.ts │ └── test.ts │ ├── tsconfig.lib.json │ ├── tsconfig.spec.json │ └── tslint.json ├── protractor.conf.js ├── tsconfig.json ├── tslint.json └── yarn.lock /.angular-cli.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "./node_modules/@angular/cli/lib/config/schema.json", 3 | "project": { 4 | "name": "jodit-angular" 5 | }, 6 | "apps": [ 7 | { 8 | "root": "src", 9 | "outDir": "dist", 10 | "assets": [ 11 | "assets", 12 | "favicon.ico" 13 | ], 14 | "index": "index.html", 15 | "main": "main.ts", 16 | "polyfills": "polyfills.ts", 17 | "test": "test.ts", 18 | "tsconfig": "tsconfig.app.json", 19 | "testTsconfig": "tsconfig.spec.json", 20 | "prefix": "app", 21 | "styles": [ 22 | "styles.css" 23 | ], 24 | "scripts": [], 25 | "environmentSource": "environments/environment.ts", 26 | "environments": { 27 | "dev": "environments/environment.ts", 28 | "prod": "environments/environment.prod.ts" 29 | } 30 | } 31 | ], 32 | "e2e": { 33 | "protractor": { 34 | "config": "./protractor.conf.js" 35 | } 36 | }, 37 | "lint": [ 38 | { 39 | "project": "src/tsconfig.app.json", 40 | "exclude": "**/node_modules/**" 41 | }, 42 | { 43 | "project": "src/tsconfig.spec.json", 44 | "exclude": "**/node_modules/**" 45 | }, 46 | { 47 | "project": "e2e/tsconfig.e2e.json", 48 | "exclude": "**/node_modules/**" 49 | } 50 | ], 51 | "test": { 52 | "karma": { 53 | "config": "./karma.conf.js" 54 | } 55 | }, 56 | "defaults": { 57 | "styleExt": "css", 58 | "component": {} 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | # Editor configuration, see http://editorconfig.org 2 | root = true 3 | 4 | [*] 5 | charset = utf-8 6 | indent_style = space 7 | indent_size = 2 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | 11 | [*.md] 12 | max_line_length = off 13 | trim_trailing_whitespace = false 14 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # See http://help.github.com/ignore-files/ for more about ignoring files. 2 | 3 | # compiled output 4 | /dist 5 | /dist-server 6 | /tmp 7 | /out-tsc 8 | 9 | # dependencies 10 | /node_modules 11 | 12 | # IDEs and editors 13 | /.idea 14 | .project 15 | .classpath 16 | .c9/ 17 | *.launch 18 | .settings/ 19 | *.sublime-workspace 20 | 21 | # IDE - VSCode 22 | .vscode/* 23 | !.vscode/settings.json 24 | !.vscode/tasks.json 25 | !.vscode/launch.json 26 | !.vscode/extensions.json 27 | 28 | # misc 29 | /.sass-cache 30 | /connect.lock 31 | /coverage 32 | /libpeerconnection.log 33 | npm-debug.log 34 | testem.log 35 | /typings 36 | 37 | # e2e 38 | /e2e/*.js 39 | /e2e/*.map 40 | 41 | # System Files 42 | .DS_Store 43 | Thumbs.db 44 | /package-lock.json 45 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 It can be easy 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 | > Hey. Due to the fact that I do not use Angular in my projects, I cannot fix plugin errors in a timely manner. If you want the plugin to develop, send PR or better become a contributor 2 | 3 | # Jodit Angular Component 4 | 5 | [![npm](https://img.shields.io/npm/v/jodit-angular.svg)](https://www.npmjs.com/package/jodit-angular) 6 | [![npm](https://img.shields.io/npm/dm/jodit-angular.svg)](https://www.npmjs.com/package/jodit-angular) 7 | [![npm](https://img.shields.io/npm/l/jodit-angular.svg)](https://www.npmjs.com/package/jodit-angular) 8 | 9 | 10 | This package is a wrapper around [Jodit](https://xdsoft.net/jodit/) to make it easier to use in a Angular application. 11 | 12 | ## for contributors 13 | The editor component itselt is located in the `jodit-angular` folder and packaged into a redistributable package with the [ng-packagr](https://www.npmjs.com/package/ng-packagr) tool. A test app has been created with the @angular/cli. It is located in the src directory and a dev server can be started by using the `npm start` command. 14 | 15 | ## Installation 16 | ```bash 17 | $ npm install jodit-angular 18 | ``` 19 | 20 | ## Usage 21 | 22 | ### Loading the component 23 | 24 | Import the EditorModule from the npm package like this: 25 | 26 | ```typescript 27 | import { JoditAngularModule } from 'jodit-angular'; 28 | ``` 29 | 30 | And add it to you application module: 31 | ```typescript 32 | // This might look different depending on how you have set up your app 33 | // but the important part is the imports array 34 | @NgModule({ 35 | declarations: [ 36 | AppComponent 37 | ], 38 | imports: [ 39 | BrowserModule, 40 | JoditAngularModule // <- Important part 41 | ], 42 | providers: [], 43 | bootstrap: [AppComponent] 44 | }) 45 | ``` 46 | 47 | Using the component in your templates 48 | Use the editor in your templates like this: 49 | 50 | ```html 51 | 52 | ``` 53 | 54 | In config you can set all [Jodit's options](https://xdsoft.net/jodit/play.html) 55 | 56 | **Note about toolbar buttons override:** 57 | 58 | Jodit editor apply a different toolbar buttons layout based on width available for the editor itself. 59 | So a different width size for editor will show a different buttons layout. 60 | The "buttons" config setting in the example above will override only the default toolbar buttons for large widths. 61 | If you want to override buttons displayed on all editor sizes use something like this: 62 | 63 | ``` 64 | 72 | ``` 73 | 74 | ## Event binding 75 | You can also bind editor events via a shorthand prop on the editor, for example: 76 | 77 | ```html 78 | 79 | ``` 80 | 81 | ### Events list 82 | 83 | * onChange 84 | * onKeydown 85 | * onMousedown 86 | * onClick 87 | * onFocus 88 | * onPaste 89 | * onResize 90 | * onBeforeEnter 91 | * onBeforeCommand 92 | * onAfterCommand 93 | * onAfterExec 94 | * onAfterPaste 95 | * onChangeSelection 96 | 97 | Where the handler gets called with an object containing the properties event, which is the event object, and editor, which is a reference to the editor. 98 | 99 | 100 | \ 101 | License 102 | ----- 103 | This package is available under `MIT` License. 104 | -------------------------------------------------------------------------------- /angular.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "./node_modules/@angular/cli/lib/config/schema.json", 3 | "version": 1, 4 | "newProjectRoot": "projects", 5 | "projects": { 6 | "jodit-angular-lib": { 7 | "projectType": "library", 8 | "root": "projects/jodit-angular-lib", 9 | "sourceRoot": "projects/jodit-angular-lib/src", 10 | "prefix": "lib", 11 | "architect": { 12 | "build": { 13 | "builder": "@angular-devkit/build-ng-packagr:build", 14 | "options": { 15 | "tsConfig": "projects/jodit-angular-lib/tsconfig.lib.json", 16 | "project": "projects/jodit-angular-lib/ng-package.json" 17 | } 18 | }, 19 | "test": { 20 | "builder": "@angular-devkit/build-angular:karma", 21 | "options": { 22 | "main": "projects/jodit-angular-lib/src/test.ts", 23 | "tsConfig": "projects/jodit-angular-lib/tsconfig.spec.json", 24 | "karmaConfig": "projects/jodit-angular-lib/karma.conf.js" 25 | } 26 | }, 27 | "lint": { 28 | "builder": "@angular-devkit/build-angular:tslint", 29 | "options": { 30 | "tsConfig": [ 31 | "projects/jodit-angular-lib/tsconfig.lib.json", 32 | "projects/jodit-angular-lib/tsconfig.spec.json" 33 | ], 34 | "exclude": [ 35 | "**/node_modules/**" 36 | ] 37 | } 38 | } 39 | } 40 | }, 41 | "jodit-angular-app": { 42 | "projectType": "application", 43 | "schematics": {}, 44 | "root": "projects/jodit-angular-app", 45 | "sourceRoot": "projects/jodit-angular-app/src", 46 | "prefix": "app", 47 | "architect": { 48 | "build": { 49 | "builder": "@angular-devkit/build-angular:browser", 50 | "options": { 51 | "outputPath": "dist/jodit-angular-app", 52 | "index": "projects/jodit-angular-app/src/index.html", 53 | "main": "projects/jodit-angular-app/src/main.ts", 54 | "polyfills": "projects/jodit-angular-app/src/polyfills.ts", 55 | "tsConfig": "projects/jodit-angular-app/tsconfig.app.json", 56 | "aot": false, 57 | "assets": [ 58 | "projects/jodit-angular-app/src/favicon.ico", 59 | "projects/jodit-angular-app/src/assets" 60 | ], 61 | "styles": [ 62 | "projects/jodit-angular-app/src/styles.css" 63 | ], 64 | "scripts": [] 65 | }, 66 | "configurations": { 67 | "production": { 68 | "fileReplacements": [ 69 | { 70 | "replace": "projects/jodit-angular-app/src/environments/environment.ts", 71 | "with": "projects/jodit-angular-app/src/environments/environment.prod.ts" 72 | } 73 | ], 74 | "optimization": true, 75 | "outputHashing": "all", 76 | "sourceMap": false, 77 | "extractCss": true, 78 | "namedChunks": false, 79 | "aot": true, 80 | "extractLicenses": true, 81 | "vendorChunk": false, 82 | "buildOptimizer": true, 83 | "budgets": [ 84 | { 85 | "type": "initial", 86 | "maximumWarning": "2mb", 87 | "maximumError": "5mb" 88 | }, 89 | { 90 | "type": "anyComponentStyle", 91 | "maximumWarning": "6kb", 92 | "maximumError": "10kb" 93 | } 94 | ] 95 | } 96 | } 97 | }, 98 | "serve": { 99 | "builder": "@angular-devkit/build-angular:dev-server", 100 | "options": { 101 | "browserTarget": "jodit-angular-app:build" 102 | }, 103 | "configurations": { 104 | "production": { 105 | "browserTarget": "jodit-angular-app:build:production" 106 | } 107 | } 108 | }, 109 | "extract-i18n": { 110 | "builder": "@angular-devkit/build-angular:extract-i18n", 111 | "options": { 112 | "browserTarget": "jodit-angular-app:build" 113 | } 114 | }, 115 | "test": { 116 | "builder": "@angular-devkit/build-angular:karma", 117 | "options": { 118 | "main": "projects/jodit-angular-app/src/test.ts", 119 | "polyfills": "projects/jodit-angular-app/src/polyfills.ts", 120 | "tsConfig": "projects/jodit-angular-app/tsconfig.spec.json", 121 | "karmaConfig": "projects/jodit-angular-app/karma.conf.js", 122 | "assets": [ 123 | "projects/jodit-angular-app/src/favicon.ico", 124 | "projects/jodit-angular-app/src/assets" 125 | ], 126 | "styles": [ 127 | "projects/jodit-angular-app/src/styles.css" 128 | ], 129 | "scripts": [] 130 | } 131 | }, 132 | "lint": { 133 | "builder": "@angular-devkit/build-angular:tslint", 134 | "options": { 135 | "tsConfig": [ 136 | "projects/jodit-angular-app/tsconfig.app.json", 137 | "projects/jodit-angular-app/tsconfig.spec.json", 138 | "projects/jodit-angular-app/e2e/tsconfig.json" 139 | ], 140 | "exclude": [ 141 | "**/node_modules/**" 142 | ] 143 | } 144 | }, 145 | "e2e": { 146 | "builder": "@angular-devkit/build-angular:protractor", 147 | "options": { 148 | "protractorConfig": "projects/jodit-angular-app/e2e/protractor.conf.js", 149 | "devServerTarget": "jodit-angular-app:serve" 150 | }, 151 | "configurations": { 152 | "production": { 153 | "devServerTarget": "jodit-angular-app:serve:production" 154 | } 155 | } 156 | } 157 | } 158 | } 159 | }, 160 | "defaultProject": "jodit-angular-app" 161 | } 162 | -------------------------------------------------------------------------------- /browserslist: -------------------------------------------------------------------------------- 1 | # This file is used by the build system to adjust CSS and JS output to support the specified browsers below. 2 | # For additional information regarding the format and rule options, please see: 3 | # https://github.com/browserslist/browserslist#queries 4 | 5 | # You can see what browsers were selected by your queries by running: 6 | # npx browserslist 7 | 8 | > 0.5% 9 | last 2 versions 10 | Firefox ESR 11 | not dead 12 | not IE 9-11 # For IE 9-11 support, remove 'not'. -------------------------------------------------------------------------------- /dist.tgz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jodit/jodit-angular/0e08de0e7546a7125e88d64bf47f9db18bf35c00/dist.tgz -------------------------------------------------------------------------------- /karma.conf.js: -------------------------------------------------------------------------------- 1 | // Karma configuration file, see link for more information 2 | // https://karma-runner.github.io/1.0/config/configuration-file.html 3 | 4 | module.exports = function (config) { 5 | config.set({ 6 | basePath: '', 7 | frameworks: ['jasmine', '@angular-devkit/build-angular'], 8 | plugins: [ 9 | require('karma-jasmine'), 10 | require('karma-chrome-launcher'), 11 | require('karma-jasmine-html-reporter'), 12 | require('karma-coverage-istanbul-reporter'), 13 | require('@angular-devkit/build-angular/plugins/karma') 14 | ], 15 | client: { 16 | clearContext: false // leave Jasmine Spec Runner output visible in browser 17 | }, 18 | coverageIstanbulReporter: { 19 | dir: require('path').join(__dirname, '../coverage'), 20 | reports: ['html', 'lcovonly'], 21 | fixWebpackSourcePaths: true 22 | }, 23 | reporters: ['progress', 'kjhtml'], 24 | port: 9876, 25 | colors: true, 26 | logLevel: config.LOG_INFO, 27 | autoWatch: true, 28 | browsers: ['Chrome'], 29 | singleRun: false 30 | }); 31 | }; 32 | -------------------------------------------------------------------------------- /ng-package.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "./node_modules/ng-packagr/ng-package.schema.json", 3 | "lib": { 4 | "entryFile": "./jodit-angular/public_api.ts" 5 | }, 6 | "whitelistedNonPeerDependencies": ["."] 7 | } -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "jodit-angular", 3 | "version": "1.0.119", 4 | "description": "Angular Jodit Component", 5 | "main": "index.js", 6 | "scripts": { 7 | "ng": "ng", 8 | "start": "ng serve", 9 | "build": "ng build --prod", 10 | "test": "ng test", 11 | "lint": "ng lint", 12 | "e2e": "ng e2e", 13 | "package": "ng build jodit-angular-lib", 14 | "public": "npm publish dist/jodit-angular-lib", 15 | "newversion": "rm -rf dist/ && cd ./projects/jodit-angular-lib && npm version patch --no-git-tag-version && cd ../../ && npm version patch --no-git-tag-version && npm run package && npm run github && npm run public", 16 | "github": "git add --all && git commit -m \"New version $npm_package_version. Read more https://github.com/xdan/jodit/releases/tag/$npm_package_version \" && git tag $npm_package_version && git push --tags origin HEAD:master" 17 | }, 18 | "repository": { 19 | "type": "git", 20 | "url": "git+https://github.com/jodit/jodit-angular.git" 21 | }, 22 | "keywords": [ 23 | "angular2", 24 | "angular4", 25 | "angular5", 26 | "ng2", 27 | "ng4", 28 | "ng5", 29 | "jodit", 30 | "html", 31 | "text", 32 | "editor", 33 | "wysisyg", 34 | "rich editor", 35 | "rich text editor", 36 | "rte", 37 | "javascript" 38 | ], 39 | "author": "Chupurnov Valeriy ", 40 | "license": "MIT", 41 | "bugs": { 42 | "url": "https://github.com/jodit/jodit-angular/issues" 43 | }, 44 | "homepage": "https://github.com/jodit/jodit-angular#readme", 45 | "dependencies": { 46 | "@angular/animations": "^8.2.14", 47 | "@angular/common": "^8.2.14", 48 | "@angular/compiler": "^8.2.14", 49 | "@angular/core": "^8.2.14", 50 | "@angular/forms": "^8.2.14", 51 | "@angular/platform-browser": "^8.2.14", 52 | "@angular/platform-browser-dynamic": "^8.2.14", 53 | "@angular/router": "^8.2.14", 54 | "core-js": "^2.6.5", 55 | "jodit": "^3.5.4", 56 | "rxjs": "^6.4.0", 57 | "tslib": "^1.10.0", 58 | "zone.js": "~0.9.1" 59 | }, 60 | "devDependencies": { 61 | "@angular-devkit/build-angular": "~0.803.29", 62 | "@angular-devkit/build-ng-packagr": "~0.803.29", 63 | "@angular/cli": "8.3.29", 64 | "@angular/compiler-cli": "^8.2.14", 65 | "@angular/language-service": "^8.2.14", 66 | "@types/jasmine": "^2.8.9", 67 | "@types/jasminewd2": "^2.0.5", 68 | "@types/node": "^10.12.0", 69 | "codelyzer": "^5.0.1", 70 | "jasmine-core": "~3.3.0", 71 | "jasmine-spec-reporter": "~4.2.1", 72 | "karma": "^3.1.1", 73 | "karma-chrome-launcher": "~2.2.0", 74 | "karma-coverage-istanbul-reporter": "^2.0.4", 75 | "karma-jasmine": "^1.1.2", 76 | "karma-jasmine-html-reporter": "^1.3.1", 77 | "ng-packagr": "^5.4.0", 78 | "protractor": "~5.4.1", 79 | "ts-node": "~7.0.1", 80 | "tsickle": "^0.37.0", 81 | "tslint": "~5.11.0", 82 | "typescript": "~3.5.3" 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /projects/jodit-angular-app/browserslist: -------------------------------------------------------------------------------- 1 | # This file is used by the build system to adjust CSS and JS output to support the specified browsers below. 2 | # For additional information regarding the format and rule options, please see: 3 | # https://github.com/browserslist/browserslist#queries 4 | 5 | # You can see what browsers were selected by your queries by running: 6 | # npx browserslist 7 | 8 | > 0.5% 9 | last 2 versions 10 | Firefox ESR 11 | not dead 12 | not IE 9-11 # For IE 9-11 support, remove 'not'. -------------------------------------------------------------------------------- /projects/jodit-angular-app/e2e/protractor.conf.js: -------------------------------------------------------------------------------- 1 | // @ts-check 2 | // Protractor configuration file, see link for more information 3 | // https://github.com/angular/protractor/blob/master/lib/config.ts 4 | 5 | const { SpecReporter } = require('jasmine-spec-reporter'); 6 | 7 | /** 8 | * @type { import("protractor").Config } 9 | */ 10 | exports.config = { 11 | allScriptsTimeout: 11000, 12 | specs: [ 13 | './src/**/*.e2e-spec.ts' 14 | ], 15 | capabilities: { 16 | browserName: 'chrome' 17 | }, 18 | directConnect: true, 19 | baseUrl: 'http://localhost:4200/', 20 | framework: 'jasmine', 21 | jasmineNodeOpts: { 22 | showColors: true, 23 | defaultTimeoutInterval: 30000, 24 | print: function() {} 25 | }, 26 | onPrepare() { 27 | require('ts-node').register({ 28 | project: require('path').join(__dirname, './tsconfig.json') 29 | }); 30 | jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } })); 31 | } 32 | }; -------------------------------------------------------------------------------- /projects/jodit-angular-app/e2e/src/app.e2e-spec.ts: -------------------------------------------------------------------------------- 1 | import { AppPage } from './app.po'; 2 | 3 | describe('jodit-angular App', () => { 4 | let page: AppPage; 5 | 6 | beforeEach(() => { 7 | page = new AppPage(); 8 | }); 9 | 10 | it('should display Jodit html editor', () => { 11 | page.navigateTo(); 12 | 13 | // Must be exists Jodit container & workplace class styles 14 | expect(page.getJoditContainer()).toBeTruthy(); 15 | expect(page.getJoditWorkplace()).toBeTruthy(); 16 | }); 17 | }); 18 | -------------------------------------------------------------------------------- /projects/jodit-angular-app/e2e/src/app.po.ts: -------------------------------------------------------------------------------- 1 | import { browser, by, element } from 'protractor'; 2 | 3 | export class AppPage { 4 | navigateTo() { 5 | return browser.get('/'); 6 | } 7 | 8 | getJoditContainer() { 9 | return element(by.css('.jodit_container')); 10 | } 11 | 12 | getJoditWorkplace() { 13 | return element(by.css('.jodit_workplace')); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /projects/jodit-angular-app/e2e/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../../../out-tsc/e2e", 5 | "module": "commonjs", 6 | "target": "es5", 7 | "types": [ 8 | "jasmine", 9 | "jasminewd2", 10 | "node" 11 | ] 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /projects/jodit-angular-app/karma.conf.js: -------------------------------------------------------------------------------- 1 | // Karma configuration file, see link for more information 2 | // https://karma-runner.github.io/1.0/config/configuration-file.html 3 | 4 | module.exports = function (config) { 5 | config.set({ 6 | basePath: '', 7 | frameworks: ['jasmine', '@angular-devkit/build-angular'], 8 | plugins: [ 9 | require('karma-jasmine'), 10 | require('karma-chrome-launcher'), 11 | require('karma-jasmine-html-reporter'), 12 | require('karma-coverage-istanbul-reporter'), 13 | require('@angular-devkit/build-angular/plugins/karma') 14 | ], 15 | client: { 16 | clearContext: false // leave Jasmine Spec Runner output visible in browser 17 | }, 18 | coverageIstanbulReporter: { 19 | dir: require('path').join(__dirname, '../../coverage/jodit-angular-app'), 20 | reports: ['html', 'lcovonly', 'text-summary'], 21 | fixWebpackSourcePaths: true 22 | }, 23 | reporters: ['progress', 'kjhtml'], 24 | port: 9876, 25 | colors: true, 26 | logLevel: config.LOG_INFO, 27 | autoWatch: true, 28 | browsers: ['Chrome'], 29 | singleRun: false, 30 | restartOnFileChange: true 31 | }); 32 | }; 33 | -------------------------------------------------------------------------------- /projects/jodit-angular-app/src/app/app.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jodit/jodit-angular/0e08de0e7546a7125e88d64bf47f9db18bf35c00/projects/jodit-angular-app/src/app/app.component.css -------------------------------------------------------------------------------- /projects/jodit-angular-app/src/app/app.component.html: -------------------------------------------------------------------------------- 1 | 6 | -------------------------------------------------------------------------------- /projects/jodit-angular-app/src/app/app.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { TestBed, async } from '@angular/core/testing'; 2 | import { JoditAngularModule } from 'jodit-angular'; 3 | 4 | import { AppComponent } from './app.component'; 5 | 6 | describe('AppComponent', () => { 7 | beforeEach(async(() => { 8 | TestBed.configureTestingModule({ 9 | imports: [ 10 | JoditAngularModule 11 | ], 12 | declarations: [ 13 | AppComponent 14 | ], 15 | }).compileComponents(); 16 | })); 17 | it('should create the app', async(() => { 18 | const fixture = TestBed.createComponent(AppComponent); 19 | const app = fixture.debugElement.componentInstance; 20 | expect(app).toBeTruthy(); 21 | })); 22 | it(`should be display the Jodit html editor`, async(() => { 23 | const fixture = TestBed.createComponent(AppComponent); 24 | fixture.detectChanges(); 25 | const compiled = fixture.debugElement.nativeElement; 26 | 27 | expect(compiled.querySelector('.jodit_container')).toBeTruthy(); 28 | })); 29 | }); 30 | -------------------------------------------------------------------------------- /projects/jodit-angular-app/src/app/app.component.ts: -------------------------------------------------------------------------------- 1 | import {Component} from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'app-root', 5 | templateUrl: './app.component.html', 6 | styleUrls: ['./app.component.css'] 7 | }) 8 | export class AppComponent { 9 | title = 'app'; 10 | 11 | content = '

Hello world

'; 12 | 13 | config = { 14 | // readonly: false, 15 | // toolbarAdaptive: false, 16 | // useAceEditor: false, 17 | // sourceEditor: 'area' 18 | // buttons: [ 19 | // 'source' 20 | // ] 21 | }; 22 | 23 | handleEvent($event: any) { 24 | return false; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /projects/jodit-angular-app/src/app/app.module.ts: -------------------------------------------------------------------------------- 1 | import { BrowserModule } from '@angular/platform-browser'; 2 | import { NgModule } from '@angular/core'; 3 | import { AppComponent } from './app.component'; 4 | import { JoditAngularModule } from 'jodit-angular'; 5 | import {FormsModule} from '@angular/forms'; 6 | 7 | @NgModule({ 8 | declarations: [ 9 | AppComponent 10 | ], 11 | imports: [ 12 | BrowserModule, 13 | JoditAngularModule, 14 | FormsModule 15 | ], 16 | providers: [], 17 | bootstrap: [AppComponent] 18 | }) 19 | export class AppModule { } 20 | -------------------------------------------------------------------------------- /projects/jodit-angular-app/src/assets/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jodit/jodit-angular/0e08de0e7546a7125e88d64bf47f9db18bf35c00/projects/jodit-angular-app/src/assets/.gitkeep -------------------------------------------------------------------------------- /projects/jodit-angular-app/src/environments/environment.prod.ts: -------------------------------------------------------------------------------- 1 | export const environment = { 2 | production: true 3 | }; 4 | -------------------------------------------------------------------------------- /projects/jodit-angular-app/src/environments/environment.ts: -------------------------------------------------------------------------------- 1 | // This file can be replaced during build by using the `fileReplacements` array. 2 | // `ng build --prod` replaces `environment.ts` with `environment.prod.ts`. 3 | // The list of file replacements can be found in `angular.json`. 4 | 5 | export const environment = { 6 | production: false 7 | }; 8 | 9 | /* 10 | * For easier debugging in development mode, you can import the following file 11 | * to ignore zone related error stack frames such as `zone.run`, `zoneDelegate.invokeTask`. 12 | * 13 | * This import should be commented out in production mode because it will have a negative impact 14 | * on performance if an error is thrown. 15 | */ 16 | // import 'zone.js/dist/zone-error'; // Included with Angular CLI. 17 | -------------------------------------------------------------------------------- /projects/jodit-angular-app/src/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jodit/jodit-angular/0e08de0e7546a7125e88d64bf47f9db18bf35c00/projects/jodit-angular-app/src/favicon.ico -------------------------------------------------------------------------------- /projects/jodit-angular-app/src/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | JoditAngularApp 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /projects/jodit-angular-app/src/main.ts: -------------------------------------------------------------------------------- 1 | import { enableProdMode } from '@angular/core'; 2 | import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; 3 | 4 | import { AppModule } from './app/app.module'; 5 | import { environment } from './environments/environment'; 6 | 7 | if (environment.production) { 8 | enableProdMode(); 9 | } 10 | 11 | platformBrowserDynamic().bootstrapModule(AppModule) 12 | .catch(err => console.error(err)); 13 | -------------------------------------------------------------------------------- /projects/jodit-angular-app/src/polyfills.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file includes polyfills needed by Angular and is loaded before the app. 3 | * You can add your own extra polyfills to this file. 4 | * 5 | * This file is divided into 2 sections: 6 | * 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers. 7 | * 2. Application imports. Files imported after ZoneJS that should be loaded before your main 8 | * file. 9 | * 10 | * The current setup is for so-called "evergreen" browsers; the last versions of browsers that 11 | * automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera), 12 | * Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile. 13 | * 14 | * Learn more in https://angular.io/guide/browser-support 15 | */ 16 | 17 | /*************************************************************************************************** 18 | * BROWSER POLYFILLS 19 | */ 20 | 21 | /** IE10 and IE11 requires the following for NgClass support on SVG elements */ 22 | // import 'classlist.js'; // Run `npm install --save classlist.js`. 23 | 24 | /** 25 | * Web Animations `@angular/platform-browser/animations` 26 | * Only required if AnimationBuilder is used within the application and using IE/Edge or Safari. 27 | * Standard animation support in Angular DOES NOT require any polyfills (as of Angular 6.0). 28 | */ 29 | // import 'web-animations-js'; // Run `npm install --save web-animations-js`. 30 | 31 | /** 32 | * By default, zone.js will patch all possible macroTask and DomEvents 33 | * user can disable parts of macroTask/DomEvents patch by setting following flags 34 | * because those flags need to be set before `zone.js` being loaded, and webpack 35 | * will put import in the top of bundle, so user need to create a separate file 36 | * in this directory (for example: zone-flags.ts), and put the following flags 37 | * into that file, and then add the following code before importing zone.js. 38 | * import './zone-flags.ts'; 39 | * 40 | * The flags allowed in zone-flags.ts are listed here. 41 | * 42 | * The following flags will work for all browsers. 43 | * 44 | * (window as any).__Zone_disable_requestAnimationFrame = true; // disable patch requestAnimationFrame 45 | * (window as any).__Zone_disable_on_property = true; // disable patch onProperty such as onclick 46 | * (window as any).__zone_symbol__UNPATCHED_EVENTS = ['scroll', 'mousemove']; // disable patch specified eventNames 47 | * 48 | * in IE/Edge developer tools, the addEventListener will also be wrapped by zone.js 49 | * with the following flag, it will bypass `zone.js` patch for IE/Edge 50 | * 51 | * (window as any).__Zone_enable_cross_context_check = true; 52 | * 53 | */ 54 | 55 | /*************************************************************************************************** 56 | * Zone JS is required by default for Angular itself. 57 | */ 58 | import 'zone.js/dist/zone'; // Included with Angular CLI. 59 | 60 | 61 | /*************************************************************************************************** 62 | * APPLICATION IMPORTS 63 | */ 64 | -------------------------------------------------------------------------------- /projects/jodit-angular-app/src/styles.css: -------------------------------------------------------------------------------- 1 | /* You can add global styles to this file, and also import other style files */ 2 | -------------------------------------------------------------------------------- /projects/jodit-angular-app/src/test.ts: -------------------------------------------------------------------------------- 1 | // This file is required by karma.conf.js and loads recursively all the .spec and framework files 2 | 3 | import 'zone.js/dist/zone-testing'; 4 | import { getTestBed } from '@angular/core/testing'; 5 | import { 6 | BrowserDynamicTestingModule, 7 | platformBrowserDynamicTesting 8 | } from '@angular/platform-browser-dynamic/testing'; 9 | 10 | declare const require: any; 11 | 12 | // First, initialize the Angular testing environment. 13 | getTestBed().initTestEnvironment( 14 | BrowserDynamicTestingModule, 15 | platformBrowserDynamicTesting() 16 | ); 17 | // Then we find all the tests. 18 | const context = require.context('./', true, /\.spec\.ts$/); 19 | // And load the modules. 20 | context.keys().map(context); 21 | -------------------------------------------------------------------------------- /projects/jodit-angular-app/tsconfig.app.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../../out-tsc/app", 5 | "types": [] 6 | }, 7 | "files": [ 8 | "src/main.ts", 9 | "src/polyfills.ts" 10 | ], 11 | "include": [ 12 | "src/**/*.ts" 13 | ], 14 | "exclude": [ 15 | "src/test.ts", 16 | "src/**/*.spec.ts" 17 | ] 18 | } 19 | -------------------------------------------------------------------------------- /projects/jodit-angular-app/tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../../out-tsc/spec", 5 | "types": [ 6 | "jasmine", 7 | "node" 8 | ] 9 | }, 10 | "files": [ 11 | "src/test.ts", 12 | "src/polyfills.ts" 13 | ], 14 | "include": [ 15 | "src/**/*.spec.ts", 16 | "src/**/*.d.ts" 17 | ] 18 | } 19 | -------------------------------------------------------------------------------- /projects/jodit-angular-app/tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tslint.json", 3 | "rules": { 4 | "directive-selector": [ 5 | true, 6 | "attribute", 7 | "app", 8 | "camelCase" 9 | ], 10 | "component-selector": [ 11 | true, 12 | "element", 13 | "app", 14 | "kebab-case" 15 | ] 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /projects/jodit-angular-lib/README.md: -------------------------------------------------------------------------------- 1 | # JoditAngularLib 2 | 3 | This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 8.2.14. 4 | 5 | ## Code scaffolding 6 | 7 | Run `ng generate component component-name --project jodit-angular-lib` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module --project jodit-angular-lib`. 8 | > Note: Don't forget to add `--project jodit-angular-lib` or else it will be added to the default project in your `angular.json` file. 9 | 10 | ## Build 11 | 12 | Run `ng build jodit-angular-lib` to build the project. The build artifacts will be stored in the `dist/` directory. 13 | 14 | ## Publishing 15 | 16 | After building your library with `ng build jodit-angular-lib`, go to the dist folder `cd dist/jodit-angular-lib` and run `npm publish`. 17 | 18 | ## Running unit tests 19 | 20 | Run `ng test jodit-angular-lib` to execute the unit tests via [Karma](https://karma-runner.github.io). 21 | 22 | ## Further help 23 | 24 | To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI README](https://github.com/angular/angular-cli/blob/master/README.md). 25 | -------------------------------------------------------------------------------- /projects/jodit-angular-lib/karma.conf.js: -------------------------------------------------------------------------------- 1 | // Karma configuration file, see link for more information 2 | // https://karma-runner.github.io/1.0/config/configuration-file.html 3 | 4 | module.exports = function (config) { 5 | config.set({ 6 | basePath: '', 7 | frameworks: ['jasmine', '@angular-devkit/build-angular'], 8 | plugins: [ 9 | require('karma-jasmine'), 10 | require('karma-chrome-launcher'), 11 | require('karma-jasmine-html-reporter'), 12 | require('karma-coverage-istanbul-reporter'), 13 | require('@angular-devkit/build-angular/plugins/karma') 14 | ], 15 | client: { 16 | clearContext: false // leave Jasmine Spec Runner output visible in browser 17 | }, 18 | coverageIstanbulReporter: { 19 | dir: require('path').join(__dirname, '../../coverage/jodit-angular-lib'), 20 | reports: ['html', 'lcovonly', 'text-summary'], 21 | fixWebpackSourcePaths: true 22 | }, 23 | reporters: ['progress', 'kjhtml'], 24 | port: 9876, 25 | colors: true, 26 | logLevel: config.LOG_INFO, 27 | autoWatch: true, 28 | browsers: ['Chrome'], 29 | singleRun: false, 30 | restartOnFileChange: true 31 | }); 32 | }; 33 | -------------------------------------------------------------------------------- /projects/jodit-angular-lib/ng-package.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "../../node_modules/ng-packagr/ng-package.schema.json", 3 | "dest": "../../dist/jodit-angular-lib", 4 | "lib": { 5 | "entryFile": "src/public-api.ts" 6 | } 7 | } -------------------------------------------------------------------------------- /projects/jodit-angular-lib/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "jodit-angular", 3 | "version": "1.0.120", 4 | "peerDependencies": { 5 | "@angular/common": "^7.0.0 || ^8.0.0 || ^9.0.0-0", 6 | "@angular/core": "^7.0.0 || ^8.0.0 || ^9.0.0-0", 7 | "@angular/animations": "^7.0.0 || ^8.0.0 || ^9.0.0-0", 8 | "@angular/compiler": "^7.0.0 || ^8.0.0 || ^9.0.0-0", 9 | "@angular/forms": "^7.0.0 || ^8.0.0 || ^9.0.0-0", 10 | "@angular/platform-browser": "^7.0.0 || ^8.0.0 || ^9.0.0-0", 11 | "@angular/platform-browser-dynamic": "^7.0.0 || ^8.0.0 || ^9.0.0-0", 12 | "@angular/router": "^7.0.0 || ^8.0.0 || ^9.0.0-0", 13 | "core-js": "^2.6.5", 14 | "jodit": "^3.5.4", 15 | "rxjs": "^6.3.3", 16 | "tslib": "^1.10.0", 17 | "zone.js": "~0.9.1" 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /projects/jodit-angular-lib/src/lib/Events.ts: -------------------------------------------------------------------------------- 1 | import {Output, EventEmitter} from '@angular/core'; 2 | 3 | export interface EventObj { 4 | args: any[]; 5 | editor: any; 6 | } 7 | 8 | export class Events { 9 | // tslint:disable:no-output-on-prefix 10 | @Output() onChange: EventEmitter = new EventEmitter(); 11 | @Output() onBeforeEnter: EventEmitter = new EventEmitter(false); 12 | @Output() onKeydown: EventEmitter = new EventEmitter(false); 13 | @Output() onMousedown: EventEmitter = new EventEmitter(false); 14 | @Output() onClick: EventEmitter = new EventEmitter(false); 15 | @Output() onFocus: EventEmitter = new EventEmitter(); 16 | @Output() onBlur: EventEmitter = new EventEmitter(); 17 | @Output() onPaste: EventEmitter = new EventEmitter(false); 18 | @Output() onResize: EventEmitter = new EventEmitter(); 19 | @Output() onBeforeCommand: EventEmitter = new EventEmitter(false); 20 | @Output() onAfterCommand: EventEmitter = new EventEmitter(); 21 | @Output() onAfterExec: EventEmitter = new EventEmitter(); 22 | @Output() onAfterPaste: EventEmitter = new EventEmitter(); 23 | @Output() onChangeSelection: EventEmitter = new EventEmitter(); 24 | } 25 | 26 | 27 | export const validEvents: (keyof Events)[] = [ 28 | 'onChange', 29 | 'onBeforeEnter', 30 | 'onKeydown', 31 | 'onMousedown', 32 | 'onClick', 33 | 'onFocus', 34 | 'onBlur', 35 | 'onPaste', 36 | 'onResize', 37 | 'onBeforeCommand', 38 | 'onAfterCommand', 39 | 'onAfterExec', 40 | 'onAfterPaste', 41 | 'onChangeSelection', 42 | ]; 43 | -------------------------------------------------------------------------------- /projects/jodit-angular-lib/src/lib/jodit-angular.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { JoditAngularComponent } from './jodit-angular.component'; 4 | 5 | describe('JoditAngularComponent', () => { 6 | let component: JoditAngularComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async(() => { 10 | TestBed.configureTestingModule({ 11 | declarations: [ JoditAngularComponent ] 12 | }) 13 | .compileComponents(); 14 | })); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(JoditAngularComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /projects/jodit-angular-lib/src/lib/jodit-angular.component.ts: -------------------------------------------------------------------------------- 1 | import { 2 | AfterViewInit, 3 | Component, 4 | ElementRef, 5 | EventEmitter, 6 | forwardRef, 7 | Input, 8 | NgZone, 9 | OnDestroy, 10 | Provider, 11 | ViewEncapsulation 12 | } from '@angular/core'; 13 | import {ControlValueAccessor, NG_VALUE_ACCESSOR} from '@angular/forms'; 14 | import {Events, validEvents} from './Events'; 15 | 16 | 17 | declare const require: any; 18 | const EditorModule: any = require('jodit'); 19 | 20 | 21 | const CUSTOM_INPUT_CONTROL_VALUE_ACCESSOR: Provider = { 22 | provide: NG_VALUE_ACCESSOR, 23 | useExisting: forwardRef(() => JoditAngularComponent), 24 | multi: true 25 | }; 26 | 27 | @Component({ 28 | selector: 'jodit-editor', 29 | template: ` 30 | `, 31 | encapsulation: ViewEncapsulation.None, 32 | styleUrls: ['../../../../node_modules/jodit/build/jodit.min.css'], 33 | providers: [CUSTOM_INPUT_CONTROL_VALUE_ACCESSOR] 34 | }) 35 | export class JoditAngularComponent extends Events implements AfterViewInit, OnDestroy, ControlValueAccessor { 36 | 37 | @Input() 38 | set config(v: object | undefined) { 39 | this._config = v; 40 | if (this.element) { 41 | this.resetEditor(); 42 | } 43 | } 44 | 45 | get config() { 46 | return this._config; 47 | } 48 | 49 | private _config = {}; 50 | 51 | @Input() tagName = 'textarea'; 52 | @Input() id: string | undefined; 53 | @Input() defaultValue: string | undefined; 54 | 55 | element: HTMLElement; 56 | editor: any; 57 | 58 | private onChangeCallback: (_: any) => {}; 59 | private onTouchedCallback: () => {}; 60 | 61 | constructor(private elementRef: ElementRef, private ngZone: NgZone) { 62 | super(); 63 | this.elementRef = elementRef; 64 | this.ngZone = ngZone; 65 | } 66 | 67 | createElement() { 68 | const tagName = typeof this.tagName === 'string' ? this.tagName : 'textarea'; 69 | this.element = document.createElement(tagName); 70 | if (this.element) { 71 | this.element.id = this.id; 72 | this.elementRef.nativeElement.appendChild(this.element); 73 | } 74 | } 75 | 76 | 77 | get value(): string { 78 | if (this.editor) { 79 | return this.editor.getEditorValue(); 80 | } else { 81 | return ''; 82 | } 83 | } 84 | 85 | set value(v: string) { 86 | if (this.editor) { 87 | this.editor.setEditorValue(v || ''); 88 | } else { 89 | this.defaultValue = v; 90 | } 91 | } 92 | 93 | resetEditor() { 94 | this.editor.destruct(); 95 | this.createEditor(); 96 | } 97 | 98 | ngAfterViewInit() { 99 | if (!this.element) { 100 | this.createElement(); 101 | this.createEditor(); 102 | } 103 | } 104 | 105 | createEditor() { 106 | // Create instance outside Angular scope 107 | this.ngZone.runOutsideAngular(() => { 108 | this.editor = new EditorModule.Jodit(this.element, this.config); 109 | }); 110 | 111 | if (this.defaultValue) { 112 | this.editor.value = this.defaultValue; 113 | } 114 | 115 | this.editor.events 116 | .on('change', (value: string) => { 117 | if (typeof this.onChangeCallback === 'function') { 118 | this.ngZone.run(() => this.onChangeCallback(value)); 119 | } 120 | }) 121 | .on('blur', () => { 122 | if (typeof this.onTouchedCallback === 'function') { 123 | this.ngZone.run(() => this.onTouchedCallback()); 124 | } 125 | }); 126 | 127 | 128 | validEvents.forEach((eventName) => { 129 | const eventEmitter: EventEmitter = this[eventName]; 130 | if (eventEmitter.observers.length > 0) { 131 | let eventNameInJodit = eventName.substring(2); 132 | eventNameInJodit = eventNameInJodit.substr(0, 1).toLowerCase() + eventNameInJodit.substring(1); 133 | // tslint:disable-next-line:max-line-length 134 | this.editor.events.on(eventNameInJodit, this.ngZone.run(() => (...args: any[]) => eventEmitter.emit({ 135 | args, 136 | editor: this.editor 137 | }))); 138 | } 139 | }); 140 | } 141 | 142 | ngOnDestroy() { 143 | if (this.editor) { 144 | this.editor.destruct(); 145 | } 146 | } 147 | 148 | writeValue(v: any): void { 149 | this.value = v; 150 | } 151 | 152 | registerOnChange(fn: any): void { 153 | this.onChangeCallback = fn; 154 | } 155 | 156 | registerOnTouched(fn: () => {}): void { 157 | this.onTouchedCallback = fn; 158 | } 159 | 160 | setDisabledState(isDisabled: boolean): void { 161 | this.editor.setReadOnly(isDisabled); 162 | } 163 | } 164 | -------------------------------------------------------------------------------- /projects/jodit-angular-lib/src/lib/jodit-angular.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { CommonModule } from '@angular/common'; 3 | import { JoditAngularComponent } from './jodit-angular.component'; 4 | 5 | 6 | @NgModule({ 7 | imports: [ 8 | CommonModule 9 | ], 10 | declarations: [JoditAngularComponent], 11 | exports: [ 12 | JoditAngularComponent 13 | ] 14 | }) 15 | 16 | export class JoditAngularModule { } 17 | -------------------------------------------------------------------------------- /projects/jodit-angular-lib/src/public-api.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Public API Surface of jodit-angular-lib 3 | */ 4 | 5 | export * from './lib/jodit-angular.component'; 6 | export * from './lib/jodit-angular.module'; 7 | -------------------------------------------------------------------------------- /projects/jodit-angular-lib/src/test.ts: -------------------------------------------------------------------------------- 1 | // This file is required by karma.conf.js and loads recursively all the .spec and framework files 2 | 3 | import 'zone.js/dist/zone'; 4 | import 'zone.js/dist/zone-testing'; 5 | import { getTestBed } from '@angular/core/testing'; 6 | import { 7 | BrowserDynamicTestingModule, 8 | platformBrowserDynamicTesting 9 | } from '@angular/platform-browser-dynamic/testing'; 10 | 11 | declare const require: any; 12 | 13 | // First, initialize the Angular testing environment. 14 | getTestBed().initTestEnvironment( 15 | BrowserDynamicTestingModule, 16 | platformBrowserDynamicTesting() 17 | ); 18 | // Then we find all the tests. 19 | const context = require.context('./', true, /\.spec\.ts$/); 20 | // And load the modules. 21 | context.keys().map(context); 22 | -------------------------------------------------------------------------------- /projects/jodit-angular-lib/tsconfig.lib.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../../out-tsc/lib", 5 | "target": "es2015", 6 | "declaration": true, 7 | "inlineSources": true, 8 | "types": [], 9 | "lib": [ 10 | "dom", 11 | "es2018" 12 | ] 13 | }, 14 | "angularCompilerOptions": { 15 | "annotateForClosureCompiler": true, 16 | "skipTemplateCodegen": true, 17 | "strictMetadataEmit": true, 18 | "fullTemplateTypeCheck": true, 19 | "strictInjectionParameters": true, 20 | "enableResourceInlining": true 21 | }, 22 | "exclude": [ 23 | "src/test.ts", 24 | "**/*.spec.ts" 25 | ] 26 | } 27 | -------------------------------------------------------------------------------- /projects/jodit-angular-lib/tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../../out-tsc/spec", 5 | "types": [ 6 | "jasmine", 7 | "node" 8 | ] 9 | }, 10 | "files": [ 11 | "src/test.ts" 12 | ], 13 | "include": [ 14 | "**/*.spec.ts", 15 | "**/*.d.ts" 16 | ] 17 | } 18 | -------------------------------------------------------------------------------- /projects/jodit-angular-lib/tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tslint.json", 3 | "rules": { 4 | "directive-selector": [ 5 | true, 6 | "attribute", 7 | "lib", 8 | "camelCase" 9 | ], 10 | "component-selector": [ 11 | false, 12 | "element", 13 | "lib", 14 | "kebab-case" 15 | ] 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /protractor.conf.js: -------------------------------------------------------------------------------- 1 | // Protractor configuration file, see link for more information 2 | // https://github.com/angular/protractor/blob/master/lib/config.ts 3 | 4 | const { SpecReporter } = require('jasmine-spec-reporter'); 5 | 6 | exports.config = { 7 | allScriptsTimeout: 11000, 8 | specs: [ 9 | './e2e/**/*.e2e-spec.ts' 10 | ], 11 | capabilities: { 12 | 'browserName': 'chrome' 13 | }, 14 | directConnect: true, 15 | baseUrl: 'http://localhost:4200/', 16 | framework: 'jasmine', 17 | jasmineNodeOpts: { 18 | showColors: true, 19 | defaultTimeoutInterval: 30000, 20 | print: function() {} 21 | }, 22 | onPrepare() { 23 | require('ts-node').register({ 24 | project: 'e2e/tsconfig.e2e.json' 25 | }); 26 | jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } })); 27 | } 28 | }; 29 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compileOnSave": false, 3 | "compilerOptions": { 4 | "baseUrl": "./", 5 | "downlevelIteration": true, 6 | "module": "esnext", 7 | "noImplicitAny": true, 8 | "outDir": "./dist/out-tsc", 9 | "sourceMap": true, 10 | "declaration": false, 11 | "moduleResolution": "node", 12 | "emitDecoratorMetadata": true, 13 | "experimentalDecorators": true, 14 | "target": "es2015", 15 | "typeRoots": [ 16 | "node_modules/@types" 17 | ], 18 | "lib": [ 19 | "es2017", 20 | "dom" 21 | ], 22 | "paths": { 23 | "jodit-angular": [ 24 | "dist/jodit-angular-lib" 25 | ], 26 | "jodit-angular/*": [ 27 | "dist/jodit-angular-lib/*" 28 | ] 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "rulesDirectory": [ 3 | "node_modules/codelyzer" 4 | ], 5 | "rules": { 6 | "arrow-return-shorthand": true, 7 | "callable-types": true, 8 | "class-name": true, 9 | "comment-format": [ 10 | true, 11 | "check-space" 12 | ], 13 | "curly": true, 14 | "deprecation": { 15 | "severity": "warn" 16 | }, 17 | "eofline": true, 18 | "forin": true, 19 | "import-blacklist": [ 20 | true, 21 | "rxjs", 22 | "rxjs/Rx" 23 | ], 24 | "import-spacing": true, 25 | "indent": [ 26 | true, 27 | "spaces" 28 | ], 29 | "interface-over-type-literal": true, 30 | "label-position": true, 31 | "max-line-length": [ 32 | true, 33 | 140 34 | ], 35 | "member-access": false, 36 | "member-ordering": [ 37 | true, 38 | { 39 | "order": [ 40 | "static-field", 41 | "instance-field", 42 | "static-method", 43 | "instance-method" 44 | ] 45 | } 46 | ], 47 | "no-arg": true, 48 | "no-bitwise": true, 49 | "no-console": [ 50 | true, 51 | "debug", 52 | "info", 53 | "time", 54 | "timeEnd", 55 | "trace" 56 | ], 57 | "no-construct": true, 58 | "no-debugger": true, 59 | "no-duplicate-super": true, 60 | "no-empty": false, 61 | "no-empty-interface": true, 62 | "no-eval": true, 63 | "no-inferrable-types": [ 64 | true, 65 | "ignore-params" 66 | ], 67 | "no-misused-new": true, 68 | "no-non-null-assertion": true, 69 | "no-shadowed-variable": true, 70 | "no-string-literal": false, 71 | "no-string-throw": true, 72 | "no-switch-case-fall-through": true, 73 | "no-trailing-whitespace": true, 74 | "no-unnecessary-initializer": true, 75 | "no-unused-expression": true, 76 | "no-use-before-declare": true, 77 | "no-var-keyword": true, 78 | "object-literal-sort-keys": false, 79 | "one-line": [ 80 | true, 81 | "check-open-brace", 82 | "check-catch", 83 | "check-else", 84 | "check-whitespace" 85 | ], 86 | "prefer-const": true, 87 | "quotemark": [ 88 | true, 89 | "single" 90 | ], 91 | "radix": true, 92 | "semicolon": [ 93 | true, 94 | "always" 95 | ], 96 | "triple-equals": [ 97 | true, 98 | "allow-null-check" 99 | ], 100 | "typedef-whitespace": [ 101 | true, 102 | { 103 | "call-signature": "nospace", 104 | "index-signature": "nospace", 105 | "parameter": "nospace", 106 | "property-declaration": "nospace", 107 | "variable-declaration": "nospace" 108 | } 109 | ], 110 | "unified-signatures": true, 111 | "variable-name": false, 112 | "whitespace": [ 113 | true, 114 | "check-branch", 115 | "check-decl", 116 | "check-operator", 117 | "check-separator", 118 | "check-type" 119 | ], 120 | "directive-selector": [ 121 | true, 122 | "attribute", 123 | "app", 124 | "camelCase" 125 | ], 126 | "component-selector": [ 127 | true, 128 | "element", 129 | "app", 130 | "kebab-case" 131 | ], 132 | "no-output-on-prefix": true, 133 | "no-inputs-metadata-property": true, 134 | "no-outputs-metadata-property": true, 135 | "no-host-metadata-property": true, 136 | "no-input-rename": true, 137 | "no-output-rename": true, 138 | "use-lifecycle-interface": true, 139 | "use-pipe-transform-interface": true, 140 | "component-class-suffix": true, 141 | "directive-class-suffix": true 142 | } 143 | } 144 | --------------------------------------------------------------------------------