# Feature OP-8298 - Handle advanced mentions (##id, ###id) in CkEditor

Project: OpenProject
Status: new
URL: https://community.openproject.org/work_packages/OP-8298

## Planning

| Attribute | Value |
| --- | --- |
| Date |  |
| Priority | Medium |
| Target versions | Wish List |
| Sprint |  |
| Backlog bucket |  |
| Votes |  |
| List |  |
| Roadmap |  |
| Relevance |  |

## OPEN POINTS / FEEDBACK

_No work packages_

## Features and Chunks

_No work packages_

## Bugs and other work packages

_No work packages_

## Technical Details

| Attribute | Value |
| --- | --- |
| Module |  |
| Feature Flag |  |
| Requires doc change | No |
| Enterprise plan |  |

## Details

| Attribute | Value |
| --- | --- |
| Pull preview |  |
| Mockups |  |
| Accessibility | No |

## People

| Attribute | Value |
| --- | --- |
| Assignee |  |
| Accountable |  |
| Product manager |  |
| Feature Lead |  |
| Developers |  |
| Designer |  |
| Ordered by | Jens Ulferts |
| Signed off by |  |
| Interest by |  |

## Estimates and progress

| Attribute | Value |
| --- | --- |
| PD (min) |  |
| PD (max) |  |
| Work |  |
| Labor costs |  |

## Description

Currently, the advanced mentions are handled in the backend and properly shown in the display view (HTML):

<figure class="image op-uc-figure" style="width:75%;"><div class="op-uc-figure--content"><img class="op-uc-image" src="/api/v3/attachments/20568/content"></div></figure>

But in the editing view (CkEditor) they are shown as text:

<figure class="image op-uc-figure" style="width:75%;"><div class="op-uc-figure--content"><img class="op-uc-image" src="/api/v3/attachments/20569/content"></div></figure>

### 

### Tasks

- [ ] Define how should the mentions be shown in the editing view (CkEditor).
- [ ] Extend the mentions plugin functionality so it recognizes and displays advanced mentions ('\#\#' and '\#\#\#') properly.
- [ ] Update backend to handle advanced mentions from mention elements (\<mention data-id="\#\#\#7"\>). Probably currently it is default mentions (\<mention data-id="\#7"\>).

### Questions

  - Do we have advanced mentions for users (e.g. @@@id)?

### Development Notes

  - We have two ways of handling wp mentions:
      - Old: markdown contains '\#id' when a mention suggestion is clicked.
          - This is also the way it works if we don't select the wp from the suggestions.
      - New: markdown contains '\<mention data-id...' when a mention suggestion is clicked.
  - Backend:
      - Three different scenarios/responses:

\- If we add '\#id' without choosing a suggestion (it is also the case for old mentions I guess), the wp link is shown in the display view but it is just a string in the editing view. Sample call:

<figure class="image op-uc-figure"><div class="op-uc-figure--content"><img class="op-uc-image" src="/api/v3/attachments/20533/content"></div></figure>

\- If we add '\#\#id' without choosing a suggestion (the current issue), nothing is shown in the display view but the string is shown in the editing view. Sample call:

<figure class="image op-uc-figure"><div class="op-uc-figure--content"><img class="op-uc-image" src="/api/v3/attachments/20534/content"></div></figure>

\- If we choose an options suggestions, a 'mention' tag is added to the markdown and it is correctly displayed in both views (display and editing). Sample call:

<figure class="image op-uc-figure"><div class="op-uc-figure--content"><img class="op-uc-image" src="/api/v3/attachments/20535/content"></div></figure>

  - Random issues:
      - \<mention\> has nested \<a\> in their HTML version.
      - data-mention property has '@\#id'
      - Sometimes link contains undefined
