Skip to content

Commit f387ad3

Browse files
authored
feat(pm): new prosemirror package for dependency resolving
* chore:(core): migrate to tsup * chore: migrate blockquote and bold to tsup * chore: migrated bubble-menu and bullet-list to tsup * chore: migrated more packages to tsup * chore: migrate code and character extensions to tsup * chore: update package.json to simplify build for all packages * chore: move all packages to tsup as a build process * chore: change ci build task * feat(pm): add prosemirror meta package * rfix: resolve issues with build paths & export mappings * docs: update documentation to include notes for @tiptap/pm * chore(pm): update tsconfig * chore(packages): update packages * fix(pm): add package export infos & fix dependencies * chore(general): start moving to pm package as deps * chore: move to tiptap pm package internally * fix(demos): fix demos working with new pm package * fix(tables): fix tables package * fix(tables): fix tables package * chore(demos): pinned typescript version * chore: remove unnecessary tsconfig * chore: fix netlify build * fix(demos): fix package resolving for pm packages * fix(tests): fix package resolving for pm packages * fix(tests): fix package resolving for pm packages * chore(tests): fix tests not running correctly after pm package * chore(pm): add files to files array * chore: update build workflow * chore(tests): increase timeout time back to 12s * chore(docs): update docs * chore(docs): update installation guides & pm information to docs * chore(docs): add link to prosemirror docs * fix(vue-3): add missing build step * chore(docs): comment out cdn link * chore(docs): remove semicolons from docs * chore(docs): remove unnecessary installation note * chore(docs): remove unnecessary installation note
1 parent 0ecb5a8 commit f387ad3

File tree

271 files changed

+3933
-3154
lines changed

Some content is hidden

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

271 files changed

+3933
-3154
lines changed

.github/workflows/build.yml

+124-119
Original file line numberDiff line numberDiff line change
@@ -23,50 +23,49 @@ jobs:
2323
node-version: [16]
2424

2525
steps:
26-
27-
- uses: actions/[email protected]
28-
29-
- name: Use Node.js ${{ matrix.node-version }}
30-
uses: actions/[email protected]
31-
with:
32-
node-version: ${{ matrix.node-version }}
33-
34-
- name: Load cached dependencies
35-
uses: actions/[email protected]
36-
id: cache
37-
with:
38-
path: |
39-
**/node_modules
40-
/home/runner/.cache/Cypress
41-
key: ${{ runner.os }}-node-${{ matrix.node-version }}-${{ hashFiles('**/package-lock.json') }}
42-
43-
- name: Install dependencies
44-
id: install-dependencies
45-
if: steps.cache.outputs.cache-hit != 'true'
46-
run: npm install
47-
48-
# - name: Fix code style linting errors
49-
# id: lint-fix
50-
# run: npm run lint:fix
51-
# continue-on-error: true
52-
#
53-
# - name: Commit fixed linting errors
54-
# id: commit
55-
# uses: stefanzweifel/git-auto-commit-action@v4
56-
# with:
57-
# commit_message: "ci: fix code style linting errors"
58-
59-
- name: Lint code
60-
id: lint
61-
run: npm run lint
62-
63-
- name: Send Slack notifications
64-
uses: act10ns/slack@v1
65-
if: failure()
66-
with:
67-
status: ${{ job.status }}
68-
steps: ${{ toJson(steps) }}
69-
channel: '#tiptap-notifications'
26+
- uses: actions/[email protected]
27+
28+
- name: Use Node.js ${{ matrix.node-version }}
29+
uses: actions/[email protected]
30+
with:
31+
node-version: ${{ matrix.node-version }}
32+
33+
- name: Load cached dependencies
34+
uses: actions/[email protected]
35+
id: cache
36+
with:
37+
path: |
38+
**/node_modules
39+
/home/runner/.cache/Cypress
40+
key: ${{ runner.os }}-node-${{ matrix.node-version }}-${{ hashFiles('**/package-lock.json') }}
41+
42+
- name: Install dependencies
43+
id: install-dependencies
44+
if: steps.cache.outputs.cache-hit != 'true'
45+
run: npm install
46+
47+
# - name: Fix code style linting errors
48+
# id: lint-fix
49+
# run: npm run lint:fix
50+
# continue-on-error: true
51+
#
52+
# - name: Commit fixed linting errors
53+
# id: commit
54+
# uses: stefanzweifel/git-auto-commit-action@v4
55+
# with:
56+
# commit_message: "ci: fix code style linting errors"
57+
58+
- name: Lint code
59+
id: lint
60+
run: npm run lint
61+
62+
- name: Send Slack notifications
63+
uses: act10ns/slack@v1
64+
if: failure()
65+
with:
66+
status: ${{ job.status }}
67+
steps: ${{ toJson(steps) }}
68+
channel: '#tiptap-notifications'
7069

7170
test:
7271
runs-on: ubuntu-latest
@@ -79,48 +78,55 @@ jobs:
7978
node-version: [16]
8079

8180
steps:
82-
83-
- uses: actions/[email protected]
84-
85-
- name: Use Node.js ${{ matrix.node-version }}
86-
uses: actions/[email protected]
87-
with:
88-
node-version: ${{ matrix.node-version }}
89-
90-
- name: Run tests with Cypress
91-
id: cypress
92-
uses: cypress-io/[email protected]
93-
with:
94-
cache-key: ${{ runner.os }}-node-${{ matrix.node-version }}-${{ hashFiles('**/package-lock.json') }}
95-
start: npm run start
96-
wait-on: 'http://localhost:3000'
97-
project: ./tests
98-
browser: chrome
99-
quiet: true
100-
101-
- name: Export screenshots (on failure only)
102-
uses: actions/[email protected]
103-
if: failure()
104-
with:
105-
name: cypress-screenshots
106-
path: tests/cypress/screenshots
107-
retention-days: 7
108-
109-
- name: Export screen recordings (on failure only)
110-
uses: actions/[email protected]
111-
if: failure()
112-
with:
113-
name: cypress-videos
114-
path: tests/cypress/videos
115-
retention-days: 7
116-
117-
- name: Send Slack notifications
118-
uses: act10ns/slack@v1
119-
if: failure()
120-
with:
121-
status: ${{ job.status }}
122-
steps: ${{ toJson(steps) }}
123-
channel: '#tiptap-notifications'
81+
- uses: actions/[email protected]
82+
83+
- name: Use Node.js ${{ matrix.node-version }}
84+
uses: actions/[email protected]
85+
with:
86+
node-version: ${{ matrix.node-version }}
87+
88+
- name: Install dependencies
89+
id: install-dependencies
90+
run: npm install
91+
92+
- name: Try to build the packages
93+
id: build-packages
94+
run: npm run build:pm
95+
96+
- name: Run tests with Cypress
97+
id: cypress
98+
uses: cypress-io/[email protected]
99+
with:
100+
cache-key: ${{ runner.os }}-node-${{ matrix.node-version }}-${{ hashFiles('**/package-lock.json') }}
101+
start: npm run start
102+
wait-on: 'http://localhost:3000'
103+
project: ./tests
104+
browser: chrome
105+
quiet: true
106+
107+
- name: Export screenshots (on failure only)
108+
uses: actions/[email protected]
109+
if: failure()
110+
with:
111+
name: cypress-screenshots
112+
path: tests/cypress/screenshots
113+
retention-days: 7
114+
115+
- name: Export screen recordings (on failure only)
116+
uses: actions/[email protected]
117+
if: failure()
118+
with:
119+
name: cypress-videos
120+
path: tests/cypress/videos
121+
retention-days: 7
122+
123+
- name: Send Slack notifications
124+
uses: act10ns/slack@v1
125+
if: failure()
126+
with:
127+
status: ${{ job.status }}
128+
steps: ${{ toJson(steps) }}
129+
channel: '#tiptap-notifications'
124130

125131
build:
126132
runs-on: ubuntu-latest
@@ -135,36 +141,35 @@ jobs:
135141
node-version: [16]
136142

137143
steps:
138-
139-
- uses: actions/[email protected]
140-
141-
- name: Use Node.js ${{ matrix.node-version }}
142-
uses: actions/[email protected]
143-
with:
144-
node-version: ${{ matrix.node-version }}
145-
146-
- name: Load cached dependencies
147-
uses: actions/[email protected]
148-
id: cache
149-
with:
150-
path: |
151-
**/node_modules
152-
/home/runner/.cache/Cypress
153-
key: ${{ runner.os }}-node-${{ matrix.node-version }}-${{ hashFiles('**/package-lock.json') }}
154-
155-
- name: Install dependencies
156-
id: install-dependencies
157-
if: steps.cache.outputs.cache-hit != 'true'
158-
run: npm install
159-
160-
- name: Try to build the packages
161-
id: build-packages
162-
run: npm run build:ci
163-
164-
- name: Send Slack notifications
165-
uses: act10ns/slack@v1
166-
if: failure()
167-
with:
168-
status: ${{ job.status }}
169-
steps: ${{ toJson(steps) }}
170-
channel: '#tiptap-notifications'
144+
- uses: actions/[email protected]
145+
146+
- name: Use Node.js ${{ matrix.node-version }}
147+
uses: actions/[email protected]
148+
with:
149+
node-version: ${{ matrix.node-version }}
150+
151+
- name: Load cached dependencies
152+
uses: actions/[email protected]
153+
id: cache
154+
with:
155+
path: |
156+
**/node_modules
157+
/home/runner/.cache/Cypress
158+
key: ${{ runner.os }}-node-${{ matrix.node-version }}-${{ hashFiles('**/package-lock.json') }}
159+
160+
- name: Install dependencies
161+
id: install-dependencies
162+
if: steps.cache.outputs.cache-hit != 'true'
163+
run: npm install
164+
165+
- name: Try to build the packages
166+
id: build-packages
167+
run: npm run build:ci
168+
169+
- name: Send Slack notifications
170+
uses: act10ns/slack@v1
171+
if: failure()
172+
with:
173+
status: ${{ job.status }}
174+
steps: ${{ toJson(steps) }}
175+
channel: '#tiptap-notifications'

