index int64 0 0 | repo_id stringlengths 16 181 | file_path stringlengths 28 270 | content stringlengths 1 11.6M | __index_level_0__ int64 0 10k |
|---|---|---|---|---|
0 | petrpan-code/geist-org/geist-ui | petrpan-code/geist-org/geist-ui/tests/utils.ts | import { act } from 'react-dom/test-utils'
import { ReactWrapper } from 'enzyme'
export const sleep = (time: number) => {
return new Promise(resolve => setTimeout(resolve, time))
}
export const updateWrapper = async (wrapper: ReactWrapper, time: number = 0) => {
await act(async () => {
await sleep(time)
w... | 3,200 |
0 | petrpan-code/geist-org/geist-ui/tests/__mocks__ | petrpan-code/geist-org/geist-ui/tests/__mocks__/styled-jsx/css.js | module.exports = {
resolve: () => ({
className: 'mock',
style: null,
}),
css: {
resolve: () => ({
className: 'mock',
style: null,
}),
},
}
| 3,201 |
0 | petrpan-code/geist-org/geist-ui | petrpan-code/geist-org/geist-ui/typings/mdx.d.ts | declare module '*.mdx' {
let MDXComponent: (props: any) => JSX.Element
export default MDXComponent
}
declare module "@mdx-js/react" {
import { ComponentType, StyleHTMLAttributes } from "react"
type MDXProps = {
children: React.ReactNode
components: { [key:? string]: React.ReactNode, }
}
export ... | 3,202 |
0 | petrpan-code/geist-org/geist-ui | petrpan-code/geist-org/geist-ui/typings/meta.d.ts | import React from 'react'
declare module 'react' {
interface MetaHTMLAttributes<T> extends React.MetaHTMLAttributes<T> {
itemprop?: string
}
}
| 3,203 |
0 | petrpan-code/geist-org/geist-ui | petrpan-code/geist-org/geist-ui/typings/styled.d.ts | // Definitions by: @types/styled-jsx <https://www.npmjs.com/package/@types/styled-jsx>
import 'react'
declare module 'react' {
interface StyleHTMLAttributes<T> extends HTMLAttributes<T> {
jsx?: boolean
global?: boolean
}
}
| 3,204 |
0 | petrpan-code/draft-js-plugins | petrpan-code/draft-js-plugins/draft-js-plugins/.editorconfig | # EditorConfig helps developers define and maintain consistent
# coding styles between different editors and IDEs
# editorconfig.org
root = true
[*]
# Change these settings to your own preference
indent_style = space
indent_size = 2
# We recommend you to keep these unchanged
end_of_line = lf
charset = utf-8
trim_t... | 3,205 |
0 | petrpan-code/draft-js-plugins | petrpan-code/draft-js-plugins/draft-js-plugins/.eslintignore | **/node_modules/**
node_modules
lib/**
scripts/**
distTs/**
**/lib/**
**/.next/**
**/out/**
| 3,206 |
0 | petrpan-code/draft-js-plugins | petrpan-code/draft-js-plugins/draft-js-plugins/.eslintrc.js | module.exports = {
parser: 'babel-eslint',
plugins: ['@typescript-eslint', 'react-hooks', 'no-only-tests'],
parserOptions: {
ecmaVersion: 2020,
sourceType: 'module',
},
overrides: [
{
extends: [
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recomm... | 3,207 |
0 | petrpan-code/draft-js-plugins | petrpan-code/draft-js-plugins/draft-js-plugins/.nvmrc | 8
| 3,208 |
0 | petrpan-code/draft-js-plugins | petrpan-code/draft-js-plugins/draft-js-plugins/.prettierrc.js | module.exports = {
semi: true,
trailingComma: 'all',
singleQuote: true,
printWidth: 120,
tabWidth: 2,
arrowParens: 'always',
};
| 3,209 |
0 | petrpan-code/draft-js-plugins | petrpan-code/draft-js-plugins/draft-js-plugins/CHANGELOG.md | # Change Log
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).
## Checkout the CHANGELOG.md of each package …
| 3,210 |
0 | petrpan-code/draft-js-plugins | petrpan-code/draft-js-plugins/draft-js-plugins/CODE_OF_CONDUCT.md | # Contributor Covenant Code of Conduct
## Our Pledge
In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender... | 3,211 |
0 | petrpan-code/draft-js-plugins | petrpan-code/draft-js-plugins/draft-js-plugins/CONTRIBUTING.md | # Contributing
We are open to, and grateful for, any contributions made by you. By contributing to DraftJS Plugins, you agree to abide by the [code of conduct](https://github.com/draft-js-plugins/draft-js-plugins/blob/master/CODE_OF_CONDUCT.md).
## Reporting Issues and Asking Questions
Before opening an issue, pleas... | 3,212 |
0 | petrpan-code/draft-js-plugins | petrpan-code/draft-js-plugins/draft-js-plugins/FAQ.md | # Frequently Asked Questions
## Why is there no Popover for Mentions/Emoji plugin?
The MentionSuggestions/EmojiSuggestions component is internally connected to the
plugin & editor and will be updated & positioned once the user starts the autocompletion
with an @ character for mentions or a colon for Emojis.
Dependin... | 3,213 |
0 | petrpan-code/draft-js-plugins | petrpan-code/draft-js-plugins/draft-js-plugins/HOW_TO_CREATE_A_PLUGIN.md | -----
# Basics
A Plugin is simply a plain JavaScript object containing a couple deeper nested objects or functions e.g.
```js
const customPlugin = {
blockStyleFn: (contentBlock) => {
if (contentBlock.getType() === 'blockquote') {
return 'superFancyBlockquote';
}
},
customStyleMap: {
'STRIKETH... | 3,214 |
0 | petrpan-code/draft-js-plugins | petrpan-code/draft-js-plugins/draft-js-plugins/LICENSE | Copyright (c) 2016 Nikolaus Graf
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, subl... | 3,215 |
0 | petrpan-code/draft-js-plugins | petrpan-code/draft-js-plugins/draft-js-plugins/README.md | # DraftJS Plugins

High quality plugins with great UX on top of [DraftJS](https://github.com/facebook/draft-js).
[](https://travis-ci.org/... | 3,216 |
0 | petrpan-code/draft-js-plugins | petrpan-code/draft-js-plugins/draft-js-plugins/babel.config.js | const removeLinariaImport = () => ({
name: 'remove-linaria-import',
visitor: {
ImportDeclaration(path) {
if (path.node.source && path.node.source.value === 'linaria') {
path.remove();
}
},
},
});
module.exports = {
presets: [
//using loose true because of this issue: https://git... | 3,217 |
0 | petrpan-code/draft-js-plugins | petrpan-code/draft-js-plugins/draft-js-plugins/jest.config.base.js | // For a detailed explanation regarding each configuration property, visit:
// https://jestjs.io/docs/en/configuration.html
module.exports = {
preset: 'ts-jest',
testEnvironment: 'jsdom',
setupFilesAfterEnv: [`${__dirname}/jestHelper.js`],
moduleFileExtensions: ['jsx', 'js', 'ts', 'tsx'],
transform: {
'^... | 3,218 |
0 | petrpan-code/draft-js-plugins | petrpan-code/draft-js-plugins/draft-js-plugins/jest.config.js | const base = require('./jest.config.base.js');
module.exports = {
...base,
projects: [
{
...base,
displayName: 'root',
modulePathIgnorePatterns: ['packages'],
},
'<rootDir>/packages/*/jest.config.js',
],
};
| 3,219 |
0 | petrpan-code/draft-js-plugins | petrpan-code/draft-js-plugins/draft-js-plugins/jestHelper.js | require('@testing-library/jest-dom/extend-expect');
require('regenerator-runtime/runtime');
| 3,220 |
0 | petrpan-code/draft-js-plugins | petrpan-code/draft-js-plugins/draft-js-plugins/package.json | {
"name": "draft-js-plugins",
"description": "A Plugin Architecture on top of Draft.JS",
"version": "0.0.0",
"author": {
"name": "Nik Graf",
"email": "nik@nikgraf.com",
"url": "http://www.nikgraf.com"
},
"dependencies": {
"draft-js": "^0.11.0",
"eslint-plugin-import": "^2.28.1",
"rea... | 3,221 |
0 | petrpan-code/draft-js-plugins | petrpan-code/draft-js-plugins/draft-js-plugins/rollup.config.js | import path from 'path';
import nodeResolve from '@rollup/plugin-node-resolve';
import babel from '@rollup/plugin-babel';
import { existsSync } from 'fs';
const input = existsSync('./src/index.ts')
? './src/index.ts'
: './src/index.tsx';
const external = (id) => !id.startsWith('.') && !path.isAbsolute(id);
const e... | 3,222 |
0 | petrpan-code/draft-js-plugins | petrpan-code/draft-js-plugins/draft-js-plugins/tsconfig.json | {
"compilerOptions": {
// "incremental": true,
/* Basic Options */
"target": "esnext" /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */,
"module": "esnext" /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd'... | 3,223 |
0 | petrpan-code/draft-js-plugins | petrpan-code/draft-js-plugins/draft-js-plugins/yarn.lock | # THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1
"@adobe/css-tools@^4.0.1":
version "4.3.1"
resolved "https://registry.yarnpkg.com/@adobe/css-tools/-/css-tools-4.3.1.tgz#abfccb8ca78075a2b6187345c26243c1a0842f28"
integrity sha512-/62yikz7NLScCGAAST5SHdnjaDJQBDq0M2muyRTpf2VQhw6S... | 3,224 |
0 | petrpan-code/draft-js-plugins/draft-js-plugins | petrpan-code/draft-js-plugins/draft-js-plugins/.changeset/README.md | # Changesets
Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
with multi-package repos, or single-package repos to help you version and publish your code. You can
find the full documentation for it [in our repository](https://github.com/changesets/changesets... | 3,225 |
0 | petrpan-code/draft-js-plugins/draft-js-plugins | petrpan-code/draft-js-plugins/draft-js-plugins/.changeset/config.json | {
"$schema": "https://unpkg.com/@changesets/config@1.4.0/schema.json",
"changelog": "@changesets/cli/changelog",
"commit": false,
"linked": [],
"access": "restricted",
"baseBranch": "master",
"updateInternalDependencies": "patch",
"ignore": []
}
| 3,226 |
0 | petrpan-code/draft-js-plugins/draft-js-plugins | petrpan-code/draft-js-plugins/draft-js-plugins/.husky/pre-commit | #!/bin/sh
. "$(dirname "$0")/_/husky.sh"
yarn lint-staged | 3,227 |
0 | petrpan-code/draft-js-plugins/draft-js-plugins | petrpan-code/draft-js-plugins/draft-js-plugins/.storybook/main.js | module.exports = {
core: {
builder: 'webpack5',
},
stories: ['../stories/**/*.stories.@(js|jsx|ts|tsx)'],
framework: '@storybook/react',
staticDirs: ['../stories/public'],
};
| 3,228 |
0 | petrpan-code/draft-js-plugins/draft-js-plugins | petrpan-code/draft-js-plugins/draft-js-plugins/.storybook/preview-head.html | <style>
body {
font-family: sans-serif;
}
#root {
padding: 2em 5em;
}
</style>
| 3,229 |
0 | petrpan-code/draft-js-plugins/draft-js-plugins | petrpan-code/draft-js-plugins/draft-js-plugins/.storybook/preview.js | import 'draft-js/dist/Draft.css';
| 3,230 |
0 | petrpan-code/draft-js-plugins/draft-js-plugins | petrpan-code/draft-js-plugins/draft-js-plugins/.storybook/webpack.config.js | const path = require('path');
const packages = [
'@draft-js-plugins/editor',
'@draft-js-plugins/hashtag',
'@draft-js-plugins/linkify',
'@draft-js-plugins/anchor',
'@draft-js-plugins/mention',
'@draft-js-plugins/sticker',
'@draft-js-plugins/undo',
'@draft-js-plugins/emoji',
'@draft-js-plugins/utils',
... | 3,231 |
0 | petrpan-code/draft-js-plugins/draft-js-plugins | petrpan-code/draft-js-plugins/draft-js-plugins/interfaces/CSSModule.js | declare module 'CSSModule' {
declare var exports: { [key: string]: string };
}
| 3,232 |
0 | petrpan-code/draft-js-plugins/draft-js-plugins/packages | petrpan-code/draft-js-plugins/draft-js-plugins/packages/alignment/CHANGELOG.md | # Change Log
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).
## To be released
## 5.0.4
- adjust react peer dependency
## 5.0.3
- support react 18 in peer dependencies [#2701](https://github.com/draft-js-plugins/draft-js-plugi... | 3,233 |
0 | petrpan-code/draft-js-plugins/draft-js-plugins/packages | petrpan-code/draft-js-plugins/draft-js-plugins/packages/alignment/LICENSE | Copyright (c) 2016 Nikolaus Graf
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, subl... | 3,234 |
0 | petrpan-code/draft-js-plugins/draft-js-plugins/packages | petrpan-code/draft-js-plugins/draft-js-plugins/packages/alignment/README.md | # DraftJS Alignment Plugin
_This is a plugin for the `@draft-js-plugins/editor`._
Usage:
see https://www.draft-js-plugins.com/plugin/alignment
| 3,235 |
0 | petrpan-code/draft-js-plugins/draft-js-plugins/packages | petrpan-code/draft-js-plugins/draft-js-plugins/packages/alignment/jest.config.js | const base = require('../../jest.config.base.js');
const packageName = require('./package').name;
module.exports = {
...base,
displayName: packageName,
name: packageName,
};
| 3,236 |
0 | petrpan-code/draft-js-plugins/draft-js-plugins/packages | petrpan-code/draft-js-plugins/draft-js-plugins/packages/alignment/package.json | {
"name": "@draft-js-plugins/alignment",
"version": "5.0.4",
"sideEffects": ["*.css"],
"description": "Alignment Plugin for DraftJS",
"author": {
"name": "Benjamin Kniffler",
"email": "benjamin@kniffler.com"
},
"repository": {
"type": "git",
"url": "https://github.com/draft-js-plugins/draf... | 3,237 |
0 | petrpan-code/draft-js-plugins/draft-js-plugins/packages | petrpan-code/draft-js-plugins/draft-js-plugins/packages/alignment/tsconfig.json | {
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "lib"
},
"include": ["src"]
}
| 3,238 |
0 | petrpan-code/draft-js-plugins/draft-js-plugins/packages/alignment | petrpan-code/draft-js-plugins/draft-js-plugins/packages/alignment/src/AlignmentTool.tsx | /* eslint-disable react/no-array-index-key */
import React, {
useState,
useEffect,
useRef,
ReactElement,
useCallback,
} from 'react';
import {
AlignBlockDefaultButton,
AlignBlockLeftButton,
AlignBlockCenterButton,
AlignBlockRightButton,
DraftJsBlockAlignmentButtonType,
} from '@draft-js-plugins/butt... | 3,239 |
0 | petrpan-code/draft-js-plugins/draft-js-plugins/packages/alignment | petrpan-code/draft-js-plugins/draft-js-plugins/packages/alignment/src/createDecorator.tsx | import { ContentBlock } from 'draft-js';
import React, {
ComponentType,
CSSProperties,
MutableRefObject,
ReactElement,
Ref,
useEffect,
useRef,
} from 'react';
import { AlignmentPluginStore } from '.';
interface BlockAlignmentDecoratorParams {
blockProps: {
isFocused: boolean;
isCollapsedSelecti... | 3,240 |
0 | petrpan-code/draft-js-plugins/draft-js-plugins/packages/alignment | petrpan-code/draft-js-plugins/draft-js-plugins/packages/alignment/src/index.tsx | import React, { ComponentType, ReactElement } from 'react';
import { ContentBlock, EditorState } from 'draft-js';
import { EditorPlugin } from '@draft-js-plugins/editor';
import { createStore, Store } from '@draft-js-plugins/utils';
import createDecorator from './createDecorator';
import AlignmentTool from './Alignment... | 3,241 |
0 | petrpan-code/draft-js-plugins/draft-js-plugins/packages/alignment | petrpan-code/draft-js-plugins/draft-js-plugins/packages/alignment/src/theme.ts | import { DraftJsButtonTheme } from '@draft-js-plugins/buttons';
import { css } from 'linaria';
export interface AlignmentPluginTheme {
buttonStyles: DraftJsButtonTheme;
alignmentToolStyles: {
alignmentTool: string;
};
}
const buttonStyles: DraftJsButtonTheme = {
buttonWrapper: css`
display: inline-blo... | 3,242 |
0 | petrpan-code/draft-js-plugins/draft-js-plugins/packages | petrpan-code/draft-js-plugins/draft-js-plugins/packages/anchor/CHANGELOG.md | # Change Log
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).
## To be released
## 4.2.1
- adjust react peer dependency
## 4.2.0
- adds accessibility aria label to LinkButton
## 4.1.4
- support react 18 in peer dependencies [... | 3,243 |
0 | petrpan-code/draft-js-plugins/draft-js-plugins/packages | petrpan-code/draft-js-plugins/draft-js-plugins/packages/anchor/LICENSE | Copyright (c) 2016 Nikolaus Graf
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, subl... | 3,244 |
0 | petrpan-code/draft-js-plugins/draft-js-plugins/packages | petrpan-code/draft-js-plugins/draft-js-plugins/packages/anchor/README.md | # Draft.js Link Plugin
_This is a plugin for the `@draft-js-plugins/editor`._
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 w... | 3,245 |
0 | petrpan-code/draft-js-plugins/draft-js-plugins/packages | petrpan-code/draft-js-plugins/draft-js-plugins/packages/anchor/jest.config.js | const base = require('../../jest.config.base.js');
const packageName = require('./package').name;
module.exports = {
...base,
displayName: packageName,
name: packageName,
};
| 3,246 |
0 | petrpan-code/draft-js-plugins/draft-js-plugins/packages | petrpan-code/draft-js-plugins/draft-js-plugins/packages/anchor/package.json | {
"name": "@draft-js-plugins/anchor",
"version": "4.2.1",
"sideEffects": ["*.css"],
"description": "Link Plugin for DraftJS",
"author": {
"name": "Jan Amann",
"email": "jan@amann.me",
"url": "http://amann.me"
},
"repository": {
"type": "git",
"url": "https://github.com/draft-js-plugins... | 3,247 |
0 | petrpan-code/draft-js-plugins/draft-js-plugins/packages | petrpan-code/draft-js-plugins/draft-js-plugins/packages/anchor/tsconfig.json | {
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "lib"
},
"include": ["src"]
}
| 3,248 |
0 | petrpan-code/draft-js-plugins/draft-js-plugins/packages/anchor | petrpan-code/draft-js-plugins/draft-js-plugins/packages/anchor/src/index.tsx | import React, {
AnchorHTMLAttributes,
ComponentType,
ReactElement,
} from 'react';
import { EditorPlugin } from '@draft-js-plugins/editor';
import EditorUtils from '@draft-js-plugins/utils';
import { EditorState } from 'draft-js';
import DefaultLink, { LinkPubProps } from './components/Link';
import LinkButton, {... | 3,249 |
0 | petrpan-code/draft-js-plugins/draft-js-plugins/packages/anchor | petrpan-code/draft-js-plugins/draft-js-plugins/packages/anchor/src/linkStrategy.ts | import { ContentBlock, ContentState } from 'draft-js';
export const matchesEntityType = (type: string): boolean => type === 'LINK';
export default function strategy(
contentBlock: ContentBlock,
callback: (start: number, end: number) => void,
contentState: ContentState
): void {
if (!contentState) return;
co... | 3,250 |
0 | petrpan-code/draft-js-plugins/draft-js-plugins/packages/anchor | petrpan-code/draft-js-plugins/draft-js-plugins/packages/anchor/src/theme.ts | import { css } from 'linaria';
export interface AnchorPluginTheme {
input: string;
inputInvalid: string;
link: string;
}
export const defaultTheme: AnchorPluginTheme = {
input: css`
height: 34px;
width: 220px;
padding: 0 12px;
font-size: 15px;
font-family: inherit;
background-color: tr... | 3,251 |
0 | petrpan-code/draft-js-plugins/draft-js-plugins/packages/anchor/src | petrpan-code/draft-js-plugins/draft-js-plugins/packages/anchor/src/components/AddLinkForm.tsx | import React, {
useState,
useRef,
useEffect,
ReactElement,
ChangeEvent,
KeyboardEvent,
ComponentType,
} from 'react';
import PropTypes from 'prop-types';
import clsx from 'clsx';
import EditorUtils from '@draft-js-plugins/utils';
import { EditorState } from 'draft-js';
import URLUtils from '../utils/URLUt... | 3,252 |
0 | petrpan-code/draft-js-plugins/draft-js-plugins/packages/anchor/src | petrpan-code/draft-js-plugins/draft-js-plugins/packages/anchor/src/components/DefaultLinkButton.tsx | import React, { ReactElement, MouseEvent } from 'react';
import clsx from 'clsx';
import { LinkButtonTheme } from './LinkButton';
export interface DefaultLinkButtonProps {
hasLinkSelected: boolean;
onRemoveLinkAtSelection(): void;
onAddLinkClick(event: MouseEvent): void;
theme?: LinkButtonTheme;
}
export defa... | 3,253 |
0 | petrpan-code/draft-js-plugins/draft-js-plugins/packages/anchor/src | petrpan-code/draft-js-plugins/draft-js-plugins/packages/anchor/src/components/Link.tsx | import React, { ReactElement, ReactNode } from 'react';
import PropTypes from 'prop-types';
import { EditorState } from 'draft-js';
const propTypes = {
className: PropTypes.string,
children: PropTypes.node.isRequired,
entityKey: PropTypes.string,
getEditorState: PropTypes.func.isRequired,
};
export interface ... | 3,254 |
0 | petrpan-code/draft-js-plugins/draft-js-plugins/packages/anchor/src | petrpan-code/draft-js-plugins/draft-js-plugins/packages/anchor/src/components/LinkButton.tsx | import React, { ComponentType, MouseEvent, ReactElement } from 'react';
import PropTypes from 'prop-types';
import EditorUtils from '@draft-js-plugins/utils';
import AddLinkForm, { OverrideContentProps } from './AddLinkForm';
import { AnchorPluginTheme } from '../theme';
import { AnchorPluginStore } from '..';
import {... | 3,255 |
0 | petrpan-code/draft-js-plugins/draft-js-plugins/packages/anchor/src | petrpan-code/draft-js-plugins/draft-js-plugins/packages/anchor/src/utils/EditorUtils.ts | import { RichUtils, EditorState, EntityInstance } from 'draft-js';
export default {
createLinkAtSelection(editorState: EditorState, url: string): EditorState {
const contentState = editorState
.getCurrentContent()
.createEntity('LINK', 'MUTABLE', { url });
const entityKey = contentState.getLastCr... | 3,256 |
0 | petrpan-code/draft-js-plugins/draft-js-plugins/packages/anchor/src | petrpan-code/draft-js-plugins/draft-js-plugins/packages/anchor/src/utils/URLUtils.ts | import prependHttp from 'prepend-http';
import urlRegex from './urlRegex';
import mailRegex from './mailRegex';
export default {
isUrl(text: string): boolean {
return urlRegex().test(text);
},
isMail(text: string): boolean {
return mailRegex().test(text);
},
normaliseMail(email: string): string {
... | 3,257 |
0 | petrpan-code/draft-js-plugins/draft-js-plugins/packages/anchor/src | petrpan-code/draft-js-plugins/draft-js-plugins/packages/anchor/src/utils/mailRegex.ts | export default (): RegExp =>
/^((mailto:[^<>()/[\].,;:\s@"]+(\.[^<>()[\].,;:\s@"]+)*)|(".+"))@(([^<>()[\].,;:\s@"]+\.)+[^<>()[\].,;:\s@"]{2,})$/i;
| 3,258 |
0 | petrpan-code/draft-js-plugins/draft-js-plugins/packages/anchor/src | petrpan-code/draft-js-plugins/draft-js-plugins/packages/anchor/src/utils/urlRegex.ts | import tlds from 'tlds';
const v4 =
'(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])(?:\\.(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])){3}';
const v6seg = '[0-9a-fA-F]{1,4}';
const v6 = `
(
(?:${v6seg}:){7}(?:${v6seg}|:)| // 1:2:3:4:5:6:7:: 1:2:3:4:5:6:7:8
(?:${v6seg}:){6... | 3,259 |
0 | petrpan-code/draft-js-plugins/draft-js-plugins/packages | petrpan-code/draft-js-plugins/draft-js-plugins/packages/buttons/CHANGELOG.md | # Change Log
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).
## To be released
## 4.3.3
- adjust react peer dependency
## 4.3.2
- add Aria roles and labels to buttons to improve accessibility
- [React Accessibility](https://... | 3,260 |
0 | petrpan-code/draft-js-plugins/draft-js-plugins/packages | petrpan-code/draft-js-plugins/draft-js-plugins/packages/buttons/LICENSE | Copyright (c) 2016 Nikolaus Graf
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, subl... | 3,261 |
0 | petrpan-code/draft-js-plugins/draft-js-plugins/packages | petrpan-code/draft-js-plugins/draft-js-plugins/packages/buttons/README.md | # DraftJS Buttons
## Important: Include after the Editor
For the toolbar to work correctly, you must include the `<Toolbar>` component after the editor component:
```jsx
<Editor .../>
<Toolbar />
```
## Using the Subscript and Superscript buttons requires a custom style map:
```jsx
<Editor
customStyleMap={{
... | 3,262 |
0 | petrpan-code/draft-js-plugins/draft-js-plugins/packages | petrpan-code/draft-js-plugins/draft-js-plugins/packages/buttons/jest.config.js | const base = require('../../jest.config.base.js');
const packageName = require('./package').name;
module.exports = {
...base,
displayName: packageName,
name: packageName,
};
| 3,263 |
0 | petrpan-code/draft-js-plugins/draft-js-plugins/packages | petrpan-code/draft-js-plugins/draft-js-plugins/packages/buttons/package.json | {
"name": "@draft-js-plugins/buttons",
"version": "4.3.3",
"sideEffects": ["*.css"],
"description": "Buttons for DraftJS",
"author": {
"name": "Nik Graf",
"email": "nik@nikgraf.com"
},
"repository": {
"type": "git",
"url": "https://github.com/draft-js-plugins/draft-js-plugins.git"
},
"... | 3,264 |
0 | petrpan-code/draft-js-plugins/draft-js-plugins/packages | petrpan-code/draft-js-plugins/draft-js-plugins/packages/buttons/tsconfig.json | {
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "lib"
},
"include": ["src"]
}
| 3,265 |
0 | petrpan-code/draft-js-plugins/draft-js-plugins/packages/buttons | petrpan-code/draft-js-plugins/draft-js-plugins/packages/buttons/src/index.ts | import { EditorState } from 'draft-js';
import { ButtonHTMLAttributes, ComponentType } from 'react';
import AlignBlockCenterButton from './components/AlignBlockCenterButton';
import AlignBlockDefaultButton from './components/AlignBlockDefaultButton';
import AlignBlockLeftButton from './components/AlignBlockLeftButton';... | 3,266 |
0 | petrpan-code/draft-js-plugins/draft-js-plugins/packages/buttons/src | petrpan-code/draft-js-plugins/draft-js-plugins/packages/buttons/src/components/AlignBlockCenterButton.tsx | import React from 'react';
import createBlockAlignmentButton from '../utils/createBlockAlignmentButton';
export default createBlockAlignmentButton({
alignment: 'center',
children: (
<svg
height="24"
viewBox="0 0 24 24"
width="24"
xmlns="http://www.w3.org/2000/svg"
>
<path d="M... | 3,267 |
0 | petrpan-code/draft-js-plugins/draft-js-plugins/packages/buttons/src | petrpan-code/draft-js-plugins/draft-js-plugins/packages/buttons/src/components/AlignBlockDefaultButton.tsx | import React from 'react';
import createBlockAlignmentButton from '../utils/createBlockAlignmentButton';
export default createBlockAlignmentButton({
alignment: 'default',
children: (
<svg
height="24"
viewBox="0 0 24 24"
width="24"
xmlns="http://www.w3.org/2000/svg"
>
<path d="... | 3,268 |
0 | petrpan-code/draft-js-plugins/draft-js-plugins/packages/buttons/src | petrpan-code/draft-js-plugins/draft-js-plugins/packages/buttons/src/components/AlignBlockLeftButton.tsx | import React from 'react';
import createBlockAlignmentButton from '../utils/createBlockAlignmentButton';
export default createBlockAlignmentButton({
alignment: 'left',
children: (
<svg
height="24"
viewBox="0 0 24 24"
width="24"
xmlns="http://www.w3.org/2000/svg"
>
<path d="M21... | 3,269 |
0 | petrpan-code/draft-js-plugins/draft-js-plugins/packages/buttons/src | petrpan-code/draft-js-plugins/draft-js-plugins/packages/buttons/src/components/AlignBlockRightButton.tsx | import React from 'react';
import createBlockAlignmentButton from '../utils/createBlockAlignmentButton';
export default createBlockAlignmentButton({
alignment: 'right',
children: (
<svg
height="24"
viewBox="0 0 24 24"
width="24"
xmlns="http://www.w3.org/2000/svg"
>
<path d="M9... | 3,270 |
0 | petrpan-code/draft-js-plugins/draft-js-plugins/packages/buttons/src | petrpan-code/draft-js-plugins/draft-js-plugins/packages/buttons/src/components/AlignTextCenterButton.tsx | import React from 'react';
import createTextAlignmentButton from '../utils/createTextAlignmentButton';
export default createTextAlignmentButton({
alignment: 'center',
children: (
<svg
height="24"
viewBox="0 0 24 24"
width="24"
xmlns="http://www.w3.org/2000/svg"
>
<path d="M7 1... | 3,271 |
0 | petrpan-code/draft-js-plugins/draft-js-plugins/packages/buttons/src | petrpan-code/draft-js-plugins/draft-js-plugins/packages/buttons/src/components/AlignTextLeftButton.tsx | import React from 'react';
import createTextAlignmentButton from '../utils/createTextAlignmentButton';
export default createTextAlignmentButton({
alignment: 'left',
children: (
<svg
height="24"
viewBox="0 0 24 24"
width="24"
xmlns="http://www.w3.org/2000/svg"
>
<path d="M15 15... | 3,272 |
0 | petrpan-code/draft-js-plugins/draft-js-plugins/packages/buttons/src | petrpan-code/draft-js-plugins/draft-js-plugins/packages/buttons/src/components/AlignTextRightButton.tsx | import React from 'react';
import createTextAlignmentButton from '../utils/createTextAlignmentButton';
export default createTextAlignmentButton({
alignment: 'right',
children: (
<svg
height="24"
viewBox="0 0 24 24"
width="24"
xmlns="http://www.w3.org/2000/svg"
>
<path d="M3 21... | 3,273 |
0 | petrpan-code/draft-js-plugins/draft-js-plugins/packages/buttons/src | petrpan-code/draft-js-plugins/draft-js-plugins/packages/buttons/src/components/BlockquoteButton.tsx | import React from 'react';
import createBlockStyleButton from '../utils/createBlockStyleButton';
export default createBlockStyleButton({
blockType: 'blockquote',
children: (
<svg
height="24"
viewBox="0 0 24 24"
width="24"
xmlns="http://www.w3.org/2000/svg"
>
<path d="M6 17h3l2... | 3,274 |
0 | petrpan-code/draft-js-plugins/draft-js-plugins/packages/buttons/src | petrpan-code/draft-js-plugins/draft-js-plugins/packages/buttons/src/components/BoldButton.tsx | import React from 'react';
import createInlineStyleButton from '../utils/createInlineStyleButton';
export default createInlineStyleButton({
style: 'BOLD',
children: (
<svg
height="24"
viewBox="0 0 24 24"
width="24"
xmlns="http://www.w3.org/2000/svg"
>
<path d="M15.6 10.79c.97-... | 3,275 |
0 | petrpan-code/draft-js-plugins/draft-js-plugins/packages/buttons/src | petrpan-code/draft-js-plugins/draft-js-plugins/packages/buttons/src/components/CodeBlockButton.tsx | import React from 'react';
import createBlockStyleButton from '../utils/createBlockStyleButton';
export default createBlockStyleButton({
blockType: 'code-block',
children: (
<svg
height="24"
viewBox="0 0 24 24"
width="24"
xmlns="http://www.w3.org/2000/svg"
>
<path d="M0 0h24v2... | 3,276 |
0 | petrpan-code/draft-js-plugins/draft-js-plugins/packages/buttons/src | petrpan-code/draft-js-plugins/draft-js-plugins/packages/buttons/src/components/CodeButton.tsx | import React from 'react';
import createInlineStyleButton from '../utils/createInlineStyleButton';
export default createInlineStyleButton({
style: 'CODE',
children: (
<svg
height="24"
viewBox="0 0 24 24"
width="24"
xmlns="http://www.w3.org/2000/svg"
>
<path d="M0 0h24v24H0V0z"... | 3,277 |
0 | petrpan-code/draft-js-plugins/draft-js-plugins/packages/buttons/src | petrpan-code/draft-js-plugins/draft-js-plugins/packages/buttons/src/components/HeadlineOneButton.tsx | import createBlockStyleButton from '../utils/createBlockStyleButton';
export default createBlockStyleButton({
blockType: 'header-one',
children: 'H1',
});
| 3,278 |
0 | petrpan-code/draft-js-plugins/draft-js-plugins/packages/buttons/src | petrpan-code/draft-js-plugins/draft-js-plugins/packages/buttons/src/components/HeadlineThreeButton.tsx | import createBlockStyleButton from '../utils/createBlockStyleButton';
export default createBlockStyleButton({
blockType: 'header-three',
children: 'H3',
});
| 3,279 |
0 | petrpan-code/draft-js-plugins/draft-js-plugins/packages/buttons/src | petrpan-code/draft-js-plugins/draft-js-plugins/packages/buttons/src/components/HeadlineTwoButton.tsx | import createBlockStyleButton from '../utils/createBlockStyleButton';
export default createBlockStyleButton({
blockType: 'header-two',
children: 'H2',
});
| 3,280 |
0 | petrpan-code/draft-js-plugins/draft-js-plugins/packages/buttons/src | petrpan-code/draft-js-plugins/draft-js-plugins/packages/buttons/src/components/ItalicButton.tsx | import React from 'react';
import createInlineStyleButton from '../utils/createInlineStyleButton';
export default createInlineStyleButton({
style: 'ITALIC',
children: (
<svg
height="24"
viewBox="0 0 24 24"
width="24"
xmlns="http://www.w3.org/2000/svg"
>
<path d="M0 0h24v24H0z"... | 3,281 |
0 | petrpan-code/draft-js-plugins/draft-js-plugins/packages/buttons/src | petrpan-code/draft-js-plugins/draft-js-plugins/packages/buttons/src/components/OrderedListButton.tsx | import React from 'react';
import createBlockStyleButton from '../utils/createBlockStyleButton';
export default createBlockStyleButton({
blockType: 'ordered-list-item',
children: (
<svg
height="24"
viewBox="0 0 24 24"
width="24"
xmlns="http://www.w3.org/2000/svg"
>
<path d="M2... | 3,282 |
0 | petrpan-code/draft-js-plugins/draft-js-plugins/packages/buttons/src | petrpan-code/draft-js-plugins/draft-js-plugins/packages/buttons/src/components/SubButton.tsx | import React from 'react';
import createInlineStyleButton from '../utils/createInlineStyleButton';
export default createInlineStyleButton({
style: 'SUBSCRIPT',
children: (
<div>
x<sub>2</sub>
</div>
),
});
| 3,283 |
0 | petrpan-code/draft-js-plugins/draft-js-plugins/packages/buttons/src | petrpan-code/draft-js-plugins/draft-js-plugins/packages/buttons/src/components/SupButton.tsx | import React from 'react';
import createInlineStyleButton from '../utils/createInlineStyleButton';
export default createInlineStyleButton({
style: 'SUPERSCRIPT',
children: (
<div>
x<sup>2</sup>
</div>
),
});
| 3,284 |
0 | petrpan-code/draft-js-plugins/draft-js-plugins/packages/buttons/src | petrpan-code/draft-js-plugins/draft-js-plugins/packages/buttons/src/components/UnderlineButton.tsx | import React from 'react';
import createInlineStyleButton from '../utils/createInlineStyleButton';
export default createInlineStyleButton({
style: 'UNDERLINE',
children: (
<svg
height="24"
viewBox="0 0 24 24"
width="24"
xmlns="http://www.w3.org/2000/svg"
>
<path d="M0 0h24v24H... | 3,285 |
0 | petrpan-code/draft-js-plugins/draft-js-plugins/packages/buttons/src | petrpan-code/draft-js-plugins/draft-js-plugins/packages/buttons/src/components/UnorderedListButton.tsx | import React from 'react';
import createBlockStyleButton from '../utils/createBlockStyleButton';
export default createBlockStyleButton({
blockType: 'unordered-list-item',
children: (
<svg
height="24"
viewBox="0 0 24 24"
width="24"
xmlns="http://www.w3.org/2000/svg"
>
<path d="... | 3,286 |
0 | petrpan-code/draft-js-plugins/draft-js-plugins/packages/buttons/src | petrpan-code/draft-js-plugins/draft-js-plugins/packages/buttons/src/utils/createBlockAlignmentButton.tsx | /* eslint-disable react/no-children-prop */
import clsx from 'clsx';
import React, { MouseEvent, ReactNode } from 'react';
import { DraftJsBlockAlignmentButtonType } from '..';
interface CreateBlockAlignmentButtonProps {
alignment: string;
children: ReactNode;
}
export default function createBlockAlignmentButton(... | 3,287 |
0 | petrpan-code/draft-js-plugins/draft-js-plugins/packages/buttons/src | petrpan-code/draft-js-plugins/draft-js-plugins/packages/buttons/src/utils/createBlockStyleButton.tsx | /* eslint-disable react/no-children-prop */
import clsx from 'clsx';
import { RichUtils } from 'draft-js';
import React, { MouseEvent, ReactNode } from 'react';
import { DraftJsStyleButtonType } from '..';
interface CreateBlockStyleButtonProps {
blockType: string;
children: ReactNode;
}
export default function cr... | 3,288 |
0 | petrpan-code/draft-js-plugins/draft-js-plugins/packages/buttons/src | petrpan-code/draft-js-plugins/draft-js-plugins/packages/buttons/src/utils/createInlineStyleButton.tsx | /* eslint-disable react/no-children-prop */
import clsx from 'clsx';
import { RichUtils } from 'draft-js';
import React, { MouseEvent, ReactNode } from 'react';
import { DraftJsStyleButtonType } from '..';
interface CreateInlineStyleButtonProp {
style: string;
children: ReactNode;
}
export default function create... | 3,289 |
0 | petrpan-code/draft-js-plugins/draft-js-plugins/packages/buttons/src | petrpan-code/draft-js-plugins/draft-js-plugins/packages/buttons/src/utils/createTextAlignmentButton.tsx | /* eslint-disable react/no-children-prop */
import clsx from 'clsx';
import { EditorState, Modifier } from 'draft-js';
import React, { MouseEvent, ReactNode } from 'react';
import { DraftJsStyleButtonType } from '..';
interface CreateTextAlignmentButtonProp {
alignment: string;
children: ReactNode;
}
export defau... | 3,290 |
0 | petrpan-code/draft-js-plugins/draft-js-plugins/packages | petrpan-code/draft-js-plugins/draft-js-plugins/packages/counter/CHANGELOG.md | # Change Log
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).
## To Be Released
## 4.1.3
- adjust react peer dependency
## 4.1.2
- support react 18 in peer dependencies [#2701](https://github.com/draft-js-plugins/draft-js-plugi... | 3,291 |
0 | petrpan-code/draft-js-plugins/draft-js-plugins/packages | petrpan-code/draft-js-plugins/draft-js-plugins/packages/counter/LICENSE | Copyright (c) 2016 Nikolaus Graf
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, subl... | 3,292 |
0 | petrpan-code/draft-js-plugins/draft-js-plugins/packages | petrpan-code/draft-js-plugins/draft-js-plugins/packages/counter/README.md | # DraftJS Counter Plugin
_This is a plugin for the `@draft-js-plugins/editor`._
This plugin adds character and word counting functionality to your editor!
## Usage
see https://www.draft-js-plugins.com/plugin/counter
| 3,293 |
0 | petrpan-code/draft-js-plugins/draft-js-plugins/packages | petrpan-code/draft-js-plugins/draft-js-plugins/packages/counter/jest.config.js | const base = require('../../jest.config.base.js');
const packageName = require('./package').name;
module.exports = {
...base,
displayName: packageName,
name: packageName,
};
| 3,294 |
0 | petrpan-code/draft-js-plugins/draft-js-plugins/packages | petrpan-code/draft-js-plugins/draft-js-plugins/packages/counter/package.json | {
"name": "@draft-js-plugins/counter",
"version": "4.1.3",
"sideEffects": ["*.css"],
"description": "Counter Plugin for DraftJS",
"author": {
"name": "Adrian Li",
"email": "li.adrianmc@gmail.com",
"url": "http://www.adrianmcli.com"
},
"repository": {
"type": "git",
"url": "https://gith... | 3,295 |
0 | petrpan-code/draft-js-plugins/draft-js-plugins/packages | petrpan-code/draft-js-plugins/draft-js-plugins/packages/counter/tsconfig.json | {
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "lib"
},
"include": ["src"]
}
| 3,296 |
0 | petrpan-code/draft-js-plugins/draft-js-plugins/packages/counter | petrpan-code/draft-js-plugins/draft-js-plugins/packages/counter/src/index.tsx | import React, { ComponentType, ReactElement } from 'react';
import { EditorState } from 'draft-js';
import { EditorPlugin } from '@draft-js-plugins/editor';
import CharCounter, { CharCounterPubProps } from './CharCounter';
import WordCounter, { WordCounterPubParams } from './WordCounter';
import LineCounter, { LineCoun... | 3,297 |
0 | petrpan-code/draft-js-plugins/draft-js-plugins/packages/counter | petrpan-code/draft-js-plugins/draft-js-plugins/packages/counter/src/theme.ts | import { css } from 'linaria';
export interface CounterPluginTheme {
counter?: string;
counterOverLimit?: string;
}
export const defaultTheme: CounterPluginTheme = {
counter: css`
color: inherit;
`,
counterOverLimit: css`
color: #d86262;
`,
};
| 3,298 |
0 | petrpan-code/draft-js-plugins/draft-js-plugins/packages/counter/src | petrpan-code/draft-js-plugins/draft-js-plugins/packages/counter/src/CharCounter/index.tsx | import React, { ReactElement } from 'react';
import PropTypes from 'prop-types';
import clsx from 'clsx';
import punycode from 'punycode';
import { EditorState } from 'draft-js';
import { CounterPluginTheme } from '../theme';
import { CounterPluginStore } from '..';
export interface CharCounterPubProps {
className?:... | 3,299 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.