javascript 重复使用选择JSON ID gapcursor>prosemirror atlaskit编辑器出现问题

pu82cl6c  于 2023-02-21  发布在  Java
关注(0)|答案(1)|浏览(246)

我收到此错误,我不确定原因,但我知道它与Atlaskit的编辑器组件有关,此错误发生在我删除node_modulepackage-lock.json并运行npm install

Uncaught RangeError: Duplicate use of selection JSON ID gapcursor
at Function.jsonID (index.es.js:188:27)
at ./node_modules/@atlaskit/prosemirror-input-rules/node_modules/@atlaskit/editor-common/dist/esm/selection/gap-cursor/selection.js (selection.js:130:10)
at __webpack_require__ (bootstrap:832:1)
at fn (bootstrap:129:1)
at ./node_modules/@atlaskit/prosemirror-input-rules/node_modules/@atlaskit/editor-common/dist/esm/selection/index.js (index.js:1:1)
at __webpack_require__ (bootstrap:832:1)
at fn (bootstrap:129:1)
at ./node_modules/@atlaskit/prosemirror-input-rules/dist/esm/handler.js (handler.js:1:1)
at __webpack_require__ (bootstrap:832:1)
at fn (bootstrap:129:1)

这是我的包. json

{
  "name": "office-addin-taskpane-react-js",
  "version": "0.0.1",
  "repository": {
    "type": "git",
    "url": "https://github.com/OfficeDev/Office-Addin-TaskPane-React-JS.git"
  },
  "license": "MIT",
  "config": {
    "app_to_debug": "outlook",
    "app_type_to_debug": "desktop",
    "dev_server_port": 3000
  },
  "scripts": {
    "prep_dev_config": "cpr assets/config/config-dev.json assets/config/config.json -o",
    "prep_prod_config": "cpr assets/config/config-prod.json assets/config/config.json -o",
    "build": "webpack -p --mode production --https false",
    "build:dev": "webpack --mode development --https false",
    "build-dev": "webpack --mode development --https false && echo . && echo . && echo . && echo Please use 'build:dev' instead of 'build-dev'.",
    "dev-server": "webpack-dev-server --mode development",
    "lint": "office-addin-lint check",
    "lint:fix": "office-addin-lint fix",
    "prettier": "office-addin-lint prettier",
    "start": "office-addin-debugging start manifest.xml",
    "start:desktop": "office-addin-debugging start manifest.xml desktop",
    "start:web": "office-addin-debugging start manifest.xml web",
    "stop": "office-addin-debugging stop manifest.xml",
    "validate": "office-addin-manifest validate manifest.xml",
    "watch": "webpack --mode development --watch"
  },
  "dependencies": {
    "@atlaskit/adf-utils": "^17.1.0",
    "@atlaskit/badge": "^15.0.13",
    "@atlaskit/editor-jira-transformer": "^8.1.28",
    "@atlaskit/inline-edit": "^12.2.6",
    "@atlaskit/mention": "^21.0.9",
    "@atlaskit/onboarding": "^10.4.2",
    "@atlaskit/progress-bar": "^0.5.6",
    "@atlaskit/section-message": "^4.1.10",
    "@atlaskit/spinner": "^14.0.0",
    "@atlaskit/toggle": "^12.4.8",
    "@fluentui/react": "^7.137.1",
    "@material-ui/core": "^4.11.0",
    "@material-ui/icons": "^4.9.1",
    "@material-ui/lab": "^4.0.0-alpha.56",
    "@tanker/file-ponyfill": "^2.22.0",
    "@uifabric/example-data": "^7.1.3",
    "@uifabric/react-cards": "^0.112.13",
    "@wcj/html-to-markdown": "^1.0.1",
    "adf-builder": "^3.3.0",
    "ajv": "^8.12.0",
    "core-js": "^3.9.1",
    "cpr": "^3.0.1",
    "es6-promise": "^4.2.8",
    "lodash": "^4.17.21",
    "moment": "^2.29.1",
    "node-html-markdown": "^1.2.0",
    "npm": "^8.10.0",
    "office-ui-fabric-react": "^7.10.0",
    "react": "^16.8.2",
    "react-app-polyfill": "^2.0.0",
    "react-dom": "^16.10.2",
    "react-dropzone": "^11.2.0",
    "react-native-html-to-markdown": "^1.0.0",
    "regenerator-runtime": "^0.13.7",
    "rxjs": "^5.5.0",
    "rxjs-compat": "^6.6.7",
    "strftime": "^0.10.1",
    "turndown": "^7.1.1"
  },
  "devDependencies": {
    "@atlaskit/button": "^13.4.2",
    "@atlaskit/checkbox": "^10.1.14",
    "@atlaskit/datetime-picker": "^9.4.7",
    "@atlaskit/dynamic-table": "^13.7.9",
    "@atlaskit/editor-core": "^165.0.0",
    "@atlaskit/editor-json-transformer": "^8.8.3",
    "@atlaskit/editor-wikimarkup-transformer": "^5.7.1",
    "@atlaskit/flag": "^12.4.5",
    "@atlaskit/form": "^7.4.1",
    "@atlaskit/icon": "^20.1.2",
    "@atlaskit/lozenge": "^9.1.9",
    "@atlaskit/media-core": "^32.3.1",
    "@atlaskit/radio": "^3.2.3",
    "@atlaskit/select": "^11.0.14",
    "@atlaskit/single-select": "^9.0.4",
    "@atlaskit/textarea": "^2.2.10",
    "@atlaskit/textfield": "^3.1.13",
    "@atlaskit/tooltip": "^9.0.0",
    "@babel/core": "^7.13.10",
    "@babel/plugin-proposal-class-properties": "^7.3.0",
    "@babel/preset-env": "^7.6.3",
    "@babel/preset-react": "^7.6.3",
    "@gfx/zopfli": "^1.0.15",
    "@types/es6-collections": "^0.5.29",
    "@types/find-process": "1.2.0",
    "@types/office-js": "^1.0.180",
    "@types/office-runtime": "^1.0.17",
    "@types/react": "^16.8.22",
    "@types/react-dom": "^16.8.4",
    "@types/react-hot-loader": "^4.1.0",
    "@types/webpack": "^4.4.34",
    "@types/webpack-dev-server": "^3.1.6",
    "axios": "^0.21.1",
    "babel-loader": "^8.2.2",
    "babel-polyfill": "^6.26.0",
    "clean-webpack-plugin": "^3.0.0",
    "compression-webpack-plugin": "^6.1.1",
    "copy-webpack-plugin": "^6.4.1",
    "copyfiles": "^2.4.1",
    "css-loader": "^5.2.7",
    "duplicate-package-checker-webpack-plugin": "^3.0.0",
    "eslint": "^7.20.0",
    "eslint-plugin-office-addins": "^1.0.0",
    "eslint-plugin-react": "^7.25.1",
    "extract-text-webpack-plugin": "4.0.0-beta.0",
    "file-loader": "^4.2.0",
    "find-process": "^1.4.4",
    "html-loader": "^0.5.5",
    "html-webpack-plugin": "^4.5.1",
    "less": "^3.10.3",
    "less-loader": "^5.0.0",
    "office-addin-cli": "^1.2.2",
    "office-addin-debugging": "^4.2.2",
    "office-addin-dev-certs": "^1.6.2",
    "office-addin-lint": "^1.3.2",
    "office-addin-manifest": "^1.6.2",
    "office-addin-prettier-config": "^1.1.0",
    "postcss-loader": "^4.0.1",
    "react-hot-loader": "^4.13.0",
    "react-redux": "^7.2.1",
    "react-router": "^5.2.0",
    "react-router-dom": "^5.2.0",
    "redux": "3.7.2",
    "socket.io": "^2.4.1",
    "socket.io-client": "^2.3.0",
    "source-map-loader": "^0.2.4",
    "style-loader": "^1.2.1",
    "ts-loader": "^6.2.2",
    "typescript": "^4.7.4",
    "validator": "^13.6.0",
    "webpack": "^4.46.0",
    "webpack-bundle-analyzer": "^4.4.2",
    "webpack-cli": "^3.3.12",
    "webpack-dev-server": "^3.11.2",
    "websocket": "^1.0.32"
  },
  "prettier": "office-addin-prettier-config"
}

请注意,这是一个office outlook加载项
我首先尝试将编辑器组件升级到新版本,但发生了相同的错误。其次,我尝试将此行添加到package.json,但效果不佳

"resolutions": {
    "prosemirror-model": "1.14.3"
  },
a1o7rhls

a1o7rhls1#

根据错误消息,您正在使用的react-dnd和react-dnd-html5-backend版本似乎存在问题。您正在使用的@atlaskit/editor-core版本似乎与最新版本的react-dnd和react-dnd-html5-backend不兼容。要解决此问题,您可以尝试将react-dnd和react-dnd-html5-backend的版本降级为与@atlaskit/editor-core兼容的版本。例如,你可以尝试运行下面的命令来安装react-dnd和react-dnd-html5-backend的兼容版本:
npm install react-dnd@11.1.3 react-dnd-html5-backend@11.1.3
然后,删除node_modules文件夹和package-lock.json文件,并再次运行npm install以重新安装依赖项,之后,尝试再次运行应用程序,并查看错误是否已解决。

相关问题