wujie icon indicating copy to clipboard operation
wujie copied to clipboard

子应用使用wangeditor无法对已存在的数据进行修改

Open IU-cwx opened this issue 3 years ago • 3 comments

子应用使用wangeditor无法对已存在的数据进行修改

初始化子应用富文本框的值,点击图标聚焦到wangeditor后,无法删除

IU-cwx avatar Oct 13 '22 09:10 IU-cwx

请给一个简单的 demo,省的我复现环境哈

yiludege avatar Oct 14 '22 07:10 yiludege

请给一个简单的 demo,省的我复现环境哈

这是demo

IU-cwx avatar Oct 14 '22 08:10 IU-cwx

请给一个简单的 demo,省的我复现环境哈

选中不可添加样式,应该也是选取的问题,劳烦看看~

IU-cwx avatar Oct 14 '22 08:10 IU-cwx

由于是vite,jsLoader 插件无法工作,在子应用中添加了一个 compatible-wujie.js 文件:

const fs = require('node:fs');
const path = require('node:path');

const wangEditorPath = path.resolve('../', 'sub-arco-design/node_modules/@wangeditor/editor/dist/index.esm.js');

let wangEditor = fs.readFileSync(wangEditorPath, 'utf-8');

wangEditor = wangEditor.replace(
  `e instanceof t.Selection`,
  `e instanceof t.top.Selection`
);

fs.writeFileSync(wangEditorPath, wangEditor);

然后再 package.json的 scripts 中添加:

"postinstall": "node ./compatible-wujie.js",

重新 npm i 一下,代码就替换了,可以解决无法删除的问题,还是有很多其他的问题,哎,具体问题出现在 getSelectedNodeAndMenuKeys 函数里面,太难找了

yiludege avatar Oct 20 '22 02:10 yiludege

添加了一个 compatible-wujie.js 文件 虽然是可以更改了,但是无法粘贴内容,哎真是一个头两个大

1393983569 avatar Mar 16 '23 08:03 1393983569

由于是vite,jsLoader 插件无法工作,在子应用中添加了一个 compatible-wujie.js 文件:

const fs = require('node:fs');
const path = require('node:path');

const wangEditorPath = path.resolve('../', 'sub-arco-design/node_modules/@wangeditor/editor/dist/index.esm.js');

let wangEditor = fs.readFileSync(wangEditorPath, 'utf-8');

wangEditor = wangEditor.replace(
  `e instanceof t.Selection`,
  `e instanceof t.top.Selection`
);

fs.writeFileSync(wangEditorPath, wangEditor);

然后再 package.json的 scripts 中添加:

"postinstall": "node ./compatible-wujie.js",

重新 npm i 一下,代码就替换了,可以解决无法删除的问题,还是有很多其他的问题,哎,具体问题出现在 getSelectedNodeAndMenuKeys 函数里面,太难找了

不止是vite,webpack也有同样问题,现在可以输入了 但是无法复制粘贴。

1393983569 avatar Mar 26 '23 06:03 1393983569