Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New Feature: Prosemirror Meta Package #3556

Merged
merged 42 commits into from
Feb 2, 2023
Merged
Show file tree
Hide file tree
Changes from 41 commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
8c65c9a
chore:(core): migrate to tsup
bdbch Dec 9, 2022
63a0ca2
chore: migrate blockquote and bold to tsup
bdbch Dec 9, 2022
1fa8065
chore: migrated bubble-menu and bullet-list to tsup
bdbch Dec 9, 2022
b36ffcc
chore: migrated more packages to tsup
bdbch Dec 9, 2022
9e03bbe
chore: migrate code and character extensions to tsup
bdbch Dec 9, 2022
5d47d6b
chore: update package.json to simplify build for all packages
bdbch Dec 9, 2022
2bb7262
chore: merge main
bdbch Dec 16, 2022
3d233da
chore: move all packages to tsup as a build process
bdbch Dec 16, 2022
17169ea
chore: change ci build task
bdbch Dec 16, 2022
ba5b15e
feat(pm): add prosemirror meta package
bdbch Dec 16, 2022
f2e4c3e
rfix: resolve issues with build paths & export mappings
bdbch Dec 17, 2022
44742a7
docs: update documentation to include notes for @tiptap/pm
bdbch Dec 17, 2022
8839703
Merge branch 'main' of github.com:ueberdosis/tiptap into prosemirror-…
bdbch Jan 25, 2023
f3bbc5e
chore(pm): update tsconfig
bdbch Jan 25, 2023
a05c1d7
chore(packages): update packages
bdbch Jan 25, 2023
4a6f8c4
fix(pm): add package export infos & fix dependencies
bdbch Jan 25, 2023
937cfd4
chore(general): start moving to pm package as deps
bdbch Jan 25, 2023
b82cbcd
Merge branch 'main' of github.com:ueberdosis/tiptap into prosemirror-…
bdbch Jan 25, 2023
095a992
chore: move to tiptap pm package internally
bdbch Jan 25, 2023
f1c457a
Merge branch 'prosemirror-meta-package' of github.com:ueberdosis/tipt…
bdbch Jan 25, 2023
58a1151
fix(demos): fix demos working with new pm package
bdbch Jan 25, 2023
9c32f0a
fix(tables): fix tables package
bdbch Jan 25, 2023
a2aa373
fix(tables): fix tables package
bdbch Jan 25, 2023
5946e80
chore(demos): pinned typescript version
bdbch Jan 26, 2023
66c0894
chore: remove unnecessary tsconfig
bdbch Jan 26, 2023
ad0313a
chore: fix netlify build
bdbch Jan 26, 2023
b65c3ca
fix(demos): fix package resolving for pm packages
bdbch Jan 27, 2023
8cb5881
fix(tests): fix package resolving for pm packages
bdbch Jan 27, 2023
8446fd9
fix(tests): fix package resolving for pm packages
bdbch Jan 30, 2023
795b8aa
chore(tests): fix tests not running correctly after pm package
bdbch Jan 30, 2023
f7f86cc
chore(pm): add files to files array
bdbch Jan 30, 2023
168c1c3
chore: update build workflow
bdbch Jan 30, 2023
0e36892
chore(tests): increase timeout time back to 12s
bdbch Jan 30, 2023
83dbaa2
chore(docs): update docs
bdbch Feb 2, 2023
f9f4674
chore(docs): update installation guides & pm information to docs
bdbch Feb 2, 2023
0b45ce7
chore(docs): add link to prosemirror docs
bdbch Feb 2, 2023
352004d
fix(vue-3): add missing build step
bdbch Feb 2, 2023
cc205b7
chore(docs): comment out cdn link
bdbch Feb 2, 2023
e2b56f1
Merge branch 'main' of github.com:ueberdosis/tiptap into prosemirror-…
bdbch Feb 2, 2023
af00a4f
chore(docs): remove semicolons from docs
bdbch Feb 2, 2023
5c55d40
chore(docs): remove unnecessary installation note
bdbch Feb 2, 2023
13b2982
chore(docs): remove unnecessary installation note
bdbch Feb 2, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
243 changes: 124 additions & 119 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,50 +23,49 @@ jobs:
node-version: [16]

steps:

- uses: actions/checkout@v3.0.2

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3.5.1
with:
node-version: ${{ matrix.node-version }}

- name: Load cached dependencies
uses: actions/cache@v3.0.11
id: cache
with:
path: |
**/node_modules
/home/runner/.cache/Cypress
key: ${{ runner.os }}-node-${{ matrix.node-version }}-${{ hashFiles('**/package-lock.json') }}

- name: Install dependencies
id: install-dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: npm install

