Skip to content

Commit 69e594b

Browse files
authored
Setup (#2)
* improve setup * fix lint * main setup * placeholders * playwright setup * document blocks * fix ci * add docs
1 parent 92e71d3 commit 69e594b

File tree

73 files changed

+10180
-3849
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+10180
-3849
lines changed

.github/workflows/build.yml

+10
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,21 @@ jobs:
3030
- name: Bootstrap packages
3131
run: npm run bootstrap
3232

33+
- name: Lint packages
34+
run: npm run lint
35+
env:
36+
CI: true
37+
3338
- name: Build packages
3439
run: npm run build
3540
env:
3641
CI: true
3742

43+
- name: Run server
44+
run: npm run start:built & npx wait-on http://localhost:3000
45+
env:
46+
CI: true
47+
3848
- name: Install Playwright
3949
run: npx playwright install --with-deps
4050

.github/workflows/cla.yml

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: "CLA Assistant"
2+
on:
3+
issue_comment:
4+
types: [created]
5+
pull_request_target:
6+
types: [opened, closed, synchronize]
7+
8+
jobs:
9+
CLAssistant:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: "CLA Assistant"
13+
if: (github.event.comment.body == 'recheck' || github.event.comment.body == 'I have read the CLA Document and I hereby sign the CLA') || github.event_name == 'pull_request_target'
14+
# Beta Release
15+
uses: cla-assistant/[email protected]
16+
env:
17+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
18+
# the below token should have repo scope and must be manually added by you in the repository's secret
19+
PERSONAL_ACCESS_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
20+
with:
21+
path-to-signatures: ".signatures/v1/cla.json"
22+
path-to-document: "https://github.com/YousefED/blocknote/blob/main/CLA.md" # e.g. a CLA or a DCO document
23+
# branch should not be protected
24+
branch: "main"
25+
# allowlist: user1,bot*
26+
27+
#below are the optional inputs - If the optional inputs are not given, then default values will be taken
28+
#remote-organization-name: enter the remote organization name where the signatures should be stored (Default is storing the signatures in the same repository)
29+
#remote-repository-name: enter the remote repository name where the signatures should be stored (Default is storing the signatures in the same repository)
30+
#create-file-commit-message: 'For example: Creating file for storing CLA Signatures'
31+
#signed-commit-message: 'For example: $contributorName has signed the CLA in #$pullRequestNo'
32+
#custom-notsigned-prcomment: 'pull request comment with Introductory message to ask new contributors to sign'
33+
#custom-pr-sign-comment: 'The signature to be committed in order to sign the CLA'
34+
#custom-allsigned-prcomment: 'pull request comment when all contributors has signed, defaults to **CLA Assistant Lite bot** All Contributors have signed the CLA.'
35+
#lock-pullrequest-aftermerge: false - if you don't want this bot to automatically lock the pull request after merging (default - true)
36+
#use-dco-flag: true - If you are using DCO instead of CLA

.signatures/v1/cla.json

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"signedContributors": []
3+
}

.vscode/extensions.json

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
// See http://go.microsoft.com/fwlink/?LinkId=827846
3+
// for the documentation about the extensions.json format
4+
"recommendations": [
5+
"esbenp.prettier-vscode",
6+
"dbaeumer.vscode-eslint",
7+
"orta.vscode-jest"
8+
]
9+
}

.vscode/settings.json

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"editor.defaultFormatter": "esbenp.prettier-vscode",
3+
"editor.formatOnSave": true,
4+
"[javascript]": { "editor.defaultFormatter": "esbenp.prettier-vscode" },
5+
"[typescript]": { "editor.defaultFormatter": "esbenp.prettier-vscode" },
6+
"[typescriptreact]": {
7+
"editor.defaultFormatter": "esbenp.prettier-vscode"
8+
},
9+
"search.exclude": {
10+
"packages/editor/public/types": true
11+
}
12+
}

CLA.md

