1
0

chore(editor): format

This commit is contained in:
kolaente 2023-10-21 11:52:20 +02:00
parent 3bf806f00c
commit e81c98fe5b
No known key found for this signature in database
GPG Key ID: F40E70337AB24C9B
3 changed files with 121 additions and 123 deletions

View File

@ -44,7 +44,7 @@ export default {
}, },
methods: { methods: {
onKeyDown({ event }) { onKeyDown({event}) {
if (event.key === 'ArrowUp') { if (event.key === 'ArrowUp') {
this.upHandler() this.upHandler()
return true return true
@ -86,19 +86,16 @@ export default {
} }
</script> </script>
<style lang="scss"> <style lang="scss" scoped>
.items { .items {
padding: 0.2rem; padding: 0.2rem;
position: relative; position: relative;
border-radius: 0.5rem; border-radius: 0.5rem;
background: #FFF; background: #fff;
color: rgba(0, 0, 0, 0.8); color: rgba(0, 0, 0, 0.8);
overflow: hidden; overflow: hidden;
font-size: 0.9rem; font-size: 0.9rem;
box-shadow: box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.05), 0px 10px 20px rgba(0, 0, 0, 0.1);
0 0 0 1px rgba(0, 0, 0, 0.05),
0px 10px 20px rgba(0, 0, 0, 0.1),
;
} }
.item { .item {

View File

@ -1,4 +1,4 @@
import { Extension } from '@tiptap/core' import {Extension} from '@tiptap/core'
import Suggestion from '@tiptap/suggestion' import Suggestion from '@tiptap/suggestion'
// Copied and adjusted from https://github.com/ueberdosis/tiptap/tree/252acb32d27a0f9af14813eeed83d8a50059a43a/demos/src/Experiments/Commands/Vue // Copied and adjusted from https://github.com/ueberdosis/tiptap/tree/252acb32d27a0f9af14813eeed83d8a50059a43a/demos/src/Experiments/Commands/Vue
@ -10,8 +10,8 @@ export default Extension.create({
return { return {
suggestion: { suggestion: {
char: '/', char: '/',
command: ({ editor, range, props }) => { command: ({editor, range, props}) => {
props.command({ editor, range }) props.command({editor, range})
}, },
}, },
} }

View File

@ -1,36 +1,37 @@
import { VueRenderer } from '@tiptap/vue-3' import {VueRenderer} from '@tiptap/vue-3'
import tippy from 'tippy.js' import tippy from 'tippy.js'
import CommandsList from './CommandsList.vue' import CommandsList from './CommandsList.vue'
export default { export default {
items: ({ query }) => { items: ({query}: { query: string }) => {
return [ return [
{ {
title: 'H1', title: 'H1',
command: ({ editor, range }) => { command: ({editor, range}) => {
editor editor
.chain() .chain()
.focus() .focus()
.deleteRange(range) .deleteRange(range)
.setNode('heading', { level: 1 }) .setNode('heading', {level: 1})
.run() .run()
}, },
}, },
{ {
title: 'H2', title: 'H2',
command: ({ editor, range }) => { description: 'Lorem ipsum',
command: ({editor, range}) => {
editor editor
.chain() .chain()
.focus() .focus()
.deleteRange(range) .deleteRange(range)
.setNode('heading', { level: 2 }) .setNode('heading', {level: 2})
.run() .run()
}, },
}, },
{ {
title: 'bold', title: 'bold',
command: ({ editor, range }) => { command: ({editor, range}) => {
editor editor
.chain() .chain()
.focus() .focus()
@ -41,7 +42,7 @@ export default {
}, },
{ {
title: 'italic', title: 'italic',
command: ({ editor, range }) => { command: ({editor, range}) => {
editor editor
.chain() .chain()
.focus() .focus()
@ -54,7 +55,7 @@ export default {
}, },
render: () => { render: () => {
let component let component: VueRenderer
let popup let popup
return { return {