diff --git a/.browserslistrc b/.browserslistrc new file mode 100644 index 0000000..8084853 --- /dev/null +++ b/.browserslistrc @@ -0,0 +1,12 @@ +# This file is used by the build system to adjust CSS and JS output to support the specified browsers below. +# For additional information regarding the format and rule options, please see: +# https://github.com/browserslist/browserslist#queries + +# You can see what browsers were selected by your queries by running: +# npx browserslist + +> 0.5% +last 2 versions +Firefox ESR +not dead +not IE 9-11 # For IE 9-11 support, remove 'not'. \ No newline at end of file diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..b55e994 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,18 @@ +# http://editorconfig.org +root = true + +[*] +charset = utf-8 +end_of_line = lf +indent_style = space +indent_size = 4 +insert_final_newline = false +trim_trailing_whitespace = true + +[*] +indent_style = space +indent_size = 2 + +[*.md] +max_line_length = 0 +trim_trailing_whitespace = false diff --git a/.eslintrc.json b/.eslintrc.json new file mode 100644 index 0000000..f962005 --- /dev/null +++ b/.eslintrc.json @@ -0,0 +1,51 @@ +{ + "root": true, + "ignorePatterns": [ + "projects/**/*" + ], + "overrides": [ + { + "files": [ + "*.ts" + ], + "parserOptions": { + "project": [ + "tsconfig.json" + ], + "createDefaultProgram": true + }, + "extends": [ + "plugin:@angular-eslint/recommended", + "plugin:@angular-eslint/template/process-inline-templates" + ], + "rules": { + "@angular-eslint/directive-selector": [ + "error", + { + "type": "attribute", + "prefix": "app", + "style": "camelCase" + } + ], + "@angular-eslint/component-selector": [ + "error", + { + "type": "element", + "style": "kebab-case" + } + ], + "@angular-eslint/no-output-on-prefix": 0, + "@angular-eslint/no-output-rename": 0 + } + }, + { + "files": [ + "*.html" + ], + "extends": [ + "plugin:@angular-eslint/template/recommended" + ], + "rules": {} + } + ] +} diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index bdb0cab..0000000 --- a/.gitattributes +++ /dev/null @@ -1,17 +0,0 @@ -# Auto detect text files and perform LF normalization -* text=auto - -# Custom for Visual Studio -*.cs diff=csharp - -# Standard to msysgit -*.doc diff=astextplain -*.DOC diff=astextplain -*.docx diff=astextplain -*.DOCX diff=astextplain -*.dot diff=astextplain -*.DOT diff=astextplain -*.pdf diff=astextplain -*.PDF diff=astextplain -*.rtf diff=astextplain -*.RTF diff=astextplain diff --git a/.github/CODE_OF_CONDUCT.md b/.github/CODE_OF_CONDUCT.md new file mode 100644 index 0000000..79323f9 --- /dev/null +++ b/.github/CODE_OF_CONDUCT.md @@ -0,0 +1,76 @@ +# Angular-Markdown-Editor Code of Conduct + +## Our Pledge + +In the interest of fostering an open and welcoming environment, we as +contributors and maintainers pledge to making participation in our project and +our community a harassment-free experience for everyone, regardless of age, body +size, disability, ethnicity, sex characteristics, gender identity and expression, +level of experience, education, socio-economic status, nationality, personal +appearance, race, religion, or sexual identity and orientation. + +## Our Standards + +Examples of behavior that contributes to creating a positive environment +include: + +* Using welcoming and inclusive language +* Being respectful of differing viewpoints and experiences +* Gracefully accepting constructive criticism +* Focusing on what is best for the community +* Showing empathy towards other community members + +Examples of unacceptable behavior by participants include: + +* The use of sexualized language or imagery and unwelcome sexual attention or + advances +* Trolling, insulting/derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or electronic + address, without explicit permission +* Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Our Responsibilities + +Project maintainers are responsible for clarifying the standards of acceptable +behavior and are expected to take appropriate and fair corrective action in +response to any instances of unacceptable behavior. + +Project maintainers have the right and responsibility to remove, edit, or +reject comments, commits, code, wiki edits, issues, and other contributions +that are not aligned to this Code of Conduct, or to ban temporarily or +permanently any contributor for other behaviors that they deem inappropriate, +threatening, offensive, or harmful. + +## Scope + +This Code of Conduct applies within all project spaces, and it also applies when +an individual is representing the project or its community in public spaces. +Examples of representing a project or community include using an official +project e-mail address, posting via an official social media account, or acting +as an appointed representative at an online or offline event. Representation of +a project may be further defined and clarified by project maintainers. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported by contacting the project team. All +complaints will be reviewed and investigated and will result in a response that +is deemed necessary and appropriate to the circumstances. The project team is +obligated to maintain confidentiality with regard to the reporter of an incident. +Further details of specific enforcement policies may be posted separately. + +Project maintainers who do not follow or enforce the Code of Conduct in good +faith may face temporary or permanent repercussions as determined by other +members of the project's leadership. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, +available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html + +[homepage]: https://www.contributor-covenant.org + +For answers to common questions about this code of conduct, see +https://www.contributor-covenant.org/faq diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 0000000..0589766 --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1,8 @@ +# These are supported funding model platforms + +github: ghiscoding +patreon: # Replace with a single Patreon username +open_collective: # Replace with a single Open Collective username +ko_fi: ghiscoding +tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel +custom: # Replace with a single custom sponsorship URL diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml new file mode 100644 index 0000000..bee9b56 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -0,0 +1,54 @@ +name: 🐞 Bug report +description: Report an issue with Angular-Markdown-Editor +labels: [pending triage] +body: + - type: markdown + attributes: + value: | + Thanks for taking the time to fill out this bug report! + - type: textarea + id: bug-description + attributes: + label: Describe the bug + description: A clear and concise description of what the bug is. If you intend to submit a PR for this issue, tell us in the description. Thanks! + placeholder: Bug description + validations: + required: true + - type: textarea + id: reproduction + attributes: + label: Reproduction + description: Please provide a way to reproduce the problem you ran into. A [minimal reproduction](https://stackoverflow.com/help/minimal-reproducible-example) would be nice unless you are absolutely sure that the issue is obvious and the provided information is enough to understand the problem. + placeholder: Reproduction + validations: + required: true + - type: textarea + id: system-info + attributes: + label: Environment Info + description: versions number of each systems and libs (Angular, Angular-Markdown-Editor, TypeScript) + render: shell + placeholder: | + Angular (x.y) + Angular-Markdown-Editor (x.y) + TypeScript (x.y) + Browser(s) + System OS + validations: + required: true + - type: checkboxes + id: checkboxes + attributes: + label: Validations + description: Before submitting the issue, please make sure you do the following + options: + - label: Follow our [Code of Conduct](https://github.com/ghiscoding/angular-markdown-editor/blob/master/.github/CODE_OF_CONDUCT.md) + required: true + - label: Read the [HOWTO - Step by Step](https://github.com/ghiscoding/angular-markdown-editor/wiki/HOWTO---Step-by-Step). + required: true + - label: Check that there isn't [already an issue](https://github.com/ghiscoding/angular-markdown-editor/issues) that reports the same bug to avoid creating a duplicate. + required: true + - label: Check that this is a concrete bug. For Q&A open a [GitHub Discussion](https://github.com/ghiscoding/angular-markdown-editor/discussions). + required: true + - label: The provided reproduction is a [minimal reproducible example](https://stackoverflow.com/help/minimal-reproducible-example) of the bug. + required: true \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 0000000..289dd24 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1,5 @@ +blank_issues_enabled: false +contact_links: + - name: Questions & Discussions + url: https://github.com/ghiscoding/angular-markdown-editor/discussions + about: Use GitHub discussions for message-board style questions and discussions. \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.yml new file mode 100644 index 0000000..774e8e0 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.yml @@ -0,0 +1,44 @@ +name: 🚀 New feature proposal +description: Propose a new feature to be added to Angular-Markdown-Editor +labels: ['enhancement: pending triage'] +body: + - type: markdown + attributes: + value: | + Thanks for your interest in the project and taking the time to fill out this feature report! + - type: textarea + id: feature-description + attributes: + label: Clear and concise description of the problem + description: 'As a developer using Angular-Markdown-Editor I want [goal / wish] so that [benefit]. If you intend to submit a PR for this issue, tell us in the description. Thanks!' + validations: + required: true + - type: textarea + id: suggested-solution + attributes: + label: Suggested solution + description: We could provide following implementation... + validations: + required: true + - type: textarea + id: alternative + attributes: + label: Alternative + description: Clear and concise description of any alternative solutions or features you've considered. + - type: textarea + id: additional-context + attributes: + label: Additional context + description: Any other context or screenshots about the feature request here. + - type: checkboxes + id: checkboxes + attributes: + label: Validations + description: Before submitting the issue, please make sure you do the following + options: + - label: Follow our [Code of Conduct](https://github.com/ghiscoding/angular-markdown-editor/blob/master/.github/CODE_OF_CONDUCT.md) + required: true + - label: Read the [HOWTO - Step by Step](https://github.com/ghiscoding/angular-markdown-editor/wiki/HOWTO---Step-by-Step). + required: true + - label: Check that there isn't already an issue that request the same feature to avoid creating a duplicate. + required: true \ No newline at end of file diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..68f93ef --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,57 @@ +name: GitHub Actions +on: + # Trigger the workflow on push or pull request, + # but only for the master branch on Push and any branches on PR + push: + branches: + - master + pull_request: + branches: + - '**' +env: + CI: true + PREFERRED_WORKSPACE_MANAGER: yarn + +jobs: + run: + name: Node ${{ matrix.node }} + runs-on: ubuntu-latest + + strategy: + fail-fast: false + matrix: + node: [20] + + steps: + - name: Clone repository + uses: actions/checkout@v4 + with: + fetch-depth: 3 + + - uses: actions/cache@v4 + with: + path: ~/.cache/yarn + key: ${{ runner.os }}-node-${{ hashFiles('**/yarn.lock') }} + restore-keys: | + ${{ runner.os }}-node- + - name: Set Node.js version + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node }} + + - run: node --version + - run: npm --version + + - name: Install npm/yarn dependencies + run: yarn install + + - name: Website Prod Build (GitHub demo site) + run: yarn build:demo + + # always deploy (re-publish) GitHub demo page with a Prod build + - name: Deploy to gh-pages + uses: peaceiris/actions-gh-pages@v4 + if: github.ref == 'refs/heads/master' + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./docs diff --git a/.gitignore b/.gitignore index 529be99..207b2bb 100644 --- a/.gitignore +++ b/.gitignore @@ -1,226 +1,59 @@ -################# -## bower Package -################# -bower_components/ +# See http://help.github.com/ignore-files/ for more about ignoring files. -################# -## NPM Package -################# -node_modules/ +# compiled output +/tmp +/out-tsc +/.ng_build +.ng_build -################# -## Eclipse -################# +# dependencies +**/node_modules -*.pydevproject +# IDEs and editors +/.idea .project -.metadata -bin/ -tmp/ -*.tmp -*.bak -*.swp -*~.nib -local.properties .classpath -.settings/ -.loadpath - -# External tool builders -.externalToolBuilders/ - -# Locally stored "Eclipse launch configurations" +.c9/ *.launch - -# CDT-specific -.cproject - -# PDT-specific -.buildpath - - -################# -## Visual Studio -################# - -## Ignore Visual Studio temporary files, build results, and -## files generated by popular Visual Studio add-ons. - -# User-specific files -*.suo -*.user -*.sln.docstates - -# Build results - -[Dd]ebug/ -[Rr]elease/ -x64/ -build/ -[Bb]in/ -[Oo]bj/ - -# MSTest test Results -[Tt]est[Rr]esult*/ -[Bb]uild[Ll]og.* - -*_i.c -*_p.c -*.ilk -*.meta -*.obj -*.pch -*.pdb -*.pgc -*.pgd -*.rsp -*.sbr -*.tlb -*.tli -*.tlh -*.tmp -*.tmp_proj -*.log -*.vspscc -*.vssscc -.builds -*.pidb -*.log -*.scc - -# Visual C++ cache files -ipch/ -*.aps -*.ncb -*.opensdf -*.sdf -*.cachefile - -# Visual Studio profiler -*.psess -*.vsp -*.vspx - -# Guidance Automation Toolkit -*.gpState - -# ReSharper is a .NET coding add-in -_ReSharper*/ -*.[Rr]e[Ss]harper - -# TeamCity is a build add-in -_TeamCity* - -# DotCover is a Code Coverage Tool -*.dotCover - -# NCrunch -*.ncrunch* -.*crunch*.local.xml - -# Installshield output folder -[Ee]xpress/ - -# DocProject is a documentation generator add-in -DocProject/buildhelp/ -DocProject/Help/*.HxT -DocProject/Help/*.HxC -DocProject/Help/*.hhc -DocProject/Help/*.hhk -DocProject/Help/*.hhp -DocProject/Help/Html2 -DocProject/Help/html - -# Click-Once directory -publish/ - -# Publish Web Output -*.Publish.xml -*.pubxml - -# NuGet Packages Directory -## TODO: If you have NuGet Package Restore enabled, uncomment the next line -#packages/ - -# Windows Azure Build Output -csx -*.build.csdef - -# Windows Store app package directory -AppPackages/ - -# Others -sql/ -*.Cache -ClientBin/ -[Ss]tyle[Cc]op.* -~$* -*~ -*.dbmdl -*.[Pp]ublish.xml -*.pfx -*.publishsettings - -# RIA/Silverlight projects -Generated_Code/ - -# Backup & report files from converting an old project file to a newer -# Visual Studio version. Backup files are not needed, because we have git ;-) -_UpgradeReport_Files/ -Backup*/ -UpgradeLog*.XML -UpgradeLog*.htm - -# SQL Server files -App_Data/*.mdf -App_Data/*.ldf - -############# -## Windows detritus -############# - -# Windows image file caches -Thumbs.db -ehthumbs.db - -# Folder config file -Desktop.ini - -# Recycle Bin used on file shares -$RECYCLE.BIN/ - -# Mac crap +.settings/ +*.sublime-workspace + +# IDE - VSCode +.vscode/* +!.vscode/settings.json +!.vscode/tasks.json +!.vscode/launch.json +!.vscode/extensions.json +.chrome + +# misc +/.angular/cache +/.sass-cache +/connect.lock +/coverage +/libpeerconnection.log +npm-debug.log +testem.log +/typings +yarn-error.log + +# System Files .DS_Store +Thumbs.db - -############# -## Python -############# - -*.py[co] - -# Packages -*.egg -*.egg-info -build/ -eggs/ -parts/ -var/ -sdist/ -develop-eggs/ -.installed.cfg - -# Installer logs -pip-log.txt - -# Unit test / coverage reports -.coverage -.tox - -#Translations -*.mo - -#Mr Developer -.mr.developer.cfg - -package-lock.json \ No newline at end of file +# Distribution/Demo folders +dist/ +docs/ + +# Tests Report & Coverage +**/node_modules +**/coverage +**/jest-coverage +**/dist +**/*.tgz +**/junit.xml +**/test-report.xml +**/testresult.xml + +# Node Version Manager files +.naverc \ No newline at end of file diff --git a/.npmignore b/.npmignore new file mode 100644 index 0000000..2ad26f3 --- /dev/null +++ b/.npmignore @@ -0,0 +1,36 @@ +# See http://help.github.com/ignore-files/ for more about ignoring files. + +# compiled output +/tmp +/out-tsc +/.ng_build +.ng_build +.angular + +# dependencies +/node_modules + +# IDE - VSCode +.vscode/* +!.vscode/settings.json +!.vscode/tasks.json +!.vscode/launch.json +!.vscode/extensions.json +.chrome + +# package manager files +package-lock.json +yarn.lock +yarn-error.log + +# Tests, Report & Coverage +*.spec.ts +/test +**/docs +**/node_modules +**/coverage +**/jest-coverage +**/*.tgz +**/junit.xml +**/test-report.xml +**/testresult.xml \ No newline at end of file diff --git a/.release-it.json b/.release-it.json new file mode 100644 index 0000000..cf2e6ef --- /dev/null +++ b/.release-it.json @@ -0,0 +1,30 @@ +{ + "git": { + "commitMessage": "chore: release v${version}", + "tagName": "v${version}" + }, + "github": { + "release": true, + "web": true, + "releaseName": "v${version}" + }, + "npm": { + "publishPath": "dist/" + }, + "hooks": { + "before:init": [ + "npm run lint" + ], + "after:bump": "npm run build", + "after:git:release": "echo After git push, before GitHub Release", + "after:release": "echo Successfully released ${name} v${version} to ${repo.repository}." + }, + "plugins": { + "@release-it/conventional-changelog": { + "header": "# Change Log\nAll notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.", + "preset": "angular", + "ignoreRecommendedBump": true, + "infile": "CHANGELOG.md" + } + } +} \ No newline at end of file diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 0000000..0a410ed --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,9 @@ +{ + "recommendations": [ + "andys8.jest-snippets", + "angular.ng-template", + "editorconfig.editorconfig", + "msjsdiag.debugger-for-chrome", + "dbaeumer.vscode-eslint" + ] +} diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..83518f0 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,72 @@ +{ + "version": "0.2.0", + "configurations": [ + { + "type": "chrome", + "request": "launch", + "name": "Chrome Debugger", + "url": "http://localhost:4300", + "breakOnLoad": false, + "webRoot": "${workspaceFolder}" + }, + { + "type": "chrome", + "request": "attach", + "name": "Attach to Chrome", + "port": 9222, + "webRoot": "${workspaceFolder}" + }, + { + "type": "node", + "request": "launch", + "name": "Jest All Tests", + "program": "${workspaceFolder}/node_modules/.bin/jest", + "args": [ + "--runInBand", + "--config", + "${workspaceFolder}/test/jest.config.js" + ], + "console": "internalConsole", + "internalConsoleOptions": "neverOpen", + "windows": { + "program": "${workspaceFolder}/node_modules/jest/bin/jest", + } + }, + { + "type": "node", + "request": "launch", + "name": "Jest Current Spec File", + "program": "${workspaceFolder}/node_modules/.bin/jest", + "args": [ + "--runInBand", + "${fileBasename}", + "--config", + "${workspaceFolder}/test/jest.config.js" + ], + "console": "internalConsole", + "internalConsoleOptions": "neverOpen", + "disableOptimisticBPs": true, + "windows": { + "program": "${workspaceFolder}/node_modules/jest/bin/jest", + } + }, + { + "type": "node", + "request": "launch", + "name": "Jest Selected Test Name", + "program": "${workspaceFolder}/node_modules/.bin/jest", + "args": [ + "${fileBasename}", + "--config", + "${workspaceFolder}/test/jest.config.js", + "-t=${selectedText}$", + "--watch" + ], + "console": "internalConsole", + "internalConsoleOptions": "neverOpen", + "windows": { + "program": "${workspaceFolder}/node_modules/jest/bin/jest", + } + } + ] +} diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..00ad71f --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "typescript.tsdk": "node_modules\\typescript\\lib" +} \ No newline at end of file diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 0000000..816fa75 --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,47 @@ +{ + "version": "2.0.0", + "tasks": [ + { + "label": "Build GitHub Prod Demo", + "type": "shell", + "command": "yarn run build:demo", + "problemMatcher": [] + }, + { + "label": "Build Library", + "type": "shell", + "command": "yarn run build", + "problemMatcher": [] + }, + { + "label": "Publish Library to NPM", + "type": "shell", + "command": "npm publish dist", + "problemMatcher": [] + }, + { + "label": "Publish Library with (Beta Tag) to NPM", + "type": "shell", + "command": "npm publish dist --tag beta", + "problemMatcher": [] + }, + { + "label": "Start Library Development", + "type": "shell", + "command": "yarn start", + "problemMatcher": [] + }, + { + "label": "Prepare Release as Minor (0.x.0) -- Make sure to NPM Publish DIST folder", + "type": "shell", + "command": "yarn run release -- --release-as minor --infile ./CHANGELOG.md", + "problemMatcher": [] + }, + { + "label": "Prepare Release as Patch (0.0.x) -- Make sure to NPM Publish DIST folder", + "type": "shell", + "command": "yarn run release -- --release-as patch --infile ./CHANGELOG.md", + "problemMatcher": [] + } + ] +} \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..6d87fa0 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,32 @@ +# Change Log +All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. + +## [3.1.1](https://github.com/ghiscoding/angular-markdown-editor/compare/v3.1.0...v3.1.1) (2024-09-21) + + +### Bug Fixes + +* update github link of bootstrap-markdown dep, fixes [#64](https://github.com/ghiscoding/angular-markdown-editor/issues/64) ([40da5ef](https://github.com/ghiscoding/angular-markdown-editor/commit/40da5ef47fd009f8c68357851bcf4f6ea27a979f)) + +# [3.1.0](https://github.com/ghiscoding/angular-markdown-editor/compare/v3.0.2...v3.1.0) (2023-04-07) + +# Change Log +All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. + +## [3.0.2](https://github.com/ghiscoding/angular-markdown-editor/compare/v3.0.1...v3.0.2) (2022-12-12) + +### Bug Fixes + +fix: forRoot now requires explicit type ModuleWithProviders, fixes #39 ([973b72](https://github.com/ghiscoding/angular-markdown-editor/commit/973b72f75350fffc36d8d8ddcac769edf327fbfa)) + +## [3.0.0](https://github.com/ghiscoding/angular-markdown-editor/compare/v2.0.2...v3.0.0) (2022-09-12) + + +### Features + +* **core:** upgrade to Angular 14 and Bootstrap 4-5, closes [#33](https://github.com/ghiscoding/angular-markdown-editor/issues/33) ([dd0f3df](https://github.com/ghiscoding/angular-markdown-editor/commit/dd0f3dfe591e764855767622aea909973964a177)) + +### [2.0.2](https://github.com/ghiscoding/angular-markdown-editor/compare/v1.1.5...v2.0.2) (2018-09-24) + +### Features +`Angular-Markdown-Editor` code base was totally rewritten to support Angular 4+. The demo uses [ngx-markdown](https://github.com/jfcere/ngx-markdown), however it is not a deep dependency, you can use any Markdown Parser you wish to use. \ No newline at end of file diff --git a/MIT-license.txt b/LICENSE similarity index 87% rename from MIT-license.txt rename to LICENSE index 6dd2735..5c57491 100644 --- a/MIT-license.txt +++ b/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2016, https://github.com/ghiscoding/angular-markdown-editor +Copyright (c) 2017-present, Angular-Markdown-Editor - Ghislain B. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the @@ -17,4 +17,4 @@ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/angular.json b/angular.json new file mode 100644 index 0000000..cc917f8 --- /dev/null +++ b/angular.json @@ -0,0 +1,148 @@ +{ + "$schema": "./node_modules/@angular/cli/lib/config/schema.json", + "version": 1, + "newProjectRoot": "projects", + "projects": { + "angular-markdown-editor": { + "root": "", + "sourceRoot": "src", + "projectType": "library", + "architect": { + "build": { + "builder": "@angular-devkit/build-angular:browser", + "options": { + "outputPath": "docs", + "index": "src/index.html", + "main": "src/main.ts", + "polyfills": "src/polyfills.ts", + "tsConfig": "tsconfig.app.json", + "allowedCommonJsDependencies": [ + "assign-deep", + "excel-builder-webpacker", + "stream" + ], + "assets": [ + "src/assets", + "src/favicon.ico", + { + "glob": "**/*", + "input": "src/assets/i18n", + "output": "/assets/i18n" + }, + { + "glob": "*", + "input": "src/assets/i18n", + "output": "/assets/i18n" + }, + { + "glob": "*/", + "input": "src/assets/i18n", + "output": "/assets/i18n" + }, + { + "glob": "**/*", + "input": "src/assets/i18n", + "output": "/assets/i18n" + } + ], + "styles": [ + "node_modules/bootstrap/dist/css/bootstrap.css", + "node_modules/font-awesome/css/font-awesome.css", + "node_modules/bootstrap-markdown/css/bootstrap-markdown.min.css", + "node_modules/prismjs/themes/prism.css", + "src/styles.scss" + ], + "scripts": [ + "node_modules/jquery/dist/jquery.js", + "node_modules/bootstrap-markdown/js/bootstrap-markdown.js", + "node_modules/prismjs/prism.js", + "node_modules/prismjs/components/prism-css.min.js", + "node_modules/prismjs/components/prism-javascript.min.js", + "node_modules/prismjs/components/prism-typescript.min.js" + ], + "vendorChunk": true, + "extractLicenses": false, + "buildOptimizer": false, + "sourceMap": true, + "optimization": false, + "namedChunks": true + }, + "configurations": { + "development": { + "budgets": [ + { + "type": "anyComponentStyle", + "maximumWarning": "150kb" + } + ], + "outputHashing": "all", + "extractLicenses": true, + "fileReplacements": [ + { + "replace": "src/environments/environment.ts", + "with": "src/environments/environment.dev.ts" + } + ] + }, + "production": { + "budgets": [ + { + "type": "anyComponentStyle", + "maximumWarning": "50kb" + } + ], + "optimization": true, + "outputHashing": "all", + "sourceMap": false, + "namedChunks": false, + "aot": false, + "extractLicenses": true, + "vendorChunk": false, + "fileReplacements": [ + { + "replace": "src/environments/environment.ts", + "with": "src/environments/environment.prod.ts" + } + ] + } + } + }, + "serve": { + "builder": "@angular-devkit/build-angular:dev-server", + "options": { + "browserTarget": "angular-markdown-editor:build" + }, + "configurations": { + "production": { + "browserTarget": "angular-markdown-editor:build:production" + } + } + }, + "lint": { + "builder": "@angular-eslint/builder:lint", + "options": { + "lintFilePatterns": [ + "src/**/*.ts", + "src/**/*.html" + ] + } + } + } + } + }, + "schematics": { + "@schematics/angular:component": { + "prefix": "app", + "style": "scss" + }, + "@schematics/angular:directive": { + "prefix": "app" + } + }, + "cli": { + "packageManager": "yarn", + "schematicCollections": [ + "@angular-eslint/schematics" + ] + } +} diff --git a/bower.json b/bower.json deleted file mode 100644 index 37196ae..0000000 --- a/bower.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "name": "angular-markdown-editor-ghiscoding", - "version": "1.1.4", - "author": "Ghislain B.", - "description": "Angular Markdown Editor, all-in-one Markdown Editor and Preview", - "main": [ - "src/angular-markdown-editor.js", - "styles/angular-markdown-editor.css" - ], - "keywords": [ - "angular-validation" - ], - "license": "MIT", - "ignore": [ - "node_modules", - "bower_components", - "example", - "images", - "gulpfile.js", - "readme.md", - "README.md" - ], - "homepage": "https://github.com/ghiscoding/angular-markdown-editor", - "repository": { - "type": "git", - "url": "git://github.com/ghiscoding/angular-markdown-editor" - }, - "dependencies": { - "angular-highlightjs": "^0.6.1", - "angular-marked": "^1.2.2", - "angular-sanitize": "^1.5.8", - "bootstrap": "^3.3.6", - "bootstrap-markdown": "^2.10.0", - "highlight.js.origin": "^9.5.0", - "jquery": "^2.2.4", - "marked": "^0.3.5" - }, - "devDependencies": { - "font-awesome": "^4.6.3" - } -} diff --git a/example/app.js b/example/app.js deleted file mode 100644 index 1eacac8..0000000 --- a/example/app.js +++ /dev/null @@ -1,64 +0,0 @@ -'use strict'; - -angular.module('example-app', ['hc.marked', 'hljs', 'angular-markdown-editor']) - .config(['markedProvider', 'hljsServiceProvider', function(markedProvider, hljsServiceProvider) { - // marked config - markedProvider.setOptions({ - gfm: true, - tables: true, - sanitize: true, - highlight: function (code, lang) { - if (lang) { - return hljs.highlight(lang, code, true).value; - } else { - return hljs.highlightAuto(code).value; - } - } - }); - - // highlight config - hljsServiceProvider.setOptions({ - // replace tab with 4 spaces - tabReplace: ' ' - }); - }]) - .controller("MainController", ["$rootScope", "$scope", "marked", function MarkdownController($rootScope, $scope, marked) { - $scope.editor1 = "*This* **is** [markdown](https://daringfireball.net/projects/markdown/)\n and `{{ 1 + 2 }}` = {{ 1 + 2 }}"; - $scope.markdownService = marked('#TEST'); - - // -- - // normal flow, function call - $scope.convertMarkdown = function() { - vm.convertedMarkdown = marked(vm.markdown); - } - - /** - * For some convenience, Angular-Markdown-Editor Directive also save each Markdown Editor inside $rootScope - * Each of editor object are available through their $rootScope.markdownEditorObjects[editorName] - * - * Example: - * We would then call our object through $rootScope.markdownEditorObjects.editor1 - */ - $scope.fullScreenPreview = function() { - $rootScope.markdownEditorObjects.editor1.showPreview(); - $rootScope.markdownEditorObjects.editor1.setFullscreen(true); - } - - /** Markdown event hook onFullscreen, in this example we will automatically show the result preview when going in full screen - * the argument (e) is the actual Markdown object returned which help call any of API functions defined in Markdown Editor - * For a list of API functions take a look on official demo site http://www.codingdrama.com/bootstrap-markdown/ - * @param object e: Markdown Editor object - */ - $scope.onFullScreenCallback = function(e) { - e.showPreview(); - } - - /** After exiting from full screen, let's go back to editor mode (which mean hide the preview) - * NOTE: If you want this one to work, you will have to manually download the JS file, not sure why but they haven't released any versions in a while - * https://github.com/toopay/bootstrap-markdown/tree/master/js - */ - $scope.onFullScreenExitCallback = function(e) { - e.hidePreview(); - } - - }]); diff --git a/example/index.bower.html b/example/index.bower.html deleted file mode 100644 index d042200..0000000 --- a/example/index.bower.html +++ /dev/null @@ -1,70 +0,0 @@ - - -
- -