element-tiptap icon indicating copy to clipboard operation
element-tiptap copied to clipboard

No value supplied for attribute px - FontSize Extension Bug

Open Arturokin opened this issue 3 years ago • 3 comments

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:

  1. Go to https://codesandbox.io/s/element-tiptap-fontsize-extension-bug-e8oxc?file=/src/components/Editor.vue
  2. Paste text from word or powerpoint into the editor

Expected behavior Console error throwing: No value supplied for attribute px

Arturokin avatar Sep 07 '21 01:09 Arturokin

同问这个问题~~。复制粘贴会报错

Melussa avatar Oct 13 '22 08:10 Melussa

同问,复制粘贴在线文档里的内容会报错 "element-tiptap": "^1.26.2" 增加了fontSizes 参数保证复制粘贴的字号在内也无效 new FontSize({ fontSizes: ['8', '10', ...] });

Liuxiang15 avatar Feb 22 '23 06:02 Liuxiang15

/**
   * @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;
   * }
   */

codeLittleNewbie avatar Aug 09 '23 09:08 codeLittleNewbie