Skip to content

Commit

Permalink
fix(lint): add missing jsdoc comments to new files
Browse files Browse the repository at this point in the history
Signed-off-by: Max <[email protected]>
  • Loading branch information
max-nextcloud committed Mar 19, 2024
1 parent c06997c commit 0969f2b
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/plugins/linkHelpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@
*
*/

/**
*
* @param {object} state the prosemirror state
* @param {object} state.selection - the current selection
* @param {object} state.doc - the current doc
*/
export function linkNodeFromSelection({ selection, doc }) {
// support for CellSelections
const { ranges } = selection
Expand All @@ -45,6 +51,10 @@ export function linkNodeFromSelection({ selection, doc }) {
return isLinkNode(node) ? node : null
}

/**
* Determine wether the given node is a link node
* @param {object} node - node to check
*/
function isLinkNode(node) {
const linkMark = node?.marks.find(m => m.type.name === 'link')
if (!linkMark) {
Expand Down
12 changes: 12 additions & 0 deletions src/plugins/links.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ export const hideLinkBubble = (state, dispatch) => {
}

export const linkBubbleKey = new PluginKey('linkBubble')
/**
* Prosemirror link bubble plugin
* @param {object} options - options for the link bubble plugin view
*/
export function linkBubble(options) {
const linkBubblePlugin = new Plugin({
key: linkBubbleKey,
Expand Down Expand Up @@ -135,6 +139,14 @@ export function linkBubble(options) {
}

export const linkClickingKey = new PluginKey('textHandleClickLink')

/**
* Prosemirror plugin for special handling for clicks on links
*
* - Open link in new tab on middle click rather than pasting.
* - Only open link on ctrl/cmd + left click.
* We use the link bubble otherwise.
*/
export function linkClicking() {
return new Plugin({
key: linkClickingKey,
Expand Down

0 comments on commit 0969f2b

Please sign in to comment.