Apparently the default pasteRules of tiptap interfere with the
pasteRules of a Link (in our case an Embed node). Consider this example:
https://de.wikipedia.org/wiki/Yin_und_Yang
Depending on some random conditions, tiptap might parse the `_und_` to be
italic because it's wrapped with underscores (markdown syntax). The
result is:
https://de.wikipedia.org/wiki/Yin # link
_und_ # italic
Yang # plain text
So let's remove the default pasteRules of `Bold`, `Strike` and `Italic`
marks respectively to prefer our Embeds. Who is copy+pasting from one
tiptap editor to another tiptap editor anyways?
* Add target="_blank" (on embeds only!)
* When pasting a link, the cursor position is moved after the paste
* Can't reproduce a link slipping into the embed in front of it
@Tirokk it is an unpleasant side efffect that mentions + hastags appear
differently on Edit+View. That's because they don't get parsed from
HTML, it's a one way, they are write only. So, when viewing content,
hashtags and mentions appear as plain links. I don't think I can do
anything about it.
Regarding some links not being embedded: Only those links that have an
oembed provider in this file:
f44d0f1f96/backend/src/schema/resolvers/embeds/providers.json
...will be embedded. Your example `http://backreaction.blogspot.com` and `https://de.wikipedia.org/wiki/Yin_und_Yang`
have no embed provider and won't be embedded.
We would have to add oembed providers to this list if we wanted to embed those
links, too.
Our build server failed because of frontend tests. However, all our
fullstack tests are passing... So maybe an issue in our test setup, not
reproducible in a real browser?
This commit:
ee4f132b0f (diff-0806c5f3fdae5e139222967601c7faca)
adds MutationObserver to their test setup. Adding it to our test suites
that touch the `editor` directly fixes our tests, too!
From what I can tell is that prosemirror is calling
`this.observer.takeRecords()`. Probably `tiptap` updated its
dependencies at some point and that's where `this.observer` was
introduced? Hard to tell. It really looks just like an issue only
present in test environments, so I think it's safe not to investigate
any further.
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
```
This reverts commit ec19c732e5678544d8dfd50c25f2c33e5aeb217e.
Ok, native module URL cannot parse relative URLs. It ensures that all parts
of the URL are present. So I'll revert this to get the ball rolling. We
can refactor out the obsolete page later on.
FYI @Tirokk
@Tirokk there is this neat URL module: https://nodejs.org/api/url.html
It has convenience methods for adding query params. I'm just not quite
sure about browser compatibility though.
Refactor Seeding with Tag ids as Tag names.
In Frontend: Done as a suggestion with all the forbidden chars removed.
In Backend by Regex only the fitting links.
Rewrite backend test to make sure Hashtag „id“ is the name of the Hashtag.
Test for „https://www.example.org/#anchor“
Co-Authored-By: mattwr18 <mattwr18@gmail.com>