-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Allow array of extensions for
enableInputRules
and `enablePas…
…teRules` options (#2119)
- Loading branch information
aguingand
authored
Nov 18, 2021
1 parent
7e1ca4c
commit 3158c37
Showing
3 changed files
with
22 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { AnyExtension, EnableRules } from '@tiptap/core' | ||
|
||
export default function isExtensionRulesEnabled(extension: AnyExtension, enabled: EnableRules): boolean { | ||
if (Array.isArray(enabled)) { | ||
return enabled.some(enabledExtension => { | ||
const name = typeof enabledExtension === 'string' | ||
? enabledExtension | ||
: enabledExtension.name | ||
|
||
return name === extension.name | ||
}) | ||
} | ||
|
||
return enabled | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters