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

feat(extension-utils): add a new package, extension-utils #5970

Merged
merged 4 commits into from
Jan 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
11 changes: 5 additions & 6 deletions demos/src/Examples/Default/React/index.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ context('/src/Examples/Default/React/', () => {

it('should apply the paragraph style when the keyboard shortcut is pressed', () => {
cy.get('.tiptap h1').should('exist')
cy.get('.tiptap p').should('not.exist')

cy.get('.tiptap')
.trigger('keydown', { modKey: true, altKey: true, key: '0' })
Expand Down Expand Up @@ -79,7 +78,7 @@ context('/src/Examples/Default/React/', () => {
cy.get('.tiptap').type('{enter}A second item{enter}A third item{selectall}')
cy.get('button').contains('Clear nodes').click()
cy.get('.tiptap ul').should('not.exist')
cy.get('.tiptap p').should('have.length', 3)
cy.get('.tiptap p').should('have.length', 4)
})

const buttonNodes = [
Expand Down Expand Up @@ -124,20 +123,20 @@ context('/src/Examples/Default/React/', () => {
it('should add a br', () => {
cy.get('.tiptap').type('{rightArrow}')
cy.get('button').contains('Hard break').click()
cy.get('.tiptap h1 br').should('exist')
cy.get('.tiptap br').should('exist')
})

it('should undo', () => {
cy.get('.tiptap').type('{selectall}{backspace}')
cy.get('button').contains('Undo').click()
cy.get('.tiptap').should('contain', 'Hello world')
cy.get('.tiptap').should('contain', 'Example Text')
})

it('should redo', () => {
cy.get('.tiptap').type('{selectall}{backspace}')
cy.get('button').contains('Undo').click()
cy.get('.tiptap').should('contain', 'Hello world')
cy.get('.tiptap').should('contain', 'Example Text')
cy.get('button').contains('Redo').click()
cy.get('.tiptap').should('not.contain', 'Hello world')
cy.get('.tiptap').should('not.contain', 'Example Text')
})
})
11 changes: 5 additions & 6 deletions demos/src/Examples/Default/Svelte/index.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ context('/src/Examples/Default/React/', () => {

it('should apply the paragraph style when the keyboard shortcut is pressed', () => {
cy.get('.tiptap h1').should('exist')
cy.get('.tiptap p').should('not.exist')

cy.get('.tiptap')
.trigger('keydown', { modKey: true, altKey: true, key: '0' })
Expand Down Expand Up @@ -53,7 +52,7 @@ context('/src/Examples/Default/React/', () => {
cy.get('.tiptap').type('{enter}A second item{enter}A third item{selectall}')
cy.get('button').contains('Clear nodes').click()
cy.get('.tiptap ul').should('not.exist')
cy.get('.tiptap p').should('have.length', 3)
cy.get('.tiptap p').should('have.length', 4)
})

const buttonNodes = [
Expand Down Expand Up @@ -98,20 +97,20 @@ context('/src/Examples/Default/React/', () => {
it('should add a br', () => {
cy.get('.tiptap').type('{rightArrow}')
cy.get('button').contains('Hard break').click()
cy.get('.tiptap h1 br').should('exist')
cy.get('.tiptap br').should('exist')
})

it('should undo', () => {
cy.get('.tiptap').type('{selectall}{backspace}')
cy.get('button').contains('Undo').click()
cy.get('.tiptap').should('contain', 'Hello world')
cy.get('.tiptap').should('contain', 'Example Text')
})

it('should redo', () => {
cy.get('.tiptap').type('{selectall}{backspace}')
cy.get('button').contains('Undo').click()
cy.get('.tiptap').should('contain', 'Hello world')
cy.get('.tiptap').should('contain', 'Example Text')
cy.get('button').contains('Redo').click()
cy.get('.tiptap').should('not.contain', 'Hello world')
cy.get('.tiptap').should('not.contain', 'Example Text')
})
})
11 changes: 5 additions & 6 deletions demos/src/Examples/Default/Vue/index.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ context('/src/Examples/Default/Vue/', () => {

it('should apply the paragraph style when the keyboard shortcut is pressed', () => {
cy.get('.tiptap h1').should('exist')
cy.get('.tiptap p').should('not.exist')

cy.get('.tiptap')
.trigger('keydown', { modKey: true, altKey: true, key: '0' })
Expand Down Expand Up @@ -53,7 +52,7 @@ context('/src/Examples/Default/Vue/', () => {
cy.get('.tiptap').type('{enter}A second item{enter}A third item{selectall}')
cy.get('button').contains('Clear nodes').click()
cy.get('.tiptap ul').should('not.exist')
cy.get('.tiptap p').should('have.length', 3)
cy.get('.tiptap p').should('have.length', 4)
})

const buttonNodes = [
Expand Down Expand Up @@ -98,20 +97,20 @@ context('/src/Examples/Default/Vue/', () => {
it('should add a br', () => {
cy.get('.tiptap').type('{rightArrow}')
cy.get('button').contains('Hard break').click()
cy.get('.tiptap h1 br').should('exist')
cy.get('.tiptap br').should('exist')
})

it('should undo', () => {
cy.get('.tiptap').type('{selectall}{backspace}')
cy.get('button').contains('Undo').click()
cy.get('.tiptap').should('contain', 'Hello world')
cy.get('.tiptap').should('contain', 'Example Text')
})

it('should redo', () => {
cy.get('.tiptap').type('{selectall}{backspace}')
cy.get('button').contains('Undo').click()
cy.get('.tiptap').should('contain', 'Hello world')
cy.get('.tiptap').should('contain', 'Example Text')
cy.get('button').contains('Redo').click()
cy.get('.tiptap').should('not.contain', 'Hello world')
cy.get('.tiptap').should('not.contain', 'Example Text')
})
})
4 changes: 3 additions & 1 deletion demos/src/Examples/NodePos/React/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ const mapNodePosToString = nodePos => `[${nodePos.node.type.name} ${nodePos.rang
export default () => {
const editor = useEditor({
extensions: [
StarterKit,
StarterKit.configure({
trailingNode: false,
}),
Image,
],
content: `
Expand Down
11 changes: 5 additions & 6 deletions demos/src/Experiments/IsolatingClear/React/index.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ context('/src/Examples/Default/React/', () => {

it('should apply the paragraph style when the keyboard shortcut is pressed', () => {
cy.get('.tiptap h1').should('exist')
cy.get('.tiptap p').should('not.exist')

cy.get('.tiptap')
.trigger('keydown', { modKey: true, altKey: true, key: '0' })
Expand Down Expand Up @@ -79,7 +78,7 @@ context('/src/Examples/Default/React/', () => {
cy.get('.tiptap').type('{enter}A second item{enter}A third item{selectall}')
cy.get('button').contains('Clear nodes').click()
cy.get('.tiptap ul').should('not.exist')
cy.get('.tiptap p').should('have.length', 3)
cy.get('.tiptap p').should('have.length', 4)
})

const buttonNodes = [
Expand Down Expand Up @@ -124,20 +123,20 @@ context('/src/Examples/Default/React/', () => {
it('should add a br', () => {
cy.get('.tiptap').type('{rightArrow}')
cy.get('button').contains('Hard break').click()
cy.get('.tiptap h1 br').should('exist')
cy.get('.tiptap br').should('exist')
})

it('should undo', () => {
cy.get('.tiptap').type('{selectall}{backspace}')
cy.get('button').contains('Undo').click()
cy.get('.tiptap').should('contain', 'Hello world')
cy.get('.tiptap').should('contain', 'Example Text')
})

it('should redo', () => {
cy.get('.tiptap').type('{selectall}{backspace}')
cy.get('button').contains('Undo').click()
cy.get('.tiptap').should('contain', 'Hello world')
cy.get('.tiptap').should('contain', 'Example Text')
cy.get('button').contains('Redo').click()
cy.get('.tiptap').should('not.contain', 'Hello world')
cy.get('.tiptap').should('not.contain', 'Example Text')
})
})
40 changes: 28 additions & 12 deletions package-lock.json

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

6 changes: 2 additions & 4 deletions packages/extension-dropcursor/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,10 @@
"dist"
],
"devDependencies": {
"@tiptap/core": "^3.0.0-next.3",
"@tiptap/pm": "^3.0.0-next.3"
"@tiptap/extension-utils": "^3.0.0-next.3"
},
"peerDependencies": {
"@tiptap/core": "^3.0.0-next.1",
"@tiptap/pm": "^3.0.0-next.1"
"@tiptap/extension-utils": "^3.0.0-next.3"
},
"repository": {
"type": "git",
Expand Down
4 changes: 2 additions & 2 deletions packages/extension-dropcursor/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Dropcursor } from './dropcursor.js'
import { Dropcursor } from '@tiptap/extension-utils'

export * from './dropcursor.js'
export { Dropcursor, DropcursorOptions } from '@tiptap/extension-utils'

export default Dropcursor
6 changes: 2 additions & 4 deletions packages/extension-focus/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,10 @@
"dist"
],
"devDependencies": {
"@tiptap/core": "^3.0.0-next.3",
"@tiptap/pm": "^3.0.0-next.3"
"@tiptap/extension-utils": "3.0.0-next.3"
},
"peerDependencies": {
"@tiptap/core": "^3.0.0-next.1",
"@tiptap/pm": "^3.0.0-next.1"
"@tiptap/extension-utils": "3.0.0-next.3"
},
"repository": {
"type": "git",
Expand Down
6 changes: 3 additions & 3 deletions packages/extension-focus/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { FocusClasses } from './focus.js'
import { Focus } from '@tiptap/extension-utils'

export * from './focus.js'
export { Focus, FocusOptions } from '@tiptap/extension-utils'

export default FocusClasses
export default Focus
6 changes: 2 additions & 4 deletions packages/extension-gapcursor/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,10 @@
"dist"
],
"devDependencies": {
"@tiptap/core": "^3.0.0-next.3",
"@tiptap/pm": "^3.0.0-next.3"
"@tiptap/extension-utils": "^3.0.0-next.3"
},
"peerDependencies": {
"@tiptap/core": "^3.0.0-next.1",
"@tiptap/pm": "^3.0.0-next.1"
"@tiptap/extension-utils": "^3.0.0-next.3"
},
"repository": {
"type": "git",
Expand Down
4 changes: 2 additions & 2 deletions packages/extension-gapcursor/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Gapcursor } from './gapcursor.js'
import { Gapcursor } from '@tiptap/extension-utils'

export * from './gapcursor.js'
export { Gapcursor } from '@tiptap/extension-utils'

export default Gapcursor
2 changes: 2 additions & 0 deletions packages/extension-utils/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Change Log

18 changes: 18 additions & 0 deletions packages/extension-utils/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# @tiptap/extension-utils

[![Version](https://img.shields.io/npm/v/@tiptap/extension-focus.svg?label=version)](https://www.npmjs.com/package/@tiptap/extension-focus)
[![Downloads](https://img.shields.io/npm/dm/@tiptap/extension-focus.svg)](https://npmcharts.com/compare/tiptap?minimal=true)
[![License](https://img.shields.io/npm/l/@tiptap/extension-focus.svg)](https://www.npmjs.com/package/@tiptap/extension-focus)
[![Sponsor](https://img.shields.io/static/v1?label=Sponsor&message=%E2%9D%A4&logo=GitHub)](https://github.com/sponsors/ueberdosis)

## Introduction

Tiptap is a headless wrapper around [ProseMirror](https://ProseMirror.net) – a toolkit for building rich text WYSIWYG editors, which is already in use at many well-known companies such as *New York Times*, *The Guardian* or *Atlassian*.

## Official Documentation

Documentation can be found on the [Tiptap website](https://tiptap.dev).

## License

Tiptap is open sourced software licensed under the [MIT license](https://github.com/ueberdosis/tiptap/blob/main/LICENSE.md).
Loading
Loading