diff --git a/.compodocrc.json b/.compodocrc.json index ff7e41ca..b7633feb 100644 --- a/.compodocrc.json +++ b/.compodocrc.json @@ -3,13 +3,14 @@ "name": "NgxEditor", "output": "./docs/", "tsconfig": "./tsconfig.docs.json", - "customFavicon": "./src/favicon.ico", - "includes": "./extras", + "customFavicon": "./demo/src/favicon.ico", + "includes": "./wiki", "includesName": "Wiki", "disableLifeCycleHooks": true, "disablePrivate": true, "disableProtected": true, "disableInternal": true, "disableCoverage": true, - "hideGenerator": true + "hideGenerator": true, + "assetsFolder": "sketch" } diff --git a/.gitignore b/.gitignore index a09a5808..b9e1f99e 100644 --- a/.gitignore +++ b/.gitignore @@ -46,5 +46,4 @@ testem.log Thumbs.db # Output directories -build/ -docs/ +/docs diff --git a/README.md b/README.md index 0dcf63bc..23aada5e 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@

- ngxEditor + ngxEditor

A Simple WYSIWYG Editor for Angular 6 Applications.

diff --git a/angular.json b/angular.json index e258fd25..f5aeef15 100644 --- a/angular.json +++ b/angular.json @@ -4,31 +4,71 @@ "newProjectRoot": "projects", "projects": { "ngx-editor": { + "projectType": "library", + "root": "", + "sourceRoot": "src", + "prefix": "lib", + "architect": { + "build": { + "builder": "@angular-devkit/build-ng-packagr:build", + "options": { + "tsConfig": "src/tsconfig.lib.json", + "project": "src/ng-package.json" + }, + "configurations": { + "production": { + "tsConfig": "src/tsconfig.lib.prod.json" + } + } + }, + "test": { + "builder": "@angular-devkit/build-angular:karma", + "options": { + "main": "src/test.ts", + "tsConfig": "src/tsconfig.spec.json", + "karmaConfig": "src/karma.conf.js" + } + }, + "lint": { + "builder": "@angular-devkit/build-angular:tslint", + "options": { + "tsConfig": [ + "src/tsconfig.lib.json", + "src/tsconfig.spec.json" + ], + "exclude": [ + "**/node_modules/**" + ] + } + } + } + }, + "demo": { "projectType": "application", "schematics": { "@schematics/angular:component": { "style": "scss" } }, - "root": "", - "sourceRoot": "src", - "prefix": "", + "root": "demo", + "sourceRoot": "demo/src", + "prefix": "app", "architect": { "build": { "builder": "@angular-devkit/build-angular:browser", "options": { - "outputPath": "dist/ngx-editor", - "index": "src/index.html", - "main": "src/main.ts", - "polyfills": "src/polyfills.ts", - "tsConfig": "tsconfig.app.json", + "outputPath": "dist/demo", + "index": "demo/src/index.html", + "main": "demo/src/main.ts", + "polyfills": "demo/src/polyfills.ts", + "tsConfig": "demo/tsconfig.app.json", "aot": true, "assets": [ - "src/favicon.ico", - "src/assets" + "demo/src/favicon.ico", + "demo/src/assets" ], "styles": [ - "src/styles.scss" + "demo/src/styles.scss" ], "scripts": [] }, @@ -36,8 +76,8 @@ "production": { "fileReplacements": [ { - "replace": "src/environments/environment.ts", - "with": "src/environments/environment.prod.ts" + "replace": "demo/src/environments/environment.ts", + "with": "demo/src/environments/environment.prod.ts" } ], "optimization": true, @@ -66,33 +106,33 @@ "serve": { "builder": "@angular-devkit/build-angular:dev-server", "options": { - "browserTarget": "ngx-editor:build" + "browserTarget": "demo:build" }, "configurations": { "production": { - "browserTarget": "ngx-editor:build:production" + "browserTarget": "demo:build:production" } } }, "extract-i18n": { "builder": "@angular-devkit/build-angular:extract-i18n", "options": { - "browserTarget": "ngx-editor:build" + "browserTarget": "demo:build" } }, "test": { "builder": "@angular-devkit/build-angular:karma", "options": { - "main": "src/test.ts", - "polyfills": "src/polyfills.ts", - "tsConfig": "tsconfig.spec.json", - "karmaConfig": "karma.conf.js", + "main": "demo/src/test.ts", + "polyfills": "demo/src/polyfills.ts", + "tsConfig": "demo/tsconfig.spec.json", + "karmaConfig": "demo/karma.conf.js", "assets": [ - "src/favicon.ico", - "src/assets" + "demo/src/favicon.ico", + "demo/src/assets" ], "styles": [ - "src/styles.scss" + "demo/src/styles.scss" ], "scripts": [] } @@ -101,9 +141,9 @@ "builder": "@angular-devkit/build-angular:tslint", "options": { "tsConfig": [ - "tsconfig.app.json", - "tsconfig.spec.json", - "e2e/tsconfig.json" + "demo/tsconfig.app.json", + "demo/tsconfig.spec.json", + "demo/e2e/tsconfig.json" ], "exclude": [ "**/node_modules/**" @@ -113,16 +153,17 @@ "e2e": { "builder": "@angular-devkit/build-angular:protractor", "options": { - "protractorConfig": "e2e/protractor.conf.js", - "devServerTarget": "ngx-editor:serve" + "protractorConfig": "demo/e2e/protractor.conf.js", + "devServerTarget": "demo:serve" }, "configurations": { "production": { - "devServerTarget": "ngx-editor:serve:production" + "devServerTarget": "demo:serve:production" } } } } - }}, - "defaultProject": "ngx-editor" + } + }, + "defaultProject": "demo" } diff --git a/browserslist b/demo/browserslist similarity index 100% rename from browserslist rename to demo/browserslist diff --git a/e2e/protractor.conf.js b/demo/e2e/protractor.conf.js similarity index 100% rename from e2e/protractor.conf.js rename to demo/e2e/protractor.conf.js diff --git a/e2e/src/app.e2e-spec.ts b/demo/e2e/src/app.e2e-spec.ts similarity index 100% rename from e2e/src/app.e2e-spec.ts rename to demo/e2e/src/app.e2e-spec.ts diff --git a/e2e/src/app.po.ts b/demo/e2e/src/app.po.ts similarity index 100% rename from e2e/src/app.po.ts rename to demo/e2e/src/app.po.ts diff --git a/e2e/tsconfig.json b/demo/e2e/tsconfig.json similarity index 83% rename from e2e/tsconfig.json rename to demo/e2e/tsconfig.json index 39b800f7..487654f5 100644 --- a/e2e/tsconfig.json +++ b/demo/e2e/tsconfig.json @@ -1,5 +1,5 @@ { - "extends": "../tsconfig.json", + "extends": "../../tsconfig.json", "compilerOptions": { "outDir": "../out-tsc/e2e", "module": "commonjs", diff --git a/karma.conf.js b/demo/karma.conf.js similarity index 93% rename from karma.conf.js rename to demo/karma.conf.js index 76a1db91..27da870e 100644 --- a/karma.conf.js +++ b/demo/karma.conf.js @@ -16,7 +16,7 @@ module.exports = function (config) { clearContext: false // leave Jasmine Spec Runner output visible in browser }, coverageIstanbulReporter: { - dir: require('path').join(__dirname, './coverage/ngx-editor'), + dir: require('path').join(__dirname, '../coverage/demo'), reports: ['html', 'lcovonly', 'text-summary'], fixWebpackSourcePaths: true }, diff --git a/src/app/app.component.html b/demo/src/app/app.component.html similarity index 92% rename from src/app/app.component.html rename to demo/src/app/app.component.html index ed49774c..0daa7f29 100644 --- a/src/app/app.component.html +++ b/demo/src/app/app.component.html @@ -2,7 +2,7 @@
diff --git a/src/app/app.component.scss b/demo/src/app/app.component.scss similarity index 100% rename from src/app/app.component.scss rename to demo/src/app/app.component.scss diff --git a/src/app/app.component.spec.ts b/demo/src/app/app.component.spec.ts similarity index 93% rename from src/app/app.component.spec.ts rename to demo/src/app/app.component.spec.ts index 1274bdcf..15d85b27 100644 --- a/src/app/app.component.spec.ts +++ b/demo/src/app/app.component.spec.ts @@ -1,9 +1,9 @@ import { TestBed, async, ComponentFixture } from '@angular/core/testing'; import { FormsModule } from '@angular/forms'; import { By } from '@angular/platform-browser'; +import { NgxEditorModule } from 'ngx-editor'; import { AppComponent } from './app.component'; -import { NgxEditorModule } from './ngx-editor/ngx-editor.module'; import { DebugElement } from '@angular/core'; describe('AppComponent', () => { diff --git a/src/app/app.component.ts b/demo/src/app/app.component.ts similarity index 100% rename from src/app/app.component.ts rename to demo/src/app/app.component.ts diff --git a/src/app/app.module.ts b/demo/src/app/app.module.ts similarity index 84% rename from src/app/app.module.ts rename to demo/src/app/app.module.ts index 4d561e0b..339c2ce3 100644 --- a/src/app/app.module.ts +++ b/demo/src/app/app.module.ts @@ -3,7 +3,7 @@ import { NgModule } from '@angular/core'; import { FormsModule } from '@angular/forms'; import { AppComponent } from './app.component'; -import { NgxEditorModule } from './ngx-editor/ngx-editor.module'; +import { NgxEditorModule } from '../../../src/lib/ngx-editor.module'; @NgModule({ declarations: [ diff --git a/src/assets/icons/ngx-editor.svg b/demo/src/assets/ngx-editor.svg similarity index 100% rename from src/assets/icons/ngx-editor.svg rename to demo/src/assets/ngx-editor.svg diff --git a/src/environments/environment.prod.ts b/demo/src/environments/environment.prod.ts similarity index 100% rename from src/environments/environment.prod.ts rename to demo/src/environments/environment.prod.ts diff --git a/src/environments/environment.ts b/demo/src/environments/environment.ts similarity index 100% rename from src/environments/environment.ts rename to demo/src/environments/environment.ts diff --git a/src/favicon.ico b/demo/src/favicon.ico similarity index 100% rename from src/favicon.ico rename to demo/src/favicon.ico diff --git a/src/index.html b/demo/src/index.html similarity index 100% rename from src/index.html rename to demo/src/index.html diff --git a/src/main.ts b/demo/src/main.ts similarity index 100% rename from src/main.ts rename to demo/src/main.ts diff --git a/src/polyfills.ts b/demo/src/polyfills.ts similarity index 100% rename from src/polyfills.ts rename to demo/src/polyfills.ts diff --git a/src/styles.scss b/demo/src/styles.scss similarity index 100% rename from src/styles.scss rename to demo/src/styles.scss diff --git a/demo/src/test.ts b/demo/src/test.ts new file mode 100644 index 00000000..50193eb0 --- /dev/null +++ b/demo/src/test.ts @@ -0,0 +1,25 @@ +// This file is required by karma.conf.js and loads recursively all the .spec and framework files + +import 'zone.js/dist/zone-testing'; +import { getTestBed } from '@angular/core/testing'; +import { + BrowserDynamicTestingModule, + platformBrowserDynamicTesting +} from '@angular/platform-browser-dynamic/testing'; + +declare const require: { + context(path: string, deep?: boolean, filter?: RegExp): { + keys(): string[]; + (id: string): T; + }; +}; + +// First, initialize the Angular testing environment. +getTestBed().initTestEnvironment( + BrowserDynamicTestingModule, + platformBrowserDynamicTesting() +); +// Then we find all the tests. +const context = require.context('./', true, /\.spec\.ts$/); +// And load the modules. +context.keys().map(context); diff --git a/tsconfig.app.json b/demo/tsconfig.app.json similarity index 69% rename from tsconfig.app.json rename to demo/tsconfig.app.json index f758d982..1a750b72 100644 --- a/tsconfig.app.json +++ b/demo/tsconfig.app.json @@ -1,7 +1,7 @@ { - "extends": "./tsconfig.json", + "extends": "../tsconfig.json", "compilerOptions": { - "outDir": "./out-tsc/app", + "outDir": "../out-tsc/app", "types": [] }, "files": [ diff --git a/tsconfig.spec.json b/demo/tsconfig.spec.json similarity index 75% rename from tsconfig.spec.json rename to demo/tsconfig.spec.json index 6400fde7..86d00b0b 100644 --- a/tsconfig.spec.json +++ b/demo/tsconfig.spec.json @@ -1,7 +1,7 @@ { - "extends": "./tsconfig.json", + "extends": "../tsconfig.json", "compilerOptions": { - "outDir": "./out-tsc/spec", + "outDir": "../out-tsc/spec", "types": [ "jasmine", "node" diff --git a/demo/tslint.json b/demo/tslint.json new file mode 100644 index 00000000..aa7c3eeb --- /dev/null +++ b/demo/tslint.json @@ -0,0 +1,17 @@ +{ + "extends": "../tslint.json", + "rules": { + "directive-selector": [ + true, + "attribute", + "app", + "camelCase" + ], + "component-selector": [ + true, + "element", + "app", + "kebab-case" + ] + } +} diff --git a/package-lock.json b/package-lock.json index e10ecc8e..03859288 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,8 +1,7 @@ { "name": "ngx-editor", - "version": "5.0.0-alpha", - "lockfileVersion": 1, "requires": true, + "lockfileVersion": 1, "dependencies": { "@angular-devkit/architect": { "version": "0.901.1", @@ -105,6 +104,50 @@ } } }, + "@angular-devkit/build-ng-packagr": { + "version": "0.901.2", + "resolved": "https://registry.npmjs.org/@angular-devkit/build-ng-packagr/-/build-ng-packagr-0.901.2.tgz", + "integrity": "sha512-EQ592DSpTsWWvjNbZEcu32JITRetjsjKYjb+ahc/gBdODredabyAaRkxgK5U9pox/HE8QSf3aYswhQq8qwqczw==", + "dev": true, + "requires": { + "@angular-devkit/architect": "0.901.2", + "rxjs": "6.5.4" + }, + "dependencies": { + "@angular-devkit/architect": { + "version": "0.901.2", + "resolved": "https://registry.npmjs.org/@angular-devkit/architect/-/architect-0.901.2.tgz", + "integrity": "sha512-0Tn/gMuls2CpizMdsjDvJNVKwrghitabiv4rs88MepBvxfopwqaNP5MD+WNGlnB8REgCfYEgA8JFLoLiCBpxaA==", + "dev": true, + "requires": { + "@angular-devkit/core": "9.1.2", + "rxjs": "6.5.4" + } + }, + "@angular-devkit/core": { + "version": "9.1.2", + "resolved": "https://registry.npmjs.org/@angular-devkit/core/-/core-9.1.2.tgz", + "integrity": "sha512-gOAu2cWcJSzFN1CZnLxJFxq2VucJ4AwIqiSDXaVXmJCJMUpQOGSGGcQwc0K/VHQTXB6TuO1m/zdT1VSmTP1LYA==", + "dev": true, + "requires": { + "ajv": "6.12.0", + "fast-json-stable-stringify": "2.1.0", + "magic-string": "0.25.7", + "rxjs": "6.5.4", + "source-map": "0.7.3" + } + }, + "rxjs": { + "version": "6.5.4", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.5.4.tgz", + "integrity": "sha512-naMQXcgEo3csAEGvw/NydRA0fuS2nDZJiw1YUWFKU7aPPAPGZEsD4Iimit96qwCieH6y614MCLYwdkrWx7z/7Q==", + "dev": true, + "requires": { + "tslib": "^1.9.0" + } + } + } + }, "@angular-devkit/build-optimizer": { "version": "0.901.1", "resolved": "https://registry.npmjs.org/@angular-devkit/build-optimizer/-/build-optimizer-0.901.1.tgz", diff --git a/package.json b/package.json index a408e22b..994a40a8 100644 --- a/package.json +++ b/package.json @@ -1,29 +1,27 @@ { "name": "ngx-editor", - "version": "5.0.0-alpha", - "description": "WYSIWYG Editor for Angular Applications", - "license": "MIT", - "repository": "https://github.com/sibiraj-s/ngx-editor.git", - "bugs": "https://github.com/sibiraj-s/ngx-editor/issues", - "homepage": "https://github.com/sibiraj-s/ngx-editor", + "private": true, "scripts": { - "build": "ng build --prod", - "build:package": "sh ./scripts/build.sh", + "build:demo": "ng build demo --prod", + "build:lib": "ng build ngx-editor --prod ", "build:docs": "compodoc", + "build": "npm run build:demo && npm run build:lib", "e2e": "ng e2e", "lint": "ng lint", "lint:scripts": "eslint ./scripts", "ng": "ng", "prebuild": "npm run lint", - "postbuild": "npm run build:package", "prepublishOnly": "node ./scripts/prepublish.js", "prerelease": "npm run build", "publish:docs": "npm run build:docs && node ./scripts/publishdocs.js", + "postbuild": "node ./scripts/postbuild.js", "release": "sh ./scripts/release.sh", - "start": "ng serve --aot --open --port 5002 --host 0.0.0.0", + "start:demo": "ng serve demo --aot --open --port 5002 --host 0.0.0.0", "serve:docs": "compodoc --serve --watch --open --output=\"docs/\"", - "test": "ng test --browsers ChromeHeadless --watch false", - "test:watch": "ng test" + "test:app": "ng test demo --browsers ChromeHeadless --watch false", + "test:package": "ng test ngx-editor --browsers ChromeHeadless --watch false", + "test": "npm run test:app && npm run test:package", + "watch:lib": "ng build ngx-editor --watch" }, "keywords": [ "angular-editor", @@ -49,6 +47,7 @@ }, "devDependencies": { "@angular-devkit/build-angular": "~0.901.1", + "@angular-devkit/build-ng-packagr": "~0.901.1", "@angular/animations": "~9.1.1", "@angular/cli": "~9.1.1", "@angular/common": "~9.1.1", diff --git a/public_api.ts b/public_api.ts deleted file mode 100644 index 8be99279..00000000 --- a/public_api.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './src/app/ngx-editor/ngx-editor.module'; diff --git a/scripts/build.sh b/scripts/build.sh deleted file mode 100644 index 22c484a5..00000000 --- a/scripts/build.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash - -# remove existing builds -rm -rf build/ -rm -rf dist/ - -# build -./node_modules/.bin/ng-packagr -p ng-package.json - -# delete unwanted folders -rm -rf .ng_build -rm -rf .ng_pkg_build diff --git a/scripts/postbuild.js b/scripts/postbuild.js new file mode 100644 index 00000000..a9ed8bbc --- /dev/null +++ b/scripts/postbuild.js @@ -0,0 +1,20 @@ +const fs = require('fs'); +const path = require('path'); + +const chalk = require('chalk'); + +async function copyFile(srcFilePath, destFilePath) { + const fileName = path.basename(srcFilePath); + try { + const srcPath = path.resolve(process.cwd(), srcFilePath); + const destPath = path.resolve(process.cwd(), 'dist/ngx-editor', destFilePath); + await fs.promises.copyFile(srcPath, destPath); + console.log(chalk.green(`- File Copied: ${fileName}`)); + } catch (err) { + console.log(chalk.red(`Error while copying ${fileName}`), err); + } +} + +copyFile('README.md', 'README.md'); +copyFile('CHANGELOG.md', 'CHANGELOG.md'); +copyFile('LICENSE', 'LICENSE'); diff --git a/scripts/release.sh b/scripts/release.sh index 598c594d..4fd78a58 100644 --- a/scripts/release.sh +++ b/scripts/release.sh @@ -1,4 +1,4 @@ #!/bin/bash # publish to npm -npm publish build/ +npm publish dist/ngx-editor/ diff --git a/src/assets/icons/ngx-editor-opt1/ang_edit1_128.ico b/sketch/ang_edit_128.ico similarity index 100% rename from src/assets/icons/ngx-editor-opt1/ang_edit1_128.ico rename to sketch/ang_edit_128.ico diff --git a/src/assets/icons/ngx-editor-opt1/ang_edit1_128.png b/sketch/ang_edit_128.png similarity index 100% rename from src/assets/icons/ngx-editor-opt1/ang_edit1_128.png rename to sketch/ang_edit_128.png diff --git a/src/assets/icons/ngx-editor-opt1/ang_edit1_256.ico b/sketch/ang_edit_256.ico similarity index 100% rename from src/assets/icons/ngx-editor-opt1/ang_edit1_256.ico rename to sketch/ang_edit_256.ico diff --git a/src/assets/icons/ngx-editor-opt1/ang_edit1_256.png b/sketch/ang_edit_256.png similarity index 100% rename from src/assets/icons/ngx-editor-opt1/ang_edit1_256.png rename to sketch/ang_edit_256.png diff --git a/src/assets/icons/ngx-editor-opt1/ang_edit1_32.png b/sketch/ang_edit_32.png similarity index 100% rename from src/assets/icons/ngx-editor-opt1/ang_edit1_32.png rename to sketch/ang_edit_32.png diff --git a/src/assets/icons/ngx-editor-opt1/ang_editv1_32_128.ico b/sketch/ang_edit_32_128.ico similarity index 100% rename from src/assets/icons/ngx-editor-opt1/ang_editv1_32_128.ico rename to sketch/ang_edit_32_128.ico diff --git a/src/assets/icons/ngx-editor-opt1/ang_editv1_32_256.ico b/sketch/ang_edit_32_256.ico similarity index 100% rename from src/assets/icons/ngx-editor-opt1/ang_editv1_32_256.ico rename to sketch/ang_edit_32_256.ico diff --git a/src/assets/icons/ngx-editor-opt1/ang_edit1_64.ico b/sketch/ang_edit_64.ico similarity index 100% rename from src/assets/icons/ngx-editor-opt1/ang_edit1_64.ico rename to sketch/ang_edit_64.ico diff --git a/src/assets/icons/ngx-editor-opt1/ang_edit1_64.png b/sketch/ang_edit_64.png similarity index 100% rename from src/assets/icons/ngx-editor-opt1/ang_edit1_64.png rename to sketch/ang_edit_64.png diff --git a/src/assets/icons/ngx-editor-opt1/ngx-editor1.gvdesign b/sketch/ngx-editor.gvdesign similarity index 100% rename from src/assets/icons/ngx-editor-opt1/ngx-editor1.gvdesign rename to sketch/ngx-editor.gvdesign diff --git a/src/assets/icons/ngx-editor.png b/sketch/ngx-editor.png similarity index 100% rename from src/assets/icons/ngx-editor.png rename to sketch/ngx-editor.png diff --git a/src/assets/icons/ngx-editor-opt1/ngx-editor1.svg b/sketch/ngx-editor.svg similarity index 100% rename from src/assets/icons/ngx-editor-opt1/ngx-editor1.svg rename to sketch/ngx-editor.svg diff --git a/src/assets/icons/ngx-editor-opt1/ngx-editor1_64x64.ico b/sketch/ngx-editor_64x64.ico similarity index 100% rename from src/assets/icons/ngx-editor-opt1/ngx-editor1_64x64.ico rename to sketch/ngx-editor_64x64.ico diff --git a/src/assets/icons/ngx-editor-opt1/ngx-editor1.png b/src/assets/icons/ngx-editor-opt1/ngx-editor1.png deleted file mode 100644 index 0899b254..00000000 Binary files a/src/assets/icons/ngx-editor-opt1/ngx-editor1.png and /dev/null differ diff --git a/src/assets/icons/ngx-editor-opt2/ang_editv4_128.ico b/src/assets/icons/ngx-editor-opt2/ang_editv4_128.ico deleted file mode 100644 index bf0929bf..00000000 Binary files a/src/assets/icons/ngx-editor-opt2/ang_editv4_128.ico and /dev/null differ diff --git a/src/assets/icons/ngx-editor-opt2/ang_editv4_128.png b/src/assets/icons/ngx-editor-opt2/ang_editv4_128.png deleted file mode 100644 index fa35bb49..00000000 Binary files a/src/assets/icons/ngx-editor-opt2/ang_editv4_128.png and /dev/null differ diff --git a/src/assets/icons/ngx-editor-opt2/ang_editv4_256.ico b/src/assets/icons/ngx-editor-opt2/ang_editv4_256.ico deleted file mode 100644 index dbecc042..00000000 Binary files a/src/assets/icons/ngx-editor-opt2/ang_editv4_256.ico and /dev/null differ diff --git a/src/assets/icons/ngx-editor-opt2/ang_editv4_256.png b/src/assets/icons/ngx-editor-opt2/ang_editv4_256.png deleted file mode 100644 index 5142888c..00000000 Binary files a/src/assets/icons/ngx-editor-opt2/ang_editv4_256.png and /dev/null differ diff --git a/src/assets/icons/ngx-editor-opt2/ang_editv4_32.ico b/src/assets/icons/ngx-editor-opt2/ang_editv4_32.ico deleted file mode 100644 index 77ee540e..00000000 Binary files a/src/assets/icons/ngx-editor-opt2/ang_editv4_32.ico and /dev/null differ diff --git a/src/assets/icons/ngx-editor-opt2/ang_editv4_32.png b/src/assets/icons/ngx-editor-opt2/ang_editv4_32.png deleted file mode 100644 index fdf487fb..00000000 Binary files a/src/assets/icons/ngx-editor-opt2/ang_editv4_32.png and /dev/null differ diff --git a/src/assets/icons/ngx-editor-opt2/ang_editv4_32_128.ico b/src/assets/icons/ngx-editor-opt2/ang_editv4_32_128.ico deleted file mode 100644 index 8b834ee0..00000000 Binary files a/src/assets/icons/ngx-editor-opt2/ang_editv4_32_128.ico and /dev/null differ diff --git a/src/assets/icons/ngx-editor-opt2/ang_editv4_32_256.ico b/src/assets/icons/ngx-editor-opt2/ang_editv4_32_256.ico deleted file mode 100644 index f8cde379..00000000 Binary files a/src/assets/icons/ngx-editor-opt2/ang_editv4_32_256.ico and /dev/null differ diff --git a/src/assets/icons/ngx-editor-opt2/ang_editv4_64.ico b/src/assets/icons/ngx-editor-opt2/ang_editv4_64.ico deleted file mode 100644 index ff2090e8..00000000 Binary files a/src/assets/icons/ngx-editor-opt2/ang_editv4_64.ico and /dev/null differ diff --git a/src/assets/icons/ngx-editor-opt2/ang_editv4_64.png b/src/assets/icons/ngx-editor-opt2/ang_editv4_64.png deleted file mode 100644 index e5745abe..00000000 Binary files a/src/assets/icons/ngx-editor-opt2/ang_editv4_64.png and /dev/null differ diff --git a/src/assets/icons/ngx-editor-opt2/ngx-editor2.gvdesign b/src/assets/icons/ngx-editor-opt2/ngx-editor2.gvdesign deleted file mode 100644 index 474dbfae..00000000 Binary files a/src/assets/icons/ngx-editor-opt2/ngx-editor2.gvdesign and /dev/null differ diff --git a/src/assets/icons/ngx-editor-opt2/ngx-editor2.png b/src/assets/icons/ngx-editor-opt2/ngx-editor2.png deleted file mode 100644 index 65935573..00000000 Binary files a/src/assets/icons/ngx-editor-opt2/ngx-editor2.png and /dev/null differ diff --git a/src/assets/icons/ngx-editor-opt2/ngx-editor2.svg b/src/assets/icons/ngx-editor-opt2/ngx-editor2.svg deleted file mode 100644 index 439e19ab..00000000 --- a/src/assets/icons/ngx-editor-opt2/ngx-editor2.svg +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - - - - - - - diff --git a/src/assets/icons/ngx-editor-opt2/ngx-editor2_64x64.ico b/src/assets/icons/ngx-editor-opt2/ngx-editor2_64x64.ico deleted file mode 100644 index 48c207ba..00000000 Binary files a/src/assets/icons/ngx-editor-opt2/ngx-editor2_64x64.ico and /dev/null differ diff --git a/src/assets/styles/_buttons.scss b/src/assets/styles/_buttons.scss deleted file mode 100644 index 59f568a0..00000000 --- a/src/assets/styles/_buttons.scss +++ /dev/null @@ -1,49 +0,0 @@ -::ng-deep .ngxePopover { - .btn { - display: inline-block; - font-weight: 400; - text-align: center; - white-space: nowrap; - vertical-align: middle; - -webkit-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - user-select: none; - border: 1px solid transparent; - padding: 0.375rem 0.75rem; - font-size: 1rem; - line-height: 1.5; - border-radius: 0.25rem; - transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out, - border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out; - - &.btn-sm { - padding: 0.25rem 0.5rem; - font-size: 0.875rem; - line-height: 1.5; - border-radius: 0.2rem; - } - - &:active, - &:focus { - outline: none; - box-shadow: none; - } - - &.btn-primary { - color: #fff; - background-color: #007bff; - border-color: #007bff; - - &:hover { - color: #fff; - background-color: #0069d9; - border-color: #0062cc; - } - } - - &:not(:disabled):not(.disabled) { - cursor: pointer; - } - } -} diff --git a/src/assets/styles/_forms.scss b/src/assets/styles/_forms.scss deleted file mode 100644 index 62c0dd08..00000000 --- a/src/assets/styles/_forms.scss +++ /dev/null @@ -1,53 +0,0 @@ -::ng-deep .ngxePopover { - form { - .form-group { - margin-bottom: 1rem; - - input { - overflow: visible; - } - - .form-control-sm { - width: 100%; - outline: none; - border: none; - border-bottom: solid 1px #bdbdbd; - border-radius: 0; - margin-bottom: 1px; - padding: 0.25rem 0.5rem; - font-size: 0.875rem; - line-height: 1.5; - } - - &.row { - display: flex; - flex-wrap: wrap; - margin-left: 0; - margin-right: 0; - - .col { - flex-basis: 0; - flex-grow: 1; - max-width: 100%; - padding: 0; - - &:first-child { - padding-right: 15px; - } - } - } - } - - .form-check { - position: relative; - display: block; - padding-left: 1.25rem; - - .form-check-input { - position: absolute; - margin-top: 0.3rem; - margin-left: -1.25rem; - } - } - } -} diff --git a/src/assets/styles/_popover.scss b/src/assets/styles/_popover.scss deleted file mode 100644 index 2ec545db..00000000 --- a/src/assets/styles/_popover.scss +++ /dev/null @@ -1,198 +0,0 @@ -::ng-deep .ngxePopover { - &.popover { - position: absolute; - top: 0; - left: 0; - z-index: 1060; - display: block; - max-width: 276px; - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, - "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", - "Segoe UI Symbol"; - font-style: normal; - font-weight: 400; - line-height: 1.5; - text-align: left; - text-align: start; - text-decoration: none; - text-shadow: none; - text-transform: none; - letter-spacing: normal; - word-break: normal; - word-spacing: normal; - white-space: normal; - line-break: auto; - font-size: 0.875rem; - word-wrap: break-word; - background-color: #fff; - background-clip: padding-box; - border: 1px solid rgba(0, 0, 0, 0.2); - border-radius: 0.3rem; - - .arrow { - position: absolute; - display: block; - width: 1rem; - height: 0.5rem; - margin: 0 0.3rem; - - &::before, - &::after { - position: absolute; - display: block; - content: ""; - border-color: transparent; - border-style: solid; - } - } - - .popover-header { - padding: 0.5rem 0.75rem; - margin-bottom: 0; - font-size: 1rem; - color: inherit; - background-color: #f7f7f7; - border-bottom: 1px solid #ebebeb; - border-top-left-radius: calc(0.3rem - 1px); - border-top-right-radius: calc(0.3rem - 1px); - - &:empty { - display: none; - } - } - - .popover-body { - padding: 0.5rem 0.75rem; - color: #212529; - } - - &.bs-popover-top { - margin-bottom: 0.5rem; - - .arrow { - bottom: calc((0.5rem + 1px) * -1); - } - - .arrow::before, - .arrow::after { - border-width: 0.5rem 0.5rem 0; - } - - .arrow::before { - bottom: 0; - border-top-color: rgba(0, 0, 0, 0.25); - } - - .arrow::after { - bottom: 1px; - border-top-color: #fff; - } - } - - &.bs-popover-right { - margin-left: 0.5rem; - - .arrow { - left: calc((0.5rem + 1px) * -1); - width: 0.5rem; - height: 1rem; - margin: 0.3rem 0; - } - - .arrow::before, - .arrow::after { - border-width: 0.5rem 0.5rem 0.5rem 0; - } - - .arrow::before { - left: 0; - border-right-color: rgba(0, 0, 0, 0.25); - } - - .arrow::after { - left: 1px; - border-right-color: #fff; - } - } - - &.bs-popover-bottom { - margin-top: 0.5rem; - - .arrow { - left: 45% !important; - top: calc((0.5rem + 1px) * -1); - } - - .arrow::before, - .arrow::after { - border-width: 0 0.5rem 0.5rem 0.5rem; - } - - .arrow::before { - top: 0; - border-bottom-color: rgba(0, 0, 0, 0.25); - } - - .arrow::after { - top: 1px; - border-bottom-color: #fff; - } - - // This will remove the popover-header's border just below the arrow - .popover-header::before { - position: absolute; - top: 0; - left: 50%; - display: block; - width: 1rem; - margin-left: -0.5rem; - content: ""; - border-bottom: 1px solid #f7f7f7; - } - } - - &.bs-popover-left { - margin-right: 0.5rem; - - .arrow { - right: calc((0.5rem + 1px) * -1); - width: 0.5rem; - height: 1rem; - margin: 0.3rem 0; - } - - .arrow::before, - .arrow::after { - border-width: 0.5rem 0 0.5rem 0.5rem; - } - - .arrow::before { - right: 0; - border-left-color: rgba(0, 0, 0, 0.25); - } - - .arrow::after { - right: 1px; - border-left-color: #fff; - } - } - - &.bs-popover-auto { - &[x-placement^="top"] { - @extend .bs-popover-top; - } - - &[x-placement^="right"] { - @extend .bs-popover-right; - } - - &[x-placement^="bottom"] { - @extend .bs-popover-bottom; - } - - &[x-placement^="left"] { - @extend .bs-popover-left; - } - } - } -} diff --git a/src/karma.conf.js b/src/karma.conf.js new file mode 100644 index 00000000..81928a7f --- /dev/null +++ b/src/karma.conf.js @@ -0,0 +1,32 @@ +// Karma configuration file, see link for more information +// https://karma-runner.github.io/1.0/config/configuration-file.html + +module.exports = function (config) { + config.set({ + basePath: '', + frameworks: ['jasmine', '@angular-devkit/build-angular'], + plugins: [ + require('karma-jasmine'), + require('karma-chrome-launcher'), + require('karma-jasmine-html-reporter'), + require('karma-coverage-istanbul-reporter'), + require('@angular-devkit/build-angular/plugins/karma') + ], + client: { + clearContext: false // leave Jasmine Spec Runner output visible in browser + }, + coverageIstanbulReporter: { + dir: require('path').join(__dirname, '../../coverage/ngx-editor'), + reports: ['html', 'lcovonly', 'text-summary'], + fixWebpackSourcePaths: true + }, + reporters: ['progress', 'kjhtml'], + port: 9876, + colors: true, + logLevel: config.LOG_INFO, + autoWatch: true, + browsers: ['Chrome'], + singleRun: false, + restartOnFileChange: true + }); +}; diff --git a/src/app/ngx-editor/ngx-editor.component.html b/src/lib/ngx-editor.component.html similarity index 100% rename from src/app/ngx-editor/ngx-editor.component.html rename to src/lib/ngx-editor.component.html diff --git a/src/app/ngx-editor/ngx-editor.component.scss b/src/lib/ngx-editor.component.scss similarity index 100% rename from src/app/ngx-editor/ngx-editor.component.scss rename to src/lib/ngx-editor.component.scss diff --git a/src/app/ngx-editor/ngx-editor.component.spec.ts b/src/lib/ngx-editor.component.spec.ts similarity index 100% rename from src/app/ngx-editor/ngx-editor.component.spec.ts rename to src/lib/ngx-editor.component.spec.ts diff --git a/src/app/ngx-editor/ngx-editor.component.ts b/src/lib/ngx-editor.component.ts similarity index 100% rename from src/app/ngx-editor/ngx-editor.component.ts rename to src/lib/ngx-editor.component.ts diff --git a/src/app/ngx-editor/ngx-editor.module.ts b/src/lib/ngx-editor.module.ts similarity index 100% rename from src/app/ngx-editor/ngx-editor.module.ts rename to src/lib/ngx-editor.module.ts diff --git a/src/app/ngx-editor/plugins/menu/MenuBarView.ts b/src/lib/plugins/menu/MenuBarView.ts similarity index 100% rename from src/app/ngx-editor/plugins/menu/MenuBarView.ts rename to src/lib/plugins/menu/MenuBarView.ts diff --git a/src/app/ngx-editor/plugins/menu/constants.ts b/src/lib/plugins/menu/constants.ts similarity index 100% rename from src/app/ngx-editor/plugins/menu/constants.ts rename to src/lib/plugins/menu/constants.ts diff --git a/src/app/ngx-editor/plugins/menu/getMenu.ts b/src/lib/plugins/menu/getMenu.ts similarity index 100% rename from src/app/ngx-editor/plugins/menu/getMenu.ts rename to src/lib/plugins/menu/getMenu.ts diff --git a/src/app/ngx-editor/plugins/menu/index.ts b/src/lib/plugins/menu/index.ts similarity index 100% rename from src/app/ngx-editor/plugins/menu/index.ts rename to src/lib/plugins/menu/index.ts diff --git a/src/app/ngx-editor/plugins/menu/menu.ts b/src/lib/plugins/menu/menu.ts similarity index 100% rename from src/app/ngx-editor/plugins/menu/menu.ts rename to src/lib/plugins/menu/menu.ts diff --git a/src/app/ngx-editor/plugins/placeholder.ts b/src/lib/plugins/placeholder.ts similarity index 100% rename from src/app/ngx-editor/plugins/placeholder.ts rename to src/lib/plugins/placeholder.ts diff --git a/src/app/ngx-editor/types.ts b/src/lib/types.ts similarity index 100% rename from src/app/ngx-editor/types.ts rename to src/lib/types.ts diff --git a/src/app/ngx-editor/utils/computeOptions.ts b/src/lib/utils/computeOptions.ts similarity index 100% rename from src/app/ngx-editor/utils/computeOptions.ts rename to src/lib/utils/computeOptions.ts diff --git a/src/app/ngx-editor/utils/icons/bold.ts b/src/lib/utils/icons/bold.ts similarity index 100% rename from src/app/ngx-editor/utils/icons/bold.ts rename to src/lib/utils/icons/bold.ts diff --git a/src/app/ngx-editor/utils/icons/code.ts b/src/lib/utils/icons/code.ts similarity index 100% rename from src/app/ngx-editor/utils/icons/code.ts rename to src/lib/utils/icons/code.ts diff --git a/src/app/ngx-editor/utils/icons/index.ts b/src/lib/utils/icons/index.ts similarity index 100% rename from src/app/ngx-editor/utils/icons/index.ts rename to src/lib/utils/icons/index.ts diff --git a/src/app/ngx-editor/utils/icons/italic.ts b/src/lib/utils/icons/italic.ts similarity index 100% rename from src/app/ngx-editor/utils/icons/italic.ts rename to src/lib/utils/icons/italic.ts diff --git a/src/app/ngx-editor/utils/plugins.ts b/src/lib/utils/plugins.ts similarity index 100% rename from src/app/ngx-editor/utils/plugins.ts rename to src/lib/utils/plugins.ts diff --git a/ng-package.json b/src/ng-package.json similarity index 76% rename from ng-package.json rename to src/ng-package.json index 14c8d826..19c5d93f 100644 --- a/ng-package.json +++ b/src/ng-package.json @@ -1,8 +1,8 @@ { - "$schema": "./node_modules/ng-packagr/ng-package.schema.json", - "dest": "./build/", + "$schema": "../node_modules/ng-packagr/ng-package.schema.json", + "dest": "../dist/ngx-editor", "lib": { - "entryFile": "./public_api.ts", + "entryFile": "./public-api.ts", "umdModuleIds": { "prosemirror-state": "prosemirrorState", "prosemirror-view": "prosemirrorView", diff --git a/src/package.json b/src/package.json new file mode 100644 index 00000000..45fea20a --- /dev/null +++ b/src/package.json @@ -0,0 +1,31 @@ +{ + "name": "ngx-editor", + "version": "5.0.0-alpha", + "description": "WYSIWYG Editor for Angular Applications", + "license": "MIT", + "repository": "https://github.com/sibiraj-s/ngx-editor.git", + "bugs": "https://github.com/sibiraj-s/ngx-editor/issues", + "homepage": "https://github.com/sibiraj-s/ngx-editor", + "keywords": [ + "angular-editor", + "angular-wysiwyg-editor", + "wysiwyg-editor", + "ngx-editor", + "prosemirror" + ], + "peerDependencies": { + "@angular/common": "^9.0.0", + "@angular/core": "^9.0.0", + "@angular/forms": "^9.0.0", + "prosemirror-commands": "^1.1.0", + "prosemirror-history": "^1.1.0", + "prosemirror-keymap": "^1.1.0", + "prosemirror-schema-basic": "^1.1.0", + "prosemirror-state": "^1.3.0", + "prosemirror-view": "^1.14.0", + "tslib": "^1.10.0" + }, + "dependencies": { + "classnames": "^2.2.6" + } +} diff --git a/src/public-api.ts b/src/public-api.ts new file mode 100644 index 00000000..46b6038c --- /dev/null +++ b/src/public-api.ts @@ -0,0 +1,6 @@ +/* + * Public API Surface of ngx-editor + */ + +export * from './lib/ngx-editor.component'; +export * from './lib/ngx-editor.module'; diff --git a/src/test.ts b/src/test.ts index 50193eb0..303b32a2 100644 --- a/src/test.ts +++ b/src/test.ts @@ -1,5 +1,6 @@ // This file is required by karma.conf.js and loads recursively all the .spec and framework files +import 'zone.js/dist/zone'; import 'zone.js/dist/zone-testing'; import { getTestBed } from '@angular/core/testing'; import { diff --git a/src/tsconfig.lib.json b/src/tsconfig.lib.json new file mode 100644 index 00000000..ce8091c2 --- /dev/null +++ b/src/tsconfig.lib.json @@ -0,0 +1,23 @@ +{ + "extends": "../tsconfig.json", + "compilerOptions": { + "outDir": "../../out-tsc/lib", + "target": "es2015", + "declaration": true, + "inlineSources": true, + "types": [], + "lib": [ + "dom", + "es2018" + ] + }, + "angularCompilerOptions": { + "skipTemplateCodegen": true, + "strictMetadataEmit": true, + "enableResourceInlining": true + }, + "exclude": [ + "test.ts", + "**/*.spec.ts" + ] +} diff --git a/src/tsconfig.lib.prod.json b/src/tsconfig.lib.prod.json new file mode 100644 index 00000000..cbae7942 --- /dev/null +++ b/src/tsconfig.lib.prod.json @@ -0,0 +1,6 @@ +{ + "extends": "./tsconfig.lib.json", + "angularCompilerOptions": { + "enableIvy": false + } +} diff --git a/src/tsconfig.spec.json b/src/tsconfig.spec.json new file mode 100644 index 00000000..c1645db5 --- /dev/null +++ b/src/tsconfig.spec.json @@ -0,0 +1,17 @@ +{ + "extends": "../tsconfig.json", + "compilerOptions": { + "outDir": "../../out-tsc/spec", + "types": [ + "jasmine", + "node" + ] + }, + "files": [ + "test.ts" + ], + "include": [ + "**/*.spec.ts", + "**/*.d.ts" + ] +} diff --git a/src/tslint.json b/src/tslint.json new file mode 100644 index 00000000..60402b17 --- /dev/null +++ b/src/tslint.json @@ -0,0 +1,17 @@ +{ + "extends": "../tslint.json", + "rules": { + "directive-selector": [ + true, + "attribute", + "", + "camelCase" + ], + "component-selector": [ + true, + "element", + "", + "kebab-case" + ] + } +} diff --git a/tsconfig.json b/tsconfig.json index 8c4ef3bb..1947d33a 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -14,7 +14,13 @@ "lib": [ "es2018", "dom" - ] + ], + "paths": { + "ngx-editor": [ + "dist/ngx-editor/ngx-editor", + "dist/ngx-editor" + ] + } }, "angularCompilerOptions": { "fullTemplateTypeCheck": true, diff --git a/tslint.json b/tslint.json index b3edbede..def88d1c 100644 --- a/tslint.json +++ b/tslint.json @@ -1,5 +1,8 @@ { "extends": "tslint:recommended", + "rulesDirectory": [ + "codelyzer" + ], "rules": { "align": { "options": [ @@ -13,21 +16,6 @@ "deprecation": { "severity": "warning" }, - "component-class-suffix": true, - "contextual-lifecycle": true, - "directive-class-suffix": true, - "directive-selector": [ - true, - "attribute", - "", - "camelCase" - ], - "component-selector": [ - true, - "element", - "", - "kebab-case" - ], "eofline": true, "import-blacklist": [ true, @@ -129,6 +117,9 @@ "check-typecast" ] }, + "component-class-suffix": true, + "contextual-lifecycle": true, + "directive-class-suffix": true, "no-conflicting-lifecycle": true, "no-host-metadata-property": true, "no-input-rename": true, @@ -141,8 +132,5 @@ "template-no-negated-async": true, "use-lifecycle-interface": true, "use-pipe-transform-interface": true - }, - "rulesDirectory": [ - "codelyzer" - ] + } } diff --git a/extras/docs/colors.md b/wiki/docs/colors.md similarity index 100% rename from extras/docs/colors.md rename to wiki/docs/colors.md diff --git a/extras/docs/configuartion.md b/wiki/docs/configuartion.md similarity index 100% rename from extras/docs/configuartion.md rename to wiki/docs/configuartion.md diff --git a/extras/docs/errors.md b/wiki/docs/errors.md similarity index 100% rename from extras/docs/errors.md rename to wiki/docs/errors.md diff --git a/extras/docs/font-size.md b/wiki/docs/font-size.md similarity index 100% rename from extras/docs/font-size.md rename to wiki/docs/font-size.md diff --git a/extras/docs/image-uploader.md b/wiki/docs/image-uploader.md similarity index 100% rename from extras/docs/image-uploader.md rename to wiki/docs/image-uploader.md diff --git a/extras/docs/prerequisites.md b/wiki/docs/prerequisites.md similarity index 100% rename from extras/docs/prerequisites.md rename to wiki/docs/prerequisites.md diff --git a/extras/docs/resizer.md b/wiki/docs/resizer.md similarity index 100% rename from extras/docs/resizer.md rename to wiki/docs/resizer.md diff --git a/extras/docs/toolbar.md b/wiki/docs/toolbar.md similarity index 100% rename from extras/docs/toolbar.md rename to wiki/docs/toolbar.md diff --git a/extras/docs/video.md b/wiki/docs/video.md similarity index 100% rename from extras/docs/video.md rename to wiki/docs/video.md diff --git a/extras/summary.json b/wiki/summary.json similarity index 100% rename from extras/summary.json rename to wiki/summary.json