Skip to content
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
4 changes: 2 additions & 2 deletions js/editor.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/editor.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions js/text-editors.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/text-editors.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions js/text-files.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/text-files.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions js/text-public.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/text-public.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions js/text-text.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/text-text.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions js/text-viewer.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/text-viewer.js.map

Large diffs are not rendered by default.

36 changes: 18 additions & 18 deletions src/nodes/Table/TableCell.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,27 +37,27 @@ export default TableCell.extend({
return [
new Plugin({
props: {
// Special-treat empty lines in pasted content to prevent jumping out of cell
// Only paste (marked) text into table cells to prevent jumping out of cell
handlePaste: (view, event, slice) => {
if (slice.content.childCount > 1) {
const state = view.state
const childCount = slice.content.childCount
const childNodes = []
for (let i = 0; i < childCount; i++) {
if (i === 0) {
childNodes.push(state.schema.text('\n'))
}

// Ignore empty children (i.e. empty lines)
if (!slice.content.child(i).firstChild) {
continue
}
if (!this.editor.isActive(this.type.name)) {
return false
}

childNodes.push(state.schema.text(slice.content.child(i).textContent, slice.content.child(i).firstChild.marks))
const { state } = view
const childNodes = []
let newLineAdded = false
slice.content.descendants((node, pos) => {
if (node.isText) {
childNodes.push(state.schema.text(node.textContent, node.marks))
newLineAdded = false
} else if (!newLineAdded) {
childNodes.push(state.schema.text('\n'))
newLineAdded = true
}
const newNode = view.state.schema.node('paragraph', [], childNodes)
slice.content = Fragment.empty.addToStart(newNode)
}
})

const newNode = state.schema.node('paragraph', [], childNodes)
slice.content = Fragment.empty.addToStart(newNode)
},
},
}),
Expand Down