From 67b7d471e92545ab36e194d8b908ad97e2c7bfeb Mon Sep 17 00:00:00 2001
From: Veselina Kolova
Date: Tue, 8 Sep 2026 15:10:11 +0300
Subject: [PATCH 1/7] build: support Immutable v5 on Node 24
Upgrade Immutable.js and migrate the Draft.js integration to its v5 API and types.
Publish the editor as @vectorworks/draft-js-plugins and update plugins, documentation, CI, and releases for Node.js 24.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---
.changeset/brave-bugs-build.md | 24 +++++++
.changeset/silent-snails-smile.md | 5 ++
.eslintrc.js | 4 +-
.github/ISSUE_TEMPLATE/bug_report.md | 2 +-
.github/workflows/deployWebsite.yml | 4 +-
.github/workflows/release.yml | 12 +++-
.github/workflows/tests.yml | 2 +-
.nvmrc | 2 +-
.storybook/webpack.config.js | 8 ++-
CONTRIBUTING.md | 4 +-
README.md | 28 +++++++--
package.json | 13 +++-
packages/alignment/README.md | 2 +-
packages/alignment/package.json | 3 +-
packages/alignment/src/index.tsx | 2 +-
packages/anchor/README.md | 2 +-
packages/anchor/package.json | 3 +-
packages/anchor/src/index.tsx | 2 +-
packages/counter/README.md | 2 +-
packages/counter/package.json | 3 +-
.../src/CharCounter/__test__/index.test.tsx | 2 +-
.../src/CustomCounter/__test__/index.test.tsx | 2 +-
.../src/LineCounter/__test__/index.test.tsx | 2 +-
.../src/WordCounter/__test__/index.test.tsx | 2 +-
packages/counter/src/index.tsx | 2 +-
packages/divider/README.md | 2 +-
packages/divider/package.json | 3 +-
packages/divider/src/index.tsx | 2 +-
.../alignment/SimpleAlignmentEditor/index.js | 6 +-
.../alignment/ThemedAlignmentEditor/index.js | 6 +-
.../anchor/CustomInlineToolbarEditor/index.js | 2 +-
.../anchor/SimpleLinkPluginEditor/index.js | 2 +-
.../Examples/anchor/gettingStarted.js | 2 +-
.../counter/CustomCounterEditor/index.js | 2 +-
.../counter/SimpleCounterEditor/index.js | 2 +-
.../Examples/counter/gettingStarted.js | 2 +-
.../DividerWithSideToolbarEditor/index.js | 2 +-
.../Examples/divider/gettingStarted.js | 2 +-
.../drag-n-drop/CustomImageEditor/index.js | 2 +-
.../Examples/drag-n-drop/gettingStarted.js | 2 +-
.../Examples/emoji/CustomEmojiEditor/index.js | 2 +-
.../Examples/emoji/SimpleEmojiEditor/index.js | 2 +-
.../Examples/emoji/gettingStarted.js | 2 +-
.../Examples/focus/SimpleFocusEditor/index.js | 2 +-
.../hashtag/CustomHashtagEditor/index.js | 2 +-
.../hashtag/SimpleHashtagEditor/index.js | 2 +-
.../Examples/hashtag/gettingStarted.js | 2 +-
.../Examples/image/AddImageEditor/index.js | 2 +-
.../Examples/image/CustomImageEditor/index.js | 2 +-
.../Examples/image/SimpleImageEditor/index.js | 2 +-
.../Examples/image/gettingStarted.js | 2 +-
.../CustomInlineToolbarEditor/index.js | 2 +-
.../SimpleInlineToolbarEditor/index.tsx | 2 +-
.../ThemedInlineToolbarEditor/index.js | 2 +-
.../Examples/inline-toolbar/gettingStarted.js | 2 +-
.../CustomComponentLinkifyEditor/index.js | 2 +-
.../linkify/CustomLinkifyEditor/index.js | 2 +-
.../linkify/SimpleLinkifyEditor/index.js | 2 +-
.../Examples/linkify/gettingStarted.js | 2 +-
.../CustomComponentMentionEditor.tsx | 2 +-
.../CustomMentionEditor.tsx | 2 +-
.../MultiMentionTriggers.tsx | 2 +-
.../RemoteMentionEditor.tsx | 2 +-
.../SimpleMentionEditor.tsx | 2 +-
.../SimpleResizeableEditor/index.js | 2 +-
.../CustomSideToolbarEditor/index.js | 2 +-
.../SimpleSideToolbarEditor/index.js | 2 +-
.../Examples/side-toolbar/gettingStarted.js | 2 +-
.../CustomToolbarEditor/index.js | 2 +-
.../SimpleToolbarEditor/index.js | 2 +-
.../ThemedToolbarEditor/index.js | 2 +-
.../Examples/static-toolbar/gettingStarted.js | 2 +-
.../sticker/CustomStickerEditor/index.js | 2 +-
.../sticker/SimpleStickerEditor/index.js | 2 +-
.../Examples/sticker/gettingStarted.js | 2 +-
.../CustomStaticToolbarPlugin/index.js | 2 +-
.../SimpleTextAlignmentPlugin/index.js | 2 +-
.../Examples/text-alignment/gettingStarted.js | 2 +-
packages/docs/package.json | 2 +-
packages/drag-n-drop-upload/README.md | 2 +-
packages/drag-n-drop-upload/package.json | 1 +
packages/drag-n-drop/README.md | 2 +-
packages/drag-n-drop/package.json | 3 +-
packages/drag-n-drop/src/index.tsx | 2 +-
.../drag-n-drop/src/modifiers/addBlock.ts | 4 +-
.../drag-n-drop/src/modifiers/removeBlock.ts | 4 +-
packages/editor/README.md | 2 +-
packages/editor/package.json | 11 ++--
packages/editor/src/Editor/MultiDecorator.ts | 14 ++---
.../Editor/__test__/MultiDecorator.test.ts | 6 +-
.../src/Editor/createCompositeDecorator.tsx | 6 +-
packages/editor/src/Editor/index.tsx | 10 +--
.../editor/src/Editor/resolveDecorators.ts | 2 +-
packages/emoji/README.md | 2 +-
packages/emoji/package.json | 5 +-
.../src/components/EmojiSuggestions/index.tsx | 63 ++++++++++++++-----
packages/emoji/src/index.tsx | 8 +--
.../attachImmutableEntitiesToEmojis.ts | 9 ++-
packages/focus/README.md | 2 +-
packages/focus/package.json | 5 +-
packages/focus/src/__test__/index.test.ts | 4 +-
packages/focus/src/index.tsx | 7 ++-
packages/focus/src/modifiers/insertNewLine.ts | 11 ++--
packages/focus/src/modifiers/removeBlock.ts | 8 +--
packages/focus/src/modifiers/setSelection.ts | 4 +-
.../src/modifiers/setSelectionToBlock.ts | 2 +-
packages/focus/src/utils/getBlockMapKeys.ts | 3 +-
.../src/utils/getSelectedBlocksMapKeys.ts | 3 +-
packages/hashtag/README.md | 2 +-
packages/hashtag/package.json | 3 +-
packages/hashtag/src/index.tsx | 2 +-
packages/image/README.md | 2 +-
packages/image/package.json | 3 +-
packages/image/src/index.tsx | 2 +-
packages/inline-toolbar/README.md | 2 +-
packages/inline-toolbar/package.json | 3 +-
packages/inline-toolbar/src/index.tsx | 2 +-
packages/linkify/README.md | 2 +-
packages/linkify/package.json | 3 +-
packages/linkify/src/index.tsx | 2 +-
packages/mention/README.md | 2 +-
packages/mention/package.json | 5 +-
packages/resizeable/README.md | 2 +-
packages/resizeable/package.json | 1 +
packages/side-toolbar/README.md | 2 +-
packages/side-toolbar/package.json | 3 +-
packages/static-toolbar/README.md | 2 +-
packages/static-toolbar/package.json | 3 +-
packages/sticker/README.md | 2 +-
packages/sticker/package.json | 5 +-
packages/text-alignment/README.md | 2 +-
packages/text-alignment/package.json | 3 +-
packages/undo/README.md | 2 +-
packages/undo/package.json | 3 +-
packages/video/README.md | 2 +-
packages/video/package.json | 3 +-
yarn.lock | 44 +++----------
137 files changed, 337 insertions(+), 236 deletions(-)
create mode 100644 .changeset/brave-bugs-build.md
create mode 100644 .changeset/silent-snails-smile.md
diff --git a/.changeset/brave-bugs-build.md b/.changeset/brave-bugs-build.md
new file mode 100644
index 0000000000..ec01fd3cdf
--- /dev/null
+++ b/.changeset/brave-bugs-build.md
@@ -0,0 +1,24 @@
+---
+'@draft-js-plugins/alignment': patch
+'@draft-js-plugins/anchor': patch
+'@draft-js-plugins/counter': patch
+'@draft-js-plugins/divider': patch
+'@draft-js-plugins/drag-n-drop': patch
+'@draft-js-plugins/drag-n-drop-upload': patch
+'@draft-js-plugins/emoji': patch
+'@draft-js-plugins/focus': patch
+'@draft-js-plugins/hashtag': patch
+'@draft-js-plugins/image': patch
+'@draft-js-plugins/inline-toolbar': patch
+'@draft-js-plugins/linkify': patch
+'@draft-js-plugins/mention': patch
+'@draft-js-plugins/resizeable': patch
+'@draft-js-plugins/side-toolbar': patch
+'@draft-js-plugins/static-toolbar': patch
+'@draft-js-plugins/sticker': patch
+'@draft-js-plugins/text-alignment': patch
+'@draft-js-plugins/undo': patch
+'@draft-js-plugins/video': patch
+---
+
+Use `@vectorworks/draft-js-plugins` for editor types and add it as a peer dependency.
diff --git a/.changeset/silent-snails-smile.md b/.changeset/silent-snails-smile.md
new file mode 100644
index 0000000000..91b9ef4b40
--- /dev/null
+++ b/.changeset/silent-snails-smile.md
@@ -0,0 +1,5 @@
+---
+'@vectorworks/draft-js-plugins': patch
+---
+
+Upgrade Immutable.js to version 5.1.5 or later.
diff --git a/.eslintrc.js b/.eslintrc.js
index 5d2a573b7d..5f9a429755 100644
--- a/.eslintrc.js
+++ b/.eslintrc.js
@@ -134,8 +134,8 @@ module.exports = {
'@draft-js-plugins/linkify/lib/plugin.css',
'@draft-js-plugins/mention',
'@draft-js-plugins/mention/lib/plugin.css',
- '@draft-js-plugins/editor',
- '@draft-js-plugins/editor/lib/plugin.css',
+ '@vectorworks/draft-js-plugins',
+ '@vectorworks/draft-js-plugins/lib/plugin.css',
'@draft-js-plugins/resizeable',
'@draft-js-plugins/side-toolbar',
'@draft-js-plugins/side-toolbar/lib/plugin.css',
diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md
index 8d826b745d..8f3101a792 100644
--- a/.github/ISSUE_TEMPLATE/bug_report.md
+++ b/.github/ISSUE_TEMPLATE/bug_report.md
@@ -14,7 +14,7 @@ All necessary environmental info that will help triage this
Especially include:
-->
-- @draft-js-plugins/editor version:
+- @vectorworks/draft-js-plugins version:
- plugin name and version:
## Description
diff --git a/.github/workflows/deployWebsite.yml b/.github/workflows/deployWebsite.yml
index f7dcfd70b7..2b0afe6704 100644
--- a/.github/workflows/deployWebsite.yml
+++ b/.github/workflows/deployWebsite.yml
@@ -18,10 +18,10 @@ jobs:
# This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits
fetch-depth: 0
- - name: Setup Node.js 16.x
+ - name: Setup Node.js 24.x
uses: actions/setup-node@v4
with:
- node-version: 16.x
+ node-version: 24.x
- name: Install Dependencies
run: yarn
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 4596a1406f..36b01af5f1 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -5,6 +5,11 @@ on:
branches:
- master
+permissions:
+ contents: write
+ packages: write
+ pull-requests: write
+
jobs:
release:
name: Release
@@ -17,10 +22,12 @@ jobs:
# This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits
fetch-depth: 0
- - name: Setup Node.js 16.x
+ - name: Setup Node.js 24.x
uses: actions/setup-node@v4
with:
- node-version: 16.x
+ node-version: 24.x
+ registry-url: https://npm.pkg.github.com
+ scope: '@vectorworks'
- name: Install Dependencies
run: yarn
@@ -34,4 +41,5 @@ jobs:
title: 'Upcoming Release Changes'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml
index 9d57a1bc45..c53133f9f9 100644
--- a/.github/workflows/tests.yml
+++ b/.github/workflows/tests.yml
@@ -15,7 +15,7 @@ jobs:
strategy:
matrix:
- node-version: [16.x]
+ node-version: [24.x]
steps:
- uses: actions/checkout@v4
diff --git a/.nvmrc b/.nvmrc
index 45a4fb75db..a45fd52cc5 100644
--- a/.nvmrc
+++ b/.nvmrc
@@ -1 +1 @@
-8
+24
diff --git a/.storybook/webpack.config.js b/.storybook/webpack.config.js
index 261f5abab9..b3884d5524 100644
--- a/.storybook/webpack.config.js
+++ b/.storybook/webpack.config.js
@@ -1,7 +1,7 @@
const path = require('path');
const packages = [
- '@draft-js-plugins/editor',
+ ['@vectorworks/draft-js-plugins', 'editor'],
'@draft-js-plugins/hashtag',
'@draft-js-plugins/linkify',
'@draft-js-plugins/anchor',
@@ -27,8 +27,10 @@ const packages = [
];
const packagesAliases = {};
-packages.forEach((name) => {
- const [, folderName] = name.split('/');
+packages.forEach((packageDetails) => {
+ const [name, folderName] = Array.isArray(packageDetails)
+ ? packageDetails
+ : [packageDetails, packageDetails.split('/')[1]];
packagesAliases[name] = path.join(
__dirname,
'../packages',
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index aaf9fa0709..37a8fdc414 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -57,7 +57,7 @@ Because of the structure of this repository you can not just use your own fork o
2. Install Yarn `npm install --global yarn` and install node modules `yarn install`
-3. Reference the needed sub packages in your code f.ex. the plugin editor `import PluginEditor from '@draft-js-plugins/editor';`
+3. Reference the needed sub packages in your code f.ex. the plugin editor `import PluginEditor from '@vectorworks/draft-js-plugins';`
4. When using Webpack you need to tell it how to compile the draft-js-plugins code, you do that by adding an additional loader like this:
@@ -91,7 +91,7 @@ module: {
```
resolve: {
alias: {
- '@draft-js-plugins/editor': path.join(__dirname, 'node_modules', 'draft-js-plugins', 'packages', 'plugins-editor', 'src'),
+ '@vectorworks/draft-js-plugins': path.join(__dirname, 'node_modules', 'draft-js-plugins', 'packages', 'plugins-editor', 'src'),
'@draft-js-plugins/hashtag': path.join(__dirname, 'node_modules', 'draft-js-plugins', 'packages', 'hashtag', 'src'),
'@draft-js-plugins/linkify': path.join(__dirname, 'node_modules', 'draft-js-plugins', 'packages', 'linkify', 'src'),
'@draft-js-plugins/mention': path.join(__dirname, 'node_modules', 'draft-js-plugins', 'packages', 'mention', 'src'),
diff --git a/README.md b/README.md
index 7edf487d14..5b98248823 100644
--- a/README.md
+++ b/README.md
@@ -60,19 +60,39 @@ Checkout [the website](https://www.draft-js-plugins.com/)!
First, install the editor with `npm`:
+```sh
+npm config set @vectorworks:registry=https://npm.pkg.github.com
+npm login --scope=@vectorworks --auth-type=legacy --registry=https://npm.pkg.github.com
```
-$ npm install @draft-js-plugins/editor --save
+
+Use a personal access token with the `read:packages` scope when the package is
+private.
+
+```
+$ npm install @vectorworks/draft-js-plugins --save
+```
+
+Draft.js declares its legacy Immutable.js 3 dependency transitively. Add the
+following npm override to your application's `package.json` so it also resolves
+to Immutable.js 5:
+
+```json
+{
+ "overrides": {
+ "immutable": "^5.1.5"
+ }
+}
```
Then import the editor somewhere in your code and you're ready to go!
```js
-import Editor from '@draft-js-plugins/editor';
+import Editor from '@vectorworks/draft-js-plugins';
```
## Documentation
-### @draft-js-plugins/editor
+### @vectorworks/draft-js-plugins
#### Editor
@@ -92,7 +112,7 @@ Usage:
```js
import React, { Component } from 'react';
-import Editor from '@draft-js-plugins/editor';
+import Editor from '@vectorworks/draft-js-plugins';
import createHashtagPlugin from '@draft-js-plugins/hashtag';
import createLinkifyPlugin from '@draft-js-plugins/linkify';
import { EditorState } from 'draft-js';
diff --git a/package.json b/package.json
index f26c0a5e03..af147ef1f5 100644
--- a/package.json
+++ b/package.json
@@ -2,6 +2,9 @@
"name": "draft-js-plugins",
"description": "A Plugin Architecture on top of Draft.JS",
"version": "0.0.0",
+ "engines": {
+ "node": ">=24"
+ },
"author": {
"name": "Nik Graf",
"email": "nik@nikgraf.com",
@@ -13,6 +16,12 @@
"react": "^17.0.2",
"react-dom": "^17.0.2"
},
+ "resolutions": {
+ "immutable": "^5.1.5"
+ },
+ "overrides": {
+ "immutable": "^5.1.5"
+ },
"devDependencies": {
"@babel/core": "7.28.5",
"@babel/plugin-proposal-class-properties": "7.18.6",
@@ -91,7 +100,7 @@
"private": true,
"repository": {
"type": "git",
- "url": "https://github.com/draft-js-plugins/draft-js-plugins.git"
+ "url": "https://github.com/Vectorworks/draft-js-plugins.git"
},
"scripts": {
"alex": "alex README.md",
@@ -104,7 +113,7 @@
"test:jest": "jest",
"test:watch": "yarn test -- --watch",
"build": "yarn build:dts && yarn workspaces run build",
- "build:dts": "yarn workspace @draft-js-plugins/editor run build && yarn workspace @draft-js-plugins/utils run build && yarn workspace @draft-js-plugins/buttons run build",
+ "build:dts": "yarn workspace @vectorworks/draft-js-plugins run build && yarn workspace @draft-js-plugins/utils run build && yarn workspace @draft-js-plugins/buttons run build",
"prerelease": "yarn build",
"release": "changeset publish",
"postinstall": "husky install"
diff --git a/packages/alignment/README.md b/packages/alignment/README.md
index d03e69185d..8803707be9 100644
--- a/packages/alignment/README.md
+++ b/packages/alignment/README.md
@@ -1,6 +1,6 @@
# DraftJS Alignment Plugin
-_This is a plugin for the `@draft-js-plugins/editor`._
+_This is a plugin for the `@vectorworks/draft-js-plugins`._
Usage:
diff --git a/packages/alignment/package.json b/packages/alignment/package.json
index 304523c989..1780a2a764 100644
--- a/packages/alignment/package.json
+++ b/packages/alignment/package.json
@@ -30,7 +30,7 @@
"build": "yarn build:js && yarn build:dts && yarn build:css",
"build:js": "yarn rollup --config ../../rollup.config.js",
"build:dts": "tsc -d",
- "build:css": "node ../../scripts/build-css.js $(pwd)",
+ "build:css": "node ../../scripts/build-css.js",
"test": "jest"
},
"license": "MIT",
@@ -39,6 +39,7 @@
"@draft-js-plugins/utils": "^4.2.1"
},
"peerDependencies": {
+ "@vectorworks/draft-js-plugins": "^4.1.4",
"draft-js": "^0.10.1 || ^0.11.0",
"react": "^16.8.0 || ^17.0.0 || >=18.0.0",
"react-dom": "^16.8.0 || ^17.0.0 || >=18.0.0"
diff --git a/packages/alignment/src/index.tsx b/packages/alignment/src/index.tsx
index 3b9216ef4e..f1962dfdcc 100644
--- a/packages/alignment/src/index.tsx
+++ b/packages/alignment/src/index.tsx
@@ -1,6 +1,6 @@
import React, { ComponentType, ReactElement } from 'react';
import { ContentBlock, EditorState } from 'draft-js';
-import { EditorPlugin } from '@draft-js-plugins/editor';
+import { EditorPlugin } from '@vectorworks/draft-js-plugins';
import { createStore, Store } from '@draft-js-plugins/utils';
import createDecorator from './createDecorator';
import AlignmentTool from './AlignmentTool';
diff --git a/packages/anchor/README.md b/packages/anchor/README.md
index 8e0b2eccc6..f81395bd47 100644
--- a/packages/anchor/README.md
+++ b/packages/anchor/README.md
@@ -1,6 +1,6 @@
# Draft.js Link Plugin
-_This is a plugin for the `@draft-js-plugins/editor`._
+_This is a plugin for the `@vectorworks/draft-js-plugins`._
This plugin allows you to add link entities via the [inline toolbar](https://www.draft-js-plugins.com/plugin/inline-toolbar). It also provides a decorator that formats the created entities. HTTP, HTTPS, as well as email addresses (with or without mailto: attached to it) are supported.
diff --git a/packages/anchor/package.json b/packages/anchor/package.json
index bc390f3b8d..5bf24849c3 100644
--- a/packages/anchor/package.json
+++ b/packages/anchor/package.json
@@ -32,7 +32,7 @@
"build": "yarn build:js && yarn build:dts && yarn build:css",
"build:js": "yarn rollup --config ../../rollup.config.js",
"build:dts": "tsc -d",
- "build:css": "node ../../scripts/build-css.js $(pwd)",
+ "build:css": "node ../../scripts/build-css.js",
"test": "jest"
},
"license": "MIT",
@@ -44,6 +44,7 @@
"tlds": "^1.261.0"
},
"peerDependencies": {
+ "@vectorworks/draft-js-plugins": "^4.1.4",
"draft-js": "^0.10.1 || ^0.11.0",
"react": "^16.8.0 || ^17.0.0 || >=18.0.0",
"react-dom": "^16.8.0 || ^17.0.0 || >=18.0.0"
diff --git a/packages/anchor/src/index.tsx b/packages/anchor/src/index.tsx
index 5a9281c778..0bbcc2b755 100644
--- a/packages/anchor/src/index.tsx
+++ b/packages/anchor/src/index.tsx
@@ -3,7 +3,7 @@ import React, {
ComponentType,
ReactElement,
} from 'react';
-import { EditorPlugin } from '@draft-js-plugins/editor';
+import { EditorPlugin } from '@vectorworks/draft-js-plugins';
import EditorUtils from '@draft-js-plugins/utils';
import { EditorState } from 'draft-js';
import DefaultLink, { LinkPubProps } from './components/Link';
diff --git a/packages/counter/README.md b/packages/counter/README.md
index 31c9c71318..aac523f10a 100644
--- a/packages/counter/README.md
+++ b/packages/counter/README.md
@@ -1,6 +1,6 @@
# DraftJS Counter Plugin
-_This is a plugin for the `@draft-js-plugins/editor`._
+_This is a plugin for the `@vectorworks/draft-js-plugins`._
This plugin adds character and word counting functionality to your editor!
diff --git a/packages/counter/package.json b/packages/counter/package.json
index 6cbac8d592..f6cbc0c889 100644
--- a/packages/counter/package.json
+++ b/packages/counter/package.json
@@ -31,7 +31,7 @@
"build": "yarn build:js && yarn build:dts && yarn build:css",
"build:js": "yarn rollup --config ../../rollup.config.js",
"build:dts": "tsc -d --emitDeclarationOnly --declarationDir lib",
- "build:css": "node ../../scripts/build-css.js $(pwd)",
+ "build:css": "node ../../scripts/build-css.js",
"test": "jest"
},
"license": "MIT",
@@ -41,6 +41,7 @@
"punycode": "^2.3.1"
},
"peerDependencies": {
+ "@vectorworks/draft-js-plugins": "^4.1.4",
"draft-js": "^0.10.1 || ^0.11.0",
"react": "^16.8.0 || ^17.0.0 || >=18.0.0",
"react-dom": "^16.8.0 || ^17.0.0 || >=18.0.0"
diff --git a/packages/counter/src/CharCounter/__test__/index.test.tsx b/packages/counter/src/CharCounter/__test__/index.test.tsx
index 47a0876281..aec8004bdd 100644
--- a/packages/counter/src/CharCounter/__test__/index.test.tsx
+++ b/packages/counter/src/CharCounter/__test__/index.test.tsx
@@ -1,6 +1,6 @@
import React from 'react';
import { screen, render } from '@testing-library/react';
-import { PluginFunctions } from '@draft-js-plugins/editor';
+import { PluginFunctions } from '@vectorworks/draft-js-plugins';
import { EditorState, ContentState } from 'draft-js';
import createCounterPlugin from '../../index';
diff --git a/packages/counter/src/CustomCounter/__test__/index.test.tsx b/packages/counter/src/CustomCounter/__test__/index.test.tsx
index 5c0ebe1060..d53f7507df 100644
--- a/packages/counter/src/CustomCounter/__test__/index.test.tsx
+++ b/packages/counter/src/CustomCounter/__test__/index.test.tsx
@@ -1,7 +1,7 @@
import React from 'react';
import { screen, render } from '@testing-library/react';
import { EditorState, ContentState } from 'draft-js';
-import { PluginFunctions } from '@draft-js-plugins/editor';
+import { PluginFunctions } from '@vectorworks/draft-js-plugins';
import createCounterPlugin from '../../index';
jest.mock('linaria');
diff --git a/packages/counter/src/LineCounter/__test__/index.test.tsx b/packages/counter/src/LineCounter/__test__/index.test.tsx
index 0625deb938..c7a353ff99 100644
--- a/packages/counter/src/LineCounter/__test__/index.test.tsx
+++ b/packages/counter/src/LineCounter/__test__/index.test.tsx
@@ -1,7 +1,7 @@
import React from 'react';
import { screen, render } from '@testing-library/react';
import { EditorState, ContentState } from 'draft-js';
-import { PluginFunctions } from '@draft-js-plugins/editor';
+import { PluginFunctions } from '@vectorworks/draft-js-plugins';
import createCounterPlugin from '../../index';
jest.mock('linaria');
diff --git a/packages/counter/src/WordCounter/__test__/index.test.tsx b/packages/counter/src/WordCounter/__test__/index.test.tsx
index 0132d420fe..84b219e95d 100644
--- a/packages/counter/src/WordCounter/__test__/index.test.tsx
+++ b/packages/counter/src/WordCounter/__test__/index.test.tsx
@@ -1,7 +1,7 @@
import React from 'react';
import { screen, render } from '@testing-library/react';
import { EditorState, ContentState } from 'draft-js';
-import { PluginFunctions } from '@draft-js-plugins/editor';
+import { PluginFunctions } from '@vectorworks/draft-js-plugins';
import createCounterPlugin from '../../index';
jest.mock('linaria');
diff --git a/packages/counter/src/index.tsx b/packages/counter/src/index.tsx
index da3ca8632d..6b50bc1957 100644
--- a/packages/counter/src/index.tsx
+++ b/packages/counter/src/index.tsx
@@ -1,6 +1,6 @@
import React, { ComponentType, ReactElement } from 'react';
import { EditorState } from 'draft-js';
-import { EditorPlugin } from '@draft-js-plugins/editor';
+import { EditorPlugin } from '@vectorworks/draft-js-plugins';
import CharCounter, { CharCounterPubProps } from './CharCounter';
import WordCounter, { WordCounterPubParams } from './WordCounter';
import LineCounter, { LineCounterPubParams } from './LineCounter';
diff --git a/packages/divider/README.md b/packages/divider/README.md
index a1aec54ce5..3b48f3d244 100644
--- a/packages/divider/README.md
+++ b/packages/divider/README.md
@@ -1,6 +1,6 @@
# DraftJS Divider Plugin
-_This is a plugin for the `@draft-js-plugins/editor`._
+_This is a plugin for the `@vectorworks/draft-js-plugins`._
## Usage
diff --git a/packages/divider/package.json b/packages/divider/package.json
index 096b0b7ff8..847acafaeb 100644
--- a/packages/divider/package.json
+++ b/packages/divider/package.json
@@ -31,7 +31,7 @@
"build": "yarn build:js && yarn build:dts && yarn build:css",
"build:js": "yarn rollup --config ../../rollup.config.js",
"build:dts": "tsc -d",
- "build:css": "node ../../scripts/build-css.js $(pwd)",
+ "build:css": "node ../../scripts/build-css.js",
"test": "jest"
},
"license": "MIT",
@@ -40,6 +40,7 @@
"prop-types": "^15.8.1"
},
"peerDependencies": {
+ "@vectorworks/draft-js-plugins": "^4.1.4",
"draft-js": "^0.10.1 || ^0.11.0",
"react": "^16.8.0 || ^17.0.0 || >=18.0.0",
"react-dom": "^16.8.0 || ^17.0.0 || >=18.0.0"
diff --git a/packages/divider/src/index.tsx b/packages/divider/src/index.tsx
index 97e5f43a70..0ccf6bad78 100644
--- a/packages/divider/src/index.tsx
+++ b/packages/divider/src/index.tsx
@@ -1,5 +1,5 @@
import React, { ComponentType, ReactElement } from 'react';
-import { EditorPlugin } from '@draft-js-plugins/editor';
+import { EditorPlugin } from '@vectorworks/draft-js-plugins';
import DefaultDivider, {
DefaultDividerProps,
} from './components/DefaultDivider';
diff --git a/packages/docs/components/Examples/alignment/SimpleAlignmentEditor/index.js b/packages/docs/components/Examples/alignment/SimpleAlignmentEditor/index.js
index 4e55295f47..c456cd774e 100644
--- a/packages/docs/components/Examples/alignment/SimpleAlignmentEditor/index.js
+++ b/packages/docs/components/Examples/alignment/SimpleAlignmentEditor/index.js
@@ -4,9 +4,9 @@ import {
DefaultDraftBlockRenderMap,
EditorState,
} from 'draft-js';
-import Immutable from 'immutable';
+import { Map } from 'immutable';
-import Editor, { composeDecorators } from '@draft-js-plugins/editor';
+import Editor, { composeDecorators } from '@vectorworks/draft-js-plugins';
import createAlignmentPlugin from '@draft-js-plugins/alignment';
@@ -79,7 +79,7 @@ function BlockWrapper({ children }) {
return {children}
;
}
-const blockRenderMap = Immutable.Map({
+const blockRenderMap = Map({
atomic: {
element: 'figure',
wrapper: ,
diff --git a/packages/docs/components/Examples/alignment/ThemedAlignmentEditor/index.js b/packages/docs/components/Examples/alignment/ThemedAlignmentEditor/index.js
index 85fb50015a..bbc5f224a8 100644
--- a/packages/docs/components/Examples/alignment/ThemedAlignmentEditor/index.js
+++ b/packages/docs/components/Examples/alignment/ThemedAlignmentEditor/index.js
@@ -4,8 +4,8 @@ import {
DefaultDraftBlockRenderMap,
EditorState,
} from 'draft-js';
-import Immutable from 'immutable';
-import Editor, { composeDecorators } from '@draft-js-plugins/editor';
+import { Map } from 'immutable';
+import Editor, { composeDecorators } from '@vectorworks/draft-js-plugins';
import createAlignmentPlugin from '@draft-js-plugins/alignment';
import createFocusPlugin from '@draft-js-plugins/focus';
import createColorBlockPlugin from './colorBlockPlugin';
@@ -83,7 +83,7 @@ function BlockWrapper({ children }) {
return {children}
;
}
-const blockRenderMap = Immutable.Map({
+const blockRenderMap = Map({
atomic: {
element: 'figure',
wrapper: ,
diff --git a/packages/docs/components/Examples/anchor/CustomInlineToolbarEditor/index.js b/packages/docs/components/Examples/anchor/CustomInlineToolbarEditor/index.js
index 4a15f1cf2b..2fba5f5f7d 100644
--- a/packages/docs/components/Examples/anchor/CustomInlineToolbarEditor/index.js
+++ b/packages/docs/components/Examples/anchor/CustomInlineToolbarEditor/index.js
@@ -1,5 +1,5 @@
import React, { Component } from 'react';
-import Editor, { createEditorStateWithText } from '@draft-js-plugins/editor';
+import Editor, { createEditorStateWithText } from '@vectorworks/draft-js-plugins';
import createInlineToolbarPlugin from '@draft-js-plugins/inline-toolbar';
import createLinkPlugin from '@draft-js-plugins/anchor';
import {
diff --git a/packages/docs/components/Examples/anchor/SimpleLinkPluginEditor/index.js b/packages/docs/components/Examples/anchor/SimpleLinkPluginEditor/index.js
index 4e11bcdaf0..2c92eff049 100644
--- a/packages/docs/components/Examples/anchor/SimpleLinkPluginEditor/index.js
+++ b/packages/docs/components/Examples/anchor/SimpleLinkPluginEditor/index.js
@@ -1,5 +1,5 @@
import React, { Component } from 'react';
-import Editor, { createEditorStateWithText } from '@draft-js-plugins/editor';
+import Editor, { createEditorStateWithText } from '@vectorworks/draft-js-plugins';
import createInlineToolbarPlugin from '@draft-js-plugins/inline-toolbar';
import createLinkPlugin from '@draft-js-plugins/anchor';
import {
diff --git a/packages/docs/components/Examples/anchor/gettingStarted.js b/packages/docs/components/Examples/anchor/gettingStarted.js
index 7cc606f643..6f7125b939 100644
--- a/packages/docs/components/Examples/anchor/gettingStarted.js
+++ b/packages/docs/components/Examples/anchor/gettingStarted.js
@@ -1,5 +1,5 @@
// It is important to import the Editor which accepts plugins.
-import Editor from '@draft-js-plugins/editor';
+import Editor from '@vectorworks/draft-js-plugins';
import createLinkPlugin from '@draft-js-plugins/anchor';
import createInlineToolbarPlugin from '@draft-js-plugins/inline-toolbar';
import {
diff --git a/packages/docs/components/Examples/counter/CustomCounterEditor/index.js b/packages/docs/components/Examples/counter/CustomCounterEditor/index.js
index f61cb95fbd..6ee8ccdb45 100644
--- a/packages/docs/components/Examples/counter/CustomCounterEditor/index.js
+++ b/packages/docs/components/Examples/counter/CustomCounterEditor/index.js
@@ -1,5 +1,5 @@
import React, { Component } from 'react';
-import Editor, { createEditorStateWithText } from '@draft-js-plugins/editor';
+import Editor, { createEditorStateWithText } from '@vectorworks/draft-js-plugins';
import createCounterPlugin from '@draft-js-plugins/counter';
import editorStyles from './editorStyles.module.css';
import counterStyles from './counterStyles.module.css';
diff --git a/packages/docs/components/Examples/counter/SimpleCounterEditor/index.js b/packages/docs/components/Examples/counter/SimpleCounterEditor/index.js
index 2651e96615..657a4ed8c8 100644
--- a/packages/docs/components/Examples/counter/SimpleCounterEditor/index.js
+++ b/packages/docs/components/Examples/counter/SimpleCounterEditor/index.js
@@ -1,5 +1,5 @@
import React, { Component } from 'react';
-import Editor, { createEditorStateWithText } from '@draft-js-plugins/editor';
+import Editor, { createEditorStateWithText } from '@vectorworks/draft-js-plugins';
import createCounterPlugin from '@draft-js-plugins/counter';
import editorStyles from './editorStyles.module.css';
diff --git a/packages/docs/components/Examples/counter/gettingStarted.js b/packages/docs/components/Examples/counter/gettingStarted.js
index dcbcf0e956..dcd47e5d1d 100644
--- a/packages/docs/components/Examples/counter/gettingStarted.js
+++ b/packages/docs/components/Examples/counter/gettingStarted.js
@@ -1,5 +1,5 @@
// It is important to import the Editor which accepts plugins.
-import Editor from '@draft-js-plugins/editor';
+import Editor from '@vectorworks/draft-js-plugins';
import createCounterPlugin from '@draft-js-plugins/counter';
import React from 'react';
diff --git a/packages/docs/components/Examples/divider/DividerWithSideToolbarEditor/index.js b/packages/docs/components/Examples/divider/DividerWithSideToolbarEditor/index.js
index f290722248..e04fbf3968 100644
--- a/packages/docs/components/Examples/divider/DividerWithSideToolbarEditor/index.js
+++ b/packages/docs/components/Examples/divider/DividerWithSideToolbarEditor/index.js
@@ -1,7 +1,7 @@
import React, { Component } from 'react';
import { convertFromRaw, EditorState } from 'draft-js';
-import Editor, { composeDecorators } from '@draft-js-plugins/editor';
+import Editor, { composeDecorators } from '@vectorworks/draft-js-plugins';
import createFocusPlugin from '@draft-js-plugins/focus';
import createSideToolbarPlugin from '@draft-js-plugins/side-toolbar';
import createDividerPlugin from '@draft-js-plugins/divider';
diff --git a/packages/docs/components/Examples/divider/gettingStarted.js b/packages/docs/components/Examples/divider/gettingStarted.js
index 13f4918c63..575436684a 100644
--- a/packages/docs/components/Examples/divider/gettingStarted.js
+++ b/packages/docs/components/Examples/divider/gettingStarted.js
@@ -1,6 +1,6 @@
// It is important to import the Editor which accepts plugins.
-import Editor from '@draft-js-plugins/editor';
+import Editor from '@vectorworks/draft-js-plugins';
import createDividerPlugin from '@draft-js-plugins/divider';
import React from 'react';
diff --git a/packages/docs/components/Examples/drag-n-drop/CustomImageEditor/index.js b/packages/docs/components/Examples/drag-n-drop/CustomImageEditor/index.js
index 49b63bea63..05da177d9d 100644
--- a/packages/docs/components/Examples/drag-n-drop/CustomImageEditor/index.js
+++ b/packages/docs/components/Examples/drag-n-drop/CustomImageEditor/index.js
@@ -1,7 +1,7 @@
import React, { Component } from 'react';
import { convertFromRaw, EditorState } from 'draft-js';
-import Editor, { composeDecorators } from '@draft-js-plugins/editor';
+import Editor, { composeDecorators } from '@vectorworks/draft-js-plugins';
import createImagePlugin from '@draft-js-plugins/image';
diff --git a/packages/docs/components/Examples/drag-n-drop/gettingStarted.js b/packages/docs/components/Examples/drag-n-drop/gettingStarted.js
index 5b8c26b131..392dadfe71 100644
--- a/packages/docs/components/Examples/drag-n-drop/gettingStarted.js
+++ b/packages/docs/components/Examples/drag-n-drop/gettingStarted.js
@@ -1,6 +1,6 @@
// It is important to import the Editor which accepts plugins.
-import Editor from '@draft-js-plugins/editor';
+import Editor from '@vectorworks/draft-js-plugins';
import createImagePlugin from '@draft-js-plugins/image';
import React from 'react';
diff --git a/packages/docs/components/Examples/emoji/CustomEmojiEditor/index.js b/packages/docs/components/Examples/emoji/CustomEmojiEditor/index.js
index 8b95e2a234..d60d3ffdf4 100644
--- a/packages/docs/components/Examples/emoji/CustomEmojiEditor/index.js
+++ b/packages/docs/components/Examples/emoji/CustomEmojiEditor/index.js
@@ -1,5 +1,5 @@
import React, { Component } from 'react';
-import Editor, { createEditorStateWithText } from '@draft-js-plugins/editor';
+import Editor, { createEditorStateWithText } from '@vectorworks/draft-js-plugins';
import createEmojiPlugin from '@draft-js-plugins/emoji';
import editorStyles from './editorStyles.module.css';
diff --git a/packages/docs/components/Examples/emoji/SimpleEmojiEditor/index.js b/packages/docs/components/Examples/emoji/SimpleEmojiEditor/index.js
index cc8d1d41da..b3a1280da5 100644
--- a/packages/docs/components/Examples/emoji/SimpleEmojiEditor/index.js
+++ b/packages/docs/components/Examples/emoji/SimpleEmojiEditor/index.js
@@ -1,5 +1,5 @@
import React, { Component } from 'react';
-import Editor, { createEditorStateWithText } from '@draft-js-plugins/editor';
+import Editor, { createEditorStateWithText } from '@vectorworks/draft-js-plugins';
import createEmojiPlugin from '@draft-js-plugins/emoji';
import editorStyles from './editorStyles.module.css';
diff --git a/packages/docs/components/Examples/emoji/gettingStarted.js b/packages/docs/components/Examples/emoji/gettingStarted.js
index 0058cec2bc..d2c62a06ec 100644
--- a/packages/docs/components/Examples/emoji/gettingStarted.js
+++ b/packages/docs/components/Examples/emoji/gettingStarted.js
@@ -1,5 +1,5 @@
// It is important to import the Editor which accepts plugins.
-import Editor from '@draft-js-plugins/editor';
+import Editor from '@vectorworks/draft-js-plugins';
import createEmojiPlugin from '@draft-js-plugins/emoji';
import React from 'react';
diff --git a/packages/docs/components/Examples/focus/SimpleFocusEditor/index.js b/packages/docs/components/Examples/focus/SimpleFocusEditor/index.js
index 362d85343b..632c351bab 100644
--- a/packages/docs/components/Examples/focus/SimpleFocusEditor/index.js
+++ b/packages/docs/components/Examples/focus/SimpleFocusEditor/index.js
@@ -1,7 +1,7 @@
import React, { Component } from 'react';
import { convertFromRaw, EditorState } from 'draft-js';
-import Editor, { composeDecorators } from '@draft-js-plugins/editor';
+import Editor, { composeDecorators } from '@vectorworks/draft-js-plugins';
import createFocusPlugin from '@draft-js-plugins/focus';
import createColorBlockPlugin from './colorBlockPlugin';
diff --git a/packages/docs/components/Examples/hashtag/CustomHashtagEditor/index.js b/packages/docs/components/Examples/hashtag/CustomHashtagEditor/index.js
index bdad3d7fbb..7cba84d824 100644
--- a/packages/docs/components/Examples/hashtag/CustomHashtagEditor/index.js
+++ b/packages/docs/components/Examples/hashtag/CustomHashtagEditor/index.js
@@ -1,5 +1,5 @@
import React, { Component } from 'react';
-import Editor, { createEditorStateWithText } from '@draft-js-plugins/editor';
+import Editor, { createEditorStateWithText } from '@vectorworks/draft-js-plugins';
import createHashtagPlugin from '@draft-js-plugins/hashtag';
import editorStyles from './editorStyles.module.css';
import hashtagStyles from './hashtagStyles.module.css';
diff --git a/packages/docs/components/Examples/hashtag/SimpleHashtagEditor/index.js b/packages/docs/components/Examples/hashtag/SimpleHashtagEditor/index.js
index 9d85aaf16a..17c74b243e 100644
--- a/packages/docs/components/Examples/hashtag/SimpleHashtagEditor/index.js
+++ b/packages/docs/components/Examples/hashtag/SimpleHashtagEditor/index.js
@@ -1,5 +1,5 @@
import React, { Component } from 'react';
-import Editor, { createEditorStateWithText } from '@draft-js-plugins/editor';
+import Editor, { createEditorStateWithText } from '@vectorworks/draft-js-plugins';
import createHashtagPlugin from '@draft-js-plugins/hashtag';
import editorStyles from './editorStyles.module.css';
diff --git a/packages/docs/components/Examples/hashtag/gettingStarted.js b/packages/docs/components/Examples/hashtag/gettingStarted.js
index 21319c38a9..eabe72a405 100644
--- a/packages/docs/components/Examples/hashtag/gettingStarted.js
+++ b/packages/docs/components/Examples/hashtag/gettingStarted.js
@@ -1,5 +1,5 @@
// It is important to import the Editor which accepts plugins.
-import Editor from '@draft-js-plugins/editor';
+import Editor from '@vectorworks/draft-js-plugins';
import createHashtagPlugin from '@draft-js-plugins/hashtag';
import React from 'react';
diff --git a/packages/docs/components/Examples/image/AddImageEditor/index.js b/packages/docs/components/Examples/image/AddImageEditor/index.js
index c8e98675e7..72e4bfaf08 100644
--- a/packages/docs/components/Examples/image/AddImageEditor/index.js
+++ b/packages/docs/components/Examples/image/AddImageEditor/index.js
@@ -1,6 +1,6 @@
import React, { Component } from 'react';
-import Editor, { createEditorStateWithText } from '@draft-js-plugins/editor';
+import Editor, { createEditorStateWithText } from '@vectorworks/draft-js-plugins';
import createImagePlugin from '@draft-js-plugins/image';
import ImageAdd from './ImageAdd';
diff --git a/packages/docs/components/Examples/image/CustomImageEditor/index.js b/packages/docs/components/Examples/image/CustomImageEditor/index.js
index e006e51cd2..f88ab8a315 100644
--- a/packages/docs/components/Examples/image/CustomImageEditor/index.js
+++ b/packages/docs/components/Examples/image/CustomImageEditor/index.js
@@ -1,7 +1,7 @@
import React, { Component } from 'react';
import { convertFromRaw, EditorState } from 'draft-js';
-import Editor, { composeDecorators } from '@draft-js-plugins/editor';
+import Editor, { composeDecorators } from '@vectorworks/draft-js-plugins';
import createImagePlugin from '@draft-js-plugins/image';
diff --git a/packages/docs/components/Examples/image/SimpleImageEditor/index.js b/packages/docs/components/Examples/image/SimpleImageEditor/index.js
index d0d871bb33..e5c3bfd283 100644
--- a/packages/docs/components/Examples/image/SimpleImageEditor/index.js
+++ b/packages/docs/components/Examples/image/SimpleImageEditor/index.js
@@ -1,7 +1,7 @@
import React, { Component } from 'react';
import { convertFromRaw, EditorState } from 'draft-js';
-import Editor from '@draft-js-plugins/editor';
+import Editor from '@vectorworks/draft-js-plugins';
import createImagePlugin from '@draft-js-plugins/image';
import editorStyles from './editorStyles.module.css';
diff --git a/packages/docs/components/Examples/image/gettingStarted.js b/packages/docs/components/Examples/image/gettingStarted.js
index 5b8c26b131..392dadfe71 100644
--- a/packages/docs/components/Examples/image/gettingStarted.js
+++ b/packages/docs/components/Examples/image/gettingStarted.js
@@ -1,6 +1,6 @@
// It is important to import the Editor which accepts plugins.
-import Editor from '@draft-js-plugins/editor';
+import Editor from '@vectorworks/draft-js-plugins';
import createImagePlugin from '@draft-js-plugins/image';
import React from 'react';
diff --git a/packages/docs/components/Examples/inline-toolbar/CustomInlineToolbarEditor/index.js b/packages/docs/components/Examples/inline-toolbar/CustomInlineToolbarEditor/index.js
index 0e8d300d8c..5d3640626d 100644
--- a/packages/docs/components/Examples/inline-toolbar/CustomInlineToolbarEditor/index.js
+++ b/packages/docs/components/Examples/inline-toolbar/CustomInlineToolbarEditor/index.js
@@ -1,7 +1,7 @@
/* eslint-disable react/no-multi-comp */
import React, { Component } from 'react';
-import Editor, { createEditorStateWithText } from '@draft-js-plugins/editor';
+import Editor, { createEditorStateWithText } from '@vectorworks/draft-js-plugins';
import createInlineToolbarPlugin, {
Separator,
diff --git a/packages/docs/components/Examples/inline-toolbar/SimpleInlineToolbarEditor/index.tsx b/packages/docs/components/Examples/inline-toolbar/SimpleInlineToolbarEditor/index.tsx
index be535322f1..a80af164e6 100644
--- a/packages/docs/components/Examples/inline-toolbar/SimpleInlineToolbarEditor/index.tsx
+++ b/packages/docs/components/Examples/inline-toolbar/SimpleInlineToolbarEditor/index.tsx
@@ -6,7 +6,7 @@ import React, {
useState,
} from 'react';
import { EditorState } from 'draft-js';
-import Editor, { createEditorStateWithText } from '@draft-js-plugins/editor';
+import Editor, { createEditorStateWithText } from '@vectorworks/draft-js-plugins';
import createInlineToolbarPlugin from '@draft-js-plugins/inline-toolbar';
import editorStyles from './editorStyles.module.css';
diff --git a/packages/docs/components/Examples/inline-toolbar/ThemedInlineToolbarEditor/index.js b/packages/docs/components/Examples/inline-toolbar/ThemedInlineToolbarEditor/index.js
index f44c913195..213ca22a09 100644
--- a/packages/docs/components/Examples/inline-toolbar/ThemedInlineToolbarEditor/index.js
+++ b/packages/docs/components/Examples/inline-toolbar/ThemedInlineToolbarEditor/index.js
@@ -1,6 +1,6 @@
import React, { Component } from 'react';
-import Editor, { createEditorStateWithText } from '@draft-js-plugins/editor';
+import Editor, { createEditorStateWithText } from '@vectorworks/draft-js-plugins';
import createInlineToolbarPlugin from '@draft-js-plugins/inline-toolbar';
import editorStyles from './editorStyles.module.css';
diff --git a/packages/docs/components/Examples/inline-toolbar/gettingStarted.js b/packages/docs/components/Examples/inline-toolbar/gettingStarted.js
index 823c2a30c4..88de7a5708 100644
--- a/packages/docs/components/Examples/inline-toolbar/gettingStarted.js
+++ b/packages/docs/components/Examples/inline-toolbar/gettingStarted.js
@@ -1,5 +1,5 @@
// It is important to import the Editor which accepts plugins.
-import Editor from '@draft-js-plugins/editor';
+import Editor from '@vectorworks/draft-js-plugins';
import createInlineToolbarPlugin from '@draft-js-plugins/inline-toolbar';
import React from 'react';
diff --git a/packages/docs/components/Examples/linkify/CustomComponentLinkifyEditor/index.js b/packages/docs/components/Examples/linkify/CustomComponentLinkifyEditor/index.js
index 671f480a45..eef7bb3dff 100644
--- a/packages/docs/components/Examples/linkify/CustomComponentLinkifyEditor/index.js
+++ b/packages/docs/components/Examples/linkify/CustomComponentLinkifyEditor/index.js
@@ -1,6 +1,6 @@
import React, { Component } from 'react';
import { EditorState } from 'draft-js';
-import Editor from '@draft-js-plugins/editor';
+import Editor from '@vectorworks/draft-js-plugins';
import createLinkifyPlugin from '@draft-js-plugins/linkify';
import linkifyIt from 'linkify-it';
import tlds from 'tlds';
diff --git a/packages/docs/components/Examples/linkify/CustomLinkifyEditor/index.js b/packages/docs/components/Examples/linkify/CustomLinkifyEditor/index.js
index 1fdaa12645..148430b79e 100644
--- a/packages/docs/components/Examples/linkify/CustomLinkifyEditor/index.js
+++ b/packages/docs/components/Examples/linkify/CustomLinkifyEditor/index.js
@@ -1,6 +1,6 @@
import React, { Component } from 'react';
import { EditorState } from 'draft-js';
-import Editor from '@draft-js-plugins/editor';
+import Editor from '@vectorworks/draft-js-plugins';
import createLinkifyPlugin from '@draft-js-plugins/linkify';
import editorStyles from './editorStyles.module.css';
diff --git a/packages/docs/components/Examples/linkify/SimpleLinkifyEditor/index.js b/packages/docs/components/Examples/linkify/SimpleLinkifyEditor/index.js
index e4082bdd96..8fdc31f786 100644
--- a/packages/docs/components/Examples/linkify/SimpleLinkifyEditor/index.js
+++ b/packages/docs/components/Examples/linkify/SimpleLinkifyEditor/index.js
@@ -1,6 +1,6 @@
import React, { Component } from 'react';
import { EditorState } from 'draft-js';
-import Editor from '@draft-js-plugins/editor';
+import Editor from '@vectorworks/draft-js-plugins';
import createLinkifyPlugin from '@draft-js-plugins/linkify';
import editorStyles from './editorStyles.module.css';
diff --git a/packages/docs/components/Examples/linkify/gettingStarted.js b/packages/docs/components/Examples/linkify/gettingStarted.js
index bd1cc68eed..aa8cc091cf 100644
--- a/packages/docs/components/Examples/linkify/gettingStarted.js
+++ b/packages/docs/components/Examples/linkify/gettingStarted.js
@@ -1,5 +1,5 @@
// It is important to import the Editor which accepts plugins.
-import Editor from '@draft-js-plugins/editor';
+import Editor from '@vectorworks/draft-js-plugins';
import createLinkifyPlugin from '@draft-js-plugins/linkify';
import React from 'react';
diff --git a/packages/docs/components/Examples/mention/CustomComponentMentionEditor/CustomComponentMentionEditor.tsx b/packages/docs/components/Examples/mention/CustomComponentMentionEditor/CustomComponentMentionEditor.tsx
index e34358f92e..7fb694f4f6 100644
--- a/packages/docs/components/Examples/mention/CustomComponentMentionEditor/CustomComponentMentionEditor.tsx
+++ b/packages/docs/components/Examples/mention/CustomComponentMentionEditor/CustomComponentMentionEditor.tsx
@@ -6,7 +6,7 @@ import React, {
useState,
} from 'react';
import { EditorState } from 'draft-js';
-import Editor from '@draft-js-plugins/editor';
+import Editor from '@vectorworks/draft-js-plugins';
import createMentionPlugin, {
defaultSuggestionsFilter,
} from '@draft-js-plugins/mention';
diff --git a/packages/docs/components/Examples/mention/CustomMentionEditor/CustomMentionEditor.tsx b/packages/docs/components/Examples/mention/CustomMentionEditor/CustomMentionEditor.tsx
index 4dad2b8f45..861da06bab 100644
--- a/packages/docs/components/Examples/mention/CustomMentionEditor/CustomMentionEditor.tsx
+++ b/packages/docs/components/Examples/mention/CustomMentionEditor/CustomMentionEditor.tsx
@@ -7,7 +7,7 @@ import React, {
useState,
} from 'react';
import { EditorState } from 'draft-js';
-import Editor from '@draft-js-plugins/editor';
+import Editor from '@vectorworks/draft-js-plugins';
import createMentionPlugin, {
defaultSuggestionsFilter,
MentionData,
diff --git a/packages/docs/components/Examples/mention/MultiMentionTriggers/MultiMentionTriggers.tsx b/packages/docs/components/Examples/mention/MultiMentionTriggers/MultiMentionTriggers.tsx
index 8bec6320c0..f36f6662d5 100644
--- a/packages/docs/components/Examples/mention/MultiMentionTriggers/MultiMentionTriggers.tsx
+++ b/packages/docs/components/Examples/mention/MultiMentionTriggers/MultiMentionTriggers.tsx
@@ -1,6 +1,6 @@
import React, { ReactElement, useRef, useState, useCallback } from 'react';
import { EditorState } from 'draft-js';
-import Editor from '@draft-js-plugins/editor';
+import Editor from '@vectorworks/draft-js-plugins';
import createMentionPlugin, {
defaultSuggestionsFilter,
} from '@draft-js-plugins/mention';
diff --git a/packages/docs/components/Examples/mention/RemoteMentionEditor/RemoteMentionEditor.tsx b/packages/docs/components/Examples/mention/RemoteMentionEditor/RemoteMentionEditor.tsx
index ba67c85dd2..9953e28445 100644
--- a/packages/docs/components/Examples/mention/RemoteMentionEditor/RemoteMentionEditor.tsx
+++ b/packages/docs/components/Examples/mention/RemoteMentionEditor/RemoteMentionEditor.tsx
@@ -7,7 +7,7 @@ import React, {
} from 'react';
import { EditorState } from 'draft-js';
-import Editor from '@draft-js-plugins/editor';
+import Editor from '@vectorworks/draft-js-plugins';
import createMentionPlugin from '@draft-js-plugins/mention';
import editorStyles from './RemoteMentionEditor.module.css';
diff --git a/packages/docs/components/Examples/mention/SimpleMentionEditor/SimpleMentionEditor.tsx b/packages/docs/components/Examples/mention/SimpleMentionEditor/SimpleMentionEditor.tsx
index c16ab8d6d9..0ce942dc67 100644
--- a/packages/docs/components/Examples/mention/SimpleMentionEditor/SimpleMentionEditor.tsx
+++ b/packages/docs/components/Examples/mention/SimpleMentionEditor/SimpleMentionEditor.tsx
@@ -6,7 +6,7 @@ import React, {
useState,
} from 'react';
import { EditorState } from 'draft-js';
-import Editor from '@draft-js-plugins/editor';
+import Editor from '@vectorworks/draft-js-plugins';
import createMentionPlugin, {
defaultSuggestionsFilter,
} from '@draft-js-plugins/mention';
diff --git a/packages/docs/components/Examples/resizeable/SimpleResizeableEditor/index.js b/packages/docs/components/Examples/resizeable/SimpleResizeableEditor/index.js
index 7c479200cf..7812cc0a38 100644
--- a/packages/docs/components/Examples/resizeable/SimpleResizeableEditor/index.js
+++ b/packages/docs/components/Examples/resizeable/SimpleResizeableEditor/index.js
@@ -1,7 +1,7 @@
import React, { Component } from 'react';
import { convertFromRaw, EditorState } from 'draft-js';
-import Editor, { composeDecorators } from '@draft-js-plugins/editor';
+import Editor, { composeDecorators } from '@vectorworks/draft-js-plugins';
import createResizeablePlugin from '@draft-js-plugins/resizeable';
diff --git a/packages/docs/components/Examples/side-toolbar/CustomSideToolbarEditor/index.js b/packages/docs/components/Examples/side-toolbar/CustomSideToolbarEditor/index.js
index e8d6e8c081..4754c00ea3 100644
--- a/packages/docs/components/Examples/side-toolbar/CustomSideToolbarEditor/index.js
+++ b/packages/docs/components/Examples/side-toolbar/CustomSideToolbarEditor/index.js
@@ -1,6 +1,6 @@
import React, { Component } from 'react';
-import Editor, { createEditorStateWithText } from '@draft-js-plugins/editor';
+import Editor, { createEditorStateWithText } from '@vectorworks/draft-js-plugins';
import {
HeadlineOneButton,
HeadlineTwoButton,
diff --git a/packages/docs/components/Examples/side-toolbar/SimpleSideToolbarEditor/index.js b/packages/docs/components/Examples/side-toolbar/SimpleSideToolbarEditor/index.js
index 5efadb66b5..e4595d80b3 100644
--- a/packages/docs/components/Examples/side-toolbar/SimpleSideToolbarEditor/index.js
+++ b/packages/docs/components/Examples/side-toolbar/SimpleSideToolbarEditor/index.js
@@ -1,5 +1,5 @@
import React, { Component } from 'react';
-import Editor, { createEditorStateWithText } from '@draft-js-plugins/editor';
+import Editor, { createEditorStateWithText } from '@vectorworks/draft-js-plugins';
import createSideToolbarPlugin from '@draft-js-plugins/side-toolbar';
import editorStyles from './editorStyles.module.css';
diff --git a/packages/docs/components/Examples/side-toolbar/gettingStarted.js b/packages/docs/components/Examples/side-toolbar/gettingStarted.js
index 9e8305971d..09ca5f7c10 100644
--- a/packages/docs/components/Examples/side-toolbar/gettingStarted.js
+++ b/packages/docs/components/Examples/side-toolbar/gettingStarted.js
@@ -1,5 +1,5 @@
// It is important to import the Editor which accepts plugins.
-import Editor from '@draft-js-plugins/editor';
+import Editor from '@vectorworks/draft-js-plugins';
import createSideToolbarPlugin from '@draft-js-plugins/side-toolbar';
import React from 'react';
diff --git a/packages/docs/components/Examples/static-toolbar/CustomToolbarEditor/index.js b/packages/docs/components/Examples/static-toolbar/CustomToolbarEditor/index.js
index 739f19b929..14639a2920 100644
--- a/packages/docs/components/Examples/static-toolbar/CustomToolbarEditor/index.js
+++ b/packages/docs/components/Examples/static-toolbar/CustomToolbarEditor/index.js
@@ -1,7 +1,7 @@
/* eslint-disable react/no-multi-comp */
import React, { Component } from 'react';
-import Editor, { createEditorStateWithText } from '@draft-js-plugins/editor';
+import Editor, { createEditorStateWithText } from '@vectorworks/draft-js-plugins';
import createToolbarPlugin, {
Separator,
diff --git a/packages/docs/components/Examples/static-toolbar/SimpleToolbarEditor/index.js b/packages/docs/components/Examples/static-toolbar/SimpleToolbarEditor/index.js
index 46e045026a..11113b1807 100644
--- a/packages/docs/components/Examples/static-toolbar/SimpleToolbarEditor/index.js
+++ b/packages/docs/components/Examples/static-toolbar/SimpleToolbarEditor/index.js
@@ -1,5 +1,5 @@
import React, { Component } from 'react';
-import Editor, { createEditorStateWithText } from '@draft-js-plugins/editor';
+import Editor, { createEditorStateWithText } from '@vectorworks/draft-js-plugins';
import createToolbarPlugin from '@draft-js-plugins/static-toolbar';
import editorStyles from './editorStyles.module.css';
diff --git a/packages/docs/components/Examples/static-toolbar/ThemedToolbarEditor/index.js b/packages/docs/components/Examples/static-toolbar/ThemedToolbarEditor/index.js
index 023a8e92ce..7aaed43f08 100644
--- a/packages/docs/components/Examples/static-toolbar/ThemedToolbarEditor/index.js
+++ b/packages/docs/components/Examples/static-toolbar/ThemedToolbarEditor/index.js
@@ -1,6 +1,6 @@
import React, { Component } from 'react';
-import Editor, { createEditorStateWithText } from '@draft-js-plugins/editor';
+import Editor, { createEditorStateWithText } from '@vectorworks/draft-js-plugins';
import createToolbarPlugin from '@draft-js-plugins/static-toolbar';
import editorStyles from './editorStyles.module.css';
diff --git a/packages/docs/components/Examples/static-toolbar/gettingStarted.js b/packages/docs/components/Examples/static-toolbar/gettingStarted.js
index 07791774fe..9ef92154d5 100644
--- a/packages/docs/components/Examples/static-toolbar/gettingStarted.js
+++ b/packages/docs/components/Examples/static-toolbar/gettingStarted.js
@@ -1,5 +1,5 @@
// It is important to import the Editor which accepts plugins.
-import Editor from '@draft-js-plugins/editor';
+import Editor from '@vectorworks/draft-js-plugins';
import createToolbarPlugin from '@draft-js-plugins/static-toolbar';
import React from 'react';
diff --git a/packages/docs/components/Examples/sticker/CustomStickerEditor/index.js b/packages/docs/components/Examples/sticker/CustomStickerEditor/index.js
index b3edeaf21e..1eb58f3fa4 100644
--- a/packages/docs/components/Examples/sticker/CustomStickerEditor/index.js
+++ b/packages/docs/components/Examples/sticker/CustomStickerEditor/index.js
@@ -1,6 +1,6 @@
import React, { Component } from 'react';
import { EditorState } from 'draft-js';
-import Editor from '@draft-js-plugins/editor';
+import Editor from '@vectorworks/draft-js-plugins';
import createStickerPlugin from '@draft-js-plugins/sticker';
import editorStyles from './editorStyles.module.css';
import stickers from './stickers';
diff --git a/packages/docs/components/Examples/sticker/SimpleStickerEditor/index.js b/packages/docs/components/Examples/sticker/SimpleStickerEditor/index.js
index 1c87f9a276..19f76774a4 100644
--- a/packages/docs/components/Examples/sticker/SimpleStickerEditor/index.js
+++ b/packages/docs/components/Examples/sticker/SimpleStickerEditor/index.js
@@ -1,6 +1,6 @@
import React, { Component } from 'react';
import { EditorState } from 'draft-js';
-import Editor from '@draft-js-plugins/editor';
+import Editor from '@vectorworks/draft-js-plugins';
import createStickerPlugin from '@draft-js-plugins/sticker';
import editorStyles from './editorStyles.module.css';
import stickers from './stickers';
diff --git a/packages/docs/components/Examples/sticker/gettingStarted.js b/packages/docs/components/Examples/sticker/gettingStarted.js
index cafcecc2ec..449fc5e9bc 100644
--- a/packages/docs/components/Examples/sticker/gettingStarted.js
+++ b/packages/docs/components/Examples/sticker/gettingStarted.js
@@ -1,5 +1,5 @@
// It is important to import the Editor which accepts plugins.
-import Editor from '@draft-js-plugins/editor';
+import Editor from '@vectorworks/draft-js-plugins';
import createStickerPlugin from '@draft-js-plugins/sticker';
import React from 'react';
import { fromJS } from 'immutable';
diff --git a/packages/docs/components/Examples/text-alignment/CustomStaticToolbarPlugin/index.js b/packages/docs/components/Examples/text-alignment/CustomStaticToolbarPlugin/index.js
index 01b4e063ae..9807ba4f62 100644
--- a/packages/docs/components/Examples/text-alignment/CustomStaticToolbarPlugin/index.js
+++ b/packages/docs/components/Examples/text-alignment/CustomStaticToolbarPlugin/index.js
@@ -1,5 +1,5 @@
import React, { Component } from 'react';
-import Editor, { createEditorStateWithText } from '@draft-js-plugins/editor';
+import Editor, { createEditorStateWithText } from '@vectorworks/draft-js-plugins';
import createStaticToolbarPlugin from '@draft-js-plugins/static-toolbar';
import createTextAlignmentPlugin from '@draft-js-plugins/text-alignment';
import {
diff --git a/packages/docs/components/Examples/text-alignment/SimpleTextAlignmentPlugin/index.js b/packages/docs/components/Examples/text-alignment/SimpleTextAlignmentPlugin/index.js
index 174e155e5f..0d5ab96674 100644
--- a/packages/docs/components/Examples/text-alignment/SimpleTextAlignmentPlugin/index.js
+++ b/packages/docs/components/Examples/text-alignment/SimpleTextAlignmentPlugin/index.js
@@ -1,5 +1,5 @@
import React, { Component } from 'react';
-import Editor, { createEditorStateWithText } from '@draft-js-plugins/editor';
+import Editor, { createEditorStateWithText } from '@vectorworks/draft-js-plugins';
import createStaticToolbarPlugin from '@draft-js-plugins/static-toolbar';
import createTextAlignmentPlugin from '@draft-js-plugins/text-alignment';
import {
diff --git a/packages/docs/components/Examples/text-alignment/gettingStarted.js b/packages/docs/components/Examples/text-alignment/gettingStarted.js
index e01a2c3dac..54a8e251be 100644
--- a/packages/docs/components/Examples/text-alignment/gettingStarted.js
+++ b/packages/docs/components/Examples/text-alignment/gettingStarted.js
@@ -1,5 +1,5 @@
// It is important to import the Editor which accepts plugins.
-import Editor from '@draft-js-plugins/editor';
+import Editor from '@vectorworks/draft-js-plugins';
import createTextAlignmentPlugin from '@draft-js-plugins/text-alignment';
import createStaticToolbarPlugin from '@draft-js-plugins/static-toolbar';
import {
diff --git a/packages/docs/package.json b/packages/docs/package.json
index 0c8bb8e9f2..7ae9d4f036 100644
--- a/packages/docs/package.json
+++ b/packages/docs/package.json
@@ -12,7 +12,7 @@
"dependencies": {
"animateplus": "1.4.0",
"clsx": "^2.1.1",
- "immutable": "^4.0.0-rc.12",
+ "immutable": "^5.1.5",
"next": "12.3.1",
"prismjs": "^1.30.0",
"react-share": "^4.4.1",
diff --git a/packages/drag-n-drop-upload/README.md b/packages/drag-n-drop-upload/README.md
index c5a5a9cf52..e6517854b0 100644
--- a/packages/drag-n-drop-upload/README.md
+++ b/packages/drag-n-drop-upload/README.md
@@ -1,6 +1,6 @@
# DraftJS Drag & Drop File Upload Plugin
-_This is a plugin for the `@draft-js-plugins/editor`._
+_This is a plugin for the `@vectorworks/draft-js-plugins`._
This plugin adds dropping & uploading files functionality to your editor!
diff --git a/packages/drag-n-drop-upload/package.json b/packages/drag-n-drop-upload/package.json
index 5c4c0bdbf1..5af1b6d0d1 100644
--- a/packages/drag-n-drop-upload/package.json
+++ b/packages/drag-n-drop-upload/package.json
@@ -34,6 +34,7 @@
},
"license": "MIT",
"peerDependencies": {
+ "@vectorworks/draft-js-plugins": "^4.1.4",
"draft-js": "^0.10.1 || ^0.11.0",
"react": "^16.8.0 || ^17.0.0 || >=18.0.0",
"react-dom": "^16.8.0 || ^17.0.0 || >=18.0.0"
diff --git a/packages/drag-n-drop/README.md b/packages/drag-n-drop/README.md
index b487c88674..952de4e1b2 100644
--- a/packages/drag-n-drop/README.md
+++ b/packages/drag-n-drop/README.md
@@ -1,6 +1,6 @@
# DraftJS Block Drag & Drop Plugin
-_This is a plugin for the `@draft-js-plugins/editor`._
+_This is a plugin for the `@vectorworks/draft-js-plugins`._
This plugin adds drag and drop functionality to your editor!
diff --git a/packages/drag-n-drop/package.json b/packages/drag-n-drop/package.json
index 1dcd3ab8a1..fcee3482e7 100644
--- a/packages/drag-n-drop/package.json
+++ b/packages/drag-n-drop/package.json
@@ -34,9 +34,10 @@
},
"license": "MIT",
"dependencies": {
- "immutable": "~3.7.4"
+ "immutable": "^5.1.5"
},
"peerDependencies": {
+ "@vectorworks/draft-js-plugins": "^4.1.4",
"draft-js": "^0.10.1 || ^0.11.0",
"react": "^16.8.0 || ^17.0.0 || >=18.0.0",
"react-dom": "^16.8.0 || ^17.0.0 || >=18.0.0"
diff --git a/packages/drag-n-drop/src/index.tsx b/packages/drag-n-drop/src/index.tsx
index d18f4cb3d7..91f39380e3 100644
--- a/packages/drag-n-drop/src/index.tsx
+++ b/packages/drag-n-drop/src/index.tsx
@@ -1,4 +1,4 @@
-import { EditorPlugin } from '@draft-js-plugins/editor';
+import { EditorPlugin } from '@vectorworks/draft-js-plugins';
import handleDrop from './handleDrop';
import createDecorator from './createDecorator';
diff --git a/packages/drag-n-drop/src/modifiers/addBlock.ts b/packages/drag-n-drop/src/modifiers/addBlock.ts
index 97687fdcba..773c43d12a 100644
--- a/packages/drag-n-drop/src/modifiers/addBlock.ts
+++ b/packages/drag-n-drop/src/modifiers/addBlock.ts
@@ -30,7 +30,7 @@ export default function addBlock(
// deciding on the postion to split the text
const targetSelection = afterRemovalContentState.getSelectionAfter();
- const blockKeyForTarget = targetSelection.get('focusKey');
+ const blockKeyForTarget = targetSelection.getFocusKey();
const block = currentContentState.getBlockForKey(blockKeyForTarget);
let insertionTargetSelection;
let insertionTargetBlock;
@@ -72,6 +72,7 @@ export default function addBlock(
const charData = CharacterMetadata.create({ entity: entityKey });
const fragmentArray = [
+ // @ts-expect-error @types/draft-js does not model ContentBlock's Record initializer with Immutable v5.
new ContentBlock({
key: genKey(),
type,
@@ -80,6 +81,7 @@ export default function addBlock(
}),
// new contentblock so we can continue wrting right away after inserting the block
+ // @ts-expect-error @types/draft-js does not model ContentBlock's Record initializer with Immutable v5.
new ContentBlock({
key: genKey(),
type: 'unstyled',
diff --git a/packages/drag-n-drop/src/modifiers/removeBlock.ts b/packages/drag-n-drop/src/modifiers/removeBlock.ts
index 0ae8b8ea88..d97348b630 100644
--- a/packages/drag-n-drop/src/modifiers/removeBlock.ts
+++ b/packages/drag-n-drop/src/modifiers/removeBlock.ts
@@ -17,14 +17,14 @@ export default function removeBlock(
afterBlock.getLength() === 0 &&
afterBlock === contentState.getBlockMap().last()
) {
- targetRange = new SelectionState({
+ targetRange = new SelectionState().merge({
anchorKey: blockKey,
anchorOffset: 0,
focusKey: afterKey,
focusOffset: 0,
});
} else {
- targetRange = new SelectionState({
+ targetRange = new SelectionState().merge({
anchorKey: blockKey,
anchorOffset: 0,
focusKey: blockKey,
diff --git a/packages/editor/README.md b/packages/editor/README.md
index 669975e055..f6e05e1c1b 100644
--- a/packages/editor/README.md
+++ b/packages/editor/README.md
@@ -1,3 +1,3 @@
-# @draft-js-plugins/editor
+# @vectorworks/draft-js-plugins
Checkout www.draft-js-plugins.com
diff --git a/packages/editor/package.json b/packages/editor/package.json
index 901ad16222..6d661c223d 100644
--- a/packages/editor/package.json
+++ b/packages/editor/package.json
@@ -1,6 +1,9 @@
{
- "name": "@draft-js-plugins/editor",
+ "name": "@vectorworks/draft-js-plugins",
"version": "4.1.4",
+ "engines": {
+ "node": ">=24"
+ },
"sideEffects": false,
"description": "Editor for DraftJS Plugins",
"author": {
@@ -10,7 +13,7 @@
},
"repository": {
"type": "git",
- "url": "https://github.com/draft-js-plugins/draft-js-plugins.git"
+ "url": "https://github.com/Vectorworks/draft-js-plugins.git"
},
"main": "lib/index.cjs.js",
"module": "lib/index.esm.js",
@@ -35,7 +38,7 @@
},
"license": "MIT",
"dependencies": {
- "immutable": "~3.7.4",
+ "immutable": "^5.1.5",
"prop-types": "^15.8.1"
},
"peerDependencies": {
@@ -47,6 +50,6 @@
"@types/draft-js": "^0.11.10"
},
"publishConfig": {
- "access": "public"
+ "registry": "https://npm.pkg.github.com"
}
}
diff --git a/packages/editor/src/Editor/MultiDecorator.ts b/packages/editor/src/Editor/MultiDecorator.ts
index 22f592a255..3d87661121 100644
--- a/packages/editor/src/Editor/MultiDecorator.ts
+++ b/packages/editor/src/Editor/MultiDecorator.ts
@@ -1,15 +1,15 @@
import { CompositeDecorator, ContentBlock, ContentState } from 'draft-js';
-import Immutable from 'immutable';
+import { List } from 'immutable';
const KEY_SEPARATOR = '-';
export default class MultiDecorator {
- decorators: Immutable.List;
+ decorators: List;
constructor(
- decorators: Immutable.List | CompositeDecorator[]
+ decorators: List | CompositeDecorator[]
) {
- this.decorators = Immutable.List(decorators);
+ this.decorators = List(decorators);
}
/**
@@ -18,7 +18,7 @@ export default class MultiDecorator {
getDecorations(
block: ContentBlock,
contentState: ContentState
- ): Immutable.List {
+ ): List {
const decorations: string[] = new Array(block.getText().length).fill(null);
this.decorators.forEach((decorator, i) => {
@@ -33,7 +33,7 @@ export default class MultiDecorator {
});
});
- return Immutable.List(decorations);
+ return List(decorations);
}
/**
@@ -61,7 +61,7 @@ export default class MultiDecorator {
const parts = key.split(KEY_SEPARATOR);
const index = Number(parts[0]);
- return this.decorators.get(index);
+ return this.decorators.get(index)!;
}
/**
diff --git a/packages/editor/src/Editor/__test__/MultiDecorator.test.ts b/packages/editor/src/Editor/__test__/MultiDecorator.test.ts
index 830908332f..260abbbb4d 100644
--- a/packages/editor/src/Editor/__test__/MultiDecorator.test.ts
+++ b/packages/editor/src/Editor/__test__/MultiDecorator.test.ts
@@ -2,9 +2,9 @@ import Draft from 'draft-js';
import MultiDecorator from '../MultiDecorator';
describe('MultiDecorator', () => {
- const contentBlock = new Draft.ContentBlock({
- text: 'AAA BBB CCC ABC',
- });
+ const contentBlock = Draft.ContentState.createFromText(
+ 'AAA BBB CCC ABC'
+ ).getFirstBlock();
const firstDecorator = new Draft.CompositeDecorator([
{
diff --git a/packages/editor/src/Editor/createCompositeDecorator.tsx b/packages/editor/src/Editor/createCompositeDecorator.tsx
index 3ac6c5054e..d2c7677800 100644
--- a/packages/editor/src/Editor/createCompositeDecorator.tsx
+++ b/packages/editor/src/Editor/createCompositeDecorator.tsx
@@ -7,11 +7,11 @@ import { List } from 'immutable';
import React, { ReactElement } from 'react';
export default function createCompositeDecorator(
- decorators: Immutable.List,
+ decorators: List,
getEditorState: () => EditorState,
setEditorState: (state: EditorState) => void
): CompositeDecorator {
- const convertedDecorators = List(decorators)
+ const convertedDecorators = decorators
.map((decorator) => {
const Component = decorator!.component;
const DecoratedComponent = (
@@ -28,7 +28,7 @@ export default function createCompositeDecorator(
component: DecoratedComponent,
};
})
- .toJS();
+ .toArray();
return new CompositeDecorator(convertedDecorators);
}
diff --git a/packages/editor/src/Editor/index.tsx b/packages/editor/src/Editor/index.tsx
index f09925713e..033281647c 100644
--- a/packages/editor/src/Editor/index.tsx
+++ b/packages/editor/src/Editor/index.tsx
@@ -10,7 +10,7 @@ import {
EditorProps,
EditorState,
} from 'draft-js';
-import { Map } from 'immutable';
+import { List } from 'immutable';
import PropTypes from 'prop-types';
import React, { Component, KeyboardEvent, ReactElement } from 'react';
import { AriaProps, EditorPlugin, EditorRef, PluginFunctions } from '..';
@@ -33,7 +33,7 @@ export interface PluginEditorProps extends Omit {
// should be DraftDecoratorType but it is not accessible and does not habe decorators or _decorators
interface DecoratorType {
- decorators?: Immutable.List;
+ decorators?: List;
_decorators?: string[];
}
@@ -228,10 +228,10 @@ class PluginEditor extends Component {
resolveblockRenderMap = (): DraftBlockRenderMap => {
let blockRenderMap = this.props
.plugins!.filter((plug) => plug.blockRenderMap !== undefined)
- .reduce(
+ .reduce(
(maps, plug) => maps.merge(plug.blockRenderMap!),
- Map({})
- ) as DraftBlockRenderMap;
+ DefaultDraftBlockRenderMap.clear()
+ );
if (this.props.defaultBlockRenderMap) {
blockRenderMap = DefaultDraftBlockRenderMap.merge(blockRenderMap);
}
diff --git a/packages/editor/src/Editor/resolveDecorators.ts b/packages/editor/src/Editor/resolveDecorators.ts
index 7bc805845e..82069651fb 100644
--- a/packages/editor/src/Editor/resolveDecorators.ts
+++ b/packages/editor/src/Editor/resolveDecorators.ts
@@ -18,7 +18,7 @@ const getDecoratorsFromProps = ({
}: PluginEditorProps): List =>
List([{ decorators }, ...plugins])
.filter((plugin) => plugin?.decorators !== undefined)
- .flatMap((plugin) => plugin?.decorators) as List<
+ .flatMap((plugin) => plugin!.decorators || []) as List<
CompositeDecorator | DraftDecorator
>;
diff --git a/packages/emoji/README.md b/packages/emoji/README.md
index c67cc3bdad..8669350cbb 100644
--- a/packages/emoji/README.md
+++ b/packages/emoji/README.md
@@ -1,6 +1,6 @@
# DraftJS Emoji Plugin
-_This is a plugin for the `@draft-js-plugins/editor`._
+_This is a plugin for the `@vectorworks/draft-js-plugins`._
This plugin provides consistent Emoji display across all platforms, independent of the host system.
diff --git a/packages/emoji/package.json b/packages/emoji/package.json
index 44c6a1ab23..c42335b6da 100644
--- a/packages/emoji/package.json
+++ b/packages/emoji/package.json
@@ -33,7 +33,7 @@
"build": "yarn build:js && yarn build:dts && yarn build:css",
"build:js": "yarn rollup --config ../../rollup.config.js",
"build:dts": "tsc -d --emitDeclarationOnly --declarationDir lib",
- "build:css": "node ../../scripts/build-css.js $(pwd)",
+ "build:css": "node ../../scripts/build-css.js",
"test": "jest"
},
"license": "MIT",
@@ -46,7 +46,7 @@
"emoji-toolkit": "^7.0",
"emojibase": "^6.1.0",
"emojibase-data": "^7.0.1",
- "immutable": "~3.7.4",
+ "immutable": "^5.1.5",
"lodash": "^4.17.21",
"lodash-es": "^4.17.21",
"prop-types": "^15.8.1",
@@ -56,6 +56,7 @@
"to-style": "^1.3.3"
},
"peerDependencies": {
+ "@vectorworks/draft-js-plugins": "^4.1.4",
"draft-js": "^0.10.1 || ^0.11.0",
"react": "^16.8.0 || ^17.0.0 || >=18.0.0",
"react-dom": "^16.8.0 || ^17.0.0 || >=18.0.0"
diff --git a/packages/emoji/src/components/EmojiSuggestions/index.tsx b/packages/emoji/src/components/EmojiSuggestions/index.tsx
index 15a33fd8c7..1bbbf4ad2a 100644
--- a/packages/emoji/src/components/EmojiSuggestions/index.tsx
+++ b/packages/emoji/src/components/EmojiSuggestions/index.tsx
@@ -12,8 +12,8 @@ import {
SelectionState,
} from 'draft-js';
import utils from '@draft-js-plugins/utils';
-import { AriaProps } from '@draft-js-plugins/editor';
-import { List } from 'immutable';
+import { AriaProps } from '@vectorworks/draft-js-plugins';
+import { is, List, Map } from 'immutable';
import Entry from './Entry';
import {
EmojiImageProps,
@@ -31,6 +31,20 @@ import { EmojiShape } from '../../constants/type';
import Popover from './Popover';
import { warning } from '../../utils/warning';
+interface Leaf {
+ start: number;
+ end: number;
+}
+
+const isLeaf = (value: unknown): value is Leaf => {
+ if (typeof value !== 'object' || value === null) {
+ return false;
+ }
+
+ const { start, end } = value as Record;
+ return typeof start === 'number' && typeof end === 'number';
+};
+
export interface EmojiSuggestionsPubParams {
isActive?: boolean;
focusedOptionIndex?: number;
@@ -60,7 +74,7 @@ export default class EmojiSuggestions extends Component
key!: string;
filteredEmojis?: List;
activeOffsetKey?: string;
- lastSelectionIsInsideWord?: Immutable.Iterable;
+ lastSelectionIsInsideWord?: Map;
lastSearchValue?: string;
UNSAFE_componentWillMount(): void {
@@ -143,16 +157,22 @@ export default class EmojiSuggestions extends Component
);
// a leave can be empty when it is removed due e.g. using backspace
- const leaves = offsetDetails
- .filter((offsetDetail) => offsetDetail!.blockKey === anchorKey)
- .map((offsetDetail) =>
- editorState
+ const leaves = offsetDetails.reduce
-
+
diff --git a/packages/docs/pages/plugin/counter/index.js b/packages/docs/pages/plugin/counter/index.js
index 205b082b63..437d888a34 100644
--- a/packages/docs/pages/plugin/counter/index.js
+++ b/packages/docs/pages/plugin/counter/index.js
@@ -63,7 +63,7 @@ export default class App extends Component {
Getting Started
-
+
Importing the default styles
diff --git a/packages/docs/pages/plugin/divider/index.js b/packages/docs/pages/plugin/divider/index.js
index b070149a19..d48ed31dee 100644
--- a/packages/docs/pages/plugin/divider/index.js
+++ b/packages/docs/pages/plugin/divider/index.js
@@ -33,7 +33,7 @@ export default class App extends Component {
Getting Started
-
+
Importing the default styles
diff --git a/packages/docs/pages/plugin/drag-n-drop/index.js b/packages/docs/pages/plugin/drag-n-drop/index.js
index 3ee1d9dfcd..7054c7990d 100644
--- a/packages/docs/pages/plugin/drag-n-drop/index.js
+++ b/packages/docs/pages/plugin/drag-n-drop/index.js
@@ -35,7 +35,7 @@ export default class App extends Component {
Getting Started
-
+
diff --git a/packages/docs/pages/plugin/emoji/index.js b/packages/docs/pages/plugin/emoji/index.js
index aca6108df2..e54dcbdaf4 100644
--- a/packages/docs/pages/plugin/emoji/index.js
+++ b/packages/docs/pages/plugin/emoji/index.js
@@ -98,7 +98,7 @@ export default class App extends Component {
Getting Started
-
+
Importing the default styles
diff --git a/packages/docs/pages/plugin/focus/index.js b/packages/docs/pages/plugin/focus/index.js
index e0466a0de3..6256e47bc5 100644
--- a/packages/docs/pages/plugin/focus/index.js
+++ b/packages/docs/pages/plugin/focus/index.js
@@ -43,7 +43,7 @@ export default class App extends Component {
Getting Started
-
+
Importing the default styles
diff --git a/packages/docs/pages/plugin/hashtag/index.js b/packages/docs/pages/plugin/hashtag/index.js
index ac44a2e2c5..222c4cc225 100644
--- a/packages/docs/pages/plugin/hashtag/index.js
+++ b/packages/docs/pages/plugin/hashtag/index.js
@@ -51,7 +51,7 @@ export default class App extends Component {
Getting Started
-
+
Importing the default styles
diff --git a/packages/docs/pages/plugin/image/index.js b/packages/docs/pages/plugin/image/index.js
index eca07cf3d2..c073922cd3 100644
--- a/packages/docs/pages/plugin/image/index.js
+++ b/packages/docs/pages/plugin/image/index.js
@@ -49,7 +49,7 @@ export default class App extends Component {
Getting Started
-
+
Importing the default styles
diff --git a/packages/docs/pages/plugin/inline-toolbar/index.js b/packages/docs/pages/plugin/inline-toolbar/index.js
index 025f048b09..428889f017 100644
--- a/packages/docs/pages/plugin/inline-toolbar/index.js
+++ b/packages/docs/pages/plugin/inline-toolbar/index.js
@@ -49,7 +49,7 @@ export default class App extends Component {
Getting Started
-
+
Importing the default styles
diff --git a/packages/docs/pages/plugin/linkify/index.js b/packages/docs/pages/plugin/linkify/index.js
index 455560bab3..7c57676c31 100644
--- a/packages/docs/pages/plugin/linkify/index.js
+++ b/packages/docs/pages/plugin/linkify/index.js
@@ -47,7 +47,7 @@ export default class App extends Component {
Getting Started
-
+
Importing the default styles
diff --git a/packages/docs/pages/plugin/mention/index.tsx b/packages/docs/pages/plugin/mention/index.tsx
index f76a70b3ac..1cb7e6b50e 100644
--- a/packages/docs/pages/plugin/mention/index.tsx
+++ b/packages/docs/pages/plugin/mention/index.tsx
@@ -81,7 +81,7 @@ export default function Mention(): ReactElement {
Getting Started
-
+
Importing the default styles
diff --git a/packages/docs/pages/plugin/resizeable/index.js b/packages/docs/pages/plugin/resizeable/index.js
index 5fc8165adf..9a8c055dd5 100644
--- a/packages/docs/pages/plugin/resizeable/index.js
+++ b/packages/docs/pages/plugin/resizeable/index.js
@@ -47,7 +47,7 @@ export default class App extends Component {
Getting Started
-
+
Notes
diff --git a/packages/docs/pages/plugin/side-toolbar/index.js b/packages/docs/pages/plugin/side-toolbar/index.js
index 780a20391a..38fa54ef4b 100644
--- a/packages/docs/pages/plugin/side-toolbar/index.js
+++ b/packages/docs/pages/plugin/side-toolbar/index.js
@@ -49,7 +49,7 @@ export default class App extends Component {
Getting Started
-
+
Importing the default styles
diff --git a/packages/docs/pages/plugin/static-toolbar/index.js b/packages/docs/pages/plugin/static-toolbar/index.js
index c63f97b031..af9317bd35 100644
--- a/packages/docs/pages/plugin/static-toolbar/index.js
+++ b/packages/docs/pages/plugin/static-toolbar/index.js
@@ -53,7 +53,7 @@ export default class App extends Component {
Getting Started
-
+
Importing the default styles
diff --git a/packages/docs/pages/plugin/sticker/index.js b/packages/docs/pages/plugin/sticker/index.js
index f34184b404..99816827f7 100644
--- a/packages/docs/pages/plugin/sticker/index.js
+++ b/packages/docs/pages/plugin/sticker/index.js
@@ -44,7 +44,7 @@ export default class App extends Component {
Getting Started
-
+
Importing the default styles
diff --git a/packages/docs/pages/plugin/text-alignment/index.js b/packages/docs/pages/plugin/text-alignment/index.js
index 2adfcd8cb2..62ad726359 100644
--- a/packages/docs/pages/plugin/text-alignment/index.js
+++ b/packages/docs/pages/plugin/text-alignment/index.js
@@ -47,7 +47,7 @@ export default class App extends Component {
static toolbar, you can
alos use it with other toolbars.
-
+
diff --git a/packages/docs/pages/plugin/undo/index.js b/packages/docs/pages/plugin/undo/index.js
index 6508fe7121..6d7583a66e 100644
--- a/packages/docs/pages/plugin/undo/index.js
+++ b/packages/docs/pages/plugin/undo/index.js
@@ -43,7 +43,7 @@ export default class App extends Component {
Getting Started
-
+
Importing the default styles
diff --git a/packages/docs/pages/plugin/video/index.js b/packages/docs/pages/plugin/video/index.js
index ab83322774..a210919361 100644
--- a/packages/docs/pages/plugin/video/index.js
+++ b/packages/docs/pages/plugin/video/index.js
@@ -38,7 +38,7 @@ export default class App extends Component {
Getting Started
-
+
diff --git a/packages/drag-n-drop-upload/src/components/UploadPlaceholder.tsx b/packages/drag-n-drop-upload/src/components/UploadPlaceholder.tsx
index 1c12495a61..4ce05b4d2c 100644
--- a/packages/drag-n-drop-upload/src/components/UploadPlaceholder.tsx
+++ b/packages/drag-n-drop-upload/src/components/UploadPlaceholder.tsx
@@ -5,20 +5,20 @@ interface UploadPlaceholderParams {
block: ContentBlock;
blockProps: {
resizeData: {
- name: string,
- progress: string
- }
+ name: string;
+ progress: string;
+ };
};
}
-export default function UploadPlaceholder(props: UploadPlaceholderParams): ReactElement {
- const {
- blockProps,
- block,
- } = props;
+export default function UploadPlaceholder(
+ props: UploadPlaceholderParams
+): ReactElement {
+ const { blockProps, block } = props;
return (
-
- {' '}
+
+ {' '}
);
}
diff --git a/packages/drag-n-drop-upload/src/handleDroppedFiles.ts b/packages/drag-n-drop-upload/src/handleDroppedFiles.ts
index 699e573fe6..fe48862aaa 100644
--- a/packages/drag-n-drop-upload/src/handleDroppedFiles.ts
+++ b/packages/drag-n-drop-upload/src/handleDroppedFiles.ts
@@ -1,4 +1,4 @@
-import { PluginFunctions } from '@draft-js-plugins/editor';
+import { PluginFunctions } from '@vectorworks/draft-js-plugins';
import { DraftHandleValue, EditorState, SelectionState } from 'draft-js';
import { DndUploadPluginConfig, FileToUpload, PlaceholderBlockType } from '.';
import { insertPlaceholder } from './components/insertPlaceholder';
diff --git a/packages/drag-n-drop-upload/src/index.ts b/packages/drag-n-drop-upload/src/index.ts
index 7306aec2ab..d595a7cb69 100644
--- a/packages/drag-n-drop-upload/src/index.ts
+++ b/packages/drag-n-drop-upload/src/index.ts
@@ -1,4 +1,4 @@
-import { EditorPlugin } from '@draft-js-plugins/editor';
+import { EditorPlugin } from '@vectorworks/draft-js-plugins';
import { EditorState } from 'draft-js';
import UploadPlaceholder from './components/UploadPlaceholder';
import handleDroppedFiles, { FileData } from './handleDroppedFiles';
diff --git a/packages/drag-n-drop-upload/src/modifiers/removeBlock.ts b/packages/drag-n-drop-upload/src/modifiers/removeBlock.ts
index 85b848dfa2..827bb94e6c 100644
--- a/packages/drag-n-drop-upload/src/modifiers/removeBlock.ts
+++ b/packages/drag-n-drop-upload/src/modifiers/removeBlock.ts
@@ -2,27 +2,26 @@ import { Modifier, EditorState, SelectionState } from 'draft-js';
export default function removeBlock(
editorState: EditorState,
- blockKey: string,
+ blockKey: string
): EditorState {
-
const content = editorState.getCurrentContent();
const block = content.getBlockForKey(blockKey);
- const targetRange = new SelectionState({
+ const targetRange = new SelectionState().merge({
anchorKey: blockKey,
anchorOffset: 0,
focusKey: blockKey,
focusOffset: block.getLength(),
});
- const withoutBlock = Modifier.removeRange(content, targetRange, "backward");
+ const withoutBlock = Modifier.removeRange(content, targetRange, 'backward');
const resetBlock = Modifier.setBlockType(
withoutBlock,
withoutBlock.getSelectionAfter(),
- "unstyled"
+ 'unstyled'
);
- const newState = EditorState.push(editorState, resetBlock, "remove-range");
+ const newState = EditorState.push(editorState, resetBlock, 'remove-range');
const newStateWithoutBlock = EditorState.forceSelection(
newState,
resetBlock.getSelectionAfter()
diff --git a/packages/drag-n-drop-upload/src/modifiers/replaceBlock.ts b/packages/drag-n-drop-upload/src/modifiers/replaceBlock.ts
index 44a7e6f016..65d63e0a1a 100644
--- a/packages/drag-n-drop-upload/src/modifiers/replaceBlock.ts
+++ b/packages/drag-n-drop-upload/src/modifiers/replaceBlock.ts
@@ -12,7 +12,7 @@ export default function replaceBlock(
): EditorState {
let content = editorState.getCurrentContent();
- const targetRange = new SelectionState({
+ const targetRange = new SelectionState().merge({
anchorKey: blockKey,
anchorOffset: 0,
focusKey: blockKey,
diff --git a/packages/drag-n-drop-upload/src/utils/block.ts b/packages/drag-n-drop-upload/src/utils/block.ts
index f5d286dbf4..71ccd0136e 100644
--- a/packages/drag-n-drop-upload/src/utils/block.ts
+++ b/packages/drag-n-drop-upload/src/utils/block.ts
@@ -1,13 +1,13 @@
-import { ContentBlock, EditorState } from 'draft-js';
+import { BlockMap, ContentBlock, EditorState } from 'draft-js';
import { FileResult } from './file';
// Filter editorState's blockMap
export function getBlocksWhereEntityData(
editorState: EditorState,
filter: (block: FileResult | null) => boolean
-): boolean {
+): BlockMap {
const contentState = editorState.getCurrentContent();
- return contentState.get('blockMap').filter((block: ContentBlock) => {
+ return contentState.getBlockMap().filter((block: ContentBlock) => {
const entityData = block.getEntityAt(0)
? contentState.getEntity(block.getEntityAt(0)).getData()
: null;
diff --git a/packages/drag-n-drop/src/handleDrop.ts b/packages/drag-n-drop/src/handleDrop.ts
index e0ad9f60d0..17227430ac 100644
--- a/packages/drag-n-drop/src/handleDrop.ts
+++ b/packages/drag-n-drop/src/handleDrop.ts
@@ -47,7 +47,7 @@ export default (
);
// force to new selection
- const newSelection = new SelectionState({
+ const newSelection = new SelectionState().merge({
anchorKey: blockKey,
anchorOffset: 0,
focusKey: blockKey,
diff --git a/packages/emoji/src/utils/warning.ts b/packages/emoji/src/utils/warning.ts
index b51e066aa8..1957fbc803 100644
--- a/packages/emoji/src/utils/warning.ts
+++ b/packages/emoji/src/utils/warning.ts
@@ -2,7 +2,7 @@ import { once } from 'lodash';
export const warning = once((text: string): void => {
if (process.env.NODE_ENV === 'development') {
- // eslint-disable-next-line no-console
+ // biome-ignore lint/suspicious/noConsole: Development-only warning.
console.warn(text);
}
});
diff --git a/packages/mention/src/MentionSuggestions/MentionSuggestions.tsx b/packages/mention/src/MentionSuggestions/MentionSuggestions.tsx
index fea9115b46..378a479c79 100644
--- a/packages/mention/src/MentionSuggestions/MentionSuggestions.tsx
+++ b/packages/mention/src/MentionSuggestions/MentionSuggestions.tsx
@@ -1,4 +1,4 @@
-import { AriaProps, EditorCommand } from '@draft-js-plugins/editor';
+import { AriaProps, EditorCommand } from '@vectorworks/draft-js-plugins';
import {
DraftHandleValue,
EditorState,
@@ -85,7 +85,6 @@ export class MentionSuggestions extends Component {
activeOffsetKey?: string;
lastSearchValue?: string;
lastActiveTrigger?: string = '';
- lastSelectionIsInsideWord?: Immutable.Iterable;
constructor(props: MentionSuggestionsProps) {
super(props);
@@ -115,6 +114,9 @@ export class MentionSuggestions extends Component {
const decoratorRect = this.props.store.getPortalClientRect(
this.activeOffsetKey!
);
+ if (!decoratorRect) {
+ return;
+ }
const positionSuggestions =
this.props.positionSuggestions || defaultPositionSuggestions;
const newStyles: CSSProperties = positionSuggestions({
diff --git a/packages/mention/src/index.tsx b/packages/mention/src/index.tsx
index 58420290ad..73a43e0441 100644
--- a/packages/mention/src/index.tsx
+++ b/packages/mention/src/index.tsx
@@ -3,7 +3,7 @@ import { Modifier } from 'react-popper';
import { Map } from 'immutable';
import React, { ComponentType, ReactElement } from 'react';
import { EditorState } from 'draft-js';
-import { EditorPlugin, AriaProps } from '@draft-js-plugins/editor';
+import { EditorPlugin, AriaProps } from '@vectorworks/draft-js-plugins';
import Mention, { MentionProps, SubMentionComponentProps } from './Mention';
import MentionSuggestions, {
MentionSuggestionCallbacks,
@@ -48,7 +48,7 @@ export interface MultiMentionData {
export interface MentionPluginStore {
setEditorState?(editorState: EditorState): void;
getEditorState?(): EditorState;
- getPortalClientRect(offsetKey: string): ClientRect;
+ getPortalClientRect(offsetKey: string): ClientRect | undefined;
getAllSearches(): Map;
isEscaped(offsetKey: string): boolean;
escapeSearch(offsetKey: string): void;
@@ -108,7 +108,10 @@ export default (
const store: MentionPluginStore = {
getEditorState: undefined,
setEditorState: undefined,
- getPortalClientRect: (offsetKey) => clientRectFunctions.get(offsetKey)(),
+ getPortalClientRect: (offsetKey) => {
+ const getClientRect = clientRectFunctions.get(offsetKey);
+ return getClientRect ? getClientRect() : undefined;
+ },
getAllSearches: () => searches,
isEscaped: (offsetKey) => escapedSearch === offsetKey,
escapeSearch: (offsetKey) => {
diff --git a/packages/mention/src/utils/__test__/getTriggerForMention.test.ts b/packages/mention/src/utils/__test__/getTriggerForMention.test.ts
index 27254aae94..d15a934655 100644
--- a/packages/mention/src/utils/__test__/getTriggerForMention.test.ts
+++ b/packages/mention/src/utils/__test__/getTriggerForMention.test.ts
@@ -43,7 +43,7 @@ function createEditorState(
])
);
- const selection = new SelectionState({
+ const selection = new SelectionState().merge({
anchorKey: 'eai0g',
anchorOffset: offset,
focusKey: 'eai0g',
diff --git a/packages/mention/src/utils/getTriggerForMention.ts b/packages/mention/src/utils/getTriggerForMention.ts
index 690c9f4dd5..3e4b2b8c3b 100644
--- a/packages/mention/src/utils/getTriggerForMention.ts
+++ b/packages/mention/src/utils/getTriggerForMention.ts
@@ -7,7 +7,21 @@ interface TriggerForMentionResult {
activeTrigger: string;
}
-function filterUndefineds(value: unknown | undefined): boolean {
+interface Leaf {
+ start: number;
+ end: number;
+}
+
+const isLeaf = (value: unknown): value is Leaf => {
+ if (typeof value !== 'object' || value === null) {
+ return false;
+ }
+
+ const { start, end } = value as Record;
+ return typeof start === 'number' && typeof end === 'number';
+};
+
+function filterUndefineds(value: T | undefined): value is T {
return value !== undefined;
}
@@ -32,16 +46,22 @@ export default function getTriggerForMention(
// a leave can be empty when it is removed due event.g. using backspace
// do not check leaves, use full decorated portal text
- const leaves = offsetDetails
- .filter((offsetDetail) => offsetDetail!.blockKey === anchorKey)
- .map((offsetDetail) =>
- editorState
- .getBlockTree(offsetDetail!.blockKey)
- .getIn([offsetDetail!.decoratorKey])
- );
+ const leaves = offsetDetails.reduce