RangeError:无法将 <> 转换为片段(看起来加载了多个版本的 prosemirror-model)

问题描述 投票:0回答:1

在我的应用程序中使用 ngx-editor 时,它曾经工作正常,但现在在本地运行时(此问题仅存在于我的本地),当我尝试按 Enter 并更改为新行时,我收到此错误。我可以正常打字并使用工具栏,否则只是输入功能不起作用。 enter image description here

我已经尝试过这里提到的解决方案https://github.com/ueberdosis/tiptap/issues/577,清除node_modules和package-lock.json,但即使如此它也不起作用。

"ngx-editor": "^14.2.0",


  
  "resolutions": {
    "prosemirror-model": "^1.18.1"
  }

这是我的应用程序中调用该组件的富文本区域组件的 HTML 代码。

<form [formGroup]="editorForm" class="w-100-p">
    <div class="editor" [class.has-menu]="showMenu">
        <ngx-editor-menu *ngIf="showMenu" [editor]="editor" [toolbar]="toolbar">
        </ngx-editor-menu>
        <ngx-editor (focusIn)="showHideEditorMenuFn(true,$event)" [placeholder]="placeholder" [editor]="editor"
            formControlName="editorContent">
        </ngx-editor>
    </div>
</form>

该组件随后在不同的父组件中作为富文本编辑器被调用。但目前每个页面只调用它的一个实例,但仍然出现此错误。有解决办法吗?

angular npm prose-mirror ngx-editor
1个回答
0
投票

分辨率仅适用于 YARN。如果您使用 npm,则必须执行相同的操作,但使用

"overrides"
而不是
"resolutions"
。 npm 不理解字段分辨率

"overrides": {
    "prosemirror-model": "^1.18.1"
  }
© www.soinside.com 2019 - 2024. All rights reserved.