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

fix(deps): update tiptap to ^2.2.4 (main) #5238

Merged
merged 6 commits into from
Apr 4, 2024
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
1 change: 1 addition & 0 deletions cypress/e2e/sections.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ describe('Content Sections', () => {
})

beforeEach(function() {
cy.clearAllSessionStorage()
cy.login(user)
cy.createTestFolder().then(folderName => {
currentFolder = folderName
Expand Down
960 changes: 536 additions & 424 deletions package-lock.json

Large diffs are not rendered by default.

74 changes: 37 additions & 37 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,43 +50,43 @@
"@nextcloud/router": "^3.0.0",
"@nextcloud/vue": "^8.11.1",
"@quartzy/markdown-it-mentions": "^0.2.0",
"@tiptap/core": "^2.1.13",
"@tiptap/extension-blockquote": "^2.1.13",
"@tiptap/extension-bold": "^2.1.13",
"@tiptap/extension-bullet-list": "^2.1.13",
"@tiptap/extension-character-count": "^2.1.13",
"@tiptap/extension-code": "^2.1.13",
"@tiptap/extension-code-block": "^2.1.13",
"@tiptap/extension-code-block-lowlight": "^2.1.13",
"@tiptap/extension-collaboration": "^2.1.13",
"@tiptap/extension-collaboration-cursor": "^2.1.13",
"@tiptap/extension-document": "^2.1.13",
"@tiptap/extension-dropcursor": "^2.1.13",
"@tiptap/extension-gapcursor": "^2.1.13",
"@tiptap/extension-hard-break": "^2.1.13",
"@tiptap/extension-heading": "^2.1.13",
"@tiptap/extension-history": "^2.1.13",
"@tiptap/extension-horizontal-rule": "^2.1.13",
"@tiptap/extension-image": "^2.1.13",
"@tiptap/extension-italic": "^2.1.13",
"@tiptap/extension-link": "^2.1.13",
"@tiptap/extension-list-item": "^2.1.13",
"@tiptap/extension-mention": "^2.1.13",
"@tiptap/extension-ordered-list": "^2.1.13",
"@tiptap/extension-paragraph": "^2.1.13",
"@tiptap/extension-placeholder": "^2.1.13",
"@tiptap/extension-strike": "^2.1.13",
"@tiptap/extension-table": "^2.1.13",
"@tiptap/extension-table-cell": "^2.1.13",
"@tiptap/extension-table-header": "^2.1.13",
"@tiptap/extension-table-row": "^2.1.13",
"@tiptap/extension-task-item": "^2.1.13",
"@tiptap/extension-task-list": "^2.1.13",
"@tiptap/extension-text": "^2.1.13",
"@tiptap/extension-underline": "^2.1.13",
"@tiptap/pm": "^2.1.13",
"@tiptap/suggestion": "^2.1.13",
"@tiptap/vue-2": "^2.1.13",
"@tiptap/core": "^2.2.4",
"@tiptap/extension-blockquote": "^2.2.4",
"@tiptap/extension-bold": "^2.2.4",
"@tiptap/extension-bullet-list": "^2.2.4",
"@tiptap/extension-character-count": "^2.2.4",
"@tiptap/extension-code": "^2.2.4",
"@tiptap/extension-code-block": "^2.2.4",
"@tiptap/extension-code-block-lowlight": "^2.2.4",
"@tiptap/extension-collaboration": "^2.2.4",
"@tiptap/extension-collaboration-cursor": "^2.2.4",
"@tiptap/extension-document": "^2.2.4",
"@tiptap/extension-dropcursor": "^2.2.4",
"@tiptap/extension-gapcursor": "^2.2.4",
"@tiptap/extension-hard-break": "^2.2.4",
"@tiptap/extension-heading": "^2.2.4",
"@tiptap/extension-history": "^2.2.4",
"@tiptap/extension-horizontal-rule": "^2.2.4",
"@tiptap/extension-image": "^2.2.4",
"@tiptap/extension-italic": "^2.2.4",
"@tiptap/extension-link": "^2.2.4",
"@tiptap/extension-list-item": "^2.2.4",
"@tiptap/extension-mention": "^2.2.4",
"@tiptap/extension-ordered-list": "^2.2.4",
"@tiptap/extension-paragraph": "^2.2.4",
"@tiptap/extension-placeholder": "^2.2.4",
"@tiptap/extension-strike": "^2.2.4",
"@tiptap/extension-table": "^2.2.4",
"@tiptap/extension-table-cell": "^2.2.4",
"@tiptap/extension-table-header": "^2.2.4",
"@tiptap/extension-table-row": "^2.2.4",
"@tiptap/extension-task-item": "^2.2.4",
"@tiptap/extension-task-list": "^2.2.4",
"@tiptap/extension-text": "^2.2.4",
"@tiptap/extension-underline": "^2.2.4",
"@tiptap/pm": "^2.2.4",
"@tiptap/suggestion": "^2.2.4",
"@tiptap/vue-2": "^2.2.4",
"@vueuse/shared": "^10.9.0",
"debounce": "^2.0.0",
"escape-html": "^1.0.3",
Expand Down
2 changes: 1 addition & 1 deletion src/extensions/Mention.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export default TipTapMention.extend({
return [
'span',
mergeAttributes({ 'data-type': 'user', class: 'mention' }, this.options.HTMLAttributes, HTMLAttributes),
this.options.renderLabel({
this.options.renderHTML({
options: this.options,
node,
}),
Expand Down
2 changes: 1 addition & 1 deletion src/marks/Link.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ const Link = TipTapLink.extend({
const plugins = this.parent()
// remove upstream link click handle plugin
.filter(({ key }) => {
return !key.startsWith('handleClickLink')
return !key.startsWith('handleClickLink') && !key.startsWith('textHandleClickLink')
})

// Custom click handler plugins
Expand Down
17 changes: 15 additions & 2 deletions src/nodes/CodeBlock.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import TiptapCodeBlockLowlight from '@tiptap/extension-code-block-lowlight'
import { defaultMarkdownSerializer } from '@tiptap/pm/markdown'
import { VueNodeViewRenderer } from '@tiptap/vue-2'
import CodeBlockView from './CodeBlockView.vue'

Expand All @@ -25,7 +24,21 @@ const CodeBlock = TiptapCodeBlockLowlight.extend({
toMarkdown(state, node, parent, index) {
// @tiptap/pm/markdown uses `params` instead of `language` attribute
node.attrs.params = node.attrs.language
return defaultMarkdownSerializer.nodes.code_block(state, node, parent, index)

// After https://github.com/ProseMirror/prosemirror-markdown/pull/90 the upstream markdown serialization
// is no longer comparible with our extraction stripping the last new line, so we keep a reverted copy
// to stay consistent with our unit tests

// Make sure the front matter fences are longer than any dash sequence within it
const backticks = node.textContent.match(/`{3,}/gm)
const fence = backticks ? (backticks.sort().slice(-1)[0] + '`') : '```'

state.write(fence + (node.attrs.params || '') + '\n')
state.text(node.textContent, false)
// Add a newline to the current content before adding closing marker
state.ensureNewLine()
state.write(fence)
state.closeBlock(node)
},

addNodeView() {
Expand Down
2 changes: 1 addition & 1 deletion src/nodes/Heading/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const onUpdate = debounce(({ editor }) => {
// Only run if editor still exists (prevent dangling debounced extractHeadings function)
extractHeadings(editor)
}
}, 900)
}, 900, { immediate: true })

const Heading = TipTapHeading.extend({
addAttributes() {
Expand Down
4 changes: 3 additions & 1 deletion src/services/SyncService.js
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,9 @@ class SyncService {
}

_autosave() {
return this.save({ manualSave: false })
return this.save({ manualSave: false }).catch((error) => {
logger.error('Failed to autosave document.', { error })
})
}

async close() {
Expand Down
Loading