+55
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
### TypeCell Individual Contributor License Agreement
2+
3+
Thank you for your interest in contributing to open source software projects (“Projects”) made available by Yousef El-Dardiry, Soft Parade B.V. or its affiliates (“TypeCell“). This Individual Contributor License Agreement (“Agreement”) sets out the terms governing any source code, object code, bug fixes, configuration changes, tools, specifications, documentation, data, materials, feedback, information or other works of authorship that you submit or have submitted, in any form and in any manner, to TypeCell in respect of any of the Projects (collectively “Contributions”). If you have any questions respecting this Agreement, please contact [email protected].
4+
5+
You agree that the following terms apply to all of your past, present and future Contributions. Except for the licenses granted in this Agreement, you retain all of your right, title and interest in and to your Contributions.
6+
7+
**Copyright License.** You hereby grant, and agree to grant, to TypeCell a non-exclusive, perpetual, irrevocable, worldwide, fully-paid, royalty-free, transferable copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, and distribute your Contributions and such derivative works, with the right to sublicense the foregoing rights through multiple tiers of sublicensees.
8+
9+
**Patent License.** You hereby grant, and agree to grant, to TypeCell a non-exclusive, perpetual, irrevocable,
10+
worldwide, fully-paid, royalty-free, transferable patent license to make, have made, use, offer to sell, sell,
11+
import, and otherwise transfer your Contributions, where such license applies only to those patent claims
12+
licensable by you that are necessarily infringed by your Contributions alone or by combination of your
13+
Contributions with the Project to which such Contributions were submitted, with the right to sublicense the
14+
foregoing rights through multiple tiers of sublicensees.
15+
16+
**Moral Rights.** To the fullest extent permitted under applicable law, you hereby waive, and agree not to
17+
assert, all of your “moral rights” in or relating to your Contributions for the benefit of TypeCell, its assigns, and
18+
their respective direct and indirect sublicensees.
19+
20+
**Third Party Content/Rights.** If your Contribution includes or is based on any source code, object code, bug
21+
fixes, configuration changes, tools, specifications, documentation, data, materials, feedback, information or
22+
other works of authorship that were not authored by you (“Third Party Content”) or if you are aware of any
23+
third party intellectual property or proprietary rights associated with your Contribution (“Third Party Rights”),
24+
then you agree to include with the submission of your Contribution full details respecting such Third Party
25+
Content and Third Party Rights, including, without limitation, identification of which aspects of your
26+
Contribution contain Third Party Content or are associated with Third Party Rights, the owner/author of the
27+
Third Party Content and Third Party Rights, where you obtained the Third Party Content, and any applicable
28+
third party license terms or restrictions respecting the Third Party Content and Third Party Rights. For greater
29+
certainty, the foregoing obligations respecting the identification of Third Party Content and Third Party Rights
30+
do not apply to any portion of a Project that is incorporated into your Contribution to that same Project.
31+
32+
**Representations.** You represent that, other than the Third Party Content and Third Party Rights identified by
33+
you in accordance with this Agreement, you are the sole author of your Contributions and are legally entitled
34+
to grant the foregoing licenses and waivers in respect of your Contributions. If your Contributions were
35+
created in the course of your employment with your past or present employer(s), you represent that such
36+
employer(s) has authorized you to make your Contributions on behalf of such employer(s) or such employer
37+
(s) has waived all of their right, title or interest in or to your Contributions.
38+
39+
**Disclaimer.** To the fullest extent permitted under applicable law, your Contributions are provided on an "asis"
40+
basis, without any warranties or conditions, express or implied, including, without limitation, any implied
41+
warranties or conditions of non-infringement, merchantability or fitness for a particular purpose. You are not
42+
required to provide support for your Contributions, except to the extent you desire to provide support.
43+
44+
**No Obligation.** You acknowledge that TypeCell is under no obligation to use or incorporate your Contributions
45+
into any of the Projects. The decision to use or incorporate your Contributions into any of the Projects will be
46+
made at the sole discretion of TypeCell or its authorized delegates ..
47+
48+
**Disputes.** This Agreement shall be governed by and construed in accordance with the laws of the The Netherlands, without giving effect to its principles or rules regarding conflicts of laws,
49+
other than such principles directing application of The Netherlands law. The parties hereby submit to venue in, and
50+
jurisdiction of the courts located in The Netherlands for purposes relating to this Agreement. In the event
51+
that any of the provisions of this Agreement shall be held by a court or other tribunal of competent jurisdiction
52+
to be unenforceable, the remaining portions hereof shall remain in full force and effect.
53+
54+
**Assignment.** You agree that TypeCell may assign this Agreement, and all of its rights, obligations and licenses
55+
hereunder.