# - name: Fix code style linting errors
# id: lint-fix
# run: npm run lint:fix
# continue-on-error: true
#
# - name: Commit fixed linting errors
# id: commit
# uses: stefanzweifel/git-auto-commit-action@v4
# with:
# commit_message: "ci: fix code style linting errors"

- name: Lint code
id: lint
run: npm run lint

- name: Send Slack notifications
uses: act10ns/slack@v1
if: failure()
with:
status: ${{ job.status }}
steps: ${{ toJson(steps) }}
channel: '#tiptap-notifications'
- uses: actions/checkout@v3.0.2

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3.5.1
with:
node-version: ${{ matrix.node-version }}

- name: Load cached dependencies
uses: actions/cache@v3.0.11
id: cache
with:
path: |
**/node_modules
/home/runner/.cache/Cypress
key: ${{ runner.os }}-node-${{ matrix.node-version }}-${{ hashFiles('**/package-lock.json') }}

- name: Install dependencies
id: install-dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: npm install

# - name: Fix code style linting errors
# id: lint-fix
# run: npm run lint:fix
# continue-on-error: true
#
# - name: Commit fixed linting errors
# id: commit
# uses: stefanzweifel/git-auto-commit-action@v4
# with:
# commit_message: "ci: fix code style linting errors"

- name: Lint code
id: lint
run: npm run lint

- name: Send Slack notifications
uses: act10ns/slack@v1
if: failure()
with:
status: ${{ job.status }}
steps: ${{ toJson(steps) }}
channel: '#tiptap-notifications'

test:
runs-on: ubuntu-latest
Expand All @@ -79,48 +78,55 @@ jobs:
node-version: [16]

steps:

- uses: actions/checkout@v3.0.2

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3.5.1
with:
node-version: ${{ matrix.node-version }}

- name: Run tests with Cypress
id: cypress
uses: cypress-io/github-action@v4.2.0
with:
cache-key: ${{ runner.os }}-node-${{ matrix.node-version }}-${{ hashFiles('**/package-lock.json') }}
start: npm run start
wait-on: 'http://localhost:3000'
project: ./tests
browser: chrome
quiet: true

- name: Export screenshots (on failure only)
uses: actions/upload-artifact@v3.1.0
if: failure()
with:
name: cypress-screenshots
path: tests/cypress/screenshots
retention-days: 7

- name: Export screen recordings (on failure only)
uses: actions/upload-artifact@v3.1.0
if: failure()
with:
name: cypress-videos
path: tests/cypress/videos
retention-days: 7

- name: Send Slack notifications
uses: act10ns/slack@v1
if: failure()
with:
status: ${{ job.status }}
steps: ${{ toJson(steps) }}
channel: '#tiptap-notifications'
- uses: actions/checkout@v3.0.2

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3.5.1
with:
node-version: ${{ matrix.node-version }}

- name: Install dependencies
id: install-dependencies
run: npm install

- name: Try to build the packages
id: build-packages
run: npm run build:pm

- name: Run tests with Cypress
id: cypress
uses: cypress-io/github-action@v4.2.0
with:
cache-key: ${{ runner.os }}-node-${{ matrix.node-version }}-${{ hashFiles('**/package-lock.json') }}
start: npm run start
wait-on: 'http://localhost:3000'
project: ./tests
browser: chrome
quiet: true

- name: Export screenshots (on failure only)
uses: actions/upload-artifact@v3.1.0
if: failure()
with:
name: cypress-screenshots
path: tests/cypress/screenshots
retention-days: 7

- name: Export screen recordings (on failure only)
uses: actions/upload-artifact@v3.1.0
if: failure()
with:
name: cypress-videos
path: tests/cypress/videos
retention-days: 7

- name: Send Slack notifications
uses: act10ns/slack@v1
if: failure()
with:
status: ${{ job.status }}
steps: ${{ toJson(steps) }}
channel: '#tiptap-notifications'

build:
runs-on: ubuntu-latest
Expand All @@ -135,36 +141,35 @@ jobs:
node-version: [16]

steps:

- uses: actions/checkout@v3.0.2

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3.5.1
with:
node-version: ${{ matrix.node-version }}

- name: Load cached dependencies
uses: actions/cache@v3.0.11
id: cache
with:
path: |
**/node_modules
/home/runner/.cache/Cypress
key: ${{ runner.os }}-node-${{ matrix.node-version }}-${{ hashFiles('**/package-lock.json') }}

- name: Install dependencies
id: install-dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: npm install

- name: Try to build the packages
id: build-packages
run: npm run build:ci

- name: Send Slack notifications
uses: act10ns/slack@v1
if: failure()
with:
status: ${{ job.status }}
steps: ${{ toJson(steps) }}
channel: '#tiptap-notifications'
- uses: actions/checkout@v3.0.2

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3.5.1
with:
node-version: ${{ matrix.node-version }}

