This commit is contained in:
Hans Pagel
2021-11-09 11:56:36 +01:00
52 changed files with 1405 additions and 1062 deletions

View File

@@ -53,11 +53,13 @@ module.exports = {
'max-len': 'off',
'vue/one-component-per-file': 'off',
'vue/this-in-template': ['error', 'never'],
'vue/multi-word-component-names': 'off',
'vue/max-attributes-per-line': ['error', {
singleline: 3,
singleline: {
max: 3,
},
multiline: {
max: 1,
allowFirstLine: false,
},
}],
'vue/singleline-html-element-content-newline': 'off',

View File

@@ -24,7 +24,7 @@ jobs:
steps:
- uses: actions/checkout@v2.3.5
- uses: actions/checkout@v2.4.0
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2.4.1
@@ -80,7 +80,7 @@ jobs:
steps:
- uses: actions/checkout@v2.3.5
- uses: actions/checkout@v2.4.0
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2.4.1
@@ -136,7 +136,7 @@ jobs:
steps:
- uses: actions/checkout@v2.3.5
- uses: actions/checkout@v2.4.0
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2.4.1

View File

@@ -16,22 +16,22 @@
"y-indexeddb": "^9.0.6",
"y-webrtc": "^10.2.0",
"y-websocket": "^1.3.17",
"yjs": "^13.5.16"
"yjs": "^13.5.18"
},
"devDependencies": {
"@types/uuid": "^8.3.1",
"@vitejs/plugin-react-refresh": "^1.3.6",
"@vitejs/plugin-vue": "^1.9.3",
"autoprefixer": "^10.3.7",
"@vitejs/plugin-vue": "^1.9.4",
"autoprefixer": "^10.4.0",
"iframe-resizer": "^4.3.2",
"postcss": "^8.3.11",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"sass": "^1.43.3",
"tailwindcss": "^2.2.17",
"sass": "^1.43.4",
"tailwindcss": "^2.2.19",
"typescript": "^4.4.4",
"uuid": "^8.3.2",
"vite": "^2.6.10",
"vite": "^2.6.13",
"vite-plugin-checker": "^0.3.4",
"vue": "^3.0.5",
"vue-router": "^4.0.11"

View File

@@ -67,6 +67,10 @@ select {
padding: 0.1rem 0.4rem;
background: white;
accent-color: black;
&[disabled] {
opacity: 0.3;
}
}
.ProseMirror:focus {

View File

@@ -13,14 +13,14 @@ context('/src/Nodes/TaskList/Vue/', () => {
it('should parse unordered lists correctly', () => {
cy.get('.ProseMirror').then(([{ editor }]) => {
editor.commands.setContent('<ul data-type="taskList"><li data-checked="true" data-type="taskItem"><p>Example Text</p></li></ul>')
expect(editor.getHTML()).to.eq('<ul data-type="taskList"><li data-checked="true" data-type="taskItem"><p>Example Text</p></li></ul>')
expect(editor.getHTML()).to.eq('<ul data-type="taskList"><li data-checked="true" data-type="taskItem"><label><input type="checkbox" checked="checked"><span></span></label><div><p>Example Text</p></div></li></ul>')
})
})
it('should parse unordered lists without paragraphs correctly', () => {
cy.get('.ProseMirror').then(([{ editor }]) => {
editor.commands.setContent('<ul data-type="taskList"><li data-checked="false" data-type="taskItem">Example Text</li></ul>')
expect(editor.getHTML()).to.eq('<ul data-type="taskList"><li data-checked="false" data-type="taskItem"><p>Example Text</p></li></ul>')
expect(editor.getHTML()).to.eq('<ul data-type="taskList"><li data-checked="false" data-type="taskItem"><label><input type="checkbox"><span></span></label><div><p>Example Text</p></div></li></ul>')
})
})

View File

@@ -40,6 +40,17 @@ CodeBlockLowlight.configure({
})
```
### defaultLanguage
Define a default language instead of the automatic detection of lowlight.
Default: `null`
```js
CodeBlockLowlight.configure({
defaultLanguage: 'plaintext',
})
```
## Commands
### setCodeBlock()

View File

@@ -24,11 +24,11 @@
},
"devDependencies": {
"@atomico/rollup-plugin-sizes": "^1.1.4",
"@babel/core": "^7.15.8",
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.14.5",
"@babel/plugin-proposal-optional-chaining": "^7.14.5",
"@babel/preset-env": "^7.15.8",
"@babel/preset-react": "^7.14.5",
"@babel/core": "^7.16.0",
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.16.0",
"@babel/plugin-proposal-optional-chaining": "^7.16.0",
"@babel/preset-env": "^7.16.0",
"@babel/preset-react": "^7.16.0",
"@cypress/webpack-preprocessor": "^5.9.1",
"@lerna/batch-packages": "^3.16.0",
"@lerna/filter-packages": "^4.0.0",
@@ -36,24 +36,24 @@
"@rollup/plugin-babel": "^5.3.0",
"@rollup/plugin-commonjs": "^21.0.1",
"@rollup/plugin-node-resolve": "^13.0.6",
"@typescript-eslint/eslint-plugin": "^5.1.0",
"@typescript-eslint/parser": "^5.1.0",
"@typescript-eslint/eslint-plugin": "^5.3.0",
"@typescript-eslint/parser": "^5.3.0",
"babel-loader": "^8.2.3",
"cypress": "^8.6.0",
"eslint": "^8.1.0",
"cypress": "^8.7.0",
"eslint": "^8.2.0",
"eslint-config-airbnb-base": "^14.2.0",
"eslint-plugin-cypress": "^2.12.1",
"eslint-plugin-html": "^6.2.0",
"eslint-plugin-import": "^2.25.2",
"eslint-plugin-vue": "^7.20.0",
"eslint-plugin-vue": "^8.0.3",
"lerna": "^4.0.0",
"minimist": "^1.2.5",
"rollup": "^2.58.1",
"rollup": "^2.59.0",
"rollup-plugin-auto-external": "^2.0.0",
"rollup-plugin-sourcemaps": "^0.6.3",
"rollup-plugin-typescript2": "^0.30.0",
"ts-loader": "^9.2.6",
"typescript": "^4.4.4",
"webpack": "^5.59.1"
"webpack": "^5.62.1"
}
}

View File

@@ -3,6 +3,37 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [2.0.0-beta.133](https://github.com/ueberdosis/tiptap/compare/@tiptap/core@2.0.0-beta.132...@tiptap/core@2.0.0-beta.133) (2021-11-08)
### Bug Fixes
* fix a bug when parsing attributes if no parseHTML method is provided, fix [#2058](https://github.com/ueberdosis/tiptap/issues/2058) ([5da313a](https://github.com/ueberdosis/tiptap/commit/5da313a5480db011374ffd236159e2aedc011b97))
* Improve behavior when using insertContent ([#2147](https://github.com/ueberdosis/tiptap/issues/2147)) ([8fc915c](https://github.com/ueberdosis/tiptap/commit/8fc915cade394bff2015be1e1e2d7c008e8c908e))
# [2.0.0-beta.132](https://github.com/ueberdosis/tiptap/compare/@tiptap/core@2.0.0-beta.131...@tiptap/core@2.0.0-beta.132) (2021-11-08)
**Note:** Version bump only for package @tiptap/core
# [2.0.0-beta.131](https://github.com/ueberdosis/tiptap/compare/@tiptap/core@2.0.0-beta.130...@tiptap/core@2.0.0-beta.131) (2021-11-05)
### Bug Fixes
* improve JSONContent type to allow pure JSON content ([ce7f52a](https://github.com/ueberdosis/tiptap/commit/ce7f52a8f0c278ef39b25010950dd734bebd679b))
# [2.0.0-beta.130](https://github.com/ueberdosis/tiptap/compare/@tiptap/core@2.0.0-beta.129...@tiptap/core@2.0.0-beta.130) (2021-10-31)

View File

@@ -1,7 +1,7 @@
{
"name": "@tiptap/core",
"description": "headless rich text editor",
"version": "2.0.0-beta.130",
"version": "2.0.0-beta.133",
"homepage": "https://tiptap.dev",
"keywords": [
"tiptap",
@@ -28,16 +28,16 @@
"@types/prosemirror-keymap": "^1.0.4",
"@types/prosemirror-model": "^1.13.2",
"@types/prosemirror-schema-list": "^1.0.3",
"@types/prosemirror-state": "^1.2.7",
"@types/prosemirror-state": "^1.2.8",
"@types/prosemirror-transform": "^1.1.4",
"@types/prosemirror-view": "^1.19.1",
"prosemirror-commands": "^1.1.11",
"prosemirror-keymap": "^1.1.3",
"prosemirror-commands": "^1.1.12",
"prosemirror-keymap": "^1.1.5",
"prosemirror-model": "^1.15.0",
"prosemirror-schema-list": "^1.1.6",
"prosemirror-state": "^1.3.4",
"prosemirror-transform": "^1.3.3",
"prosemirror-view": "^1.20.3"
"prosemirror-view": "^1.22.0"
},
"repository": {
"type": "git",

View File

@@ -45,15 +45,40 @@ export const insertContentAt: RawCommands['insertContentAt'] = (position, value,
return true
}
const { from, to } = typeof position === 'number'
let { from, to } = typeof position === 'number'
? { from: position, to: position }
: position
let isOnlyBlockContent = true
content.forEach(node => {
isOnlyBlockContent = isOnlyBlockContent
? node.isBlock
: false
})
// check if we can replace the wrapping node by
// the newly inserted content
// example:
// replace an empty paragraph by an inserted image
// instead of inserting the image below the paragraph
if (from === to && isOnlyBlockContent) {
const $from = tr.doc.resolve(from)
const isEmptyTextBlock = $from.parent.isTextblock
&& !$from.parent.type.spec.code
&& !$from.parent.textContent
if (isEmptyTextBlock) {
from -= 1
to += 1
}
}
tr.replaceWith(from, to, content)
// set cursor at end of inserted content
if (options.updateSelection) {
selectionToInsertionEnd(tr, tr.steps.length - 1, 1)
selectionToInsertionEnd(tr, tr.steps.length - 1, -1)
}
}

View File

@@ -88,7 +88,7 @@ export interface EditorOptions {
export type HTMLContent = string
export type JSONContent = {
type: string,
type?: string,
attrs?: Record<string, any>,
content?: JSONContent[],
marks?: {

View File

@@ -3,7 +3,7 @@ export default function fromString(value: any): any {
return value
}
if (value.match(/^\d*(\.\d+)?$/)) {
if (value.match(/^[+-]?(?:\d*\.)?\d+$/)) {
return Number(value)
}

View File

@@ -3,6 +3,22 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [2.0.0-beta.46](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-bubble-menu@2.0.0-beta.45...@tiptap/extension-bubble-menu@2.0.0-beta.46) (2021-11-08)
**Note:** Version bump only for package @tiptap/extension-bubble-menu
# [2.0.0-beta.45](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-bubble-menu@2.0.0-beta.44...@tiptap/extension-bubble-menu@2.0.0-beta.45) (2021-11-05)
**Note:** Version bump only for package @tiptap/extension-bubble-menu
# [2.0.0-beta.44](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-bubble-menu@2.0.0-beta.43...@tiptap/extension-bubble-menu@2.0.0-beta.44) (2021-10-31)
**Note:** Version bump only for package @tiptap/extension-bubble-menu

View File

@@ -1,7 +1,7 @@
{
"name": "@tiptap/extension-bubble-menu",
"description": "bubble-menu extension for tiptap",
"version": "2.0.0-beta.44",
"version": "2.0.0-beta.46",
"homepage": "https://tiptap.dev",
"keywords": [
"tiptap",
@@ -25,8 +25,8 @@
},
"dependencies": {
"prosemirror-state": "^1.3.4",
"prosemirror-view": "^1.20.3",
"tippy.js": "^6.3.2"
"prosemirror-view": "^1.22.0",
"tippy.js": "^6.3.4"
},
"repository": {
"type": "git",

View File

@@ -3,6 +3,25 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [2.0.0-beta.52](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-code-block-lowlight@2.0.0-beta.51...@tiptap/extension-code-block-lowlight@2.0.0-beta.52) (2021-11-08)
**Note:** Version bump only for package @tiptap/extension-code-block-lowlight
# [2.0.0-beta.51](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-code-block-lowlight@2.0.0-beta.50...@tiptap/extension-code-block-lowlight@2.0.0-beta.51) (2021-11-05)
### Features
* add defaultLanguage option to CodeBlockLowlight extension, fix [#2121](https://github.com/ueberdosis/tiptap/issues/2121) ([0f94bcd](https://github.com/ueberdosis/tiptap/commit/0f94bcd591e98c0a767d0914b87a1efee8b002e0))
# [2.0.0-beta.50](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-code-block-lowlight@2.0.0-beta.49...@tiptap/extension-code-block-lowlight@2.0.0-beta.50) (2021-10-31)
**Note:** Version bump only for package @tiptap/extension-code-block-lowlight

View File

@@ -1,7 +1,7 @@
{
"name": "@tiptap/extension-code-block-lowlight",
"description": "code block extension for tiptap",
"version": "2.0.0-beta.50",
"version": "2.0.0-beta.52",
"homepage": "https://tiptap.dev",
"keywords": [
"tiptap",
@@ -29,7 +29,7 @@
"lowlight": "^1.20.0",
"prosemirror-model": "^1.15.0",
"prosemirror-state": "^1.3.4",
"prosemirror-view": "^1.20.3"
"prosemirror-view": "^1.22.0"
},
"repository": {
"type": "git",

View File

@@ -4,6 +4,7 @@ import { LowlightPlugin } from './lowlight-plugin'
export interface CodeBlockLowlightOptions extends CodeBlockOptions {
lowlight: any,
defaultLanguage: string | null | undefined,
}
export const CodeBlockLowlight = CodeBlock.extend<CodeBlockLowlightOptions>({
@@ -11,6 +12,7 @@ export const CodeBlockLowlight = CodeBlock.extend<CodeBlockLowlightOptions>({
return {
...this.parent?.(),
lowlight,
defaultLanguage: null,
}
},
@@ -20,6 +22,7 @@ export const CodeBlockLowlight = CodeBlock.extend<CodeBlockLowlightOptions>({
LowlightPlugin({
name: this.name,
lowlight: this.options.lowlight,
defaultLanguage: this.options.defaultLanguage,
}),
]
},

View File

@@ -30,13 +30,19 @@ function getHighlightNodes(result: any) {
return result.value || result.children || []
}
function getDecorations({ doc, name, lowlight }: { doc: ProsemirrorNode, name: string, lowlight: any }) {
function getDecorations({
doc,
name,
lowlight,
defaultLanguage,
}: { doc: ProsemirrorNode, name: string, lowlight: any, defaultLanguage: string | null | undefined }) {
const decorations: Decoration[] = []
findChildren(doc, node => node.type.name === name)
.forEach(block => {
let from = block.pos + 1
const { language } = block.node.attrs
const language = block.node.attrs.language || defaultLanguage
console.log({ language, defaultLanguage })
const languages = lowlight.listLanguages()
const nodes = language && languages.includes(language)
? getHighlightNodes(lowlight.highlight(language, block.node.textContent))
@@ -60,12 +66,17 @@ function getDecorations({ doc, name, lowlight }: { doc: ProsemirrorNode, name: s
return DecorationSet.create(doc, decorations)
}
export function LowlightPlugin({ name, lowlight }: { name: string, lowlight: any }) {
export function LowlightPlugin({ name, lowlight, defaultLanguage }: { name: string, lowlight: any, defaultLanguage: string | null | undefined }) {
return new Plugin({
key: new PluginKey('lowlight'),
state: {
init: (_, { doc }) => getDecorations({ doc, name, lowlight }),
init: (_, { doc }) => getDecorations({
doc,
name,
lowlight,
defaultLanguage,
}),
apply: (transaction, decorationSet, oldState, newState) => {
const oldNodeName = oldState.selection.$head.parent.type.name
const newNodeName = newState.selection.$head.parent.type.name
@@ -97,7 +108,12 @@ export function LowlightPlugin({ name, lowlight }: { name: string, lowlight: any
})
)
) {
return getDecorations({ doc: transaction.doc, name, lowlight })
return getDecorations({
doc: transaction.doc,
name,
lowlight,
defaultLanguage,
})
}
return decorationSet.map(transaction.mapping, transaction.doc)

View File

@@ -3,6 +3,22 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [2.0.0-beta.40](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-floating-menu@2.0.0-beta.39...@tiptap/extension-floating-menu@2.0.0-beta.40) (2021-11-08)
**Note:** Version bump only for package @tiptap/extension-floating-menu
# [2.0.0-beta.39](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-floating-menu@2.0.0-beta.38...@tiptap/extension-floating-menu@2.0.0-beta.39) (2021-11-05)
**Note:** Version bump only for package @tiptap/extension-floating-menu
# [2.0.0-beta.38](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-floating-menu@2.0.0-beta.37...@tiptap/extension-floating-menu@2.0.0-beta.38) (2021-10-31)
**Note:** Version bump only for package @tiptap/extension-floating-menu

View File

@@ -1,7 +1,7 @@
{
"name": "@tiptap/extension-floating-menu",
"description": "floating-menu extension for tiptap",
"version": "2.0.0-beta.38",
"version": "2.0.0-beta.40",
"homepage": "https://tiptap.dev",
"keywords": [
"tiptap",
@@ -25,8 +25,8 @@
},
"dependencies": {
"prosemirror-state": "^1.3.4",
"prosemirror-view": "^1.20.3",
"tippy.js": "^6.3.2"
"prosemirror-view": "^1.22.0",
"tippy.js": "^6.3.4"
},
"repository": {
"type": "git",

View File

@@ -3,6 +3,22 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [2.0.0-beta.33](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-focus@2.0.0-beta.32...@tiptap/extension-focus@2.0.0-beta.33) (2021-11-08)
**Note:** Version bump only for package @tiptap/extension-focus
# [2.0.0-beta.32](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-focus@2.0.0-beta.31...@tiptap/extension-focus@2.0.0-beta.32) (2021-11-05)
**Note:** Version bump only for package @tiptap/extension-focus
# [2.0.0-beta.31](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-focus@2.0.0-beta.30...@tiptap/extension-focus@2.0.0-beta.31) (2021-10-31)
**Note:** Version bump only for package @tiptap/extension-focus

View File

@@ -1,7 +1,7 @@
{
"name": "@tiptap/extension-focus",
"description": "focus extension for tiptap",
"version": "2.0.0-beta.31",
"version": "2.0.0-beta.33",
"homepage": "https://tiptap.dev",
"keywords": [
"tiptap",
@@ -25,7 +25,7 @@
},
"dependencies": {
"prosemirror-state": "^1.3.4",
"prosemirror-view": "^1.20.3"
"prosemirror-view": "^1.22.0"
},
"repository": {
"type": "git",

View File

@@ -3,6 +3,17 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [2.0.0-beta.27](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-hard-break@2.0.0-beta.26...@tiptap/extension-hard-break@2.0.0-beta.27) (2021-11-05)
### Bug Fixes
* prevent adding hard breaks in isolated nodes ([9247fcb](https://github.com/ueberdosis/tiptap/commit/9247fcb6cf20493d021664ddce95ad1c23c5a152))
# [2.0.0-beta.26](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-hard-break@2.0.0-beta.25...@tiptap/extension-hard-break@2.0.0-beta.26) (2021-10-31)
**Note:** Version bump only for package @tiptap/extension-hard-break

View File

@@ -1,7 +1,7 @@
{
"name": "@tiptap/extension-hard-break",
"description": "hard break extension for tiptap",
"version": "2.0.0-beta.26",
"version": "2.0.0-beta.27",
"homepage": "https://tiptap.dev",
"keywords": [
"tiptap",

View File

@@ -57,10 +57,16 @@ export const HardBreak = Node.create<HardBreakOptions>({
return commands.first([
() => commands.exitCode(),
() => commands.command(() => {
const { selection, storedMarks } = state
if (selection.$from.parent.type.spec.isolating) {
return false
}
const { keepMarks } = this.options
const { splittableMarks } = editor.extensionManager
const marks = state.storedMarks
|| (state.selection.$to.parentOffset && state.selection.$from.marks())
const marks = storedMarks
|| (selection.$to.parentOffset && selection.$from.marks())
return chain()
.insertContent({ type: this.name })

View File

@@ -3,6 +3,17 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [2.0.0-beta.27](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-horizontal-rule@2.0.0-beta.26...@tiptap/extension-horizontal-rule@2.0.0-beta.27) (2021-11-08)
### Bug Fixes
* Improve behavior when using insertContent ([#2147](https://github.com/ueberdosis/tiptap/issues/2147)) ([8fc915c](https://github.com/ueberdosis/tiptap/commit/8fc915cade394bff2015be1e1e2d7c008e8c908e))
# [2.0.0-beta.26](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-horizontal-rule@2.0.0-beta.25...@tiptap/extension-horizontal-rule@2.0.0-beta.26) (2021-10-31)
**Note:** Version bump only for package @tiptap/extension-horizontal-rule

View File

@@ -1,7 +1,7 @@
{
"name": "@tiptap/extension-horizontal-rule",
"description": "horizontal rule extension for tiptap",
"version": "2.0.0-beta.26",
"version": "2.0.0-beta.27",
"homepage": "https://tiptap.dev",
"keywords": [
"tiptap",

View File

@@ -45,35 +45,18 @@ export const HorizontalRule = Node.create<HorizontalRuleOptions>({
return {
setHorizontalRule: () => ({ chain }) => {
return chain()
// remove node before hr if its an empty text block
.command(({ tr, dispatch }) => {
const { selection } = tr
const { empty, $anchor } = selection
const isEmptyTextBlock = $anchor.parent.isTextblock
&& !$anchor.parent.type.spec.code
&& !$anchor.parent.textContent
if (!empty || !isEmptyTextBlock || !dispatch) {
return true
}
const from = $anchor.before()
const to = $anchor.start()
tr.deleteRange(from, to)
tr.setSelection(TextSelection.create(tr.doc, from))
return true
})
.insertContent({ type: this.name })
// add node after hr if its the end of the document
// set cursor after horizontal rule
.command(({ tr, dispatch }) => {
if (dispatch) {
const { parent, pos } = tr.selection.$from
const posAfter = pos + 1
const nodeAfter = tr.doc.nodeAt(posAfter)
if (!nodeAfter) {
if (nodeAfter) {
tr.setSelection(TextSelection.create(tr.doc, posAfter))
} else {
// add node after horizontal rule if its the end of the document
const node = parent.type.contentMatch.defaultType?.create()
if (node) {

View File

@@ -3,6 +3,22 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [2.0.0-beta.83](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-mention@2.0.0-beta.82...@tiptap/extension-mention@2.0.0-beta.83) (2021-11-08)
**Note:** Version bump only for package @tiptap/extension-mention
# [2.0.0-beta.82](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-mention@2.0.0-beta.81...@tiptap/extension-mention@2.0.0-beta.82) (2021-11-05)
**Note:** Version bump only for package @tiptap/extension-mention
# [2.0.0-beta.81](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-mention@2.0.0-beta.80...@tiptap/extension-mention@2.0.0-beta.81) (2021-10-31)
**Note:** Version bump only for package @tiptap/extension-mention

View File

@@ -1,7 +1,7 @@
{
"name": "@tiptap/extension-mention",
"description": "mention extension for tiptap",
"version": "2.0.0-beta.81",
"version": "2.0.0-beta.83",
"homepage": "https://tiptap.dev",
"keywords": [
"tiptap",
@@ -24,7 +24,7 @@
"@tiptap/core": "^2.0.0-beta.1"
},
"dependencies": {
"@tiptap/suggestion": "^2.0.0-beta.77",
"@tiptap/suggestion": "^2.0.0-beta.79",
"prosemirror-model": "^1.15.0",
"prosemirror-state": "^1.3.4"
},

View File

@@ -3,6 +3,22 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [2.0.0-beta.40](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-placeholder@2.0.0-beta.39...@tiptap/extension-placeholder@2.0.0-beta.40) (2021-11-08)
**Note:** Version bump only for package @tiptap/extension-placeholder
# [2.0.0-beta.39](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-placeholder@2.0.0-beta.38...@tiptap/extension-placeholder@2.0.0-beta.39) (2021-11-05)
**Note:** Version bump only for package @tiptap/extension-placeholder
# [2.0.0-beta.38](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-placeholder@2.0.0-beta.37...@tiptap/extension-placeholder@2.0.0-beta.38) (2021-10-31)
**Note:** Version bump only for package @tiptap/extension-placeholder

View File

@@ -1,7 +1,7 @@
{
"name": "@tiptap/extension-placeholder",
"description": "placeholder extension for tiptap",
"version": "2.0.0-beta.38",
"version": "2.0.0-beta.40",
"homepage": "https://tiptap.dev",
"keywords": [
"tiptap",
@@ -26,7 +26,7 @@
"dependencies": {
"prosemirror-model": "^1.15.0",
"prosemirror-state": "^1.3.4",
"prosemirror-view": "^1.20.3"
"prosemirror-view": "^1.22.0"
},
"repository": {
"type": "git",

View File

@@ -3,6 +3,22 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [2.0.0-beta.39](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-table@2.0.0-beta.38...@tiptap/extension-table@2.0.0-beta.39) (2021-11-08)
**Note:** Version bump only for package @tiptap/extension-table
# [2.0.0-beta.38](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-table@2.0.0-beta.37...@tiptap/extension-table@2.0.0-beta.38) (2021-11-05)
**Note:** Version bump only for package @tiptap/extension-table
# [2.0.0-beta.37](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-table@2.0.0-beta.36...@tiptap/extension-table@2.0.0-beta.37) (2021-10-31)
**Note:** Version bump only for package @tiptap/extension-table

View File

@@ -1,7 +1,7 @@
{
"name": "@tiptap/extension-table",
"description": "table extension for tiptap",
"version": "2.0.0-beta.37",
"version": "2.0.0-beta.39",
"homepage": "https://tiptap.dev",
"keywords": [
"tiptap",
@@ -25,7 +25,7 @@
},
"dependencies": {
"prosemirror-tables": "^1.1.1",
"prosemirror-view": "^1.20.3"
"prosemirror-view": "^1.22.0"
},
"repository": {
"type": "git",

View File

@@ -3,6 +3,17 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [2.0.0-beta.25](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-task-item@2.0.0-beta.24...@tiptap/extension-task-item@2.0.0-beta.25) (2021-11-08)
### Bug Fixes
* add checkboxes to TaskItem HTML output, fix [#2037](https://github.com/ueberdosis/tiptap/issues/2037) ([c94d2b0](https://github.com/ueberdosis/tiptap/commit/c94d2b0517e62afea84cb9dd6999874abf0bf3cd))
# [2.0.0-beta.24](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-task-item@2.0.0-beta.23...@tiptap/extension-task-item@2.0.0-beta.24) (2021-10-31)
**Note:** Version bump only for package @tiptap/extension-task-item

View File

@@ -1,7 +1,7 @@
{
"name": "@tiptap/extension-task-item",
"description": "task item extension for tiptap",
"version": "2.0.0-beta.24",
"version": "2.0.0-beta.25",
"homepage": "https://tiptap.dev",
"keywords": [
"tiptap",

View File

@@ -45,12 +45,32 @@ export const TaskItem = Node.create<TaskItemOptions>({
]
},
renderHTML({ HTMLAttributes }) {
return ['li', mergeAttributes(
renderHTML({ node, HTMLAttributes }) {
return [
'li',
mergeAttributes(
this.options.HTMLAttributes,
HTMLAttributes,
{ 'data-type': 'taskItem' },
), 0]
),
[
'label',
[
'input',
{
type: 'checkbox',
checked: node.attrs.checked
? 'checked'
: null,
},
],
['span'],
],
[
'div',
0,
],
]
},
addKeyboardShortcuts() {

View File

@@ -3,6 +3,30 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [2.0.0-beta.132](https://github.com/ueberdosis/tiptap/compare/@tiptap/html@2.0.0-beta.131...@tiptap/html@2.0.0-beta.132) (2021-11-08)
**Note:** Version bump only for package @tiptap/html
# [2.0.0-beta.131](https://github.com/ueberdosis/tiptap/compare/@tiptap/html@2.0.0-beta.130...@tiptap/html@2.0.0-beta.131) (2021-11-08)
**Note:** Version bump only for package @tiptap/html
# [2.0.0-beta.130](https://github.com/ueberdosis/tiptap/compare/@tiptap/html@2.0.0-beta.129...@tiptap/html@2.0.0-beta.130) (2021-11-05)
**Note:** Version bump only for package @tiptap/html
# [2.0.0-beta.129](https://github.com/ueberdosis/tiptap/compare/@tiptap/html@2.0.0-beta.128...@tiptap/html@2.0.0-beta.129) (2021-10-31)
**Note:** Version bump only for package @tiptap/html

View File

@@ -1,7 +1,7 @@
{
"name": "@tiptap/html",
"description": "utility package to render tiptap JSON as HTML",
"version": "2.0.0-beta.129",
"version": "2.0.0-beta.132",
"homepage": "https://tiptap.dev",
"keywords": [
"tiptap",
@@ -21,7 +21,7 @@
"dist"
],
"dependencies": {
"@tiptap/core": "^2.0.0-beta.130",
"@tiptap/core": "^2.0.0-beta.133",
"hostic-dom": "^0.8.7",
"prosemirror-model": "^1.15.0"
},

View File

@@ -3,6 +3,22 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [2.0.0-beta.89](https://github.com/ueberdosis/tiptap/compare/@tiptap/react@2.0.0-beta.88...@tiptap/react@2.0.0-beta.89) (2021-11-08)
**Note:** Version bump only for package @tiptap/react
# [2.0.0-beta.88](https://github.com/ueberdosis/tiptap/compare/@tiptap/react@2.0.0-beta.87...@tiptap/react@2.0.0-beta.88) (2021-11-05)
**Note:** Version bump only for package @tiptap/react
# [2.0.0-beta.87](https://github.com/ueberdosis/tiptap/compare/@tiptap/react@2.0.0-beta.86...@tiptap/react@2.0.0-beta.87) (2021-10-31)
**Note:** Version bump only for package @tiptap/react

View File

@@ -1,7 +1,7 @@
{
"name": "@tiptap/react",
"description": "React components for tiptap",
"version": "2.0.0-beta.87",
"version": "2.0.0-beta.89",
"homepage": "https://tiptap.dev",
"keywords": [
"tiptap",
@@ -21,8 +21,8 @@
"dist"
],
"devDependencies": {
"@types/react": "^17.0.32",
"@types/react-dom": "^17.0.10",
"@types/react": "^17.0.34",
"@types/react-dom": "^17.0.11",
"react": "^17.0.0",
"react-dom": "^17.0.0"
},
@@ -32,9 +32,9 @@
"react-dom": "^17.0.0"
},
"dependencies": {
"@tiptap/extension-bubble-menu": "^2.0.0-beta.44",
"@tiptap/extension-floating-menu": "^2.0.0-beta.38",
"prosemirror-view": "^1.20.3"
"@tiptap/extension-bubble-menu": "^2.0.0-beta.46",
"@tiptap/extension-floating-menu": "^2.0.0-beta.40",
"prosemirror-view": "^1.22.0"
},
"repository": {
"type": "git",

View File

@@ -3,6 +3,30 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [2.0.0-beta.135](https://github.com/ueberdosis/tiptap/compare/@tiptap/starter-kit@2.0.0-beta.134...@tiptap/starter-kit@2.0.0-beta.135) (2021-11-08)
**Note:** Version bump only for package @tiptap/starter-kit
# [2.0.0-beta.134](https://github.com/ueberdosis/tiptap/compare/@tiptap/starter-kit@2.0.0-beta.133...@tiptap/starter-kit@2.0.0-beta.134) (2021-11-08)
**Note:** Version bump only for package @tiptap/starter-kit
# [2.0.0-beta.133](https://github.com/ueberdosis/tiptap/compare/@tiptap/starter-kit@2.0.0-beta.132...@tiptap/starter-kit@2.0.0-beta.133) (2021-11-05)
**Note:** Version bump only for package @tiptap/starter-kit
# [2.0.0-beta.132](https://github.com/ueberdosis/tiptap/compare/@tiptap/starter-kit@2.0.0-beta.131...@tiptap/starter-kit@2.0.0-beta.132) (2021-10-31)
**Note:** Version bump only for package @tiptap/starter-kit

View File

@@ -1,7 +1,7 @@
{
"name": "@tiptap/starter-kit",
"description": "starter kit for tiptap",
"version": "2.0.0-beta.132",
"version": "2.0.0-beta.135",
"homepage": "https://tiptap.dev",
"keywords": [
"tiptap",
@@ -21,7 +21,7 @@
"dist"
],
"dependencies": {
"@tiptap/core": "^2.0.0-beta.130",
"@tiptap/core": "^2.0.0-beta.133",
"@tiptap/extension-blockquote": "^2.0.0-beta.21",
"@tiptap/extension-bold": "^2.0.0-beta.21",
"@tiptap/extension-bullet-list": "^2.0.0-beta.20",
@@ -30,10 +30,10 @@
"@tiptap/extension-document": "^2.0.0-beta.13",
"@tiptap/extension-dropcursor": "^2.0.0-beta.21",
"@tiptap/extension-gapcursor": "^2.0.0-beta.30",
"@tiptap/extension-hard-break": "^2.0.0-beta.26",
"@tiptap/extension-hard-break": "^2.0.0-beta.27",
"@tiptap/extension-heading": "^2.0.0-beta.20",
"@tiptap/extension-history": "^2.0.0-beta.18",
"@tiptap/extension-horizontal-rule": "^2.0.0-beta.26",
"@tiptap/extension-horizontal-rule": "^2.0.0-beta.27",
"@tiptap/extension-italic": "^2.0.0-beta.21",
"@tiptap/extension-list-item": "^2.0.0-beta.16",
"@tiptap/extension-ordered-list": "^2.0.0-beta.21",

View File

@@ -3,6 +3,22 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [2.0.0-beta.79](https://github.com/ueberdosis/tiptap/compare/@tiptap/suggestion@2.0.0-beta.78...@tiptap/suggestion@2.0.0-beta.79) (2021-11-08)
**Note:** Version bump only for package @tiptap/suggestion
# [2.0.0-beta.78](https://github.com/ueberdosis/tiptap/compare/@tiptap/suggestion@2.0.0-beta.77...@tiptap/suggestion@2.0.0-beta.78) (2021-11-05)
**Note:** Version bump only for package @tiptap/suggestion
# [2.0.0-beta.77](https://github.com/ueberdosis/tiptap/compare/@tiptap/suggestion@2.0.0-beta.76...@tiptap/suggestion@2.0.0-beta.77) (2021-10-31)
**Note:** Version bump only for package @tiptap/suggestion

View File

@@ -1,7 +1,7 @@
{
"name": "@tiptap/suggestion",
"description": "suggestion plugin for tiptap",
"version": "2.0.0-beta.77",
"version": "2.0.0-beta.79",
"homepage": "https://tiptap.dev",
"keywords": [
"tiptap",
@@ -26,7 +26,7 @@
"dependencies": {
"prosemirror-model": "^1.15.0",
"prosemirror-state": "^1.3.4",
"prosemirror-view": "^1.20.3"
"prosemirror-view": "^1.22.0"
},
"repository": {
"type": "git",

View File

@@ -3,6 +3,22 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [2.0.0-beta.64](https://github.com/ueberdosis/tiptap/compare/@tiptap/vue-2@2.0.0-beta.63...@tiptap/vue-2@2.0.0-beta.64) (2021-11-08)
**Note:** Version bump only for package @tiptap/vue-2
# [2.0.0-beta.63](https://github.com/ueberdosis/tiptap/compare/@tiptap/vue-2@2.0.0-beta.62...@tiptap/vue-2@2.0.0-beta.63) (2021-11-05)
**Note:** Version bump only for package @tiptap/vue-2
# [2.0.0-beta.62](https://github.com/ueberdosis/tiptap/compare/@tiptap/vue-2@2.0.0-beta.61...@tiptap/vue-2@2.0.0-beta.62) (2021-10-31)
**Note:** Version bump only for package @tiptap/vue-2

View File

@@ -1,7 +1,7 @@
{
"name": "@tiptap/vue-2",
"description": "Vue components for tiptap",
"version": "2.0.0-beta.62",
"version": "2.0.0-beta.64",
"homepage": "https://tiptap.dev",
"keywords": [
"tiptap",
@@ -28,9 +28,9 @@
"vue": "^2.6.0"
},
"dependencies": {
"@tiptap/extension-bubble-menu": "^2.0.0-beta.44",
"@tiptap/extension-floating-menu": "^2.0.0-beta.38",
"prosemirror-view": "^1.20.3"
"@tiptap/extension-bubble-menu": "^2.0.0-beta.46",
"@tiptap/extension-floating-menu": "^2.0.0-beta.40",
"prosemirror-view": "^1.22.0"
},
"repository": {
"type": "git",

View File

@@ -3,6 +3,22 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [2.0.0-beta.76](https://github.com/ueberdosis/tiptap/compare/@tiptap/vue-3@2.0.0-beta.75...@tiptap/vue-3@2.0.0-beta.76) (2021-11-08)
**Note:** Version bump only for package @tiptap/vue-3
# [2.0.0-beta.75](https://github.com/ueberdosis/tiptap/compare/@tiptap/vue-3@2.0.0-beta.74...@tiptap/vue-3@2.0.0-beta.75) (2021-11-05)
**Note:** Version bump only for package @tiptap/vue-3
# [2.0.0-beta.74](https://github.com/ueberdosis/tiptap/compare/@tiptap/vue-3@2.0.0-beta.73...@tiptap/vue-3@2.0.0-beta.74) (2021-10-31)
**Note:** Version bump only for package @tiptap/vue-3

View File

@@ -1,7 +1,7 @@
{
"name": "@tiptap/vue-3",
"description": "Vue components for tiptap",
"version": "2.0.0-beta.74",
"version": "2.0.0-beta.76",
"homepage": "https://tiptap.dev",
"keywords": [
"tiptap",
@@ -28,10 +28,10 @@
"vue": "^3.0.0"
},
"dependencies": {
"@tiptap/extension-bubble-menu": "^2.0.0-beta.44",
"@tiptap/extension-floating-menu": "^2.0.0-beta.38",
"@tiptap/extension-bubble-menu": "^2.0.0-beta.46",
"@tiptap/extension-floating-menu": "^2.0.0-beta.40",
"prosemirror-state": "^1.3.4",
"prosemirror-view": "^1.20.3"
"prosemirror-view": "^1.22.0"
},
"repository": {
"type": "git",

View File

@@ -1,9 +1,15 @@
import { onMounted, onBeforeUnmount, shallowRef } from 'vue'
import {
onMounted,
onBeforeUnmount,
shallowRef,
Ref,
} from 'vue'
import { EditorOptions } from '@tiptap/core'
import { Editor } from './Editor'
export const useEditor = (options: Partial<EditorOptions> = {}) => {
const editor = shallowRef<Editor>()
// We set a custom return type. Otherwise TypeScript will throw TS4023. Not sure why.
export const useEditor = (options: Partial<EditorOptions> = {}): Ref<Editor> => {
const editor = shallowRef<Editor>() as Ref<Editor>
onMounted(() => {
editor.value = new Editor(options)

View File

@@ -9,6 +9,12 @@ describe('fromString', () => {
expect(value).to.eq('test')
})
it('should return an empty string', () => {
const value = fromString('')
expect(value).to.eq('')
})
it('should convert to a number', () => {
const value = fromString('1')

1868
yarn.lock

File diff suppressed because it is too large Load Diff