Skip to content

Commit

Permalink
refactor: move files around and copy over readme file
Browse files Browse the repository at this point in the history
  • Loading branch information
ifiokjr committed Jan 30, 2019
1 parent b108534 commit 281a682
Show file tree
Hide file tree
Showing 70 changed files with 174 additions and 15 deletions.
1 change: 0 additions & 1 deletion .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
---
name: Bug report
about: Create a report to help us improve

---

<!--- Provide a general summary of the issue in the Title above -->
Expand Down
3 changes: 0 additions & 3 deletions .github/ISSUE_TEMPLATE/custom.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
---
name: Custom issue template
about: Describe this issue template's purpose here.

---


1 change: 0 additions & 1 deletion .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
---
name: Feature request
about: Suggest an idea for this project

---

<!--- Provide a general summary of the issue in the Title above -->
Expand Down
6 changes: 3 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,9 @@ tmp**
.local.env

# Only keep the workspace yarn.lock file
@packages/**/yarn.lock
@remirror/**/yarn.lock
@apps/**/yarn.lock
@cloud/**/yarn.lock
@deps/**/yarn.lock
dependencies/**/yarn.lock

./**/.vscode
./**/.vscode
Empty file removed @packages/remirror/README.md
Empty file.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
164 changes: 164 additions & 0 deletions @remirror/remirror/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,164 @@
# Remirror

Remirror is an extensible text-editor for react, built on top of Prosemirror. It aims to be **the** goto editor for a reliable editing experience across all JavaScript and user-facing environments.

The project is still in its early days and several of the ideas featured here still need to be fleshed out.

## Getting Started

### Prerequisites

You can use either npm or yarn for managing packages. This project has been built with yarn workspaces so all further instructions will assume you're using `yarn`. For help translating commands refer to this helpful [document](https://yarnpkg.com/lang/en/docs/migrating-from-npm/#toc-cli-commands-comparison)

#### TypeScript Users

This project is built with and should work with version `>=3.0`.

### Installing

A step by step series of examples that tell you how to get a development env running

Say what the step will be

```bash
yarn add remirror
```

Then import the main component into your codebase.

Import and use the component with the child component as a render function.

```ts
import { Remirror } from 'remirror';

const Editor = props => (
<Remirror
onChange={onChange}
placeholder='This is a placeholder'
autoFocus={true}
initialContent={initialJson}
>
{({ getMenuProps, actions }) => {
const menuProps = getMenuProps({
name: 'floating-menu',
});
return (
<div>
<div
style={{
position: 'absolute',
top: menuProps.position.top,
left: menuProps.position.left,
}}
ref={menuProps.ref}
>
<button
style={{
backgroundColor: actions.bold.isActive() ? 'white' : 'pink',
fontWeight: actions.bold.isActive() ? 600 : 300,
}}
disabled={!actions.bold.isEnabled()}
onClick={runAction(actions.bold.run)}
>
B
</button>
</div>
</div>
);
}}
</Remirror>
);
```

React hooks can also be used to pull the Remirror Context from a parent provider. This api relies on the new(ish) hooks specification and React Context.

```ts
import { RemirrorProvider, useRemirror } from 'remirror';

// ...

function HooksComponent(props) {
// This pull the remirror props out from the context.
const { getMenuProps } = useRemirror();

// ...
return <Menu {...getMenuProps()} />;
}

class App extends Component {
// ...
render() {
return (
<RemirrorProvider>
<HooksComponent />
</RemirrorProvider>
);
}
}
```

In a similar fashion Higher Order Components (HOC's) can be used to wrap a component.

```ts
import { RemirrorProvider, withRemirror, InjectedRemirrorProps } from 'remirror';

// ...

function EditorComponent(props: InjectedRemirrorProps) {
const { getMenuProps } = props;

// ...
return <Menu {...getMenuProps()} />;
}

const WrappedEditorComponent = withRemirror(EditorComponent);

class App extends Component {
// ...
render() {
return (
<RemirrorProvider>
<WrappedEditorComponent />
</RemirrorProvider>
);
}
}
```

## Running the tests

From the root of this repository run the following to trigger a full typecheck, linting and jest tests.

```bash
yarn checks
```

By default these checks are run on every push but eventually this will be configurable.

- [ ] Add private config option for switching off precommit and prepush checks.

## Built With

- [React](https://github.com/facebook/react) - The web framework used
- [Prosemirror](https://prosemirror.net) - A beautiful and elegant text editor for DOM environments.

## Contributing

Please read [CONTRIBUTING.md](https://github.com/ifiokjr/remirror/blob/master/CONTRIBUTING.md) for details on our code of conduct, and the process for submitting pull requests to us.

## Versioning

We use [SemVer](http://semver.org/) for versioning. For the versions available, see the [tags on this repository](https://github.com/ifiokjr/remirror/tags).

## Contributors

- **Ifiok Jr.** - _Initial work_ - [ifiokjr](https://github.com/ifiokjr)

## License

This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details

## Acknowledgments

- Many ideas were ~~stolen~~ borrowed from **[tiptap](https://github.com/heyscrumpy/tiptap)** which is a prosemirror editor for Vue. The concept of extensions and a lot of the early code was a direct port from this library.
- At the time I started thinking about building an editor [Slate](https://github.com/ianstormtaylor) didn't have great support for Android devices (they've since addressed [this here](https://github.com/ianstormtaylor/slate/pull/2553))
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ module.exports = {
],
'@babel/preset-typescript',
],
babelrcRoots: ['./', './@packages/*'],
babelrcRoots: ['./', './@remirror/*'],
};
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ module.exports = {
'!jest.*.ts',
],
coveragePathIgnorePatterns: ['**/dtslint/*.ts'],
projects: ['<rootDir>/@packages/*'], // Doesn't work with only one project https://github.com/facebook/jest/pull/7498
projects: ['<rootDir>/@remirror/*'], // Doesn't work with only one project https://github.com/facebook/jest/pull/7498
watchPlugins: ['jest-watch-typeahead/filename', 'jest-watch-typeahead/testname'],
...(process.env.TEST_ENV ? coverageThreshold : {}),
};
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"packages": ["@packages/*", "@deps/*"],
"packages": ["@remirror/*", "dependencies/*"],
"publish": {},
"command": {
"publish": {
Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
"name": "root",
"workspaces": {
"packages": [
"@packages/*",
"@deps/*"
"@remirror/*",
"dependencies/*"
]
},
"scripts": {
Expand Down Expand Up @@ -32,7 +32,7 @@
}
},
"lint-staged": {
"@packages/*/src/**/*.{ts,tsx}": [
"@remirror/*/src/**/*.{ts,tsx}": [
"tslint --fix",
"git add",
"jest --coverage=false --bail --findRelatedTests"
Expand All @@ -57,7 +57,7 @@
"prettier-package-json --write",
"git add"
],
"@{packages,deps}/*/package.json": [
"**/package.json": [
"prettier-package-json --write",
"git add"
]
Expand Down

0 comments on commit 281a682

Please sign in to comment.