New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Generate a link for @-Mentionings #462
Conversation
f9903b3
to
359fbd2
Compare
@appinteractive we have `yarn run lint` on our build server. I would say this is enough to enforce linting. I get slowed down a little during development. Instead of runing `yarn run lint --fix` every time I save, I would like to `yarn run lint --fix` all in one before I commit.
All components should consist of a folder with these three files: ``` README.d index.vue spec.js ``` When you import components, omit the `index.vue`. That helps to `git grep` for component names.
359fbd2
to
f5cf3d9
Compare
Note that we don't create duplicate notifications. I made use of the behaviour of XSS-middleware: It removes all css classes from `<a>` anchors. Because notifications rely on a css class `mention` which gets removed in a later middleware, this gives us a nice behaviour for re-notifications without creating duplicates. The downside is that it creates dependencies between middlewares and it's not that obvious at all. cc @mattwr18 @ulfgebhardt @appinteractive @Tirokk
This will help some people not to loose data after accidently clicking on the user @-mentioning.
…ning_link_in_editor
}) | ||
|
||
describe('given a link with .mention class', () => { | ||
it('extracts ids', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I pulled down the code and added a went to /post/create
, and was playing around with the updated Editor
, it seems really nice to me.
One thing I did was to add a mention, and then inspected and looked at the link and it doesn't seem to be added a .mention
class as I was suspecting based on the tests, but maybe this is removed in xssMiddleware
as your comment 👇 suggests?
<a href="/profile/u2" target="_blank">@bob-der-baumeister</a>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One of the things I noticed about this PR
is the editor has some features I hadn't noticed before
there are validations on creating a Post
with a title, which must be between 3 to 64 characters.
The mentions drop down is a nice addition.
I did notice that I am able to mention myself, which might be a refactor?
Overall, unless anyone else comes in with reasons we shouldn't get this merged, I am approving the changes as they are a great improvement and it is well tested.
@mattwr18 unfortunately the frontend is not well tested. For the reasons above. Good catch that you are able to mention yourself 😉 I noticed this and used it for manual testing. Maybe we don't even have to prevent this and you can happily notifiy yourself if you want. 😆 Let's wait for sb. to ask for the prevention. Regarding the |
Pullrequest
I'm not able to provide proper testing of the
Editor
component. When I unskip this test case I getTypeError: this.view.root.getSelection is not a function
. I tried to find working component tests in their repo but unfortunately the entire library seems to be untested 🙀 there are no traces in package.json or issue list. I would be super glad if sb. could help me out on writing component tests for the Editor of if sb. has ideas how to resolve the above error.Regarding the implementation: This PR sticks extremely close to their example code. It's basically copy-paste from here. That means I added tippy.js which gives animated tooltips and fuse.js which does fuzzy search in the list of suggestions. I can see the value of
fuse.js
but I would question the need fortippy
. @appinteractive are tooltips and the suggestions menu sth. easy to implement? Opinions? If we implement it ourselves, we could at least test some parts of the editor.After understanding how tiptap works, my task was just to create a custom
Mention
node. The original code which I overrode is Mention.js.Oh yeah and one last thing. I'm fetching the entire user collection (id+slug) here.
Issues
Checklist
How2Test
@
in the content field.Todo
Full stack trace: