我使用
ckeditor5-angular
和 ckeditor5-build-classic
以及角度 17 。在开发模式下它确实可以工作,但在生产模式下,它不起作用并导致
错误类型错误:这不是构造函数
我的组件:
public Editor = ClassicEditor;
public config = {
language: 'fa',
link: {
addTargetToExternalLinks: true
}
};
我的看法:
<div class="col-12 mb-3">
<label class="col-form-label flex-grow-1">body</label>
<ckeditor formControlName="body" [config]="config" [editor]="Editor" row="10"></ckeditor>
</div>
我的 package.json ck 编辑器版本:
"@ckeditor/ckeditor5-angular": "^6.0.1",
"@ckeditor/ckeditor5-build-classic": "^34.2.0",
我的角度版本:
"@angular-devkit/build-angular": "^17.0.0",
"@angular-eslint/builder": "17.1.1",
"@angular-eslint/eslint-plugin": "17.1.1",
"@angular-eslint/eslint-plugin-template": "17.1.1",
"@angular-eslint/schematics": "17.1.1",
"@angular-eslint/template-parser": "17.1.1",
"@angular/cli": "^17.0.0",
"@angular/compiler-cli": "^17.0.2",
"@commitlint/cli": "^18.4.3",
"@commitlint/config-angular": "^18.4.3",
"@commitlint/config-conventional": "^18.4.3",
"@types/jasmine": "~3.6.0",
"@types/node": "^12.11.1",
"@typescript-eslint/eslint-plugin": "6.13.1",
"@typescript-eslint/parser": "6.13.1",
"codelyzer": "^6.0.0",
"eslint": "^8.54.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.1.2",
"eslint-plugin-unused-imports": "^3.0.0",
"husky": "^8.0.3",
"jasmine-core": "~3.6.0",
"jasmine-spec-reporter": "~5.0.0",
"karma": "~6.3.4",
"karma-chrome-launcher": "~3.1.0",
"karma-coverage": "~2.0.3",
"karma-jasmine": "~4.0.0",
"karma-jasmine-html-reporter": "^1.5.0",
"lint-staged": "^15.2.0",
"prettier": "^3.1.1",
"prettier-eslint": "^16.2.0",
"protractor": "~7.0.0",
"ts-node": "~8.3.0",
"tslint": "~6.1.0",
"typescript": "^5.2.2"
我的 angular.json 构建器配置:
"build": {
"builder": "@angular-devkit/build-angular:application",
"options": {
"outputPath": "dist/Admin",
"browser": "src/main.ts",
"index": "src/index.html",
"polyfills": [
"zone.js"
],
"tsConfig": "tsconfig.app.json",
angular.json 生产配置:
"production": {
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
}
],
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"namedChunks": false,
"extractLicenses": true,
"budgets": [
{
"type": "initial",
"maximumWarning": "30mb",
"maximumError": "30mb"
},
{
"type": "anyComponentStyle",
"maximumWarning": "20kb",
"maximumError": "20kb"
}
]
},
我尝试将ckeditor5版本更改为最新但没有成功。
我也有同样的问题。
你找到解决办法了吗?如果是这样的话,可以分享一下吗:)
谢谢