From 4c09e53ea16c4e3e371153db14f564020f108d38 Mon Sep 17 00:00:00 2001 From: Thomas Willheim Date: Mon, 1 Jul 2024 13:56:43 -0700 Subject: [PATCH] updating to add disableBpEditing msg and dup handlers --- CHANGELOG.md | 3 +- output.json | 547 +++++++++--------- packages/ove/package.json | 2 +- packages/ove/src/StatusBar/index.js | 23 +- .../ove/src/withEditorInteractions/index.js | 43 +- 5 files changed, 335 insertions(+), 283 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 845732c1..639dae40 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). #### 0.2.0 +- chore: Update drag and drop sortable package to dnd-kit [`#78`](https://github.com/TeselaGen/tg-oss/pull/78) - relax react version [`#74`](https://github.com/TeselaGen/tg-oss/pull/74) - closes #71 [`#72`](https://github.com/TeselaGen/tg-oss/pull/72) - Debounce the ResizeObserver for automatic dialog resizing to resolve https://github.com/TeselaGen/tg-oss/issues/63 [`#65`](https://github.com/TeselaGen/tg-oss/pull/65) @@ -40,4 +41,4 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). - closes #35 [`#35`](https://github.com/TeselaGen/tg-oss/issues/35) - updating yarn lock [`ff41df0`](https://github.com/TeselaGen/tg-oss/commit/ff41df0b49b8051fcba084f7eaa44cf23284926d) - updating deps, moving to lodash-es, moving all packages to type: module [`bc7312c`](https://github.com/TeselaGen/tg-oss/commit/bc7312ccbe27c2d9a11cf2563ba978199428b50a) -- unifying the ui and ove demos [`f23237d`](https://github.com/TeselaGen/tg-oss/commit/f23237d4185830d94f362cbd1dae527ab59ad623) +- updating table styling to remove table last row bottom margin, removing unused S3Download, removing axios dep, updating deps [`8a6fb1f`](https://github.com/TeselaGen/tg-oss/commit/8a6fb1f047550f617c3e56b8c3ebf145967076ef) diff --git a/output.json b/output.json index b0d80146..43c9bedf 100644 --- a/output.json +++ b/output.json @@ -14,17 +14,10 @@ "options": {}, "configurations": {} }, - "version": { - "executor": "@jscutlery/semver:version", - "options": { - "preset": "conventional" - }, - "configurations": {} - }, "build": { + "executor": "@nx/vite:build", "dependsOn": ["^build"], "inputs": ["production", "^production"], - "executor": "@nx/vite:build", "outputs": ["{options.outputPath}"], "options": { "target": "es2015", @@ -32,15 +25,22 @@ }, "configurations": {} }, - "publish": { - "dependsOn": ["test", "build"], - "executor": "nx:run-commands", + "lint": { + "executor": "@nx/linter:eslint", + "inputs": [ + "default", + "{workspaceRoot}/.eslintrc.json", + "{workspaceRoot}/.eslintignore" + ], + "outputs": ["{options.outputFile}"], "options": { - "command": "node tools/scripts/publish.mjs sequence-utils {args.ver} {args.tag}" + "maxWarnings": 0, + "lintFilePatterns": ["packages/sequence-utils/**/*.js"] }, "configurations": {} }, "test": { + "metadata": {}, "inputs": [ "default", "^production", @@ -52,17 +52,18 @@ }, "configurations": {} }, - "lint": { - "inputs": [ - "default", - "{workspaceRoot}/.eslintrc.json", - "{workspaceRoot}/.eslintignore" - ], - "executor": "@nx/linter:eslint", - "outputs": ["{options.outputFile}"], + "version": { + "executor": "@jscutlery/semver:version", "options": { - "maxWarnings": 0, - "lintFilePatterns": ["packages/sequence-utils/**/*.js"] + "preset": "conventional" + }, + "configurations": {} + }, + "publish": { + "dependsOn": ["test", "build"], + "executor": "nx:run-commands", + "options": { + "command": "node tools/scripts/publish.mjs sequence-utils {args.ver} {args.tag}" }, "configurations": {} } @@ -87,13 +88,29 @@ "options": {}, "configurations": {} }, + "build": { + "executor": "@nx/vite:build", + "dependsOn": ["^build"], + "inputs": ["production", "^production"], + "outputs": ["{options.outputPath}"], + "defaultConfiguration": "production", + "options": { + "generatePackageJson": true, + "outputPath": "dist/bounce-loader" + }, + "configurations": { + "production": { + "mode": "production" + } + } + }, "lint": { + "executor": "@nx/linter:eslint", "inputs": [ "default", "{workspaceRoot}/.eslintrc.json", "{workspaceRoot}/.eslintignore" ], - "executor": "@nx/linter:eslint", "outputs": ["{options.outputFile}"], "options": { "maxWarnings": 0, @@ -103,30 +120,30 @@ }, "configurations": {} }, - "build": { - "dependsOn": ["^build"], - "inputs": ["production", "^production"], - "executor": "@nx/vite:build", - "outputs": ["{options.outputPath}"], - "defaultConfiguration": "production", + "test": { + "metadata": {}, + "inputs": [ + "default", + "^production", + "{workspaceRoot}/jest.preset.js" + ], + "executor": "nx:run-commands", "options": { - "generatePackageJson": true, - "outputPath": "dist/bounce-loader" + "command": "cd packages/bounce-loader && yarn vitest run --changed --config vite.config.ts" }, - "configurations": { - "production": { - "mode": "production" - } - } + "configurations": {} }, - "start": { + "e2e-playwright": { + "metadata": {}, + "inputs": ["default", "^production"], "executor": "nx:run-commands", "options": { - "command": "cd packages/bounce-loader && yarn vite" + "command": "cd packages/bounce-loader && npx playwright test" }, "configurations": {} }, "launch-e2e": { + "metadata": {}, "inputs": ["default", "^production"], "executor": "nx:run-commands", "options": { @@ -134,18 +151,17 @@ }, "configurations": {} }, - "launch-e2e2": { + "start": { "executor": "nx:run-commands", "options": { - "command": "npx concurrently -k \"wait-on tcp:4200 && cd packages/bounce-loader && yarn cypress open --e2e --browser chrome\" \"nx run bounce-loader:start\"" + "command": "cd packages/bounce-loader && yarn vite" }, "configurations": {} }, - "e2e-playwright": { - "inputs": ["default", "^production"], + "launch-e2e2": { "executor": "nx:run-commands", "options": { - "command": "cd packages/bounce-loader && npx playwright test" + "command": "npx concurrently -k \"wait-on tcp:4200 && cd packages/bounce-loader && yarn cypress open --e2e --browser chrome\" \"nx run bounce-loader:start\"" }, "configurations": {} }, @@ -156,18 +172,6 @@ }, "configurations": {} }, - "test": { - "inputs": [ - "default", - "^production", - "{workspaceRoot}/jest.preset.js" - ], - "executor": "nx:run-commands", - "options": { - "command": "cd packages/bounce-loader && yarn vitest run --changed --config vite.config.ts" - }, - "configurations": {} - }, "publish": { "dependsOn": ["e2e", "build"], "executor": "nx:run-commands", @@ -197,17 +201,10 @@ "options": {}, "configurations": {} }, - "version": { - "executor": "@jscutlery/semver:version", - "options": { - "preset": "conventional" - }, - "configurations": {} - }, "build": { + "executor": "@nx/vite:build", "dependsOn": ["^build"], "inputs": ["production", "^production"], - "executor": "@nx/vite:build", "outputs": ["{options.outputPath}"], "options": { "target": "es2015", @@ -215,15 +212,22 @@ }, "configurations": {} }, - "publish": { - "dependsOn": ["test", "build"], - "executor": "nx:run-commands", + "lint": { + "executor": "@nx/linter:eslint", + "inputs": [ + "default", + "{workspaceRoot}/.eslintrc.json", + "{workspaceRoot}/.eslintignore" + ], + "outputs": ["{options.outputFile}"], "options": { - "command": "node tools/scripts/publish.mjs bio-parsers {args.ver} {args.tag}" + "maxWarnings": 0, + "lintFilePatterns": ["packages/bio-parsers/**/*.js"] }, "configurations": {} }, "test": { + "metadata": {}, "inputs": [ "default", "^production", @@ -235,17 +239,18 @@ }, "configurations": {} }, - "lint": { - "inputs": [ - "default", - "{workspaceRoot}/.eslintrc.json", - "{workspaceRoot}/.eslintignore" - ], - "executor": "@nx/linter:eslint", - "outputs": ["{options.outputFile}"], + "version": { + "executor": "@jscutlery/semver:version", "options": { - "maxWarnings": 0, - "lintFilePatterns": ["packages/bio-parsers/**/*.js"] + "preset": "conventional" + }, + "configurations": {} + }, + "publish": { + "dependsOn": ["test", "build"], + "executor": "nx:run-commands", + "options": { + "command": "node tools/scripts/publish.mjs bio-parsers {args.ver} {args.tag}" }, "configurations": {} } @@ -270,17 +275,10 @@ "options": {}, "configurations": {} }, - "version": { - "executor": "@jscutlery/semver:version", - "options": { - "preset": "conventional" - }, - "configurations": {} - }, "build": { + "executor": "@nx/vite:build", "dependsOn": ["^build"], "inputs": ["production", "^production"], - "executor": "@nx/vite:build", "outputs": ["{options.outputPath}"], "options": { "target": "es2015", @@ -288,15 +286,22 @@ }, "configurations": {} }, - "publish": { - "dependsOn": ["test", "build"], - "executor": "nx:run-commands", + "lint": { + "executor": "@nx/linter:eslint", + "inputs": [ + "default", + "{workspaceRoot}/.eslintrc.json", + "{workspaceRoot}/.eslintignore" + ], + "outputs": ["{options.outputFile}"], "options": { - "command": "node tools/scripts/publish.mjs range-utils {args.ver} {args.tag}" + "maxWarnings": 0, + "lintFilePatterns": ["packages/range-utils/**/*.js"] }, "configurations": {} }, "test": { + "metadata": {}, "inputs": [ "default", "^production", @@ -308,17 +313,18 @@ }, "configurations": {} }, - "lint": { - "inputs": [ - "default", - "{workspaceRoot}/.eslintrc.json", - "{workspaceRoot}/.eslintignore" - ], - "executor": "@nx/linter:eslint", - "outputs": ["{options.outputFile}"], + "version": { + "executor": "@jscutlery/semver:version", "options": { - "maxWarnings": 0, - "lintFilePatterns": ["packages/range-utils/**/*.js"] + "preset": "conventional" + }, + "configurations": {} + }, + "publish": { + "dependsOn": ["test", "build"], + "executor": "nx:run-commands", + "options": { + "command": "node tools/scripts/publish.mjs range-utils {args.ver} {args.tag}" }, "configurations": {} } @@ -335,9 +341,6 @@ "type": "lib", "data": { "root": "packages/shared-demo", - "sourceRoot": "packages/shared-demo", - "name": "shared-demo", - "projectType": "library", "targets": { "nx-release-publish": { "dependsOn": ["^nx-release-publish"], @@ -346,6 +349,9 @@ "configurations": {} } }, + "sourceRoot": "packages/shared-demo", + "name": "shared-demo", + "projectType": "library", "implicitDependencies": [], "tags": [] } @@ -363,17 +369,10 @@ "options": {}, "configurations": {} }, - "version": { - "executor": "@jscutlery/semver:version", - "options": { - "preset": "conventional" - }, - "configurations": {} - }, "build": { + "executor": "@nx/vite:build", "dependsOn": ["^build"], "inputs": ["production", "^production"], - "executor": "@nx/vite:build", "outputs": ["{options.outputPath}"], "options": { "target": "es2015", @@ -381,15 +380,22 @@ }, "configurations": {} }, - "publish": { - "dependsOn": ["test", "build"], - "executor": "nx:run-commands", + "lint": { + "executor": "@nx/linter:eslint", + "inputs": [ + "default", + "{workspaceRoot}/.eslintrc.json", + "{workspaceRoot}/.eslintignore" + ], + "outputs": ["{options.outputFile}"], "options": { - "command": "node tools/scripts/publish.mjs file-utils {args.ver} {args.tag}" + "maxWarnings": 0, + "lintFilePatterns": ["packages/file-utils/**/*.js"] }, "configurations": {} }, "test": { + "metadata": {}, "inputs": [ "default", "^production", @@ -401,17 +407,18 @@ }, "configurations": {} }, - "lint": { - "inputs": [ - "default", - "{workspaceRoot}/.eslintrc.json", - "{workspaceRoot}/.eslintignore" - ], - "executor": "@nx/linter:eslint", - "outputs": ["{options.outputFile}"], + "version": { + "executor": "@jscutlery/semver:version", "options": { - "maxWarnings": 0, - "lintFilePatterns": ["packages/file-utils/**/*.js"] + "preset": "conventional" + }, + "configurations": {} + }, + "publish": { + "dependsOn": ["test", "build"], + "executor": "nx:run-commands", + "options": { + "command": "node tools/scripts/publish.mjs file-utils {args.ver} {args.tag}" }, "configurations": {} } @@ -436,29 +443,29 @@ "options": {}, "configurations": {} }, - "lint": { - "inputs": [ - "default", - "{workspaceRoot}/.eslintrc.json", - "{workspaceRoot}/.eslintignore" - ], - "executor": "@nx/linter:eslint", - "outputs": ["{options.outputFile}"], - "options": { - "maxWarnings": 0, - "lintFilePatterns": ["packages/uploader/**/*.{ts,tsx,js,jsx}"] - }, - "configurations": {} - }, "build": { + "executor": "@nx/vite:build", "dependsOn": ["^build"], "inputs": ["production", "^production"], - "executor": "@nx/vite:build", "outputs": ["{options.outputPath}"], "options": { "outputPath": "dist/uploader" }, "configurations": {} + }, + "lint": { + "executor": "@nx/linter:eslint", + "inputs": [ + "default", + "{workspaceRoot}/.eslintrc.json", + "{workspaceRoot}/.eslintignore" + ], + "outputs": ["{options.outputFile}"], + "options": { + "maxWarnings": 0, + "lintFilePatterns": ["packages/uploader/**/*.{ts,tsx,js,jsx}"] + }, + "configurations": {} } }, "sourceRoot": "packages/uploader/src", @@ -481,13 +488,38 @@ "options": {}, "configurations": {} }, + "build": { + "executor": "@nx/vite:build", + "dependsOn": ["build_lib"], + "inputs": ["production", "^production"], + "outputs": ["{options.outputPath}"], + "defaultConfiguration": "production", + "options": { + "emptyOutDir": false, + "generatePackageJson": true, + "outputPath": "dist/ove" + }, + "configurations": { + "umd": { + "mode": "umd" + }, + "demo": { + "mode": "demo", + "base": "./", + "outputPath": "demo-dist/ove" + }, + "production": { + "mode": "production" + } + } + }, "lint": { + "executor": "@nx/linter:eslint", "inputs": [ "default", "{workspaceRoot}/.eslintrc.json", "{workspaceRoot}/.eslintignore" ], - "executor": "@nx/linter:eslint", "outputs": ["{options.outputFile}"], "options": { "maxWarnings": 0, @@ -495,6 +527,49 @@ }, "configurations": {} }, + "test": { + "metadata": {}, + "inputs": [ + "default", + "^production", + "{workspaceRoot}/jest.preset.js" + ], + "executor": "nx:run-commands", + "options": { + "command": "cd packages/ove && yarn vitest run --changed --config vite.config.ts" + }, + "configurations": {} + }, + "e2e": { + "executor": "@nx/cypress:cypress", + "inputs": ["default", "^production"], + "options": { + "parallel": true, + "key": "373658d4-4931-4ffd-9263-8eb78a838ab9", + "record": true, + "cypressConfig": "packages/ove/cypress.config.ts", + "devServerTarget": "ove:start:ci", + "testingType": "e2e" + }, + "configurations": { + "dev": { + "parallel": false + } + } + }, + "launch-e2e": { + "executor": "@nx/cypress:cypress", + "inputs": ["default", "^production"], + "options": { + "watch": true, + "headed": true, + "browser": "chrome", + "cypressConfig": "packages/ove/cypress.config.ts", + "devServerTarget": "ove:start:ci", + "testingType": "e2e" + }, + "configurations": {} + }, "start": { "executor": "nx:run-commands", "options": { @@ -532,31 +607,6 @@ "command": "cd packages/ove && vite build --mode={args.mode}" } }, - "build": { - "dependsOn": ["build_lib"], - "inputs": ["production", "^production"], - "executor": "@nx/vite:build", - "outputs": ["{options.outputPath}"], - "defaultConfiguration": "production", - "options": { - "emptyOutDir": false, - "generatePackageJson": true, - "outputPath": "dist/ove" - }, - "configurations": { - "umd": { - "mode": "umd" - }, - "demo": { - "mode": "demo", - "base": "./", - "outputPath": "demo-dist/ove" - }, - "production": { - "mode": "production" - } - } - }, "pushToGhPages": { "executor": "nx:run-commands", "options": { @@ -564,54 +614,12 @@ }, "configurations": {} }, - "launch-e2e": { - "inputs": ["default", "^production"], - "executor": "@nx/cypress:cypress", - "options": { - "watch": true, - "headed": true, - "browser": "chrome", - "cypressConfig": "packages/ove/cypress.config.ts", - "devServerTarget": "ove:start:ci", - "testingType": "e2e" - }, - "configurations": {} - }, "launch-e2e-playwright": { "executor": "nx:run-commands", "options": { "command": "cd packages/ove && npx playwright test --ui" }, "configurations": {} - }, - "e2e": { - "inputs": ["default", "^production"], - "executor": "@nx/cypress:cypress", - "options": { - "parallel": true, - "key": "373658d4-4931-4ffd-9263-8eb78a838ab9", - "record": true, - "cypressConfig": "packages/ove/cypress.config.ts", - "devServerTarget": "ove:start:ci", - "testingType": "e2e" - }, - "configurations": { - "dev": { - "parallel": false - } - } - }, - "test": { - "inputs": [ - "default", - "^production", - "{workspaceRoot}/jest.preset.js" - ], - "executor": "nx:run-commands", - "options": { - "command": "cd packages/ove && yarn vitest run --changed --config vite.config.ts" - }, - "configurations": {} } }, "sourceRoot": "packages/ove/src", @@ -634,43 +642,10 @@ "options": {}, "configurations": {} }, - "lint": { - "inputs": [ - "default", - "{workspaceRoot}/.eslintrc.json", - "{workspaceRoot}/.eslintignore" - ], - "executor": "@nx/linter:eslint", - "outputs": ["{options.outputFile}"], - "options": { - "maxWarnings": 0, - "lintFilePatterns": ["packages/ui/**/*.{ts,tsx,js,jsx}"] - }, - "configurations": {} - }, - "publish": { - "dependsOn": ["test", "build"], - "executor": "nx:run-commands", - "options": { - "command": "node tools/scripts/publish.mjs ui {args.ver} {args.tag}" - }, - "configurations": {} - }, - "build_simple": { - "configurations": { - "demo": { - "args": "--mode=demo" - } - }, - "executor": "nx:run-commands", - "options": { - "command": "cd packages/ui && vite build --mode={args.mode}" - } - }, "build": { + "executor": "@nx/vite:build", "dependsOn": ["^build"], "inputs": ["production", "^production"], - "executor": "@nx/vite:build", "outputs": ["{options.outputPath}"], "defaultConfiguration": "production", "options": { @@ -688,27 +663,53 @@ } } }, - "pushToGhPages": { - "executor": "nx:run-commands", + "lint": { + "executor": "@nx/linter:eslint", + "inputs": [ + "default", + "{workspaceRoot}/.eslintrc.json", + "{workspaceRoot}/.eslintignore" + ], + "outputs": ["{options.outputFile}"], "options": { - "command": "yarn gh-pages -a -d demo-dist" + "maxWarnings": 0, + "lintFilePatterns": ["packages/ui/**/*.{ts,tsx,js,jsx}"] }, "configurations": {} }, - "start": { + "test": { + "metadata": {}, + "inputs": [ + "default", + "^production", + "{workspaceRoot}/jest.preset.js" + ], "executor": "nx:run-commands", "options": { - "commands": ["cd packages/ui && yarn vite"] + "command": "cd packages/ui && yarn vitest run --changed --config vite.config.ts" + }, + "configurations": {} + }, + "e2e": { + "executor": "@nx/cypress:cypress", + "inputs": ["default", "^production"], + "options": { + "parallel": true, + "key": "1ced39be-1a3a-4fd8-b2d5-a88951d9b766", + "record": true, + "cypressConfig": "packages/ui/cypress.config.ts", + "devServerTarget": "ui:start:ci", + "testingType": "e2e" }, "configurations": { - "ci": { - "readyWhen": "ready in" + "dev": { + "parallel": false } } }, "launch-e2e": { - "inputs": ["default", "^production"], "executor": "@nx/cypress:cypress", + "inputs": ["default", "^production"], "options": { "watch": true, "headed": true, @@ -719,34 +720,42 @@ }, "configurations": {} }, - "e2e": { - "inputs": ["default", "^production"], - "executor": "@nx/cypress:cypress", + "publish": { + "dependsOn": ["test", "build"], + "executor": "nx:run-commands", "options": { - "parallel": true, - "key": "1ced39be-1a3a-4fd8-b2d5-a88951d9b766", - "record": true, - "cypressConfig": "packages/ui/cypress.config.ts", - "devServerTarget": "ui:start:ci", - "testingType": "e2e" + "command": "node tools/scripts/publish.mjs ui {args.ver} {args.tag}" }, + "configurations": {} + }, + "build_simple": { "configurations": { - "dev": { - "parallel": false + "demo": { + "args": "--mode=demo" } + }, + "executor": "nx:run-commands", + "options": { + "command": "cd packages/ui && vite build --mode={args.mode}" } }, - "test": { - "inputs": [ - "default", - "^production", - "{workspaceRoot}/jest.preset.js" - ], + "pushToGhPages": { "executor": "nx:run-commands", "options": { - "command": "cd packages/ui && yarn vitest run --changed --config vite.config.ts" + "command": "yarn gh-pages -a -d demo-dist" }, "configurations": {} + }, + "start": { + "executor": "nx:run-commands", + "options": { + "commands": ["cd packages/ui && yarn vite"] + }, + "configurations": { + "ci": { + "readyWhen": "ready in" + } + } } }, "sourceRoot": "packages/ui/src", @@ -833,7 +842,5 @@ } ] } - }, - "affectedProjects": [], - "criticalPath": [] + } } diff --git a/packages/ove/package.json b/packages/ove/package.json index d85d7393..74366213 100644 --- a/packages/ove/package.json +++ b/packages/ove/package.json @@ -1,6 +1,6 @@ { "name": "@teselagen/ove", - "version": "0.5.17", + "version": "0.5.18", "main": "./src/index.js", "type": "module", "exports": { diff --git a/packages/ove/src/StatusBar/index.js b/packages/ove/src/StatusBar/index.js index 4dd6376a..bb11e90e 100644 --- a/packages/ove/src/StatusBar/index.js +++ b/packages/ove/src/StatusBar/index.js @@ -19,14 +19,29 @@ import { handleReadOnlyChange } from "../ToolBar/editTool"; const EditReadOnlyItem = connectToEditor(({ readOnly }) => ({ readOnly }))(props => { - const { onSave, readOnly, showReadOnly, disableSetReadOnly } = props; + const { + onSave, + readOnly, + showReadOnly, + disableSetReadOnly, + disableBpEditing + } = props; return showReadOnly ? ( {onSave ? ( diff --git a/packages/ove/src/withEditorInteractions/index.js b/packages/ove/src/withEditorInteractions/index.js index 0642713d..eb692677 100644 --- a/packages/ove/src/withEditorInteractions/index.js +++ b/packages/ove/src/withEditorInteractions/index.js @@ -213,10 +213,10 @@ function VectorInteractionHOC(Component /* options */) { } = this.props; if (disableBpEditing) { - return window.toastr.warning("Sorry the underlying sequence is locked"); + return this.createDisableBpEditingMsg(); } if (readOnly) { - return window.toastr.warning("Sorry the sequence is Read-Only"); + return this.createReadOnlyMsg(); } if (!(caretPosition > -1 || selectionLayer.start > -1)) { return window.toastr.warning("Please place the cursor before pasting"); @@ -344,6 +344,33 @@ function VectorInteractionHOC(Component /* options */) { handleCopy = this.handleCutOrCopy(); + getDuplicateAction = () => { + if (!this.props.onDuplicate) { + return undefined; + } + return { + action: { + text: "Create a Duplicate?", + onClick: () => { + window.__tgClearAllToasts(); + this.props.onDuplicate(this.props.sequenceData, this.props); + } + } + }; + }; + createDisableBpEditingMsg = () => { + window.toastr.warning( + this.props.disableBpEditing, + this.getDuplicateAction() + ); + }; + createReadOnlyMsg = () => { + window.toastr.warning( + "Sorry the sequence is Read-Only", + this.getDuplicateAction() + ); + }; + handleDnaInsert = async ({ useEventPositioning }) => { const { caretPosition = -1, @@ -358,10 +385,10 @@ function VectorInteractionHOC(Component /* options */) { const sequenceLength = sequenceData.sequence.length; const isReplace = selectionLayer.start > -1; if (disableBpEditing) { - return window.toastr.warning("Sorry the underlying sequence is locked"); + return this.createDisableBpEditingMsg(); } - if (readOnly || disableBpEditing) { - window.toastr.warning("Sorry the sequence is Read-Only"); + if (readOnly) { + return this.createReadOnlyMsg(); } else { createSequenceInputPopup({ useEventPositioning, @@ -397,10 +424,10 @@ function VectorInteractionHOC(Component /* options */) { } = this.props; const sequenceLength = sequenceData.sequence.length; if (disableBpEditing) { - return window.toastr.warning("Sorry the underlying sequence is locked"); + return this.createDisableBpEditingMsg(); } - if (readOnly || disableBpEditing) { - return window.toastr.warning("Sorry the sequence is Read-Only"); + if (readOnly) { + return this.createReadOnlyMsg(); } if (sequenceLength > 0) { let rangeToDelete = selectionLayer;