Skip to content

Commit

Permalink
Merge pull request #5095 from nextcloud/feat/gapcursor
Browse files Browse the repository at this point in the history
feat(editor): Enable gapcursor, allows to put cursor between images
  • Loading branch information
mejo- committed Dec 6, 2023
2 parents eb2563a + 4f7bc37 commit c442ff8
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 9 deletions.
20 changes: 20 additions & 0 deletions package-lock.json

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

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
"@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",
Expand Down
6 changes: 0 additions & 6 deletions src/components/Editor/MediaHandler.vue
Original file line number Diff line number Diff line change
Expand Up @@ -203,14 +203,8 @@ export default {
// subsequent editor inserts (see tiptap#3355). So unselect the image by placing
// the cursor at the end of the selection.
this.$editor.commands.focus(selection.to)
} else {
// Place the cursor after the inserted image node
this.$editor.commands.focus(selection.to + 2)
}
// Insert a newline to allow placing the cursor in between subsequent images
this.$editor.chain().insertContent('<br />').focus().run()
// Scroll image into view
this.$editor.commands.scrollIntoView()
Expand Down
8 changes: 5 additions & 3 deletions src/extensions/RichText.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,24 +32,25 @@ import Code from '@tiptap/extension-code'
import CodeBlock from './../nodes/CodeBlock.js'
import Document from '@tiptap/extension-document'
import Dropcursor from '@tiptap/extension-dropcursor'
import EditableTable from './../nodes/EditableTable.js'
import Emoji from './Emoji.js'
import EmojiSuggestion from './../components/Suggestion/Emoji/suggestions.js'
import FrontMatter from './../nodes/FrontMatter.js'
import Paragraph from './../nodes/Paragraph.js'
import Gapcursor from '@tiptap/extension-gapcursor'
import HardBreak from './../nodes/HardBreak.js'
import Heading from '../nodes/Heading/index.js'
import HorizontalRule from '@tiptap/extension-horizontal-rule'
import Image from './../nodes/Image.js'
import ImageInline from './../nodes/ImageInline.js'
import KeepSyntax from './KeepSyntax.js'
import LinkPicker from './../extensions/LinkPicker.js'
import ListItem from '@tiptap/extension-list-item'
import Markdown from './../extensions/Markdown.js'
import Mention from './../extensions/Mention.js'
import LinkPicker from './../extensions/LinkPicker.js'
import OrderedList from '@tiptap/extension-ordered-list'
import Paragraph from './../nodes/Paragraph.js'
import Placeholder from '@tiptap/extension-placeholder'
import Table from './../nodes/Table.js'
import EditableTable from './../nodes/EditableTable.js'
import TaskItem from './../nodes/TaskItem.js'
import TaskList from './../nodes/TaskList.js'
import Text from '@tiptap/extension-text'
Expand Down Expand Up @@ -104,6 +105,7 @@ export default Extension.create({
Image,
ImageInline,
Dropcursor,
Gapcursor,
KeepSyntax,
FrontMatter,
Mention,
Expand Down

0 comments on commit c442ff8

Please sign in to comment.