mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-13 07:46:06 +00:00
Some important commit messages:
```
Fix youtu.be not being embedded
And also try to maintain the old behaviour matching
`provider.provider_url`.
```
```
Remove confusing code comments and obsolete code
I discovered that the behaviour of no duplicate notifications being send
out is caused by the frontend: When the editor reads html from the
backend, it will parse hashtags and mentions as ordinary links, not as
their respective nodes during editing. Also, we don't have to worry
about duplicate ids being found: The cypher statement will implicitly
suppress duplicate notification nodes for the same user.
So let's remove the code to avoid confusing the next developer.
```
```
Test editor.getHTML()
I do this because I'm not able to test the content of `this.editor` from
a wrapper of `vue-test-utils`. If I call `this.editor.getHTML` directly
and use it as a computed property `renderedContent` to populate a `<div
v-html="renderedContent" />` this will not work for the embeds. So, my
current best bet is to test the editor object isolated from a real
component. ;(
```
```
Add core-js as explicit dependency
Because of build errors on Travis.
See: https://stackoverflow.com/a/55313456
Remove as soon as this issue is resolved:
https://github.com/storybookjs/storybook/issues/7591
```
```
Refactor: Keep Runtime-only builds
See: https://vuejs.org/v2/guide/installation.html#Runtime-Compiler-vs-Runtime-only
```
49 lines
1.1 KiB
JavaScript
49 lines
1.1 KiB
JavaScript
import Embed from '~/components/Editor/nodes/Embed.js'
|
|
import Link from '~/components/Editor/nodes/Link.js'
|
|
import EmbedQuery from '~/graphql/EmbedQuery.js'
|
|
import {
|
|
Heading,
|
|
HardBreak,
|
|
Blockquote,
|
|
ListItem,
|
|
BulletList,
|
|
OrderedList,
|
|
HorizontalRule,
|
|
Placeholder,
|
|
Bold,
|
|
Italic,
|
|
Strike,
|
|
Underline,
|
|
} from 'tiptap-extensions'
|
|
|
|
export default function defaultExtensions(component) {
|
|
const { placeholder, $t, $apollo } = component
|
|
return [
|
|
new Heading(),
|
|
new HardBreak(),
|
|
new Blockquote(),
|
|
new BulletList(),
|
|
new OrderedList(),
|
|
new HorizontalRule(),
|
|
new Bold(),
|
|
new Italic(),
|
|
new Strike(),
|
|
new Underline(),
|
|
new Link(),
|
|
new Heading({ levels: [3, 4] }),
|
|
new ListItem(),
|
|
new Placeholder({
|
|
emptyNodeClass: 'is-empty',
|
|
emptyNodeText: placeholder || $t('editor.placeholder'),
|
|
}),
|
|
new Embed({
|
|
onEmbed: async ({ url }) => {
|
|
const {
|
|
data: { embed },
|
|
} = await $apollo.query({ query: EmbedQuery(), variables: { url } })
|
|
return embed
|
|
},
|
|
}),
|
|
]
|
|
}
|