Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions cypress/e2e/nodes/Mentions.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ describe('Test mentioning users', () => {

return cy.wait(`@${requestAlias}`)
.then(() => {
cy.get('.tippy-box .items').children().should(($children) => {
cy.get('.tippy-box .suggestion-list').children().should(($children) => {
const users = $children.map((i, el) => el.innerText).get()
expect(users.length).to.be.greaterThan(0)
expect(mention).to.be.oneOf(users)
Expand Down Expand Up @@ -78,7 +78,7 @@ describe('Test mentioning users', () => {

return cy.wait(`@${autocompleteReauestAlias}`)
.then(() => {
cy.get('.tippy-box .items').contains(mention).click()
cy.get('.tippy-box .suggestion-list').contains(mention).click()
cy.get('span.mention').contains(mention).should('be.visible')
})
})
Expand Down
4 changes: 2 additions & 2 deletions js/editor.js

Large diffs are not rendered by default.

42 changes: 42 additions & 0 deletions js/editor.js.LICENSE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,27 @@
*
*/

/*
* @copyright Copyright (c) 2022 Julius Härtl <[email protected]>
*
* @author Julius Härtl <[email protected]>
*
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

/*
* @copyright Copyright (c) 2022 Max <[email protected]>
*
Expand Down Expand Up @@ -269,6 +290,27 @@
*
*/

/*
* @copyright Copyright (c) 2022 Julius Härtl <[email protected]>
*
* @author Julius Härtl <[email protected]>
*
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */

/**
Expand Down
2 changes: 1 addition & 1 deletion js/editor.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions js/files-modal.js

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

2 changes: 1 addition & 1 deletion js/files-modal.js.map

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

4 changes: 2 additions & 2 deletions js/text-files.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/text-files.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions js/text-public.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/text-public.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions js/text-text.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/text-text.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions js/text-viewer.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/text-viewer.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions js/vendors.js

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions js/vendors.js.LICENSE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@
* @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
*/

/*! For license information please see NcHighlight.js.LICENSE.txt */

/*! For license information please see index.module.js.LICENSE.txt */

/*! Hammer.JS - v2.0.7 - 2016-04-22
Expand Down
2 changes: 1 addition & 1 deletion js/vendors.js.map

Large diffs are not rendered by default.

24 changes: 15 additions & 9 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"@nextcloud/moment": "^1.2.1",
"@nextcloud/router": "^2.0.1",
"@nextcloud/vue": "^7.5.0",
"@nextcloud/vue-richtext": "^2.0.4",
"@nextcloud/vue-richtext": "^2.1.0-beta.1",
"@quartzy/markdown-it-mentions": "^0.2.0",
"@tiptap/core": "^2.0.0-beta.209",
"@tiptap/extension-blockquote": "^2.0.0-beta.209",
Expand Down
57 changes: 3 additions & 54 deletions src/EditorFactory.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,14 @@ import Placeholder from '@tiptap/extension-placeholder'
/* eslint-enable import/no-named-as-default */

import TrailingNode from './nodes/TrailingNode.js'
import EmojiListWrapper from './components/EmojiListWrapper.vue'
import EditableTable from './nodes/EditableTable.js'
import MentionSuggestion from './components/Mention/suggestion.js'
import MentionSuggestion from './components/Suggestion/Mention/suggestions.js'
import EmojiSuggestion from './components/Suggestion/Emoji/suggestions.js'

import tippy from 'tippy.js'
import 'proxy-polyfill'

import { Editor } from '@tiptap/core'
import { VueRenderer } from '@tiptap/vue-2'
import { translate as t } from '@nextcloud/l10n'
import { emojiSearch } from '@nextcloud/vue'
import { lowlight } from 'lowlight/lib/core.js'
import hljs from 'highlight.js'

Expand Down Expand Up @@ -79,55 +76,7 @@ const createEditor = ({ content, onCreate, onUpdate, extensions, enableRichEditi
],
}),
Emoji.configure({
suggestion: {
items: ({ query }) => {
return emojiSearch(query)
},
render: () => {
let component
let popup

return {
onStart: props => {
component = new VueRenderer(EmojiListWrapper, {
parent: this,
propsData: props,
})

popup = tippy('body', {
getReferenceClientRect: props.clientRect,
appendTo: () => document.body,
content: component.element,
showOnCreate: true,
interactive: true,
trigger: 'manual',
placement: 'bottom-start',
})
},

onUpdate(props) {
component.updateProps(props)
popup[0].setProps({
getReferenceClientRect: props.clientRect,
})
},

onKeyDown(props) {
if (props.event.key === 'Escape') {
component.destroy()
popup[0].destroy()
return true
}
return component.ref?.onKeyDown(props)
},

onExit() {
popup[0].destroy()
component.destroy()
},
}
},
},
suggestion: EmojiSuggestion(),
}),
Placeholder.configure({
emptyNodeClass: 'is-empty',
Expand Down
Loading