Skip to content

Commit

Permalink
Merge pull request #34 from contco/develop
Browse files Browse the repository at this point in the history
merge v1.1.16 into master
  • Loading branch information
Fahad-Mahmood authored Sep 21, 2022
2 parents 3daf876 + 90ea365 commit f193a40
Show file tree
Hide file tree
Showing 65 changed files with 28,160 additions and 35,350 deletions.
34 changes: 0 additions & 34 deletions .eslintrc

This file was deleted.

77 changes: 77 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
module.exports = {
env: {
browser: true,
node: true,
jest: true,
},
extends: [
'plugin:react/recommended',
"plugin:react-hooks/recommended",
'airbnb',
'prettier/@typescript-eslint',
'plugin:prettier/recommended',
'prettier/react'
],
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaFeatures: {
jsx: true,
},
ecmaVersion: 12,
sourceType: 'module',
},
settings: {
react: {
version: "detect"
},
"import/resolver": {
"node": {
"extensions": [".js", ".jsx", ".ts", ".tsx"]
}
}
},
plugins: [
'react',
'prettier',
'@typescript-eslint'
],
rules: {
"react/react-in-jsx-scope": "off",
"no-undef": "off",
"no-use-before-define": "off",
"no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": [
"error"
],
"react/jsx-props-no-spreading": "off",
"@typescript-eslint/no-use-before-define": ["error"],
"jsx-a11y/anchor-is-valid": [
'error',
{
components: ['Link'],
specialLink: ['hrefLeft', 'hrefRight'],
aspects: ['invalidHref', 'preferButton']
}
],
"prettier/prettier": ["error"],
"react/jsx-filename-extension": [1, {
"extensions": [".tsx", ".ts"]
}],
"import/extensions": [
"error",
"ignorePackages",
{
"js": "never",
"jsx": "never",
"ts": "never",
"tsx": "never"
}
]
},
"overrides": [{
"files": ["**/*.tsx"],
"rules": {
"react/prop-types": "off"
}
}]
};
39 changes: 39 additions & 0 deletions .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Node.js Package

on:
push:
branches:
- develop
jobs:

build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 12
- run: npm install
- run: npm ci

publish-gpr:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 12
registry-url: https://npm.pkg.github.com/
scope: '@contco'
- run: npm install
- run: npm ci
- run: |
git config user.email ""
git config user.name "Publish Action"
- run: |
npm version patch -f
git push "https://$GITHUB_ACTOR:[email protected]/$GITHUB_REPOSITORY"
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
15 changes: 15 additions & 0 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Node.js Package

on: [pull_request]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 12
- run: npm install
- run: npm ci
- run: npm run lint
11 changes: 11 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,14 @@ dist
npm-debug.log*
yarn-debug.log*
yarn-error.log*


#yarn

.yarn/*
!.yarn/patches
!.yarn/releases
!.yarn/plugins
!.yarn/sdks
!.yarn/versions
.pnp.*
17 changes: 17 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
.eslintrc.js
# dependencies
/node_modules
package-lock.json
yarn.lock

# production
/build

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*

#misc
/public/
/assets/
10 changes: 0 additions & 10 deletions .prettierrc

This file was deleted.

8 changes: 8 additions & 0 deletions .prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
module.exports = {
semi: true,
trailingComma: 'all',
singleQuote: true,
printWidth: 120,
tabWidth: 2,
endOfLine: 'auto',
};
6 changes: 6 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
}
}
1 change: 1 addition & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
nodeLinker: node-modules
57 changes: 50 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,63 @@
## Install

```bash
npm install --save editor
npm install @contco/editor@1.0.3
```

## Usage

```tsx
import React, { Component } from 'react'
import React, {useState} from 'react'

import MyComponent from 'editor'
import Editor from 'editor'
import 'editor/dist/index.css'

class Example extends Component {
render() {
return <MyComponent />
}
const App = () => {
const [document, setDocument] = useState<any>(initialValue);

const setContent = (content: any) => {
setDocument(content);
};
return (
<Editor data={document} setContent={setContent} readOnly={false} />

)
}
const initialValue = [
{
type: 'paragraph',
children: [
{ text: 'This is editable ' },
{ text: 'rich', bold: true },
{ text: ' text, ' },
{ text: 'much', italic: true },
{ text: ' better than a ' },
{ text: '<textarea>', code: true },
{ text: '!' },
],
},
{
type: 'paragraph',
children: [
{
text:
"Since it's rich text, you can do things like turn a selection of text ",
},
{ text: 'bold', bold: true },
{
text:
', or add a semantically rendered block quote in the middle of the page, like this:',
},
],
},
{
type: 'block-quote',
children: [{ text: 'A wise quote.' }],
},
{
type: 'paragraph',
children: [{ text: 'Try it out for yourself!' }],
},
]
```

9 changes: 9 additions & 0 deletions example/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#yarn

.yarn/*
!.yarn/patches
!.yarn/releases
!.yarn/plugins
!.yarn/sdks
!.yarn/versions
.pnp.*
Loading

0 comments on commit f193a40

Please sign in to comment.