element-tiptap
element-tiptap copied to clipboard
No value supplied for attribute px - FontSize Extension Bug
Describe the bug Copying and paste text from word/powerpoint fires bug while using the FontSize extension, if you take out this extension the bug is gone
To Reproduce Forked the demo page on codesandbox Steps to reproduce the behavior:
- Go to https://codesandbox.io/s/element-tiptap-fontsize-extension-bug-e8oxc?file=/src/components/Editor.vue
- Paste text from word or powerpoint into the editor
Expected behavior Console error throwing: No value supplied for attribute px
同问这个问题~~。复制粘贴会报错
同问,复制粘贴在线文档里的内容会报错 "element-tiptap": "^1.26.2" 增加了fontSizes 参数保证复制粘贴的字号在内也无效 new FontSize({ fontSizes: ['8', '10', ...] });
/**
* @title 如果要使用FontSize 需要修改源码 node_modules\prosemirror-model\dist\index
* function computeAttrs(attrs, value) {
* let built = Object.create(null);
* for (let name in attrs) {
* let given = value && value[name];
* if (given === undefined) {
* let attr = attrs[name];
* if (attr.hasDefault)
* given = attr.default;
* else {
* console.warn("No value supplied for attribute " + name);
* // throw new Warning("No value supplied for attribute " + name);
* return built;
* }
* }
* built[name] = given;
* }
* return built;
* }
*/