demos/includeDependencies.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ prosemirror-keymap
1010
prosemirror-model
1111
prosemirror-schema-list
1212
prosemirror-state
13-
@tiptap/prosemirror-tables
13+
prosemirror-tables
1414
prosemirror-transform
1515
prosemirror-view
1616
react

demos/package-lock.json

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

demos/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
"sass": "^1.49.7",
3535
"svelte": "^3.49.0",
3636
"tailwindcss": "^2.2.19",
37-
"typescript": "^4.5.5",
37+
"typescript": "4.7.4",
3838
"uuid": "^8.3.2",
3939
"vite": "^2.9.13",
4040
"vite-plugin-checker": "^0.3.4",

demos/src/Examples/Savvy/React/ColorHighlighter.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Extension } from '@tiptap/core'
2-
import { Plugin } from 'prosemirror-state'
2+
import { Plugin } from '@tiptap/pm/state'
33

44
import findColors from './findColors'
55

demos/src/Examples/Savvy/React/findColors.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { Node } from 'prosemirror-model'
2-
import { Decoration, DecorationSet } from 'prosemirror-view'
1+
import { Node } from '@tiptap/pm/model'
2+
import { Decoration, DecorationSet } from '@tiptap/pm/view'
33

44
export default function (doc: Node): DecorationSet {
55
const hexColor = /(#[0-9a-f]{3,6})\b/gi

demos/src/Examples/Savvy/Vue/ColorHighlighter.ts

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Extension } from '@tiptap/core'
2-
import { Plugin } from 'prosemirror-state'
2+
import { Plugin } from '@tiptap/pm/state'
33

44
import findColors from './findColors'
55

@@ -14,9 +14,7 @@ export const ColorHighlighter = Extension.create({
1414
return findColors(doc)
1515
},
1616
apply(transaction, oldState) {
17-
return transaction.docChanged
18-
? findColors(transaction.doc)
19-
: oldState
17+
return transaction.docChanged ? findColors(transaction.doc) : oldState
2018
},
2119
},
2220
props: {

demos/src/Examples/Savvy/Vue/findColors.ts

+14-16
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,27 @@
1-
import { Node } from 'prosemirror-model'
2-
import { Decoration, DecorationSet } from 'prosemirror-view'
1+
import { Node } from '@tiptap/pm/model'
2+
import { Decoration, DecorationSet } from '@tiptap/pm/view'
33

44
export default function (doc: Node): DecorationSet {
5-
const hexColor = /(#[0-9a-f]{3,6})\b/ig
5+
const hexColor = /(#[0-9a-f]{3,6})\b/gi
66
const decorations: Decoration[] = []
77

88
doc.descendants((node, position) => {
99
if (!node.text) {
1010
return
1111
}
1212

13-
Array
14-
.from(node.text.matchAll(hexColor))
15-
.forEach(match => {
16-
const color = match[0]
17-
const index = match.index || 0
18-
const from = position + index
19-
const to = from + color.length
20-
const decoration = Decoration.inline(from, to, {
21-
class: 'color',
22-
style: `--color: ${color}`,
23-
})
24-
25-
decorations.push(decoration)
13+
Array.from(node.text.matchAll(hexColor)).forEach(match => {
14+
const color = match[0]
15+
const index = match.index || 0
16+
const from = position + index
17+
const to = from + color.length
18+
const decoration = Decoration.inline(from, to, {
19+
class: 'color',
20+
style: `--color: ${color}`,
2621
})
22+
23+
decorations.push(decoration)
24+
})
2725
})
2826

2927
return DecorationSet.create(doc, decorations)

demos/src/Experiments/CollaborationAnnotation/Vue/extension/AnnotationPlugin.ts

+6-8
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Plugin, PluginKey } from 'prosemirror-state'
1+
import { Plugin, PluginKey } from '@tiptap/pm/state'
22
import * as Y from 'yjs'
33

44
import { AnnotationState } from './AnnotationState'
@@ -8,10 +8,10 @@ export const AnnotationPluginKey = new PluginKey('annotation')
88
export interface AnnotationPluginOptions {
99
HTMLAttributes: {
1010
[key: string]: any
11-
},
12-
onUpdate: (items: [any?]) => {},
13-
map: Y.Map<any>,
14-
instance: string,
11+
}
12+
onUpdate: (items: [any?]) => {}
13+
map: Y.Map<any>
14+
instance: string
1515
}
1616

1717
export const AnnotationPlugin = (options: AnnotationPluginOptions) => new Plugin({
@@ -39,9 +39,7 @@ export const AnnotationPlugin = (options: AnnotationPluginOptions) => new Plugin
3939
return decorations
4040
}
4141

42-
const annotations = this
43-
.getState(state)
44-
.annotationsAt(selection.from)
42+
const annotations = this.getState(state).annotationsAt(selection.from)
4543

4644
options.onUpdate(annotations)
4745

0 commit comments

Comments
 (0)