- name: Load cached dependencies
uses: actions/cache@v3.0.11
id: cache
with:
path: |
**/node_modules
/home/runner/.cache/Cypress
key: ${{ runner.os }}-node-${{ matrix.node-version }}-${{ hashFiles('**/package-lock.json') }}

- name: Install dependencies
id: install-dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: npm install

- name: Try to build the packages
id: build-packages
run: npm run build:ci

- name: Send Slack notifications
uses: act10ns/slack@v1
if: failure()
with:
status: ${{ job.status }}
steps: ${{ toJson(steps) }}
channel: '#tiptap-notifications'
2 changes: 1 addition & 1 deletion demos/includeDependencies.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ prosemirror-keymap
prosemirror-model
prosemirror-schema-list
prosemirror-state
@tiptap/prosemirror-tables
prosemirror-tables
prosemirror-transform
prosemirror-view
react
Expand Down
2 changes: 1 addition & 1 deletion demos/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion demos/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"sass": "^1.49.7",
"svelte": "^3.49.0",
"tailwindcss": "^2.2.19",
"typescript": "^4.5.5",
"typescript": "4.7.4",
"uuid": "^8.3.2",
"vite": "^2.9.13",
"vite-plugin-checker": "^0.3.4",
Expand Down
2 changes: 1 addition & 1 deletion demos/src/Examples/Savvy/React/ColorHighlighter.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Extension } from '@tiptap/core'
import { Plugin } from 'prosemirror-state'
import { Plugin } from '@tiptap/pm/state'

import findColors from './findColors'

Expand Down
4 changes: 2 additions & 2 deletions demos/src/Examples/Savvy/React/findColors.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Node } from 'prosemirror-model'
import { Decoration, DecorationSet } from 'prosemirror-view'
import { Node } from '@tiptap/pm/model'
import { Decoration, DecorationSet } from '@tiptap/pm/view'

export default function (doc: Node): DecorationSet {
const hexColor = /(#[0-9a-f]{3,6})\b/gi
Expand Down
6 changes: 2 additions & 4 deletions demos/src/Examples/Savvy/Vue/ColorHighlighter.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Extension } from '@tiptap/core'
import { Plugin } from 'prosemirror-state'
import { Plugin } from '@tiptap/pm/state'

import findColors from './findColors'

Expand All @@ -14,9 +14,7 @@ export const ColorHighlighter = Extension.create({
return findColors(doc)
},
apply(transaction, oldState) {
return transaction.docChanged
? findColors(transaction.doc)
: oldState
return transaction.docChanged ? findColors(transaction.doc) : oldState
},
},
props: {
Expand Down
30 changes: 14 additions & 16 deletions demos/src/Examples/Savvy/Vue/findColors.ts
Original file line number Diff line number Diff line change
@@ -1,29 +1,27 @@
import { Node } from 'prosemirror-model'
import { Decoration, DecorationSet } from 'prosemirror-view'
import { Node } from '@tiptap/pm/model'
import { Decoration, DecorationSet } from '@tiptap/pm/view'

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

doc.descendants((node, position) => {
if (!node.text) {
return
}

Array
.from(node.text.matchAll(hexColor))
.forEach(match => {
const color = match[0]
const index = match.index || 0
const from = position + index
const to = from + color.length
const decoration = Decoration.inline(from, to, {
class: 'color',
style: `--color: ${color}`,
})

decorations.push(decoration)
Array.from(node.text.matchAll(hexColor)).forEach(match => {
const color = match[0]
const index = match.index || 0
const from = position + index
const to = from + color.length
const decoration = Decoration.inline(from, to, {
class: 'color',
style: `--color: ${color}`,
})

decorations.push(decoration)
})
})

return DecorationSet.create(doc, decorations)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Plugin, PluginKey } from 'prosemirror-state'
import { Plugin, PluginKey } from '@tiptap/pm/state'
import * as Y from 'yjs'

import { AnnotationState } from './AnnotationState'
Expand All @@ -8,10 +8,10 @@ export const AnnotationPluginKey = new PluginKey('annotation')
export interface AnnotationPluginOptions {
HTMLAttributes: {
[key: string]: any
},
onUpdate: (items: [any?]) => {},
map: Y.Map<any>,
instance: string,
}
onUpdate: (items: [any?]) => {}
map: Y.Map<any>
instance: string
}

export const AnnotationPlugin = (options: AnnotationPluginOptions) => new Plugin({
Expand Down Expand Up @@ -39,9 +39,7 @@ export const AnnotationPlugin = (options: AnnotationPluginOptions) => new Plugin
return decorations
}

const annotations = this
.getState(state)
.annotationsAt(selection.from)
const annotations = this.getState(state).annotationsAt(selection.from)

options.onUpdate(annotations)

Expand Down
Loading