README.md

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# BlockNote
2+
3+
Welcome to the BlockNote editor. Let's build a block based WYSIWYG editor with killer UX!
4+
5+
```
6+
blocknote
7+
├── packages/core - The editor that can be used in other applications
8+
├── examples/editor - The main example application that just embeds the editor
9+
└── tests - Playwright end to end tests
10+
```
11+
12+
# Development
13+
14+
We use [Lerna](https://lerna.js.org/) to manage the monorepo with separate packages.
15+
16+
## Running
17+
18+
To run the project, open the command line in the project's root directory and enter the following commands:
19+
20+
# Install all required npm modules for lerna, and bootstrap lerna packages
21+
npm run install-lerna
22+
npm run bootstrap
23+
24+
# Start the editor project
25+
npm start
26+
27+
## Updating packages
28+
29+
If you've pulled changes from git that add new or update existing dependencies, use `npm run bootstrap` instead of `npm install` to install updated dependencies!
30+
31+
## Adding packages
32+
33+
- Add the dependency to the relevant `package.json` file (packages/xxx/package.json)
34+
- run `npm run install-new-packages`
35+
- Double check `package-lock.json` to make sure only the relevant packages have been affected

examples/editor/README.md

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Editor example
2+
3+
This is an example client application that consumes @blocknote/core.

examples/editor/package.json

+14-4
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,29 @@
55
"scripts": {
66
"dev": "vite",
77
"build": "tsc && vite build",
8-
"preview": "vite preview"
8+
"preview": "vite preview",
9+
"lint": "eslint src --max-warnings 0"
910
},
1011
"dependencies": {
1112
"@blocknote/core": "*",
1213
"react": "^17.0.2",
1314
"react-dom": "^17.0.2"
1415
},
1516
"devDependencies": {
16-
"@types/react": "^17.0.33",
17-
"@types/react-dom": "^17.0.10",
17+
"@types/react": "^17.0.39",
18+
"@types/react-dom": "^17.0.12",
1819
"@vitejs/plugin-react": "^1.0.7",
1920
"typescript": "^4.5.4",
20-
"vite": "^2.8.0"
21+
"vite": "^2.8.0",
22+
"eslint-config-react-app": "^7.0.0",
23+
"eslint": "^8.10.0",
24+
"vite-plugin-eslint": "^1.3.0"
25+
},
26+
"eslintConfig": {
27+
"extends": [
28+
"react-app",
29+
"react-app/jest"
30+
]
2131
},
2232
"workspaces": {
2333
"nohoist": [

examples/editor/src/App.module.css

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
.editor {
2+
padding: 0 calc((100% - 731px) / 2);
3+
height: 100%;
4+
}

examples/editor/src/App.tsx

+11-28
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,23 @@
1-
import { useState } from 'react'
2-
31
// import logo from './logo.svg'
4-
// import './App.css'
5-
import { useEditor, EditorContent } from "@blocknote/core";
6-
2+
import styles from "./App.module.css";
3+
import { EditorContent, useEditor } from "@blocknote/core";
4+
import React from "react";
75
// import "@blocknote/core/style.css";
86

97
function App() {
10-
11-
128
const editor = useEditor({
139
onUpdate: ({ editor }) => {
1410
console.log(editor.getJSON());
1511
},
16-
// editorProps: {
17-
// attributes: {
18-
// class: "editor",
19-
// },
20-
// },
12+
editorProps: {
13+
attributes: {
14+
class: styles.editor,
15+
"data-test": "editor",
16+
},
17+
},
2118
});
2219

23-
return (
24-
<div>
25-
{/* {editor != null ? (
26-
<InlineMenu editor={editor} commentStore={commentStore} />
27-
) : null}
28-
{editor != null ? <TableMenu editor={editor} /> : null}
29-
{editor != null ? (
30-
<CommentWrapper editor={editor} commentStore={commentStore} />
31-
) : null} */}
32-
{/* <EngineContext.Provider */}
33-
{/* value={{ compiler, executionHost, document: props.document }}> */}
34-
<EditorContent editor={editor} />
35-
{/* </EngineContext.Provider> */}
36-
</div>
37-
);
20+
return <EditorContent editor={editor} />;
3821
}
3922

40-
export default App
23+
export default App;

examples/editor/src/index.css

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
html,
2+
body,
3+
#root {
4+
height: 100%;
5+
}

examples/editor/src/main.tsx

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
import React from 'react'
2-
import ReactDOM from 'react-dom'
3-
// import './index.css'
4-
import App from './App'
1+
import React from "react";
2+
import ReactDOM from "react-dom";
3+
import "./index.css";
4+
import App from "./App";
55

66
ReactDOM.render(
77
<React.StrictMode>
88
<App />
99
</React.StrictMode>,
10-
document.getElementById('root')
11-
)
10+
document.getElementById("root")
11+
);

examples/editor/tsconfig.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"resolveJsonModule": true,
1515
"isolatedModules": true,
1616
"noEmit": true,
17-
"jsx": "react-jsx",
17+
"jsx": "react",
1818
"paths": {
1919
"@blocknote/core": ["../../packages/core/src"]
2020
}

examples/editor/vite.config.ts

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
11
import { defineConfig } from "vite";
22
import react from "@vitejs/plugin-react";
33
import * as path from "path";
4+
import eslintPlugin from "vite-plugin-eslint";
45

56
// https://vitejs.dev/config/
67
export default defineConfig({
7-
plugins: [react()],
8+
plugins: [
9+
react({
10+
jsxRuntime: "classic", // TODO: would prefer to move to new jsxRuntime
11+
}),
12+
eslintPlugin(),
13+
],
814
optimizeDeps: {
915
// link: ['vite-react-ts-components'],
1016
},

0 commit comments

Comments
 (0)