ckeditor5插件带有角度
我正在为Angular(13)使用CKEditor5自定义构建,并且正在尝试实现他们的示例“占位符”插件。当我尝试运行应用程序时,我会收到以下错误。我认为我需要在我的angular.json上添加一些东西...但是我不确定。
Compiled with problems:X
ERROR in ./node_modules/@ckeditor/ckeditor5-core/theme/icons/three-vertical-dots.svg 1:0
Module parse failed: Unexpected token (1:0)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
> <svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><circle cx="9.5" cy="4.5" r="1.5"/><circle cx="9.5" cy="10.5" r="1.5"/><circle cx="9.5" cy="16.5" r="1.5"/></svg>
这是我的component.ts文件的相关行:
import { CdkDragDrop, moveItemInArray } from '@angular/cdk/drag-drop';
import { Component, OnInit } from '@angular/core';
import { ActivatedRoute, Router } from '@angular/router';
import { CKEditorUploadAdapter } from 'src/app/_helpers/ckeditor-upload-adapter';
import { ConferenceViewModelWithDetails, PaperAcknowledgementViewModel, PaperConfigurationViewModel } from 'src/app/_models/generatedModels';
import { AuthenticationService } from 'src/app/_services/authentication.service';
import { AdminCallForPapersService, OrganizationService } from 'src/app/_services/generatedServices';
import { ToasterService } from 'src/app/_services/toaster.service';
import * as customBuild from 'src/ckCustomBuild/ckeditor';
import * as Placeholder from 'src/ckCustomBuild/placeholder.plugin';
@Component({
selector: 'bxl-abstract-management-configuration',
templateUrl: 'abstract-management-configuration.component.html',
})
export class AbstractManagementConfigurationComponent implements OnInit {
initialized = false;
public Editor = customBuild;
htmlEditorConfig = {
plugins: [Placeholder],
toolbar: {
items: ['bold', 'italic', 'underline', 'link', 'alignment', 'bulletedList', 'numberedList', '|', 'fontFamily', 'fontSize', 'fontColor', 'fontBackgroundColor', '|', 'Paceholder'],
shouldNotGroupWhenFull: false,
},
placeholderConfig: {
types: ['date', 'color', 'first name', 'surname'],
},
fontSize: {
options: [9, 11, 13, 'default', 17, 19, 21],
},
mediaEmbed: {
previewsInData: true,
},
};
他们说要将其放在webpack.config.json
中,但我们在Angular 13上没有。
module: {
rules: [
{
test: /ckeditor5-[^/\\]+[/\\]theme[/\\]icons[/\\][^/\\]+\.svg$/,
use: [ 'raw-loader' ]
},
I am using the CKEditor5 custom build for angular (13) and I am trying to implement their example "Placeholder" plugin. When I try to run my app, I get the below error. I assume I'll need to add something to my angular.json...but I'm not sure what.
Compiled with problems:X
ERROR in ./node_modules/@ckeditor/ckeditor5-core/theme/icons/three-vertical-dots.svg 1:0
Module parse failed: Unexpected token (1:0)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
> <svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><circle cx="9.5" cy="4.5" r="1.5"/><circle cx="9.5" cy="10.5" r="1.5"/><circle cx="9.5" cy="16.5" r="1.5"/></svg>
Here is the relevent lines from my component.ts file:
import { CdkDragDrop, moveItemInArray } from '@angular/cdk/drag-drop';
import { Component, OnInit } from '@angular/core';
import { ActivatedRoute, Router } from '@angular/router';
import { CKEditorUploadAdapter } from 'src/app/_helpers/ckeditor-upload-adapter';
import { ConferenceViewModelWithDetails, PaperAcknowledgementViewModel, PaperConfigurationViewModel } from 'src/app/_models/generatedModels';
import { AuthenticationService } from 'src/app/_services/authentication.service';
import { AdminCallForPapersService, OrganizationService } from 'src/app/_services/generatedServices';
import { ToasterService } from 'src/app/_services/toaster.service';
import * as customBuild from 'src/ckCustomBuild/ckeditor';
import * as Placeholder from 'src/ckCustomBuild/placeholder.plugin';
@Component({
selector: 'bxl-abstract-management-configuration',
templateUrl: 'abstract-management-configuration.component.html',
})
export class AbstractManagementConfigurationComponent implements OnInit {
initialized = false;
public Editor = customBuild;
htmlEditorConfig = {
plugins: [Placeholder],
toolbar: {
items: ['bold', 'italic', 'underline', 'link', 'alignment', 'bulletedList', 'numberedList', '|', 'fontFamily', 'fontSize', 'fontColor', 'fontBackgroundColor', '|', 'Paceholder'],
shouldNotGroupWhenFull: false,
},
placeholderConfig: {
types: ['date', 'color', 'first name', 'surname'],
},
fontSize: {
options: [9, 11, 13, 'default', 17, 19, 21],
},
mediaEmbed: {
previewsInData: true,
},
};
They say to put this in the webpack.config.json
but we don't have that on angular 13.
module: {
rules: [
{
test: /ckeditor5-[^/\\]+[/\\]theme[/\\]icons[/\\][^/\\]+\.svg$/,
use: [ 'raw-loader' ]
},
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论