Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pull] master from draft-js-plugins:master #149

Open
wants to merge 58 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
bf30776
Bump prettier from 3.0.3 to 3.2.5 (#3382)
dependabot[bot] Feb 12, 2024
a2b77f5
Bump @babel/core from 7.23.0 to 7.23.9 (#3386)
dependabot[bot] Feb 12, 2024
45807d8
Bump whatwg-fetch from 3.6.19 to 3.6.20 (#3388)
dependabot[bot] Feb 12, 2024
a0a8af0
Bump tlds from 1.242.0 to 1.250.0 (#3387)
dependabot[bot] Feb 12, 2024
0331532
Bump webpack from 5.88.2 to 5.90.1 (#3391)
dependabot[bot] Feb 12, 2024
a1fad86
Bump punycode from 2.3.0 to 2.3.1 (#3392)
dependabot[bot] Feb 12, 2024
2bed914
Bump @babel/preset-react from 7.22.15 to 7.23.3 (#3389)
dependabot[bot] Feb 12, 2024
dad6aa8
Bump style-loader from 3.3.3 to 3.3.4 (#3395)
dependabot[bot] Feb 12, 2024
763470b
Bump eslint-plugin-import from 2.28.1 to 2.29.1 (#3397)
dependabot[bot] Feb 13, 2024
aad9797
Bump @testing-library/user-event from 14.5.1 to 14.5.2 (#3398)
dependabot[bot] Feb 13, 2024
b160db2
Bump @types/prismjs from 1.26.1 to 1.26.3 (#3399)
dependabot[bot] Feb 14, 2024
e70c448
Bump ip from 2.0.0 to 2.0.1 (#3406)
dependabot[bot] Feb 20, 2024
d63a7fb
Add support for defining mention prefix based on the trigger. (#3409)
amansaryal Mar 4, 2024
d697138
Bump actions/cache from 3 to 4 (#3368)
dependabot[bot] Mar 25, 2024
f71b6d0
Bump express from 4.18.1 to 4.19.2 (#3419)
dependabot[bot] Mar 28, 2024
b4b3bc0
Bump tar from 6.1.11 to 6.2.1 (#3424)
dependabot[bot] Apr 10, 2024
9c833f7
Bump JamesIves/github-pages-deploy-action from 4.5.0 to 4.6.0 (#3429)
dependabot[bot] Apr 18, 2024
6b27319
Bump JamesIves/github-pages-deploy-action from 4.6.0 to 4.6.1 (#3440)
dependabot[bot] May 20, 2024
cd4a8d6
Bump eslint-plugin-react from 7.33.2 to 7.34.2 (#3454)
dependabot[bot] Jun 4, 2024
02631f3
Bump @changesets/cli from 2.26.2 to 2.27.5 (#3456)
dependabot[bot] Jun 5, 2024
26eb9a3
Bump @babel/preset-env from 7.22.6 to 7.24.6 (#3457)
dependabot[bot] Jun 5, 2024
c844edb
Bump @babel/core from 7.23.9 to 7.24.7 (#3460)
dependabot[bot] Jun 6, 2024
d22b207
Bump @babel/preset-react from 7.23.3 to 7.24.7 (#3462)
dependabot[bot] Jun 7, 2024
82dbc99
Bump prettier from 3.2.5 to 3.3.1 (#3463)
dependabot[bot] Jun 7, 2024
5e16dd4
Bump @babel/preset-typescript from 7.23.0 to 7.24.7 (#3464)
dependabot[bot] Jun 10, 2024
de1cfee
Bump ts-node from 10.9.1 to 10.9.2 (#3473)
dependabot[bot] Jun 17, 2024
2bfcb05
Bump clsx from 2.0.0 to 2.1.1 (#3474)
dependabot[bot] Jun 17, 2024
b7e0e54
Bump rimraf from 5.0.5 to 5.0.7 (#3475)
dependabot[bot] Jun 18, 2024
77d98e8
Bump ws from 7.5.8 to 7.5.10 (#3478)
dependabot[bot] Jun 18, 2024
da92253
Bump @types/lodash from 4.14.195 to 4.17.5 (#3479)
dependabot[bot] Jun 18, 2024
ebff413
Bump tlds from 1.250.0 to 1.253.0 (#3480)
dependabot[bot] Jun 19, 2024
0e27800
Bump eslint-plugin-react from 7.34.2 to 7.34.3 (#3481)
dependabot[bot] Jun 19, 2024
987bf6f
Bump JamesIves/github-pages-deploy-action from 4.6.1 to 4.6.3 (#3485)
dependabot[bot] Jul 8, 2024
0d7b5b7
Bump eslint-plugin-react-hooks from 4.6.0 to 4.6.2 (#3491)
dependabot[bot] Aug 19, 2024
d7df86d
Bump @babel/preset-env from 7.24.6 to 7.25.3 (#3492)
dependabot[bot] Aug 19, 2024
38ac085
Bump elliptic from 6.5.4 to 6.5.7 (#3493)
dependabot[bot] Aug 19, 2024
c0d45f2
Bump webpack from 5.90.1 to 5.94.0 (#3496)
dependabot[bot] Aug 29, 2024
e60bf57
Bump JamesIves/github-pages-deploy-action from 4.6.3 to 4.6.4 (#3498)
dependabot[bot] Sep 3, 2024
efdac18
Bump express from 4.19.2 to 4.21.0 (#3501)
dependabot[bot] Sep 21, 2024
bb3ae18
Bump rollup from 2.79.1 to 2.79.2 (#3504)
dependabot[bot] Sep 27, 2024
96a3301
Bump JamesIves/github-pages-deploy-action from 4.6.4 to 4.6.8 (#3505)
dependabot[bot] Sep 30, 2024
9829318
Bump @types/prismjs from 1.26.3 to 1.26.5 (#3513)
dependabot[bot] Oct 28, 2024
dd29639
Bump elliptic from 6.5.7 to 6.6.0 (#3516)
dependabot[bot] Oct 31, 2024
9be6e7a
Bump JamesIves/github-pages-deploy-action from 4.6.8 to 4.6.9 (#3519)
dependabot[bot] Nov 11, 2024
3fee5dd
Bump @changesets/cli from 2.27.5 to 2.27.10 (#3521)
dependabot[bot] Nov 28, 2024
f58f951
Bump @babel/preset-typescript from 7.24.7 to 7.26.0 (#3522)
dependabot[bot] Nov 28, 2024
db07919
Bump cross-spawn from 7.0.3 to 7.0.6 (#3523)
dependabot[bot] Nov 28, 2024
2160ebb
Bump JamesIves/github-pages-deploy-action from 4.6.9 to 4.7.1 (#3524)
dependabot[bot] Nov 29, 2024
a1ee876
Bump tlds from 1.253.0 to 1.255.0 (#3526)
dependabot[bot] Nov 29, 2024
ff65905
Bump eslint-plugin-no-only-tests from 3.1.0 to 3.3.0 (#3525)
dependabot[bot] Nov 29, 2024
6785aa9
Bump @types/lodash from 4.17.5 to 4.17.13 (#3527)
dependabot[bot] Nov 29, 2024
fc582d8
Bump webpack from 5.94.0 to 5.96.1 (#3529)
dependabot[bot] Dec 2, 2024
fc95079
Bump eslint-plugin-react from 7.34.3 to 7.37.2 (#3530)
dependabot[bot] Dec 3, 2024
d4b598b
Bump @babel/preset-env from 7.25.3 to 7.26.0 (#3531)
dependabot[bot] Dec 3, 2024
30a72f9
Bump prettier from 3.3.1 to 3.4.1 (#3532)
dependabot[bot] Dec 3, 2024
aa687db
Bump JamesIves/github-pages-deploy-action from 4.7.1 to 4.7.2 (#3533)
dependabot[bot] Dec 4, 2024
b43e7b3
Bump nanoid from 3.3.4 to 3.3.8 (#3537)
dependabot[bot] Dec 10, 2024
ecdb5ab
Bump store2 from 2.13.2 to 2.14.4 (#3547)
dependabot[bot] Jan 24, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/deployWebsite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
run: ./scripts/publishGithubPages.sh

- name: Deploy
uses: JamesIves/github-pages-deploy-action@v4.5.0
uses: JamesIves/github-pages-deploy-action@v4.7.2
with:
branch: gh-pages
folder: packages/docs/out
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:

- name: Cache node_modules
id: cache-modules
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: node_modules
key: ${{ matrix.node-version }}-${{ runner.OS }}-build-${{ hashFiles('yarn.lock') }}
Expand Down
32 changes: 16 additions & 16 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@
},
"dependencies": {
"draft-js": "^0.11.0",
"eslint-plugin-import": "^2.28.1",
"eslint-plugin-import": "^2.29.1",
"react": "^17.0.2",
"react-dom": "^17.0.2"
},
"devDependencies": {
"@babel/core": "7.23.0",
"@babel/core": "7.24.7",
"@babel/plugin-proposal-class-properties": "7.18.6",
"@babel/preset-env": "7.22.6",
"@babel/preset-react": "7.22.15",
"@babel/preset-typescript": "7.23.0",
"@changesets/cli": "^2.26.2",
"@babel/preset-env": "7.26.0",
"@babel/preset-react": "7.24.7",
"@babel/preset-typescript": "7.26.0",
"@changesets/cli": "^2.27.10",
"@rollup/plugin-babel": "^5.3.1",
"@rollup/plugin-node-resolve": "^14.1.0",
"@storybook/builder-webpack5": "^6.5.16",
Expand All @@ -28,7 +28,7 @@
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/react": "^12.1.5",
"@testing-library/react-hooks": "^8.0.1",
"@testing-library/user-event": "^14.5.1",
"@testing-library/user-event": "^14.5.2",
"@types/jest": "^27.5.0",
"@types/react-dom": "^18.0.3",
"@typescript-eslint/eslint-plugin": "4.33.0",
Expand All @@ -43,24 +43,24 @@
"eslint-config-prettier": "^8.8.0",
"eslint-import-resolver-typescript": "2.7.1",
"eslint-plugin-jsx-a11y": "4.0.0",
"eslint-plugin-no-only-tests": "^3.1.0",
"eslint-plugin-react": "^7.33.2",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-no-only-tests": "^3.3.0",
"eslint-plugin-react": "^7.37.2",
"eslint-plugin-react-hooks": "^4.6.2",
"husky": "^8.0.3",
"jest": "^27.5.1",
"linaria": "2.1",
"lint-staged": "^13.2.2",
"matched": "^5.0.1",
"multer": "^1.4.4",
"prettier": "^3.0.3",
"prettier": "^3.4.1",
"prismjs": "^1.29.0",
"rimraf": "^5.0.5",
"rollup": "^2.79.1",
"style-loader": "3.3.3",
"rimraf": "^5.0.7",
"rollup": "^2.79.2",
"style-loader": "3.3.4",
"ts-jest": "27.1.4",
"ts-node": "10.9.1",
"ts-node": "10.9.2",
"typescript": "4.9.5",
"webpack": "^5.88.2"
"webpack": "^5.96.1"
},
"keywords": [
"components",
Expand Down
4 changes: 2 additions & 2 deletions packages/anchor/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@
"license": "MIT",
"dependencies": {
"@draft-js-plugins/utils": "^4.0.0",
"clsx": "^2.0.0",
"clsx": "^2.1.1",
"prepend-http": "3.0.1",
"prop-types": "^15.8.1",
"tlds": "^1.242.0"
"tlds": "^1.255.0"
},
"peerDependencies": {
"draft-js": "^0.10.1 || ^0.11.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/buttons/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
},
"license": "MIT",
"dependencies": {
"clsx": "^2.0.0"
"clsx": "^2.1.1"
},
"peerDependencies": {
"draft-js": "^0.10.1 || ^0.11.0",
Expand Down
4 changes: 2 additions & 2 deletions packages/counter/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@
},
"license": "MIT",
"dependencies": {
"clsx": "^2.0.0",
"clsx": "^2.1.1",
"prop-types": "^15.8.1",
"punycode": "^2.3.0"
"punycode": "^2.3.1"
},
"peerDependencies": {
"draft-js": "^0.10.1 || ^0.11.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/divider/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
},
"license": "MIT",
"dependencies": {
"clsx": "^2.0.0",
"clsx": "^2.1.1",
"prop-types": "^15.8.1"
},
"peerDependencies": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,4 @@ const topics = [
},
];

export default { '@': mentions, '(': topics };
export default { '@': mentions, '#': topics };
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ import createMentionPlugin, {
import editorStyles from './MultiMentionTriggers.module.css';
import mentions from './Mentions';

const mentionPlugin = createMentionPlugin({ mentionTrigger: ['@', '('] });
const mentionPlugin = createMentionPlugin({
mentionTrigger: ['@', '#'],
mentionPrefix: (trigger) => trigger,
});
const { MentionSuggestions } = mentionPlugin;
const plugins = [mentionPlugin];

Expand Down
6 changes: 3 additions & 3 deletions packages/docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@
},
"dependencies": {
"animateplus": "1.4.0",
"clsx": "^2.0.0",
"clsx": "^2.1.1",
"immutable": "^4.0.0-rc.12",
"next": "12.3.1",
"prismjs": "^1.29.0",
"react-share": "^4.4.1",
"whatwg-fetch": "^3.6.19"
"whatwg-fetch": "^3.6.20"
},
"devDependencies": {
"@types/prismjs": "^1.26.1",
"@types/prismjs": "^1.26.5",
"raw-loader": "^4.0.2"
}
}
6 changes: 4 additions & 2 deletions packages/docs/pages/plugin/mention/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,10 @@ export default function Mention(): ReactElement {
<div className={styles.param}>
<span className={styles.paramName}>mentionPrefix</span>
<span>
By default it is an empty String. For Twitter or Slack like mention
behaviour you can provide an `@`
Allows you to define a custom prefix to add to the selected
mention&apos;s name. Can either be a string or a function that takes
the `mentionTrigger` as an argument and returns a string. Defaults
to an empty string.
</span>
</div>
<div className={styles.param}>
Expand Down
4 changes: 2 additions & 2 deletions packages/emoji/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@
"@draft-js-plugins/buttons": "^4.3.3",
"@draft-js-plugins/utils": "^4.2.1",
"@popperjs/core": "^2.11.8",
"@types/lodash": "^4.14.195",
"clsx": "^2.0.0",
"@types/lodash": "^4.17.13",
"clsx": "^2.1.1",
"emoji-toolkit": "^7.0",
"emojibase": "^6.1.0",
"emojibase-data": "^7.0.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/focus/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
},
"license": "MIT",
"dependencies": {
"clsx": "^2.0.0",
"clsx": "^2.1.1",
"immutable": "~3.7.4"
},
"peerDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/hashtag/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
},
"license": "MIT",
"dependencies": {
"clsx": "^2.0.0"
"clsx": "^2.1.1"
},
"peerDependencies": {
"draft-js": "^0.10.1 || ^0.11.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/image/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
},
"license": "MIT",
"dependencies": {
"clsx": "^2.0.0"
"clsx": "^2.1.1"
},
"peerDependencies": {
"draft-js": "^0.10.1 || ^0.11.0",
Expand Down
4 changes: 2 additions & 2 deletions packages/linkify/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@
},
"license": "MIT",
"dependencies": {
"clsx": "^2.0.0",
"clsx": "^2.1.1",
"linkify-it": "^4.0.1",
"tlds": "^1.242.0"
"tlds": "^1.255.0"
},
"peerDependencies": {
"draft-js": "^0.10.1 || ^0.11.0",
Expand Down
4 changes: 4 additions & 0 deletions packages/mention/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ This project adheres to [Semantic Versioning](http://semver.org/).

## To Be Released

## 5.3.0

- Add support for defining `mentionPrefix` as a callback function that takes the `mentionTrigger` as an argument and returns the prefix.

## 5.2.2

- adjust react peer dependency
Expand Down
6 changes: 3 additions & 3 deletions packages/mention/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@draft-js-plugins/mention",
"version": "5.2.2",
"version": "5.3.0",
"sideEffects": ["*.css"],
"description": "Mention Plugin for DraftJS",
"author": {
Expand Down Expand Up @@ -37,8 +37,8 @@
"license": "MIT",
"dependencies": {
"@popperjs/core": "^2.11.8",
"@types/lodash": "^4.14.195",
"clsx": "^2.0.0",
"@types/lodash": "^4.17.13",
"clsx": "^2.1.1",
"immutable": "~3.7.4",
"lodash": "^4.17.21",
"lodash-es": "^4.17.21",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export interface MentionSuggestionsProps extends MentionSuggestionsPubProps {
positionSuggestions?: PositionSuggestionsFn;
ariaProps: AriaProps;
theme: MentionPluginTheme;
mentionPrefix: string;
mentionPrefix: string | ((trigger: string) => string);
mentionTriggers: string[];
entityMutability: 'SEGMENTED' | 'IMMUTABLE' | 'MUTABLE';
popperOptions?: PopperOptions;
Expand Down
5 changes: 3 additions & 2 deletions packages/mention/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export interface MentionPluginStore {
}

export interface MentionPluginConfig {
mentionPrefix?: string;
mentionPrefix?: string | ((trigger: string) => string);
theme?: MentionPluginTheme;
positionSuggestions?: PositionSuggestionsFn;
mentionComponent?: ComponentType<SubMentionComponentProps>;
Expand Down Expand Up @@ -154,7 +154,8 @@ export default (
theme = defaultTheme,
positionSuggestions,
mentionComponent,
mentionSuggestionsComponent: MentionSuggestionsComponent = MentionSuggestions,
mentionSuggestionsComponent:
MentionSuggestionsComponent = MentionSuggestions,
entityMutability = 'SEGMENTED',
mentionTrigger = '@',
mentionRegExp = defaultRegExp,
Expand Down
4 changes: 2 additions & 2 deletions packages/mention/src/modifiers/addMention.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import getTypeByTrigger from '../utils/getTypeByTrigger';
export default function addMention(
editorState: EditorState,
mention: MentionData,
mentionPrefix: string,
mentionPrefix: string | ((trigger: string) => string),
mentionTrigger: string,
entityMutability: 'SEGMENTED' | 'IMMUTABLE' | 'MUTABLE'
): EditorState {
Expand All @@ -31,7 +31,7 @@ export default function addMention(
let mentionReplacedContent = Modifier.replaceText(
editorState.getCurrentContent(),
mentionTextSelection,
`${mentionPrefix}${mention.name}`,
`${typeof mentionPrefix === 'string' ? mentionPrefix : mentionPrefix(mentionTrigger)}${mention.name}`,
editorState.getCurrentInlineStyle(),
entityKey
);
Expand Down
2 changes: 1 addition & 1 deletion packages/undo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
},
"license": "MIT",
"dependencies": {
"clsx": "^2.0.0",
"clsx": "^2.1.1",
"prop-types": "^15.8.1"
},
"peerDependencies": {
Expand Down
Loading
Loading