首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何在React中将链接图像添加到ckeditor?

如何在React中将链接图像添加到ckeditor?
EN

Stack Overflow用户
提问于 2022-04-29 11:14:53
回答 1查看 230关注 0票数 0

我想添加链接图片功能到我的反应应用程序,使用‘

代码语言:javascript
复制
@ckeditor/ckeditor5-build-decoupled-document

代码:

代码语言:javascript
复制
import React from 'react'
import { CKEditor } from "@ckeditor/ckeditor5-react";
import * as  DecoupledEditor from "@ckeditor/ckeditor5-build-decoupled-document";

但当我进口:

代码语言:javascript
复制
import linkimage from '@ckeditor/ckeditor5-link/src/linkimage';

我收到一个错误:

未知CKEditorError: ckeditor-复制-模块

关于图像链接的更多信息

如何添加链接图像?

EN

回答 1

Stack Overflow用户

发布于 2022-05-04 14:39:26

我想你已经做了:

代码语言:javascript
复制
npm install --save @ckeditor/ckeditor5-image

并通过以下方式启用插件:

代码语言:javascript
复制
import LinkImage from '@ckeditor/ckeditor5-link/src/linkimage';

然后将其添加到编辑器配置中:

代码语言:javascript
复制
image: {
    toolbar: [
        'imageStyle:block',
        'imageStyle:side',
        '|',
        'toggleImageCaption',
        'imageTextAlternative',
        '|',
        'linkImage' <---- here
    ]
}

即使错误仍然持续存在,也可以尝试它的错误代码文档这里

代码语言:javascript
复制
Packages were duplicated in node_modules

In some situations, especially when calling npm install multiple times, it may happen that npm will not correctly "deduplicate" packages.

Normally, npm deduplicates all packages so, for example, @ckeditor/ckeditor5-core is installed only once in node_modules/. However, it is known to fail to do so from time to time.

We recommend checking if any of the steps listed below help:

    rm -rf node_modules && npm install to make sure you have a clean node_modules/ directory. This step is known to help in most cases.
    If you use yarn.lock or package-lock.json, remove it before npm install.
    Check whether all CKEditor 5 packages are up to date and reinstall them if you changed anything (rm -rf node_modules && npm install).
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/72057070

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档